"Fossies" - the Fresh Open Source Software Archive

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

    1 --[[
    2 Sample plugin file for highlight 3.9
    3 ]]
    4 
    5 Description="Capitalize keywords if the syntax is not case sensitive."
    6 
    7 Categories = {"format" }
    8 
    9 -- optional parameter: syntax description
   10 function syntaxUpdate(desc)
   11 
   12   if IgnoreCase ~=true then
   13     return
   14   end
   15 
   16   function Decorate(token, state)
   17     if (state == HL_KEYWORD and not token:match("%W")) then
   18       cap=token:gsub("^%l", string.upper) --why do I need cap variable here???
   19       return cap
   20     end
   21   end
   22 
   23 end
   24 
   25 Plugins={
   26 
   27   { Type="lang", Chunk=syntaxUpdate },
   28 
   29 }