Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

add download link to module page / fix some perl syntax highlighting issues #242

Merged
merged 2 commits into from

2 participants

@mauke

No description provided.

mauke added some commits
@mauke mauke add download link to module page (#228) 0969154
@mauke mauke fix a few perl syntax highlighting bugs
- comment highlighting could bleed into the next line, as seen on
  https://metacpan.org/source/ATRIPPS/File-Tail-Multi-0.1/Multi.pm

- "#!" was treated as a shebang even in the middle of a line/file

- "*" was missing from the list of variable sigils

- __END__ was matched case-insensitively and __DATA__ was missing

- general cleanup of the regexes
9cb4055
@oalders oalders merged commit 884f0c3 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 16, 2011
  1. @mauke
  2. @mauke

    fix a few perl syntax highlighting bugs

    mauke authored
    - comment highlighting could bleed into the next line, as seen on
      https://metacpan.org/source/ATRIPPS/File-Tail-Multi-0.1/Multi.pm
    
    - "#!" was treated as a shebang even in the middle of a line/file
    
    - "*" was missing from the list of variable sigils
    
    - __END__ was matched case-insensitively and __DATA__ was missing
    
    - general cleanup of the regexes
This page is out of date. Refresh to see the latest.
Showing with 38 additions and 37 deletions.
  1. +1 −0  root/module.html
  2. +37 −37 root/static/js/shBrushPerl.js
View
1  root/module.html
@@ -15,6 +15,7 @@
<ul>
<li><strong class="relatize"><% module.date.dt_http %></strong></li>
<% IF module.module.0.version %><li>Module version: <% module.module.0.version %></li><% END %>
+ <li><a href="<% release.download_url %>">Download</a> (<% release.stat.size | format_bytes %>)</li>
<li>
<a href="/source/<% module.author %>/<% module.release %>/<% module.path %>">Source</a>
(<a href="<% api %>/source/<% module.author %>/<% module.release %>/<% module.path %>">raw</a>)
View
74 root/static/js/shBrushPerl.js
@@ -7,7 +7,7 @@
*
* @version
* 3.0.83 (July 02 2010)
- *
+ *
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
@@ -22,54 +22,54 @@
function Brush()
{
// Contributed by David Simmons-Duffin and Marty Kube
-
- var funcs =
- 'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' +
- 'chroot close closedir connect cos crypt defined delete each endgrent ' +
- 'endhostent endnetent endprotoent endpwent endservent eof exec exists ' +
- 'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' +
- 'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' +
- 'getnetbyname getnetent getpeername getpgrp getppid getpriority ' +
- 'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' +
- 'getservbyname getservbyport getservent getsockname getsockopt glob ' +
- 'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' +
- 'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' +
- 'oct open opendir ord pack pipe pop pos print printf prototype push ' +
- 'quotemeta rand read readdir readline readlink readpipe recv rename ' +
- 'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' +
- 'semget semop send setgrent sethostent setnetent setpgrp setpriority ' +
- 'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' +
- 'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' +
- 'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' +
- 'system syswrite tell telldir time times tr truncate uc ucfirst umask ' +
+
+ var funcs =
+ 'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' +
+ 'chroot close closedir connect cos crypt defined delete each endgrent ' +
+ 'endhostent endnetent endprotoent endpwent endservent eof exec exists ' +
+ 'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' +
+ 'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' +
+ 'getnetbyname getnetent getpeername getpgrp getppid getpriority ' +
+ 'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' +
+ 'getservbyname getservbyport getservent getsockname getsockopt glob ' +
+ 'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' +
+ 'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' +
+ 'oct open opendir ord pack pipe pop pos print printf prototype push ' +
+ 'quotemeta rand read readdir readline readlink readpipe recv rename ' +
+ 'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' +
+ 'semget semop send setgrent sethostent setnetent setpgrp setpriority ' +
+ 'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' +
+ 'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' +
+ 'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' +
+ 'system syswrite tell telldir time times tr truncate uc ucfirst umask ' +
'undef unlink unpack unshift utime values vec wait waitpid warn write';
-
- var keywords =
+
+ var keywords =
'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' +
- 'for foreach goto if import last local my next no our package redo ref ' +
+ 'for foreach goto if import last local my next no our package redo ref ' +
'require return sub tie tied unless untie until use wantarray while ' +
// Try::Tiny
- 'try catch finally ' +
+ 'try catch finally ' +
// Moose
'has extends with before after around override augment';
-
+
this.regexList = [
- { regex: new RegExp('#[^!].*$', 'gm'), css: 'comments' },
- { regex: new RegExp('^\\s*#!.*$', 'gm'), css: 'preprocessor' }, // shebang
- { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
- { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
- { regex: new RegExp('(\\$|@|%|\\$#)\\w+', 'g'), css: 'variable' },
- { regex: new RegExp('__END__(.|\\n|\\r)*', 'gi'), css: 'comments' },
- { regex: new RegExp('^=\\w+(.|\\n|\\r)*?^=cut\\s*$', 'mg'), css: 'comments' },
- { regex: new RegExp(this.getKeywords(funcs), 'gm'), css: 'functions' },
- { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
+ { regex: /#.*$/gm, css: 'comments' },
+ { regex: /^#!.*\n/g, css: 'preprocessor' }, // shebang
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
+ { regex: /(?:[$@%*]|\$#)\w+/g, css: 'variable' },
+ { regex: /\b__(?:END|DATA)__\b[\s\S]*$/g, css: 'comments' },
+ { regex: /^=\w[\s\S]*?\n=cut\s*$/gm, css: 'comments' },
+ { regex: new RegExp(this.getKeywords(funcs), 'gm'), css: 'functions' },
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
];
this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
}
- Brush.prototype = new SyntaxHighlighter.Highlighter();
- Brush.aliases = ['perl', 'Perl', 'pl'];
+ Brush.prototype = new SyntaxHighlighter.Highlighter();
+ Brush.aliases = ['perl', 'Perl', 'pl'];
SyntaxHighlighter.brushes.Perl = Brush;
Something went wrong with that request. Please try again.