hemingway 0.0.0 → 0.0.2

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.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +297 -0
  7. data/Rakefile +1 -0
  8. data/hemingway.gemspec +23 -0
  9. data/lib/hemingway/block/block.rb +378 -0
  10. data/lib/hemingway/block/block.treetop +36 -0
  11. data/lib/hemingway/block/block_nodes.rb +9 -0
  12. data/lib/hemingway/block/list/list.rb +412 -0
  13. data/lib/hemingway/block/list/list.treetop +51 -0
  14. data/lib/hemingway/block/list/list_nodes.rb +39 -0
  15. data/lib/hemingway/block/quote/quote.rb +192 -0
  16. data/lib/hemingway/block/quote/quote.treetop +27 -0
  17. data/lib/hemingway/block/quote/quote_nodes.rb +25 -0
  18. data/lib/hemingway/block/verbatim/verbatim.rb +159 -0
  19. data/lib/hemingway/block/verbatim/verbatim.treetop +21 -0
  20. data/lib/hemingway/block/verbatim/verbatim_nodes.rb +9 -0
  21. data/lib/hemingway/build.rb +65 -0
  22. data/lib/hemingway/footnote/footnote.rb +83 -0
  23. data/lib/hemingway/footnote/footnote.treetop +11 -0
  24. data/lib/hemingway/footnote/footnote_nodes.rb +21 -0
  25. data/lib/hemingway/latex.rb +409 -0
  26. data/lib/hemingway/latex.treetop +81 -0
  27. data/lib/hemingway/latex_nodes.rb +45 -0
  28. data/lib/hemingway/math/math.rb +135 -0
  29. data/lib/hemingway/math/math.treetop +29 -0
  30. data/lib/hemingway/math/math_nodes.rb +7 -0
  31. data/lib/hemingway/special/special.rb +164 -0
  32. data/lib/hemingway/special/special.treetop +17 -0
  33. data/lib/hemingway/special/special_nodes.rb +7 -0
  34. data/lib/hemingway/symbol/symbol.rb +460 -0
  35. data/lib/hemingway/symbol/symbol.treetop +47 -0
  36. data/lib/hemingway/symbol/symbol_nodes.rb +7 -0
  37. data/lib/hemingway/tag/tag.rb +538 -0
  38. data/lib/hemingway/tag/tag.treetop +63 -0
  39. data/lib/hemingway/tag/tag_nodes.rb +49 -0
  40. data/lib/hemingway/text/text.rb +121 -0
  41. data/lib/hemingway/text/text.treetop +35 -0
  42. data/lib/hemingway/text/text_nodes.rb +7 -0
  43. data/lib/hemingway/version.rb +3 -0
  44. data/lib/hemingway.rb +7 -0
  45. data/script/build +22 -0
  46. data/script/test +2 -0
  47. data/spec/build_spec.rb +65 -0
  48. data/spec/nodes/block/list_spec.rb +91 -0
  49. data/spec/nodes/block/quote_spec.rb +31 -0
  50. data/spec/nodes/block/verbatim_spec.rb +27 -0
  51. data/spec/nodes/block_spec.rb +21 -0
  52. data/spec/nodes/footnote_spec.rb +42 -0
  53. data/spec/nodes/math_spec.rb +31 -0
  54. data/spec/nodes/special_spec.rb +27 -0
  55. data/spec/nodes/tag_spec.rb +98 -0
  56. data/spec/parser_spec.rb +48 -0
  57. data/spec/spec_helper.rb +5 -0
  58. metadata +110 -18
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ module Hemingway
4
+
5
+ describe Parser do
6
+
7
+ before do
8
+ @parser = Parser.new
9
+ end
10
+
11
+ describe "#basics" do
12
+
13
+ it 'should create a paragraph inside a entry div' do
14
+ html = @parser.parse("hello").html
15
+ html.should == "<div class='entry'><p>hello</p></div>"
16
+ end
17
+
18
+ it 'should allow me to newline the hell out of a file (\n invariant)' do
19
+ html = @parser.parse("\\emph{hey}\n\n\n\n\n\n").html
20
+ html.should == "<div class='entry'><p><em>hey</em></p></div>"
21
+ end
22
+
23
+ it 'should create a new paragraph when two newlines are encountered' do
24
+ html = @parser.parse("para 1\n\npara 2").html
25
+ html.should == "<div class='entry'><p>para 1</p><p>para 2</p></div>"
26
+ end
27
+
28
+ it 'should create a new paragraph when more than two newlines are encountered' do
29
+ html = @parser.parse("para 1\n\n\n\n\n\n\npara 2").html
30
+ html.should == "<div class='entry'><p>para 1</p><p>para 2</p></div>"
31
+ end
32
+
33
+ it 'should create an empty div with the empty string' do
34
+ html = @parser.parse("").html
35
+ html.should == "<div class='entry'></div>"
36
+ end
37
+
38
+ it 'should be cool with an empty tag' do
39
+ html = @parser.parse("\\emph{}").html
40
+ html.should == "<div class='entry'><p><em></em></p></div>"
41
+ end
42
+
43
+ end
44
+
45
+
46
+ end
47
+
48
+ end
@@ -0,0 +1,5 @@
1
+ require 'hemingway'
2
+
3
+ RSpec.configure do |config|
4
+ # some (optional) config here
5
+ end
metadata CHANGED
@@ -1,47 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hemingway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - William Myers
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-09 00:00:00.000000000 Z
13
- dependencies: []
14
- description: Hemingway is an extremely simple LaTeX to HTML parser. It takes a rigidly
15
- defined subset of TeX commands and produces equivalent markup that can then be styled
16
- at the user's whim
17
- email: griffin.myers@gmail.com
11
+ date: 2013-03-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: treetop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A LaTeX to HTML parser.
42
+ email:
43
+ - griffin.myers@gmail.com
18
44
  executables: []
19
45
  extensions: []
20
46
  extra_rdoc_files: []
21
47
  files:
48
+ - .gitignore
49
+ - .travis.yml
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - hemingway.gemspec
22
55
  - lib/hemingway.rb
23
- homepage: http://rubygems.org/gems/hemingway
24
- licenses: []
56
+ - lib/hemingway/block/block.rb
57
+ - lib/hemingway/block/block.treetop
58
+ - lib/hemingway/block/block_nodes.rb
59
+ - lib/hemingway/block/list/list.rb
60
+ - lib/hemingway/block/list/list.treetop
61
+ - lib/hemingway/block/list/list_nodes.rb
62
+ - lib/hemingway/block/quote/quote.rb
63
+ - lib/hemingway/block/quote/quote.treetop
64
+ - lib/hemingway/block/quote/quote_nodes.rb
65
+ - lib/hemingway/block/verbatim/verbatim.rb
66
+ - lib/hemingway/block/verbatim/verbatim.treetop
67
+ - lib/hemingway/block/verbatim/verbatim_nodes.rb
68
+ - lib/hemingway/build.rb
69
+ - lib/hemingway/footnote/footnote.rb
70
+ - lib/hemingway/footnote/footnote.treetop
71
+ - lib/hemingway/footnote/footnote_nodes.rb
72
+ - lib/hemingway/latex.rb
73
+ - lib/hemingway/latex.treetop
74
+ - lib/hemingway/latex_nodes.rb
75
+ - lib/hemingway/math/math.rb
76
+ - lib/hemingway/math/math.treetop
77
+ - lib/hemingway/math/math_nodes.rb
78
+ - lib/hemingway/special/special.rb
79
+ - lib/hemingway/special/special.treetop
80
+ - lib/hemingway/special/special_nodes.rb
81
+ - lib/hemingway/symbol/symbol.rb
82
+ - lib/hemingway/symbol/symbol.treetop
83
+ - lib/hemingway/symbol/symbol_nodes.rb
84
+ - lib/hemingway/tag/tag.rb
85
+ - lib/hemingway/tag/tag.treetop
86
+ - lib/hemingway/tag/tag_nodes.rb
87
+ - lib/hemingway/text/text.rb
88
+ - lib/hemingway/text/text.treetop
89
+ - lib/hemingway/text/text_nodes.rb
90
+ - lib/hemingway/version.rb
91
+ - script/build
92
+ - script/test
93
+ - spec/build_spec.rb
94
+ - spec/nodes/block/list_spec.rb
95
+ - spec/nodes/block/quote_spec.rb
96
+ - spec/nodes/block/verbatim_spec.rb
97
+ - spec/nodes/block_spec.rb
98
+ - spec/nodes/footnote_spec.rb
99
+ - spec/nodes/math_spec.rb
100
+ - spec/nodes/special_spec.rb
101
+ - spec/nodes/tag_spec.rb
102
+ - spec/parser_spec.rb
103
+ - spec/spec_helper.rb
104
+ homepage: https://rubygems.org/gems/hemingway
105
+ licenses:
106
+ - MIT
107
+ metadata: {}
25
108
  post_install_message:
26
109
  rdoc_options: []
27
110
  require_paths:
28
111
  - lib
29
112
  required_ruby_version: !ruby/object:Gem::Requirement
30
- none: false
31
113
  requirements:
32
- - - ! '>='
114
+ - - '>='
33
115
  - !ruby/object:Gem::Version
34
116
  version: '0'
35
117
  required_rubygems_version: !ruby/object:Gem::Requirement
36
- none: false
37
118
  requirements:
38
- - - ! '>='
119
+ - - '>='
39
120
  - !ruby/object:Gem::Version
40
121
  version: '0'
41
122
  requirements: []
42
123
  rubyforge_project:
43
- rubygems_version: 1.8.24
124
+ rubygems_version: 2.0.0
44
125
  signing_key:
45
- specification_version: 3
46
- summary: Hemingway translates a subset of LaTeX commands into HTML markup.
47
- test_files: []
126
+ specification_version: 4
127
+ summary: Hemingway is a LaTeX to HTML parser.
128
+ test_files:
129
+ - spec/build_spec.rb
130
+ - spec/nodes/block/list_spec.rb
131
+ - spec/nodes/block/quote_spec.rb
132
+ - spec/nodes/block/verbatim_spec.rb
133
+ - spec/nodes/block_spec.rb
134
+ - spec/nodes/footnote_spec.rb
135
+ - spec/nodes/math_spec.rb
136
+ - spec/nodes/special_spec.rb
137
+ - spec/nodes/tag_spec.rb
138
+ - spec/parser_spec.rb
139
+ - spec/spec_helper.rb