Adobe 65007312 Programming Guide - Page 136
Using custom tags, Custom tag example
UPC - 883919154398
View all Adobe 65007312 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 136 highlights
CHAPTER 6: Writing a Web-engine Plug-in Web SDK tagsets 136 end, myCloseTagFunction = function( ) --body of function end, } tags = { myTag = { startTag = "myOpenTagFunction()", endTag = "myCloseTagFunction()", } } If you import this tag into the xmpl namespace, your LuaPage would reference the tag like this: Helloworld At run time, when the LuaPage is evaluated, the tags are replaced with the Lua code, and the contents is simply written out: myOpenTagFunction() write( [[Helloworld]] ) myCloseTagFunction() This code is then evaluated to produce the final HTML for your web gallery page. Using custom tags To use a tagset that you have defined in your web-engine plug-in: 1. Include the tagset definition file or files in the root directory of your web engine. 2. Add a line to import the tagset in your manifest.lrweb file: importTags( "lr", "pathToTagsetFile" ) This includes all of the tags defined in the file under the namespace lr. The namespace definition prevents conflicts with tags of the same name defined in other tagset libraries. You can use any namespace for your own tags. 3. To load the built-in default tagset, substitute the special value "com.adobe.lightroom.default" for the path: importTags( "lr", "com.adobe.lightroom.default" ) By convention, the built-in tags are imported into the lr namespace. 4. To use the defined tags in your LuaPages, use the namespace prefix for both the opening and closing tag. For example: ... Custom tag example Here is an example that simply wraps some constant text around the text specified as the content of the tag: 1. Define the tag and its supporting function in the tagset file, myTags.lua: globals = { myFn = function( x )