Asciidoc example

This commit is contained in:
Waf Project 2024-03-26 19:23:32 +01:00
parent 7a15d4c74c
commit a5c220896a
9 changed files with 846 additions and 0 deletions

View File

@ -0,0 +1,31 @@
%%
%% This style is derived from the docbook one.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{asciidoc}[2008/06/05 AsciiDoc DocBook Style]
%% Just use the original package and pass the options.
\RequirePackageWithOptions{docbook}
% Sidebar is a boxed minipage that can contain verbatim.
% Changed shadow box to double box.
\renewenvironment{sidebar}[1][0.95\textwidth]{
\hspace{0mm}\newline%
\noindent\begin{Sbox}\begin{minipage}{#1}%
\setlength\parskip{\medskipamount}%
}{
\end{minipage}\end{Sbox}\doublebox{\TheSbox}%
}
% For DocBook literallayout elements, see `./dblatex/dblatex-readme.txt`.
\usepackage{alltt}
\usepackage{color}
\usepackage{listings}
\definecolor{gray}{gray}{0.5}
\definecolor{plum}{rgb}{0.55078125,0.09765625,0.55859375}
\lstset{commentstyle=\color{plum}}
\lstdefinelanguage{shishell} {
morekeywords={},
sensitive=false,
morecomment=[l]{\$}
}

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
dblatex(1) XSL user stylesheet for asciidoc(1).
See dblatex(1) -p option.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- TOC links in the titles, and in blue. -->
<xsl:param name="latex.hyperparam">colorlinks,linkcolor=blue,pdfstartview=FitH</xsl:param>
<xsl:param name="doc.publisher.show">0</xsl:param>
<xsl:param name="doc.lot.show"></xsl:param>
<xsl:param name="term.breakline">1</xsl:param>
<xsl:param name="doc.collab.show">0</xsl:param>
<xsl:param name="doc.section.depth">3</xsl:param>
<xsl:param name="table.in.float">0</xsl:param>
<xsl:param name="monoseq.hyphenation">0</xsl:param>
<xsl:param name="latex.output.revhistory">0</xsl:param>
<!-- This doesn't work, don't know why, see:
http://dblatex.sourceforge.net/html/manual/apas03.html
./docbook-xsl/common.xsl
-->
<!--
<xsl:param name="doc.toc.show">
<xsl:choose>
<xsl:when test="/processing-instruction('asciidoc-toc')">
1
</xsl:when>
<xsl:otherwise>
0
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="doc.lot.show">
<xsl:choose>
<xsl:when test="/book">
figure,table,equation,example
</xsl:when>
</xsl:choose>
</xsl:param>
-->
<xsl:param name="doc.toc.show">1</xsl:param>
<!--
Override default literallayout template.
See `./dblatex/dblatex-readme.txt`.
-->
<xsl:template match="address|literallayout[@class!='monospaced']">
<xsl:text>\begin{alltt}</xsl:text>
<xsl:text>&#10;\normalfont{}&#10;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#10;\end{alltt}</xsl:text>
</xsl:template>
<xsl:template match="processing-instruction('asciidoc-pagebreak')">
<!-- force hard pagebreak, varies from 0(low) to 4(high) -->
<xsl:text>\pagebreak[4] </xsl:text>
<xsl:apply-templates />
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="processing-instruction('asciidoc-br')">
<xsl:text>\newline&#10;</xsl:text>
</xsl:template>
<xsl:template match="processing-instruction('asciidoc-hr')">
<!-- draw a 444 pt line (centered) -->
<xsl:text>\begin{center}&#10; </xsl:text>
<xsl:text>\line(1,0){444}&#10; </xsl:text>
<xsl:text>\end{center}&#10; </xsl:text>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,21 @@
== Test chapter
=== Subtitle
==== Subsubtitle 1
Python highlighting
[source,python]
---------------
xyz = str("42")
---------------
==== Subsubtitle 2
image::graph{PIC}["Graph test"{backend@docbook:,height=200:},align="center"]
==== Subsubtitle 3
image::diag{PIC}["diagram"{backend@docbook:,height=200:},align="center"]

View File

@ -0,0 +1,76 @@
bgcolor "white"; // the background color for documents
context gray; // the color for context lines (when specified with line ranges)
normal black ;
keyword darkblue; // for language keywords
type darkgreen ; // for basic types
usertype teal ; // for user defined types
string darkgreen ; // for strings and chars
regexp orange f ; // for strings and chars
specialchar pink f ; // for special chars, e.g., \n, \t, \\
comment gray; // for comments
number black ; // for literal numbers
preproc teal b; // for preproc directives (e.g. #include, import)
symbol black ; // for simbols (e.g. <, >, +)
function black; // for function calls and declarations
cbracket black; // for block brackets (e.g. {, })
todo bg:cyan b; // for TODO and FIXME
code bg:brightgreen b; // for code snippets
//Predefined variables and functions (for instance glsl)
predef_var darkblue ;
predef_func darkblue b ;
// for OOP
classname teal ; // for class names, e.g., in Java and C++
// line numbers
linenum black f;
// Internet related
url blue u, f;
// other elements for ChangeLog and Log files
date blue b ;
time, file darkblue b ;
ip, name darkgreen ;
// for Prolog, Perl...
variable darkgreen ;
// explicit for Latex
italics darkgreen i;
bold darkgreen b;
underline darkgreen u;
fixed green f;
argument darkgreen;
optionalargument purple b;
math orange;
bibtex blue;
// for diffs
oldfile orange;
newfile darkgreen;
difflines blue;
// for css
selector purple;
property blue;
value darkgreen i;
// for oz
atom orange;
meta i;
// for file system
path orange;
// for C (or other language) labels
label teal b;
// for errors
error purple;
warning darkgreen;

493
playground/docs/diag.eps Normal file
View File

@ -0,0 +1,493 @@
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: Tk Canvas Widget
%%For: user,,,
%%Title: Window .!frame.!canvas.!frame.!chem_paper
%%CreationDate: Wed Mar 27 02:01:42 2024
%%BoundingBox: 8 -24 604 818
%%Pages: 1
%%DocumentData: Clean7Bit
%%Orientation: Portrait
%%EndComments
%%BeginProlog
% This is a standard prolog for Postscript generated by Tk's canvas
% widget.
/CurrentEncoding [
/space/space/space/space/space/space/space/space
/space/space/space/space/space/space/space/space
/space/space/space/space/space/space/space/space
/space/space/space/space/space/space/space/space
/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quotesingle
/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash
/zero/one/two/three/four/five/six/seven
/eight/nine/colon/semicolon/less/equal/greater/question
/at/A/B/C/D/E/F/G
/H/I/J/K/L/M/N/O
/P/Q/R/S/T/U/V/W
/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore
/grave/a/b/c/d/e/f/g
/h/i/j/k/l/m/n/o
/p/q/r/s/t/u/v/w
/x/y/z/braceleft/bar/braceright/asciitilde/space
/space/space/space/space/space/space/space/space
/space/space/space/space/space/space/space/space
/space/space/space/space/space/space/space/space
/space/space/space/space/space/space/space/space
/space/exclamdown/cent/sterling/currency/yen/brokenbar/section
/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron
/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered
/cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown
/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla
/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis
/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply
/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls
/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide
/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis
] def
50 dict begin
/baseline 0 def
/stipimage 0 def
/height 0 def
/justify 0 def
/lineLength 0 def
/spacing 0 def
/stipple 0 def
/strings 0 def
/xoffset 0 def
/yoffset 0 def
/tmpstip null def
/baselineSampler ( TXygqPZ) def
baselineSampler 0 196 put
/cstringshow {{ dup type /stringtype eq { show } { glyphshow } ifelse } forall } bind def
/cstringwidth {0 exch 0 exch { dup type /stringtype eq { stringwidth } { currentfont /Encoding get exch 1 exch put (\001) stringwidth } ifelse exch 3 1 roll add 3 1 roll add exch } forall } bind def
/ISOEncode {dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall /Encoding CurrentEncoding def currentdict end /Temporary exch definefont } bind def
/StrokeClip {{strokepath} stopped { (This Postscript printer gets limitcheck overflows when) = (stippling dashed lines; lines will be printed solid instead.) = [] 0 setdash strokepath} if clip } bind def
/EvenPixels {dup 0 matrix currentmatrix dtransform dup mul exch dup mul add sqrt dup round dup 1 lt {pop 1} if exch div mul } bind def
/StippleFill {/tmpstip 1 index def 1 EvenPixels dup scale pathbbox 4 2 roll 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll 6 index exch { 2 index 5 index 3 index { gsave 1 index exch translate 5 index 5 index true matrix tmpstip imagemask grestore } for pop } for pop pop pop pop pop } bind def
/AdjustColor {CL 2 lt { currentgray CL 0 eq { .5 lt {0} {1} ifelse } if setgray } if } bind def
/DrawText {/stipple exch def /justify exch def /yoffset exch def /xoffset exch def /spacing exch def /strings exch def /lineLength 0 def strings { cstringwidth pop dup lineLength gt {/lineLength exch def} {pop} ifelse newpath } forall 0 0 moveto baselineSampler false charpath pathbbox dup /baseline exch def exch pop exch sub /height exch def pop newpath translate rotate lineLength xoffset mul strings length 1 sub spacing mul height add yoffset mul translate justify lineLength mul baseline neg translate strings { dup cstringwidth pop justify neg mul 0 moveto stipple { gsave /char (X) def { dup type /stringtype eq { { char 0 3 -1 roll put currentpoint gsave char true charpath clip StippleText grestore char stringwidth translate moveto } forall } { currentfont /Encoding get exch 1 exch put currentpoint gsave (\001) true charpath clip StippleText grestore (\001) stringwidth translate moveto } ifelse } forall grestore } {cstringshow} ifelse 0 spacing neg translate } forall } bind def
/TkPhotoColor {gsave 32 dict begin /tinteger exch def /transparent 1 string def transparent 0 tinteger put /olddict exch def olddict /DataSource get dup type /filetype ne { olddict /DataSource 3 -1 roll 0 () /SubFileDecode filter put } { pop } ifelse /newdict olddict maxlength dict def olddict newdict copy pop /w newdict /Width get def /crpp newdict /Decode get length 2 idiv def /str w string def /pix w crpp mul string def /substrlen 2 w log 2 log div floor exp cvi def /substrs [ { substrlen string 0 1 substrlen 1 sub { 1 index exch tinteger put } for /substrlen substrlen 2 idiv def substrlen 0 eq {exit} if } loop ] def /h newdict /Height get def 1 w div 1 h div matrix scale olddict /ImageMatrix get exch matrix concatmatrix matrix invertmatrix concat newdict /Height 1 put newdict /DataSource pix put /mat [w 0 0 h 0 0] def newdict /ImageMatrix mat put 0 1 h 1 sub { mat 5 3 -1 roll neg put olddict /DataSource get str readstring pop pop /tail str def /x 0 def olddict /DataSource get pix readstring pop pop { tail transparent search dup /done exch not def {exch pop exch pop} if /w1 exch length def w1 0 ne { newdict /DataSource pix x crpp mul w1 crpp mul getinterval put newdict /Width w1 put mat 4 x neg put /x x w1 add def newdict image /tail tail w1 tail length w1 sub getinterval def } if done {exit} if tail substrs { anchorsearch {pop} if } forall /tail exch def tail length 0 eq {exit} if /x w tail length sub def } loop } for end grestore } bind def
/TkPhotoMono {gsave 32 dict begin /dummyInteger exch def /olddict exch def olddict /DataSource get dup type /filetype ne { olddict /DataSource 3 -1 roll 0 () /SubFileDecode filter put } { pop } ifelse /newdict olddict maxlength dict def olddict newdict copy pop /w newdict /Width get def /pix w 7 add 8 idiv string def /h newdict /Height get def 1 w div 1 h div matrix scale olddict /ImageMatrix get exch matrix concatmatrix matrix invertmatrix concat newdict /Height 1 put newdict /DataSource pix put /mat [w 0 0 h 0 0] def newdict /ImageMatrix mat put 0 1 h 1 sub { mat 5 3 -1 roll neg put 0.000 0.000 0.000 setrgbcolor olddict /DataSource get pix readstring pop pop newdict /DataSource pix put newdict imagemask 1.000 1.000 1.000 setrgbcolor olddict /DataSource get pix readstring pop pop newdict /DataSource pix put newdict imagemask } for end grestore } bind def
%%EndProlog
%%BeginSetup
/CL 2 def
%%EndSetup
%%Page: 1 1
save
306.0 396.0 translate
0.75 0.75 scale
-397 -561 translate
0 1123 moveto 794 1123 lineto 794 0 lineto 0 0 lineto closepath clip newpath
gsave
0 1123 moveto 793.700787401575 0 rlineto 0 -1122.51968503937 rlineto -793.700787401575 0 rlineto closepath
1.000 1.000 1.000 setrgbcolor AdjustColor
fill
0 1123 moveto 793.700787401575 0 rlineto 0 -1122.51968503937 rlineto -793.700787401575 0 rlineto closepath
0 setlinejoin 2 setlinecap
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
195.183646710763 780.58148981733 moveto
218.091823355381 767.346232255342 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
241 807 moveto
241 780.58148981733 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
195.183646710763 807 moveto
218.091823355381 820.235257561988 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
235.134910579472 784.122329825414 moveto
217.953778096008 774.195886653924 lineto
0 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
241 780.58148981733 moveto
218.091823355381 767.346232255342 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
217.953778096008 813.385603163406 moveto
235.134910579472 803.459159991915 lineto
0 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
218.091823355381 820.235257561988 moveto
241 807 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
201.183646710763 803.697686227166 moveto
201.183646710763 783.883803590163 lineto
0 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
195.183646710763 807 moveto
195.183646710763 780.58148981733 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
325.76039537611 876.267951080583 moveto
317.586965990953 901.44121293349 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
360.413034009047 901.44121293349 moveto
352.23960462389 876.267951080583 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
352.23960462389 876.267951080583 moveto
325.76039537611 876.267951080583 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
339 917 moveto
360.413034009047 901.44121293349 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
317.586965990953 901.44121293349 moveto
339 917 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
405.824399515105 665.1617995506 moveto
379.36614551868 665.1617995506 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
384.050532141865 660.162465211093 moveto
377.918831778193 641.291115548143 lineto
0 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
379.36614551868 665.1617995506 moveto
371.190545033784 640 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
392.595272516892 624.442546650102 moveto
414 640 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
371.190545033784 640 moveto
392.595272516892 624.442546650102 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
407.271713255591 641.291115548143 moveto
401.14001289192 660.162465211093 lineto
0 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
414 640 moveto
405.824399515105 665.1617995506 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
81.0805628022795 1033.32674037852 moveto
104 1046.54248850161 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
58.1611256045588 1073 moveto
58.1611256045588 1046.54248850161 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
58.1611256045588 1046.54248850161 moveto
81.0805628022795 1033.32674037852 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
104 1073 moveto
81.0805628022795 1086.21574812309 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
104 1046.54248850161 moveto
104 1073 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
81.0805628022795 1086.21574812309 moveto
58.1611256045588 1073 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
147.050532141865 477.837534788907 moveto
140.918831778193 496.708884451857 lineto
0 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
142.36614551868 472.8382004494 moveto
134.190545033784 498 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
155.595272516892 513.557453349898 moveto
177 498 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
134.190545033784 498 moveto
155.595272516892 513.557453349898 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
170.271713255591 496.708884451857 moveto
164.14001289192 477.837534788907 lineto
0 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
177 498 moveto
168.824399515105 472.8382004494 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
168.824399515105 472.8382004494 moveto
142.36614551868 472.8382004494 lineto
1 setlinecap
1 setlinejoin
1 setlinewidth
[] 0 setdash
0.000 0.000 0.000 setrgbcolor AdjustColor
stroke
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
grestore
gsave
grestore
restore showpage
%%Trailer
end
%%EOF

View File

@ -0,0 +1,9 @@
digraph G {
label="Graph example";
A1[fillcolor="#fffea6",style=filled]
A2[fillcolor="#fffea6",style=filled]
A1 -> A2;
}

20
playground/docs/main.txt Normal file
View File

@ -0,0 +1,20 @@
Doc example
===========
:author: example @VERSION@
:quotes.++:
:numbered!:
{set:PIC:{basebackend@docbook:.pdf:.svg}}
[preface]
== Introduction
Just a test
=== Next
Contents
:numbered:
include::chapter_.txt[]

28
playground/docs/waf.css Normal file
View File

@ -0,0 +1,28 @@
div.tableblock > table {
border: 1px solid gray;
}
/*div#header h1 {
background: url('logo-64x64.png') no-repeat left center;
padding-left: 80px;
line-height: 80px;
height: 80px;
}*/
div.title, caption.title {
text-align: center;
margin-bottom: 0.2em;
}
div.tableblock > table th {
background-color: #F4F4F4;
}
h1, h2, h3, h4, h5, h6, span#author, div.title, caption.title, div.admonitionblock .icon, div#toctitle, div.sidebar-title, div.image-title {
color: #333;
}
body, div.sectionbody, div#toctitle {
font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
}

94
playground/docs/wscript Normal file
View File

@ -0,0 +1,94 @@
#! /usr/bin/env python
# encoding: utf-8
VERSION='0.0.5'
APPNAME='docs'
import os, re, shutil
from waflib import TaskGen
top = '.'
out = 'build'
re_xi = re.compile('''^(include|image)::([^.]*.(txt|\\{PIC\\}))\[''', re.M)
def ascii_doc_scan(self):
# detect image dependencies
p = self.inputs[0].parent
node_lst = [self.inputs[0]]
seen = []
depnodes = []
while node_lst:
nd = node_lst.pop(0)
if nd in seen: continue
seen.append(nd)
code = nd.read()
for m in re_xi.finditer(code):
name = m.group(2)
if m.group(3) == '{PIC}':
ext = '.svg'
if self.generator.rule.rfind('A2X') > 0:
ext = '.pdf'
k = p.find_resource(name.replace('{PIC}', ext))
if k:
depnodes.append(k)
else:
k = p.find_resource(name)
if k:
depnodes.append(k)
node_lst.append(k)
return [depnodes, ()]
def options(opt):
opt.add_option('--exe', action='store_true', default=False, help='Execute the program after it is compiled')
def configure(conf):
conf.find_program('a2x', var='A2X')
conf.find_program('asciidoc', var='ADOC')
conf.find_program('convert', var='CONVERT')
conf.find_program('source-highlight', var='SOURCE_HIGHLIGHT')
conf.find_program('dot')
conf.find_program('dblatex')
conf.find_program('epstopdf')
conf.find_program('pdf2svg')
def build(bld):
# eps files, if any
for x in bld.path.ant_glob('*.eps'):
bld(rule='${EPSTOPDF} ${SRC} --outfile=${TGT}', source=x, target=x.change_ext('.pdf'))
bld(rule='${PDF2SVG} ${SRC} ${TGT[0].abspath()}', source=x.change_ext('.pdf'), target=x.change_ext('.svg'))
# graphviz files, no size is applied
for x in bld.path.ant_glob('*.dot'):
tg = bld(rule='${DOT} -Tsvg -o${TGT} ${SRC}', source=x, target=x.change_ext('.svg'))
tg = bld(rule='${DOT} -Tpdf -o${TGT} ${SRC}', source=x, target=x.change_ext('.pdf'))
for x in 'default.style waf.css'.split():
bld(features='subst', source=x, target=x, is_copy=True)
# copy files to the build directory with substitutions to add a vrsion number
with open('wscript', 'r') as f:
version = re.compile('VERSION=[\'"]([^\'"]+)', re.M).search(f.read()).group(1)
for x in bld.path.ant_glob('*.txt'):
bld(features='subst', source=x, target=x.change_ext('_.txt'), VERSION=version)
bld.add_group() # separator because documents require all pictures from above
# asciidoc processing
bld(rule='${ADOC} -a icons=true -b html5 -a stylesheet=${SRC[1].abspath()} -a iconsdir=. -a toc2 -a max-width=55em -d book -o ${TGT} ${SRC[0].abspath()}',
source='main_.txt waf.css', target='index.html', scan=ascii_doc_scan)
# to create PDF files, install dblatex
bld(rule='${A2X} -v -L -a toc --icons-dir=. --icons -d book -f pdf --dblatex-opts "-s ${SRC[1].abspath()} -p ${SRC[2].abspath()} -o ${TGT}" ${SRC[0].bldpath()}',
shell=True,
source='main_.txt asciidoc-dblatex.sty asciidoc-dblatex.xsl', target='main.pdf', scan=ascii_doc_scan)
# in case the doc is to be reviewed after creating it, run "waf --exe"
if bld.options.exe:
def exe(ctx):
bld.exec_command('firefox build/index.html')
bld.add_post_fun(exe)