"Fossies" - the Fresh Open Source Software Archive

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

    1 --[[
    2 Sample plugin file for highlight 3.9
    3 ]]
    4 
    5 Description="Add perldoc.perl.org reference links to HTML, LaTeX, RTF and ODT output of Perl code"
    6 
    7 Categories = {"perl", "html", "rtf", "latex", "odt" }
    8 
    9 -- optional parameter: syntax description
   10 function syntaxUpdate(desc)
   11 
   12   if desc~="Perl" then
   13     return
   14   end
   15 
   16   function Set (list)
   17     local set = {}
   18     for _, l in ipairs(list) do set[l] = true end
   19       return set
   20   end
   21 
   22   function_items = Set {"chomp", "chop", "chr", "crypt", "hex", "index", "lc",
   23     "lcfirst", "length", "oct", "ord", "pack", "qq", "reverse", "rindex", "sprintf",
   24     "substr", "tr", "uc", "ucfirst,",  "pos", "quotemeta", "split", "study",
   25     "qr", "abs", "atan2", "cos", "exp", "hex", "int", "log", "oct", "rand", "sin",
   26     "sqrt", "srand", "each", "keys", "pop", "push", "shift", "splice", "unshift",
   27     "values", "grep", "join", "map", "qw", "reverse", "sort", "unpack", "delete",
   28     "each", "exists", "keys", "values", "binmode", "close", "closedir", "dbmclose",
   29     "dbmopen", "die", "eof", "fileno", "flock", "format", "getc", "print", "printf",
   30     "read", "readdir", "rewinddir", "say", "seek", "seekdir", "select", "syscall",
   31     "sysread", "sysseek", "syswrite", "tell", "telldir", "truncate", "warn",
   32     "write", "pack", "read", "syscall", "sysread", "syswrite", "unpack", "vec",
   33     "chdir", "chmod", "chown", "chroot", "fcntl", "glob", "ioctl", "link", "lstat",
   34     "mkdir", "open", "opendir", "readlink", "rename", "rmdir", "stat", "symlink",
   35     "sysopen", "umask", "unlink", "utime", "caller", "continue", "die", "do",
   36     "dump", "eval", "exit", "goto", "last", "next", "redo", "return", "sub",
   37     "wantarray", "continue",  "caller", "import", "local", "my", "our",
   38     "package", "state", "use", "defined", "dump", "eval", "formline", "local", "my",
   39     "our", "reset", "scalar", "state", "undef", "wantarray", "alarm", "exec",
   40     "fork", "getpgrp", "getppid", "getpriority", "kill", "pipe", "qx", "setpgrp",
   41     "setpriority", "sleep", "system", "times", "wait", "waitpid", "do", "import",
   42     "no", "package", "require", "use", "bless", "dbmclose", "dbmopen", "package",
   43     "ref", "tie", "tied", "untie", "use", "accept", "bind", "connect",
   44     "getpeername", "getsockname", "getsockopt", "listen", "recv", "send",
   45     "setsockopt", "shutdown", "socket", "socketpair", "msgctl", "msgget", "msgrcv",
   46     "msgsnd", "semctl", "semget", "semop", "shmctl", "shmget", "shmread",
   47     "shmwrite", "endgrent", "endhostent", "endnetent", "endpwent", "getgrent",
   48     "getgrgid", "getgrnam", "getlogin", "getpwent", "getpwnam", "getpwuid",
   49     "setgrent", "setpwent", "endprotoent", "endservent", "gethostbyaddr",
   50     "gethostbyname", "gethostent", "getnetbyaddr", "getnetbyname", "getnetent",
   51     "getprotobyname", "getprotobynumber", "getprotoent", "getservbyname",
   52     "getservbyport", "getservent", "sethostent", "setnetent", "setprotoent",
   53     "setservent", "gmtime", "localtime", "time", "times", "abs", "bless", "chomp",
   54     "chr", "continue", "exists", "formline", "glob", "import", "lc", "lcfirst",
   55     "lock", "map", "my", "no", "our", "prototype", "qr", "qw", "qx", "readline",
   56     "readpipe", "ref", "sub*", "sysopen", "tie", "tied", "uc", "ucfirst", "untie",
   57     "use", "binmode", "chmod", "chown", "chroot", "crypt", "dbmclose", "dbmopen",
   58     "dump", "endgrent", "endhostent", "endnetent", "endprotoent", "endpwent",
   59     "endservent", "exec", "fcntl", "flock", "fork", "getgrent", "getgrgid",
   60     "gethostbyname", "gethostent", "getlogin", "getnetbyaddr", "getnetbyname",
   61     "getnetent", "getppid", "getpgrp", "getpriority", "getprotobynumber",
   62     "getprotoent", "getpwent", "getpwnam", "getpwuid", "getservbyport",
   63     "getservent", "getsockopt", "glob", "ioctl", "kill", "link", "lstat", "msgctl",
   64     "msgget", "msgrcv", "msgsnd", "open", "pipe", "readlink", "rename", "select",
   65     "semctl", "semget", "semop", "setgrent", "sethostent", "setnetent", "setpgrp",
   66     "setpriority", "setprotoent", "setpwent", "setservent", "setsockopt", "shmctl",
   67     "shmget", "shmread", "shmwrite", "socket", "socketpair", "stat", "symlink",
   68     "syscall", "sysopen", "system", "times", "truncate", "umask", "unlink", "utime",
   69     "wait", "waitpid" }
   70 
   71   function getURL(token)
   72     url='http://perldoc.perl.org/functions/'..string.lower(token).. '.html'
   73 
   74     if (HL_OUTPUT== HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
   75       return '<a class="hl" target="new" href="' .. url .. '">'.. token .. '</a>'
   76     elseif (HL_OUTPUT == HL_FORMAT_LATEX) then
   77       return '\\href{'..url..'}{'..token..'}'
   78     elseif (HL_OUTPUT == HL_FORMAT_RTF) then
   79       return '{{\\field{\\*\\fldinst HYPERLINK "'..url..'" }{\\fldrslt\\ul\\ulc0 '..token..'}}}'
   80     elseif (HL_OUTPUT == HL_FORMAT_ODT) then
   81       return '<text:a xlink:type="simple" xlink:href="'..url..'">'..token..'</text:a>'
   82     end
   83   end
   84 
   85 
   86   function Decorate(token, state)
   87 
   88     if  (state ~= HL_STANDARD and state ~= HL_KEYWORD) then
   89       return
   90     end
   91 
   92     if function_items[token] then
   93       return getURL(token)
   94     end
   95 
   96   end
   97 end
   98 
   99 function themeUpdate(desc)
  100   if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
  101     Injections[#Injections+1]="a.hl, a.hl:visited {color:inherit;font-weight:inherit;}"
  102   elseif (HL_OUTPUT==HL_FORMAT_LATEX) then
  103     Injections[#Injections+1]="\\usepackage[colorlinks=false, pdfborderstyle={/S/U/W 1}]{hyperref}"
  104   end
  105 end
  106 --The Plugins array assigns code chunks to themes or language definitions.
  107 --The chunks are interpreted after the theme or lang file were parsed,
  108 --so you can refer to elements of these files
  109 
  110 Plugins={
  111 
  112   { Type="lang", Chunk=syntaxUpdate },
  113   { Type="theme", Chunk=themeUpdate },
  114 
  115 }