"Fossies" - the Fresh Open Source Software Archive

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

    1 --[[
    2 Sample plugin file for highlight 3.13
    3 ]]
    4 
    5 Description="Add developer.gnome.org reference links to HTML, LeTeX, RTF and ODT output of C++ GTK code"
    6 
    7 Categories = {"c++", "gtk", "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     url='http://developer.gnome.org/gtk3/stable/'..token.. '.html'
   18 
   19     if (HL_OUTPUT== HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
   20       return '<a class="hl" target="new" href="' .. url .. '">'.. token .. '</a>'
   21     elseif (HL_OUTPUT == HL_FORMAT_LATEX) then
   22       return '\\href{'..url..'}{'..token..'}'
   23     elseif (HL_OUTPUT == HL_FORMAT_RTF) then
   24       return '{{\\field{\\*\\fldinst HYPERLINK "'..url..'" }{\\fldrslt\\ul\\ulc0 '..token..'}}}'
   25     elseif (HL_OUTPUT == HL_FORMAT_ODT) then
   26       return '<text:a xlink:type="simple" xlink:href="'..url..'">'..token..'</text:a>'
   27     end
   28   end
   29 
   30   function Decorate(token, state)
   31 
   32     if (state ~= HL_STANDARD and state ~= HL_KEYWORD) then
   33       return
   34     end
   35 
   36     if string.find(token, "Gtk%u%l")==1 then
   37       return getURL(token)
   38     end
   39 
   40   end
   41 end
   42 
   43 
   44 function themeUpdate(desc)
   45   if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
   46     Injections[#Injections+1]="a.hl, a.hl:visited {color:inherit;font-weight:inherit;}"
   47   elseif (HL_OUTPUT==HL_FORMAT_LATEX) then
   48     Injections[#Injections+1]="\\usepackage[colorlinks=false, pdfborderstyle={/S/U/W 1}]{hyperref}"
   49   end
   50 end
   51 --The Plugins array assigns code chunks to themes or language definitions.
   52 --The chunks are interpreted after the theme or lang file were parsed,
   53 --so you can refer to elements of these files
   54 
   55 Plugins={
   56 
   57   { Type="lang", Chunk=syntaxUpdate },
   58   { Type="theme", Chunk=themeUpdate },
   59 
   60 }