softcover 1.1.beta2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6eb5e43fc93c5e0da85e86052b14720579109b7c
4
- data.tar.gz: 455198a217d10e6241c7e7ee3651153f92f6f346
3
+ metadata.gz: 82280455b9d6603b42a1593bd269c0cfc82182f7
4
+ data.tar.gz: e89a5b9757ca2e06fc5e55d0b65760bb137f7c3c
5
5
  SHA512:
6
- metadata.gz: 588933739ed83b3e89b152fc5df4d9260509e3c802963df2e2b4bef1a671153f368b982abf96c3383c6bdcf7b5a38b309520e8b633355cdcd1fcb3aa5e6e64fd
7
- data.tar.gz: a23735e587bfd6f779d661a31a1b22870c719998722ab30fda5296b86ab06265be18903594e09c40177a03a430b598ad67a6c5081bae890f064d041750be0b4e
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 document 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]
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
- This is the first paragraph of the Softcover template. It shows how to write a document in \PolyTeX, a subset of the \LaTeX\ typesetting language optimized for ebooks. For more information, see \href{http://manual.softcover.org/book}{\emph{The Softcover Book}}. To learn how to easily publish (and optionally sell) documents produced with Softcover, visit \href{http://softcover.io/}{Softcover.io}.
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 \emph{second} paragraph, showing how to emphasize text.\footnote{This is a footnote. It is numbered automatically.} You can also make text \textbf{bold} or \textit{italicized} (which looks the same as emphasized text).
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. Because it has a label, we can refer to it as Section~\ref{sec:a_section}. The cross-reference will be automatically numbered and linked. There's another reference to this section in Section~\ref{sec:floats}, as well as one in Chapter~\ref{cha:another_chapter}.
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
- This is a subsection. As usual, it can be referenced by label (Section~\ref{sec:source_code}). Note that the label starts with \kode{sec:}, not \kode{ssec:} or \kode{subsec:}. Any of these would work, but I find that sections often become subsections (and vice versa) when figuring out the structure of a book, and using \kode{sec:} to prefix them both saves having to change labels.
12
+ In plain Markdown, you can typeset code samples and other verbatim text using four spaces of indentation:
14
13
 
15
- Softcover comes with full support for syntax-highlighted source code:
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{code}
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
- You can also define \emph{code listings}, as seen in Listing~\ref{code:hello_world}. Such code listings are automatically numbered and linked.
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
- You can indicate inline code with the \verb+\kode+ command, as in \kode{current\_\-user}. If you prefer a plainer version of the same thing, you can use ``typewriter text'', as in \texttt{current\_\-user}.
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
- \label{code:hyphenation}
43
- \codecaption{Adding an optional hyphen to \kode{current\_user}.}
44
- %= lang:latex
33
+ \codecaption{Hello, world.}
34
+ \label{code:hello}
35
+ %= lang:ruby
45
36
  \begin{code}
46
- current\_\-user
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 full mathematical typesetting, including inline math, such as $\phi^2 - \phi - 1 = 0$, and centered math, such as
62
- \[ \phi = \frac{1+\sqrt{5}}{2}. \]
63
- It also supports cross-referenced equations, as in Eq.~\eqref{eq:golden_ratio} and Eq.~\eqref{eq:stokes_theorem}.
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:golden_ratio}
67
- \phi = \frac{1+\sqrt{5}}{2} \approx 1.618 \qquad{\text{The Golden Ratio}}
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:stokes_theorem}
72
- \int_\Omega d\omega = \int_{\partial\Omega} \omega \qquad{\text{Generalized Stokes's Theorem}}
56
+ \label{eq:gauss}
57
+ \mathbf{\nabla}\cdot\mathbf{B} = 0 \qquad\mbox{Gauss's law}
73
58
  \end{equation}
74
59
 
75
- \section{Floats}
76
- \label{sec:floats}
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
- Softcover supports \href{http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions}{\emph{floats}} such as figures and tables, including numbered captions and linked cross-references. The defining quality of a float is that its placement isn't guaranteed (i.e., it ``floats'' in the document), so you shouldn't generally assume it will be placed immediately after the text that precedes it. (Such placement \emph{will} be the case with HTML-based output, but \emph{not} in PDFs, where \TeX's state-of-the-art float placement algorithm is in charge.)
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{Graphics and figures}
83
- \label{sec:graphics_and_figures}
70
+ \subsection{Images}
84
71
 
85
- You can include raw graphics like this:
72
+ Softcover supports the inclusion of images, like this:
86
73
 
87
- \includegraphics{images/2011_michael_hartl.png}
74
+ \image{images/01_michael_hartl_headshot.jpg}
88
75
 
89
- \noindent You can also include centered images:
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
- \image{images/2011_michael_hartl.png}
92
-
93
- \noindent Or include one with a box, like so:
94
-
95
- \imagebox{images/2011_michael_hartl.png}
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
- \subsection{Tables and tabular environments}
105
- \label{tables_and_tabular}
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
- Softcover supports raw tables via the \kode{tabular} environment. To make a tabular environment into a full-blown table, with a number and a caption, use the \kode{table} environment (Table~\ref{table:rails_actions}), which includes some special magic to make the font size nicer in PDFs.
92
+ \subsection{Tables}
108
93
 
109
- \bigskip
94
+ Softcover supports raw tables via the \LaTeX\ \kode{table} or \kode{longtable} environments.
110
95
 
111
- \begin{tabular}{llll}
112
- \textbf{HTTP request} & \textbf{URL} & \textbf{Action} & \textbf{Purpose} \\ \hline
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
- \texttt{GET} & /users & \texttt{index} & page to list all users \\
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
- \begin{tabular}{llll}
125
- \textbf{HTTP request} & \textbf{URL} & \textbf{Action} & \textbf{Purpose} \\ \hline
126
-
127
- \texttt{GET} & /users & \texttt{index} & page to list all users \\
128
- \texttt{GET} & /users/1 & \texttt{show} & page to show user with id \texttt{1}\\
129
- \texttt{GET} & /users/new & \texttt{new} & page to make a new user \\
130
- \texttt{POST} & /users & \texttt{create} & create a new user \\
131
- \texttt{GET} & /users/1/edit & \texttt{edit} & page to edit user with id \texttt{1} \\
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{Command-line interface}
123
+ \section{Final section}
139
124
 
140
- Softcover comes with a command-line interface called \kode{poly}. To get more information, just run \kode{softcover help}:
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}.
@@ -29,6 +29,7 @@ module Softcover
29
29
  'img' => %w{id class src alt},
30
30
  'em' => %w{id class},
31
31
  'code' => %w{id class},
32
+ 'blockquote' => %w{id class},
32
33
  'strong' => %w{id class},
33
34
  'table' => %w{id class},
34
35
  'tbody' => %w{id class},
@@ -1,3 +1,3 @@
1
1
  module Softcover
2
- VERSION = "1.1.beta2"
2
+ VERSION = "1.1.0"
3
3
  end
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.beta2'
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
@@ -105,7 +105,6 @@ describe Softcover::App do
105
105
  get '/'
106
106
  expect(last_response).to be_redirect
107
107
  expect(last_response.location).to match article.slug
108
- puts last_response
109
108
  end
110
109
 
111
110
  it 'GET chapter' do
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.beta2
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-08 00:00:00.000000000 Z
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.beta2
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.beta2
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: 1.3.1
1642
+ version: '0'
1643
1643
  requirements: []
1644
1644
  rubyforge_project:
1645
1645
  rubygems_version: 2.2.2