kramdown-converter-indesign 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 +4 -0
- data/Gemfile +3 -0
- data/README.md +1 -0
- data/Rakefile +9 -0
- data/TODO.md +15 -0
- data/kramdown-converter-indesign.gemspec +24 -0
- data/lib/kramdown-converter-indesign/extensions/kramdown.rb +55 -0
- data/lib/kramdown-converter-indesign/extensions/nokogiri.rb +23 -0
- data/lib/kramdown-converter-indesign/style.rb +55 -0
- data/lib/kramdown-converter-indesign/style_group.rb +90 -0
- data/lib/kramdown-converter-indesign.rb +260 -0
- data/test/helpers.rb +17 -0
- data/test/input/complex.md +38 -0
- data/test/input/gettysburg.md +16 -0
- data/test/input/simple.md +3 -0
- data/test/test_complex.rb +13 -0
- data/test/test_gettysburg.rb +13 -0
- data/test/test_simple.rb +13 -0
- metadata +152 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ce8cacf46a285384da26fc974a60e09bc30708dbc252f83bb83d1494677c858c
|
4
|
+
data.tar.gz: f9d2824ef7834d77206aeeea5defe829962b4c64ecfe77950ab69780ce013513
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c1aa412bd692a61af1db6f0b4f47b1cec3f6118271ea4638e4f48d316a15bbb711eb154c2c9c7754dba48a5dd194af83ea0a190bb45bfdd4ec11aaaa3e742f5
|
7
|
+
data.tar.gz: 6e0d649b5134e28594ae010f3fbe7bbe921543510bf36d38d5feca77ed230c45f27e76b301bab617547c18ddfc1c073e020e669877bdc2a250dc6e0b85a47430
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
FIXME
|
data/Rakefile
ADDED
data/TODO.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# TODO
|
2
|
+
|
3
|
+
## NOW -- bugs, problems
|
4
|
+
|
5
|
+
|
6
|
+
## SOON -- improvements
|
7
|
+
|
8
|
+
- find comprehensive test input document
|
9
|
+
|
10
|
+
- make correct elements for <a> link
|
11
|
+
|
12
|
+
|
13
|
+
## LATER -- features
|
14
|
+
|
15
|
+
- allow custom styles to be specified to converter (via options)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'kramdown-converter-indesign'
|
3
|
+
s.version = '0.1'
|
4
|
+
s.summary = 'Converts a Kramdown/Markdown document to InDesign\'s ICML format.'
|
5
|
+
s.author = 'John Labovitz'
|
6
|
+
s.email = 'johnl@johnlabovitz.com'
|
7
|
+
s.description = %q{
|
8
|
+
Kramdown::Converter::Indesign converts a Kramdown/Markdown document to InDesign's ICML format.
|
9
|
+
}
|
10
|
+
s.license = 'MIT'
|
11
|
+
s.homepage = 'http://github.com/jslabovitz/kramdown-converter-indesign'
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
15
|
+
s.require_path = 'lib'
|
16
|
+
|
17
|
+
s.add_dependency 'kramdown', '~> 2.4'
|
18
|
+
s.add_dependency 'nokogiri', '~> 1.13'
|
19
|
+
|
20
|
+
s.add_development_dependency 'bundler', '~> 2.3'
|
21
|
+
s.add_development_dependency 'minitest', '~> 5.16'
|
22
|
+
s.add_development_dependency 'minitest-power_assert', '~> 0.3'
|
23
|
+
s.add_development_dependency 'rake', '~> 13.0'
|
24
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Kramdown
|
2
|
+
|
3
|
+
class Element
|
4
|
+
|
5
|
+
attr_accessor :parent
|
6
|
+
attr_accessor :level
|
7
|
+
|
8
|
+
def setup_tree(parent=nil)
|
9
|
+
@parent = parent
|
10
|
+
@level = parent ? parent.level + 1 : 0
|
11
|
+
@children.each { |e| e.setup_tree(self) }
|
12
|
+
end
|
13
|
+
|
14
|
+
def previous
|
15
|
+
if (i = index) && i > 0
|
16
|
+
@parent.children[i - 1]
|
17
|
+
else
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def next
|
23
|
+
if (i = index)
|
24
|
+
@parent.children[i + 1]
|
25
|
+
else
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def index
|
31
|
+
@parent&.children.index(self)
|
32
|
+
end
|
33
|
+
|
34
|
+
def ial_class
|
35
|
+
(ial = @options[:ial]) && ial['class']
|
36
|
+
end
|
37
|
+
|
38
|
+
TEXT_TYPES = [:text, :smart_quote, :typographic_sym, :entity]
|
39
|
+
|
40
|
+
def is_text?
|
41
|
+
TEXT_TYPES.include?(@type)
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_s
|
45
|
+
"* %s%s <%p> (%s)" % [
|
46
|
+
"\t" * (@level || 0),
|
47
|
+
@type,
|
48
|
+
@value,
|
49
|
+
(@options || {}).map { |k, v| "#{k}: #{v.inspect}" }.join(', ')
|
50
|
+
]
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Nokogiri
|
2
|
+
|
3
|
+
module XML
|
4
|
+
|
5
|
+
class Builder
|
6
|
+
|
7
|
+
def processing_instruction(string, content)
|
8
|
+
insert(doc.create_processing_instruction(string, content))
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
class Document
|
14
|
+
|
15
|
+
def create_processing_instruction(string, content)
|
16
|
+
Nokogiri::XML::ProcessingInstruction.new(self, string.to_s, content.to_s)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Kramdown
|
2
|
+
|
3
|
+
module Converter
|
4
|
+
|
5
|
+
class Indesign
|
6
|
+
|
7
|
+
class Style
|
8
|
+
|
9
|
+
attr_accessor :name
|
10
|
+
attr_accessor :attrs
|
11
|
+
attr_accessor :based_on
|
12
|
+
|
13
|
+
def initialize(name:, attrs: nil, based_on: nil)
|
14
|
+
@name = name
|
15
|
+
@attrs = attrs || {}
|
16
|
+
@based_on = based_on
|
17
|
+
end
|
18
|
+
|
19
|
+
def build(xml)
|
20
|
+
xml.send(self.class.type, Self: to_s, Name: @name, **attrs) do
|
21
|
+
if @based_on
|
22
|
+
xml.Properties do
|
23
|
+
xml.BasedOn(@based_on.to_s, type: 'object')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_s
|
30
|
+
"#{self.class.type}/#{@name}"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
class ParagraphStyle < Style
|
36
|
+
|
37
|
+
def self.type
|
38
|
+
'ParagraphStyle'
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
class CharacterStyle < Style
|
44
|
+
|
45
|
+
def self.type
|
46
|
+
'CharacterStyle'
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module Kramdown
|
2
|
+
|
3
|
+
module Converter
|
4
|
+
|
5
|
+
class Indesign
|
6
|
+
|
7
|
+
class StyleGroup
|
8
|
+
|
9
|
+
attr_accessor :id
|
10
|
+
attr_accessor :base_style
|
11
|
+
|
12
|
+
def self.add_styles(specs)
|
13
|
+
new.tap { |g| g.add_styles(specs) }
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(base_style:, id: nil)
|
17
|
+
@id = id || self.class.default_id
|
18
|
+
@base_style = base_style
|
19
|
+
@styles = {}
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_styles(specs)
|
23
|
+
specs.each do |name, spec|
|
24
|
+
add_style(spec.merge(name: name))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_style(params)
|
29
|
+
params = params.dup
|
30
|
+
if (base = params[:based_on])
|
31
|
+
base = self[base] if base.kind_of?(String)
|
32
|
+
end
|
33
|
+
params[:based_on] = base || @base_style
|
34
|
+
style = self.class.style_class.new(**params)
|
35
|
+
@styles[style.name] = style
|
36
|
+
style
|
37
|
+
end
|
38
|
+
|
39
|
+
def [](name)
|
40
|
+
@styles[name] or raise "Can't find style: #{name}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def build(xml)
|
44
|
+
xml.send(self.class.xml_tag, Self: @id) do
|
45
|
+
@base_style.build(xml) if @base_style
|
46
|
+
@styles.values.each do |style|
|
47
|
+
style.build(xml)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
class ParagraphStyleGroup < StyleGroup
|
55
|
+
|
56
|
+
def self.style_class
|
57
|
+
ParagraphStyle
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.xml_tag
|
61
|
+
'RootParagraphStyleGroup'
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.default_id
|
65
|
+
'paragraph_styles'
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
class CharacterStyleGroup < StyleGroup
|
71
|
+
|
72
|
+
def self.style_class
|
73
|
+
CharacterStyle
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.xml_tag
|
77
|
+
'RootCharacterStyleGroup'
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.default_id
|
81
|
+
'character_styles'
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,260 @@
|
|
1
|
+
require 'kramdown'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
module Kramdown
|
5
|
+
|
6
|
+
module Converter
|
7
|
+
|
8
|
+
class Indesign < Base
|
9
|
+
|
10
|
+
class Error < StandardError; end
|
11
|
+
|
12
|
+
def initialize(root, options)
|
13
|
+
super
|
14
|
+
@paragraph_style_group = make_paragraph_styles
|
15
|
+
@character_style_group = make_character_styles
|
16
|
+
root.setup_tree
|
17
|
+
end
|
18
|
+
|
19
|
+
def make_paragraph_styles
|
20
|
+
base_style = ParagraphStyle.new(name: '$ID/NormalParagraphStyle')
|
21
|
+
group = ParagraphStyleGroup.new(base_style: base_style)
|
22
|
+
group.add_styles(
|
23
|
+
'head1' => {},
|
24
|
+
'head2' => {},
|
25
|
+
'head3' => {},
|
26
|
+
'para' => {},
|
27
|
+
'para first' => { based_on: 'para' },
|
28
|
+
'bul item' => {},
|
29
|
+
'num item' => {},
|
30
|
+
'footnote' => {},
|
31
|
+
'blockquote' => {},
|
32
|
+
'credit' => {},
|
33
|
+
)
|
34
|
+
group
|
35
|
+
end
|
36
|
+
|
37
|
+
def make_character_styles
|
38
|
+
base_style = CharacterStyle.new(name: '$ID/[No character style]')
|
39
|
+
group = CharacterStyleGroup.new(base_style: base_style)
|
40
|
+
group.add_styles(
|
41
|
+
'bold' => { attrs: { FontStyle: 'Bold' } },
|
42
|
+
'italic' => { attrs: { FontStyle: 'Italic' } },
|
43
|
+
'small caps' => { attrs: { Capitalization: 'CapToSmallCap' } },
|
44
|
+
'code' => { attrs: {} }, #FIXME: mono font
|
45
|
+
'footnote ref' => { }, #FIXME: OpenType superior
|
46
|
+
)
|
47
|
+
group
|
48
|
+
end
|
49
|
+
|
50
|
+
def convert(elem, options={})
|
51
|
+
# ;;puts elem
|
52
|
+
begin
|
53
|
+
method_name = "convert_#{elem.type}"
|
54
|
+
raise Error, "Can't convert element" unless respond_to?(method_name)
|
55
|
+
send(method_name, elem)
|
56
|
+
rescue Error => e
|
57
|
+
raise Error, "#{e} (type: #{elem.type.inspect}, value: #{elem.value.inspect}, location: #{elem.options[:location]})"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def convert_children(elem)
|
62
|
+
elem.children.each do |e|
|
63
|
+
if e.is_text? && @xml.parent.name != 'Content'
|
64
|
+
build_character(@character_style_group.base_style) { convert(e) }
|
65
|
+
else
|
66
|
+
convert(e)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def convert_root(elem)
|
72
|
+
Nokogiri::XML::Builder.new do |xml|
|
73
|
+
@xml = xml
|
74
|
+
build_document do
|
75
|
+
convert_children(elem)
|
76
|
+
end
|
77
|
+
end.doc.to_xml(save_with: 0)
|
78
|
+
end
|
79
|
+
|
80
|
+
def convert_xml_comment(elem)
|
81
|
+
# ignore
|
82
|
+
end
|
83
|
+
|
84
|
+
def convert_html_element(elem)
|
85
|
+
if elem.value == 'a'
|
86
|
+
convert_a(elem)
|
87
|
+
else
|
88
|
+
raise Error, "Unsupported HTML element: <#{elem.value}>"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def convert_header(elem)
|
93
|
+
build_paragraph("head#{elem.options[:level]}") { convert_children(elem) }
|
94
|
+
end
|
95
|
+
|
96
|
+
def convert_p(elem)
|
97
|
+
style = elem.ial_class \
|
98
|
+
|| @next_paragraph_style \
|
99
|
+
|| (@previous_paragraph_style && @previous_paragraph_style.name.start_with?('head') && 'para first') \
|
100
|
+
|| 'para'
|
101
|
+
build_paragraph(style) { convert_children(elem) }
|
102
|
+
end
|
103
|
+
|
104
|
+
def convert_blockquote(elem)
|
105
|
+
@next_paragraph_style = 'blockquote'
|
106
|
+
convert_children(elem)
|
107
|
+
@next_paragraph_style = nil
|
108
|
+
end
|
109
|
+
|
110
|
+
def convert_footnote(elem)
|
111
|
+
build_character('footnote ref', 'Footnote') do
|
112
|
+
convert(elem.value)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def convert_footnote_def(elem)
|
117
|
+
elem.children.each_with_index do |e, i|
|
118
|
+
build_paragraph('footnote') do
|
119
|
+
if i == 0
|
120
|
+
build_character('footnote ref') do
|
121
|
+
@xml.processing_instruction('ACE', '4')
|
122
|
+
end
|
123
|
+
end
|
124
|
+
convert_children(e)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def convert_em(elem)
|
130
|
+
style = case elem.ial_class
|
131
|
+
when 'sc'
|
132
|
+
'small caps'
|
133
|
+
else
|
134
|
+
'italic'
|
135
|
+
end
|
136
|
+
build_character(style) { convert_children(elem) }
|
137
|
+
end
|
138
|
+
|
139
|
+
def convert_strong(elem)
|
140
|
+
build_character('bold') { convert_children(elem) }
|
141
|
+
end
|
142
|
+
|
143
|
+
def convert_codespan(elem)
|
144
|
+
build_character('code') { @xml.text(elem.value) }
|
145
|
+
end
|
146
|
+
|
147
|
+
def convert_ul(elem)
|
148
|
+
@next_paragraph_style = 'bul item'
|
149
|
+
convert_children(elem)
|
150
|
+
@next_paragraph_style = nil
|
151
|
+
end
|
152
|
+
|
153
|
+
def convert_ol(elem)
|
154
|
+
@next_paragraph_style = 'num item'
|
155
|
+
convert_children(elem)
|
156
|
+
@next_paragraph_style = nil
|
157
|
+
end
|
158
|
+
|
159
|
+
def convert_li(elem)
|
160
|
+
# handled in convert_p
|
161
|
+
@xml.Br
|
162
|
+
convert_children(elem)
|
163
|
+
end
|
164
|
+
|
165
|
+
def convert_br(elem)
|
166
|
+
# newline automatically inserted
|
167
|
+
end
|
168
|
+
|
169
|
+
def convert_hr(elem)
|
170
|
+
# paragraph_style('section')
|
171
|
+
# @xml.text('* * *')
|
172
|
+
end
|
173
|
+
|
174
|
+
def convert_a(elem)
|
175
|
+
# link ignored
|
176
|
+
convert_children(elem)
|
177
|
+
end
|
178
|
+
|
179
|
+
def convert_blank(elem)
|
180
|
+
@xml.Br
|
181
|
+
end
|
182
|
+
|
183
|
+
def convert_text(elem)
|
184
|
+
@xml.text(elem.value)
|
185
|
+
end
|
186
|
+
|
187
|
+
def convert_entity(elem)
|
188
|
+
@xml << "&#{elem.value.name};"
|
189
|
+
end
|
190
|
+
|
191
|
+
def convert_smart_quote(elem)
|
192
|
+
text = case elem.value
|
193
|
+
when :lsquo
|
194
|
+
'‘'
|
195
|
+
when :rsquo
|
196
|
+
'’'
|
197
|
+
when :ldquo
|
198
|
+
'“'
|
199
|
+
when :rdquo
|
200
|
+
'”'
|
201
|
+
else
|
202
|
+
raise "Unknown smart quote: #{elem.value.inspect}"
|
203
|
+
end
|
204
|
+
@xml.text(text)
|
205
|
+
end
|
206
|
+
|
207
|
+
def convert_typographic_sym(elem)
|
208
|
+
text = case elem.value
|
209
|
+
when :ndash
|
210
|
+
'–'
|
211
|
+
when :hellip
|
212
|
+
'…'
|
213
|
+
else
|
214
|
+
raise "Unknown typographic symbol: #{elem.value.inspect}"
|
215
|
+
end
|
216
|
+
@xml.text(text)
|
217
|
+
end
|
218
|
+
|
219
|
+
###
|
220
|
+
|
221
|
+
def build_document(&block)
|
222
|
+
@xml.processing_instruction('aid', 'style="50" type="snippet" readerVersion="6.0" featureSet="513" product="8.0(370)"')
|
223
|
+
@xml.processing_instruction('aid', 'SnippetType="InCopyInterchange"')
|
224
|
+
@xml.Document(DOMVersion: '8.0', Self: 'doc') do
|
225
|
+
@character_style_group.build(@xml)
|
226
|
+
@paragraph_style_group.build(@xml)
|
227
|
+
build_story(&block)
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
def build_story(&block)
|
232
|
+
@xml.Story(Self: 'story') do
|
233
|
+
@xml.StoryPreference(OpticalMarginAlignment: true, OpticalMarginSize: 12)
|
234
|
+
yield
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
def build_paragraph(style, &block)
|
239
|
+
style = @paragraph_style_group[style] unless style.kind_of?(Style)
|
240
|
+
@xml.ParagraphStyleRange(AppliedParagraphStyle: style, &block)
|
241
|
+
@previous_paragraph_style = style
|
242
|
+
end
|
243
|
+
|
244
|
+
def build_character(style, sub_name='Content', &block)
|
245
|
+
style = @character_style_group[style] unless style.kind_of?(Style)
|
246
|
+
@xml.CharacterStyleRange(AppliedCharacterStyle: style) do
|
247
|
+
@xml.send(sub_name, &block)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
end
|
252
|
+
|
253
|
+
end
|
254
|
+
|
255
|
+
end
|
256
|
+
|
257
|
+
require_relative 'kramdown-converter-indesign/style'
|
258
|
+
require_relative 'kramdown-converter-indesign/style_group'
|
259
|
+
require_relative 'kramdown-converter-indesign/extensions/kramdown'
|
260
|
+
require_relative 'kramdown-converter-indesign/extensions/nokogiri'
|
data/test/helpers.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'minitest/power_assert'
|
3
|
+
|
4
|
+
require 'kramdown-converter-indesign'
|
5
|
+
|
6
|
+
class Test < MiniTest::Test
|
7
|
+
|
8
|
+
def convert(input)
|
9
|
+
@doc = Kramdown::Document.new(File.read(input))
|
10
|
+
@output = @doc.to_indesign.to_s
|
11
|
+
end
|
12
|
+
|
13
|
+
def assert_xml
|
14
|
+
assert { @output =~ /^<\?xml/ }
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Main heading
|
2
|
+
|
3
|
+
Hello, _first_\\
|
4
|
+
‘WAVING’!
|
5
|
+
|
6
|
+
And second.
|
7
|
+
|
8
|
+
* * *
|
9
|
+
|
10
|
+
Another section, [linked](http://foo.bar).
|
11
|
+
|
12
|
+
|
13
|
+
## Subheading
|
14
|
+
|
15
|
+
Foo bar -- & zot?
|
16
|
+
|
17
|
+
"Quotes" or 'quotes,' with ... ellipses.
|
18
|
+
|
19
|
+
Some _small_{:.sc} capitals.
|
20
|
+
|
21
|
+
Some `code` here.[^1]
|
22
|
+
|
23
|
+
[^1]: A footnote, _with style._
|
24
|
+
|
25
|
+
|
26
|
+
### Sub-subheading
|
27
|
+
|
28
|
+
More here:
|
29
|
+
|
30
|
+
- a
|
31
|
+
- bulleted
|
32
|
+
- list
|
33
|
+
|
34
|
+
and:
|
35
|
+
|
36
|
+
1. a
|
37
|
+
2. numbered
|
38
|
+
3. list
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# The Gettysburg Address
|
2
|
+
|
3
|
+
_Four score and seven years ago_ our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.
|
4
|
+
|
5
|
+
> Here is a block of quoted text.
|
6
|
+
|
7
|
+
Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.
|
8
|
+
|
9
|
+
But, in a larger sense, we can not dedicate—we can not consecrate—we can not hallow—this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth.
|
10
|
+
|
11
|
+
Abraham Lincoln[^lincoln] \\
|
12
|
+
Gettysburg, Pennsylvania \\
|
13
|
+
November 19, 1863
|
14
|
+
{:.credit}
|
15
|
+
|
16
|
+
[^lincoln]: A footnote.
|
data/test/test_simple.rb
ADDED
metadata
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kramdown-converter-indesign
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Labovitz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-11-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: kramdown
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.13'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.13'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.16'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.16'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest-power_assert
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '13.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '13.0'
|
97
|
+
description: "\n Kramdown::Converter::Indesign converts a Kramdown/Markdown document
|
98
|
+
to InDesign's ICML format.\n "
|
99
|
+
email: johnl@johnlabovitz.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- Gemfile
|
106
|
+
- README.md
|
107
|
+
- Rakefile
|
108
|
+
- TODO.md
|
109
|
+
- kramdown-converter-indesign.gemspec
|
110
|
+
- lib/kramdown-converter-indesign.rb
|
111
|
+
- lib/kramdown-converter-indesign/extensions/kramdown.rb
|
112
|
+
- lib/kramdown-converter-indesign/extensions/nokogiri.rb
|
113
|
+
- lib/kramdown-converter-indesign/style.rb
|
114
|
+
- lib/kramdown-converter-indesign/style_group.rb
|
115
|
+
- test/helpers.rb
|
116
|
+
- test/input/complex.md
|
117
|
+
- test/input/gettysburg.md
|
118
|
+
- test/input/simple.md
|
119
|
+
- test/test_complex.rb
|
120
|
+
- test/test_gettysburg.rb
|
121
|
+
- test/test_simple.rb
|
122
|
+
homepage: http://github.com/jslabovitz/kramdown-converter-indesign
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubygems_version: 3.3.26
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: Converts a Kramdown/Markdown document to InDesign's ICML format.
|
145
|
+
test_files:
|
146
|
+
- test/helpers.rb
|
147
|
+
- test/input/complex.md
|
148
|
+
- test/input/gettysburg.md
|
149
|
+
- test/input/simple.md
|
150
|
+
- test/test_complex.rb
|
151
|
+
- test/test_gettysburg.rb
|
152
|
+
- test/test_simple.rb
|