wikitext 1.0.2 → 1.0.3

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.
data/ext/parser.c CHANGED
@@ -1170,7 +1170,15 @@ VALUE Wikitext_parser_parse(int argc, VALUE *argv, VALUE self)
1170
1170
  ary_push(parser->scope, BLOCKQUOTE_START);
1171
1171
  ary_push(parser->line, BLOCKQUOTE_START);
1172
1172
  }
1173
- else if (parser->scope->count == 0 || (IN(P) && !IN(BLOCKQUOTE)))
1173
+ else if (IN(BLOCKQUOTE))
1174
+ {
1175
+ // illegal here
1176
+ i = NIL_P(parser->capture) ? parser->output : parser->capture;
1177
+ _Wikitext_pop_excess_elements(parser);
1178
+ _Wikitext_start_para_if_necessary(parser);
1179
+ rb_str_cat(i, escaped_blockquote_start, sizeof(escaped_blockquote_start) - 1);
1180
+ }
1181
+ else
1174
1182
  {
1175
1183
  // would be nice to eliminate the repetition here but it's probably the clearest way
1176
1184
  _Wikitext_rollback_failed_link(parser); // if any
@@ -1182,14 +1190,6 @@ VALUE Wikitext_parser_parse(int argc, VALUE *argv, VALUE self)
1182
1190
  ary_push(parser->scope, BLOCKQUOTE_START);
1183
1191
  ary_push(parser->line, BLOCKQUOTE_START);
1184
1192
  }
1185
- else
1186
- {
1187
- // everywhere else, BLOCKQUOTE_START is illegal (in LI, BLOCKQUOTE, H1_START etc)
1188
- i = NIL_P(parser->capture) ? parser->output : parser->capture;
1189
- _Wikitext_pop_excess_elements(parser);
1190
- _Wikitext_start_para_if_necessary(parser);
1191
- rb_str_cat(i, escaped_blockquote_start, sizeof(escaped_blockquote_start) - 1);
1192
- }
1193
1193
  break;
1194
1194
 
1195
1195
  case BLOCKQUOTE_END:
@@ -1,3 +1,17 @@
1
+ # Copyright 2008 Wincent Colaiuta
2
+ # This program is free software: you can redistribute it and/or modify
3
+ # it under the terms of the GNU General Public License as published by
4
+ # the Free Software Foundation, either version 3 of the License, or
5
+ # (at your option) any later version.
6
+ #
7
+ # This program is distributed in the hope that it will be useful,
8
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
+ # GNU General Public License for more details.
11
+ #
12
+ # You should have received a copy of the GNU General Public License
13
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
14
+
1
15
  require 'wikitext/string'
2
16
 
3
17
  module Wikitext
@@ -1,3 +1,17 @@
1
+ # Copyright 2008 Wincent Colaiuta
2
+ # This program is free software: you can redistribute it and/or modify
3
+ # it under the terms of the GNU General Public License as published by
4
+ # the Free Software Foundation, either version 3 of the License, or
5
+ # (at your option) any later version.
6
+ #
7
+ # This program is distributed in the hope that it will be useful,
8
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
+ # GNU General Public License for more details.
11
+ #
12
+ # You should have received a copy of the GNU General Public License
13
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
14
+
1
15
  require 'wikitext'
2
16
 
3
17
  class String
@@ -15,7 +29,7 @@ private
15
29
  # for now do this in pure Ruby
16
30
  # if speed later becomes a concern can whip up a Ragel C extension to do it
17
31
  def wikitext_preprocess
18
- gsub /\b(bug|issue|request) #(\d+)/i, '[[issues/\2|\1 #\2]]'
32
+ gsub /\b(bug|issue|request|ticket) #(\d+)/i, '[[issues/\2|\1 #\2]]'
19
33
  end
20
34
 
21
35
  end
@@ -13,5 +13,5 @@
13
13
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
14
14
 
15
15
  module Wikitext
16
- VERSION = '1.0.2'
16
+ VERSION = '1.0.3'
17
17
  end # module Wikitext
File without changes
File without changes
data/spec/em_spec.rb CHANGED
File without changes
File without changes
data/spec/entity_spec.rb CHANGED
File without changes
File without changes
data/spec/h1_spec.rb CHANGED
File without changes
data/spec/h2_spec.rb CHANGED
File without changes
data/spec/h3_spec.rb CHANGED
File without changes
data/spec/h4_spec.rb CHANGED
File without changes
data/spec/h5_spec.rb CHANGED
File without changes
data/spec/h6_spec.rb CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/spec/nowiki_spec.rb CHANGED
File without changes
data/spec/p_spec.rb CHANGED
File without changes
data/spec/pre_spec.rb CHANGED
File without changes
@@ -744,4 +744,22 @@ describe Wikitext::Parser, 'regressions' do
744
744
  END
745
745
  @parser.parse(input).should == expected
746
746
  end
747
+
748
+ # discovered at: http://rails.wincent.com/wiki/Testing_cookies_in_Rails
749
+ it 'should handle BLOCKQUOTE_START blocks which follow lists' do
750
+ # example text taken from wiki article and edited for brevity
751
+ input = dedent <<-END
752
+ * This article
753
+ <blockquote>The cookies</blockquote>
754
+ END
755
+ expected = dedent <<-END
756
+ <ul>
757
+ <li>This article</li>
758
+ </ul>
759
+ <blockquote>
760
+ <p>The cookies</p>
761
+ </blockquote>
762
+ END
763
+ @parser.parse(input).should == expected
764
+ end
747
765
  end
File without changes
data/spec/strong_spec.rb CHANGED
File without changes
File without changes
data/spec/tt_spec.rb CHANGED
File without changes
data/spec/ul_spec.rb CHANGED
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikitext
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wincent Colaiuta
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-27 00:00:00 +01:00
12
+ date: 2008-04-17 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  requirements: []
94
94
 
95
95
  rubyforge_project: wikitext
96
- rubygems_version: 1.0.1
96
+ rubygems_version: 1.1.1
97
97
  signing_key:
98
98
  specification_version: 2
99
99
  summary: Wikitext-to-HTML translator