"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/plugins/outhtml_tooltips.lua" (12 May 2020, 904 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.

    1 
    2 Description="Add HTML tooltips within comments linked to circled numbers (format as @tip[tooltip text])"
    3 
    4 Categories = {"format", "html", "usability" }
    5 
    6 function syntaxUpdate(desc)
    7 
    8   ttCnt=0 -- tooltip counter
    9 
   10   table.insert( Keywords,
   11         { Id=102,
   12           Regex=[=[\@tip\[.+\]]=],
   13           Group=0
   14         })
   15 
   16   function Decorate(token, state)
   17     if (HL_OUTPUT ~= HL_FORMAT_HTML and HL_OUTPUT ~= HL_FORMAT_XHTML) then
   18       return
   19     end
   20 
   21     if (state ~= HL_LINE_COMMENT and state ~= HL_BLOCK_COMMENT) then
   22       return
   23     end
   24 
   25     title = string.match(token, "%@tip%[(.+)%]")
   26     if title~=nil then
   27           if ttCnt>19 then ttCnt=0 end
   28           ttCnt = ttCnt + 1
   29       -- use Unicode circle entities 1..20
   30           return '<span style="font-style: normal;" title="' .. title ..'">&#'..(ttCnt + 9311)..';</span>'
   31     end
   32 
   33   end
   34 end
   35 
   36 Plugins={
   37   { Type="lang", Chunk=syntaxUpdate },
   38 }