Index: scripts/html_syntax.php =================================================================== RCS file: /repository/phpdoc/scripts/html_syntax.php,v retrieving revision 1.14 diff -u -r1.14 html_syntax.php --- scripts/html_syntax.php 10 Feb 2007 11:42:27 -0000 1.14 +++ scripts/html_syntax.php 20 Feb 2007 21:07:21 -0000 @@ -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\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\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); Index: Makefile.in =================================================================== RCS file: /repository/phpdoc/Makefile.in,v retrieving revision 1.191 diff -u -r1.191 Makefile.in --- Makefile.in 19 Feb 2007 15:40:59 -0000 1.191 +++ Makefile.in 20 Feb 2007 21:07:22 -0000 @@ -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)