asciidoctor-nabetani 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +92 -0
- data/LICENSE.txt +21 -0
- data/README.md +45 -0
- data/Rakefile +34 -0
- data/asciidoctor-nabetani.gemspec +22 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/asciidoctor/nabetani.rb +8 -0
- data/lib/asciidoctor/nabetani/abstractblock-xreftext.rb +44 -0
- data/lib/asciidoctor/nabetani/horz-dlist.rb +161 -0
- data/lib/asciidoctor/nabetani/nabehelper.rb +40 -0
- data/lib/asciidoctor/nabetani/pdf-custom-property.rb +21 -0
- data/lib/asciidoctor/nabetani/pdf-outline.rb +72 -0
- data/lib/asciidoctor/nabetani/prawn-linewrap-ja.rb +135 -0
- data/lib/asciidoctor/nabetani/version.rb +5 -0
- data/sample/src/horz-dlist.adoc +54 -0
- data/sample/src/index.adoc +31 -0
- data/sample/src/line-wrap.adoc +24 -0
- data/sample/src/theme.yml +128 -0
- data/sample/src/xref.adoc +63 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2035cd5fd1f7e71f56ea56f9e78836f32f843c7b09d05478b42bf5756b88c3d6
|
4
|
+
data.tar.gz: 8144173c30a41e27a2f19c7082ded879f35dae9bc0bcd5b4e5164573efab0a10
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d3dcf58f5fa99bc79fc9541039db00c25ee5b6e6df0acd3caac11e890283f7e498afe53461a541cbabb16d8b822e7b2739766dfa9eebc6fc9318cec2795d7abd
|
7
|
+
data.tar.gz: e855226020e9d206a1b11864ee5b83fca83994411282d64f36ca96ca5e374acada231234238f44a7ff70fd53dca902b6a33067a42c0e06380bee0207ce1065a0
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at takenori@nabetani.sakura.ne.jp. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in asciidoctor-nabetani.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem "rake", "~> 12.0"
|
7
|
+
gem "rspec", "~> 3.0"
|
8
|
+
gem "asciidoctor", "2.0.10"
|
9
|
+
gem "asciidoctor-pdf", "1.5.3"
|
10
|
+
gem "prawn", "2.2.2"
|
11
|
+
gem "prawn-table", "0.2.2"
|
12
|
+
gem 'asciidoctor-pdf-cjk-kai_gen_gothic'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
asciidoctor-nabetani (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
Ascii85 (1.0.3)
|
10
|
+
addressable (2.7.0)
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
12
|
+
afm (0.2.2)
|
13
|
+
asciidoctor (2.0.10)
|
14
|
+
asciidoctor-pdf (1.5.3)
|
15
|
+
asciidoctor (>= 1.5.3, < 3.0.0)
|
16
|
+
concurrent-ruby (~> 1.1.0)
|
17
|
+
prawn (~> 2.2.0)
|
18
|
+
prawn-icon (~> 2.5.0)
|
19
|
+
prawn-svg (~> 0.30.0)
|
20
|
+
prawn-table (~> 0.2.0)
|
21
|
+
prawn-templates (~> 0.1.0)
|
22
|
+
safe_yaml (~> 1.0.0)
|
23
|
+
thread_safe (~> 0.3.0)
|
24
|
+
treetop (~> 1.6.0)
|
25
|
+
ttfunk (~> 1.5.0, >= 1.5.1)
|
26
|
+
asciidoctor-pdf-cjk (0.1.3)
|
27
|
+
asciidoctor-pdf (~> 1.5.0.alpha.8)
|
28
|
+
asciidoctor-pdf-cjk-kai_gen_gothic (0.1.1)
|
29
|
+
asciidoctor-pdf-cjk (~> 0.1.2)
|
30
|
+
concurrent-ruby (1.1.7)
|
31
|
+
css_parser (1.7.1)
|
32
|
+
addressable
|
33
|
+
diff-lcs (1.4.4)
|
34
|
+
hashery (2.1.2)
|
35
|
+
pdf-core (0.7.0)
|
36
|
+
pdf-reader (2.4.0)
|
37
|
+
Ascii85 (~> 1.0.0)
|
38
|
+
afm (~> 0.2.1)
|
39
|
+
hashery (~> 2.0)
|
40
|
+
ruby-rc4
|
41
|
+
ttfunk
|
42
|
+
polyglot (0.3.5)
|
43
|
+
prawn (2.2.2)
|
44
|
+
pdf-core (~> 0.7.0)
|
45
|
+
ttfunk (~> 1.5)
|
46
|
+
prawn-icon (2.5.0)
|
47
|
+
prawn (>= 1.1.0, < 3.0.0)
|
48
|
+
prawn-svg (0.30.0)
|
49
|
+
css_parser (~> 1.6)
|
50
|
+
prawn (>= 0.11.1, < 3)
|
51
|
+
prawn-table (0.2.2)
|
52
|
+
prawn (>= 1.3.0, < 3.0.0)
|
53
|
+
prawn-templates (0.1.2)
|
54
|
+
pdf-reader (~> 2.0)
|
55
|
+
prawn (~> 2.2)
|
56
|
+
public_suffix (4.0.5)
|
57
|
+
rake (12.3.3)
|
58
|
+
rspec (3.9.0)
|
59
|
+
rspec-core (~> 3.9.0)
|
60
|
+
rspec-expectations (~> 3.9.0)
|
61
|
+
rspec-mocks (~> 3.9.0)
|
62
|
+
rspec-core (3.9.2)
|
63
|
+
rspec-support (~> 3.9.3)
|
64
|
+
rspec-expectations (3.9.2)
|
65
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
66
|
+
rspec-support (~> 3.9.0)
|
67
|
+
rspec-mocks (3.9.1)
|
68
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
69
|
+
rspec-support (~> 3.9.0)
|
70
|
+
rspec-support (3.9.3)
|
71
|
+
ruby-rc4 (0.1.5)
|
72
|
+
safe_yaml (1.0.5)
|
73
|
+
thread_safe (0.3.6)
|
74
|
+
treetop (1.6.10)
|
75
|
+
polyglot (~> 0.3)
|
76
|
+
ttfunk (1.5.1)
|
77
|
+
|
78
|
+
PLATFORMS
|
79
|
+
ruby
|
80
|
+
|
81
|
+
DEPENDENCIES
|
82
|
+
asciidoctor (= 2.0.10)
|
83
|
+
asciidoctor-nabetani!
|
84
|
+
asciidoctor-pdf (= 1.5.3)
|
85
|
+
asciidoctor-pdf-cjk-kai_gen_gothic
|
86
|
+
prawn (= 2.2.2)
|
87
|
+
prawn-table (= 0.2.2)
|
88
|
+
rake (~> 12.0)
|
89
|
+
rspec (~> 3.0)
|
90
|
+
|
91
|
+
BUNDLED WITH
|
92
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Nabetani
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# asciidoctor-nabetani
|
2
|
+
|
3
|
+
An assortment of things I needed to make a Japanese PDF document with asciidoctor.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'asciidoctor-nabetani'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```
|
16
|
+
$ bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
```
|
22
|
+
$ gem install asciidoctor-nabetani
|
23
|
+
```
|
24
|
+
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
TODO: Write usage instructions here
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/nabetani/asciidoctor-nabetani.
|
33
|
+
|
34
|
+
## Special Thanks
|
35
|
+
|
36
|
+
This project is inspired by [asciidoctor-pdf-linewrap-ja](https://github.com/fuka/asciidoctor-pdf-linewrap-ja)
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
|
+
|
42
|
+
## Code of Conduct
|
43
|
+
|
44
|
+
Everyone interacting in the Asciidoctor::Nabetani project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/asciidoctor-nabetani/blob/master/CODE_OF_CONDUCT.md).
|
45
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
desc 'Create Sample PDF'
|
7
|
+
task :pdf do
|
8
|
+
cmd = %W[
|
9
|
+
asciidoctor-pdf
|
10
|
+
-r asciidoctor-pdf-cjk-kai_gen_gothic
|
11
|
+
-r asciidoctor/nabetani/prawn-linewrap-ja
|
12
|
+
-r asciidoctor/nabetani/abstractblock-xreftext
|
13
|
+
-r asciidoctor/nabetani/pdf-custom-property
|
14
|
+
-r asciidoctor/nabetani/horz-dlist
|
15
|
+
-r asciidoctor/nabetani/pdf-outline
|
16
|
+
sample/src/index.adoc
|
17
|
+
-o sample/book.pdf
|
18
|
+
]
|
19
|
+
sh cmd.join(' ')
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Create Sample PDF Without This Library'
|
23
|
+
task :pdf_org do
|
24
|
+
cmd = %W[
|
25
|
+
asciidoctor-pdf
|
26
|
+
-r asciidoctor-pdf-cjk-kai_gen_gothic
|
27
|
+
sample/src/index.adoc
|
28
|
+
-o sample/book_org.pdf
|
29
|
+
]
|
30
|
+
sh cmd.join(' ')
|
31
|
+
end
|
32
|
+
|
33
|
+
task default: :spec
|
34
|
+
task pdfs: [:pdf, :pdf_org]
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative 'lib/asciidoctor/nabetani/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "asciidoctor-nabetani"
|
5
|
+
spec.version = Asciidoctor::Nabetani::VERSION
|
6
|
+
spec.authors = ["Nabetani"]
|
7
|
+
spec.email = ["takenori@nabetani.sakura.ne.jp"]
|
8
|
+
|
9
|
+
spec.summary = %q{An assortment of things I needed to make a Japanese PDF document with asciidoctor.}
|
10
|
+
spec.homepage = "https://github.com/nabetani/asciidoctor-nabetani"
|
11
|
+
spec.license = "MIT"
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
13
|
+
|
14
|
+
# Specify which files should be added to the gem when it is released.
|
15
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
16
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "asciidoctor/nabetani"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "asciidoctor"
|
4
|
+
|
5
|
+
module Asciidoctor
|
6
|
+
class Section < AbstractBlock
|
7
|
+
def xreftext xrefstyle = nil
|
8
|
+
if (val = reftext) && !val.empty?
|
9
|
+
val
|
10
|
+
elsif xrefstyle
|
11
|
+
if @numbered
|
12
|
+
case xrefstyle
|
13
|
+
when 'custom'
|
14
|
+
fmt = @document.attributes["xrefcustomformat"]
|
15
|
+
fmt.gsub( "[$SECT_NUMS$]", sectnum.gsub( /[\.\,]$/, "" ) ).gsub( "[$TITLE$]", title )
|
16
|
+
when 'full'
|
17
|
+
if (type = @sectname) == 'chapter' || type == 'appendix'
|
18
|
+
quoted_title = sub_placeholder (sub_quotes '_%s_'), title
|
19
|
+
else
|
20
|
+
quoted_title = sub_placeholder (sub_quotes @document.compat_mode ? %q(``%s'') : '"`%s`"'), title
|
21
|
+
end
|
22
|
+
if (signifier = @document.attributes[%(#{type}-refsig)])
|
23
|
+
%(#{signifier} #{sectnum '.', ','} #{quoted_title})
|
24
|
+
else
|
25
|
+
%(#{sectnum '.', ','} #{quoted_title})
|
26
|
+
end
|
27
|
+
when 'short'
|
28
|
+
if (signifier = @document.attributes[%(#{@sectname}-refsig)])
|
29
|
+
%(#{signifier} #{sectnum '.', ''})
|
30
|
+
else
|
31
|
+
sectnum '.', ''
|
32
|
+
end
|
33
|
+
else # 'basic'
|
34
|
+
(type = @sectname) == 'chapter' || type == 'appendix' ? (sub_placeholder (sub_quotes '_%s_'), title) : title
|
35
|
+
end
|
36
|
+
else # apply basic styling
|
37
|
+
(type = @sectname) == 'chapter' || type == 'appendix' ? (sub_placeholder (sub_quotes '_%s_'), title) : title
|
38
|
+
end
|
39
|
+
else
|
40
|
+
title
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,161 @@
|
|
1
|
+
require "asciidoctor-pdf"
|
2
|
+
require_relative "nabehelper"
|
3
|
+
|
4
|
+
module Asciidoctor
|
5
|
+
module PDF
|
6
|
+
class Converter
|
7
|
+
include NabeHelper
|
8
|
+
def convert_paragraph node
|
9
|
+
add_dest_for_block node if node.id
|
10
|
+
prose_opts = { margin_bottom: 0, hyphenate: true }
|
11
|
+
lead = (roles = node.roles).include? 'lead'
|
12
|
+
if (align = resolve_alignment_from_role roles)
|
13
|
+
prose_opts[:align] = align
|
14
|
+
end
|
15
|
+
|
16
|
+
if (text_indent = @theme.prose_text_indent || 0) > 0
|
17
|
+
prose_opts[:indent_paragraphs] = text_indent
|
18
|
+
end
|
19
|
+
|
20
|
+
# TODO: check if we're within one line of the bottom of the page
|
21
|
+
# and advance to the next page if so (similar to logic for section titles)
|
22
|
+
layout_caption node.title if node.title?
|
23
|
+
|
24
|
+
if lead
|
25
|
+
theme_font :lead do
|
26
|
+
layout_prose node.content, prose_opts
|
27
|
+
end
|
28
|
+
else
|
29
|
+
layout_prose node.content, prose_opts
|
30
|
+
end
|
31
|
+
|
32
|
+
dlist = node&.parent&.parent&.parent
|
33
|
+
|
34
|
+
if dlist&.style=="horizontal"
|
35
|
+
m = get_node_attriute_float( dlist, "margin-bottom", nil )
|
36
|
+
if m
|
37
|
+
margin_bottom m
|
38
|
+
return
|
39
|
+
end
|
40
|
+
end
|
41
|
+
if (margin_inner_val = @theme.prose_margin_inner) &&
|
42
|
+
(next_block = (siblings = node.parent.blocks)[(siblings.index node) + 1]) && next_block.context == :paragraph
|
43
|
+
margin_bottom margin_inner_val
|
44
|
+
else
|
45
|
+
margin_bottom @theme.prose_margin_bottom
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def convert_dlist node
|
50
|
+
add_dest_for_block node if node.id
|
51
|
+
|
52
|
+
case (style = node.style)
|
53
|
+
when 'unordered', 'ordered'
|
54
|
+
if style == 'unordered'
|
55
|
+
list_style = :ulist
|
56
|
+
(markers = @list_bullets) << :disc
|
57
|
+
else
|
58
|
+
list_style = :olist
|
59
|
+
(markers = @list_numerals) << 1
|
60
|
+
end
|
61
|
+
list = List.new node.parent, list_style
|
62
|
+
stack_subject = node.has_role? 'stack'
|
63
|
+
subject_stop = node.attr 'subject-stop', (stack_subject ? nil : ':'), false
|
64
|
+
node.items.each do |subjects, dd|
|
65
|
+
subject = [*subjects].first.text
|
66
|
+
list_item_text = %(+++<strong>#{subject}#{(StopPunctRx.match? sanitize subject) ? '' : subject_stop}</strong>#{dd.text? ? "#{stack_subject ? '<br>' : ' '}#{dd.text}" : ''}+++)
|
67
|
+
list_item = ListItem.new list, list_item_text
|
68
|
+
dd.blocks.each {|it| list_item << it }
|
69
|
+
list << list_item
|
70
|
+
end
|
71
|
+
convert_outline_list list
|
72
|
+
markers.pop
|
73
|
+
when 'horizontal'
|
74
|
+
table_data = []
|
75
|
+
term_padding = desc_padding = term_line_metrics = term_inline_format = term_kerning = nil
|
76
|
+
max_term_width = 0
|
77
|
+
theme_font :description_list_term do
|
78
|
+
if (term_font_styles = font_styles).empty?
|
79
|
+
term_inline_format = true
|
80
|
+
else
|
81
|
+
term_inline_format = [inherited: { styles: term_font_styles }]
|
82
|
+
end
|
83
|
+
margin_left = get_node_attriute_float(node, 'margin-left', 10)
|
84
|
+
margin_bottom = get_node_attriute_float(node, 'margin-bottom', (@theme.prose_margin_bottom || 0) * 0.5 )
|
85
|
+
term_line_metrics = calc_line_metrics @theme.description_list_term_line_height || @theme.base_line_height
|
86
|
+
term_padding = [
|
87
|
+
term_line_metrics.padding_top, # up
|
88
|
+
10, # right
|
89
|
+
margin_bottom + term_line_metrics.padding_bottom, # bottom
|
90
|
+
margin_left # left
|
91
|
+
]
|
92
|
+
desc_padding = [
|
93
|
+
0, # up
|
94
|
+
10, # right
|
95
|
+
margin_bottom, # bottom
|
96
|
+
10 # left
|
97
|
+
]
|
98
|
+
term_kerning = default_kerning?
|
99
|
+
end
|
100
|
+
node.items.each do |terms, desc|
|
101
|
+
term_text = terms.map(&:text).join ?\n
|
102
|
+
if (term_width = width_of term_text, inline_format: term_inline_format, kerning: term_kerning) > max_term_width
|
103
|
+
max_term_width = term_width
|
104
|
+
end
|
105
|
+
row_data = [{
|
106
|
+
text_color: @font_color,
|
107
|
+
kerning: term_kerning,
|
108
|
+
content: term_text,
|
109
|
+
inline_format: term_inline_format,
|
110
|
+
padding: term_padding,
|
111
|
+
leading: term_line_metrics.leading,
|
112
|
+
# FIXME: prawn-table doesn't have support for final_gap option
|
113
|
+
#final_gap: term_line_metrics.final_gap,
|
114
|
+
valign: :top,
|
115
|
+
}]
|
116
|
+
desc_container = Block.new desc, :open
|
117
|
+
desc_container << (Block.new desc_container, :paragraph, source: (desc.instance_variable_get :@text), subs: :default) if desc.text?
|
118
|
+
desc.blocks.each {|b| desc_container << b } if desc.block?
|
119
|
+
row_data << {
|
120
|
+
content: (::Prawn::Table::Cell::AsciiDoc.new self, content: desc_container, text_color: @font_color, padding: desc_padding, valign: :top),
|
121
|
+
}
|
122
|
+
table_data << row_data
|
123
|
+
end
|
124
|
+
max_term_width += (term_padding[1] + term_padding[3])
|
125
|
+
term_column_width = [max_term_width, bounds.width * 0.5].min
|
126
|
+
table table_data, position: :left, cell_style: { border_width: 0 }, column_widths: [term_column_width] do
|
127
|
+
@pdf.layout_table_caption node if node.title?
|
128
|
+
end
|
129
|
+
margin_bottom 0 # (@theme.prose_margin_bottom || 0) * 0.5
|
130
|
+
when 'qanda'
|
131
|
+
@list_numerals << '1'
|
132
|
+
convert_outline_list node
|
133
|
+
@list_numerals.pop
|
134
|
+
else
|
135
|
+
# TODO: check if we're within one line of the bottom of the page
|
136
|
+
# and advance to the next page if so (similar to logic for section titles)
|
137
|
+
layout_caption node.title, category: :description_list if node.title?
|
138
|
+
|
139
|
+
term_line_height = @theme.description_list_term_line_height || @theme.base_line_height
|
140
|
+
line_metrics = theme_font(:description_list_term) { calc_line_metrics term_line_height }
|
141
|
+
node.items.each do |terms, desc|
|
142
|
+
# NOTE: don't orphan the terms (keep together terms and at least one line of content)
|
143
|
+
allocate_space_for_list_item line_metrics, (terms.size + 1), ((@theme.description_list_term_spacing || 0) + 0.05)
|
144
|
+
theme_font :description_list_term do
|
145
|
+
if (term_font_styles = font_styles).empty?
|
146
|
+
term_font_styles = nil
|
147
|
+
end
|
148
|
+
terms.each do |term|
|
149
|
+
# QUESTION should we pass down styles in other calls to layout_prose
|
150
|
+
layout_prose term.text, margin_top: 0, margin_bottom: @theme.description_list_term_spacing, align: :left, line_height: term_line_height, normalize_line_height: true, styles: term_font_styles
|
151
|
+
end
|
152
|
+
end
|
153
|
+
indent(@theme.description_list_description_indent || 0) do
|
154
|
+
traverse_list_item desc, :dlist_desc, normalize_line_height: true
|
155
|
+
end if desc
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module NabeHelper
|
3
|
+
module_function
|
4
|
+
def get_node_attriute_float node, name, fallback
|
5
|
+
t = node.attributes[name]
|
6
|
+
return fallback unless t
|
7
|
+
|
8
|
+
begin
|
9
|
+
return Float(t)
|
10
|
+
rescue ArgumentError => e
|
11
|
+
raise ArgumentError, "#{name} value should be float value, but it is #{t.inspect} (#{e.inspect})"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def three_state(v0, key)
|
16
|
+
v = v0.is_a?(String) ? v0.downcase.strip : v0
|
17
|
+
case v
|
18
|
+
when true, 1, 'true', '1', 'yes', 'on'
|
19
|
+
true
|
20
|
+
when false, 0, 'false', '0', 'no', 'off'
|
21
|
+
false
|
22
|
+
when nil, 'nil', 'null', 'default', '~'
|
23
|
+
nil
|
24
|
+
else
|
25
|
+
raise ArgumentError, "#{key} should be true, false, or nil, but it is #{v0.inspect}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_node_attriute_float_array node, name, fallback
|
30
|
+
t = node.attributes[name]
|
31
|
+
return fallback unless t
|
32
|
+
|
33
|
+
begin
|
34
|
+
return t.split(",").map{ |e| Float(e.strip) }
|
35
|
+
rescue ArgumentError => e
|
36
|
+
raise ArgumentError, "#{name} value should be array of float value, but it is #{t.inspect} (#{e.inspect})"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "asciidoctor-pdf"
|
2
|
+
|
3
|
+
module Asciidoctor
|
4
|
+
module PDF
|
5
|
+
class Converter
|
6
|
+
alias_method :build_pdf_info_original, :build_pdf_info
|
7
|
+
def build_pdf_info doc
|
8
|
+
info = build_pdf_info_original(doc)
|
9
|
+
keys = %w( Title Author Subject Keywords Producer Creator )
|
10
|
+
keys.each do |key|
|
11
|
+
val = doc.attr( ("pdf_"+key).downcase )
|
12
|
+
next unless val
|
13
|
+
info[ key.to_sym ] = val.to_s.as_pdf
|
14
|
+
end
|
15
|
+
info
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "asciidoctor-pdf"
|
4
|
+
|
5
|
+
module Prawn
|
6
|
+
class Outline
|
7
|
+
include Asciidoctor::NabeHelper
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module Asciidoctor
|
12
|
+
module PDF
|
13
|
+
class Converter
|
14
|
+
def add_outline doc, num_levels = 2, toc_page_nums = [], num_front_matter_pages = 0, has_front_cover = false
|
15
|
+
if ::String === num_levels
|
16
|
+
if num_levels.include? ':'
|
17
|
+
num_levels, expand_levels = num_levels.split ':', 2
|
18
|
+
num_levels = num_levels.empty? ? (doc.attr 'toclevels', 2).to_i : num_levels.to_i
|
19
|
+
expand_levels = expand_levels.to_i
|
20
|
+
else
|
21
|
+
num_levels = expand_levels = num_levels.to_i
|
22
|
+
end
|
23
|
+
else
|
24
|
+
expand_levels = num_levels
|
25
|
+
end
|
26
|
+
front_matter_counter = RomanNumeral.new 0, :lower
|
27
|
+
pagenum_labels = {}
|
28
|
+
|
29
|
+
num_front_matter_pages.times do |n|
|
30
|
+
pagenum_labels[n] = { P: (::PDF::Core::LiteralString.new front_matter_counter.next!.to_s) }
|
31
|
+
end
|
32
|
+
|
33
|
+
# add labels for each content page, which is required for reader's page navigator to work correctly
|
34
|
+
(num_front_matter_pages..(page_count - 1)).each_with_index do |n, i|
|
35
|
+
pagenum_labels[n] = { P: (::PDF::Core::LiteralString.new (i + 1).to_s) }
|
36
|
+
end
|
37
|
+
|
38
|
+
unless toc_page_nums.none? || (toc_title = doc.attr 'toc-title').nil_or_empty?
|
39
|
+
toc_section = insert_toc_section doc, toc_title, toc_page_nums
|
40
|
+
end
|
41
|
+
|
42
|
+
outline.define do
|
43
|
+
initial_pagenum = has_front_cover ? 2 : 1
|
44
|
+
# FIXME: use sanitize: :plain_text once available
|
45
|
+
keyname = "bookmark_include_title_page in theme-yaml"
|
46
|
+
case three_state(document.theme.bookmark_include_title_page, keyname)
|
47
|
+
when true
|
48
|
+
doctitle = doc.header? ? doc.doctitle : (doc.attr 'untitled-label')
|
49
|
+
doctitle ||= "title page"
|
50
|
+
page title: (document.sanitize doctitle), destination: (document.dest_top has_front_cover ? 2 : 1)
|
51
|
+
when false
|
52
|
+
# nothing needs to happen
|
53
|
+
else # nil
|
54
|
+
if document.page_count >= initial_pagenum && (doctitle = doc.header? ? doc.doctitle : (doc.attr 'untitled-label'))
|
55
|
+
page title: (document.sanitize doctitle), destination: (document.dest_top has_front_cover ? 2 : 1)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
# QUESTION is there any way to get add_outline_level to invoke in the context of the outline?
|
59
|
+
document.add_outline_level self, doc.sections, num_levels, expand_levels
|
60
|
+
end
|
61
|
+
|
62
|
+
toc_section.parent.blocks.delete toc_section if toc_section
|
63
|
+
|
64
|
+
catalog.data[:PageLabels] = state.store.ref Nums: pagenum_labels.flatten
|
65
|
+
primary_page_mode, secondary_page_mode = PageModes[(doc.attr 'pdf-page-mode') || @theme.page_mode]
|
66
|
+
catalog.data[:PageMode] = primary_page_mode
|
67
|
+
catalog.data[:NonFullScreenPageMode] = secondary_page_mode if secondary_page_mode
|
68
|
+
nil
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# Prawn の改行制御を変更するライブラリ。
|
2
|
+
# require すると、Prawn::Text::Formatted モジュールの LineWrap クラスを書き換える。
|
3
|
+
# 変更内容は
|
4
|
+
# * disable_wrap_by_char を常に true にする
|
5
|
+
# * 漢字やひらがなが続く文字列の途中での改行を許可する
|
6
|
+
# 辺り。
|
7
|
+
# * 行頭禁則・行末禁則の文字については asciidoctor-pdf-linewrap-ja を参考にした。
|
8
|
+
#
|
9
|
+
# known issue #1
|
10
|
+
# メソッド tokenize で、文字コードを見るべきだが、見ていない。
|
11
|
+
# utf-8 以外の入力があると不具合に見舞われると考えているが、試していない。
|
12
|
+
#
|
13
|
+
|
14
|
+
require "prawn"
|
15
|
+
|
16
|
+
module Prawn
|
17
|
+
module Text
|
18
|
+
module Formatted
|
19
|
+
class LineWrap
|
20
|
+
alias_method :original_initialize_line, :initialize_line
|
21
|
+
|
22
|
+
def initialize_line(options)
|
23
|
+
original_initialize_line(options)
|
24
|
+
@disable_wrap_by_char = true
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.or_rgexp( chars )
|
28
|
+
s = chars.chars.map{ |e| Regexp.escape(e) }.join
|
29
|
+
/[#{s}]/
|
30
|
+
end
|
31
|
+
|
32
|
+
PROHIBIT_LINE_BREAK_BEFORE_CHARS =
|
33
|
+
'‐〜゠–' + # ハイフン類(cl-03)※ 普通の半角マイナスはエスケープが必要なので別途で
|
34
|
+
'·・:;' + # 中点類(cl-05)
|
35
|
+
'!?‼⁇⁈⁉' + # 区切り約物(cl-04)※ 半角の ? ! はエスケープが必要なので別途で
|
36
|
+
'・・:;' + # 中点類(cl-05)※ 半角の : ; はエスケープが必要なので別途で
|
37
|
+
'。.。' + # 句点類(cl-06)※ 半角ピリオドはエスケープが必要なので別途で
|
38
|
+
'、,、' + # 読点類(cl-07)※ 半角コンマはエスケープが必要なので別途で
|
39
|
+
'ヽヾゝゞ々〻' + # 繰返し記号(cl-09)
|
40
|
+
'ーー' + # 長音記号(cl-10)
|
41
|
+
'ぁぃぅぇぉァィゥェォっゃゅょゎゕゖッャュョヮヵヶㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ'.freeze # 小書きの仮名(cl-11)
|
42
|
+
|
43
|
+
# 行頭禁則
|
44
|
+
PROHIBIT_LINE_BREAK_BEFORE =
|
45
|
+
/.[\-\.\,\!\?\:\;\p{Terminal_Punctuation}\p{Close_Punctuation}\p{Final_Punctuation}#{PROHIBIT_LINE_BREAK_BEFORE_CHARS}]/.freeze
|
46
|
+
|
47
|
+
PROHIBIT_LINE_BREAK_AFTER_CHARS = "¿¡⸘"
|
48
|
+
|
49
|
+
# 行末禁則
|
50
|
+
PROHIBIT_LINE_BREAK_AFTER =
|
51
|
+
/[\p{Initial_Punctuation}\p{Open_Punctuation}#{PROHIBIT_LINE_BREAK_AFTER_CHARS}]./.freeze
|
52
|
+
|
53
|
+
# 各種ダッシュ。種類が異なってもよい。
|
54
|
+
DASH_PATTERN = /[\u{2012}\u{2013}\u{2014}\u{2015}\u{2E3A}\u{2E3B}]{2}/
|
55
|
+
|
56
|
+
# 同一種類のリーダーの2個繰り返し
|
57
|
+
LEADER_PATTERN = /\u{2026}\u{2026}|\u{2025}\u{2025}|\u{22EF}\u{22EF}/
|
58
|
+
|
59
|
+
ATMARKS = "\u{0040}\u{FE6B}\u{FF20}"
|
60
|
+
UNDERSCORES = "\u{005F}\u{0332}\u{FF3F}"
|
61
|
+
|
62
|
+
# 英数字・キリル文字・ギリシャ文字・コンマ・ピリオド の繰り返し
|
63
|
+
ALNUM_PATTERN = /[\p{Latin}\p{Greek}\p{Cyrillic}0-90-9\.\,#{ATMARKS}#{UNDERSCORES}]{2}/
|
64
|
+
|
65
|
+
EXTRA_SPLITTABLE_CHAR =
|
66
|
+
'ーー' + # 音引き
|
67
|
+
'〇∞∴♂♀&*☆★○●◎◇◆□■△▲▽▼※♪◯©®'+ # 色々
|
68
|
+
"\u{2026}\u{2025}\u{22EF}" + # リーダー
|
69
|
+
"\u{2012}\u{2013}\u{2014}\u{2015}\u{2E3A}\u{2E3B}" # 各種ダッシュ
|
70
|
+
|
71
|
+
def split_pattern(s)
|
72
|
+
case s
|
73
|
+
when PROHIBIT_LINE_BREAK_BEFORE,
|
74
|
+
PROHIBIT_LINE_BREAK_AFTER,
|
75
|
+
DASH_PATTERN,
|
76
|
+
LEADER_PATTERN,
|
77
|
+
ALNUM_PATTERN
|
78
|
+
false
|
79
|
+
when /[\-\s\p{Space}\u{200B}\u{00ad}]/, # 空白(200b は、ゼロ幅空白。00ad は、soft-hyphen)
|
80
|
+
/[\p{Hiragana}\p{Katakana}#{EXTRA_SPLITTABLE_CHAR}\p{Han}]/, # 日本語等
|
81
|
+
/[\p{Initial_Punctuation}\p{Open_Punctuation}]/, # 開き括弧等
|
82
|
+
/[\p{Terminal_Punctuation}\p{Close_Punctuation}\p{Final_Punctuation}]/ # 閉じ括弧等
|
83
|
+
true
|
84
|
+
else
|
85
|
+
false
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def tokenize(fragment)
|
90
|
+
fragment.size.times.with_object(["".clone]) do |ix,s|
|
91
|
+
cur = fragment[ix]
|
92
|
+
if s.last.empty?
|
93
|
+
s.last << cur
|
94
|
+
elsif split_pattern(s.last[-1]+cur)
|
95
|
+
s.push cur
|
96
|
+
else
|
97
|
+
s.last << cur
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def end_of_the_line_reached(segment)
|
103
|
+
if !@fragment_output.strip.empty? && !segment.strip.empty?
|
104
|
+
@line_contains_more_than_one_word = true
|
105
|
+
end
|
106
|
+
|
107
|
+
update_line_status_based_on_last_output
|
108
|
+
unless @line_contains_more_than_one_word
|
109
|
+
wrap_by_char(segment)
|
110
|
+
end
|
111
|
+
@line_full = true
|
112
|
+
end
|
113
|
+
|
114
|
+
def text_ended_with_breakable( text )
|
115
|
+
true
|
116
|
+
end
|
117
|
+
|
118
|
+
def get_last_token_of(text)
|
119
|
+
if text
|
120
|
+
tokenize(text).last
|
121
|
+
else
|
122
|
+
""
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def remember_this_fragment_for_backward_looking_ops
|
127
|
+
@previous_fragment = @fragment_output.dup
|
128
|
+
pf = @previous_fragment
|
129
|
+
@previous_fragment_ended_with_breakable = text_ended_with_breakable(pf)
|
130
|
+
@previous_fragment_output_without_last_word = get_last_token_of pf
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
== Horizontal dlist
|
2
|
+
|
3
|
+
=== default
|
4
|
+
|
5
|
+
[horizontal]
|
6
|
+
Foo:: bar
|
7
|
+
Baz Qux:: quux corge
|
8
|
+
Grault Garply Waldo:: fred plugh xyzzy thud
|
9
|
+
Tata Toto Tete::
|
10
|
+
First line +
|
11
|
+
Second line +
|
12
|
+
Third line +
|
13
|
+
Xyzzy::
|
14
|
+
Long long line which can not be written in a line. So renderer should find one or some position(s) to split this line to two lines or more.
|
15
|
+
|
16
|
+
=== margin-left=20, margin-bottom=0
|
17
|
+
|
18
|
+
[horizontal, margin-left=20, margin-bottom=0]
|
19
|
+
Foo:: bar
|
20
|
+
Baz Qux:: quux corge
|
21
|
+
Grault Garply Waldo:: fred plugh xyzzy thud
|
22
|
+
Tata Toto Tete::
|
23
|
+
First line +
|
24
|
+
Second line +
|
25
|
+
Third line +
|
26
|
+
Xyzzy::
|
27
|
+
Long long line which can not be written in a line. So renderer should find one or some position(s) to split this line to two lines or more.
|
28
|
+
|
29
|
+
=== margin-left=0, margin-bottom=20
|
30
|
+
|
31
|
+
[horizontal, margin-left=0, margin-bottom=20]
|
32
|
+
Foo:: bar
|
33
|
+
Baz Qux:: quux corge
|
34
|
+
Grault Garply Waldo:: fred plugh xyzzy thud
|
35
|
+
Tata Toto Tete::
|
36
|
+
First line +
|
37
|
+
Second line +
|
38
|
+
Third line +
|
39
|
+
Xyzzy::
|
40
|
+
Long long line which can not be written in a line. So renderer should find one or some position(s) to split this line to two lines or more.
|
41
|
+
|
42
|
+
=== margin-left=0, margin-bottom=0
|
43
|
+
|
44
|
+
[horizontal, margin-left=0, margin-bottom=0]
|
45
|
+
Foo:: bar
|
46
|
+
Baz Qux:: quux corge
|
47
|
+
Grault Garply Waldo:: fred plugh xyzzy thud
|
48
|
+
Tata Toto Tete::
|
49
|
+
First line +
|
50
|
+
Second line +
|
51
|
+
Third line +
|
52
|
+
Xyzzy::
|
53
|
+
Long long line which can not be written in a line. So renderer should find one or some position(s) to split this line to two lines or more.
|
54
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
:encoding: utf-8
|
2
|
+
:lang: ja
|
3
|
+
:doctype: book
|
4
|
+
:pdf-style: sample/src/theme.yml
|
5
|
+
|
6
|
+
:doctitle: asciidoctor-nabetani sample
|
7
|
+
|
8
|
+
// タイトル
|
9
|
+
:pdf_title: PDF Title
|
10
|
+
// 作成者
|
11
|
+
:pdf_author: PDF Author
|
12
|
+
// サブタイトル
|
13
|
+
:pdf_subject: PDF Subject
|
14
|
+
// キーワード
|
15
|
+
:pdf_keywords: PDF Keywords
|
16
|
+
// PDF変換 (例: Acrobat Distiller)
|
17
|
+
:pdf_producer: n/a
|
18
|
+
// アプリケーション (例: FrameMaker 6.0)
|
19
|
+
:pdf_creator: Asciidoctor with asciidoctor-nabetani
|
20
|
+
|
21
|
+
|
22
|
+
:sectnums:
|
23
|
+
:toc-title: 目次
|
24
|
+
:toc:
|
25
|
+
|
26
|
+
include::line-wrap.adoc[]
|
27
|
+
|
28
|
+
include::xref.adoc[]
|
29
|
+
|
30
|
+
include::horz-dlist.adoc[]
|
31
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
== 改行制御
|
2
|
+
|
3
|
+
[cols="1,1,1,1"]
|
4
|
+
|===
|
5
|
+
|foo
|
6
|
+
|bar
|
7
|
+
|baz
|
8
|
+
|qux
|
9
|
+
|
10
|
+
|
|
11
|
+
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)(q)(r)(s)(t)(u)(v)(w)(x)(y)(z)(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)(q)(r)(s)(t)(u)(v)(w)(x)(y)(z)
|
12
|
+
Oh be a fine girl, kiss me, right now, sweet!
|
13
|
+
Oh be a fine girl, kiss me, right now, sweet!
|
14
|
+
|
|
15
|
+
《a》《b》《c》《d》《e》《f》《g》《h》《i》《j》《k》《l》《m》《n》《o》《p》《q》《r》《s》《t》《u》《v》《w》《x》《y》《z》《a》《b》《c》《d》《e》《f》《g》《h》《i》《j》《k》《l》《m》《n》《o》《p》《q》《r》《s》《t》《u》《v》《w》《x》《y》《z》
|
16
|
+
|
|
17
|
+
foo ほげふがほげふがほげふが foo bar ほげふがほげふがほげふが foo bar baz ほげふがほげふがほげふが foo bar baz qux ほげふがほげふがほげふが
|
18
|
+
foo bar baz qux quux ほげふがほげふがほげふが
|
19
|
+
foo bar baz qux quux corge ほげふがほげふがほげふが
|
20
|
+
foo bar baz qux quux corge grault ほげふがほげふがほげふが
|
21
|
+
|
|
22
|
+
あいうえおかきちゃーっ。あいうえおかきくちゃーっ。あいうえおかきくけちゃーっ。あいうえおかきくけこちゃーっ。あいうえおかきくけこさちゃーっ。あいうえおかきくけこさしちゃーっ。 +
|
23
|
+
「括弧」『かっこ』【括弧】[かっこ]“クオート”〈ブラケット〉«ギュメ»。「そして三点リーダー……。」「括弧」『かっこ』【括弧】[かっこ]“クオート”〈ブラケット〉«ギュメ»。「そして三点リーダー……。」
|
24
|
+
|===
|
@@ -0,0 +1,128 @@
|
|
1
|
+
font:
|
2
|
+
catalog:
|
3
|
+
serif:
|
4
|
+
normal: KaiGenGothicJP-Regular.ttf
|
5
|
+
italic: KaiGenGothicJP-Regular-Italic.ttf
|
6
|
+
bold: KaiGenGothicJP-Bold.ttf
|
7
|
+
bold_italic: KaiGenGothicJP-Bold-Italic.ttf
|
8
|
+
sans-serif:
|
9
|
+
normal: KaiGenGothicJP-Regular.ttf
|
10
|
+
italic: KaiGenGothicJP-Regular-Italic.ttf
|
11
|
+
bold: KaiGenGothicJP-Bold.ttf
|
12
|
+
bold_italic: KaiGenGothicJP-Bold-Italic.ttf
|
13
|
+
monospace:
|
14
|
+
normal: KaiGenGothicJP-Regular.ttf
|
15
|
+
italic: KaiGenGothicJP-Regular-Italic.ttf
|
16
|
+
bold: KaiGenGothicJP-Bold.ttf
|
17
|
+
bold_italic: KaiGenGothicJP-Bold-Italic.ttf
|
18
|
+
|
19
|
+
fallbacks:
|
20
|
+
sans-serif
|
21
|
+
|
22
|
+
|
23
|
+
page:
|
24
|
+
background_color: ffffff
|
25
|
+
layout: portrait
|
26
|
+
margin: [25mm, 12mm, 25mm, 12mm] # [top,right,bottom,left]
|
27
|
+
size: A4
|
28
|
+
|
29
|
+
base:
|
30
|
+
align: left
|
31
|
+
font_color: 000000
|
32
|
+
font_family: sans-serif
|
33
|
+
font_size: 10
|
34
|
+
line_height_length: 15
|
35
|
+
line_height: $base_line_height_length / $base_font_size
|
36
|
+
font_size_large: round($base_font_size * 1.25)
|
37
|
+
font_size_small: round($base_font_size * 0.85)
|
38
|
+
font_size_min: $base_font_size * 0.75
|
39
|
+
font_style: normal
|
40
|
+
border_color: eeeeee
|
41
|
+
border_radius: 4
|
42
|
+
border_width: 0.5
|
43
|
+
|
44
|
+
title_page:
|
45
|
+
align: center
|
46
|
+
background_color: ffffff
|
47
|
+
title:
|
48
|
+
top: 20%
|
49
|
+
font_family: sans-serif
|
50
|
+
font_size: 40pt
|
51
|
+
font_style: bold
|
52
|
+
font_color: 000000
|
53
|
+
line_height: 2
|
54
|
+
subtitle:
|
55
|
+
font_size: 24pt
|
56
|
+
font_family: sans-serif
|
57
|
+
line_height: 1
|
58
|
+
margin_bottom: 9cm
|
59
|
+
authors:
|
60
|
+
font_size: 20pt
|
61
|
+
font_family: sans-serif
|
62
|
+
margin_top: $base_font_size * 1.25
|
63
|
+
revision:
|
64
|
+
font_size: 16pt
|
65
|
+
font_family: sans-serif
|
66
|
+
margin_top: $base_font_size * 1.25
|
67
|
+
|
68
|
+
literal:
|
69
|
+
font_family: monospace
|
70
|
+
|
71
|
+
code:
|
72
|
+
font_family: monospace
|
73
|
+
|
74
|
+
table:
|
75
|
+
border_width: 0.1
|
76
|
+
head:
|
77
|
+
background_color: #f0f0f0
|
78
|
+
border_bottom_width: 0.1
|
79
|
+
font_style: bold
|
80
|
+
|
81
|
+
header:
|
82
|
+
font_size: $base_font_size_small
|
83
|
+
font_color: $base_font_color
|
84
|
+
border_color: dddddd
|
85
|
+
border_width: 0.25
|
86
|
+
height: 22mm
|
87
|
+
vertical_align: bottom
|
88
|
+
padding: [0,0,2mm,0] # [top,right,bottom,left]
|
89
|
+
recto:
|
90
|
+
center:
|
91
|
+
content: 'ヘッダ(recto)'
|
92
|
+
right:
|
93
|
+
content: '*{page-number}*'
|
94
|
+
verso:
|
95
|
+
center:
|
96
|
+
content: 'ヘッダ(verso)'
|
97
|
+
left:
|
98
|
+
content: '*{page-number}*'
|
99
|
+
|
100
|
+
bookmark:
|
101
|
+
include-title-page: false
|
102
|
+
|
103
|
+
admonition:
|
104
|
+
column-rule-width: 0.3mm
|
105
|
+
column-rule-color: 000000
|
106
|
+
border_width: 0.3mm
|
107
|
+
border_color: 000000
|
108
|
+
border-radius: 2mm
|
109
|
+
min-width: 40mm
|
110
|
+
|
111
|
+
footer:
|
112
|
+
font_size: $base_font_size_small
|
113
|
+
font_color: $base_font_color
|
114
|
+
border_color: dddddd
|
115
|
+
border_width: 0.25
|
116
|
+
height: 22mm
|
117
|
+
padding: [2mm,0,0,0] # [top,right,bottom,left]
|
118
|
+
vertical_align: top
|
119
|
+
recto:
|
120
|
+
center:
|
121
|
+
content: 'フッタ(recto)'
|
122
|
+
right:
|
123
|
+
content: '*{page-number}*'
|
124
|
+
verso:
|
125
|
+
center:
|
126
|
+
content: 'フッタ(verso)'
|
127
|
+
left:
|
128
|
+
content: '*{page-number}*'
|
@@ -0,0 +1,63 @@
|
|
1
|
+
[[xref-sample]]
|
2
|
+
== クロスリファレンスサンプル
|
3
|
+
|
4
|
+
参照される側
|
5
|
+
|
6
|
+
[[three-equals]]
|
7
|
+
=== イコール3個
|
8
|
+
|
9
|
+
参照される側
|
10
|
+
|
11
|
+
[[four-equals]]
|
12
|
+
==== イコール4個
|
13
|
+
|
14
|
+
参照される側
|
15
|
+
|
16
|
+
[[five-equals]]
|
17
|
+
===== イコール5個
|
18
|
+
|
19
|
+
参照される側
|
20
|
+
|
21
|
+
[[six-equals]]
|
22
|
+
====== イコール6個
|
23
|
+
|
24
|
+
参照される側
|
25
|
+
|
26
|
+
== 参照する側
|
27
|
+
|
28
|
+
=== custom("[$SECT_NUMS$]. [$TITLE$]")
|
29
|
+
|
30
|
+
:xrefstyle: custom
|
31
|
+
:xrefcustomformat: [$SECT_NUMS$]. [$TITLE$]
|
32
|
+
|
33
|
+
<<xref-sample>> および <<three-equals>> および <<four-equals>> および <<five-equals>> および <<six-equals>> を参照のこと。
|
34
|
+
|
35
|
+
|
36
|
+
(<<xref-sample>>) および (<<three-equals>>) および (<<four-equals>>) および (<<five-equals>>) および (<<six-equals>>) を参照のこと。
|
37
|
+
|
38
|
+
=== full
|
39
|
+
|
40
|
+
:xrefstyle: full
|
41
|
+
|
42
|
+
<<xref-sample>> および <<three-equals>> および <<four-equals>> および <<five-equals>> および <<six-equals>> を参照のこと。
|
43
|
+
|
44
|
+
|
45
|
+
(<<xref-sample>>) および (<<three-equals>>) および (<<four-equals>>) および (<<five-equals>>) および (<<six-equals>>) を参照のこと。
|
46
|
+
|
47
|
+
=== short
|
48
|
+
|
49
|
+
:xrefstyle: short
|
50
|
+
|
51
|
+
<<xref-sample>> および <<three-equals>> および <<four-equals>> および <<five-equals>> および <<six-equals>> を参照のこと。
|
52
|
+
|
53
|
+
|
54
|
+
(<<xref-sample>>) および (<<three-equals>>) および (<<four-equals>>) および (<<five-equals>>) および (<<six-equals>>) を参照のこと。
|
55
|
+
|
56
|
+
=== basic
|
57
|
+
|
58
|
+
:xrefstyle: basic
|
59
|
+
|
60
|
+
<<xref-sample>> および <<three-equals>> および <<four-equals>> および <<five-equals>> および <<six-equals>> を参照のこと。
|
61
|
+
|
62
|
+
|
63
|
+
(<<xref-sample>>) および (<<three-equals>>) および (<<four-equals>>) および (<<five-equals>>) および (<<six-equals>>) を参照のこと。
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: asciidoctor-nabetani
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nabetani
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- takenori@nabetani.sakura.ne.jp
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- ".rspec"
|
22
|
+
- ".travis.yml"
|
23
|
+
- CODE_OF_CONDUCT.md
|
24
|
+
- Gemfile
|
25
|
+
- Gemfile.lock
|
26
|
+
- LICENSE.txt
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- asciidoctor-nabetani.gemspec
|
30
|
+
- bin/console
|
31
|
+
- bin/setup
|
32
|
+
- lib/asciidoctor/nabetani.rb
|
33
|
+
- lib/asciidoctor/nabetani/abstractblock-xreftext.rb
|
34
|
+
- lib/asciidoctor/nabetani/horz-dlist.rb
|
35
|
+
- lib/asciidoctor/nabetani/nabehelper.rb
|
36
|
+
- lib/asciidoctor/nabetani/pdf-custom-property.rb
|
37
|
+
- lib/asciidoctor/nabetani/pdf-outline.rb
|
38
|
+
- lib/asciidoctor/nabetani/prawn-linewrap-ja.rb
|
39
|
+
- lib/asciidoctor/nabetani/version.rb
|
40
|
+
- sample/src/horz-dlist.adoc
|
41
|
+
- sample/src/index.adoc
|
42
|
+
- sample/src/line-wrap.adoc
|
43
|
+
- sample/src/theme.yml
|
44
|
+
- sample/src/xref.adoc
|
45
|
+
homepage: https://github.com/nabetani/asciidoctor-nabetani
|
46
|
+
licenses:
|
47
|
+
- MIT
|
48
|
+
metadata: {}
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options: []
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 2.6.0
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubygems_version: 3.0.3
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: An assortment of things I needed to make a Japanese PDF document with asciidoctor.
|
68
|
+
test_files: []
|