asciidoctor-htmlbook 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +10 -0
- data/asciidoctor-htmlbook.gemspec +31 -0
- data/bin/console +14 -0
- data/bin/rake +17 -0
- data/bin/setup +8 -0
- data/lib/asciidoctor/htmlbook.rb +9 -0
- data/lib/asciidoctor/htmlbook/converter.rb +181 -0
- data/lib/asciidoctor/htmlbook/version.rb +5 -0
- data/templates/admonition.html +4 -0
- data/templates/audio.html +6 -0
- data/templates/colist.html +8 -0
- data/templates/dlist.html +12 -0
- data/templates/document.html +10 -0
- data/templates/example.html +4 -0
- data/templates/image.html +11 -0
- data/templates/inline_anchor.html +18 -0
- data/templates/inline_callout.html +1 -0
- data/templates/inline_footnote.html +1 -0
- data/templates/inline_image.html +3 -0
- data/templates/inline_indexterm.html +10 -0
- data/templates/inline_quoted.html +24 -0
- data/templates/listing.html +6 -0
- data/templates/literal.html +1 -0
- data/templates/olist.html +8 -0
- data/templates/page_break.html +1 -0
- data/templates/paragraph.html +1 -0
- data/templates/pass.html +1 -0
- data/templates/preamble.html +3 -0
- data/templates/quote.html +9 -0
- data/templates/section.html +42 -0
- data/templates/sidebar.html +7 -0
- data/templates/stem.html +9 -0
- data/templates/table.html +41 -0
- data/templates/thematic_break.html +1 -0
- data/templates/toc.html +4 -0
- data/templates/ulist.html +8 -0
- data/templates/verse.html +9 -0
- data/templates/video.html +9 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a9f279f879d6126ddd879119caa51fa6fc0906f0
|
4
|
+
data.tar.gz: 1d55866eaf1bdcfe687d5b7a5dbac4575adf194b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 72f2d188d20858d64864bd6c8fe6fbdc62a3b730504ec56a551cc26b3099dd73eb848176085a291fc8c7f3b8524561dadf1784c5b3e5d54601dd162f993bb4c5
|
7
|
+
data.tar.gz: '08e9f93a2b96e650fc25eb0bbc33270203137fec33673ad63e366b05b115369dd7dc78a9bad725927f9f79b814b2d00b29e93bbd3a03ac5930a8bc9713b2a1b1'
|
data/.gitignore
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 chloerei@gmail.com. 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 [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Rei
|
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,41 @@
|
|
1
|
+
# Asciidoctor::Htmlbook
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/asciidoctor/htmlbook`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'asciidoctor-htmlbook'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install asciidoctor-htmlbook
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/asciidoctor-htmlbook. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'asciidoctor/htmlbook/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "asciidoctor-htmlbook"
|
8
|
+
spec.version = Asciidoctor::Htmlbook::VERSION
|
9
|
+
spec.authors = ["Rei"]
|
10
|
+
spec.email = ["chloerei@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{}
|
13
|
+
spec.description = %q{}
|
14
|
+
spec.homepage = ""
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_runtime_dependency "asciidoctor", "~> 1.5"
|
25
|
+
spec.add_runtime_dependency "thread_safe", "~> 0.3.5"
|
26
|
+
spec.add_runtime_dependency "liquid", "~> 4.0"
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
29
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
31
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "asciidoctor/htmlbook"
|
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
|
data/bin/rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rake' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/setup
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module Htmlbook
|
3
|
+
class Converter < Asciidoctor::Converter::Base
|
4
|
+
register_for "htmlbook"
|
5
|
+
|
6
|
+
DEFAULT_TEMPLATE_PATH = File.expand_path('../../../../templates', __FILE__)
|
7
|
+
|
8
|
+
def initialize(backend, options = {})
|
9
|
+
super
|
10
|
+
@templates = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_template(node_name)
|
14
|
+
return @templates[node_name] if @templates[node_name]
|
15
|
+
|
16
|
+
path = File.join DEFAULT_TEMPLATE_PATH, "#{node_name}.html"
|
17
|
+
if File.exist?(path)
|
18
|
+
@templates[node_name] = Liquid::Template.parse(File.read(path))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def convert(node, transform = nil, options = {})
|
23
|
+
template = get_template(node.node_name)
|
24
|
+
|
25
|
+
unless template
|
26
|
+
raise "Template not found #{node.node_name} #{node} #{node.attributes}"
|
27
|
+
end
|
28
|
+
|
29
|
+
template.render 'node' => node_to_liquid(node)
|
30
|
+
end
|
31
|
+
|
32
|
+
def node_to_liquid(node)
|
33
|
+
case node
|
34
|
+
when Asciidoctor::Document
|
35
|
+
document_to_liquid(node)
|
36
|
+
when Asciidoctor::Section
|
37
|
+
section_to_liquid(node)
|
38
|
+
when Asciidoctor::Block
|
39
|
+
block_to_liquid(node)
|
40
|
+
when Asciidoctor::List
|
41
|
+
list_to_liquid(node)
|
42
|
+
when Asciidoctor::Table
|
43
|
+
table_to_liquid(node)
|
44
|
+
when Asciidoctor::Inline
|
45
|
+
inline_to_liquid(node)
|
46
|
+
else
|
47
|
+
raise "Uncatch type #{node} #{node.attributes}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def abstract_node_to_liquid(node)
|
52
|
+
{
|
53
|
+
'context' => node.context.to_s,
|
54
|
+
'node_name' => node.node_name,
|
55
|
+
'id' => node.id,
|
56
|
+
'attributes' => node.attributes,
|
57
|
+
'document' => {
|
58
|
+
'references' => {
|
59
|
+
'ids' => node.document.references[:ids]
|
60
|
+
},
|
61
|
+
'attributes' => node.document.attributes
|
62
|
+
}
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
def abstract_block_to_liquid(node)
|
67
|
+
abstract_node_to_liquid(node).merge({
|
68
|
+
'level' => node.level,
|
69
|
+
'title' => node.title,
|
70
|
+
'style' => node.style,
|
71
|
+
'caption' => node.caption,
|
72
|
+
'content' => node.content
|
73
|
+
})
|
74
|
+
end
|
75
|
+
|
76
|
+
def document_to_liquid(node)
|
77
|
+
abstract_block_to_liquid(node).merge({
|
78
|
+
'header' => {
|
79
|
+
'title' => (node.header && node.header.title)
|
80
|
+
}
|
81
|
+
})
|
82
|
+
end
|
83
|
+
|
84
|
+
def section_to_liquid(node)
|
85
|
+
abstract_block_to_liquid(node).merge({
|
86
|
+
'index' => node.index,
|
87
|
+
'number' => node.number,
|
88
|
+
'sectname' => node.sectname,
|
89
|
+
'special' => node.special,
|
90
|
+
'numbered' => node.numbered,
|
91
|
+
'sectnum' => node.sectnum
|
92
|
+
})
|
93
|
+
end
|
94
|
+
|
95
|
+
def block_to_liquid(node)
|
96
|
+
case node.context
|
97
|
+
when :toc
|
98
|
+
abstract_block_to_liquid(node).merge({
|
99
|
+
'blockname' => node.blockname,
|
100
|
+
'content' => outline(node.document)
|
101
|
+
})
|
102
|
+
else
|
103
|
+
abstract_block_to_liquid(node).merge({
|
104
|
+
'blockname' => node.blockname
|
105
|
+
})
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def outline(node)
|
110
|
+
result = ""
|
111
|
+
if node.sections.any? && node.level < (node.document.attributes['toclevels'] || 2)
|
112
|
+
result << "<ol>"
|
113
|
+
node.sections.each do |section|
|
114
|
+
result << "<li>"
|
115
|
+
result << %Q(<a href="##{section.id}">)
|
116
|
+
result << "#{section.sectnum} " if section.numbered && section.level < (node.document.attributes['sectnumlevels'] || 3)
|
117
|
+
result << section.title
|
118
|
+
result << "</a>"
|
119
|
+
result << outline(section)
|
120
|
+
result << "</li>"
|
121
|
+
end
|
122
|
+
result << "</ol>"
|
123
|
+
end
|
124
|
+
result
|
125
|
+
end
|
126
|
+
|
127
|
+
def list_to_liquid(node)
|
128
|
+
case node.context
|
129
|
+
when :dlist
|
130
|
+
abstract_block_to_liquid(node).merge({
|
131
|
+
'items' => node.items.map { |terms, item|
|
132
|
+
{
|
133
|
+
'terms' => terms.map {|term| listitem_to_liquid(term) },
|
134
|
+
'description' => listitem_to_liquid(item)
|
135
|
+
}
|
136
|
+
}
|
137
|
+
})
|
138
|
+
else
|
139
|
+
abstract_block_to_liquid(node).merge({
|
140
|
+
'items' => node.blocks.map { |item| listitem_to_liquid(item) }
|
141
|
+
})
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def listitem_to_liquid(node)
|
146
|
+
abstract_block_to_liquid(node).merge({
|
147
|
+
'text' => (node.text? ? node.text : nil)
|
148
|
+
})
|
149
|
+
end
|
150
|
+
|
151
|
+
def table_to_liquid(node)
|
152
|
+
abstract_block_to_liquid(node).merge({
|
153
|
+
'columns' => node.columns,
|
154
|
+
'rows' => {
|
155
|
+
'head' => node.rows.head.map { |row| row.map {|cell| cell_to_liquid(cell) } },
|
156
|
+
'body' => node.rows.body.map { |row| row.map {|cell| cell_to_liquid(cell) } },
|
157
|
+
'foot' => node.rows.foot.map { |row| row.map {|cell| cell_to_liquid(cell) } }
|
158
|
+
}
|
159
|
+
})
|
160
|
+
end
|
161
|
+
|
162
|
+
def cell_to_liquid(node)
|
163
|
+
abstract_node_to_liquid(node).merge({
|
164
|
+
'text' => node.text,
|
165
|
+
'content' => node.content,
|
166
|
+
'style' => node.style,
|
167
|
+
'colspan' => node.colspan,
|
168
|
+
'rowspan' => node.rowspan
|
169
|
+
})
|
170
|
+
end
|
171
|
+
|
172
|
+
def inline_to_liquid(node)
|
173
|
+
abstract_node_to_liquid(node).merge({
|
174
|
+
'text' => node.text,
|
175
|
+
'type' => node.type.to_s,
|
176
|
+
'target' => node.target
|
177
|
+
})
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<audio src="{{ node.attributes.target }}"
|
2
|
+
controls="controls"
|
3
|
+
{% if node.attributes.options contains 'autoplay' %}autoplay="autoplay"{% endif %}
|
4
|
+
{% if node.attributes.options contains 'loop' %}loop="loop"{% endif %}>
|
5
|
+
<em>Sorry, the <auido> element not supported in your reading system.</em>
|
6
|
+
</audio>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<ul data-type="colist">
|
2
|
+
{% for item in node.items %}
|
3
|
+
<li>
|
4
|
+
<a data-type="callout" id="colist-{{ item.attributes.coids }}" href="#callout-{{ item.attributes.coids }}">{{ item.attributes.coids | split: '-' | last }}</a>
|
5
|
+
{{ node.text }}
|
6
|
+
</li>
|
7
|
+
{% endfor %}
|
8
|
+
</ul>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<dl>
|
2
|
+
{% for item in node.items %}
|
3
|
+
{% for term in item.terms %}
|
4
|
+
<dt>{{ term.text }}</dt>
|
5
|
+
{% endfor %}
|
6
|
+
{% if item.description.text %}
|
7
|
+
<dd>{{ item.description.text }}</dd>
|
8
|
+
{% else %}
|
9
|
+
<dd>{{ item.description.content }}</dd>
|
10
|
+
{% endif %}
|
11
|
+
{% endfor %}
|
12
|
+
</dl>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<figure>
|
2
|
+
{% if node.attributes.link %}<a href="{{ node.attributes.link }}">{% endif %}
|
3
|
+
<img src="{{ node.attributes.target }}"
|
4
|
+
{% if node.attributes.alt %}alt="{{ node.attributes.alt }}"{% endif %}
|
5
|
+
{% if node.attributes.width %}width="{{ node.attributes.width }}"{% endif %}
|
6
|
+
{% if node.attributes.height %}height="{{ node.attributes.height }}"{% endif %} />
|
7
|
+
{% if node.attributes.link %}</a>{% endif %}
|
8
|
+
{% if node.attributes.title %}
|
9
|
+
<figcaption>{{ node.attributes.title }}</figcaption>
|
10
|
+
{% endif %}
|
11
|
+
</figure>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
{% case node.type %}
|
2
|
+
{% when 'xref' %}
|
3
|
+
{% if node.text %}
|
4
|
+
<a data-type="xref" href="{{ node.target }}">{{ node.text }}</a>
|
5
|
+
{% elsif node.document.references.ids[node.attributes.refid] %}
|
6
|
+
<a data-type="xref" href="{{ node.target }}">{{ node.document.references.ids[node.attributes.refid] }}</a>
|
7
|
+
{% else %}
|
8
|
+
<a data-type="xref" href="{{ node.target }}">[{{ node.attributes.refid }}]</a>
|
9
|
+
{% endif %}
|
10
|
+
{% when 'ref' %}
|
11
|
+
<a id="{{ node.target }}"></a>
|
12
|
+
{% when 'link' %}
|
13
|
+
<a href="{{ node.target }}"
|
14
|
+
{% if node.attributes.title %}title="{{ node.attributes.title }}"{% endif %}
|
15
|
+
{% if node.attributes.window %}target="{{ node.attributes.window }}"{% endif %} >{{ node.text }}</a>
|
16
|
+
{% when 'bibref' %}
|
17
|
+
<a id="{{ node.target }}"></a>[{{ node.target }}]
|
18
|
+
{% endcase %}
|
@@ -0,0 +1 @@
|
|
1
|
+
<a data-type="callout" id="callout-{{ node.id }}" href="#colist-{{ node.id }}">{{ node.text }}</a>
|
@@ -0,0 +1 @@
|
|
1
|
+
<span data-type="footnote">{{ node.text }}</span>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{% if node.type == 'visible' %}
|
2
|
+
<a data-type="indexterm">{{ node.text }}</a>
|
3
|
+
{% else %}
|
4
|
+
{% assign terms = node.attributes.terms %}
|
5
|
+
<a data-type="indexterm"
|
6
|
+
{% for term in node.attributes.terms %}
|
7
|
+
data-{% cycle 'primary', 'secondary', 'tertiary' %}="{{ term }}"
|
8
|
+
{% endfor %}
|
9
|
+
/>
|
10
|
+
{% endif %}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{% case node.type %}
|
2
|
+
{% when 'emphasis' %}
|
3
|
+
<em>{{ node.text }}</em>
|
4
|
+
{% when 'strong' %}
|
5
|
+
<strong>{{ node.text }}</strong>
|
6
|
+
{% when 'monospaced' %}
|
7
|
+
<code>{{ node.text }}</code>
|
8
|
+
{% when 'superscript' %}
|
9
|
+
<sup>{{ node.text }}</sup>
|
10
|
+
{% when 'subscript' %}
|
11
|
+
<sub>{{ node.text }}</sub>
|
12
|
+
{% when 'double' %}
|
13
|
+
“{{ node.text }}”
|
14
|
+
{% when 'single' %}
|
15
|
+
‘{{ node.text }}’
|
16
|
+
{% when 'mark' %}
|
17
|
+
<mark>{{ node.text }}</mark>
|
18
|
+
{% when 'asciimath' %}
|
19
|
+
\\${{ node.text }}\\$
|
20
|
+
{% when 'latexmath' %}
|
21
|
+
\\({{ node.text }}\\)
|
22
|
+
{% else %}
|
23
|
+
<span>{{ node.text }}</span>
|
24
|
+
{% endcase %}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<figure>
|
2
|
+
{% if node.title %}<figcaption>{{ node.title }}</figcaption>{% endif %}
|
3
|
+
<pre data-type="programlisting"
|
4
|
+
{% if node.attributes.language %}data-code-language="{{ node.attributes.language }}"{% endif %}
|
5
|
+
{% if node.id %}id="{{ node.id }}"{% endif %}>{{ node.content }}</pre>
|
6
|
+
</figure>
|
@@ -0,0 +1 @@
|
|
1
|
+
<pre>{{ node.content }}</pre>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div data-type="page-break" />
|
@@ -0,0 +1 @@
|
|
1
|
+
<p>{{ node.content }}</p>
|
data/templates/pass.html
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{{ node.content }}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<blockquote>
|
2
|
+
{{ node.content }}
|
3
|
+
{% if node.attributes.attribution %}
|
4
|
+
<p data-type="attribution">{{ node.attributes.attribution }}</p>
|
5
|
+
{% endif %}
|
6
|
+
{% if node.attributes.citetitle %}
|
7
|
+
<p data-type="citetitle">{{ node.attributes.citetitle }}</p>
|
8
|
+
{% endif %}
|
9
|
+
</blockquote>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
{% case node.sectname %}
|
2
|
+
{% when 'sect0' %}
|
3
|
+
<section id="{{node.id}}" data-type="part">
|
4
|
+
<h1>{% if node.numbered %}{{ node.sectnum }} {% endif %}{{ node.title }}</h1>
|
5
|
+
{{ node.content }}
|
6
|
+
</section>
|
7
|
+
{% when 'sect1' %}
|
8
|
+
<section id="{{node.id}}" data-type="chapter">
|
9
|
+
<h1>{% if node.numbered %}{{ node.sectnum }} {% endif %}{{ node.title }}</h1>
|
10
|
+
{{ node.content }}
|
11
|
+
</section>
|
12
|
+
{% when 'sect2' %}
|
13
|
+
<section id="{{node.id}}" data-type="sect1">
|
14
|
+
<h1>{% if node.numbered %}{{ node.sectnum }} {% endif %}{{ node.title }}</h1>
|
15
|
+
{{ node.content }}
|
16
|
+
</section>
|
17
|
+
{% when 'sect3' %}
|
18
|
+
<section id="{{node.id}}" data-type="sect2">
|
19
|
+
<h2>{% if node.numbered %}{{ node.sectnum }} {% endif %}{{ node.title }}</h2>
|
20
|
+
{{ node.content }}
|
21
|
+
</section>
|
22
|
+
{% when 'sect4' %}
|
23
|
+
<section id="{{node.id}}" data-type="sect3">
|
24
|
+
<h3>{% if node.numbered %}{{ node.sectnum }} {% endif %}{{ node.title }}</h3>
|
25
|
+
{{ node.content }}
|
26
|
+
</section>
|
27
|
+
{% when 'sect5' %}
|
28
|
+
<section id="{{node.id}}" data-type="sect4">
|
29
|
+
<h4>{% if node.numbered %}{{ node.sectnum }} {% endif %}{{ node.title }}</h4>
|
30
|
+
{{ node.content }}
|
31
|
+
</section>
|
32
|
+
{% when 'sect6' %}
|
33
|
+
<section id="{{node.id}}" data-type="sect5">
|
34
|
+
<h5>{% if node.numbered %}{{ node.sectnum }} {% endif %}{{ node.title }}</h5>
|
35
|
+
{{ node.content }}
|
36
|
+
</section>
|
37
|
+
{% else %}
|
38
|
+
<section id="{{node.id}}" data-type="{{ node.sectname }}">
|
39
|
+
<h1>{% if node.numbered %}{{ node.sectnum }} {% endif %}{{ node.title }}</h1>
|
40
|
+
{{ node.content }}
|
41
|
+
</section>
|
42
|
+
{% endcase %}
|
data/templates/stem.html
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
<table>
|
2
|
+
{% if node.title %}
|
3
|
+
<caption>{{ node.title }}</caption>
|
4
|
+
{% endif %}
|
5
|
+
{% if node.rows.head.size > 0 %}
|
6
|
+
<thead>
|
7
|
+
{% for row in node.rows.head %}
|
8
|
+
<tr>
|
9
|
+
{% for cell in row %}
|
10
|
+
<th {% if cell.colspan %}colspan="{{ cell.colspan }}"{% endif %}
|
11
|
+
{% if cell.rowspan %}rowspan="{{ cell.rowspan }}"{% endif %}>{{ cell.content }}</th>
|
12
|
+
{% endfor %}
|
13
|
+
</tr>
|
14
|
+
{% endfor %}
|
15
|
+
</thead>
|
16
|
+
{% endif %}
|
17
|
+
{% if node.rows.body.size > 0 %}
|
18
|
+
<tbody>
|
19
|
+
{% for row in node.rows.body %}
|
20
|
+
<tr>
|
21
|
+
{% for cell in row %}
|
22
|
+
<td {% if cell.colspan %}colspan="{{ cell.colspan }}"{% endif %}
|
23
|
+
{% if cell.rowspan %}rowspan="{{ cell.rowspan }}"{% endif %}>{{ cell.content }}</td>
|
24
|
+
{% endfor %}
|
25
|
+
</tr>
|
26
|
+
{% endfor %}
|
27
|
+
</tbody>
|
28
|
+
{% endif %}
|
29
|
+
{% if node.rows.foot.size > 0 %}
|
30
|
+
<tfoot>
|
31
|
+
{% for row in node.rows.foot %}
|
32
|
+
<tr>
|
33
|
+
{% for cell in row %}
|
34
|
+
<td {% if cell.colspan %}colspan="{{ cell.colspan }}"{% endif %}
|
35
|
+
{% if cell.rowspan %}rowspan="{{ cell.rowspan }}"{% endif %}>{{ cell.content }}</td>
|
36
|
+
{% endfor %}
|
37
|
+
</tr>
|
38
|
+
{% endfor %}
|
39
|
+
</tfoot>
|
40
|
+
{% endif %}
|
41
|
+
</table>
|
@@ -0,0 +1 @@
|
|
1
|
+
<hr />
|
data/templates/toc.html
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<blockquote>
|
2
|
+
<pre>{{ node.content }}</pre>
|
3
|
+
{% if node.attributes.attribution %}
|
4
|
+
<p data-type="attribution">{{ node.attributes.attribution }}</p>
|
5
|
+
{% endif %}
|
6
|
+
{% if node.attributes.citetitle %}
|
7
|
+
<p data-type="citetitle">{{ node.attributes.citetitle }}</p>
|
8
|
+
{% endif %}
|
9
|
+
</blockquote>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<video src="{{ node.attributes.target }}"
|
2
|
+
controls="controls"
|
3
|
+
{% if node.attributes.width %}width="{{ node.attributes.width }}"{% endif %}
|
4
|
+
{% if node.attributes.height %}height="{{ node.attributes.height }}"{% endif %}
|
5
|
+
{% if node.attributes.poster %}poster="{{ node.attributes.poster }}"{% endif %}
|
6
|
+
{% if node.attributes.options contains 'autoplay' %}autoplay="autoplay"{% endif %}
|
7
|
+
{% if node.attributes.options contains 'loop' %}loop="loop"{% endif %}>
|
8
|
+
<em>Sorry, the <video> element not supported in your reading system.</em>
|
9
|
+
</video>
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: asciidoctor-htmlbook
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rei
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: asciidoctor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thread_safe
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.3.5
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.3.5
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: liquid
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.13'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.13'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: minitest
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '5.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '5.0'
|
97
|
+
description: ''
|
98
|
+
email:
|
99
|
+
- chloerei@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
106
|
+
- CODE_OF_CONDUCT.md
|
107
|
+
- Gemfile
|
108
|
+
- LICENSE.txt
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- asciidoctor-htmlbook.gemspec
|
112
|
+
- bin/console
|
113
|
+
- bin/rake
|
114
|
+
- bin/setup
|
115
|
+
- lib/asciidoctor/htmlbook.rb
|
116
|
+
- lib/asciidoctor/htmlbook/converter.rb
|
117
|
+
- lib/asciidoctor/htmlbook/version.rb
|
118
|
+
- templates/admonition.html
|
119
|
+
- templates/audio.html
|
120
|
+
- templates/colist.html
|
121
|
+
- templates/dlist.html
|
122
|
+
- templates/document.html
|
123
|
+
- templates/example.html
|
124
|
+
- templates/image.html
|
125
|
+
- templates/inline_anchor.html
|
126
|
+
- templates/inline_callout.html
|
127
|
+
- templates/inline_footnote.html
|
128
|
+
- templates/inline_image.html
|
129
|
+
- templates/inline_indexterm.html
|
130
|
+
- templates/inline_quoted.html
|
131
|
+
- templates/listing.html
|
132
|
+
- templates/literal.html
|
133
|
+
- templates/olist.html
|
134
|
+
- templates/page_break.html
|
135
|
+
- templates/paragraph.html
|
136
|
+
- templates/pass.html
|
137
|
+
- templates/preamble.html
|
138
|
+
- templates/quote.html
|
139
|
+
- templates/section.html
|
140
|
+
- templates/sidebar.html
|
141
|
+
- templates/stem.html
|
142
|
+
- templates/table.html
|
143
|
+
- templates/thematic_break.html
|
144
|
+
- templates/toc.html
|
145
|
+
- templates/ulist.html
|
146
|
+
- templates/verse.html
|
147
|
+
- templates/video.html
|
148
|
+
homepage: ''
|
149
|
+
licenses:
|
150
|
+
- MIT
|
151
|
+
metadata: {}
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
require_paths:
|
155
|
+
- lib
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
requirements: []
|
167
|
+
rubyforge_project:
|
168
|
+
rubygems_version: 2.5.2
|
169
|
+
signing_key:
|
170
|
+
specification_version: 4
|
171
|
+
summary: ''
|
172
|
+
test_files: []
|