colder Tue Feb 20 21:17:39 2007 UTC
Modified files: /phpdoc Makefile.in /phpdoc/scripts html_syntax.php Log: Fix #40564 (Entities decoding required for dsssl builds) http://cvs.php.net/viewvc.cgi/phpdoc/Makefile.in?r1=1.191&r2=1.192&diff_format=u Index: phpdoc/Makefile.in diff -u phpdoc/Makefile.in:1.191 phpdoc/Makefile.in:1.192 --- phpdoc/Makefile.in:1.191 Mon Feb 19 15:40:59 2007 +++ phpdoc/Makefile.in Tue Feb 20 21:17:39 2007 @@ -16,7 +16,7 @@ # # -# $Id: Makefile.in,v 1.191 2007/02/19 15:40:59 rquadling Exp $ +# $Id: Makefile.in,v 1.192 2007/02/20 21:17:39 colder Exp $ # all: html @@ -204,14 +204,14 @@ for i in `find en -type d -name figures`; do sect=`echo $$i | awk -F\/ '{print $$3}'`; for file in $$i/*; do if test -f $$file; then name=`basename $$file`; cp $$file html/figures/$$sect.$$name; fi; done; done; $(PHP) -q $(scriptdir)/rtlpatch/hackmanuallang.php $(LANGDIR) $(JADE) $(CATALOG) -d $(HTML_STYLESHEET) -V use-output-dir -t sgml $(XMLDCL) manual.xml - $(PHP) -q $(scriptdir)/html_syntax.php html html/ + $(PHP) -q $(scriptdir)/html_syntax.php html dsssl html/ $(PHP) -q $(scriptdir)/rtlpatch/hackmanuallang.php en $(HACK_RTL_LANGS_PAGES) # still needs more tweaks!! html_xsl: manual.xml images_html ${XSLTPROC} $(PHPXSL)/html.xsl manual.xml - $(PHP) -q $(scriptdir)/html_syntax.php html html/ + $(PHP) -q $(scriptdir)/html_syntax.php html xsl html/ xul_xsl: manual.xml images_xul ${XSLTPROC} xsl/xul.xsl manual.xml @@ -231,14 +231,14 @@ phpweb_xsl: manual.xml images_php ${XSLTPROC} $(PHPXSL)/phpweb.xsl manual.xml - $(PHP) -q $(scriptdir)/html_syntax.php php php/ + $(PHP) -q $(scriptdir)/html_syntax.php php xsl php/ #$(PHP) -q $(scriptdir)/fixphpweb.php `pwd`/php php/index.php: manual.xml $(PHPWEB_DEPS) $(PHP) -q $(scriptdir)/phpweb-entities.php `pwd` phpweb $(PHP) -q $(scriptdir)/rtlpatch/hackmanuallang.php $(LANGDIR) -$(JADE) $(CATALOG) -d $(PHPWEB_STYLESHEET) -V use-output-dir -t sgml $(XMLDCL) manual.xml - $(PHP) -q $(scriptdir)/html_syntax.php php php/ + $(PHP) -q $(scriptdir)/html_syntax.php php dsssl php/ $(PHP) -q $(scriptdir)/rtlpatch/hackmanuallang.php en $(PHP) -q $(scriptdir)/phpweb-entities.php `pwd` remove $(HACK_RTL_LANGS_PHPWEB) http://cvs.php.net/viewvc.cgi/phpdoc/scripts/html_syntax.php?r1=1.14&r2=1.15&diff_format=u Index: phpdoc/scripts/html_syntax.php diff -u phpdoc/scripts/html_syntax.php:1.14 phpdoc/scripts/html_syntax.php:1.15 --- phpdoc/scripts/html_syntax.php:1.14 Sat Feb 10 11:42:27 2007 +++ phpdoc/scripts/html_syntax.php Tue Feb 20 21:17:39 2007 @@ -18,20 +18,28 @@ +----------------------------------------------------------------------+ */ -if ($_SERVER["argc"] < 3) { +if ($_SERVER["argc"] < 4) { exit("Purpose: Syntax highlight PHP examples in DSSSL generated HTML manual.\n" - .'Usage: html_syntax.php [ "html" | "php" ] [ filename.ext | dir | wildcard ] ...' ."\n" + .'Usage: html_syntax.php [ "html" | "php" ] [ "xsl" | "dsssl" ] [ filename.ext | dir | wildcard ] ...' ."\n" .'"html" - highlight_string() is applied, "php" - highlight_php() is added' ."\n" ); } set_time_limit(5*60); // can run long, but not more than 5 minutes +function callback_html_number_entities_decode($matches) { + return chr($matches[1]); +} + function callback_highlight_php($matches) { - $matches[1] = trim($matches[1]); - if ($GLOBALS["TYPE"] == "php") { - return "\n<?php\nhighlight_php('". addcslashes($matches[1], "'\\") ."');\n?>\n"; + if ($GLOBALS['DECODE'] === true) { + $with_tags = preg_replace_callback("!&#([0-9]+);!", "callback_html_number_entities_decode", trim($matches[1])); + } else { + $with_tags = trim($matches[1]); + } + if ($GLOBALS["TYPE"] == "php") { + return "\n<?php\nhighlight_php('". addcslashes($with_tags, "'\\") ."');\n?>\n"; } else { // "html" - return highlight_string($matches[1], true); + return highlight_string($with_tags, true); } } @@ -71,6 +79,10 @@ $files = $_SERVER["argv"]; array_shift($files); // $argv[0] - script filename $TYPE = array_shift($files); // "html" or "php" + +$build_medium = array_shift($files); +$DECODE = ($build_medium !== "xsl"); + while (($file = array_shift($files)) !== null) { if (is_file($file)) { $process = array($file);