govspeak 1.6.0 → 1.6.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.
- data/CHANGELOG.md +5 -0
- data/README.md +14 -0
- data/lib/govspeak.rb +2 -2
- data/lib/govspeak/version.rb +1 -1
- data/test/govspeak_test.rb +74 -0
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -136,6 +136,20 @@ Steps can be created similar to an ordered list:
|
|
136
136
|
|
137
137
|
Note that steps need an extra line break after the final step (ie. two full blank lines) or other markdown directly afterwards won't work. If you have a subhead after - add a line break after this.
|
138
138
|
|
139
|
+
## Legislative Lists
|
140
|
+
|
141
|
+
For lists where you want to specify the numbering and have multiple indent levels.
|
142
|
+
|
143
|
+
$LegislativeList
|
144
|
+
* 1. Item 1
|
145
|
+
* 2. Item 2
|
146
|
+
* a) Item 2a
|
147
|
+
* b) Item 2b
|
148
|
+
* i. Item 2 b i
|
149
|
+
* ii. Item 2 b ii
|
150
|
+
* 3. Item 3
|
151
|
+
(to indent, add 2 spaces)
|
152
|
+
|
139
153
|
## Abbreviations
|
140
154
|
|
141
155
|
Abbreviations can be defined at the end of the document, and any occurrences elswhere in the document will wrapped in an `<abbr>` tag. They are parsed in the order in which they are defined, so `PCSOs` should be defined before `PCSO`, for example.
|
data/lib/govspeak.rb
CHANGED
@@ -160,7 +160,7 @@ module Govspeak
|
|
160
160
|
%{<div class="address"><div class="adr org fn"><p>\n#{body.sub("\n", "").gsub("\n", "<br />")}\n</p></div></div>\n}
|
161
161
|
}
|
162
162
|
|
163
|
-
extension("legislative list",
|
163
|
+
extension("legislative list", /(?<=\A|\n{2})^\$LegislativeList\s*$(.*?)(?:^\s*$|\Z)/m) do |body|
|
164
164
|
Govspeak::KramdownOverrides.with_kramdown_ordered_lists_disabled do
|
165
165
|
Kramdown::Document.new(body.strip).to_html.tap do |doc|
|
166
166
|
doc.gsub!('<ul>', '<ol>')
|
@@ -196,7 +196,7 @@ module Govspeak
|
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
-
extension("Priority list",
|
199
|
+
extension("Priority list", /(?<=\A|\n{2})^\$PriorityList:(\d+)\s*$(.*?)(?:^\s*$|\Z)/m) do |number_to_show, body|
|
200
200
|
number_to_show = number_to_show.to_i
|
201
201
|
tagged = 0
|
202
202
|
Govspeak::Document.new(body.strip).to_html.gsub(/<li>/) do |match|
|
data/lib/govspeak/version.rb
CHANGED
data/test/govspeak_test.rb
CHANGED
@@ -418,6 +418,32 @@ $CTA
|
|
418
418
|
}
|
419
419
|
end
|
420
420
|
|
421
|
+
test_given_govspeak "
|
422
|
+
The quick brown
|
423
|
+
$LegislativeList
|
424
|
+
* 1. fox jumps over
|
425
|
+
" do
|
426
|
+
assert_html_output "
|
427
|
+
<p>The quick brown
|
428
|
+
$LegislativeList
|
429
|
+
* 1. fox jumps over</p>"
|
430
|
+
end
|
431
|
+
|
432
|
+
test_given_govspeak "
|
433
|
+
The quick brown fox
|
434
|
+
|
435
|
+
$LegislativeList
|
436
|
+
* 1. jumps over the lazy dog
|
437
|
+
" do
|
438
|
+
assert_html_output %{
|
439
|
+
<p>The quick brown fox</p>
|
440
|
+
|
441
|
+
<ol class="legislative-list">
|
442
|
+
<li>1. jumps over the lazy dog</li>
|
443
|
+
</ol>
|
444
|
+
}
|
445
|
+
end
|
446
|
+
|
421
447
|
test_given_govspeak "
|
422
448
|
Zippy, Bungle and George did not qualify for the tax exemption in s428. They filled in their tax return accordingly.
|
423
449
|
" do
|
@@ -601,4 +627,52 @@ $PriorityList:1
|
|
601
627
|
|
|
602
628
|
end
|
603
629
|
end
|
630
|
+
|
631
|
+
test "Priority list placed incorrectly" do
|
632
|
+
govspeak = "
|
633
|
+
This is a paragraph
|
634
|
+
$PriorityList:3
|
635
|
+
* List item 1
|
636
|
+
* List item 2
|
637
|
+
* List item 3
|
638
|
+
* List item 4
|
639
|
+
* List item 5"
|
640
|
+
|
641
|
+
given_govspeak(govspeak) do
|
642
|
+
assert_html_output("
|
643
|
+
<p>This is a paragraph
|
644
|
+
$PriorityList:3
|
645
|
+
* List item 1
|
646
|
+
* List item 2
|
647
|
+
* List item 3
|
648
|
+
* List item 4
|
649
|
+
* List item 5</p>")
|
650
|
+
end
|
651
|
+
end
|
652
|
+
|
653
|
+
test "Priority list placed correctly" do
|
654
|
+
govspeak = "
|
655
|
+
This is a paragraph
|
656
|
+
|
657
|
+
$PriorityList:3
|
658
|
+
* List item 1
|
659
|
+
* List item 2
|
660
|
+
* List item 3
|
661
|
+
* List item 4
|
662
|
+
* List item 5"
|
663
|
+
|
664
|
+
given_govspeak(govspeak) do
|
665
|
+
assert_html_output %|
|
666
|
+
<p>This is a paragraph</p>
|
667
|
+
|
668
|
+
<ul>
|
669
|
+
<li class="primary-item">List item 1</li>
|
670
|
+
<li class="primary-item">List item 2</li>
|
671
|
+
<li class="primary-item">List item 3</li>
|
672
|
+
<li>List item 4</li>
|
673
|
+
<li>List item 5</li>
|
674
|
+
</ul>
|
675
|
+
|
|
676
|
+
end
|
677
|
+
end
|
604
678
|
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.6.
|
4
|
+
version: 1.6.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-06-
|
13
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: kramdown
|
@@ -182,7 +182,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: '0'
|
183
183
|
segments:
|
184
184
|
- 0
|
185
|
-
hash:
|
185
|
+
hash: 4364278234785949725
|
186
186
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
187
|
none: false
|
188
188
|
requirements:
|
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
version: '0'
|
192
192
|
segments:
|
193
193
|
- 0
|
194
|
-
hash:
|
194
|
+
hash: 4364278234785949725
|
195
195
|
requirements: []
|
196
196
|
rubyforge_project:
|
197
197
|
rubygems_version: 1.8.23
|