"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/plugins/asciidoc_html_add_links.lua" (12 May 2020, 1127 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lua source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "asciidoc_html_add_links.lua": 3.53_vs_3.54.

    1 --[[
    2 Sample plugin file for highlight 3.9
    3 ]]
    4 
    5 Description="Add hyperlinks in AsciiDoc files"
    6 
    7 Categories = {"html", "asciidoc", "hyperlinks"}
    8 
    9 -- optional parameter: syntax description
   10 function syntaxUpdate(desc)
   11 
   12   if desc~="AsciiDoc" then
   13     return
   14   end
   15 
   16   if (HL_OUTPUT ~= HL_FORMAT_HTML and HL_OUTPUT ~= HL_FORMAT_XHTML) then
   17       return
   18   end
   19 
   20 
   21   function Decorate(token, state, kwclass)
   22 
   23     if ( state ~= HL_KEYWORD or  #token == 0) then
   24       return
   25     end
   26 
   27     if kwclass==1 or kwclass==2  then
   28       return '<a href="'..token ..'">'.. token .. '</a>'
   29     end
   30 
   31   end
   32 end
   33 
   34 
   35 function themeUpdate(desc)
   36 
   37   if (HL_OUTPUT ~= HL_FORMAT_HTML and HL_OUTPUT ~= HL_FORMAT_XHTML) then
   38     return
   39   end
   40   -- inherit formatting of enclosing span tags
   41   Injections[#Injections+1]="a.hl, a.hl:visited {color:inherit;font-weight:inherit;}"
   42 end
   43 
   44 --The Plugins array assigns code chunks to themes or language definitions.
   45 --The chunks are interpreted after the theme or lang file were parsed,
   46 --so you can refer to elements of these files
   47 
   48 Plugins={
   49 
   50   { Type="lang", Chunk=syntaxUpdate },
   51   { Type="theme", Chunk=themeUpdate },
   52 
   53 }