Naming convention for custom tags in Lasso

Following naming convention should be followed while giving tag name and namespace to a custom defined tag in Lasso. There is no such rules mentioned for Custom Tag in Lasso, but from my experience I found the following restrictions in defining and calling custom tags. 1. Special characters except underscore (“_”) are not allowed in custom tag name and namespace.

2. Underscore “_” character can be used in tag names but only under following conditions.

i) When you are defining a custom tag in Lasso do not use “_” character in the tag name if a “–Namespace” parameter is used for the tag.

For example: If a tag named as “my_tag” is defined with a namespace as “Ex”, then it is logical that the calling [Ex_my_tag] tag in Lasso code will return you the output of the custom tag “my_tag”.

//Define a custom tag
[Define_Tag: ´my_tag', -Namespace='Ex']
            [Return: ´Hello']
[/Define_Tag]
 
//Calling the tag
[Ex_my_tag]
 
=>      It is expected that the above code [Ex_my_tag] should return "Hello" as output, but in practical calling the above tag will return an error "No tag, type or constant was defined under the name ´Ex_my_tag'".

Reason:
When a custom tag is used in the Lasso program, Lasso interprets the Tag Name as:

  • If the tag is not predefined in Lasso, then it considers the string upto last “_” character in the tag name as the “namespace” of the custom tag and the string after the last “_”character in the tag name as the “Tag Name”.
    If there is no tag defined for the name found after the last “_” with a -Namespace same as the string before found “_” character, the it returns an error that the “No tag, type or constant was defined under the “

In the above instance it will consider the string “Ex_my” as the namespace of the tag and “tag” as the name of the tag. However, it will not find any tag defined for the name “tag” with namespace “Ex_my” and will return an error.

Following is the correct syntax of giving the tag name.

//Define a custom tag
[Define_Tag: ´mytag', -Namespace='Ex']
            [Return: ´Hello']
[/Define_Tag]
 
//Calling the tag
[Ex_mytag]

=>     This will execute successfully and will return the text ´Hello’ as output.

ii) If no –Namespace parameter is used in the [Define_Tag], then you can use “_” character in the Tag Name.

Example:

//Define a custom tag
[Define_Tag: ´my_tag']
            [Return: ´Hello']
[/Define_Tag]
 
//Calling the tag
[my_tag]
 
=>      This will execute successfully and will return the text ´Hello' as output.
150 150 Burnignorance | Where Minds Meet And Sparks Fly!