pseudohikiparser 0.0.0.12.develop → 0.0.0.13.develop
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/bin/pseudohiki2html.rb +19 -0
- data/lib/pseudohiki/blockparser.rb +40 -46
- data/lib/pseudohiki/converter.rb +26 -19
- data/lib/pseudohiki/htmlformat.rb +2 -1
- data/lib/pseudohiki/inlineparser.rb +4 -7
- data/lib/pseudohiki/treestack.rb +13 -19
- data/lib/pseudohiki/version.rb +1 -1
- data/lib/pseudohikiparser.rb +95 -61
- data/test/test_blockparser.rb +6 -6
- data/test/test_htmlformat.rb +28 -0
- data/test/test_inlineparser.rb +1 -1
- data/test/test_latexformat.rb +19 -0
- data/test/test_pseudohiki2html.rb +222 -0
- data/test/test_utils.rb +41 -0
- metadata +108 -76
- checksums.yaml +0 -7
data/README.md
CHANGED
data/bin/pseudohiki2html.rb
CHANGED
@@ -11,6 +11,25 @@ if $KCODE
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
unless String.new.respond_to? :encode
|
15
|
+
require 'iconv'
|
16
|
+
|
17
|
+
def choose_input_encoding_using_kcode
|
18
|
+
PseudoHiki::OptionManager::ENCODING_REGEXP.each do |pat, encoding|
|
19
|
+
return PseudoHiki::OptionManager::ENCODING_TO_CHARSET[encoding] if pat =~ $KCODE
|
20
|
+
end
|
21
|
+
HtmlElement::CHARSET::UTF8
|
22
|
+
end
|
23
|
+
private :choose_input_encoding_using_kcode
|
24
|
+
|
25
|
+
def encode(to, from=choose_input_encoding_using_kcode)
|
26
|
+
iconv = Iconv.new(to, from)
|
27
|
+
str = iconv.iconv(self)
|
28
|
+
str << iconv.iconv(nil)
|
29
|
+
end
|
30
|
+
public :encode
|
31
|
+
end
|
32
|
+
|
14
33
|
PseudoHiki::OptionManager.remove_bom
|
15
34
|
input_lines = ARGF.readlines.map {|line| line.encode(options.charset) }
|
16
35
|
options.set_options_from_input_file(input_lines)
|
@@ -6,17 +6,16 @@ require 'pseudohiki/inlineparser'
|
|
6
6
|
module PseudoHiki
|
7
7
|
class BlockParser
|
8
8
|
URI_RE = /(?:(?:https?|ftp|file):|mailto:)[A-Za-z0-9;\/?:@&=+$,\-_.!~*\'()#%]+/ #borrowed from hikidoc
|
9
|
-
ID_TAG_PAT =
|
9
|
+
ID_TAG_PAT = /\A\[([^\[\]]+)\]/o
|
10
10
|
|
11
11
|
module LINE_PAT
|
12
|
-
VERBATIM_BEGIN = /\A
|
13
|
-
VERBATIM_END = /\A
|
12
|
+
VERBATIM_BEGIN = /\A<<<\s*/o
|
13
|
+
VERBATIM_END = /\A>>>\s*/o
|
14
14
|
PLUGIN_BEGIN = /\{\{/o
|
15
15
|
PLUGIN_END = /\}\}/o
|
16
16
|
end
|
17
17
|
|
18
18
|
ParentNode = {}
|
19
|
-
HeadToLeaf = {}
|
20
19
|
|
21
20
|
attr_reader :stack
|
22
21
|
|
@@ -26,7 +25,7 @@ module PseudoHiki
|
|
26
25
|
return unless head.kind_of? String
|
27
26
|
if m = ID_TAG_PAT.match(head)
|
28
27
|
node.node_id = m[1]
|
29
|
-
leaf[0] = head.sub(ID_TAG_PAT, "")
|
28
|
+
leaf[0] = head.sub(ID_TAG_PAT, "".freeze)
|
30
29
|
end
|
31
30
|
node
|
32
31
|
end
|
@@ -49,11 +48,11 @@ module PseudoHiki
|
|
49
48
|
attr_accessor :nominal_level, :node_id, :decorator
|
50
49
|
|
51
50
|
def self.head_re=(head_regex)
|
52
|
-
@@head_re[self] = head_regex
|
51
|
+
@self_head_re = @@head_re[self] = head_regex
|
53
52
|
end
|
54
53
|
|
55
54
|
def self.head_re
|
56
|
-
|
55
|
+
@self_head_re
|
57
56
|
end
|
58
57
|
|
59
58
|
def self.with_depth?
|
@@ -61,21 +60,16 @@ module PseudoHiki
|
|
61
60
|
end
|
62
61
|
|
63
62
|
def self.create(line, inline_parser=InlineParser)
|
64
|
-
line.sub
|
63
|
+
line = line.sub(self.head_re, "".freeze) if self.head_re
|
65
64
|
new.concat(inline_parser.parse(line)) #leaf = self.new
|
66
65
|
end
|
67
66
|
|
68
|
-
def self.assign_head_re(head, need_to_escape=true, reg_pat="(%s)")
|
69
|
-
head = Regexp.escape(head) if need_to_escape
|
70
|
-
self.head_re = Regexp.new('\\A'+reg_pat%[head])
|
71
|
-
end
|
72
|
-
|
73
67
|
def head_re
|
74
|
-
@@head_re[self.class]
|
68
|
+
@head_re ||= @@head_re[self.class]
|
75
69
|
end
|
76
70
|
|
77
71
|
def block
|
78
|
-
ParentNode[self.class]
|
72
|
+
@parent_node ||= ParentNode[self.class]
|
79
73
|
end
|
80
74
|
|
81
75
|
def push_block(stack)
|
@@ -102,7 +96,7 @@ module PseudoHiki
|
|
102
96
|
include TreeStack::Mergeable
|
103
97
|
|
104
98
|
def self.create(line)
|
105
|
-
line.sub
|
99
|
+
line = line.sub(self.head_re, "".freeze) if self.head_re
|
106
100
|
self.new.tap {|leaf| leaf.push line }
|
107
101
|
end
|
108
102
|
|
@@ -117,10 +111,6 @@ module PseudoHiki
|
|
117
111
|
end
|
118
112
|
|
119
113
|
class NestedBlockLeaf < BlockLeaf
|
120
|
-
def self.assign_head_re(head, need_to_escape)
|
121
|
-
super(head, need_to_escape, "(%s)+")
|
122
|
-
end
|
123
|
-
|
124
114
|
def self.create(line)
|
125
115
|
m = self.head_re.match(line)
|
126
116
|
super(line).tap {|leaf| leaf.nominal_level = m[0].length }
|
@@ -142,13 +132,11 @@ module PseudoHiki
|
|
142
132
|
attr_accessor :node_id
|
143
133
|
|
144
134
|
def nominal_level
|
145
|
-
|
146
|
-
first.nominal_level
|
135
|
+
first.nominal_level if first # @cached_nominal_level ||= (first.nominal_level if first)
|
147
136
|
end
|
148
137
|
|
149
138
|
def decorator
|
150
|
-
|
151
|
-
first.decorator
|
139
|
+
first.decorator if first
|
152
140
|
end
|
153
141
|
|
154
142
|
def push_self(stack)
|
@@ -163,7 +151,7 @@ module PseudoHiki
|
|
163
151
|
def parse_leafs(breaker); end
|
164
152
|
|
165
153
|
def in_link_tag?(preceding_str)
|
166
|
-
preceding_str[-2, 2] == "[[" or preceding_str[-1, 1] == "|"
|
154
|
+
preceding_str[-2, 2] == "[[".freeze or preceding_str[-1, 1] == "|".freeze
|
167
155
|
end
|
168
156
|
|
169
157
|
def tagfy_link(line)
|
@@ -177,8 +165,8 @@ module PseudoHiki
|
|
177
165
|
end
|
178
166
|
|
179
167
|
def create_leaf(line, blockparser)
|
180
|
-
return BlockElement::VerbatimLeaf.create("", true) if LINE_PAT::VERBATIM_BEGIN =~ line
|
181
|
-
line = tagfy_link(line)
|
168
|
+
return BlockElement::VerbatimLeaf.create("".freeze, true) if LINE_PAT::VERBATIM_BEGIN =~ line
|
169
|
+
line = tagfy_link(line) if URI_RE =~ line and BlockElement::VerbatimLeaf.head_re !~ line
|
182
170
|
blockparser.select_leaf_type(line).create(line)
|
183
171
|
end
|
184
172
|
end
|
@@ -221,7 +209,13 @@ module PseudoHiki
|
|
221
209
|
include BlockElement
|
222
210
|
|
223
211
|
class BlockElement::BlockNodeEnd
|
212
|
+
PARSED_NODE_END = new.concat(InlineParser.parse(""))
|
213
|
+
|
224
214
|
def push_self(stack); end
|
215
|
+
|
216
|
+
def self.create(line, inline_parser=InlineParser)
|
217
|
+
PARSED_NODE_END
|
218
|
+
end
|
225
219
|
end
|
226
220
|
|
227
221
|
class BlockElement::VerbatimNode
|
@@ -279,7 +273,7 @@ module PseudoHiki
|
|
279
273
|
attr_accessor :in_block_tag
|
280
274
|
|
281
275
|
def self.create(line, in_block_tag=nil)
|
282
|
-
line.sub
|
276
|
+
line = line.sub(self.head_re, "".freeze) if self.head_re and not in_block_tag
|
283
277
|
self.new.tap do |leaf|
|
284
278
|
leaf.push line
|
285
279
|
leaf.in_block_tag = in_block_tag
|
@@ -331,29 +325,30 @@ module PseudoHiki
|
|
331
325
|
ParentNode[BlockNodeEnd] = BlockNodeEnd
|
332
326
|
|
333
327
|
def self.assign_head_re
|
334
|
-
|
335
|
-
head_pats = []
|
336
|
-
[['
|
337
|
-
[
|
328
|
+
irregular_leafs = [BlockNodeEnd, VerbatimLeaf, HrLeaf]
|
329
|
+
head_pats, leaf_types = [], [:entire_matched_part]
|
330
|
+
[['\r?\n?$', BlockNodeEnd],
|
331
|
+
['//@', DecoratorLeaf],
|
332
|
+
[':', DescLeaf],
|
333
|
+
['\s', VerbatimLeaf],
|
338
334
|
['""', QuoteLeaf],
|
339
335
|
['||', TableLeaf],
|
340
336
|
['//', CommentOutLeaf],
|
341
337
|
['!', HeadingLeaf],
|
342
338
|
['*', ListLeaf],
|
343
|
-
['#', EnumLeaf]
|
339
|
+
['#', EnumLeaf],
|
340
|
+
['----\s*$', HrLeaf]
|
344
341
|
].each do |head, leaf|
|
345
|
-
|
346
|
-
|
347
|
-
head_pat = leaf.with_depth? ? "(#{escaped_head})+" : "(#{escaped_head})"
|
348
|
-
head_pats.push head_pat
|
342
|
+
escaped_head = irregular_leafs.include?(leaf) ? head : Regexp.escape(head)
|
343
|
+
head_pat = leaf.with_depth? ? "#{escaped_head}+" : "#{escaped_head}"
|
349
344
|
leaf.head_re = Regexp.new('\\A'+head_pat)
|
345
|
+
head_pats.push "(#{escaped_head})"
|
346
|
+
leaf_types.push leaf
|
350
347
|
end
|
351
|
-
|
352
|
-
BlockNodeEnd.head_re = Regexp.new(/^(\r?\n?)$/o)
|
353
|
-
DecoratorLeaf.head_re = Regexp.new(/^(\/\/@)/o)
|
354
|
-
Regexp.new('\\A('+head_pats.join('|')+')')
|
348
|
+
return Regexp.new('\\A(?:'+head_pats.join('|')+')'), leaf_types, leaf_types.length - 1
|
355
349
|
end
|
356
|
-
|
350
|
+
|
351
|
+
LEAF_HEAD_PAT, NOT_PARAGRAPH_LEAF_TYPES, NUMBER_OF_NOT_PARAGRAPH_LEAF_TYPES = assign_head_re
|
357
352
|
|
358
353
|
def initialize
|
359
354
|
root_node = BlockNode.new
|
@@ -368,10 +363,9 @@ module PseudoHiki
|
|
368
363
|
end
|
369
364
|
|
370
365
|
def select_leaf_type(line)
|
371
|
-
|
372
|
-
|
373
|
-
return
|
374
|
-
ParagraphLeaf
|
366
|
+
matched = LEAF_HEAD_PAT.match(line)
|
367
|
+
return ParagraphLeaf unless matched
|
368
|
+
1.upto(NUMBER_OF_NOT_PARAGRAPH_LEAF_TYPES) {|i| return NOT_PARAGRAPH_LEAF_TYPES[i] if matched[i] }
|
375
369
|
end
|
376
370
|
|
377
371
|
def read_lines(lines)
|
data/lib/pseudohiki/converter.rb
CHANGED
@@ -7,6 +7,7 @@ require 'pseudohiki/blockparser'
|
|
7
7
|
require 'pseudohiki/htmlformat'
|
8
8
|
require 'pseudohiki/plaintextformat'
|
9
9
|
require 'pseudohiki/markdownformat'
|
10
|
+
require 'pseudohiki/utils'
|
10
11
|
require 'htmlelement/htmltemplate'
|
11
12
|
require 'htmlelement'
|
12
13
|
|
@@ -18,6 +19,11 @@ module PseudoHiki
|
|
18
19
|
|
19
20
|
def initialize(options)
|
20
21
|
@options = options
|
22
|
+
@is_toc_item_pat = Proc.new do |node|
|
23
|
+
node.kind_of?(PseudoHiki::BlockParser::HeadingLeaf) and
|
24
|
+
(2..3).include? node.nominal_level and
|
25
|
+
node.node_id
|
26
|
+
end
|
21
27
|
end
|
22
28
|
|
23
29
|
def formatter
|
@@ -25,25 +31,26 @@ module PseudoHiki
|
|
25
31
|
end
|
26
32
|
|
27
33
|
def to_plain(line)
|
28
|
-
PlainFormat.format(
|
34
|
+
PlainFormat.format(line).to_s
|
35
|
+
end
|
36
|
+
|
37
|
+
def collect_nodes_for_table_of_contents(tree)
|
38
|
+
Utils::NodeCollector.select(tree) {|node| @is_toc_item_pat.call(node) }
|
29
39
|
end
|
30
40
|
|
31
|
-
def create_plain_table_of_contents(
|
32
|
-
toc_lines =
|
33
|
-
|
34
|
-
heading_depth = m[1].length
|
35
|
-
line.sub(/^!+/o, '*'*heading_depth)
|
41
|
+
def create_plain_table_of_contents(tree)
|
42
|
+
toc_lines = collect_nodes_for_table_of_contents(tree).map do |toc_node|
|
43
|
+
('*' * toc_node.nominal_level) + to_plain(toc_node)
|
36
44
|
end
|
37
45
|
|
38
46
|
@options.formatter.format(BlockParser.parse(toc_lines))
|
39
47
|
end
|
40
48
|
|
41
|
-
def create_html_table_of_contents(
|
42
|
-
toc_lines =
|
43
|
-
|
44
|
-
heading_depth, id = m[1].length, m[2].upcase
|
45
|
-
"%s[[%s|#%s]]"%['*'*heading_depth, to_plain(line.sub(HEADING_WITH_ID_PAT,'')), id]
|
49
|
+
def create_html_table_of_contents(tree)
|
50
|
+
toc_lines = collect_nodes_for_table_of_contents(tree).map do |toc_node|
|
51
|
+
"%s[[%s|#%s]]"%['*'*toc_node.nominal_level, to_plain(toc_node).lstrip, toc_node.node_id.upcase]
|
46
52
|
end
|
53
|
+
|
47
54
|
@options.formatter.format(BlockParser.parse(toc_lines)).tap do |toc|
|
48
55
|
toc.traverse do |element|
|
49
56
|
if element.kind_of? HtmlElement and element.tagname == "a"
|
@@ -53,10 +60,10 @@ module PseudoHiki
|
|
53
60
|
end
|
54
61
|
end
|
55
62
|
|
56
|
-
def create_table_of_contents(
|
63
|
+
def create_table_of_contents(tree)
|
57
64
|
return "" unless @options[:toc]
|
58
|
-
return create_plain_table_of_contents(
|
59
|
-
create_html_table_of_contents(
|
65
|
+
return create_plain_table_of_contents(tree) unless @options.html_template
|
66
|
+
create_html_table_of_contents(tree)
|
60
67
|
end
|
61
68
|
|
62
69
|
def split_main_heading(input_lines)
|
@@ -108,18 +115,18 @@ module PseudoHiki
|
|
108
115
|
end
|
109
116
|
end
|
110
117
|
|
111
|
-
def compose_body(
|
112
|
-
tree = BlockParser.parse(input_lines)
|
118
|
+
def compose_body(tree)
|
113
119
|
@options.formatter.format(tree)
|
114
120
|
end
|
115
121
|
|
116
122
|
def compose_html(input_lines)
|
117
123
|
h1 = split_main_heading(input_lines)
|
118
124
|
css = @options[:css]
|
119
|
-
|
120
|
-
|
125
|
+
tree = BlockParser.parse(input_lines)
|
126
|
+
toc = create_table_of_contents(tree)
|
127
|
+
body = compose_body(tree)
|
121
128
|
title = @options.title
|
122
|
-
main = create_main(toc,body, h1)
|
129
|
+
main = create_main(toc, body, h1)
|
123
130
|
|
124
131
|
if @options[:template]
|
125
132
|
erb = ERB.new(@options.read_template_file)
|
@@ -149,6 +149,7 @@ module PseudoHiki
|
|
149
149
|
|
150
150
|
class << Formatter[LinkNode]
|
151
151
|
def visit(tree)
|
152
|
+
not_from_thumbnail = tree.first.class != LinkNode
|
152
153
|
tree = tree.dup
|
153
154
|
caption = get_caption(tree)
|
154
155
|
begin
|
@@ -157,7 +158,7 @@ module PseudoHiki
|
|
157
158
|
raise NoMethodError unless tree.empty?
|
158
159
|
STDERR.puts "No uri is specified for #{caption}"
|
159
160
|
end
|
160
|
-
if ImageSuffix =~ ref
|
161
|
+
if ImageSuffix =~ ref and not_from_thumbnail
|
161
162
|
htmlelement = ImgFormat.create_self_element
|
162
163
|
htmlelement[SRC] = tree.join
|
163
164
|
htmlelement[ALT] = caption.join if caption
|
@@ -14,7 +14,7 @@ module PseudoHiki
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.compile_token_pat(*token_sets)
|
17
|
-
tokens = token_sets.flatten.uniq.sort do |x,y|
|
17
|
+
tokens = token_sets.flatten.uniq.sort do |x, y|
|
18
18
|
[y.length, y] <=> [x.length, x]
|
19
19
|
end.collect {|token| Regexp.escape(token) }
|
20
20
|
Regexp.new(tokens.join("|"))
|
@@ -22,7 +22,7 @@ module PseudoHiki
|
|
22
22
|
|
23
23
|
class InlineParser < TreeStack
|
24
24
|
module InlineElement
|
25
|
-
class InlineNode < InlineParser::Node;end
|
25
|
+
class InlineNode < InlineParser::Node; end
|
26
26
|
class InlineLeaf < InlineParser::Leaf; end
|
27
27
|
# class LinkSepLeaf < InlineLeaf; end
|
28
28
|
|
@@ -51,11 +51,8 @@ module PseudoHiki
|
|
51
51
|
|
52
52
|
TokenPat[self] = PseudoHiki.compile_token_pat(HEAD.keys,TAIL.keys,[LinkSep, TableSep, DescSep])
|
53
53
|
|
54
|
-
def token_pat
|
55
|
-
TokenPat[self.class]
|
56
|
-
end
|
57
|
-
|
58
54
|
def initialize(str)
|
55
|
+
@token_pat = TokenPat[self.class]
|
59
56
|
@tokens = split_into_tokens(str)
|
60
57
|
super()
|
61
58
|
end
|
@@ -80,7 +77,7 @@ module PseudoHiki
|
|
80
77
|
|
81
78
|
def split_into_tokens(str)
|
82
79
|
tokens = []
|
83
|
-
while m = token_pat.match(str)
|
80
|
+
while m = @token_pat.match(str)
|
84
81
|
tokens.push m.pre_match unless m.pre_match.empty?
|
85
82
|
tokens.push m[0]
|
86
83
|
str = m.post_match
|
data/lib/pseudohiki/treestack.rb
CHANGED
@@ -18,7 +18,7 @@ class TreeStack
|
|
18
18
|
|
19
19
|
module NodeType
|
20
20
|
def push_self(stack)
|
21
|
-
@depth = stack.
|
21
|
+
@depth = stack.current_node.depth + 1
|
22
22
|
stack.push_as_child_node self
|
23
23
|
nil
|
24
24
|
end
|
@@ -26,7 +26,7 @@ class TreeStack
|
|
26
26
|
|
27
27
|
module LeafType
|
28
28
|
def push_self(stack)
|
29
|
-
@depth = stack.
|
29
|
+
@depth = stack.current_node.depth + 1
|
30
30
|
stack.push_as_leaf self
|
31
31
|
self
|
32
32
|
end
|
@@ -59,18 +59,13 @@ class TreeStack
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
attr_reader :node_end, :last_leaf
|
62
|
+
attr_reader :node_end, :last_leaf, :current_node
|
63
63
|
|
64
64
|
def initialize(root_node=Node.new)
|
65
65
|
@stack = [root_node]
|
66
|
+
@current_node = root_node # @stack[-1]
|
66
67
|
@node_end = NodeEnd.new
|
67
|
-
|
68
|
-
0
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def current_node
|
73
|
-
@stack.last
|
68
|
+
root_node.depth = 0
|
74
69
|
end
|
75
70
|
|
76
71
|
def tree
|
@@ -83,25 +78,24 @@ class TreeStack
|
|
83
78
|
end
|
84
79
|
|
85
80
|
def pop
|
86
|
-
|
81
|
+
return unless @stack.length > 1
|
82
|
+
@current_node = @stack[-2]
|
83
|
+
@stack.pop
|
87
84
|
end
|
88
85
|
alias return_to_previous_node pop
|
89
86
|
|
90
|
-
def current_depth
|
91
|
-
@stack.last.depth
|
92
|
-
end
|
93
|
-
|
94
87
|
def push_as_child_node(node)
|
95
|
-
@
|
88
|
+
@current_node.push node
|
89
|
+
@current_node = node
|
96
90
|
@stack.push node
|
97
91
|
end
|
98
92
|
|
99
93
|
def push_as_leaf(node)
|
100
|
-
@
|
94
|
+
@current_node.push node
|
101
95
|
end
|
102
96
|
|
103
97
|
def push_as_sibling(sibling_node=nil)
|
104
|
-
sibling_node ||= current_node.class.new
|
98
|
+
sibling_node ||= @current_node.class.new
|
105
99
|
pop if sibling_node.kind_of? NodeType
|
106
100
|
push(sibling_node)
|
107
101
|
sibling_node
|
@@ -109,7 +103,7 @@ class TreeStack
|
|
109
103
|
|
110
104
|
def remove_current_node
|
111
105
|
removed_node = self.pop
|
112
|
-
|
106
|
+
@current_node.pop
|
113
107
|
removed_node
|
114
108
|
end
|
115
109
|
|
data/lib/pseudohiki/version.rb
CHANGED
data/lib/pseudohikiparser.rb
CHANGED
@@ -13,9 +13,9 @@ module PseudoHiki
|
|
13
13
|
# This class provides class methods for converting texts written in a Hiki-like notation into HTML or other formats.
|
14
14
|
#
|
15
15
|
class Format
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
@@formatter = {}
|
17
|
+
@@preset_options = {}
|
18
|
+
@@type_to_formatter = {}
|
19
19
|
|
20
20
|
[
|
21
21
|
[:html, HtmlFormat, nil],
|
@@ -27,73 +27,107 @@ module PseudoHiki
|
|
27
27
|
[:gfm, MarkDownFormat, { :strict_mode=> false, :gfm_style => true }]
|
28
28
|
].each do |type, formatter, options|
|
29
29
|
preset_options = [type, nil]
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
@@formatter[preset_options] = formatter.create(options)
|
31
|
+
@@preset_options[type] = preset_options
|
32
|
+
@@type_to_formatter[type] = formatter
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
tree = BlockParser.parse(hiki_data)
|
35
|
+
# Converts <hiki_data> into a format specified by <format_type>
|
36
|
+
#
|
37
|
+
# <hiki_data> should be a string or an array of strings
|
38
|
+
#
|
39
|
+
# Options for <format_type> are:
|
40
|
+
# [:html] HTML4.1
|
41
|
+
# [:xhtml] XHTML1.0
|
42
|
+
# [:html5] HTML5
|
43
|
+
# [:plain] remove all of tags. certain information such as urls in link tags does not appear in the output
|
44
|
+
# [:plain_verbose] similar to :plain, but certain information such as urls in link tags will be kept in the output
|
45
|
+
# [:markdown] Markdown
|
46
|
+
# [:gfm] GitHub Flavored Markdown
|
47
|
+
#
|
48
|
+
def self.format(hiki_data, format_type, options=nil, &block)
|
49
|
+
tree = BlockParser.parse(hiki_data)
|
51
50
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
51
|
+
if options
|
52
|
+
@@formatter[[format_type, options]] ||= @@type_to_formatter[format_type].create(options)
|
53
|
+
else
|
54
|
+
@@formatter[@@preset_options[format_type]]
|
55
|
+
end.format(tree).tap do |formatted|
|
56
|
+
block.call(formatted) if block
|
57
|
+
end.to_s
|
58
|
+
end
|
60
59
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
60
|
+
# Converts <hiki_data> into HTML4.1
|
61
|
+
#
|
62
|
+
# When you give a block to this method, a tree of HtmlElement objects is passed as the parameter to the block,
|
63
|
+
# so you can traverse it, as in the following example:
|
64
|
+
#
|
65
|
+
# hiki = <<HIKI
|
66
|
+
# !! heading
|
67
|
+
#
|
68
|
+
# paragraph 1 that contains [[a link to a html file|http://www.example.org/example.html]]
|
69
|
+
#
|
70
|
+
# paragraph 2 that contains [[a link to a pdf file|http://www.example.org/example.pdf]]
|
71
|
+
# HIKI
|
72
|
+
#
|
73
|
+
# html_str = PseudoHiki::Format.to_html(hiki) do |html|
|
74
|
+
# html.traverse do |elm|
|
75
|
+
# if elm.kind_of? HtmlElement and elm.tagname == "a"
|
76
|
+
# elm["class"] = "pdf" if /\.pdf\Z/o =~ elm["href"]
|
77
|
+
# end
|
78
|
+
# end
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
# and the value of html_str is
|
82
|
+
#
|
83
|
+
# <div class="section h2">
|
84
|
+
# <h2> heading
|
85
|
+
# </h2>
|
86
|
+
# <p>
|
87
|
+
# paragraph 1 that contains <a href="http://www.example.org/example.html">a link to a html file</a>
|
88
|
+
# </p>
|
89
|
+
# <p>
|
90
|
+
# paragraph 2 that contains <a class="pdf" href="http://www.example.org/example.pdf">a link to a pdf file</a>
|
91
|
+
# </p>
|
92
|
+
# <!-- end of section h2 -->
|
93
|
+
# </div>
|
94
|
+
#
|
95
|
+
def self.to_html(hiki_data, &block)
|
96
|
+
format(hiki_data, :html, options=nil, &block)
|
97
|
+
end
|
67
98
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
99
|
+
# Converts <hiki_data> into XHTML1.0
|
100
|
+
#
|
101
|
+
# You can give a block to this method as in the case of ::to_html, but the parameter to the block is a tree of XhtmlElement objects
|
102
|
+
#
|
103
|
+
def self.to_xhtml(hiki_data, &block)
|
104
|
+
format(hiki_data, :xhtml, options=nil, &block)
|
105
|
+
end
|
73
106
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
107
|
+
# Converts <hiki_data> into HTML5
|
108
|
+
#
|
109
|
+
# You can give a block to this method as in the case of ::to_html, but the parameter to the block is a tree of Xhtml5Element objects
|
110
|
+
#
|
111
|
+
def self.to_html5(hiki_data, &block)
|
112
|
+
format(hiki_data, :html5, options=nil, &block)
|
113
|
+
end
|
79
114
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
115
|
+
# Converts <hiki_data> into plain texts without tags
|
116
|
+
#
|
117
|
+
def self.to_plain(hiki_data, &block)
|
118
|
+
format(hiki_data, :plain, options=nil, &block)
|
119
|
+
end
|
85
120
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
121
|
+
# Converts <hiki_data> into Markdown
|
122
|
+
#
|
123
|
+
def self.to_markdown(hiki_data, &block)
|
124
|
+
format(hiki_data, :markdown, options=nil, &block)
|
125
|
+
end
|
91
126
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
end
|
127
|
+
# Converts <hiki_data> into GitHub Flavored Markdown
|
128
|
+
#
|
129
|
+
def self.to_gfm(hiki_data, &block)
|
130
|
+
format(hiki_data, :gfm, options=nil, &block)
|
97
131
|
end
|
98
132
|
end
|
99
133
|
end
|
data/test/test_blockparser.rb
CHANGED
@@ -15,15 +15,15 @@ class TC_BlockLeaf < MiniTest::Unit::TestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_block_head_re_when_verbatimleaf
|
18
|
-
assert_equal(/\A
|
18
|
+
assert_equal(/\A\s/o, VerbatimLeaf.new.head_re)
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_block_head_re_when_tableleaf
|
22
|
-
assert_equal(/\A
|
22
|
+
assert_equal(/\A\|\|/o, TableLeaf.new.head_re)
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_block_head_re_when_commentoutleaf
|
26
|
-
assert_equal(/\A
|
26
|
+
assert_equal(/\A\/\//o.to_s, CommentOutLeaf.new.head_re.to_s)
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_block_head_re_when_commentoutleaf2
|
@@ -31,7 +31,7 @@ class TC_BlockLeaf < MiniTest::Unit::TestCase
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_block_head_re_when_headingleaf
|
34
|
-
assert_equal(/\A
|
34
|
+
assert_equal(/\A!+/o, HeadingLeaf.new.head_re)
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_leaf_create
|
@@ -332,8 +332,8 @@ TEXT
|
|
332
332
|
assert_equal(PseudoHiki::BlockParser::BlockNode, tree.class)
|
333
333
|
assert_equal("section_name", tree[0].decorator["class"].id)
|
334
334
|
assert_equal(PseudoHiki::BlockParser::BlockElement::HeadingNode, tree[0].class)
|
335
|
-
assert_equal(
|
336
|
-
assert_equal(
|
335
|
+
assert_equal([[["title of section"]], [[[["header 1"]], [[" header 2"]]], [[["cell 1"]], [["cell 2"]]]], [[["a paragraph."]]], [[["another paragraph."]]]], tree[0])
|
336
|
+
assert_equal([["Summary of the table"]], tree[0][1].decorator["summary"].value)
|
337
337
|
assert_equal(PseudoHiki::BlockParser::BlockElement::TableNode, tree[0][1].class)
|
338
338
|
assert_equal(nil, tree[0][2].decorator)
|
339
339
|
assert_equal('id_name', tree[0][3].decorator[:id].id)
|
data/test/test_htmlformat.rb
CHANGED
@@ -115,6 +115,34 @@ HTML
|
|
115
115
|
assert_equal(html,convert_text_to_html(text))
|
116
116
|
end
|
117
117
|
|
118
|
+
def test_img
|
119
|
+
text = <<TEXT
|
120
|
+
a paragraph with a normal [[link|http://www.example.org/]]
|
121
|
+
|
122
|
+
a paragraph with an [[image|http://www.example.org/image.png]]
|
123
|
+
|
124
|
+
a paragraph with a link to an image from [[[[a thumbnail image|image/thumb_nail.png]]|http://www.example.org/image.png]]
|
125
|
+
TEXT
|
126
|
+
|
127
|
+
html = <<HTML
|
128
|
+
<p>
|
129
|
+
a paragraph with a normal <a href="http://www.example.org/">link</a>
|
130
|
+
</p>
|
131
|
+
<p>
|
132
|
+
a paragraph with an <img alt="image" src="http://www.example.org/image.png">
|
133
|
+
|
134
|
+
</p>
|
135
|
+
<p>
|
136
|
+
a paragraph with a link to an image from <a href="http://www.example.org/image.png"><img alt="a thumbnail image" src="image/thumb_nail.png">
|
137
|
+
</a>
|
138
|
+
</p>
|
139
|
+
HTML
|
140
|
+
|
141
|
+
|
142
|
+
tree = BlockParser.parse(text)
|
143
|
+
assert_equal(html, HtmlFormat.format(tree).to_s)
|
144
|
+
end
|
145
|
+
|
118
146
|
def test_plugin
|
119
147
|
text = <<TEXT
|
120
148
|
a paragraph with several plugin tags.
|
data/test/test_inlineparser.rb
CHANGED
@@ -10,7 +10,7 @@ class TC_InlineParser < MiniTest::Unit::TestCase
|
|
10
10
|
|
11
11
|
def test_inlineparser_compile_token_pat
|
12
12
|
parser = InlineParser.new("")
|
13
|
-
assert_equal(/'''|\}\}|\|\||\{\{|``|\]\]|\[\[|==|''|\||:/,parser.token_pat)
|
13
|
+
assert_equal(/'''|\}\}|\|\||\{\{|``|\]\]|\[\[|==|''|\||:/, parser.instance_variable_get(:@token_pat))
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_inlineparser_split_into_tokens
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require 'pseudohiki/latexformat'
|
5
|
+
|
6
|
+
class TC_LaTeXTag < MiniTest::Unit::TestCase
|
7
|
+
include PseudoHiki
|
8
|
+
|
9
|
+
def test_escape
|
10
|
+
unescaped = '# $ % \\ & {} ^ _ ~'
|
11
|
+
escaped = '\\# \\$ \\% \\textbackslash{} \\& \\{\\} \\^{} \\_ \\~{}'
|
12
|
+
assert_equal(escaped, LaTeXTag.escape(unescaped))
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_format_options
|
16
|
+
command = LaTeXTag.new("documentclass")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -111,6 +111,228 @@ end
|
|
111
111
|
class TC_PageComposer < MiniTest::Unit::TestCase
|
112
112
|
include PseudoHiki
|
113
113
|
|
114
|
+
def setup
|
115
|
+
@input_lines = <<HIKI.each_line.to_a
|
116
|
+
!Title
|
117
|
+
|
118
|
+
!![heading1]Heading1
|
119
|
+
|
120
|
+
paragraph
|
121
|
+
|
122
|
+
paragran
|
123
|
+
|
124
|
+
!![heading2]Heading2
|
125
|
+
|
126
|
+
!!![heading2-1]Heading2-1
|
127
|
+
|
128
|
+
paragraph
|
129
|
+
|
130
|
+
paragraph
|
131
|
+
|
132
|
+
HIKI
|
133
|
+
|
134
|
+
@parsed_tree = BlockParser.parse(@input_lines)
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_collect_nodes_for_table_of_contents
|
138
|
+
set_argv("-fg -s -c css/with_toc.css wikipage.txt")
|
139
|
+
options = OptionManager.new
|
140
|
+
options.set_options_from_command_line
|
141
|
+
collected_nodes = [[["Heading1\n"]],
|
142
|
+
[["Heading2\n"]],
|
143
|
+
[["Heading2-1\n"]]]
|
144
|
+
|
145
|
+
tree = BlockParser.parse(@input_lines)
|
146
|
+
toc_nodes = PageComposer.new(options).collect_nodes_for_table_of_contents(tree)
|
147
|
+
assert_equal(collected_nodes, toc_nodes)
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_create_plain_table_of_contents
|
151
|
+
toc_in_plain_text = <<TEXT
|
152
|
+
* Heading1
|
153
|
+
* Heading2
|
154
|
+
* Heading2-1
|
155
|
+
TEXT
|
156
|
+
set_argv("-fg -s -c css/with_toc.css wikipage.txt")
|
157
|
+
|
158
|
+
options = OptionManager.new
|
159
|
+
options.set_options_from_command_line
|
160
|
+
|
161
|
+
toc = PageComposer.new(options).create_plain_table_of_contents(@parsed_tree)
|
162
|
+
|
163
|
+
assert_equal(toc_in_plain_text, toc)
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_create_html_table_of_contents
|
167
|
+
toc_in_html = <<TEXT
|
168
|
+
<ul>
|
169
|
+
<li><a href="#HEADING1" title="toc_item: Heading1">Heading1
|
170
|
+
</a></li>
|
171
|
+
<li><a href="#HEADING2" title="toc_item: Heading2">Heading2
|
172
|
+
</a><ul>
|
173
|
+
<li><a href="#HEADING2-1" title="toc_item: Heading2-1">Heading2-1
|
174
|
+
</a></li>
|
175
|
+
</ul>
|
176
|
+
</li>
|
177
|
+
</ul>
|
178
|
+
TEXT
|
179
|
+
|
180
|
+
set_argv("-fh5 -s -c css/with_toc.css wikipage.txt")
|
181
|
+
|
182
|
+
options = OptionManager.new
|
183
|
+
options.set_options_from_command_line
|
184
|
+
|
185
|
+
toc = PageComposer.new(options).create_html_table_of_contents(@parsed_tree).join
|
186
|
+
|
187
|
+
assert_equal(toc_in_html, toc)
|
188
|
+
end
|
189
|
+
|
190
|
+
def test_create_table_of_contents
|
191
|
+
set_argv("-c css/with_toc.css wikipage.txt")
|
192
|
+
options = OptionManager.new
|
193
|
+
options.set_options_from_command_line
|
194
|
+
toc = PageComposer.new(options).create_table_of_contents(@parsed_tree)
|
195
|
+
assert_equal("", toc)
|
196
|
+
|
197
|
+
toc_in_plain_text = <<TEXT
|
198
|
+
* Heading1
|
199
|
+
* Heading2
|
200
|
+
* Heading2-1
|
201
|
+
TEXT
|
202
|
+
|
203
|
+
set_argv("-fg -m 'table of contents' -c css/with_toc.css wikipage.txt")
|
204
|
+
options = OptionManager.new
|
205
|
+
options.set_options_from_command_line
|
206
|
+
toc = PageComposer.new(options).create_table_of_contents(@parsed_tree)
|
207
|
+
assert_equal(toc_in_plain_text, toc)
|
208
|
+
|
209
|
+
toc_in_html = <<TEXT
|
210
|
+
<ul>
|
211
|
+
<li><a href="#HEADING1" title="toc_item: Heading1">Heading1
|
212
|
+
</a></li>
|
213
|
+
<li><a href="#HEADING2" title="toc_item: Heading2">Heading2
|
214
|
+
</a><ul>
|
215
|
+
<li><a href="#HEADING2-1" title="toc_item: Heading2-1">Heading2-1
|
216
|
+
</a></li>
|
217
|
+
</ul>
|
218
|
+
</li>
|
219
|
+
</ul>
|
220
|
+
TEXT
|
221
|
+
|
222
|
+
set_argv("-fh5 -m 'table of contents' -c css/with_toc.css wikipage.txt")
|
223
|
+
options = OptionManager.new
|
224
|
+
options.set_options_from_command_line
|
225
|
+
toc = PageComposer.new(options).create_table_of_contents(@parsed_tree).join
|
226
|
+
assert_equal(toc_in_html, toc)
|
227
|
+
end
|
228
|
+
|
229
|
+
def test_compose_html
|
230
|
+
expected_html =<<HTML
|
231
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
232
|
+
<!DOCTYPE html>
|
233
|
+
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
234
|
+
<head>
|
235
|
+
<meta charset="UTF-8" />
|
236
|
+
<title>wikipage</title>
|
237
|
+
<link href="css/with_toc.css" rel="stylesheet" type="text/css" />
|
238
|
+
</head>
|
239
|
+
<body>
|
240
|
+
<section id="main">
|
241
|
+
<section id="toc">
|
242
|
+
<h2>table of contents</h2>
|
243
|
+
<ul>
|
244
|
+
<li><a href="#HEADING1" title="toc_item: Heading1">Heading1
|
245
|
+
</a></li>
|
246
|
+
<li><a href="#HEADING2" title="toc_item: Heading2">Heading2
|
247
|
+
</a><ul>
|
248
|
+
<li><a href="#HEADING2-1" title="toc_item: Heading2-1">Heading2-1
|
249
|
+
</a></li>
|
250
|
+
</ul>
|
251
|
+
</li>
|
252
|
+
</ul>
|
253
|
+
<!-- end of toc -->
|
254
|
+
</section>
|
255
|
+
<section id="contents">
|
256
|
+
<section class="h1">
|
257
|
+
<h1>Title
|
258
|
+
</h1>
|
259
|
+
<section class="h2">
|
260
|
+
<h2 id="HEADING1">Heading1
|
261
|
+
</h2>
|
262
|
+
<p>
|
263
|
+
paragraph
|
264
|
+
</p>
|
265
|
+
<p>
|
266
|
+
paragran
|
267
|
+
</p>
|
268
|
+
<!-- end of h2 -->
|
269
|
+
</section>
|
270
|
+
<section class="h2">
|
271
|
+
<h2 id="HEADING2">Heading2
|
272
|
+
</h2>
|
273
|
+
<section class="h3">
|
274
|
+
<h3 id="HEADING2-1">Heading2-1
|
275
|
+
</h3>
|
276
|
+
<p>
|
277
|
+
paragraph
|
278
|
+
</p>
|
279
|
+
<p>
|
280
|
+
paragraph
|
281
|
+
</p>
|
282
|
+
<!-- end of h3 -->
|
283
|
+
</section>
|
284
|
+
<!-- end of h2 -->
|
285
|
+
</section>
|
286
|
+
<!-- end of h1 -->
|
287
|
+
</section>
|
288
|
+
<!-- end of contents -->
|
289
|
+
</section>
|
290
|
+
<!-- end of main -->
|
291
|
+
</section>
|
292
|
+
</body>
|
293
|
+
</html>
|
294
|
+
HTML
|
295
|
+
|
296
|
+
expected_plain_text = <<TEXT
|
297
|
+
## table of contents
|
298
|
+
|
299
|
+
* Heading1
|
300
|
+
* Heading2
|
301
|
+
* Heading2-1
|
302
|
+
|
303
|
+
# Title
|
304
|
+
|
305
|
+
## Heading1
|
306
|
+
|
307
|
+
paragraph
|
308
|
+
|
309
|
+
paragran
|
310
|
+
|
311
|
+
## Heading2
|
312
|
+
|
313
|
+
### Heading2-1
|
314
|
+
|
315
|
+
paragraph
|
316
|
+
|
317
|
+
paragraph
|
318
|
+
|
319
|
+
TEXT
|
320
|
+
|
321
|
+
set_argv("-fh5 -m 'table of contents' -c css/with_toc.css wikipage.txt")
|
322
|
+
options = OptionManager.new
|
323
|
+
options.set_options_from_command_line
|
324
|
+
|
325
|
+
composed_html = PageComposer.new(options).compose_html(@input_lines).to_s
|
326
|
+
assert_equal(expected_html, composed_html)
|
327
|
+
|
328
|
+
set_argv("-fg -m 'table of contents' -c css/with_toc.css wikipage.txt")
|
329
|
+
options = OptionManager.new
|
330
|
+
options.set_options_from_command_line
|
331
|
+
|
332
|
+
composed_plain_text = PageComposer.new(options).compose_html(@input_lines).join
|
333
|
+
assert_equal(expected_plain_text, composed_plain_text)
|
334
|
+
end
|
335
|
+
|
114
336
|
def test_output_in_gfm_with_toc
|
115
337
|
input = <<TEXT.each_line.to_a
|
116
338
|
//title: Test Data
|
data/test/test_utils.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require 'pseudohikiparser'
|
5
|
+
require 'pseudohiki/utils'
|
6
|
+
|
7
|
+
class TC_NodeCollector < MiniTest::Unit::TestCase
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@input_text = <<TEXT
|
11
|
+
!Title
|
12
|
+
|
13
|
+
!![heading1]Heading1
|
14
|
+
|
15
|
+
paragaraph
|
16
|
+
|
17
|
+
!!Heading2
|
18
|
+
|
19
|
+
paragragh
|
20
|
+
|
21
|
+
!![heading3]Heading3
|
22
|
+
|
23
|
+
paragraph
|
24
|
+
TEXT
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_nodecollector
|
28
|
+
tree = PseudoHiki::BlockParser.parse(@input_text)
|
29
|
+
nodes = PseudoHiki::Utils::NodeCollector.select(tree) do |node|
|
30
|
+
node.kind_of?(PseudoHiki::BlockParser::HeadingLeaf) and
|
31
|
+
node.nominal_level == 2 and
|
32
|
+
node.node_id
|
33
|
+
end
|
34
|
+
|
35
|
+
selected_headings = [[["Heading1\n"]],
|
36
|
+
[["Heading3\n"]]]
|
37
|
+
|
38
|
+
assert_equal(selected_headings, nodes)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
metadata
CHANGED
@@ -1,118 +1,148 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pseudohikiparser
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: -1684086064
|
5
|
+
prerelease: true
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
- 13
|
11
|
+
- develop
|
12
|
+
version: 0.0.0.13.develop
|
5
13
|
platform: ruby
|
6
|
-
authors:
|
14
|
+
authors:
|
7
15
|
- HASHIMOTO, Naoki
|
8
16
|
autorequire:
|
9
17
|
bindir: bin
|
10
18
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
19
|
+
|
20
|
+
date: 2014-12-25 00:00:00 +09:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
14
24
|
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.3'
|
20
|
-
type: :development
|
21
25
|
prerelease: false
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ~>
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 9
|
32
|
+
segments:
|
33
|
+
- 1
|
34
|
+
- 3
|
35
|
+
version: "1.3"
|
34
36
|
type: :development
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rake
|
35
40
|
prerelease: false
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: minitest
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
45
44
|
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 3
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
version: "0"
|
48
50
|
type: :development
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: minitest
|
49
54
|
prerelease: false
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 25
|
61
|
+
segments:
|
62
|
+
- 1
|
63
|
+
- 3
|
64
|
+
- 1
|
65
|
+
version: 1.3.1
|
66
|
+
type: :development
|
67
|
+
version_requirements: *id003
|
68
|
+
description: PseudoHikiParser is a parser of texts written in a Hiki like notation, and coverts them into HTML or other formats.
|
69
|
+
email:
|
58
70
|
- hashimoto.naoki@gmail.com
|
59
|
-
executables:
|
71
|
+
executables:
|
60
72
|
- pseudohiki2html.rb
|
61
73
|
extensions: []
|
74
|
+
|
62
75
|
extra_rdoc_files: []
|
63
|
-
|
64
|
-
|
76
|
+
|
77
|
+
files:
|
65
78
|
- README.md
|
66
|
-
-
|
67
|
-
- lib/
|
68
|
-
- lib/
|
79
|
+
- LICENSE
|
80
|
+
- lib/pseudohikiparser.rb
|
81
|
+
- lib/pseudohiki/treestack.rb
|
82
|
+
- lib/pseudohiki/inlineparser.rb
|
69
83
|
- lib/pseudohiki/blockparser.rb
|
70
|
-
- lib/pseudohiki/converter.rb
|
71
84
|
- lib/pseudohiki/htmlformat.rb
|
72
|
-
- lib/pseudohiki/htmlplugin.rb
|
73
|
-
- lib/pseudohiki/inlineparser.rb
|
74
|
-
- lib/pseudohiki/markdownformat.rb
|
75
85
|
- lib/pseudohiki/plaintextformat.rb
|
86
|
+
- lib/pseudohiki/markdownformat.rb
|
76
87
|
- lib/pseudohiki/sinatra_helpers.rb
|
77
|
-
- lib/pseudohiki/treestack.rb
|
78
88
|
- lib/pseudohiki/version.rb
|
79
|
-
- lib/
|
89
|
+
- lib/pseudohiki/converter.rb
|
90
|
+
- lib/pseudohiki/htmlplugin.rb
|
91
|
+
- lib/htmlelement.rb
|
92
|
+
- lib/htmlelement/htmltemplate.rb
|
93
|
+
- test/test_htmltemplate.rb
|
94
|
+
- test/test_pseudohikiparser.rb
|
80
95
|
- test/test_blockparser.rb
|
96
|
+
- test/test_pseudohiki2html.rb
|
97
|
+
- test/test_plaintextformat.rb
|
81
98
|
- test/test_htmlelement.rb
|
82
|
-
- test/
|
83
|
-
- test/test_htmlplugin.rb
|
84
|
-
- test/test_htmltemplate.rb
|
99
|
+
- test/test_treestack.rb
|
85
100
|
- test/test_inlineparser.rb
|
86
101
|
- test/test_markdownformat.rb
|
87
|
-
- test/
|
88
|
-
- test/
|
89
|
-
- test/
|
90
|
-
- test/
|
102
|
+
- test/test_htmlformat.rb
|
103
|
+
- test/test_htmlplugin.rb
|
104
|
+
- test/test_utils.rb
|
105
|
+
- test/test_latexformat.rb
|
106
|
+
- bin/pseudohiki2html.rb
|
107
|
+
has_rdoc: true
|
91
108
|
homepage: https://github.com/nico-hn/PseudoHikiParser/wiki
|
92
|
-
licenses:
|
109
|
+
licenses:
|
93
110
|
- BSD 2-Clause license
|
94
|
-
metadata: {}
|
95
111
|
post_install_message:
|
96
112
|
rdoc_options: []
|
97
|
-
|
113
|
+
|
114
|
+
require_paths:
|
98
115
|
- lib
|
99
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
-
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
101
119
|
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 57
|
122
|
+
segments:
|
123
|
+
- 1
|
124
|
+
- 8
|
125
|
+
- 7
|
103
126
|
version: 1.8.7
|
104
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
-
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
106
130
|
- - ">"
|
107
|
-
- !ruby/object:Gem::Version
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
hash: 25
|
133
|
+
segments:
|
134
|
+
- 1
|
135
|
+
- 3
|
136
|
+
- 1
|
108
137
|
version: 1.3.1
|
109
138
|
requirements: []
|
139
|
+
|
110
140
|
rubyforge_project:
|
111
|
-
rubygems_version:
|
141
|
+
rubygems_version: 1.3.7
|
112
142
|
signing_key:
|
113
|
-
specification_version:
|
114
|
-
summary:
|
115
|
-
test_files:
|
143
|
+
specification_version: 3
|
144
|
+
summary: "PseudoHikiParser: a parser of texts in a Hiki like notation."
|
145
|
+
test_files:
|
116
146
|
- test/test_htmltemplate.rb
|
117
147
|
- test/test_pseudohikiparser.rb
|
118
148
|
- test/test_blockparser.rb
|
@@ -124,3 +154,5 @@ test_files:
|
|
124
154
|
- test/test_markdownformat.rb
|
125
155
|
- test/test_htmlformat.rb
|
126
156
|
- test/test_htmlplugin.rb
|
157
|
+
- test/test_utils.rb
|
158
|
+
- test/test_latexformat.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: ab6d03f5f2b3131e62af81faa6540355f115b489
|
4
|
-
data.tar.gz: d95e43ed55af9b8b0ecb6868b7075315e1a8e5e2
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 66e3bec04f94faa3cbbd21b6e945ad46e23e58d1ffd8b0e36cb1c400e4caee43a4e9ce55e0fdfd70bf5ce6b65a5bf877f979882ae6190f348db5cbdef7cea392
|
7
|
-
data.tar.gz: 7a0be29c24383e9ff375404413df96ca209d7c885dc13eec566828c84ad19dd7cbd9a6029e7cbb0cadaa280aa5746dad8c5bf34e0fc5620db99a2bf962c3d1ac
|