pseudohikiparser 0.0.0.13.develop → 0.0.0.14.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 687d3c71781413308c05437bee7de9ca5ade7370
4
+ data.tar.gz: 3a8e171f56796ba47882fefccb04ec78e8ba1499
5
+ SHA512:
6
+ metadata.gz: 3d3935e24ba70e03f0e12cd60360e4b01e210e101ac8bcecc6e044003322b77c25eef6bdba9ed083e45c0a816e09faf73541f358521b1b2c96345ca543b1d057
7
+ data.tar.gz: 1d2fd247886b2c24594db8f5df51620242b661d97966bdb1ea5012cc04482f2168f2c6b8ce5503927c24a2fea3b31520cbf54b7ba3986391f0187b8e04a5df68
@@ -326,29 +326,31 @@ module PseudoHiki
326
326
 
327
327
  def self.assign_head_re
328
328
  irregular_leafs = [BlockNodeEnd, VerbatimLeaf, HrLeaf]
329
- head_pats, leaf_types = [], [:entire_matched_part]
329
+ irregular_head_pats, regular_leaf_types, head_to_leaf = [], [], {}
330
330
  [['\r?\n?$', BlockNodeEnd],
331
- ['//@', DecoratorLeaf],
332
- [':', DescLeaf],
333
331
  ['\s', VerbatimLeaf],
332
+ ['*', ListLeaf],
333
+ ['#', EnumLeaf],
334
+ [':', DescLeaf],
335
+ ['!', HeadingLeaf],
334
336
  ['""', QuoteLeaf],
335
337
  ['||', TableLeaf],
338
+ ['//@', DecoratorLeaf],
336
339
  ['//', CommentOutLeaf],
337
- ['!', HeadingLeaf],
338
- ['*', ListLeaf],
339
- ['#', EnumLeaf],
340
340
  ['----\s*$', HrLeaf]
341
341
  ].each do |head, leaf|
342
342
  escaped_head = irregular_leafs.include?(leaf) ? head : Regexp.escape(head)
343
343
  head_pat = leaf.with_depth? ? "#{escaped_head}+" : "#{escaped_head}"
344
344
  leaf.head_re = Regexp.new('\\A'+head_pat)
345
- head_pats.push "(#{escaped_head})"
346
- leaf_types.push leaf
345
+ head_to_leaf[head] = leaf
346
+ irregular_head_pats.push "(#{escaped_head})" if irregular_leafs.include?(leaf)
347
+ regular_leaf_types.push head unless irregular_leafs.include?(leaf)
347
348
  end
348
- return Regexp.new('\\A(?:'+head_pats.join('|')+')'), leaf_types, leaf_types.length - 1
349
+ irregular_leaf_types = [:entire_matched_part].concat(irregular_leafs)
350
+ return Regexp.new('\\A(?:'+irregular_head_pats.join('|')+')'), regular_leaf_types, head_to_leaf, irregular_leaf_types, irregular_leafs.length
349
351
  end
350
352
 
351
- LEAF_HEAD_PAT, NOT_PARAGRAPH_LEAF_TYPES, NUMBER_OF_NOT_PARAGRAPH_LEAF_TYPES = assign_head_re
353
+ IRREGULAR_HEAD_PAT, REGULAR_LEAF_TYPES, HEAD_TO_LEAF, IRREGULAR_LEAF_TYPES, NUMBER_OF_IRREGULAR_LEAF_TYPES = assign_head_re
352
354
 
353
355
  def initialize
354
356
  root_node = BlockNode.new
@@ -363,9 +365,10 @@ module PseudoHiki
363
365
  end
364
366
 
365
367
  def select_leaf_type(line)
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] }
368
+ matched = IRREGULAR_HEAD_PAT.match(line)
369
+ 1.upto(NUMBER_OF_IRREGULAR_LEAF_TYPES) {|i| return IRREGULAR_LEAF_TYPES[i] if matched[i] } if matched
370
+ REGULAR_LEAF_TYPES.each {|head| return HEAD_TO_LEAF[head] if line.start_with?(head) }
371
+ ParagraphLeaf
369
372
  end
370
373
 
371
374
  def read_lines(lines)
@@ -1,3 +1,3 @@
1
1
  module PseudoHiki
2
- VERSION = "0.0.0.13.develop"
2
+ VERSION = "0.0.0.14.develop"
3
3
  end
metadata CHANGED
@@ -1,148 +1,120 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pseudohikiparser
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
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0.14.develop
13
5
  platform: ruby
14
- authors:
6
+ authors:
15
7
  - HASHIMOTO, Naoki
16
8
  autorequire:
17
9
  bindir: bin
18
10
  cert_chain: []
19
-
20
- date: 2014-12-25 00:00:00 +09:00
21
- default_executable:
22
- dependencies:
23
- - !ruby/object:Gem::Dependency
11
+ date: 2014-12-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
24
14
  name: bundler
25
- prerelease: false
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"
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
36
20
  type: :development
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: rake
40
21
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
44
31
  - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 3
47
- segments:
48
- - 0
49
- version: "0"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
50
34
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: minitest
54
35
  prerelease: false
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
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
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:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
65
47
  version: 1.3.1
66
48
  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:
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.1
55
+ description: PseudoHikiParser is a parser of texts written in a Hiki like notation,
56
+ and coverts them into HTML or other formats.
57
+ email:
70
58
  - hashimoto.naoki@gmail.com
71
- executables:
59
+ executables:
72
60
  - pseudohiki2html.rb
73
61
  extensions: []
74
-
75
62
  extra_rdoc_files: []
76
-
77
- files:
78
- - README.md
63
+ files:
79
64
  - LICENSE
80
- - lib/pseudohikiparser.rb
81
- - lib/pseudohiki/treestack.rb
82
- - lib/pseudohiki/inlineparser.rb
65
+ - README.md
66
+ - bin/pseudohiki2html.rb
67
+ - lib/htmlelement.rb
68
+ - lib/htmlelement/htmltemplate.rb
83
69
  - lib/pseudohiki/blockparser.rb
70
+ - lib/pseudohiki/converter.rb
84
71
  - lib/pseudohiki/htmlformat.rb
85
- - lib/pseudohiki/plaintextformat.rb
72
+ - lib/pseudohiki/htmlplugin.rb
73
+ - lib/pseudohiki/inlineparser.rb
86
74
  - lib/pseudohiki/markdownformat.rb
75
+ - lib/pseudohiki/plaintextformat.rb
87
76
  - lib/pseudohiki/sinatra_helpers.rb
77
+ - lib/pseudohiki/treestack.rb
88
78
  - lib/pseudohiki/version.rb
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
79
+ - lib/pseudohikiparser.rb
95
80
  - test/test_blockparser.rb
96
- - test/test_pseudohiki2html.rb
97
- - test/test_plaintextformat.rb
98
81
  - test/test_htmlelement.rb
99
- - test/test_treestack.rb
100
- - test/test_inlineparser.rb
101
- - test/test_markdownformat.rb
102
82
  - test/test_htmlformat.rb
103
83
  - test/test_htmlplugin.rb
104
- - test/test_utils.rb
84
+ - test/test_htmltemplate.rb
85
+ - test/test_inlineparser.rb
105
86
  - test/test_latexformat.rb
106
- - bin/pseudohiki2html.rb
107
- has_rdoc: true
87
+ - test/test_markdownformat.rb
88
+ - test/test_plaintextformat.rb
89
+ - test/test_pseudohiki2html.rb
90
+ - test/test_pseudohikiparser.rb
91
+ - test/test_treestack.rb
92
+ - test/test_utils.rb
108
93
  homepage: https://github.com/nico-hn/PseudoHikiParser/wiki
109
- licenses:
94
+ licenses:
110
95
  - BSD 2-Clause license
96
+ metadata: {}
111
97
  post_install_message:
112
98
  rdoc_options: []
113
-
114
- require_paths:
99
+ require_paths:
115
100
  - lib
116
- required_ruby_version: !ruby/object:Gem::Requirement
117
- none: false
118
- requirements:
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
119
103
  - - ">="
120
- - !ruby/object:Gem::Version
121
- hash: 57
122
- segments:
123
- - 1
124
- - 8
125
- - 7
104
+ - !ruby/object:Gem::Version
126
105
  version: 1.8.7
127
- required_rubygems_version: !ruby/object:Gem::Requirement
128
- none: false
129
- requirements:
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
130
108
  - - ">"
131
- - !ruby/object:Gem::Version
132
- hash: 25
133
- segments:
134
- - 1
135
- - 3
136
- - 1
109
+ - !ruby/object:Gem::Version
137
110
  version: 1.3.1
138
111
  requirements: []
139
-
140
112
  rubyforge_project:
141
- rubygems_version: 1.3.7
113
+ rubygems_version: 2.2.2
142
114
  signing_key:
143
- specification_version: 3
144
- summary: "PseudoHikiParser: a parser of texts in a Hiki like notation."
145
- test_files:
115
+ specification_version: 4
116
+ summary: 'PseudoHikiParser: a parser of texts in a Hiki like notation.'
117
+ test_files:
146
118
  - test/test_htmltemplate.rb
147
119
  - test/test_pseudohikiparser.rb
148
120
  - test/test_blockparser.rb