softcover 1.1.beta2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/softcover/article_template/chapters/an_article.md +17 -1
- data/lib/softcover/article_template/chapters/an_article.tex +72 -117
- data/lib/softcover/sanitizer.rb +1 -0
- data/lib/softcover/version.rb +1 -1
- data/softcover.gemspec +1 -1
- data/spec/app_spec.rb +0 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82280455b9d6603b42a1593bd269c0cfc82182f7
|
4
|
+
data.tar.gz: e89a5b9757ca2e06fc5e55d0b65760bb137f7c3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e28b2cd8d0ffedd4fa00aa7484867849a842398e46881f3234dd14501d73cc739db5682517ce633dba7307f29868912a65ef65c08024784a0e89c1e7902b27d8
|
7
|
+
data.tar.gz: cc0f6bc56a068978a80ebaaf4fb563afe98f37da584f2416aeb761888f88d112d0860799686b75ec99729878c492ce30dbafe65baa3d648b9bad8213e1c64a6f
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Title of the Article
|
2
2
|
|
3
|
-
The is the first paragraph of the Softcover
|
3
|
+
The is the first paragraph of the Softcover article template. It shows how to write a document in [Markdown](http://daringfireball.net/projects/markdown/), augmented with some custom extensions, including numbered footnotes[^sample-footnote] and embedded \LaTeX.[^pronunciation]
|
4
4
|
|
5
5
|
This is the second paragraph, showing how to *emphasize* text. You can also make text **bold**.
|
6
6
|
|
@@ -20,6 +20,7 @@ In plain Markdown, you can typeset code samples and other verbatim text using fo
|
|
20
20
|
Softcover also supports GitHub-style "code fencing" with language-specific syntax highlighting:
|
21
21
|
|
22
22
|
```ruby
|
23
|
+
# "Hello, world!" in Ruby.
|
23
24
|
def hello
|
24
25
|
puts "hello, world!"
|
25
26
|
end
|
@@ -31,6 +32,7 @@ The second of these can be combined with Softcover's `codelisting` environment t
|
|
31
32
|
\codecaption{Hello, world.}
|
32
33
|
\label{code:hello}
|
33
34
|
```ruby
|
35
|
+
# "Hello, world!" in Ruby.
|
34
36
|
def hello
|
35
37
|
puts "hello, world!"
|
36
38
|
end
|
@@ -90,6 +92,20 @@ Softcover supports raw tables via a simple table syntax:
|
|
90
92
|
| `PATCH` | /users/1 | `update` | update user with id `1` |
|
91
93
|
| `DELETE` | /users/1 | `destroy` | delete user with id `1` |
|
92
94
|
|
95
|
+
Via embedded \LaTeX, Softcover supports `table` and `tabular` environments as well, as shown in Table~\ref{table:figure_placement}.
|
96
|
+
|
97
|
+
\begin{table}
|
98
|
+
\caption{Options for a float placement specifier.\label{table:figure_placement}}
|
99
|
+
\begin{tabular}{l|l}
|
100
|
+
\textbf{Specifier} & \textbf{Placement} \\ \hline
|
101
|
+
\kode{h} & Place the float \emph{approximately} here \\
|
102
|
+
\kode{h!} & Place the float \emph{(almost) exactly} here \\
|
103
|
+
\kode{t} & Place at the top of the page \\
|
104
|
+
\kode{b} & Place at the bottom of the page \\
|
105
|
+
\kode{p} & Put on a special page for floats only
|
106
|
+
\end{tabular}
|
107
|
+
\end{table}
|
108
|
+
|
93
109
|
|
94
110
|
## Final section
|
95
111
|
|
@@ -1,170 +1,125 @@
|
|
1
|
-
|
1
|
+
The is the first paragraph of the Softcover article template. It shows how to write a document in \PolyTeX, a subset of the \LaTeX\ typesetting language optimized for writing ebooks.\footnote{Pronunciations of ``LaTeX'' differ, but \emph{lay}-tech is the one I prefer.}
|
2
2
|
|
3
|
-
This is the
|
3
|
+
This is the second paragraph, showing how to \emph{emphasize} text. You can also make text \textbf{bold}.
|
4
4
|
|
5
5
|
\section{A section}
|
6
6
|
\label{sec:a_section}
|
7
7
|
|
8
|
-
This is a section.
|
8
|
+
This is a section. We'll take a look at some of the features supported by Softcover.
|
9
9
|
|
10
10
|
\subsection{Source code}
|
11
|
-
\label{sec:source_code}
|
12
11
|
|
13
|
-
|
12
|
+
In plain Markdown, you can typeset code samples and other verbatim text using four spaces of indentation:
|
14
13
|
|
15
|
-
|
16
|
-
%= lang:ruby
|
17
|
-
\begin{code}
|
14
|
+
\begin{verbatim}
|
18
15
|
def hello
|
19
|
-
puts "hello, world
|
16
|
+
puts "hello, world"
|
20
17
|
end
|
21
|
-
\end{
|
22
|
-
\noindent Softcover can highlight any language supported by \href{http://pygments.org/languages/}{Pygments} (which is most of them).
|
18
|
+
\end{verbatim}
|
23
19
|
|
24
|
-
|
20
|
+
Softcover also supports GitHub-style ``code fencing'' with language-specific syntax highlighting:
|
25
21
|
|
26
|
-
\begin{codelisting}
|
27
|
-
\label{code:hello_world}
|
28
|
-
\codecaption{``Hello, world!'' in Ruby.}
|
29
22
|
%= lang:ruby
|
30
23
|
\begin{code}
|
24
|
+
# "Hello, world!" in Ruby.
|
31
25
|
def hello
|
32
26
|
puts "hello, world!"
|
33
27
|
end
|
34
28
|
\end{code}
|
35
|
-
\end{codelisting}
|
36
29
|
|
37
|
-
|
38
|
-
|
39
|
-
For words whose hypenation isn't built in, you can indicate an optional hyphen using \verb+\-+ (Listing~\ref{code:hyphenation}), which will only be used if necessary to make a clean line break (and even then only when producing PDFs). You can also define global hyphenation rules in \texttt{custom\_pdf.sty}, which includes a rule for hyphenating ``JavaScript'' (Listing~\ref{code:custom}).
|
30
|
+
The second of these can be combined with Softcover's \kode{codelisting} environment to make code listings via embedded \LaTeX, as shown in Listing~\ref{code:hello}.
|
40
31
|
|
41
32
|
\begin{codelisting}
|
42
|
-
\
|
43
|
-
\
|
44
|
-
%= lang:
|
33
|
+
\codecaption{Hello, world.}
|
34
|
+
\label{code:hello}
|
35
|
+
%= lang:ruby
|
45
36
|
\begin{code}
|
46
|
-
|
37
|
+
# "Hello, world!" in Ruby.
|
38
|
+
def hello
|
39
|
+
puts "hello, world!"
|
40
|
+
end
|
47
41
|
\end{code}
|
48
42
|
\end{codelisting}
|
49
43
|
|
50
|
-
\begin{codelisting}
|
51
|
-
\label{code:custom}
|
52
|
-
\codecaption{Defining custom commands. \\ \filepath{latex\_styles/custom\_pdf.sty}}
|
53
|
-
%= <<(latex_styles/custom_pdf.sty, lang: tex)
|
54
|
-
\end{codelisting}
|
55
|
-
|
56
|
-
Listing~\ref{code:hyphenation} also shows how to escape the underscore character using a backslash. This is necessary because plain underscores are reserved for math environments (Section~\ref{sec:mathematics}).
|
57
|
-
|
58
44
|
\subsection{Mathematics}
|
59
|
-
\label{sec:mathematics}
|
60
45
|
|
61
|
-
Softcover supports
|
62
|
-
\[ \phi
|
63
|
-
|
46
|
+
Softcover supports mathematical typesetting via embedded \LaTeX. This includes both inline math, such as \( \phi^2 - \phi - 1 = 0, \) and centered math, such as
|
47
|
+
\[ \phi^2 - \phi - 1 = 0. \]
|
48
|
+
Softcover also supports numbered equations via embedded \LaTeX, as seen in Eq.~\eqref{eq:phi} and Eq.~\eqref{eq:gauss}.
|
64
49
|
|
65
50
|
\begin{equation}
|
66
|
-
\label{eq:
|
67
|
-
\phi = \frac{1+\sqrt{5}}{2} \approx 1.618
|
51
|
+
\label{eq:phi}
|
52
|
+
\phi = \frac{1+\sqrt{5}}{2} \approx 1.618
|
68
53
|
\end{equation}
|
69
54
|
|
70
55
|
\begin{equation}
|
71
|
-
\label{eq:
|
72
|
-
\
|
56
|
+
\label{eq:gauss}
|
57
|
+
\mathbf{\nabla}\cdot\mathbf{B} = 0 \qquad\mbox{Gauss's law}
|
73
58
|
\end{equation}
|
74
59
|
|
75
|
-
\section{
|
76
|
-
\label{sec:
|
77
|
-
|
78
|
-
This is the second section. As we saw above above, the first section is Section~\ref{sec:a_section}.
|
60
|
+
\section{Images and tables}
|
61
|
+
\label{sec:images_and_tables}
|
79
62
|
|
80
|
-
|
63
|
+
This is the second section. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
64
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
65
|
+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
66
|
+
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
67
|
+
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
68
|
+
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
81
69
|
|
82
|
-
\subsection{
|
83
|
-
\label{sec:graphics_and_figures}
|
70
|
+
\subsection{Images}
|
84
71
|
|
85
|
-
|
72
|
+
Softcover supports the inclusion of images, like this:
|
86
73
|
|
87
|
-
\
|
74
|
+
\image{images/01_michael_hartl_headshot.jpg}
|
88
75
|
|
89
|
-
\
|
76
|
+
Using \LaTeX\ labels, you can also include a caption (as in Figure~\ref{fig:captioned_image}) or just a figure number (as in Figure~\ref{fig:figure_number}).
|
90
77
|
|
91
|
-
\
|
92
|
-
|
93
|
-
\
|
94
|
-
|
95
|
-
\
|
96
|
-
|
97
|
-
To turn an image into a figure, use the \kode{figure} environment (Figure~\ref{fig:the_dude}).
|
98
|
-
|
99
|
-
\begin{figure}
|
100
|
-
\imagebox{images/2011_michael_hartl.png}
|
101
|
-
\caption{Some \href{http://michaelhartl.com/}{dude}.\label{fig:the_dude}}
|
78
|
+
\begin{figure}[h]
|
79
|
+
\begin{center}
|
80
|
+
\image{images/01_michael_hartl_headshot.jpg}
|
81
|
+
\end{center}
|
82
|
+
\caption{Some dude.\label{fig:captioned_image}}
|
102
83
|
\end{figure}
|
103
84
|
|
104
|
-
\
|
105
|
-
\
|
85
|
+
\begin{figure}[h]
|
86
|
+
\begin{center}
|
87
|
+
\image{images/01_michael_hartl_headshot.jpg}
|
88
|
+
\end{center}
|
89
|
+
\caption{\label{fig:figure_number}}
|
90
|
+
\end{figure}
|
106
91
|
|
107
|
-
|
92
|
+
\subsection{Tables}
|
108
93
|
|
109
|
-
\
|
94
|
+
Softcover supports raw tables via the \LaTeX\ \kode{table} or \kode{longtable} environments.
|
110
95
|
|
111
|
-
\begin{
|
112
|
-
\
|
96
|
+
\begin{longtable}{|l|l|l|l|}
|
97
|
+
\hline
|
98
|
+
\textbf{HTTP request} & \textbf{URL} & \textbf{Action} & \textbf{Purpose}\\
|
99
|
+
\kode{GET} & /users & \kode{index} & page to list all users\\
|
100
|
+
\kode{GET} & /users/1 & \kode{show} & page to show user with id \kode{1}\\
|
101
|
+
\kode{GET} & /users/new & \kode{new} & page to make a new user\\
|
102
|
+
\kode{POST} & /users & \kode{create} & create a new user\\
|
103
|
+
\kode{GET} & /users/1/edit & \kode{edit} & page to edit user with id \kode{1}\\
|
104
|
+
\kode{PATCH} & /users/1 & \kode{update} & update user with id \kode{1}\\
|
105
|
+
\kode{DELETE} & /users/1 & \kode{destroy} & delete user with id \kode{1}\\
|
106
|
+
\hline
|
107
|
+
\end{longtable}
|
113
108
|
|
114
|
-
|
115
|
-
\texttt{GET} & /users/1 & \texttt{show} & page to show user with id \texttt{1}\\
|
116
|
-
\texttt{GET} & /users/new & \texttt{new} & page to make a new user \\
|
117
|
-
\texttt{POST} & /users & \texttt{create} & create a new user \\
|
118
|
-
\texttt{GET} & /users/1/edit & \texttt{edit} & page to edit user with id \texttt{1} \\
|
119
|
-
\texttt{PATCH} & /users/1 & \texttt{update} & update user with id \texttt{1} \\
|
120
|
-
\texttt{DELETE} & /users/1 & \texttt{destroy} & delete user with id \texttt{1}
|
121
|
-
\end{tabular}
|
109
|
+
Softcover also supports \kode{tabular} environments, as shown in Table~\ref{table:figure_placement}.
|
122
110
|
|
123
111
|
\begin{table}
|
124
|
-
\
|
125
|
-
\
|
126
|
-
|
127
|
-
\
|
128
|
-
\
|
129
|
-
\
|
130
|
-
\
|
131
|
-
\
|
132
|
-
\texttt{PATCH} & /users/1 & \texttt{update} & update user with id \texttt{1} \\
|
133
|
-
\texttt{DELETE} & /users/1 & \texttt{destroy} & delete user with id \texttt{1}
|
112
|
+
\caption{Options for a float placement specifier.\label{table:figure_placement}}
|
113
|
+
\begin{tabular}{l|l}
|
114
|
+
\textbf{Specifier} & \textbf{Placement} \\ \hline
|
115
|
+
\kode{h} & Place the float \emph{approximately} here \\
|
116
|
+
\kode{h!} & Place the float \emph{(almost) exactly} here \\
|
117
|
+
\kode{t} & Place at the top of the page \\
|
118
|
+
\kode{b} & Place at the bottom of the page \\
|
119
|
+
\kode{p} & Put on a special page for floats only
|
134
120
|
\end{tabular}
|
135
|
-
\caption{The default \href{http://rubyonrails.org/}{Rails} actions.\label{table:rails_actions}}
|
136
121
|
\end{table}
|
137
122
|
|
138
|
-
\section{
|
123
|
+
\section{Final section}
|
139
124
|
|
140
|
-
|
141
|
-
|
142
|
-
%= lang:console
|
143
|
-
\begin{code}
|
144
|
-
$ softcover help
|
145
|
-
Commands:
|
146
|
-
softcover build, build:all # Build all formats
|
147
|
-
softcover build:epub # Build EPUB
|
148
|
-
softcover build:html # Build HTML
|
149
|
-
softcover build:mobi # Build MOBI
|
150
|
-
softcover build:pdf # Build PDF
|
151
|
-
softcover build:preview # Build book preview in all formats
|
152
|
-
.
|
153
|
-
.
|
154
|
-
.
|
155
|
-
\end{code}
|
156
|
-
|
157
|
-
\noindent You can run \kode{softcover help <command>} to get additional help on a given command:
|
158
|
-
|
159
|
-
%= lang:console
|
160
|
-
\begin{code}
|
161
|
-
$ softcover help build
|
162
|
-
Usage:
|
163
|
-
softcover build, build:all
|
164
|
-
|
165
|
-
Options:
|
166
|
-
-q, [--quiet] # Quiet output
|
167
|
-
-s, [--silent] # Silent output
|
168
|
-
|
169
|
-
Build all formats
|
170
|
-
\end{code}
|
125
|
+
This is the final section. The previous sections were Section~\ref{sec:a_section} and Section~\ref{sec:images_and_tables}.
|
data/lib/softcover/sanitizer.rb
CHANGED
data/lib/softcover/version.rb
CHANGED
data/softcover.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.add_dependency 'polytexnic', '~> 1.1.
|
21
|
+
gem.add_dependency 'polytexnic', '~> 1.1.0'
|
22
22
|
gem.add_dependency 'msgpack', '~> 0.4.2'
|
23
23
|
gem.add_dependency 'nokogiri', '~> 1.6.0'
|
24
24
|
gem.add_dependency 'thor', '~> 0.18.1'
|
data/spec/app_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: softcover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hartl
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-05-
|
12
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: polytexnic
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.1.
|
20
|
+
version: 1.1.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.1.
|
27
|
+
version: 1.1.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: msgpack
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1637,9 +1637,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1637
1637
|
version: '0'
|
1638
1638
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1639
1639
|
requirements:
|
1640
|
-
- - "
|
1640
|
+
- - ">="
|
1641
1641
|
- !ruby/object:Gem::Version
|
1642
|
-
version:
|
1642
|
+
version: '0'
|
1643
1643
|
requirements: []
|
1644
1644
|
rubyforge_project:
|
1645
1645
|
rubygems_version: 2.2.2
|