wikiwah 0.0.3 → 0.1.0

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,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MWM1ZGQ5ZjhjZThhY2EzNWE0NWJmZWI5Zjg1ZTU5ZTYyYmFhMzY0Yg==
5
+ data.tar.gz: !binary |-
6
+ NTliYTFkMGFkOTg3NjMzZjc2MWQ0Y2UzNzM0ZjY5YTFiMzU2YWVmMg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NDA0MjFjNmNiODFkMjA0MTgzMzJhMWVjZmViZDE0YzRhMWI1YjM2NjM0YjBj
10
+ N2FlNDljZTUwZjc2NTE1NGUzZDFiOGE1ODkwYzUwYTljNjE3M2U4MGRhM2Y3
11
+ MzU3NDA2ZjI5Zjg2NWQyNTE2MWIyZTY2N2Y1MzA4NjVmMzlkODg=
12
+ data.tar.gz: !binary |-
13
+ OGVlYzY0OTYzNDAyNWRhNjk5ODI4MzIxZWNkY2I0Zjc3MGE4ODBjODEwZjdl
14
+ ZjJkYTg1NmVjNmVlNjM3OTJmOGI5OGM1MDEzNWQ3MzRjZWExODgwNzhlMmU2
15
+ NTAxOTEzZGUzMjc2NDczYWIyNDM5ZmZkMmQ5NDNjZDk4MWIwOWQ=
data/lib/wikiwah/flow.rb CHANGED
@@ -28,7 +28,7 @@ module WikiWah
28
28
  #
29
29
  class Flow
30
30
 
31
- # Convert +input+ text to HTML.
31
+ # Convert +input+ text to HTML.
32
32
  #
33
33
  # An optional +filter+ block may be provided, in which case it's
34
34
  # applied to the body of each block.
@@ -38,18 +38,18 @@ module WikiWah
38
38
  parser.process(input)
39
39
  buff
40
40
  end
41
-
41
+
42
42
  # Patterns that start a new block
43
43
  BlankRegexp = /\A *$/
44
44
  BulletRegexp = Regexp.new('\A *([\*\-\#]|\d+\.|\(\d+\)) ')
45
-
45
+
46
46
  def initialize(out, text_filter=null)
47
47
  @out = out
48
48
  @text_filter = text_filter
49
49
  @context_stack = [TopContext]
50
50
  @block_buffer = nil
51
51
  end
52
-
52
+
53
53
  # Process a multi-line input string
54
54
  def process(input)
55
55
  add_input(input)
@@ -57,22 +57,22 @@ module WikiWah
57
57
  end
58
58
 
59
59
  private
60
-
60
+
61
61
  # Process multi-line input
62
- def add_input(input)
62
+ def add_input(input)
63
63
  input.each_line do |line|
64
64
  if (line =~ BlankRegexp)
65
65
  start_new_block
66
66
  else
67
67
  if (line =~ BulletRegexp)
68
- start_new_block
68
+ start_new_block
69
69
  end
70
70
  append_to_block(line)
71
71
  end
72
72
  end
73
73
  start_new_block
74
74
  end
75
-
75
+
76
76
  # Append a line to the block
77
77
  def append_to_block(line)
78
78
  @block_buffer = (@block_buffer || '') + line
@@ -80,7 +80,7 @@ module WikiWah
80
80
 
81
81
  # Flush the buffered block
82
82
  def start_new_block
83
- if (@block_buffer)
83
+ if (@block_buffer)
84
84
  add_block(@block_buffer)
85
85
  @block_buffer = nil
86
86
  end
@@ -108,7 +108,7 @@ module WikiWah
108
108
  when /\A(( *)\| )/ # preformatted (explicit)
109
109
  push_context('pre',$2.size)
110
110
  block = strip_prefix($1, block)
111
- write_html(CGI.escapeHTML(block))
111
+ write_html("<code>" + CGI.escapeHTML(block) + "</code>")
112
112
  when /\A( *)(=+) / # heading
113
113
  flush_context_stack
114
114
  write_tag($', "h#{$2.size}")
@@ -126,7 +126,7 @@ module WikiWah
126
126
  write_text(block)
127
127
  end
128
128
  end
129
-
129
+
130
130
  def strip_prefix(prefix, text)
131
131
  pattern = '^' + Regexp.quote(prefix)
132
132
  pattern.sub!(/\\ $/, '( |$)')
@@ -140,12 +140,12 @@ module WikiWah
140
140
  write_text(content)
141
141
  write_html("</#{tag}>\n")
142
142
  end
143
-
143
+
144
144
  # Write HTML markup
145
145
  def write_html(html)
146
146
  @out << html
147
147
  end
148
-
148
+
149
149
  # Write text content, performing any necessary substitutions
150
150
  def write_text(text)
151
151
  if (@text_filter)
@@ -153,10 +153,10 @@ module WikiWah
153
153
  end
154
154
  @out << text
155
155
  end
156
-
156
+
157
157
  Context = Struct.new('Context', :tag, :level)
158
158
  TopContext = Context.new(:top, -1)
159
-
159
+
160
160
  # Get the current Context
161
161
  def context
162
162
  @context_stack.last
@@ -191,7 +191,7 @@ module WikiWah
191
191
  cxt = @context_stack.pop
192
192
  write_html("</#{cxt.tag}>\n")
193
193
  end
194
-
194
+
195
195
  def pop_context_to_level(level)
196
196
  while (context.level > level)
197
197
  pop_context
@@ -204,7 +204,7 @@ module WikiWah
204
204
  pop_context
205
205
  end
206
206
  end
207
-
207
+
208
208
  end
209
209
 
210
210
  end
@@ -1,3 +1,3 @@
1
1
  module WikiWah
2
- VERSION = "0.0.3".freeze
2
+ VERSION = "0.1.0".freeze
3
3
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
-
2
+
3
3
  require 'wikiwah/flow'
4
4
  require 'test/unit'
5
5
 
@@ -165,14 +165,14 @@ P2
165
165
 
166
166
  ==== # Code
167
167
  | code
168
- |
168
+ |
169
169
  | more code
170
170
  ----
171
171
  <pre>
172
- code
172
+ <code>code
173
173
 
174
174
  more code
175
- </pre>
175
+ </code></pre>
176
176
 
177
177
  ==== # Blockquote
178
178
  > block
@@ -222,8 +222,8 @@ item
222
222
  </li>
223
223
  </ul>
224
224
  <pre>
225
- code
226
- </pre>
225
+ <code>code
226
+ </code></pre>
227
227
 
228
228
  ====
229
229
  * item
@@ -235,8 +235,8 @@ code
235
235
  item
236
236
  </li>
237
237
  <pre>
238
- code
239
- </pre>
238
+ <code>code
239
+ </code></pre>
240
240
  </ul>
241
241
 
242
242
  ====
@@ -333,10 +333,10 @@ two
333
333
  | z
334
334
  ----
335
335
  <pre>
336
- x
336
+ <code>x
337
337
  |y|
338
338
  z
339
- </pre>
339
+ </code></pre>
340
340
 
341
341
  ====
342
342
  - list item
@@ -417,6 +417,6 @@ module WikiWah
417
417
  end
418
418
  end
419
419
 
420
- end
420
+ end
421
421
  end
422
-
422
+
metadata CHANGED
@@ -1,33 +1,24 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: wikiwah
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - Mike Williams
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2011-05-08 00:00:00 Z
11
+ date: 2013-05-07 00:00:00.000000000 Z
14
12
  dependencies: []
15
-
16
- description: |
17
- WikiWah is a text-to-HTML converter, along the lines of Markdown.
18
-
19
- This isn't the markup language you're looking for.
20
- It offers no improvements on Markdown, Textile, etc.
21
- I'm packaging it as a gem only because I still have some legacy content in this format.
22
-
13
+ description: ! "WikiWah is a text-to-HTML converter, along the lines of Markdown.
14
+ \ \n\nThis isn't the markup language you're looking for. \nIt offers no improvements
15
+ on Markdown, Textile, etc. \nI'm packaging it as a gem only because I still have
16
+ some legacy content in this format.\n"
23
17
  email: mdub@dogbiscuit.org
24
18
  executables: []
25
-
26
19
  extensions: []
27
-
28
20
  extra_rdoc_files: []
29
-
30
- files:
21
+ files:
31
22
  - lib/wikiwah/converter.rb
32
23
  - lib/wikiwah/flow.rb
33
24
  - lib/wikiwah/flow.rb~
@@ -47,32 +38,28 @@ files:
47
38
  - Rakefile
48
39
  homepage: http://github.com/mdub/wikiwah
49
40
  licenses: []
50
-
41
+ metadata: {}
51
42
  post_install_message:
52
43
  rdoc_options: []
53
-
54
- require_paths:
44
+ require_paths:
55
45
  - lib
56
- required_ruby_version: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: "0"
62
- required_rubygems_version: !ruby/object:Gem::Requirement
63
- none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: "0"
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
68
56
  requirements: []
69
-
70
57
  rubyforge_project:
71
- rubygems_version: 1.7.2
58
+ rubygems_version: 2.0.0
72
59
  signing_key:
73
- specification_version: 3
60
+ specification_version: 4
74
61
  summary: WikiWah turns text into HTML
75
- test_files:
62
+ test_files:
76
63
  - test/wikiwah/flow_tests.rb
77
64
  - test/wikiwah/flow_tests.rb~
78
65
  - test/wikiwah/subst_tests.rb
@@ -80,4 +67,3 @@ test_files:
80
67
  - test/wikiwah_tests.rb
81
68
  - test/wikiwah_tests.rb~
82
69
  - Rakefile
83
- has_rdoc: