"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/plugins/cpp_ref_wxwidgets_org.lua" (12 May 2020, 1858 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 "cpp_ref_wxwidgets_org.lua": 3.53_vs_3.54.

    1 --[[
    2 Sample plugin file for highlight 3.9
    3 ]]
    4 
    5 Description="Add wxwidgets.org reference links to HTML, LaTeX, RTF or ODT output of C++ code"
    6 
    7 Categories = {"c++", "wxwidgets", "html", "rtf", "latex", "odt" }
    8 
    9 -- optional parameter: syntax description
   10 function syntaxUpdate(desc)
   11 
   12   if desc~="C and C++" then
   13     return
   14   end
   15 
   16   function getURL(token)
   17     urltoken, cnt = string.gsub(token, "%u", "_%1")
   18     url='http://docs.wxwidgets.org/trunk/class'..string.lower(urltoken).. '.html'
   19 
   20     if (HL_OUTPUT== HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
   21       return '<a class="hl" target="new" href="' .. url .. '">'.. token .. '</a>'
   22     elseif (HL_OUTPUT == HL_FORMAT_LATEX) then
   23       return '\\href{'..url..'}{'..token..'}'
   24     elseif (HL_OUTPUT == HL_FORMAT_RTF) then
   25       return '{{\\field{\\*\\fldinst HYPERLINK "'..url..'" }{\\fldrslt\\ul\\ulc0 '..token..'}}}'
   26     elseif (HL_OUTPUT == HL_FORMAT_ODT) then
   27       return '<text:a xlink:type="simple" xlink:href="'..url..'">'..token..'</text:a>'
   28     end
   29   end
   30 
   31 
   32   function Decorate(token, state)
   33 
   34     if (state ~= HL_STANDARD and state ~= HL_KEYWORD ) then
   35       return
   36     end
   37 
   38     if string.find(token, "wx%u")==1 then
   39       return  getURL(token)
   40     end
   41 
   42   end
   43 end
   44 
   45 
   46 function themeUpdate(desc)
   47   if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
   48     Injections[#Injections+1]="a.hl, a.hl:visited {color:inherit;font-weight:inherit;}"
   49   elseif (HL_OUTPUT==HL_FORMAT_LATEX) then
   50     Injections[#Injections+1]="\\usepackage[colorlinks=false, pdfborderstyle={/S/U/W 1}]{hyperref}"
   51   end
   52 end
   53 
   54 
   55 --The Plugins array assigns code chunks to themes or language definitions.
   56 --The chunks are interpreted after the theme or lang file were parsed,
   57 --so you can refer to elements of these files
   58 
   59 Plugins={
   60 
   61   { Type="lang", Chunk=syntaxUpdate },
   62   { Type="theme", Chunk=themeUpdate },
   63 
   64 }