docfu 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/docfu.rb +1 -1
- data/lib/docfu/outputs/pdf.rb +5 -5
- data/lib/docfu/templates/book.tex +14 -14
- metadata +1 -1
data/lib/docfu.rb
CHANGED
data/lib/docfu/outputs/pdf.rb
CHANGED
@@ -124,7 +124,7 @@ module Docfu
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
-
def post_pandoc(string,
|
127
|
+
def post_pandoc(string, cfg)
|
128
128
|
replace(string) do
|
129
129
|
space = /\s/
|
130
130
|
|
@@ -134,15 +134,15 @@ module Docfu
|
|
134
134
|
s(/SUBSUBSECTION: (.*)/, '\subsubsection{\1}')
|
135
135
|
|
136
136
|
# Enable proper cross-reference
|
137
|
-
s(/#{
|
138
|
-
s(/#{
|
139
|
-
s(/#{
|
137
|
+
s(/#{cfg['fig'].gsub(space, '\s')}\s*(\d+)\-\-(\d+)/, '\imgref{\1.\2}')
|
138
|
+
s(/#{cfg['tab'].gsub(space, '\s')}\s*(\d+)\-\-(\d+)/, '\tabref{\1.\2}')
|
139
|
+
s(/#{cfg['prechap'].gsub(space, '\s')}\s*(\d+)(\s*)#{cfg['postchap'].gsub(space, '\s')}/, '\chapref{\1}\2')
|
140
140
|
|
141
141
|
# Miscellaneous fixes
|
142
142
|
s(/FIG: (.*)/, '\img{\1}')
|
143
143
|
s('\begin{enumerate}[1.]', '\begin{enumerate}')
|
144
144
|
s(/(\w)--(\w)/, '\1-\2')
|
145
|
-
s(/``(.*?)''/, "#{
|
145
|
+
s(/``(.*?)''/, "#{cfg['dql']}\\1#{cfg['dqr']}")
|
146
146
|
|
147
147
|
# Typeset the maths in the book with TeX
|
148
148
|
s('\verb!p = (n(n-1)/2) * (1/2^160))!', '$p = \frac{n(n-1)}{2} \times \frac{1}{2^{160}}$)')
|
@@ -20,13 +20,13 @@
|
|
20
20
|
|
21
21
|
\definecolor{shadecolor}{gray}{0.90}
|
22
22
|
|
23
|
-
\setromanfont[Mapping=tex-text,BoldFont=<%=
|
24
|
-
\setmonofont[Scale=.85]{<%=
|
23
|
+
\setromanfont[Mapping=tex-text,BoldFont=<%= cfg['bold'] %>]{<%= cfg['font'] %>}
|
24
|
+
\setmonofont[Scale=.85]{<%= cfg['mono'] %>}
|
25
25
|
|
26
26
|
\XeTeXlinebreaklocale{<%= lang %>}
|
27
|
-
<%=
|
27
|
+
<%= cfg['langrule'] %>
|
28
28
|
|
29
|
-
\settowidth{\parindent}{<%=
|
29
|
+
\settowidth{\parindent}{<%= cfg['indent'] %>}
|
30
30
|
|
31
31
|
\title{<%= info['title'] %>}
|
32
32
|
\author{<%= info['author'] %>}
|
@@ -40,7 +40,7 @@
|
|
40
40
|
\makeatother
|
41
41
|
|
42
42
|
\title{\textbf{\savedtitle}}
|
43
|
-
\author{\textbf{\savedauthor}\thanks{<%=
|
43
|
+
\author{\textbf{\savedauthor}\thanks{<%= cfg['thanks'] %>}}
|
44
44
|
\def\w3cdtfymd{\the\year-\ifnum\month<10 0\fi\the\month-\ifnum\day<10 0\fi\the\day}
|
45
45
|
\date{\w3cdtfymd}
|
46
46
|
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
|
@@ -101,20 +101,20 @@
|
|
101
101
|
\newcounter{tab}[chapter]
|
102
102
|
\renewcommand{\thetab}{\thechapter.\arabic{tab}}
|
103
103
|
|
104
|
-
\newcommand{\prechap}{<%=
|
105
|
-
\newcommand{\postchap}{<%=
|
106
|
-
\newcommand{\presect}{<%=
|
107
|
-
\newcommand{\postsect}{<%=
|
104
|
+
\newcommand{\prechap}{<%= cfg['prechap'] %>}
|
105
|
+
\newcommand{\postchap}{<%= cfg['postchap'] %>}
|
106
|
+
\newcommand{\presect}{<%= cfg['presect'] %>}
|
107
|
+
\newcommand{\postsect}{<%= cfg['postsect'] %>}
|
108
108
|
\renewcommand{\chaptermark}[1]{\markboth{\textbf{\prechap \thechapter \postchap}\hspace*{1ex}#1}{}}
|
109
109
|
\renewcommand{\sectionmark}[1]{\markright{\textbf{\presect \thesection \postsect}\hspace*{1ex}#1}}
|
110
110
|
\newcommand{\chap}[1]{\newpage\thispagestyle{empty}\chapter{#1}\label{chap:\thechapter}}
|
111
111
|
\newcommand{\chapref}[1]{\hyperref[chap:#1]{\prechap #1\postchap}}
|
112
|
-
\newcommand{\imgref}[1]{\hyperref[img:#1]{<%=
|
113
|
-
\newcommand{\tabref}[1]{\hyperref[tab:#1]{<%=
|
112
|
+
\newcommand{\imgref}[1]{\hyperref[img:#1]{<%= cfg['fig'] %>#1}}
|
113
|
+
\newcommand{\tabref}[1]{\hyperref[tab:#1]{<%= cfg['tab'] %>#1}}
|
114
114
|
\newcommand{\e}[1]{$ \times 10^{#1}$}
|
115
|
-
\renewcommand{\contentsname}{<%=
|
116
|
-
\renewcommand{\figurename}{<%=
|
117
|
-
\renewcommand{\tablename}{<%=
|
115
|
+
\renewcommand{\contentsname}{<%= cfg['con'] %>}
|
116
|
+
\renewcommand{\figurename}{<%= cfg['fig'] %>}
|
117
|
+
\renewcommand{\tablename}{<%= cfg['tab'] %>}
|
118
118
|
|
119
119
|
\makeatletter
|
120
120
|
\def\@makechapterhead#1{%
|