nora_mark 0.2beta19 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/FUNDING.yml +3 -0
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/test.yml +19 -0
- data/.rubocop.yml +3 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile +0 -1
- data/README.md +1 -2
- data/Rakefile +1 -4
- data/lib/nora_mark/document.rb +14 -14
- data/lib/nora_mark/extensions.rb +6 -6
- data/lib/nora_mark/html/abstract_node_writer.rb +2 -1
- data/lib/nora_mark/html/context.rb +16 -14
- data/lib/nora_mark/html/default_transformer.rb +36 -38
- data/lib/nora_mark/html/frontmatter_writer.rb +2 -2
- data/lib/nora_mark/html/generator.rb +19 -22
- data/lib/nora_mark/html/pages.rb +13 -14
- data/lib/nora_mark/html/paragraph_writer.rb +24 -26
- data/lib/nora_mark/html/raw_text_block_writer.rb +2 -1
- data/lib/nora_mark/html/tag_writer.rb +14 -13
- data/lib/nora_mark/html/util.rb +5 -5
- data/lib/nora_mark/node.rb +45 -55
- data/lib/nora_mark/node_set.rb +1 -1
- data/lib/nora_mark/node_util.rb +7 -8
- data/lib/nora_mark/parser.kpeg.rb +16 -16
- data/lib/nora_mark/parser.rb +1 -3
- data/lib/nora_mark/rake_task.rb +16 -20
- data/lib/nora_mark/transformer.rb +13 -15
- data/lib/nora_mark/version.rb +1 -1
- data/lib/nora_mark.rb +0 -4
- data/lib/tilt/nora_mark.rb +1 -1
- data/nora_mark.gemspec +6 -5
- data/spec/extensions_spec.rb +1 -2
- data/spec/fixtures/test-plugins/nora_mark_tester.rb +3 -1
- data/spec/node_spec.rb +69 -49
- data/spec/nokogiri_test_helper.rb +9 -7
- data/spec/nora_mark_spec.rb +437 -498
- data/spec/spec_helper.rb +1 -5
- data/spec/tilt_spec.rb +1 -1
- data/spec/transformer_spec.rb +16 -18
- metadata +36 -27
data/spec/spec_helper.rb
CHANGED
data/spec/tilt_spec.rb
CHANGED
data/spec/transformer_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
|
2
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
3
4
|
require File.dirname(__FILE__) + '/../lib/nora_mark'
|
4
5
|
require 'nokogiri'
|
@@ -36,9 +37,9 @@ EOF
|
|
36
37
|
body = Nokogiri::XML::Document.parse(@parsed.html[0]).root.at_xpath('xmlns:body')
|
37
38
|
expect(body.element_children[0].selector_and_children())
|
38
39
|
.to eq(
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
['section', ['h1', 'section 1'],
|
41
|
+
['div.custom1', ['div.pgroup', ['p', 'text is here']]]]
|
42
|
+
)
|
42
43
|
end
|
43
44
|
it 'can split page' do
|
44
45
|
@parsed.add_transformer(generator: :html) do
|
@@ -73,16 +74,16 @@ EOF
|
|
73
74
|
body = Nokogiri::XML::Document.parse(@parsed.html[0]).root.at_xpath('xmlns:body')
|
74
75
|
expect(body.element_children[0].selector_and_children())
|
75
76
|
.to eq(
|
76
|
-
|
77
|
-
|
78
|
-
|
77
|
+
['section', ['h1', 'section 1'],
|
78
|
+
['div.class-1', ['div.pgroup', ['p', 'text is here']]]]
|
79
|
+
)
|
79
80
|
|
80
81
|
body = Nokogiri::XML::Document.parse(@parsed.html[1]).root.at_xpath('xmlns:body')
|
81
82
|
expect(body.element_children[0].selector_and_children())
|
82
83
|
.to eq(
|
83
|
-
|
84
|
-
|
85
|
-
|
84
|
+
["section", ["h1", "section 2"],
|
85
|
+
["div.pgroup", ["p", "next text."]]]
|
86
|
+
)
|
86
87
|
end
|
87
88
|
|
88
89
|
it 'can add frontmatter' do
|
@@ -114,26 +115,23 @@ EOF
|
|
114
115
|
@node.assign_pageno
|
115
116
|
end
|
116
117
|
end
|
117
|
-
|
118
118
|
end
|
119
119
|
end
|
120
120
|
html = @parsed.html
|
121
121
|
body1 = Nokogiri::XML::Document.parse(html[0]).root.at_xpath('xmlns:body')
|
122
122
|
expect(body1.element_children[0].selector_and_children())
|
123
123
|
.to eq(
|
124
|
-
|
125
|
-
|
126
|
-
|
124
|
+
['section', ['h1', 'section 1'],
|
125
|
+
['div.class-1', ['div.pgroup', ['p', 'text is here']]]]
|
126
|
+
)
|
127
127
|
head2 = Nokogiri::XML::Document.parse(html[1]).root.at_xpath('xmlns:head')
|
128
128
|
expect(head2.element_children[1].a).to eq ["link[rel='stylesheet'][type='text/css'][href='new_stylesheet.css']", '']
|
129
129
|
|
130
130
|
body2 = Nokogiri::XML::Document.parse(@parsed.html[1]).root.at_xpath('xmlns:body')
|
131
131
|
expect(body2.element_children[0].selector_and_children())
|
132
132
|
.to eq(
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
133
|
+
["section", ["h1", "section 2"],
|
134
|
+
["div.pgroup", ["p", "next text."]]]
|
135
|
+
)
|
138
136
|
end
|
139
137
|
end
|
metadata
CHANGED
@@ -1,23 +1,37 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nora_mark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KOJIMA Satoshi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kpeg
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.3.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.3.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: debug
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - ">="
|
18
32
|
- !ruby/object:Gem::Version
|
19
33
|
version: '0'
|
20
|
-
type: :
|
34
|
+
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
@@ -67,33 +81,25 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: nokogiri
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 1.13.6
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '2.0'
|
76
93
|
type: :development
|
77
94
|
prerelease: false
|
78
95
|
version_requirements: !ruby/object:Gem::Requirement
|
79
96
|
requirements:
|
80
97
|
- - ">="
|
81
98
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
83
|
-
-
|
84
|
-
name: nokogiri
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
99
|
+
version: 1.13.6
|
100
|
+
- - "<"
|
88
101
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.7.0
|
102
|
+
version: '2.0'
|
97
103
|
description: Simple and customizable text markup language for EPUB/XHTML
|
98
104
|
email:
|
99
105
|
- skoji@mac.com
|
@@ -102,7 +108,11 @@ executables:
|
|
102
108
|
extensions: []
|
103
109
|
extra_rdoc_files: []
|
104
110
|
files:
|
111
|
+
- ".github/FUNDING.yml"
|
112
|
+
- ".github/dependabot.yml"
|
113
|
+
- ".github/workflows/test.yml"
|
105
114
|
- ".gitignore"
|
115
|
+
- ".rubocop.yml"
|
106
116
|
- ".travis.yml"
|
107
117
|
- CHANGELOG.md
|
108
118
|
- Gemfile
|
@@ -232,7 +242,7 @@ files:
|
|
232
242
|
homepage: ''
|
233
243
|
licenses: []
|
234
244
|
metadata: {}
|
235
|
-
post_install_message:
|
245
|
+
post_install_message:
|
236
246
|
rdoc_options: []
|
237
247
|
require_paths:
|
238
248
|
- lib
|
@@ -240,16 +250,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
240
250
|
requirements:
|
241
251
|
- - ">="
|
242
252
|
- !ruby/object:Gem::Version
|
243
|
-
version:
|
253
|
+
version: 3.0.0
|
244
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
255
|
requirements:
|
246
|
-
- - "
|
256
|
+
- - ">="
|
247
257
|
- !ruby/object:Gem::Version
|
248
|
-
version:
|
258
|
+
version: '0'
|
249
259
|
requirements: []
|
250
|
-
|
251
|
-
|
252
|
-
signing_key:
|
260
|
+
rubygems_version: 3.3.3
|
261
|
+
signing_key:
|
253
262
|
specification_version: 4
|
254
263
|
summary: Simple and customizable text markup language for EPUB/XHTML
|
255
264
|
test_files:
|