- Workaround for dblatex escaping in <filename>
This commit is contained in:
parent
d31228bd31
commit
8893e5621d
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/projects/db5/; revision=42234
2 changed files with 37 additions and 1 deletions
share
|
@ -75,7 +75,7 @@ IMAGES_LIB?=
|
|||
SCHEMATRONS?= ${DOC_PREFIX}/share/xml/freebsd.sch
|
||||
XSLTPROCOPTS?= --nonet
|
||||
|
||||
DBLATEXOPTS?= -I ${IMAGES_EN_DIR}/${DOC}s/${.CURDIR:T} -T simple -d
|
||||
DBLATEXOPTS?= -I ${IMAGES_EN_DIR}/${DOC}s/${.CURDIR:T} -p ${DOC_PREFIX}/share/xsl/freebsd-dblatex.xsl -T simple -d
|
||||
|
||||
KNOWN_FORMATS= html html.tar html-split html-split.tar \
|
||||
epub txt rtf ps pdf tex dvi tar pdb
|
||||
|
|
36
share/xsl/freebsd-dblatex.xsl
Normal file
36
share/xsl/freebsd-dblatex.xsl
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?xml version='1.0' encoding="iso-8859-1"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:str="http://exslt.org/strings"
|
||||
extension-element-prefixes="str"
|
||||
version='1.0'>
|
||||
|
||||
<!-- $FreeBSD$ -->
|
||||
|
||||
<xsl:template match="filename">
|
||||
<xsl:choose>
|
||||
<!-- \Url cannot stand in a section heading -->
|
||||
<xsl:when test="$filename.as.url='1' and
|
||||
not(ancestor::title or ancestor::refentrytitle)">
|
||||
<xsl:text>\nolinkurl{</xsl:text><xsl:apply-templates mode="tex.escape"/><xsl:text>}</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="inline.monoseq"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text()" mode="tex.escape">
|
||||
<xsl:variable name="t1" select="str:replace(., '\', '\\')"/>
|
||||
<xsl:variable name="t2" select="str:replace($t1, '^', '\^')"/>
|
||||
<xsl:variable name="t3" select="str:replace($t2, '~', '\~')"/>
|
||||
<xsl:variable name="t4" select="str:replace($t3, '{', '\{')"/>
|
||||
<xsl:variable name="t5" select="str:replace($t4, '}', '\}')"/>
|
||||
<xsl:variable name="t6" select="str:replace($t5, '%', '\%')"/>
|
||||
<xsl:variable name="t7" select="str:replace($t6, '$', '\$')"/>
|
||||
<xsl:variable name="t8" select="str:replace($t7, '&', '\&')"/>
|
||||
<xsl:variable name="t9" select="str:replace($t8, '#', '\#')"/>
|
||||
<xsl:variable name="t10" select="str:replace($t9, '_', '\_')"/>
|
||||
|
||||
<xsl:value-of select="$t10"/>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
Loading…
Reference in a new issue