asciidoctor-pdf 1.5.0.alpha.7 → 1.5.0.alpha.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/NOTICE.adoc +2 -2
  3. data/README.adoc +127 -128
  4. data/Rakefile +5 -4
  5. data/bin/asciidoctor-pdf +15 -2
  6. data/data/fonts/notoserif-regular-latin.ttf +0 -0
  7. data/data/themes/default-theme.yml +15 -13
  8. data/docs/theme-schema.json +114 -0
  9. data/docs/theming-guide.adoc +386 -132
  10. data/lib/asciidoctor-pdf/asciidoctor_ext.rb +2 -0
  11. data/lib/asciidoctor-pdf/asciidoctor_ext/image.rb +18 -0
  12. data/lib/asciidoctor-pdf/converter.rb +377 -221
  13. data/lib/asciidoctor-pdf/core_ext.rb +2 -0
  14. data/lib/asciidoctor-pdf/core_ext/array.rb +10 -4
  15. data/lib/asciidoctor-pdf/core_ext/numeric.rb +11 -0
  16. data/lib/asciidoctor-pdf/core_ext/ostruct.rb +1 -1
  17. data/lib/asciidoctor-pdf/formatted_text.rb +8 -0
  18. data/lib/asciidoctor-pdf/{prawn_ext/formatted_text → formatted_text}/formatter.rb +6 -9
  19. data/lib/asciidoctor-pdf/formatted_text/inline_destination_marker.rb +16 -0
  20. data/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb +125 -0
  21. data/lib/asciidoctor-pdf/formatted_text/inline_image_renderer.rb +45 -0
  22. data/lib/asciidoctor-pdf/{prawn_ext/formatted_text → formatted_text}/parser.rb +252 -218
  23. data/lib/asciidoctor-pdf/{prawn_ext/formatted_text → formatted_text}/parser.treetop +18 -9
  24. data/lib/asciidoctor-pdf/{prawn_ext/formatted_text → formatted_text}/transform.rb +80 -69
  25. data/lib/asciidoctor-pdf/prawn_ext.rb +2 -2
  26. data/lib/asciidoctor-pdf/prawn_ext/extensions.rb +164 -35
  27. data/lib/asciidoctor-pdf/prawn_ext/formatted_text/fragment.rb +37 -0
  28. data/lib/asciidoctor-pdf/prawn_ext/images.rb +11 -9
  29. data/lib/asciidoctor-pdf/temporary_path.rb +9 -0
  30. data/lib/asciidoctor-pdf/theme_loader.rb +40 -33
  31. data/lib/asciidoctor-pdf/version.rb +1 -1
  32. metadata +30 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91cb53f52e412fd931bb3682852b067925666959
4
- data.tar.gz: d0cd8e53ce01660fc2083acc816c817114c17ba1
3
+ metadata.gz: 2b2c65350b1794de68fc1396284903bb5e15efde
4
+ data.tar.gz: 29a3cfea5ef7f61d77e241518d1b26440c1f58cc
5
5
  SHA512:
6
- metadata.gz: e1daccf26ee2383765fb921a184173b27331132579fd24775a353ac5f7fe639529d1155d6e0c5c38f31ff7ed52289c17ea19b9a11f39e51654dfa36685c7d570
7
- data.tar.gz: a60d21046bb9653dc6a9c64e4f6720c4805732deb00d5c59ed8933d4369bb78f0a2b5e79194fd8b6e465a5deb9cfba35abb92e9735fd21f7169c9d1402a78562
6
+ metadata.gz: a6e7506596f8d5446e9275a00f916648f336c69543d372680a4d11d77065676de4dd7721b429d49e585386639ff3d9c7eaaca776040a0afc4f1e107e1d6e98eb
7
+ data.tar.gz: 173008d8b6d048722150da22616202c118f2d46929cc67f1b4ea097e0dd8b02b8fe7f13f0a6d1a933709844ad736af1eabbc1dc49c28f1315e1fea3e4e9e137c
@@ -19,7 +19,7 @@ See the License for the specific language governing permissions and limitations
19
19
  == Third-party licensed work
20
20
 
21
21
  M+ OUTLINE FONTS (M+ TESTFLIGHT 058)::
22
- The M+ OUTLINE FONTS are used for section titles, literal text and code annotation numbers and bundled in the EPUB3 archive.
22
+ The M+ OUTLINE FONTS are used for literal text, annotation numbers and fallback characters and are bundled in the PDF file.
23
23
  These fonts are free software and are designed and maintained by Coji Morishita.
24
24
  Unlimited permission is granted to use, copy, and distribute them, with or without modification, either commercially or noncommercially.
25
25
  THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY.
@@ -28,7 +28,7 @@ M+ OUTLINE FONTS (M+ TESTFLIGHT 058)::
28
28
 
29
29
  Noto Serif Font (v2014-01-30)::
30
30
  Noto is font family developed by the Google Internationalization Team that aims to support all the world's languages.
31
- The Noto Serif font is used for body copy and bundled in the EPUB3 archive.
31
+ The Noto Serif font is used for headings and body copy and is bundled in the PDF file.
32
32
  The Noto fonts are licensed under the Apache 2.0 License.
33
33
  You may obtain a copy of the license at:
34
34
 
@@ -1,11 +1,14 @@
1
- = Asciidoctor PDF: A _native_ PDF converter for AsciiDoc
1
+ = Asciidoctor PDF: A native PDF converter for AsciiDoc
2
2
  Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
3
3
  // Settings:
4
4
  :compat-mode!:
5
5
  :experimental:
6
6
  :idprefix:
7
7
  :idseparator: -
8
+ :icons: font
9
+ :pagenums:
8
10
  ifdef::env-github[:relfileprefix: /blob/master]
11
+ ifdef::env-browser[:toc: preamble]
9
12
  //:pdf-page-size: [8.25in, 11.69in]
10
13
  //:pdf-page-size: A4
11
14
  // Aliases:
@@ -20,6 +23,7 @@ ifdef::env-github[:relfileprefix: /blob/master]
20
23
  :uri-rvm: http://rvm.io
21
24
  :uri-asciidoctor: http://asciidoctor.org
22
25
 
26
+ // FIXME See last line; Asciidoctor should only be using outfilesuffix defined in header
23
27
  :original-outfilesuffix: {outfilesuffix}
24
28
  :outfilesuffix: .adoc
25
29
 
@@ -28,15 +32,15 @@ _No more middleman._ +
28
32
  _No more DocBook toolchain._ +
29
33
  It's AsciiDoc straight to PDF!
30
34
 
31
- [caption='Status']
35
+ [caption=Status]
32
36
  CAUTION: {project-name} is currently _alpha_ software.
33
- While it handles most of the AsciiDoc content, there's still work needed to fill in gaps where conversion is incomplete, incorrect or not implemented.
37
+ While the converter handles most AsciiDoc content, there's still work needed to fill in gaps where conversion is incomplete, incorrect or not implemented.
34
38
  See the milestone v1.5.0 in the {uri-project-issues}[issue tracker] for details.
35
39
 
36
40
  == Prawn, the majestic PDF generator
37
41
 
38
- {uri-project}[{project-name}] is made possible by an amazing Ruby Gem named Prawn.
39
- And what a Gem it is!
42
+ {uri-project}[{project-name}] is made possible by an amazing Ruby gem named Prawn.
43
+ And what a gem it is!
40
44
 
41
45
  {uri-prawn}[Prawn] is a nimble PDF writer for Ruby.
42
46
  More important, it's a hackable platform that offers both high level APIs for the most common needs and low level APIs for bending the document model to accomodate special circumstances.
@@ -51,30 +55,37 @@ Here's an example that demonstrates how to use Prawn to create a basic PDF docum
51
55
  ----
52
56
  require 'prawn'
53
57
 
54
- Prawn::Document.generate 'example.pdf' do
58
+ Prawn::Document.generate 'output.pdf' do
55
59
  text 'Hello, PDF creation!'
56
60
  end
57
61
  ----
58
62
 
59
63
  It's that easy.
60
64
  And that's just the beginning.
61
- Skip ahead to <<Getting started>> to start putting it use.
65
+ Skip ahead to <<getting-started,Getting started>> to start putting it use.
62
66
 
63
- *Prawn is the killer library for PDF generation* we've needed to close this critical gap in Asciidoctor.
67
+ Prawn is the _killer library_ for PDF generation we've needed to close this critical gap in Asciidoctor.
64
68
  It absolutely takes the pain out of creating printable documents.
65
- Picking up from there, {project-name} takes the pain out of creating printable documents _from AsciiDoc_.
69
+ Picking up from there, {project-name} takes the pain out of creating PDF documents _from AsciiDoc_.
66
70
 
67
- == Notable features
71
+ == Features
72
+
73
+ === Notable features
68
74
 
69
75
  * Direct AsciiDoc to PDF conversion
70
- * Configuration-driven style and layout
76
+ * <<docs/theming-guide.adoc#,Configuration-driven style and layout>>
71
77
  * PDF document outline (i.e., bookmarks)
78
+ * Table of contents page(s)
72
79
  * Document metadata (title, authors, subject, keywords, etc)
73
80
  * Internal cross reference links
74
81
  * Syntax highlighting with CodeRay or Pygments
75
- * Page breaks avoided in block content
82
+ * Page numbering
83
+ * Customizable running content (header and footer)
84
+ * “Keep together” blocks (i.e., page breaks avoided in certain block content)
76
85
  * Orphan section titles avoided
77
86
  * Table border settings honored
87
+ * Font-based icons (currently admonition blocks only)
88
+ * Custom fonts
78
89
 
79
90
  === Missing features
80
91
 
@@ -82,200 +93,188 @@ See <<WORKLOG.adoc#,WORKLOG>>.
82
93
 
83
94
  == Prerequisites
84
95
 
85
- All that's needed is Ruby 1.9.3 or better (2.1.2 recommended) and a few RubyGems, which we explain how to install in the next section.
96
+ All that's needed is Ruby (1.9.3 or above; 2.2.x recommended) and a few Ruby gems, which we explain how to install in the next section.
86
97
 
87
- To check you have Ruby available, use the `ruby` command to query the version installed:
98
+ [WARNING]
99
+ ====
100
+ Prawn 2.0.0 and above requires Ruby >= 2.0.0 at installation (though it still works with Ruby 1.9.3 once you get beyond installation).
101
+ If you need to use Asciidoctor PDF with Ruby 1.9.3, you must first install Prawn 1.3.0 using:
88
102
 
89
- $ ruby --version
103
+ $ gem install prawn --version 1.3.0
90
104
 
91
- If you're using {uri-rvm}[RVM], we recommend creating a new gemset to work with Asciidoctor and {project-name}:
105
+ You can then proceed with installation of Asciidoctor PDF.
106
+ ====
92
107
 
93
- $ rvm use 2.1@asciidoctor-pdf --create
108
+ To check you have Ruby available, use the `ruby` command to query the version installed:
94
109
 
95
- We like RVM because it keeps the dependencies required by various projects isolated.
110
+ $ ruby --version
96
111
 
97
112
  == Getting started
98
113
 
99
- The {project-name} project is published in pre-release on RubyGems.org.
100
- You can either install the pre-release version using the following command:
114
+ You can get {project-name} by <<install-the-published-gem,installing the published gem>> or <<development,running the code from source>>.
115
+
116
+ === Install the published gem
117
+
118
+ {project-name} is published in pre-release on RubyGems.org.
119
+ You can install the published gem using the following command:
101
120
 
102
121
  $ gem install --pre asciidoctor-pdf
103
122
 
104
- If you want to syntax highlight source listings, you'll also want to install CodeRay or Pygments.
105
- To be safe, go ahead and install both gems:
123
+ If you want to syntax highlight source listings, you'll also want to install CodeRay (or Pygments).
106
124
 
107
- $ gem install coderay pygments.rb
125
+ $ gem install coderay
108
126
 
109
127
  Assuming all the required gems install properly, verify you can run the `asciidoctor-pdf` script:
110
128
 
111
129
  $ asciidoctor-pdf -v
112
130
 
113
- If you see the version of Asciidoctor PDF printed, you're ready to use {project-name}!
114
-
115
- Skip ahead to the <<example-asciidoc-document>> section to start putting {project-name} to use.
116
- Alternatively, you can follow the steps below to install the project from source.
117
-
118
- === Retrieve the source code
119
-
120
- You can retrieve the {project-name} project in one of two ways:
121
-
122
- . Clone the git repository
123
- . Download a zip archive of the repository
124
-
125
- ==== Option 1: Fetch using git clone
131
+ If you see the version of {project-name} printed, you're ready to use {project-name}.
126
132
 
127
- If you want to clone the git repository, simply copy the {uri-project-repo}[GitHub repository URL] and pass it to `git clone` command:
133
+ Let's grab an AsciiDoc document to distill and start putting {project-name} to use!
128
134
 
129
- $ git clone https://github.com/asciidoctor/asciidoctor-pdf
135
+ === An example AsciiDoc document
130
136
 
131
- Next, change to the project directory:
137
+ If you don't already have an AsciiDoc document, you can use the [file]_basic-example.adoc_ file found in the examples directory of this project.
132
138
 
133
- $ cd asciidoctor-pdf
139
+ ifeval::[{safe-mode-level} >= 20]
140
+ See <<examples/basic-example.adoc#,basic-example.adoc>>.
141
+ endif::[]
142
+ ifeval::[{safe-mode-level} < 20]
143
+ .basic-example.adoc
144
+ [source,asciidoc]
145
+ ....
146
+ include::examples/basic-example.adoc[]
147
+ ....
148
+ endif::[]
134
149
 
135
- ==== Option 2: Download the archive
150
+ It's time to convert the AsciiDoc document directly to PDF.
136
151
 
137
- If you want to download a zip archive, click the btn:[Download Zip] button on the right-hand side of the repository page on GitHub.
138
- Once the download finishes, extract the archive, open a console and change to that directory.
152
+ === Convert AsciiDoc to PDF
139
153
 
140
- TIP: Instead of working out of the {project-handle} directory, you can simply add the absolute path of the [path]_bin_ directory to your `PATH` environment variable.
154
+ IMPORTANT: You'll need to the `coderay` gem installed to run this example since it uses the `source-highlighter` attribute with the value of `coderay`.
141
155
 
142
- We'll leverage the project configuration to install the necessary dependencies.
156
+ Converting to PDF is a simple as running the `asciidoctor-pdf` script using Ruby and passing our AsciiDoc document as the first argument.
143
157
 
144
- === Install the dependencies
158
+ $ asciidoctor-pdf basic-example.adoc
145
159
 
146
- The dependencies needed to use {project-name} are defined in the [file]_Gemfile_ at the root of the project.
147
- We can use Bundler to install the dependencies for us.
160
+ This command is just a shorthand way of running:
148
161
 
149
- To check you have Bundler available, use the `bundle` command to query the version installed:
162
+ $ asciidoctor -r asciidoctor-pdf -b pdf basic-example.adoc
150
163
 
151
- $ bundle --version
164
+ When the script completes, you should see the file [file]_basic-example.pdf_ in the same directory.
165
+ Open the [file]_basic-example.pdf_ file with a PDF viewer to see the result.
152
166
 
153
- If it's not installed, use the `gem` command to install it.
167
+ .Example PDF document rendered in a PDF viewer
168
+ image::examples/example-pdf-screenshot.png[Screenshot of PDF document,width=800,scaledwidth=100%]
154
169
 
155
- $ gem install bundler
170
+ You're also encouraged to try converting this <<README#,README>> as well as the documents in the examples directory to see more of what {project-name} can do.
156
171
 
157
- Then use the `bundle` command to install the project dependencies:
172
+ The pain of the DocBook toolchain should be melting away about now.
158
173
 
159
- $ bundle
174
+ == Themes
160
175
 
161
- NOTE: You need to call `bundle` from the project directory so that it can find the [file]_Gemfile_.
176
+ The layout and styling of the PDF is driven by a YAML configuration file.
177
+ To learn how the theming system works and how to create and apply custom themes, refer to the <<docs/theming-guide.adoc#,Asciidoctor PDF Theme Guide>>.
178
+ You can use the built-in theme files, which you can find in the [file]_data/themes_ directory, as examples.
162
179
 
163
- Assuming all the required gems install properly, verify you can run the `asciidoctor-pdf` script using Ruby:
180
+ == Optional scripts
164
181
 
165
- $ ruby ./bin/asciidoctor-pdf -v
182
+ {project-name} also provides a shell script that invokes GhostScript (`gs`) to optimize and compress the generated PDF with minimal impact on quality.
183
+ You must have Ghostscript installed to use it.
166
184
 
167
- If you see the version of Asciidoctor PDF printed, you're ready to use {project-name}!
185
+ Here's an example usage:
168
186
 
169
- If you get an error message--and you're not using a Ruby manager like RVM--you may need to invoke the script through `bundle exec`:
187
+ $ ./bin/optimize-pdf basic-example.pdf
170
188
 
171
- $ bundle exec ./bin/asciidoctor-pdf -v
189
+ The command will generate the file [file]_example-optimized.pdf_ in the current directory.
172
190
 
173
- If this works, be sure to use `bundle exec` whenever invoking the `./bin/asciidoctor-pdf` script.
191
+ WARNING: The `optimize-pdf` script currently requires a Bash shell (Linux, OSX, etc).
192
+ We plan to rewrite the script in Ruby so it works across platforms (see https://github.com/asciidoctor/asciidoctor-pdf/issues/1[issue #1])
174
193
 
175
- Next, let's grab an AsciiDoc document to distill.
194
+ IMPORTANT: The `optimize-pdf` script relies on Ghostscript >= 9.10.
195
+ Otherwise, it may actually make the PDF larger.
196
+ Also, you should only consider using it if the file size of the original PDF is > 5MB.
176
197
 
177
- === Example AsciiDoc document
198
+ If a file is found with the extension `.pdfmarks` and the same rootname as the input file, it is used to add metadata to the generated PDF document.
199
+ This file is necessary to preserve the document metadata since Ghostscript will otherwise drop it.
200
+ That's why {project-name} always creates this file in addition to the PDF.
178
201
 
179
- If you don't already have an AsciiDoc document, you can use the [file]_example.adoc_ file found in the examples directory of this project.
202
+ == Contributing
180
203
 
181
- .example.adoc
182
- [source,asciidoc]
183
- ....
184
- = Document Title
185
- Doc Writer <doc@example.com>
186
- :doctype: book
187
- :source-highlighter: coderay
188
- :listing-caption: Listing
204
+ In the spirit of free software, _everyone_ is encouraged to help improve this project.
189
205
 
190
- A simple http://asciidoc.org[AsciiDoc] document.
206
+ To contribute code, simply fork the project on GitHub, hack away and send a pull request with your proposed changes.
191
207
 
192
- == Introduction
208
+ Feel free to use the {uri-project-issues}[issue tracker] or {uri-project-list}[Asciidoctor mailing list] to provide feedback or suggestions in other ways.
193
209
 
194
- A paragraph followed by a simple list with square bullets.
210
+ == Development
195
211
 
196
- [square]
197
- * item 1
198
- * item 2
212
+ To help develop {project-name}, or to simply use the development version, you need to get the source from GitHub.
213
+ Follow the instructions below to learn how to clone the source and run it from your local copy.
199
214
 
200
- Here's how you say "`Hello, World!`" in Prawn:
215
+ === Retrieve the source code
201
216
 
202
- .Create a basic PDF document using Prawn
203
- [source,ruby]
204
- ----
205
- require 'prawn'
217
+ You can retrieve the source of {project-name} in one of two ways:
206
218
 
207
- Prawn::Document.generate 'example.pdf' do
208
- text 'Hello, World!'
209
- end
210
- ----
211
- ....
219
+ . Clone the git repository
220
+ . Download a zip archive of the repository
212
221
 
213
- It's time to convert the AsciiDoc document directly to PDF.
222
+ ==== Option 1: Fetch using git clone
214
223
 
215
- === Convert AsciiDoc to PDF
224
+ If you want to clone the git repository, simply copy the {uri-project-repo}[GitHub repository URL] and pass it to `git clone` command:
216
225
 
217
- Converting to PDF is a simple as running the `./bin/asciidoctor-pdf` script using Ruby and passing our AsciiDoc document as the first argument.
226
+ $ git clone https://github.com/asciidoctor/asciidoctor-pdf
218
227
 
219
- $ ruby ./bin/asciidoctor-pdf example.adoc
228
+ Next, change to the project directory:
220
229
 
221
- When the script completes, you should see the file [file]_example.pdf_ in the same directory.
230
+ $ cd asciidoctor-pdf
222
231
 
223
- IMPORTANT: You'll need to the `coderay` gem installed to run this example since it uses the `source-highlighter` attribute with the value of `coderay`.
232
+ ==== Option 2: Download the archive
224
233
 
225
- Open the [file]_example.pdf_ file with a PDF viewer to see the result.
234
+ If you want to download a zip archive, click the btn:[Download Zip] button on the right-hand side of the repository page on GitHub.
235
+ Once the download finishes, extract the archive, open a console and change to that directory.
226
236
 
227
- .Example PDF document rendered in a PDF viewer
228
- image::examples/example-pdf-screenshot.png[Screenshot of PDF document,width=800,scaledwidth=100%]
237
+ TIP: Instead of working out of the {project-handle} directory, you can simply add the absolute path of the [path]_bin_ directory to your `PATH` environment variable.
229
238
 
230
- You're also encouraged to try converting this link:README.adoc[README] as well as the documents in the examples directory to see more of what {project-name} can do.
231
- Another good example is the https://github.com/cdi-spec/cdi/tree/master/spec[CDI Specification].
239
+ We'll leverage the project configuration to install the necessary dependencies.
232
240
 
233
- The pain of the DocBook toolchain should be melting away about now.
241
+ === Install dependencies
234
242
 
235
- == Themes
243
+ If you're using {uri-rvm}[RVM], we recommend creating a new gemset to work with {project-name}:
236
244
 
237
- The layout and styling of the PDF is driven by a YAML configuration file.
238
- To learn how the theming system works and how to create and apply custom themes, refer to the <<docs/theming-guide.adoc#,Asciidoctor PDF Theme Guide>>.
245
+ $ rvm use 2.2@asciidoctor-pdf --create
239
246
 
240
- You can use the built-in theme files, [file]_default-theme.yml_ and [file]_asciidoctor-theme.yml_, found in the [file]_data/themes_ directory, as examples.
247
+ We like RVM because it keeps the dependencies required by various projects isolated.
241
248
 
242
- Specify the path to an alternate theme file with the `pdf-style` attribute.
243
- For example to use the built-in _asciidoctor_ theme:
249
+ The dependencies needed to use {project-name} are defined in the [file]_Gemfile_ at the root of the project.
250
+ We can use Bundler to install the dependencies for us.
244
251
 
245
- $ ./bin/asciidoctor-pdf -a pdf-style=asciidoctor examples/example.adoc
246
-
247
- To refer to a theme at another location you can use the `pdf-stylesdir` attribute to specify the location of themes.
248
- If the `pdf-style` value does not end in `.yml`, then the file name is calculated as `{pdf-style}-theme.yml` located in the `pdf-stylesdir` directory (which defaults to the built-in `data/themes` directory).
252
+ To check you have Bundler available, use the `bundle` command to query the version installed:
249
253
 
250
- == Optional scripts
254
+ $ bundle --version
251
255
 
252
- {project-name} also provides a shell script that invokes GhostScript (`gs`) to optimize and compress the generated PDF with minimal impact on quality.
253
- You must have Ghostscript installed to use it.
256
+ If it's not installed, use the `gem` command to install it.
254
257
 
255
- Here's an example usage:
258
+ $ gem install bundler
256
259
 
257
- $ ./bin/optimize-pdf example.pdf
260
+ Then use the `bundle` command to install the project dependencies:
258
261
 
259
- The command will generate the file [file]_example-optimized.pdf_ in the current directory.
262
+ $ bundle
260
263
 
261
- WARNING: The `optimize-pdf` script currently requires a Bash shell (Linux, OSX, etc).
262
- We plan to rewrite the script in Ruby so it works across platforms (see https://github.com/asciidoctor/asciidoctor-pdf/issues/1[issue #1])
264
+ NOTE: You need to call `bundle` from the project directory so that it can find the [file]_Gemfile_.
263
265
 
264
- IMPORTANT: The `optimize-pdf` script relies on Ghostscript >= 9.10.
265
- Otherwise, it may actually make the PDF larger.
266
- Also, you should only consider using it if the file size of the original PDF is > 5MB.
266
+ Assuming all the required gems install properly, verify you can run the `asciidoctor-pdf` script using Ruby:
267
267
 
268
- If a file is found with the extension `.pdfmarks` and the same rootname as the input file, it is used to add metadata to the generated PDF document.
269
- This file is necessary to preserve the document metadata since Ghostscript will otherwise drop it.
270
- That's why Asciidoctor PDF always creates this file in addition to the PDF.
268
+ $ ruby ./bin/asciidoctor-pdf -v
271
269
 
272
- == Contributing
270
+ or
273
271
 
274
- In the spirit of free software, _everyone_ is encouraged to help improve this project.
272
+ $ bundle exec ./bin/asciidoctor-pdf -v
275
273
 
276
- To contribute code, simply fork the project on GitHub, hack away and send a pull request with your proposed changes.
274
+ If you see the version of {project-name} printed, you're ready to use {project-name}!
277
275
 
278
- Feel free to use the {uri-project-issues}[issue tracker] or {uri-project-list}[Asciidoctor mailing list] to provide feedback or suggestions in other ways.
276
+ CAUTION: If you get an error message--and you're not using a Ruby manager like RVM--you may need to invoke the script through `bundle exec`:
277
+ For best results, be sure to always use `bundle exec` whenever invoking the `./bin/asciidoctor-pdf` script in development mode.
279
278
 
280
279
  [[resources,Links]]
281
280
  == Resources
data/Rakefile CHANGED
@@ -8,13 +8,14 @@ default_tasks = []
8
8
  begin
9
9
  require 'bundler/gem_tasks'
10
10
 
11
+ # Enhance the release task to create an explicit commit for the release
12
+ #Rake::Task[:release].enhance [:commit_release]
13
+
14
+ # NOTE you don't need to push after updating version and committing locally
11
15
  task :commit_release do
12
16
  Bundler::GemHelper.new.send :guard_clean
13
17
  sh %(git commit --allow-empty -a -m 'Release #{Asciidoctor::Pdf::VERSION}')
14
18
  end
15
-
16
- # Enhance the release task to create an explicit commit for the release
17
- Rake::Task[:release].enhance [:commit_release]
18
19
  rescue LoadError
19
20
  end
20
21
 
@@ -22,7 +23,7 @@ begin
22
23
  require 'rdoc/task'
23
24
  Rake::RDocTask.new do |t|
24
25
  t.rdoc_dir = 'rdoc'
25
- t.title = %(Asciidoctor EPUB3 #{Asciidoctor::Pdf::VERSION})
26
+ t.title = %(Asciidoctor PDF #{Asciidoctor::Pdf::VERSION})
26
27
  t.main = %(README.adoc)
27
28
  t.rdoc_files.include 'README.adoc', 'LICENSE.adoc', 'NOTICE.adoc', 'lib/**/*.rb', 'bin/**/*'
28
29
  end
@@ -4,9 +4,22 @@ require_relative '../lib/asciidoctor-pdf'
4
4
  require 'asciidoctor/cli'
5
5
 
6
6
  options = Asciidoctor::Cli::Options.new backend: 'pdf', header_footer: true
7
+
8
+ # FIXME provide an API in Asciidoctor for sub-components to print version information
9
+ unless ARGV != ['-v'] && (ARGV & ['-V', '--version']).empty?
10
+ $stdout.write %(Asciidoctor PDF #{Asciidoctor::Pdf::VERSION} using )
11
+ # NOTE the print_version method was added in Asciidoctor 1.5.2
12
+ if options.respond_to? :print_version
13
+ options.print_version
14
+ else
15
+ puts %(Asciidoctor #{::Asciidoctor::VERSION} [http://asciidoctor.org])
16
+ end
17
+ exit 0
18
+ end
19
+
7
20
  # FIXME This is a really bizarre API. Please make me simpler.
8
- result = options.parse! ARGV
9
- if Integer === result
21
+ case (result = options.parse! ARGV)
22
+ when Integer
10
23
  exit result
11
24
  else
12
25
  invoker = Asciidoctor::Cli::Invoker.new options