mirror of https://github.com/tLDP/LDP
648 lines
16 KiB
Plaintext
648 lines
16 KiB
Plaintext
#
|
|
# $Id$
|
|
#
|
|
# PLD-Guide stylesheet.
|
|
#
|
|
# Copyright (c) 2002 Michal Moskal <malekith@pld-linux.org>.
|
|
# All rights reserved.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions
|
|
# are met:
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
# documentation and/or other materials provided with the distribution.
|
|
# 3. All advertising materials mentioning features or use of this software
|
|
# must display the following acknowledgement:
|
|
# This product includes software developed by Michal Moskal.
|
|
# 4. Neither the name of the author nor the names of any co-contributors
|
|
# may be used to endorse or promote products derived from this software
|
|
# without specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY MICHAL MOSKAL AND CONTRIBUTORS ``AS IS'' AND
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
# SUCH DAMAGE.
|
|
|
|
var img-root = ""
|
|
var icons = ""
|
|
#var icons = "1"
|
|
|
|
template "*" {}
|
|
|
|
def head(title = "") {
|
|
<head>
|
|
<title>v{$title}</title>
|
|
<style type="text/css">q|
|
|
body {
|
|
font-family: Helvetica, sans-serif;
|
|
font-size: 17px;
|
|
color: #000000;
|
|
background-color: #FFFFFF;
|
|
}
|
|
div.small {
|
|
font-family: Helvetica, sans-serif;
|
|
font-size: 12px;
|
|
color: #000000;
|
|
}
|
|
div.title {
|
|
width: 100%;
|
|
text-align: center;
|
|
padding: 5px;
|
|
color: #000000;
|
|
background-color: #edf1fa;
|
|
font-size: 140%;
|
|
font-weight: bold;
|
|
}
|
|
div.example {
|
|
background-color: #eeeeee;
|
|
padding: 3px;
|
|
}
|
|
div.example pre {
|
|
margin: 5px;
|
|
padding: 10px;
|
|
background-color: #dddddd;
|
|
}
|
|
div.example h6.example {
|
|
width: 100%;
|
|
text-align: center;
|
|
margin: 0px;
|
|
padding: 2px;
|
|
}
|
|
a {
|
|
text-decoration: none;
|
|
color: #000099;
|
|
}
|
|
a:hover {
|
|
text-decoration: none;
|
|
color: #FF3300;
|
|
}|
|
|
</style>
|
|
</head>
|
|
}
|
|
|
|
def navi-img(img = "next", align = "center", alt = "->", val = "")
|
|
{
|
|
<td width="1%" align="{$align}">
|
|
if "$val != ''" {
|
|
<a href="{$val}.html">
|
|
<img width="30" height="30" src="{$img-root}{$img}.png"
|
|
alt="{$alt}" border="0"/>
|
|
</a>
|
|
} else {
|
|
<img width="30" height="30" src="{$img-root}empty.png"
|
|
border="0"/>
|
|
}
|
|
</td>
|
|
}
|
|
|
|
# this isn't currently in use
|
|
def navi-stuff(next = "", prev = "", up = "") {
|
|
<table cellspacing="3" cellpadding="0" width="100%">
|
|
<tr>
|
|
navi-img(img = "prev", align="right", val = v{$prev}, alt = "<-")
|
|
navi-img(img = "up", align="center", val = v{$up}, alt = "^")
|
|
navi-img(img = "next", align="left", val = v{$next}, alt = "->")
|
|
</tr>
|
|
</table>
|
|
}
|
|
|
|
# but this is
|
|
def small-navi-stuff(next = "", prev = "", up = "") {
|
|
if "$next != '' or $prev != ''" {
|
|
<div align="right">
|
|
<table cellpadding="2">
|
|
<tr>
|
|
if "$prev != ''" {
|
|
<td>
|
|
<a href="{$prev}.html">
|
|
<img border="0" width="30" height="30"
|
|
src="{$img-root}prev-small.png" alt="<-"/>
|
|
</a>
|
|
</td>
|
|
}
|
|
if "$next != ''" {
|
|
<td>
|
|
<a href="{$next}.html">
|
|
<img border="0" width="30" height="30"
|
|
src="{$img-root}next-small.png" alt="->"/>
|
|
</a>
|
|
</td>
|
|
}
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
}
|
|
}
|
|
|
|
def title(title = "")
|
|
{
|
|
<div class="title">v{$title}</div>
|
|
}
|
|
|
|
macro page(title = "", content = "", next = "", prev = "", up = "",
|
|
current-chapter = "-1", current-section = "")
|
|
{
|
|
<html>
|
|
head(title = { macro-arg title })
|
|
<body>
|
|
<table cellspacing="5" width="100%" cellpadding="0">
|
|
<tr>
|
|
<td width="15%" valign="top">
|
|
<table width="100%" cellpadding="0">
|
|
<tr>
|
|
<td bgcolor="#FFFFFF" align="center">
|
|
<img width="130" height="85"
|
|
src="{$img-root}pld-rec.png"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
small-toc(current-chapter = {macro-arg current-chapter},
|
|
current-section = {macro-arg current-section})
|
|
# navi-stuff(next = {macro-arg next},
|
|
# prev = {macro-arg prev},
|
|
# up = {macro-arg up})
|
|
</td>
|
|
<td valign="top">
|
|
title(title = {macro-arg title})
|
|
small-navi-stuff(next = {macro-arg next},
|
|
prev = {macro-arg prev},
|
|
up = {macro-arg up})
|
|
<table>
|
|
<tr>
|
|
<td width="3%"> nbsp </td>
|
|
<td> macro-arg content </td>
|
|
<td width="3%"> nbsp </td>
|
|
</tr>
|
|
</table>
|
|
small-navi-stuff(next = {macro-arg next},
|
|
prev = {macro-arg prev},
|
|
up = {macro-arg up})
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</body>
|
|
</html>
|
|
}
|
|
|
|
def small-toc(current-chapter = "-1", current-section = "")
|
|
{
|
|
<table cellspacing="4" cellpadding="3">
|
|
for-each "//part" {
|
|
<tr>
|
|
<td align="center" bgcolor="#000066">
|
|
<div class="small" style="color: #FFFFFF">
|
|
<b>q|<xsl:number value="position()" format="I"/>. | v{title}</b>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
for-each "chapter" {
|
|
if "count(preceding::chapter) = $current-chapter" {
|
|
<tr>
|
|
<td bgcolor="#EDF1FA">
|
|
if "$icons" {
|
|
<table>
|
|
<tr>
|
|
<td valign="top" width="1%">
|
|
<img src="{$img-root}icon.png"/>
|
|
nbsp
|
|
</td>
|
|
<td>
|
|
v{title}
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
} else {
|
|
v{title}
|
|
}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<table>
|
|
for-each "section[parent::chapter]" {
|
|
<tr>
|
|
<td width="20" valign="top" align="right">
|
|
if "$icons" {
|
|
<img src="{$img-root}icon-small.png" />
|
|
}
|
|
</td>
|
|
<td>
|
|
<div class="small">
|
|
if "@id = $current-section" {
|
|
v{title}
|
|
} else {
|
|
<a href="{@id}.html">v{title}</a>
|
|
}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
} else {
|
|
<tr>
|
|
<td bgcolor="#EDF1FA">
|
|
if "$icons" {
|
|
<table>
|
|
<tr>
|
|
<td valign="top" width="1%">
|
|
<img src="{$img-root}icon.png"/>
|
|
nbsp
|
|
</td>
|
|
<td>
|
|
<a href="{concat(child::section[1]/attribute::id,
|
|
'.html')}">
|
|
v{title}
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
} else {
|
|
<div class="small">
|
|
<a href="{concat(child::section[1]/attribute::id, '.html')}">
|
|
v{title}
|
|
</a>
|
|
</div>
|
|
}
|
|
</td>
|
|
</tr>
|
|
}
|
|
}
|
|
}
|
|
<tr>
|
|
<td bgcolor="#EDF1FA" align="left">
|
|
<small>
|
|
<a href="bookinfo.html">v{//config/bookinfo/title}</a>
|
|
</small>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td bgcolor="#EDF1FA" align="left">
|
|
<small>
|
|
<a href="toc.html">v{//config/toc/title}</a>
|
|
</small>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td bgcolor="#EDF1FA">
|
|
apply select = "//main/links" mode = "";
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
}
|
|
|
|
template "links" {
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
<b>v{//config/links/title}</b>
|
|
</td>
|
|
</tr>
|
|
for-each "link" {
|
|
<tr>
|
|
<td>
|
|
<small><a href="{.}">v{.}</a></small>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</table>
|
|
}
|
|
|
|
mode "sec" {
|
|
template "*" {}
|
|
template "section" {
|
|
<h2>v{title}</h2>
|
|
apply;
|
|
}
|
|
template "example" {
|
|
<div class="example">
|
|
apply;
|
|
<h6 class="example">v{title}</h6>
|
|
</div>
|
|
}
|
|
template "orderedlist" {
|
|
<ol>
|
|
apply;
|
|
</ol>
|
|
}
|
|
template "itemizedlist" {
|
|
<ul>
|
|
apply;
|
|
</ul>
|
|
}
|
|
template "listitem" {
|
|
<li>
|
|
apply;
|
|
</li>
|
|
}
|
|
template "emphasis" { <em> apply; </em> }
|
|
template "abstract" { apply; }
|
|
template "ulink" { <a href="{@url}"> apply; </a> }
|
|
template "para|simpara" { <p> apply; </p> }
|
|
template "figure" {
|
|
<p align="center">
|
|
<table bgcolor="#000000" cellspacing="2" cellpadding="5">
|
|
<tr>
|
|
<td align="center" bgcolor="#ffffff">
|
|
apply select = "mediaobject/imageobject";
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td bgcolor="#ffffff">
|
|
<div align="center">
|
|
<b>v{title}</b><br/>
|
|
apply select = "mediaobject/textobject";
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</p>
|
|
}
|
|
template "imageobject" { apply; }
|
|
template "textobject" { apply; }
|
|
template "imagedata" { <img src="{$img-root}{@fileref}"/> }
|
|
# template "phrase" { apply; }
|
|
|
|
template "screen" {
|
|
<pre>
|
|
apply;
|
|
</pre>
|
|
}
|
|
template "prompt" { <font color="#206610">apply;</font> }
|
|
template "command" { <tt><b> apply; </b></tt> }
|
|
|
|
template "table" {
|
|
<table width="100%" bgcolor="#000000"
|
|
cellpadding="3" cellspacing="1" caption="{title}">
|
|
apply;
|
|
</table>
|
|
}
|
|
template "tgroup" { apply; }
|
|
template "tbody" { apply; }
|
|
template "row" { <tr>apply;</tr> }
|
|
template "entry" { <td bgcolor="#999999">apply;</td> }
|
|
|
|
template "filename" { <i><tt> apply; </tt></i> }
|
|
template "programlisting" { <pre> apply; </pre> }
|
|
|
|
template "variablelist" {
|
|
<p>
|
|
<table width="100%" bgcolor="#000000"
|
|
cellpadding="3" cellspacing="1" caption="{title}">
|
|
apply;
|
|
</table>
|
|
</p>
|
|
}
|
|
template "varlistentry" { <tr> apply; </tr> }
|
|
template "varlistentry/term" {
|
|
<td bgcolor="#999999" valign="top">
|
|
<b>apply;</b>
|
|
</td>
|
|
}
|
|
template "varlistentry/listitem" {
|
|
<td bgcolor="#999999">apply;</td>
|
|
}
|
|
|
|
template "citerefentry" {
|
|
<tt>
|
|
v{refentrytitle}
|
|
</tt>
|
|
"(" <b>v{manvolnum}</b> ")"
|
|
}
|
|
|
|
template "note" {
|
|
<small>
|
|
apply;
|
|
</small>
|
|
}
|
|
|
|
template "address" { apply; }
|
|
template "email" { <a href="mailto:{.}">v{.}</a> }
|
|
template "application" { v{.} }
|
|
template "caution|important" { <font color="#ff0000"> apply; </font> }
|
|
template "envar" { <tt> v{.} </tt> }
|
|
template "literal" { <tt> v{.} </tt> }
|
|
template "parameter" { <tt> v{.} </tt> }
|
|
template "formalpara" { <i> v{.} </i> }
|
|
template "literallayout" { <pre> apply; </pre> }
|
|
template "quote" { q|"| v{.} q|"| }
|
|
|
|
# FIXME:
|
|
template "link" { apply; }
|
|
#template "footnote" { "(" v{.} ")" }
|
|
}
|
|
|
|
mode "sec-enum" {
|
|
template "text()" {}
|
|
template "section" {
|
|
<li>
|
|
v{title}
|
|
if "count(child::section) != 0" {
|
|
<ul>
|
|
apply;
|
|
</ul>
|
|
}
|
|
</li>
|
|
}
|
|
}
|
|
|
|
mode "index-html" {
|
|
template "*" {}
|
|
template "section" {
|
|
<table width="100%">
|
|
<tr>
|
|
<td valign="middle">
|
|
apply mode = "sec";
|
|
</td>
|
|
<td valign="middle">
|
|
<img src="{$img-root}pld-big.png"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
}
|
|
}
|
|
|
|
mode "chap" {
|
|
template "text()" {}
|
|
|
|
template "section" {
|
|
<li> nbsp
|
|
<a href="{@id}.html">v{title}</a>
|
|
if "count(child::section) != 0" {
|
|
<ul>
|
|
apply mode = "sec-enum";
|
|
</ul>
|
|
}
|
|
</li>
|
|
redirect "concat(@id, '.html')" {
|
|
%page(
|
|
title = v{title},
|
|
prev = v{preceding::section[parent::chapter][1]/attribute::id},
|
|
next = {
|
|
if "@id = 'Welcome'" { "" }
|
|
else { v{following::section[parent::chapter][1]/attribute::id} }
|
|
},
|
|
up = "toc",
|
|
current-chapter = v{count(preceding::chapter)},
|
|
current-section = v{@id},
|
|
content = {
|
|
if "@id = 'Welcome'" {
|
|
apply mode = "index-html" select=".";
|
|
} else {
|
|
apply mode = "sec";
|
|
}
|
|
}
|
|
)
|
|
}
|
|
}
|
|
|
|
template "chapter" {
|
|
redirect "concat('ch', count(preceding::chapter) + 1, '.html')" {
|
|
%page(
|
|
title = v{title},
|
|
up = "toc",
|
|
prev = {
|
|
if "count(preceding::chapter) > 0" {
|
|
"ch" v{count(preceding::chapter)}
|
|
}
|
|
},
|
|
next = {
|
|
if "count(following::chapter) > 0" {
|
|
"ch" v{count(preceding::chapter) + 2}
|
|
}
|
|
},
|
|
content = {
|
|
apply select = "child::section";
|
|
}
|
|
)
|
|
}
|
|
}
|
|
|
|
template "appendix" {
|
|
redirect "concat(@id, '.html')" {
|
|
%page( title = v{title}, up = "toc", content = {
|
|
apply mode = "sec";
|
|
})
|
|
}
|
|
}
|
|
|
|
} # mode chap
|
|
|
|
mode "full-toc" {
|
|
template "text()" {}
|
|
|
|
template "part" {
|
|
q|<xsl:number format="I" value="count(preceding::part) + 1"/>. |
|
|
<b>v{title}</b>
|
|
<br/>
|
|
<ul> apply; </ul>
|
|
}
|
|
|
|
template "chapter" {
|
|
q|<xsl:number value="count(preceding::chapter) + 1"/>. |
|
|
<a href="{concat('ch', count(preceding::chapter) + 1, '.html')}"
|
|
><b>v{title}</b></a>
|
|
<br/>
|
|
<ul> apply; </ul>
|
|
}
|
|
|
|
template "appendix" {
|
|
q|<xsl:number format="i" value="count(preceding::appendix) + 1"/>. |
|
|
<a href="{@id}.html"
|
|
><b>v{title}</b></a>
|
|
<br/>
|
|
}
|
|
|
|
template "section" {
|
|
<li><a href="{@id}.html">v{title}</a></li>
|
|
}
|
|
} # mode full-toc
|
|
|
|
|
|
mode "book-info" {
|
|
template "*" {}
|
|
template "abstract" { apply; }
|
|
template "para" { <p> apply; </p> }
|
|
template "author" {
|
|
<li>
|
|
v{firstname} nbsp v{surname} nbsp nbsp
|
|
var email = v{concat(substring-before(affiliation/address/email, '@'),
|
|
' /at/ ',
|
|
substring-after(affiliation/address/email, '@'))}
|
|
" <"
|
|
<a href="mailto:{$email}">
|
|
v{$email}
|
|
</a>
|
|
">" nbsp nbsp "(" v{affiliation/orgname} ")"
|
|
<p>
|
|
v{contrib}
|
|
</p>
|
|
</li>
|
|
}
|
|
template "revhistory" {
|
|
<ul>
|
|
apply;
|
|
</ul>
|
|
}
|
|
template "revision" {
|
|
<li>
|
|
v{revnumber} ", " v{date}
|
|
"(" v{authorinitials} ")"
|
|
<p>
|
|
v{revremark}
|
|
</p>
|
|
</li>
|
|
}
|
|
template "//bookinfo" {
|
|
redirect "'bookinfo.html'" {
|
|
%page(
|
|
title = v{//config/bookinfo/title},
|
|
content = {
|
|
<div align="center">
|
|
<h1>v{title}</h1>
|
|
<h3>v{pubdate}</h3>
|
|
</div>
|
|
apply select = "abstract";
|
|
<h2>v{//config/bookinfo/authors}</h2>
|
|
<ul>
|
|
apply select = "author";
|
|
</ul>
|
|
<h2>v{//config/bookinfo/revhistory}</h2>
|
|
apply select = "revhistory";
|
|
},
|
|
up = "toc"
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
template "book" {
|
|
redirect "'toc.html'" {
|
|
%page( title = v{//config/toc/title}, content = {
|
|
apply mode = "full-toc" select = "//part";
|
|
apply mode = "chap" select = "descendant::chapter";
|
|
apply mode = "chap" select = "descendant::appendix";
|
|
})
|
|
apply mode = "book-info";
|
|
}
|
|
}
|
|
|
|
template "main" {
|
|
redirect "'foobarbaz.html'" {
|
|
apply;
|
|
}
|
|
}
|
|
|
|
# vim:expandtab:sw=2
|