govspeak 1.5.0 → 1.5.1

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.
@@ -185,7 +185,7 @@ module Govspeak
185
185
  end
186
186
  end
187
187
 
188
- extension("Priority list", /\$PriorityList:(\d+)\n(.*)(?:^\s*\n|\Z)/m) do |number_to_show, body|
188
+ extension("Priority list", /\$PriorityList:(\d+)\s*$(.*?)(?:^\s*$|\Z)/m) do |number_to_show, body|
189
189
  number_to_show = number_to_show.to_i
190
190
  tagged = 0
191
191
  Kramdown::Document.new(body.strip).to_html.gsub(/<li>/) do |match|
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
@@ -464,21 +464,75 @@ $CTA
464
464
  assert document.valid?
465
465
  end
466
466
 
467
- ["$PriorityList:3
467
+ expected_priority_list_output = %|
468
+ <ul>
469
+ <li class="primary-item">List item 1</li>
470
+ <li class="primary-item">List item 2</li>
471
+ <li class="primary-item">List item 3</li>
472
+ <li>List item 4</li>
473
+ <li>List item 5</li>
474
+ </ul>
475
+ |
476
+
477
+ test "Single priority list ending with EOF" do
478
+ govspeak = "$PriorityList:3
468
479
  * List item 1
469
480
  * List item 2
470
481
  * List item 3
471
482
  * List item 4
472
- * List item 5",
473
- "$PriorityList:3
474
- * List item 1
475
- * List item 2
476
- * List item 3
477
- * List item 4
478
- * List item 5
483
+ * List item 5"
484
+
485
+ given_govspeak(govspeak) do
486
+ assert_html_output(expected_priority_list_output)
487
+ end
488
+ end
479
489
 
480
- "].each do |govspeak|
481
- test_given_govspeak(govspeak) do
490
+ test "Single priority list ending with newlines" do
491
+ govspeak = "$PriorityList:3
492
+ * List item 1
493
+ * List item 2
494
+ * List item 3
495
+ * List item 4
496
+ * List item 5
497
+
498
+ "
499
+
500
+ given_govspeak(govspeak) do
501
+ assert_html_output(expected_priority_list_output)
502
+ end
503
+ end
504
+
505
+ test 'Single priority list with \n newlines' do
506
+ govspeak = "$PriorityList:3\n * List item 1\n * List item 2\n * List item 3\n * List item 4\n * List item 5"
507
+
508
+ given_govspeak(govspeak) do
509
+ assert_html_output(expected_priority_list_output)
510
+ end
511
+ end
512
+
513
+ test 'Single priority list with \r\n newlines' do
514
+ govspeak = "$PriorityList:3\r\n * List item 1\r\n * List item 2\r\n * List item 3\r\n * List item 4\r\n * List item 5"
515
+
516
+ given_govspeak(govspeak) do
517
+ assert_html_output(expected_priority_list_output)
518
+ end
519
+ end
520
+
521
+
522
+ test "Multiple priority lists" do
523
+ govspeak = "
524
+ $PriorityList:3
525
+ * List item 1
526
+ * List item 2
527
+ * List item 3
528
+ * List item 4
529
+ * List item 5
530
+
531
+ $PriorityList:1
532
+ * List item 1
533
+ * List item 2"
534
+
535
+ given_govspeak(govspeak) do
482
536
  assert_html_output %|
483
537
  <ul>
484
538
  <li class="primary-item">List item 1</li>
@@ -487,6 +541,11 @@ $CTA
487
541
  <li>List item 4</li>
488
542
  <li>List item 5</li>
489
543
  </ul>
544
+
545
+ <ul>
546
+ <li class="primary-item">List item 1</li>
547
+ <li>List item 2</li>
548
+ </ul>
490
549
  |
491
550
  end
492
551
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govspeak
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-03-05 00:00:00.000000000 Z
13
+ date: 2014-03-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: kramdown
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
165
  version: '0'
166
166
  segments:
167
167
  - 0
168
- hash: 132095242591557468
168
+ hash: -2566926204979886726
169
169
  required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  none: false
171
171
  requirements:
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  segments:
176
176
  - 0
177
- hash: 132095242591557468
177
+ hash: -2566926204979886726
178
178
  requirements: []
179
179
  rubyforge_project:
180
180
  rubygems_version: 1.8.23