From: <var...@us...> - 2008-09-05 09:48:10
|
Revision: 6233 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6233&view=rev Author: vargenau Date: 2008-09-05 09:48:17 +0000 (Fri, 05 Sep 2008) Log Message: ----------- Fix bug 1906123: use --inline-css Modified Paths: -------------- trunk/lib/plugin/SyntaxHighlighter.php Modified: trunk/lib/plugin/SyntaxHighlighter.php =================================================================== --- trunk/lib/plugin/SyntaxHighlighter.php 2008-09-05 08:25:32 UTC (rev 6232) +++ trunk/lib/plugin/SyntaxHighlighter.php 2008-09-05 09:48:17 UTC (rev 6233) @@ -162,7 +162,7 @@ $html->pushContent($this->error(fmt("invalid %s ignored",'color'))); $color = false; } - if (!empty($color)) $args .= " --style $color -c ".FindFile("uploads")."/highlight-$color.css"; + if (!empty($color)) $args .= " --style $color --inline-css"; if (!empty($style)) $args .= " -F $style"; $commandLine = HIGHLIGHT_EXE . "$args -q -X -f -S $syntax"; if (check_php_version(4,3,0)) @@ -174,41 +174,13 @@ $pre = HTML::pre(HTML::raw($code)); $pre->setAttr('class','tightenable top bottom'); $html->pushContent($pre); - $css = $GLOBALS['WikiTheme']->_CSSlink('',empty($color) ? 'highlight.css' : "uploads/highlight-$color.css",''); - return HTML($css,$html); + return HTML($html); } else { return $this->error(fmt("empty source")); } } }; -// $Log: not supported by cvs2svn $ -// Revision 1.6 2004/06/29 18:47:40 rurban -// use predefined constants, and added sf.net defaults -// -// Revision 1.5 2004/06/14 11:31:39 rurban -// renamed global $Theme to $WikiTheme (gforge nameclash) -// inherit PageList default options from PageList -// default sortby=pagename -// use options in PageList_Selectable (limit, sortby, ...) -// added action revert, with button at action=diff -// added option regex to WikiAdminSearchReplace -// -// Revision 1.4 2004/05/18 14:49:52 rurban -// Simplified strings for easier translation -// -// Revision 1.3 2004/05/14 17:33:12 rurban -// new plugin RecentChanges -// -// Revision 1.2 2004/05/14 15:56:16 rurban -// protect color argument, more error handling, added default css -// -// Revision 1.1 2004/05/14 14:55:52 rurban -// Alec Thomas original plugin, which comes with highlight http://www.andre-simon.de/, -// plus some extensions by Reini Urban -// -// - // For emacs users // Local Variables: // mode: php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-06-17 13:35:24
|
Revision: 7544 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7544&view=rev Author: vargenau Date: 2010-06-17 13:35:18 +0000 (Thu, 17 Jun 2010) Log Message: ----------- Remove unused function OldFilterThroughCmd Modified Paths: -------------- trunk/lib/plugin/SyntaxHighlighter.php Modified: trunk/lib/plugin/SyntaxHighlighter.php =================================================================== --- trunk/lib/plugin/SyntaxHighlighter.php 2010-06-17 13:22:59 UTC (rev 7543) +++ trunk/lib/plugin/SyntaxHighlighter.php 2010-06-17 13:35:18 UTC (rev 7544) @@ -119,30 +119,6 @@ } } - /* PHP versions < 4.3 - * TODO: via temp file looks more promising - */ - function OldFilterThroughCmd($input, $commandLine) { - $input = str_replace ("\\", "\\\\", $input); - $input = str_replace ("\"", "\\\"", $input); - $input = str_replace ("\$", "\\\$", $input); - $input = str_replace ("`", "\`", $input); - $input = str_replace ("'", "\'", $input); - //$input = str_replace (";", "\;", $input); - - $pipe = popen("echo \"$input\"|$commandLine", 'r'); - if (!$pipe) { - print "pipe failed."; - return ""; - } - $output = ''; - while (!feof($pipe)) { - $output .= fread($pipe, 1024); - } - pclose($pipe); - return $output; - } - function run($dbi, $argstr, &$request, $basepage) { extract($this->getArgs($argstr, $request)); $source =& $this->source; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-11-28 09:46:54
|
Revision: 8563 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8563&view=rev Author: vargenau Date: 2012-11-28 09:46:48 +0000 (Wed, 28 Nov 2012) Log Message: ----------- Remove what has been put in Help page Modified Paths: -------------- trunk/lib/plugin/SyntaxHighlighter.php Modified: trunk/lib/plugin/SyntaxHighlighter.php =================================================================== --- trunk/lib/plugin/SyntaxHighlighter.php 2012-11-27 17:16:31 UTC (rev 8562) +++ trunk/lib/plugin/SyntaxHighlighter.php 2012-11-28 09:46:48 UTC (rev 8563) @@ -25,32 +25,9 @@ * highlighter called "highlight" (available at http://www.andre-simon.de/). * * @author: alecthomas - * - * syntax: See http://www.andre-simon.de/doku/highlight/highlight.html - * style = ["ansi", "gnu", "kr", "java", "linux"] - -<<SyntaxHighlighter syntax=c style=kr color=emacs -#include <stdio.h> - -int main() { -printf("Lalala\n"); -} ->> - -I did not use beautifier, because it used up more than 8M of memory on -my system and PHP killed it. I'm not sure whether this is a problem -with my integration, or with beautifier itself. - -Fixes by Reini Urban: -support options: syntax, style, color. -php version switch -HIGHLIGHT_DATA_DIR, HIGHLIGHT_EXE */ if (!defined('HIGHLIGHT_EXE')) define('HIGHLIGHT_EXE', 'highlight'); -//define('HIGHLIGHT_EXE','/usr/local/bin/highlight'); -//define('HIGHLIGHT_EXE','/home/groups/p/ph/phpwiki/bin/highlight'); - // highlight requires two subdirs themes and langDefs somewhere. // Best by highlight.conf in $HOME, but the webserver user usually // doesn't have a $HOME @@ -59,7 +36,6 @@ define('HIGHLIGHT_DATA_DIR', 'f:\cygnus\usr\local\share\highlight'); else define('HIGHLIGHT_DATA_DIR', '/usr/share/highlight'); -//define('HIGHLIGHT_DATA_DIR','/home/groups/p/ph/phpwiki/share/highlight'); class WikiPlugin_SyntaxHighlighter extends WikiPlugin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-11-28 09:55:12
|
Revision: 8564 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8564&view=rev Author: vargenau Date: 2012-11-28 09:55:05 +0000 (Wed, 28 Nov 2012) Log Message: ----------- Add {} Modified Paths: -------------- trunk/lib/plugin/SyntaxHighlighter.php Modified: trunk/lib/plugin/SyntaxHighlighter.php =================================================================== --- trunk/lib/plugin/SyntaxHighlighter.php 2012-11-28 09:46:48 UTC (rev 8563) +++ trunk/lib/plugin/SyntaxHighlighter.php 2012-11-28 09:55:05 UTC (rev 8564) @@ -100,7 +100,9 @@ // It is important that you close any pipes before calling // proc_close in order to avoid a deadlock $return_value = proc_close($process); - if (empty($buf)) printXML($this->error($stderr)); + if (empty($buf)) { + printXML($this->error($stderr)); + } return $buf; } } @@ -114,21 +116,31 @@ } if (!empty($source)) { $args = ""; - if (defined('HIGHLIGHT_DATA_DIR')) + if (defined('HIGHLIGHT_DATA_DIR')) { $args .= " --data-dir " . HIGHLIGHT_DATA_DIR; - if ($number != 0) $args .= " -l"; - if ($wrap != 0) $args .= " -V"; + } + if ($number != 0) { + $args .= " -l"; + } + if ($wrap != 0) { + $args .= " -V"; + } $html = HTML(); if (!empty($color) and !preg_match('/^[\w-]+$/', $color)) { $html->pushContent($this->error(fmt("invalid %s ignored", 'color'))); $color = false; } - if (!empty($color)) $args .= " --style $color --inline-css"; - if (!empty($style)) $args .= " -F $style"; + if (!empty($color)) { + $args .= " --style $color --inline-css"; + } + if (!empty($style)) { + $args .= " -F $style"; + } $commandLine = HIGHLIGHT_EXE . "$args -q -X -f -S $syntax"; $code = $this->newFilterThroughCmd($source, $commandLine); - if (empty($code)) + if (empty($code)) { return $this->error(fmt("Couldn't start commandline '%s'", $commandLine)); + } $pre = HTML::pre(HTML::raw($code)); $html->pushContent($pre); return HTML($html); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-11-28 10:01:28
|
Revision: 8565 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8565&view=rev Author: vargenau Date: 2012-11-28 10:01:17 +0000 (Wed, 28 Nov 2012) Log Message: ----------- Unused return_value Modified Paths: -------------- trunk/lib/plugin/SyntaxHighlighter.php Modified: trunk/lib/plugin/SyntaxHighlighter.php =================================================================== --- trunk/lib/plugin/SyntaxHighlighter.php 2012-11-28 09:55:05 UTC (rev 8564) +++ trunk/lib/plugin/SyntaxHighlighter.php 2012-11-28 10:01:17 UTC (rev 8565) @@ -99,7 +99,7 @@ fclose($pipes[2]); // It is important that you close any pipes before calling // proc_close in order to avoid a deadlock - $return_value = proc_close($process); + proc_close($process); if (empty($buf)) { printXML($this->error($stderr)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-11-28 10:07:28
|
Revision: 8566 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8566&view=rev Author: vargenau Date: 2012-11-28 10:07:18 +0000 (Wed, 28 Nov 2012) Log Message: ----------- Always return something Modified Paths: -------------- trunk/lib/plugin/SyntaxHighlighter.php Modified: trunk/lib/plugin/SyntaxHighlighter.php =================================================================== --- trunk/lib/plugin/SyntaxHighlighter.php 2012-11-28 10:01:17 UTC (rev 8565) +++ trunk/lib/plugin/SyntaxHighlighter.php 2012-11-28 10:07:18 UTC (rev 8566) @@ -105,6 +105,7 @@ } return $buf; } + return ''; } function run($dbi, $argstr, &$request, $basepage) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-11-28 10:16:25
|
Revision: 8567 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8567&view=rev Author: vargenau Date: 2012-11-28 10:16:18 +0000 (Wed, 28 Nov 2012) Log Message: ----------- Reformat code Modified Paths: -------------- trunk/lib/plugin/SyntaxHighlighter.php Modified: trunk/lib/plugin/SyntaxHighlighter.php =================================================================== --- trunk/lib/plugin/SyntaxHighlighter.php 2012-11-28 10:07:18 UTC (rev 8566) +++ trunk/lib/plugin/SyntaxHighlighter.php 2012-11-28 10:16:18 UTC (rev 8567) @@ -115,39 +115,38 @@ if (empty($syntax)) { return $this->error(sprintf(_("A required argument '%s' is missing."), 'syntax')); } - if (!empty($source)) { - $args = ""; - if (defined('HIGHLIGHT_DATA_DIR')) { - $args .= " --data-dir " . HIGHLIGHT_DATA_DIR; - } - if ($number != 0) { - $args .= " -l"; - } - if ($wrap != 0) { - $args .= " -V"; - } - $html = HTML(); - if (!empty($color) and !preg_match('/^[\w-]+$/', $color)) { - $html->pushContent($this->error(fmt("invalid %s ignored", 'color'))); - $color = false; - } - if (!empty($color)) { - $args .= " --style $color --inline-css"; - } - if (!empty($style)) { - $args .= " -F $style"; - } - $commandLine = HIGHLIGHT_EXE . "$args -q -X -f -S $syntax"; - $code = $this->newFilterThroughCmd($source, $commandLine); - if (empty($code)) { - return $this->error(fmt("Couldn't start commandline '%s'", $commandLine)); - } - $pre = HTML::pre(HTML::raw($code)); - $html->pushContent($pre); - return HTML($html); - } else { + if (empty($source)) { return $this->error(fmt("empty source")); } + $args = ""; + if (defined('HIGHLIGHT_DATA_DIR')) { + $args .= " --data-dir " . HIGHLIGHT_DATA_DIR; + } + if ($number != 0) { + $args .= " -l"; + } + if ($wrap != 0) { + $args .= " -V"; + } + $html = HTML(); + if (!empty($color) and !preg_match('/^[\w-]+$/', $color)) { + $html->pushContent($this->error(fmt("invalid %s ignored", 'color'))); + $color = false; + } + if (!empty($color)) { + $args .= " --style $color --inline-css"; + } + if (!empty($style)) { + $args .= " -F $style"; + } + $commandLine = HIGHLIGHT_EXE . "$args -q -X -f -S $syntax"; + $code = $this->newFilterThroughCmd($source, $commandLine); + if (empty($code)) { + return $this->error(fmt("Couldn't start commandline '%s'", $commandLine)); + } + $pre = HTML::pre(HTML::raw($code)); + $html->pushContent($pre); + return HTML($html); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-11-30 15:33:52
|
Revision: 8580 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8580&view=rev Author: vargenau Date: 2012-11-30 15:33:41 +0000 (Fri, 30 Nov 2012) Log Message: ----------- Better error message Modified Paths: -------------- trunk/lib/plugin/SyntaxHighlighter.php Modified: trunk/lib/plugin/SyntaxHighlighter.php =================================================================== --- trunk/lib/plugin/SyntaxHighlighter.php 2012-11-30 15:31:50 UTC (rev 8579) +++ trunk/lib/plugin/SyntaxHighlighter.php 2012-11-30 15:33:41 UTC (rev 8580) @@ -116,7 +116,8 @@ return $this->error(sprintf(_("A required argument '%s' is missing."), 'syntax')); } if (empty($source)) { - return $this->error(fmt("empty source")); + return HTML::div(array('class' => "error"), + "Please provide source code to SyntaxHighlighter plugin"); } $args = ""; if (defined('HIGHLIGHT_DATA_DIR')) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |