wikiwah 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wikiwah/flow.rb +28 -9
- data/lib/wikiwah/version.rb +1 -1
- data/test/wikiwah/flow_tests.rb +2 -2
- metadata +3 -3
data/lib/wikiwah/flow.rb
CHANGED
@@ -89,36 +89,54 @@ module WikiWah
|
|
89
89
|
# Add a block
|
90
90
|
def add_block(block)
|
91
91
|
case block
|
92
|
-
|
92
|
+
|
93
|
+
# unordered list item
|
94
|
+
when /\A( *)- /
|
93
95
|
push_context('ul',$1.size)
|
94
96
|
write_tag($', 'li')
|
95
|
-
|
97
|
+
|
98
|
+
# unordered list item
|
99
|
+
when /\A( *)\* /
|
96
100
|
push_context('ul class="sparse"',$1.size)
|
97
101
|
write_tag($', 'li')
|
98
|
-
|
102
|
+
|
103
|
+
# ordered list item
|
104
|
+
when /\A( *)(\#|\d+\.|\(\d+\)) /
|
99
105
|
push_context('ol',$1.size)
|
100
106
|
write_tag($', 'li')
|
101
|
-
|
107
|
+
|
108
|
+
# unordered list item
|
109
|
+
when /\A( *)% /
|
102
110
|
push_context('dl',$1.size)
|
103
111
|
write_tag($', 'dt')
|
104
|
-
|
112
|
+
|
113
|
+
# citation
|
114
|
+
when /\A(( *)> )/
|
105
115
|
push_context('blockquote',$2.size)
|
106
116
|
block = strip_prefix($1, block)
|
107
117
|
write_text(block)
|
108
|
-
|
118
|
+
|
119
|
+
# preformatted
|
120
|
+
when /\A(( *)\| )/
|
109
121
|
push_context('pre',$2.size)
|
110
122
|
block = strip_prefix($1, block)
|
111
123
|
write_html("<code>" + CGI.escapeHTML(block) + "</code>")
|
112
|
-
|
124
|
+
|
125
|
+
# preformatted (with language)
|
126
|
+
when /\A( *)\,-- (\S+).*\n/
|
113
127
|
indent = $1
|
114
128
|
lang = $2
|
115
129
|
push_context('pre',indent.size)
|
116
130
|
block = strip_prefix(indent + "| ", $')
|
117
131
|
write_html(%(<code class="#{lang}">) + CGI.escapeHTML(block) + "</code>")
|
118
|
-
|
132
|
+
|
133
|
+
# heading
|
134
|
+
when /\A( *)(=+) /
|
119
135
|
flush_context_stack
|
120
136
|
write_tag($', "h#{$2.size}")
|
121
|
-
|
137
|
+
|
138
|
+
# body text
|
139
|
+
when /\A( *)/
|
122
140
|
tag = \
|
123
141
|
if $1 == ""
|
124
142
|
'p'
|
@@ -130,6 +148,7 @@ module WikiWah
|
|
130
148
|
push_context(tag,$1.size,true)
|
131
149
|
block = strip_prefix($1, block)
|
132
150
|
write_text(block)
|
151
|
+
|
133
152
|
end
|
134
153
|
end
|
135
154
|
|
data/lib/wikiwah/version.rb
CHANGED
data/test/wikiwah/flow_tests.rb
CHANGED
@@ -175,13 +175,13 @@ more code
|
|
175
175
|
</code></pre>
|
176
176
|
|
177
177
|
==== # Code with language specified
|
178
|
-
,--
|
178
|
+
,-- fnord-script --
|
179
179
|
| code
|
180
180
|
|
|
181
181
|
| more code
|
182
182
|
----
|
183
183
|
<pre>
|
184
|
-
<code class="
|
184
|
+
<code class="fnord-script">code
|
185
185
|
|
186
186
|
more code
|
187
187
|
</code></pre>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wikiwah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -51,7 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
segments:
|
53
53
|
- 0
|
54
|
-
hash:
|
54
|
+
hash: -4597256986172157690
|
55
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
60
|
version: '0'
|
61
61
|
segments:
|
62
62
|
- 0
|
63
|
-
hash:
|
63
|
+
hash: -4597256986172157690
|
64
64
|
requirements: []
|
65
65
|
rubyforge_project:
|
66
66
|
rubygems_version: 1.8.23
|