asciidoctor-pdf 1.5.0.beta.7 → 1.5.0.beta.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +32 -0
- data/README.adoc +14 -225
- data/asciidoctor-pdf.gemspec +1 -1
- data/bin/asciidoctor-pdf +1 -6
- data/data/themes/base-theme.yml +2 -0
- data/data/themes/default-theme.yml +4 -0
- data/docs/theming-guide.adoc +136 -19
- data/lib/asciidoctor/pdf/converter.rb +221 -87
- data/lib/asciidoctor/pdf/ext/asciidoctor.rb +2 -1
- data/lib/asciidoctor/pdf/ext/asciidoctor/abstract_node.rb +6 -0
- data/lib/asciidoctor/pdf/ext/core/array.rb +4 -0
- data/lib/asciidoctor/pdf/ext/core/object.rb +1 -1
- data/lib/asciidoctor/pdf/ext/core/string.rb +2 -6
- data/lib/asciidoctor/pdf/ext/prawn-table/cell/asciidoc.rb +3 -2
- data/lib/asciidoctor/pdf/ext/prawn.rb +1 -0
- data/lib/asciidoctor/pdf/ext/prawn/extensions.rb +9 -2
- data/lib/asciidoctor/pdf/ext/prawn/formatted_text/box.rb +16 -0
- data/lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb +6 -0
- data/lib/asciidoctor/pdf/ext/prawn/images.rb +1 -0
- data/lib/asciidoctor/pdf/formatted_text/inline_image_arranger.rb +3 -2
- data/lib/asciidoctor/pdf/formatted_text/transform.rb +11 -8
- data/lib/asciidoctor/pdf/index_catalog.rb +2 -1
- data/lib/asciidoctor/pdf/optimizer.rb +18 -8
- data/lib/asciidoctor/pdf/pdfmark.rb +10 -10
- data/lib/asciidoctor/pdf/sanitizer.rb +0 -57
- data/lib/asciidoctor/pdf/text_transformer.rb +115 -0
- data/lib/asciidoctor/pdf/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4971b7ad193cc6b81346ac764010d20b46bbfdd66986e601938fcca2cd3929ba
|
4
|
+
data.tar.gz: 86076a5fcb2bc9f6fbb54b8479f04be26a576b207be08ea5b504013dec48ef72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 940b1a41aa08c0950fb9e609f1ab5cf5c960bee9535cbd5710306b5c7a20d30794ec41fa2ea4b0a78a9c11f5d53262e6bac25417777f6a96e2fded72dd5d121c
|
7
|
+
data.tar.gz: 3017ce6726c7cae78b59394fe12be84587e691375c9e11f196384d42b8a254d2f10201e110503af1447eb456c0e070d90e7d1c0f7099e4e87057d2a4c69606ff
|
data/CHANGELOG.adoc
CHANGED
@@ -5,6 +5,38 @@
|
|
5
5
|
This document provides a high-level view of the changes to the {project-name} by release.
|
6
6
|
For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub.
|
7
7
|
|
8
|
+
== 1.5.0.beta.8 (2019-11-23) - @mojavelinux
|
9
|
+
|
10
|
+
* automatically hyphenate prose using the text-hyphen gem if the `hyphens` document attribute is set (#20)
|
11
|
+
* set hyphenation language using the `hyphens` attribute value, falling back to the `lang` attribute (#20)
|
12
|
+
* add support for capitalize text transform (#1382)
|
13
|
+
* fix AsciiDoc table cell from overflowing bounds of table and creating extra page (#1369)
|
14
|
+
* don't double escape XML special characters in literal table cell (#1370)
|
15
|
+
* allow theme to customize the width and color of text decoration (underline and line-through) (#812)
|
16
|
+
* use same line height throughout abstract
|
17
|
+
* don't mangle XML attribute values when applying lowercase text transform (#1391)
|
18
|
+
* place toc at same position in outline as it is in the document (#1361)
|
19
|
+
* log warning with error message if remote image cannot be retrieved
|
20
|
+
* allow initial page mode to be set to fullscreen using pdf-page-mode=fullscreen attribute or page_mode=fullscreen theme key (#1357)
|
21
|
+
* allow theme to configure content of entries in authors line on title page (#800)
|
22
|
+
* allow theme to override styles of caption on admonition blocks (#561)
|
23
|
+
* allow theme to configure hanging indent for titles in toc (#1153)
|
24
|
+
* apply hanging indent to wrapped entries in index (#645)
|
25
|
+
* allow theme to configure text decoration of headings (#811)
|
26
|
+
* define line-through and underline roles as built-in custom roles so they can be customized (#1393)
|
27
|
+
* allow top value of logo and title on title page to be specified in any measurement unit
|
28
|
+
* don't set a top value for the logo on the title page if not set in theme
|
29
|
+
* if value of scripts attribute is cjk, break lines between any two CJK characters except punctuation in table cells (#1359) (*gasol*)
|
30
|
+
* ignore invalid cellbgcolor value (#1396)
|
31
|
+
* recommend installing prawn-gmagick gem if image format is unsupported
|
32
|
+
* set cache_images option on SVG interface if cache-uri attribute is set on document (#223)
|
33
|
+
* upgrade prawn-svg to fix display of links in plantuml diagrams (#1105)
|
34
|
+
* allow icon set to be specified as prefix on target of icon macro (#1365)
|
35
|
+
* write Unix epoch dates to pdfmark file in UTC when reproducible is set
|
36
|
+
* don't include software versions in PDF info if reproducible attribute is set
|
37
|
+
* fix optimizer so it applies pdfmark after reading input file
|
38
|
+
* allow converter instance to be reused
|
39
|
+
|
8
40
|
== 1.5.0.beta.7 (2019-10-29) - @mojavelinux
|
9
41
|
|
10
42
|
* fix value of implicit page-count attribute when page numbering and running content don't start on same page (#1334)
|
data/README.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
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
|
-
v1.5.0.beta.
|
3
|
+
v1.5.0.beta.8, 2019-11-23
|
4
4
|
// Settings:
|
5
5
|
:experimental:
|
6
6
|
:idprefix:
|
@@ -12,7 +12,6 @@ ifdef::env-github,env-browser[]
|
|
12
12
|
endif::[]
|
13
13
|
ifdef::env-github[]
|
14
14
|
:status:
|
15
|
-
:outfilesuffix: .adoc
|
16
15
|
:!toc-title:
|
17
16
|
:caution-caption: :fire:
|
18
17
|
:important-caption: :exclamation:
|
@@ -24,7 +23,7 @@ endif::[]
|
|
24
23
|
:project-name: Asciidoctor PDF
|
25
24
|
:project-handle: asciidoctor-pdf
|
26
25
|
// Variables:
|
27
|
-
:release-version: 1.5.0.beta.
|
26
|
+
:release-version: 1.5.0.beta.8
|
28
27
|
// URIs:
|
29
28
|
:url-asciidoctor: http://asciidoctor.org
|
30
29
|
:url-gem: http://rubygems.org/gems/asciidoctor-pdf
|
@@ -95,7 +94,7 @@ endif::[]
|
|
95
94
|
== Highlights
|
96
95
|
|
97
96
|
* Direct AsciiDoc to PDF conversion
|
98
|
-
* <<docs/theming-guide#,Configuration-driven theme (style and layout)>>
|
97
|
+
* <<docs/theming-guide.adoc#,Configuration-driven theme (style and layout)>>
|
99
98
|
* SVG support
|
100
99
|
* PDF document outline (i.e., bookmarks)
|
101
100
|
* Table of contents page(s)
|
@@ -162,7 +161,7 @@ ERROR: While executing gem ... (Gem::FilePermissionError)
|
|
162
161
|
You don't have write permissions for the /Library/Ruby/Gems/2.x.x directory.
|
163
162
|
....
|
164
163
|
|
165
|
-
A better practice (and one that will ensure your sanity) is to ignore any version of Ruby installed on your system and use
|
164
|
+
A better practice (and one that will ensure your sanity) is to ignore any version of Ruby installed on your system and use {url-rvm}[RVM] to manage the Ruby installation instead.
|
166
165
|
The benefit of this approach is that a) Ruby is guaranteed to be set up correctly, b) installing gems will in no way interfere with the operation of your system, and c) any bin scripts provided by the installed gems will be available on your PATH.
|
167
166
|
All files are managed in user space (aka your home or user directory).
|
168
167
|
If something gets messed up, you can simply remove the [.path]_$HOME/.rvm_ folder and start over.
|
@@ -247,10 +246,10 @@ Let's grab an AsciiDoc document to distill and start putting {project-name} to u
|
|
247
246
|
|
248
247
|
=== An Example AsciiDoc Document
|
249
248
|
|
250
|
-
If you don't already have an AsciiDoc document, you can use the <<examples/basic-example#,basic-example.adoc>> file found in the examples directory of this project.
|
249
|
+
If you don't already have an AsciiDoc document, you can use the <<examples/basic-example.adoc#,basic-example.adoc>> file found in the examples directory of this project.
|
251
250
|
|
252
251
|
ifeval::[{safe-mode-level} >= 20]
|
253
|
-
See <<examples/basic-example#,basic-example.adoc>>.
|
252
|
+
See <<examples/basic-example.adoc#,basic-example.adoc>>.
|
254
253
|
endif::[]
|
255
254
|
ifeval::[{safe-mode-level} < 20]
|
256
255
|
.basic-example.adoc
|
@@ -284,7 +283,7 @@ Open the [.path]_basic-example.pdf_ file with a PDF viewer to see the result.
|
|
284
283
|
image::examples/example-pdf-screenshot.png[Screenshot of PDF document,width=850,467,scaledwidth=100%]
|
285
284
|
|
286
285
|
ifndef::env-site[]
|
287
|
-
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.
|
286
|
+
You're also encouraged to try converting this <<README.adoc#,README>> as well as the documents in the examples directory to see more of what {project-name} can do.
|
288
287
|
endif::[]
|
289
288
|
|
290
289
|
The pain of the DocBook toolchain should be melting away about now.
|
@@ -292,7 +291,7 @@ The pain of the DocBook toolchain should be melting away about now.
|
|
292
291
|
== Themes
|
293
292
|
|
294
293
|
The layout and styling of the PDF is driven by a YAML configuration file.
|
295
|
-
To learn how the theming system works and how to create and apply custom themes, refer to the <<docs/theming-guide#,Asciidoctor PDF Theme Guide>>.
|
294
|
+
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>>.
|
296
295
|
You can use the built-in theme files, which you can find in the [.path]_data/themes_ directory, as examples.
|
297
296
|
|
298
297
|
If you've enabled a source highlighter, you can control the style (aka theme) it applies to source blocks using the `coderay-style`, `pygments-style`, and `rouge-style` attributes, respectively.
|
@@ -301,7 +300,7 @@ For example, to configure Rouge to use the built-in monokai theme, run Asciidoct
|
|
301
300
|
$ asciidoctor-pdf -a rouge-style=monokai basic-example.adoc
|
302
301
|
|
303
302
|
It's possible to develop your own theme for Rouge.
|
304
|
-
Refer to the <<docs/theming-guide#,Asciidoctor PDF Theme Guide>> for details.
|
303
|
+
Refer to the <<docs/theming-guide.adoc#,Asciidoctor PDF Theme Guide>> for details.
|
305
304
|
|
306
305
|
=== Support for Non-Latin Languages
|
307
306
|
|
@@ -590,7 +589,7 @@ The result becomes indistinguishable from other PDF objects.
|
|
590
589
|
What that means for text is that any font family used for text in the SVG _must_ be registered in the Asciidoctor PDF theme file (and thus with Prawn).
|
591
590
|
Otherwise, Prawn will fallback to using the closest matching built-in (afm) font from PDF (e.g., sans-serif becomes Helvetica).
|
592
591
|
Recall that afm fonts only support basic Latin.
|
593
|
-
As we like to say, PDF is <<docs/theming-guide#built-in-afm-fonts,bring your own font>>.
|
592
|
+
As we like to say, PDF is <<docs/theming-guide.adoc#built-in-afm-fonts,bring your own font>>.
|
594
593
|
|
595
594
|
If you're using Asciidoctor Diagram to generate SVGs to embed in the PDF, you likely need to specify the default font the diagramming tool uses.
|
596
595
|
Let's assume you are making a plantuml diagram.
|
@@ -992,218 +991,8 @@ hexapdf also allows you to add password protection to your PDF, if that's someth
|
|
992
991
|
ifndef::env-site[]
|
993
992
|
== Contributing
|
994
993
|
|
995
|
-
|
996
|
-
|
997
|
-
To contribute code, simply fork the project on GitHub, hack away and send a pull request with your proposed changes.
|
998
|
-
*All pull requests must include a) tests that verify the code change and b) an entry in the CHANGELOG.adoc file to document what changed.*
|
999
|
-
If a pull request is missing tests or a CHANGELOG entry, *it will not be merged*.
|
1000
|
-
|
1001
|
-
Feel free to use the {url-project-issues}[issue tracker] or {url-project-list}[Asciidoctor mailing list] to provide feedback or suggestions in other ways.
|
1002
|
-
|
1003
|
-
== Development
|
1004
|
-
|
1005
|
-
To help develop {project-name}, or to simply use the development version, you need to get the source from GitHub.
|
1006
|
-
Follow the instructions below to learn how to clone the source and run it from your local copy.
|
1007
|
-
|
1008
|
-
=== Retrieve the Source Code
|
1009
|
-
|
1010
|
-
You can retrieve the source of {project-name} in one of two ways:
|
1011
|
-
|
1012
|
-
. Clone the git repository
|
1013
|
-
. Download a zip archive of the repository
|
1014
|
-
|
1015
|
-
==== Option 1: Fetch Using Git
|
1016
|
-
|
1017
|
-
If you want to clone the git repository, simply copy the {url-project-repo}[GitHub repository URL] and pass it to the `git clone` command:
|
1018
|
-
|
1019
|
-
$ git clone https://github.com/asciidoctor/asciidoctor-pdf
|
1020
|
-
|
1021
|
-
Next, change to the project directory:
|
1022
|
-
|
1023
|
-
$ cd asciidoctor-pdf
|
1024
|
-
|
1025
|
-
==== Option 2: Download the Archive
|
1026
|
-
|
1027
|
-
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.
|
1028
|
-
Once the download finishes, extract the archive, open a console and change to that directory.
|
1029
|
-
|
1030
|
-
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.
|
1031
|
-
|
1032
|
-
We'll leverage the project configuration to install the necessary dependencies.
|
1033
|
-
|
1034
|
-
=== Install Dependencies
|
1035
|
-
|
1036
|
-
We recommend using {url-rvm}[RVM] to manage the installation of Ruby you'll use to build and develop the project.
|
1037
|
-
|
1038
|
-
$ rvm use 2.6
|
1039
|
-
|
1040
|
-
The dependencies needed to use {project-name} are defined in the [.path]_Gemfile_ at the root of the project.
|
1041
|
-
We can use Bundler to install the dependencies for us.
|
1042
|
-
|
1043
|
-
To check you have Bundler available, use the `bundle` command to query the installed version:
|
1044
|
-
|
1045
|
-
$ bundle --version
|
1046
|
-
|
1047
|
-
If it's not installed, use the `gem` command to install it.
|
1048
|
-
|
1049
|
-
$ gem install bundler
|
1050
|
-
|
1051
|
-
Then use the `bundle` command with the `--path` option to install the project dependencies into the project:
|
1052
|
-
|
1053
|
-
$ bundle --path=.bundle/gems
|
1054
|
-
|
1055
|
-
NOTE: You must call `bundle` from the project directory so that it can find the [.path]_Gemfile_.
|
1056
|
-
|
1057
|
-
=== Run the Tests
|
1058
|
-
|
1059
|
-
Tests are written using RSpec.
|
1060
|
-
To run the tests, simply invoke rspec via bundler.
|
1061
|
-
|
1062
|
-
$ bundle exec rspec
|
1063
|
-
|
1064
|
-
To disable the visual integration tests, pass the `` option:
|
1065
|
-
|
1066
|
-
$ bundle exec rspec -t ~visual
|
1067
|
-
|
1068
|
-
If a visual integration test fails, you can instruct the test suite to keep the files in the [.path]_spec/output_ directory by setting the `DEBUG` environment variable:
|
1069
|
-
|
1070
|
-
$ DEBUG=true bundle exec rspec -t visual
|
1071
|
-
|
1072
|
-
If you want to see the name of each test as it is run, add the `-fd` option:
|
1073
|
-
|
1074
|
-
$ bundle exec rspec -fd
|
1075
|
-
|
1076
|
-
You can also use the provided Rake task (note the name difference):
|
1077
|
-
|
1078
|
-
$ bundle exec rake spec
|
1079
|
-
|
1080
|
-
Running tests using `rspec` directly gives you the advantage of being able to specify additional options.
|
1081
|
-
|
1082
|
-
To run a single test, you can filter by the name of the test.
|
1083
|
-
For example, to run all tests that pertain to failures, use:
|
1084
|
-
|
1085
|
-
$ bundle exec rspec -e fail
|
1086
|
-
|
1087
|
-
To run all tests that have `wip` in the name, use:
|
1088
|
-
|
1089
|
-
$ bundle exec rspec -e wip
|
1090
|
-
|
1091
|
-
You can also run all tests in a given file by passing the file's path to rspec:
|
1092
|
-
|
1093
|
-
$ bundle exec rspec spec/toc_spec.rb
|
1094
|
-
|
1095
|
-
For a full list of options that rspec provides, run `rspec -h`.
|
1096
|
-
|
1097
|
-
=== Run the Application (optional)
|
1098
|
-
|
1099
|
-
Like with Bundler, you have to run the application from the project directory.
|
1100
|
-
Assuming all the required gems install properly, verify you can run the `asciidoctor-pdf` script using Ruby:
|
1101
|
-
|
1102
|
-
$ bundle exec asciidoctor-pdf -v
|
1103
|
-
|
1104
|
-
If you see the version of {project-name} printed, you're ready to use {project-name}!
|
1105
|
-
|
1106
|
-
You can use the application to convert a document as follows:
|
1107
|
-
|
1108
|
-
$ bundle exec asciidoctor-pdf /path/to/sample.adoc
|
1109
|
-
|
1110
|
-
=== Install the Application (optional)
|
1111
|
-
|
1112
|
-
If you want to install the application globally so you can run it anywhere, use the following `rake` task:
|
1113
|
-
|
1114
|
-
$ bundle exec rake install
|
1115
|
-
|
1116
|
-
This task will package the gem and install it into your system gems.
|
1117
|
-
|
1118
|
-
If you want to install the gem using a separate command, first use the following `rake` task to build it:
|
1119
|
-
|
1120
|
-
$ rm -rf pkg
|
1121
|
-
bundle exec rake build
|
1122
|
-
|
1123
|
-
This task packages the application as a gem and writes it to the [.path]_pkg_ directory.
|
1124
|
-
A message will be printed to the console telling you the exact filename.
|
1125
|
-
You can now use the `gem install` command to install it.
|
1126
|
-
|
1127
|
-
$ gem install pkg/*.gem
|
1128
|
-
|
1129
|
-
You'll want to pay attention to which Ruby installation you are installing the gem into.
|
1130
|
-
If successful, the `asciidoctor-pdf` executable will be available on your PATH.
|
1131
|
-
|
1132
|
-
endif::[]
|
1133
|
-
|
1134
|
-
=== Test a Pull Request
|
1135
|
-
|
1136
|
-
To test a pull request (PR), you first need to fetch the branch that contains the change and switch to it.
|
1137
|
-
The steps below are covered in detail in the https://help.github.com/articles/checking-out-pull-requests-locally[GitHub help].
|
1138
|
-
|
1139
|
-
Let's assume you want to test PR 955.
|
1140
|
-
Here's how you fetch and switch to it:
|
1141
|
-
|
1142
|
-
$ git fetch origin pull/955/head:pr-955-review
|
1143
|
-
git checkout pr-955-review
|
1144
|
-
|
1145
|
-
IMPORTANT: Make sure you replace the number with the number of the PR you want to test.
|
1146
|
-
|
1147
|
-
In case any dependencies have changed, you should run the `bundle` command again:
|
1148
|
-
|
1149
|
-
$ bundle
|
1150
|
-
|
1151
|
-
Now you can run the application as modified by the PR:
|
1152
|
-
|
1153
|
-
$ bundle exec asciidoctor-pdf /path/to/sample.adoc
|
1154
|
-
|
1155
|
-
To switch back to master, just type:
|
1156
|
-
|
1157
|
-
$ git checkout master
|
1158
|
-
|
1159
|
-
=== Generate Code Coverage Report
|
1160
|
-
|
1161
|
-
To generate a code coverage report when running tests using simplecov, set the `COVERAGE` environment variable as follows when running the tests:
|
1162
|
-
|
1163
|
-
$ COVERAGE=true bundle exec rake spec
|
1164
|
-
|
1165
|
-
You'll see a total coverage score as well as a link to the HTML report in the output.
|
1166
|
-
The HTML report helps you understand which lines and branches were missed, if any.
|
1167
|
-
|
1168
|
-
Despite being fast, the downside of using simplecov is that it misses code branches.
|
1169
|
-
You can use deep-cover instead of simplecov to generate a more thorough report.
|
1170
|
-
To do so, set the `COVERAGE` environment variable to `deep` when running the tests:
|
1171
|
-
|
1172
|
-
$ COVERAGE=deep bundle exec rake spec
|
1173
|
-
|
1174
|
-
You'll see a total coverage score, a detailed coverage report, and a link to HTML report in the output.
|
1175
|
-
The HTML report helps you understand which lines and branches were missed, if any.
|
1176
|
-
|
1177
|
-
////
|
1178
|
-
As an alternative to deep cover's native HTML reporter, you can also use istanbul / nyc.
|
1179
|
-
First, you'll need to have the `nyc` command available on your system:
|
1180
|
-
|
1181
|
-
$ npm install -g nyc
|
1182
|
-
|
1183
|
-
Next, in addition to the `COVERAGE` environment variable, also set the `DEEP_COVER_REPORTER` environment variable as follows when running the tests:
|
1184
|
-
|
1185
|
-
$ COVERAGE=deep DEEP_COVER_REPORTER=istanbul bundle exec rake spec
|
1186
|
-
|
1187
|
-
You'll see a total coverage score, a detailed coverage report, and a link to HTML report in the output.
|
1188
|
-
The HTML report helps you understand which lines and branches were missed, if any.
|
1189
|
-
////
|
1190
|
-
|
1191
|
-
=== Rebuild the Formatter Text Parser
|
1192
|
-
|
1193
|
-
The formatted text is first converted to a pseudo-HTML language, then converted from there into Prawn text fragments using a https://github.com/cjheath/treetop[treetop] parser.
|
1194
|
-
treetop is a Ruby-based parsing DSL based on parsing expression grammars.
|
1195
|
-
This strategy allows the converter to manipulate the formatted text without needing the know the internal details of how Prawn arranges text fragments.
|
1196
|
-
It also allows Asciidoctor to behave in a consistent manner, since some of the inline parsing in Asciidoctor assumes that the converter is generating an SGML-based language like HTML or DocBook.
|
1197
|
-
|
1198
|
-
The parsing expression grammar is defined in the source file [.path]_lib/asciidoctor/pdf/formatted_text/parser.treetop_.
|
1199
|
-
If you make a change to this file, you must regenerate the parser, which is defined in the source file _lib/asciidoctor/pdf/formatted_text/parser.rb_.
|
1200
|
-
(Don't modify the generated parser directly).
|
1201
|
-
|
1202
|
-
Use the following command to regenerate the parser:
|
1203
|
-
|
1204
|
-
bundle exec tt lib/asciidoctor/pdf/formatted_text/parser.treetop
|
1205
|
-
|
1206
|
-
You then need to commit both files.
|
994
|
+
See the <<CONTRIBUTING.adoc#,contributing guide>>.
|
995
|
+
To help develop {project-name}, or to simply use the development version, refer to the <<CONTRIBUTING-CODE.adoc#,developing and contributing code guide>>.
|
1207
996
|
|
1208
997
|
[[resources,Links]]
|
1209
998
|
== Resources
|
@@ -1219,5 +1008,5 @@ You then need to commit both files.
|
|
1219
1008
|
Copyright (C) 2014-2019 OpenDevise Inc. and the Asciidoctor Project.
|
1220
1009
|
Free use of this software is granted under the terms of the MIT License.
|
1221
1010
|
|
1222
|
-
For the full text of the license, see the <<LICENSE#,LICENSE>> file.
|
1223
|
-
Refer to the <<NOTICE#,NOTICE>> file for information about third-party Open Source software in use.
|
1011
|
+
For the full text of the license, see the <<LICENSE.adoc#,LICENSE>> file.
|
1012
|
+
Refer to the <<NOTICE.adoc#,NOTICE>> file for information about third-party Open Source software in use.
|
data/asciidoctor-pdf.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
s.add_runtime_dependency 'prawn', '~> 2.2.0'
|
38
38
|
s.add_runtime_dependency 'prawn-table', '~> 0.2.0'
|
39
39
|
s.add_runtime_dependency 'prawn-templates', '~> 0.1.0'
|
40
|
-
s.add_runtime_dependency 'prawn-svg', '~> 0.
|
40
|
+
s.add_runtime_dependency 'prawn-svg', '~> 0.30.0'
|
41
41
|
s.add_runtime_dependency 'prawn-icon', '~> 2.5.0'
|
42
42
|
s.add_runtime_dependency 'safe_yaml', '~> 1.0.0'
|
43
43
|
s.add_runtime_dependency 'thread_safe', '~> 0.3.0'
|
data/bin/asciidoctor-pdf
CHANGED
@@ -13,12 +13,7 @@ options = Asciidoctor::Cli::Options.new backend: 'pdf', header_footer: true
|
|
13
13
|
# FIXME provide an API in Asciidoctor for sub-components to print version information
|
14
14
|
unless ARGV != ['-v'] && (ARGV & ['-V', '--version']).empty?
|
15
15
|
$stdout.write %(Asciidoctor PDF #{Asciidoctor::PDF::VERSION} using )
|
16
|
-
|
17
|
-
if options.respond_to? :print_version
|
18
|
-
options.print_version
|
19
|
-
else
|
20
|
-
puts %(Asciidoctor #{::Asciidoctor::VERSION} [http://asciidoctor.org])
|
21
|
-
end
|
16
|
+
options.print_version
|
22
17
|
exit 0
|
23
18
|
end
|
24
19
|
|
data/data/themes/base-theme.yml
CHANGED
@@ -21,6 +21,8 @@ base_font_style: normal
|
|
21
21
|
base_line_height: 1.15
|
22
22
|
base_border_color: 'EEEEEE'
|
23
23
|
base_border_width: 0.5
|
24
|
+
role_line-through_text_decoration: line-through
|
25
|
+
role_underline_text_decoration: underline
|
24
26
|
role_big_font_size: 14
|
25
27
|
role_small_font_size: 10
|
26
28
|
button_content: '[%s]'
|
data/docs/theming-guide.adoc
CHANGED
@@ -438,6 +438,14 @@ Text can be aligned as follows:
|
|
438
438
|
* right
|
439
439
|
* justify (stretched to each edge)
|
440
440
|
|
441
|
+
==== Text Decorations
|
442
|
+
|
443
|
+
The following decorations can be applied to text:
|
444
|
+
|
445
|
+
* none (no decoration)
|
446
|
+
* underline
|
447
|
+
* line-through
|
448
|
+
|
441
449
|
==== Image Alignments
|
442
450
|
|
443
451
|
Images can be aligned as follows:
|
@@ -465,6 +473,7 @@ The following transforms are recognized:
|
|
465
473
|
|
466
474
|
* uppercase
|
467
475
|
* lowercase
|
476
|
+
* capitalize (each word, like CSS)
|
468
477
|
* none (clears an inherited value)
|
469
478
|
|
470
479
|
[CAUTION#transform-unicode-letters]
|
@@ -480,8 +489,6 @@ or
|
|
480
489
|
$ gem install unicode
|
481
490
|
====
|
482
491
|
|
483
|
-
// Additional transforms, such as capitalize, may be added in the future.
|
484
|
-
|
485
492
|
=== Colors
|
486
493
|
|
487
494
|
The theme language supports color values in three formats:
|
@@ -986,8 +993,10 @@ Each time a theme is loaded, the keys are overlaid onto the keys from the previo
|
|
986
993
|
|
987
994
|
The keys in the `role` category define custom roles for formatting.
|
988
995
|
The name of the role is the first subkey level.
|
989
|
-
The role name may
|
990
|
-
The keys under the role are the
|
996
|
+
The role name may contain a hyphen, but *a role name cannot contain an underscore*.
|
997
|
+
The keys under the role are the theming properties.
|
998
|
+
|
999
|
+
IMPORTANT: Custom roles only apply to inline phrases.
|
991
1000
|
|
992
1001
|
Here's an example of a role for making text red:
|
993
1002
|
|
@@ -1005,7 +1014,21 @@ This role can be used as follows:
|
|
1005
1014
|
Error text is shown in [.red]#red#.
|
1006
1015
|
----
|
1007
1016
|
|
1008
|
-
|
1017
|
+
You can also use a role to unset a font color (to make it inherit):
|
1018
|
+
|
1019
|
+
[source,yaml]
|
1020
|
+
----
|
1021
|
+
role:
|
1022
|
+
heading-code:
|
1023
|
+
font-color: ~
|
1024
|
+
----
|
1025
|
+
|
1026
|
+
This role can be used as follows:
|
1027
|
+
|
1028
|
+
[source,asciidoc]
|
1029
|
+
----
|
1030
|
+
== [.heading-code]`SELECT` clause
|
1031
|
+
----
|
1009
1032
|
|
1010
1033
|
The converter provides several predefined roles.
|
1011
1034
|
The `big` and `small` roles map the font size to the $base-font-size-large and $base-font-size-small values, respectively.
|
@@ -1083,6 +1106,27 @@ You'll need to define these in your theme if you'd like to make use of them when
|
|
1083
1106
|
|role:
|
1084
1107
|
heavy:
|
1085
1108
|
font-style: bold
|
1109
|
+
|
1110
|
+
|text-decoration
|
1111
|
+
|<<text-decorations,Text decoration>> +
|
1112
|
+
(default: none)
|
1113
|
+
|role:
|
1114
|
+
deleted:
|
1115
|
+
text-decoration: line-through
|
1116
|
+
|
1117
|
+
|text-decoration-color
|
1118
|
+
|<<colors,Color>> +
|
1119
|
+
(default: $role-<name>-font-color)
|
1120
|
+
|role:
|
1121
|
+
deleted:
|
1122
|
+
text-decoration-color: #ff0000
|
1123
|
+
|
1124
|
+
|text-decoration-width
|
1125
|
+
|<<values,Number>> +
|
1126
|
+
(default: 1)
|
1127
|
+
|role:
|
1128
|
+
underline:
|
1129
|
+
text-decoration-width: 0.5
|
1086
1130
|
|===
|
1087
1131
|
|
1088
1132
|
[#keys-page]
|
@@ -1156,6 +1200,12 @@ See <<Title Page>> for details.
|
|
1156
1200
|
|page:
|
1157
1201
|
margin-outer: 0.59in
|
1158
1202
|
|
1203
|
+
|mode
|
1204
|
+
|fullscreen
|
1205
|
+
(default: _not set_)
|
1206
|
+
|page:
|
1207
|
+
mode: fullscreen
|
1208
|
+
|
1159
1209
|
|size
|
1160
1210
|
|https://github.com/prawnpdf/pdf-core/blob/0.6.0/lib/pdf/core/page_geometry.rb#L16-L68[Named size^] {vbar} <<measurement-units,Measurement[width,height]>> +
|
1161
1211
|
(default: A4)
|
@@ -1349,10 +1399,22 @@ The keys in this category are used to style hyperlink text.
|
|
1349
1399
|
font-style: italic
|
1350
1400
|
|
1351
1401
|
|text-decoration
|
1352
|
-
|
1402
|
+
|<<text-decorations,Text decoration>> +
|
1353
1403
|
(default: none)
|
1354
1404
|
|link:
|
1355
1405
|
text-decoration: underline
|
1406
|
+
|
1407
|
+
|text-decoration-color
|
1408
|
+
|<<colors,Color>> +
|
1409
|
+
(default: $link-font-color)
|
1410
|
+
|link:
|
1411
|
+
text-decoration-color: #0000ff
|
1412
|
+
|
1413
|
+
|text-decoration-width
|
1414
|
+
|<<values,Number>> +
|
1415
|
+
(default: 1)
|
1416
|
+
|link:
|
1417
|
+
text-decoration-width: 0.5
|
1356
1418
|
|===
|
1357
1419
|
|
1358
1420
|
[#keys-literal]
|
@@ -1469,11 +1531,29 @@ The keys in this category control the style of most headings, including part tit
|
|
1469
1531
|
|heading:
|
1470
1532
|
font-style: bold
|
1471
1533
|
|
1534
|
+
|text-decoration
|
1535
|
+
|<<text-decorations,Text decoration>> +
|
1536
|
+
(default: none)
|
1537
|
+
|heading:
|
1538
|
+
text-decoration: underline
|
1539
|
+
|
1540
|
+
|text-decoration-color
|
1541
|
+
|<<colors,Color>> +
|
1542
|
+
(default: $heading-font-color)
|
1543
|
+
|heading:
|
1544
|
+
text-decoration-color: #cccccc
|
1545
|
+
|
1546
|
+
|text-decoration-width
|
1547
|
+
|<<values,Number>> +
|
1548
|
+
(default: 1)
|
1549
|
+
|heading:
|
1550
|
+
text-decoration-width: 0.5
|
1551
|
+
|
1472
1552
|
|text-transform
|
1473
1553
|
|<<text-transforms,Text transform>> +
|
1474
1554
|
(default: _inherit_)
|
1475
1555
|
|heading:
|
1476
|
-
text-transform:
|
1556
|
+
text-transform: capitalize
|
1477
1557
|
|
1478
1558
|
|line-height
|
1479
1559
|
|<<values,Number>> +
|
@@ -1562,7 +1642,7 @@ The keys in this category control the style of most headings, including part tit
|
|
1562
1642
|
|<<text-transforms,Text transform>> +
|
1563
1643
|
(default: $heading-text-transform)
|
1564
1644
|
|heading:
|
1565
|
-
h3-text-transform:
|
1645
|
+
h3-text-transform: uppercase
|
1566
1646
|
|
1567
1647
|
|margin-top
|
1568
1648
|
|<<measurement-units,Measurement>> +
|
@@ -1697,7 +1777,7 @@ TIP: The title page can be disabled for the book doctype by setting the `notitle
|
|
1697
1777
|
image: image:logo.png[pdfwidth=25%]
|
1698
1778
|
|
1699
1779
|
|top
|
1700
|
-
|
1780
|
+
|<<measurement-units,Measurement>>^[4]^ +
|
1701
1781
|
(default: 10%)
|
1702
1782
|
|title-page:
|
1703
1783
|
logo:
|
@@ -1755,7 +1835,7 @@ TIP: The title page can be disabled for the book doctype by setting the `notitle
|
|
1755
1835
|
line-height: 0.9
|
1756
1836
|
|
1757
1837
|
|top
|
1758
|
-
|
1838
|
+
|<<measurement-units,Measurement>>^[4]^ +
|
1759
1839
|
(default: 40%)
|
1760
1840
|
|title-page:
|
1761
1841
|
title:
|
@@ -1842,6 +1922,17 @@ TIP: The title page can be disabled for the book doctype by setting the `notitle
|
|
1842
1922
|
|
1843
1923
|
3+|[#key-prefix-authors]*Key Prefix:* <<key-prefix-authors,title-page-authors>>
|
1844
1924
|
|
1925
|
+
|content
|
1926
|
+
|<<quoted-string,Quoted AsciiDoc string>> +
|
1927
|
+
(optional subkeys: name_only, with_email, with_url) +
|
1928
|
+
(default: "\{author}")
|
1929
|
+
|title-page:
|
1930
|
+
authors:
|
1931
|
+
content:
|
1932
|
+
name_only: "{author}"
|
1933
|
+
with_email: "{author} <{email}>"
|
1934
|
+
with_url: "{url}[{author}]"
|
1935
|
+
|
1845
1936
|
|display
|
1846
1937
|
|none +
|
1847
1938
|
(default: _not set_)
|
@@ -1977,7 +2068,7 @@ The color keyword `transparent` is not recognized in this context.
|
|
1977
2068
|
The size of the background image can be controlled using any of the sizing attributes on the image macro (i.e., fit, pdfwidth, scaledwidth, or width) when `fit=none`.
|
1978
2069
|
The position of the background image can be controlled using the `position` attribute.
|
1979
2070
|
. Target may be an absolute path or a path relative to the value of the `pdf-themesdir` attribute.
|
1980
|
-
.
|
2071
|
+
. % unit is relative to content height; vh unit is relative to page height.
|
1981
2072
|
|
1982
2073
|
[#keys-prose]
|
1983
2074
|
=== Prose
|
@@ -3864,11 +3955,23 @@ The keys in this category control the arrangement and style of the table of cont
|
|
3864
3955
|
font-style: bold
|
3865
3956
|
|
3866
3957
|
|text-decoration
|
3867
|
-
|
3958
|
+
|<<text-decorations,Text decoration>> +
|
3868
3959
|
(default: none)
|
3869
3960
|
|toc:
|
3870
3961
|
text-decoration: underline
|
3871
3962
|
|
3963
|
+
|text-decoration-color
|
3964
|
+
|<<colors,Color>> +
|
3965
|
+
(default: $toc-font-color)
|
3966
|
+
|toc
|
3967
|
+
text-decoration-color: #cccccc
|
3968
|
+
|
3969
|
+
|text-decoration-width
|
3970
|
+
|<<values,Number>> +
|
3971
|
+
(default: 1)
|
3972
|
+
|toc:
|
3973
|
+
text-decoration-width: 0.5
|
3974
|
+
|
3872
3975
|
|text-transform
|
3873
3976
|
|<<text-transforms,Text transform>> +
|
3874
3977
|
(default: _inherit_)
|
@@ -3887,6 +3990,12 @@ The keys in this category control the arrangement and style of the table of cont
|
|
3887
3990
|
|toc:
|
3888
3991
|
indent: 20
|
3889
3992
|
|
3993
|
+
|hanging-indent
|
3994
|
+
|<<measurement-units,Measurement>> +
|
3995
|
+
(default: _not set_)
|
3996
|
+
|toc:
|
3997
|
+
hanging-indent: 0.5in
|
3998
|
+
|
3890
3999
|
|margin-top
|
3891
4000
|
|<<measurement-units,Measurement>> +
|
3892
4001
|
(default: 0)
|
@@ -3919,12 +4028,6 @@ The keys in this category control the arrangement and style of the table of cont
|
|
3919
4028
|
|toc:
|
3920
4029
|
font-style: italic
|
3921
4030
|
|
3922
|
-
|text-decoration
|
3923
|
-
|none {vbar} underline +
|
3924
|
-
(default: _inherit_)
|
3925
|
-
|toc:
|
3926
|
-
text-decoration: none
|
3927
|
-
|
3928
4031
|
|text-transform
|
3929
4032
|
|<<text-transforms,Text transform>> +
|
3930
4033
|
(default: _inherit_)
|
@@ -4276,6 +4379,8 @@ IMPORTANT: If you don't specify a height for either the header or footer key, it
|
|
4276
4379
|
TIP: Although not listed in the table above, you can control the font settings (font-family, font-size, font-color, font-style, text-transform) that get applied to the running content in each column position for each page side (e.g., `footer-<side>-<position>-font-color`).
|
4277
4380
|
For example, you can set the font color used for the right-hand column on recto pages by setting `footer-recto-right-font-color: 6CC644`.
|
4278
4381
|
|
4382
|
+
==== Disabling
|
4383
|
+
|
4279
4384
|
If you define running header and footer content in your theme (including the height), you can still disable this content per document by setting the `noheader` and `nofooter` attributes in the AsciiDoc document header, respectively.
|
4280
4385
|
|
4281
4386
|
If you extend either the base or default theme, and don't specify content for the footer, the current page number will be added to the right side on recto pages and the left side on verso pages.
|
@@ -4295,6 +4400,8 @@ footer:
|
|
4295
4400
|
|
4296
4401
|
Instead of erasing the content (which is what the `~` does), you can specify content of your choosing.
|
4297
4402
|
|
4403
|
+
==== Replacing
|
4404
|
+
|
4298
4405
|
If you want to replace the alternating page numbers with a centered page number, then you can restrict the footer to a single column and specify the content for the center position.
|
4299
4406
|
|
4300
4407
|
[source,yaml]
|
@@ -4490,7 +4597,13 @@ The only thing you need to add to an existing build is the attributes mentioned
|
|
4490
4597
|
* https://github.com/asciidoctor/asciidoctor-maven-examples/tree/master/asciidoctor-pdf-with-theme-example[Maven Example]
|
4491
4598
|
* https://github.com/asciidoctor/asciidoctor-gradle-examples/tree/master/asciidoc-to-pdf-with-theme-example[Gradle Example]
|
4492
4599
|
|
4493
|
-
|
4600
|
+
Speaking of Java, you can bundle and distribute your theme and fonts in a jar file.
|
4601
|
+
To reference the theme file and/or directory of fonts from inside the jar, refer to their location on the classpath using the `uri:classloader:` prefix.
|
4602
|
+
Here's how you'd load both the theme and fonts from the classpath:
|
4603
|
+
|
4604
|
+
$ asciidoctorj -b pdf -a pdf-theme="uri:classloader:/path/to/themes/my-theme.yml" -a pdf-fontsdir="uri:classloader:/path/to/fonts" document.adoc
|
4605
|
+
|
4606
|
+
This only works when running Asciidoctor PDF on the JVM.
|
4494
4607
|
|
4495
4608
|
== Theme-Related Document Attributes
|
4496
4609
|
|
@@ -4514,6 +4627,10 @@ These settings override equivalent keys defined in the theme file, where applica
|
|
4514
4627
|
(format can be image or PDF)
|
4515
4628
|
|:front-cover-image: image:front-cover.pdf[]
|
4516
4629
|
|
4630
|
+
|hyphens^[7]^
|
4631
|
+
|language code {vbar} _blank_ to default to en_us (default: _not set_)
|
4632
|
+
|:hyphens: de
|
4633
|
+
|
4517
4634
|
|media
|
4518
4635
|
|screen {vbar} print {vbar} prepress
|
4519
4636
|
|:media: prepress
|