techtonik Tue Nov 2 08:20:16 2004 EDT
Modified files: /phpdoc/xsl htmlhelp.xsl Log: add special reference page formatting for HH http://cvs.php.net/diff.php/phpdoc/xsl/htmlhelp.xsl?r1=1.7&r2=1.8&ty=u Index: phpdoc/xsl/htmlhelp.xsl diff -u phpdoc/xsl/htmlhelp.xsl:1.7 phpdoc/xsl/htmlhelp.xsl:1.8 --- phpdoc/xsl/htmlhelp.xsl:1.7 Mon Nov 1 11:29:45 2004 +++ phpdoc/xsl/htmlhelp.xsl Tue Nov 2 08:20:16 2004 @@ -3,7 +3,7 @@ HTML Help specific stylesheet - $Id: htmlhelp.xsl,v 1.7 2004/11/01 16:29:45 techtonik Exp $ + $Id: htmlhelp.xsl,v 1.8 2004/11/02 13:20:16 techtonik Exp $ --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" @@ -53,6 +53,7 @@ <!-- *************** HTML HELP PROJECT PARAMETERS **************** --> + <!-- Turn off Binary TOC used Prev/Next buttons on toolbar. Files with binary TOC can't be merged --> <xsl:param name="htmlhelp.hhc.binary" select="0"/> <xsl:param name="htmlhelp.generate.index" select="1"/> @@ -201,6 +202,8 @@ <xsl:value-of select="translate(.,'"',$apos)"/> </xsl:template> + + <!-- *************** HTML HELP TOC CUSTOMIZINGS (HHC) **************** --> <!-- compile custom TOC file (.hhc) and insert two additional files into @@ -292,11 +295,11 @@ <!-- <xsl:param name="htmlhelp.only" select="1"/> htmlhelp.autolabel - chapter and section numbers in ToC - off - - --> +--> <!-- *************** HH HTML FILES CUSTOMIZATIONS **************** --> + <xsl:param name="label.from.part" select="1"/> <!-- *extra* slim HTML head from older templates to strip <link> tags --> @@ -434,7 +437,11 @@ </xsl:template> + +<!-- *************** HH HTML MARKUP CUSTOMIZATIONS **************** --> + <!-- output formal object titles enclosed in <h3> tags --> +<!-- formalhead was seen in abstract title, examples, tables --> <xsl:template name="formal.object.heading"> <xsl:param name="object" select="."/> <h3 class="formalhead"> @@ -445,4 +452,96 @@ </h3> </xsl:template> + +<!-- Special REFERENCE PAGE formatting for HH --> + +<!-- We need <refnamediv> to be in page title or header (also called titlepage + in templates). + Native <refentry> template calls "refentry.titlepage" template to display + page header. refentry.titlepage is generated automatically as described in + http://www.sagehill.net/docbookxsl/HtmlCustomEx.html#HTMLTitlePage + and by default do not produces titlepage content for <refname>, which is + rendered by "refentry.title" in html/refentry.xsl + + FIX: replace autogenerated template with ours custom as we don't have + mechanizm for automatic generation of titlepage templates for now +--> +<xsl:template name="refentry.titlepage"> + <div class="titlepage"> + <xsl:call-template name="refentry.title"/> + </div> +</xsl:template> + +<!-- Function page sample: +<h2 class="subheader">Format a local time/date. (PHP 3, PHP 4 >= 4.0.0)<br> +Usage: string date (string format, int [timestamp])<br></h2> +--> +<xsl:template match="refnamediv"> + <div class="{name(.)}"> + <xsl:call-template name="anchor"/> + <h2 class="subheader"> + <span id="funcPurpose"><xsl:value-of select="./refpurpose"/></span> + (<span id="funcAvail"><xsl:value-of select="$version/[EMAIL PROTECTED](current()/refname)]/@from"/></span>) + <br/> + <span id="funcUsage"><xsl:apply-templates select="../refsect1/methodsynopsis" mode="php"/></span> + </h2> + </div> +</xsl:template> + +<!-- Rendering of METHODSYNOPSIS with span tags. The output of this should look like: + + int preg_match_all ( string pattern, string subject, array matches [, int flags]) + + working from a structure like this: + + <methodsynopsis> + <type>int</type><methodname>preg_match_all</methodname> + <methodparam><type>string</type><parameter>pattern</parameter></methodparam> + <methodparam><type>string</type><parameter>subject</parameter></methodparam> + <methodparam><type>array</type><parameter>matches</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam> + </methodsynopsis> + + This overrides common.xsl templates +--> +<!-- Print out the return type, the method name, then the parameters. + Close all the optional signs opened and close the prentheses --> +<xsl:template match="methodsynopsis" mode="php"> + <span class="funcreturntype"> + <xsl:value-of select="concat(./type/text(), ' ')"/> + </span> + <span class="funcname"> + <xsl:value-of select="./methodname/text()"/> + </span> + <xsl:text> ( </xsl:text> + <xsl:apply-templates select="./methodparam" mode="php"/> + <xsl:for-each select="./[EMAIL PROTECTED] = 'opt']"> + <xsl:text>]</xsl:text> + </xsl:for-each> + <xsl:text> )</xsl:text> +</xsl:template> + +<!-- Print out optional sign if needed, then a comma if this is + not the first param, then the type and the parameter name --> +<xsl:template match="methodsynopsis/methodparam" mode="php"> + <xsl:if test="@choice = 'opt'"> + <xsl:text> [</xsl:text> + </xsl:if> + <xsl:if test="position() != 1"> + <xsl:text>, </xsl:text> + </xsl:if> + <span class="funcparamtype"> + <xsl:value-of select="./type/text()"/> + </span> + <xsl:text> </xsl:text> + <span class="funcparamname"> + <xsl:value-of select="./parameter/text()"/> + </span> +</xsl:template> + +<!-- Drop out constant "Description" --> +<xsl:template match="refsect1/title"/> +<xsl:template match="refsect1/refpurpose"/> + + </xsl:stylesheet>