hierogloss 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,72 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ class TestKramdownExtensions < Minitest::Test
4
+ def assert_bbcode(bbcode, text)
5
+ actual = Kramdown::Document.new(text, input: 'hierogloss').to_bbcode
6
+ assert_equal(bbcode, actual)
7
+ end
8
+
9
+ def assert_htlal_bbcode(bbcode, text)
10
+ actual = Kramdown::Document.new(text, input: 'hierogloss').to_htlal
11
+ assert_equal(bbcode, actual)
12
+ end
13
+
14
+ def test_should_process_paragraphs
15
+ assert_bbcode("Hello", "Hello")
16
+ assert_bbcode("Hello\n\nThere", "Hello\n\nThere")
17
+ end
18
+
19
+ def test_should_process_headers
20
+ assert_bbcode("[b]Hello[/b]", "# Hello")
21
+ end
22
+
23
+ def test_should_process_blockquotes
24
+ assert_bbcode("[quote]Hello there[/quote]", "> Hello\n> there")
25
+ end
26
+
27
+ def test_should_process_codeblocks
28
+ assert_bbcode("[code]Hello\nthere[/code]", " Hello\n there")
29
+ end
30
+
31
+ def test_should_process_image
32
+ assert_bbcode("[img]http://example.com/f.png[/img]",
33
+ "![](http://example.com/f.png)")
34
+ end
35
+
36
+ def test_should_process_styling_tags
37
+ assert_bbcode("[i]Hello[/i]", "_Hello_")
38
+ assert_bbcode("[b]Hello[/b]", "**Hello**")
39
+ end
40
+
41
+ def test_should_process_links
42
+ assert_bbcode("[url=http://example.com]here[/url]",
43
+ "[here](http://example.com)")
44
+ end
45
+
46
+ def test_should_process_smart_quotes
47
+ assert_bbcode("A “foo” ", "A \"foo\" ")
48
+ end
49
+
50
+ def test_should_handle_inline_transliteration
51
+ assert_bbcode("[i]mꜣꜥ ḫrw[/i]", "{mAa xrw}")
52
+ end
53
+
54
+ def test_should_handle_gloss_blocks
55
+ gloss = <<EOD
56
+ H: 𓇋𓀀 | 𓁐
57
+ G: homme | femme
58
+ EOD
59
+ table = <<EOD.sub(/\n$/, '')
60
+ [table]
61
+ [tr][td][size=24]𓇋[url=http://www.hierogl.ch/hiero/Sp%C3%A9cial:Recherche?search=Signe%3AA1&go=Lire]𓀀[/url][/size][/td][td][size=24][url=http://www.hierogl.ch/hiero/Sp%C3%A9cial:Recherche?search=Signe%3AB1&go=Lire]𓁐[/url][/size][/td][/tr]
62
+ [tr][td]homme[/td][td]femme[/td][/tr]
63
+ [/table]
64
+ EOD
65
+ assert_bbcode(table, gloss)
66
+ without_table = <<EOD.sub(/\n$/, '')
67
+ 𓇋[url=http://www.hierogl.ch/hiero/Sp%C3%A9cial:Recherche?search=Signe%3AA1&go=Lire]𓀀[/url] | [url=http://www.hierogl.ch/hiero/Sp%C3%A9cial:Recherche?search=Signe%3AB1&go=Lire]𓁐[/url]
68
+ homme | femme
69
+ EOD
70
+ assert_htlal_bbcode(without_table, gloss)
71
+ end
72
+ end
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hierogloss
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Eric Kidd
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-20 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: '1.3'
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'
27
+ - !ruby/object:Gem::Dependency
28
+ name: prawn
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.14.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 0.14.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Extends the Markdown parser Kramdown to support hieroglyphs, inline multi-column
84
+ glosses, and output to BBCode for use on forums. Includes an executable for processing
85
+ files and a webfont version of the Gardiner signs.
86
+ email:
87
+ - git@randomhacks.net
88
+ executables:
89
+ - hierogloss
90
+ extensions: []
91
+ extra_rdoc_files: []
92
+ files:
93
+ - .gitignore
94
+ - .travis.yml
95
+ - GARDINER-LICENSE.txt
96
+ - Gemfile
97
+ - KRAMDOWN-LICENSE.txt
98
+ - LICENSE.txt
99
+ - README.md
100
+ - Rakefile
101
+ - UNICODE-DATA-LICENSE.txt
102
+ - UNLICENSE.txt
103
+ - assets/fonts/Gardiner.eot
104
+ - assets/fonts/Gardiner.otf
105
+ - assets/fonts/Gardiner.svg
106
+ - assets/fonts/Gardiner.ttf
107
+ - assets/fonts/Gardiner.woff
108
+ - bin/hierogloss
109
+ - data/Unicode-MdC-Mapping-v1.utf8
110
+ - data/hierogloss.html.erb
111
+ - examples/disjunction.md
112
+ - examples/disjunction.png
113
+ - examples/liverpool.md
114
+ - hierogloss.gemspec
115
+ - lib/hierogloss.rb
116
+ - lib/hierogloss/dictionary.rb
117
+ - lib/hierogloss/gloss.rb
118
+ - lib/hierogloss/version.rb
119
+ - lib/kramdown/converter/bbcode.rb
120
+ - lib/kramdown/converter/htlal.rb
121
+ - lib/kramdown/parser/hierogloss.rb
122
+ - src/Gardiner.ttf
123
+ - test/minitest_helper.rb
124
+ - test/test_dictionary.rb
125
+ - test/test_gloss.rb
126
+ - test/test_hierogloss.rb
127
+ - test/test_kramdown_extensions.rb
128
+ homepage: https://github.com/emk/hierogloss
129
+ licenses:
130
+ - Public domain + other open source licenses
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 2.1.11
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Markdown extensions for hieroglyphic glosses and BBCode
152
+ test_files:
153
+ - test/minitest_helper.rb
154
+ - test/test_dictionary.rb
155
+ - test/test_gloss.rb
156
+ - test/test_hierogloss.rb
157
+ - test/test_kramdown_extensions.rb