ENDCODE -- end a code fragment

  • The %ENDCODE% macro and its companion %CODE% macro are provided by the BeautifierPlugin and are used together to mark the beginning and ending of a code fragment to be beautifully displayed.
  • Syntax: %CODE%%ENDCODE% or %CODE{…}%%ENDCODE%
  • %CODE%%ENDCODE% encapsulates a code fragment to be displayed using the default language syntax and CSS styling
  • %CODE{…}%%ENDCODE% encapsulates a code fragment to be displayed allowing the language syntax and CSS styling to be overridden according to any parameters supplied
  • Supported parameters:
    Parameter: Description: Default
    "language" The language syntax identifier "cpp"
    css="URL" The URL of a CSS stylesheet that extends the plugin's default styling for code fragments  
  • Supported language syntaxes:
    Language: Identifier: Language: Identifier: Language: Identifier:Sorted ascending
    JavaScript "javascript"   Python "python"      
    bash "bash"   Lua "lua"   Scheme "scheme"
    C++ "cpp"   Makefile "makefile"   TCL "tcl"
    C# "csharp"   Perl "perl"   Verilog "verilog"
    HTML "html"   PHP3 "php3"   VHDL "vhdl"
    Java "java"   PL/SQL "plsql"   XML "xml"
    • The Beautifier package supports many, many more language syntaxes but only the languages above have been ported to Foswiki at this point. If you need support for an additional syntax, please open an Enhancement Request to request the syntax you require.
  • DOM Structure: The beautified code fragment is encapsulated within a <pre> element which, in turn, is encapulated within a <div> element which has two CSS class selectors, "fragment" and the language syntax identifier, which is itself encapsulated within a <div> element with the CSS class selector "BeautifierPlugin" as illustrated below.
    • <div class="BeautifierPlugin">
      • <div class=" language fragment">
        • <pre>
          • … beautified code fragment …
        • </pre>
      • </div>
    • </div>
    • Language-specific CSS styling can be applied to the beautified code fragment using CSS selectors of the form div.BeautifierPlugin div.language.fragment
    • Only one extended stylesheet may be supplied for a given topic using either the css="URL" macro parameter or the BEAUTIFIERPLUGIN_CSS preference setting. The final stylesheet specified is the one that will be used. If you wish to specify multiple customizations, combine all the CSS rules into a single stylesheet.

Topic revision: r1 - 09 Apr 2010, UnknownUser
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback