govspeak 3.4.0 → 3.5.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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 56a1d2187e10b165f7f6872389a4bf16e48c1ba9
4
+ data.tar.gz: 04d622ee297eb5cbdd0284c42ecd2f8b0f8ef543
5
+ SHA512:
6
+ metadata.gz: 63b8fb72f6f042920bca9e5b867101e2e03e1c46aac5ab32ce779fee79042ecf957f3c8311164308264ce8c36830bef951211275b37516b73318b88b8e13cff0
7
+ data.tar.gz: f6fd90f8a72f143aa865f3535463e0e9a7e1f8049ac92ebf6c2c6a2a5780800101ce97fb0713b1046428e17a301d7cab61133bc6fb2f56cc47aed400b216aa6a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 3.5.0
2
+
3
+ * Add `{stat-headline}*10m* big numbers{/stat-headline}` markdown for HTML publications
4
+ * `aside` elements are now allowed through the sanitization process.
5
+ * Update Ruby from 1.9.3 to 2.1
6
+
1
7
  ## 3.4.0
2
8
 
3
9
  * Increase the version of Kramdown to `1.5.0`. This allows compatibility with Jekyll
data/README.md CHANGED
@@ -74,12 +74,32 @@ highlights the enclosed text in yellow
74
74
  The VAT rate is *20%*
75
75
  {:/highlight-answer}
76
76
 
77
- creates a large pink highlight box with optional preamble text and giant text denoted with `**`
77
+ creates a large highlight box with optional preamble text and giant text denoted with `**`
78
78
 
79
79
  <div class="highlight-answer">
80
80
  <p>The VAT rate is <em>20%</em></p>
81
81
  </div>
82
82
 
83
+ ### Statistic headline
84
+
85
+ Used in HTML publications.
86
+
87
+ Statistic headlines highlight important numbers in content. Displays a statistic as a large number with a description. The statistic and description must make sense when read aloud. The important number must be wrapped in `**`.
88
+
89
+ ```
90
+ {stat-headline}
91
+ *13.8bn* years since the big bang
92
+ {/stat-headline}
93
+ ```
94
+
95
+ Creates the following:
96
+
97
+ ```html
98
+ <aside class="stat-headline">
99
+ <p><em>13.8bn</em> years since the big bang</p>
100
+ </aside>
101
+ ```
102
+
83
103
  ## Points of Contact
84
104
 
85
105
  ### Contact
@@ -90,7 +110,7 @@ creates a large pink highlight box with optional preamble text and giant text de
90
110
  **Minicom:** 0845 604 44 34
91
111
  $C
92
112
 
93
- creates an contact box
113
+ creates a contact box
94
114
 
95
115
  <div class="contact">
96
116
  <p><strong>Student Finance England</strong><br><strong>Telephone:</strong> 0845 300 50 90<br><strong>Minicom:</strong> 0845 604 44 34</p>
data/lib/govspeak.rb CHANGED
@@ -36,7 +36,7 @@ module Govspeak
36
36
  def to_html
37
37
  kramdown_doc.to_html
38
38
  end
39
-
39
+
40
40
  def to_liquid
41
41
  to_html
42
42
  end
@@ -114,6 +114,11 @@ module Govspeak
114
114
  #{Govspeak::Document.new(body.strip).to_html}</div>\n}
115
115
  }
116
116
 
117
+ extension('stat-headline', %r${stat-headline}(.*?){/stat-headline}$m) { |body|
118
+ %{\n\n<aside class="stat-headline">
119
+ #{Govspeak::Document.new(body.strip).to_html}</aside>\n}
120
+ }
121
+
117
122
  # FIXME: these surrounded_by arguments look dodgy
118
123
  extension('external', surrounded_by("x[", ")x")) { |body|
119
124
  Kramdown::Document.new("[#{body.strip}){:rel='external'}").to_html
@@ -45,7 +45,7 @@ class Govspeak::HtmlSanitizer
45
45
  :all => Sanitize::Config::RELAXED[:attributes][:all] + [ "id", "class", "role", "aria-label" ],
46
46
  "a" => Sanitize::Config::RELAXED[:attributes]["a"] + [ "rel" ],
47
47
  },
48
- elements: Sanitize::Config::RELAXED[:elements] + [ "div", "span" ],
48
+ elements: Sanitize::Config::RELAXED[:elements] + [ "div", "span", "aside" ],
49
49
  })
50
50
  end
51
51
  end
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "3.4.0"
2
+ VERSION = "3.5.0"
3
3
  end
@@ -28,6 +28,11 @@ class GovspeakTest < Test::Unit::TestCase
28
28
  assert_equal %Q{<p>this </p>\n\n<div class="highlight-answer">\n<p>Lead in to <em>BIG TEXT</em></p>\n</div>\n}, rendered
29
29
  end
30
30
 
31
+ test "stat-headline block extension" do
32
+ rendered = Govspeak::Document.new("this \n{stat-headline}*13.8bn* Age of the universe in years{/stat-headline}").to_html
33
+ assert_equal %Q{<p>this </p>\n\n<aside class="stat-headline">\n<p><em>13.8bn</em> Age of the universe in years</p>\n</aside>\n}, rendered
34
+ end
35
+
31
36
  test "extracts headers with text, level and generated id" do
32
37
  document = Govspeak::Document.new %{
33
38
  # Big title
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govspeak
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
5
- prerelease:
4
+ version: 3.5.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ben Griffiths
@@ -10,139 +9,123 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2015-07-13 00:00:00.000000000 Z
12
+ date: 2015-10-09 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: kramdown
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ~>
18
+ - - "~>"
21
19
  - !ruby/object:Gem::Version
22
20
  version: 1.5.0
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ~>
25
+ - - "~>"
29
26
  - !ruby/object:Gem::Version
30
27
  version: 1.5.0
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: htmlentities
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
- - - ~>
32
+ - - "~>"
37
33
  - !ruby/object:Gem::Version
38
34
  version: '4'
39
35
  type: :runtime
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
- - - ~>
39
+ - - "~>"
45
40
  - !ruby/object:Gem::Version
46
41
  version: '4'
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: sanitize
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
- - - ~>
46
+ - - "~>"
53
47
  - !ruby/object:Gem::Version
54
48
  version: 2.1.0
55
49
  type: :runtime
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
- - - ~>
53
+ - - "~>"
61
54
  - !ruby/object:Gem::Version
62
55
  version: 2.1.0
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: nokogiri
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
68
- - - ~>
60
+ - - "~>"
69
61
  - !ruby/object:Gem::Version
70
62
  version: '1.5'
71
63
  type: :runtime
72
64
  prerelease: false
73
65
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
- - - ~>
67
+ - - "~>"
77
68
  - !ruby/object:Gem::Version
78
69
  version: '1.5'
79
70
  - !ruby/object:Gem::Dependency
80
71
  name: rake
81
72
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
73
  requirements:
84
- - - ~>
74
+ - - "~>"
85
75
  - !ruby/object:Gem::Version
86
76
  version: 0.9.0
87
77
  type: :development
88
78
  prerelease: false
89
79
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
80
  requirements:
92
- - - ~>
81
+ - - "~>"
93
82
  - !ruby/object:Gem::Version
94
83
  version: 0.9.0
95
84
  - !ruby/object:Gem::Dependency
96
85
  name: gem_publisher
97
86
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
87
  requirements:
100
- - - ~>
88
+ - - "~>"
101
89
  - !ruby/object:Gem::Version
102
90
  version: 1.1.1
103
91
  type: :development
104
92
  prerelease: false
105
93
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
94
  requirements:
108
- - - ~>
95
+ - - "~>"
109
96
  - !ruby/object:Gem::Version
110
97
  version: 1.1.1
111
98
  - !ruby/object:Gem::Dependency
112
99
  name: simplecov
113
100
  requirement: !ruby/object:Gem::Requirement
114
- none: false
115
101
  requirements:
116
- - - ! '>='
102
+ - - ">="
117
103
  - !ruby/object:Gem::Version
118
104
  version: '0'
119
105
  type: :development
120
106
  prerelease: false
121
107
  version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
108
  requirements:
124
- - - ! '>='
109
+ - - ">="
125
110
  - !ruby/object:Gem::Version
126
111
  version: '0'
127
112
  - !ruby/object:Gem::Dependency
128
113
  name: simplecov-rcov
129
114
  requirement: !ruby/object:Gem::Requirement
130
- none: false
131
115
  requirements:
132
- - - ! '>='
116
+ - - ">="
133
117
  - !ruby/object:Gem::Version
134
118
  version: '0'
135
119
  type: :development
136
120
  prerelease: false
137
121
  version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
122
  requirements:
140
- - - ! '>='
123
+ - - ">="
141
124
  - !ruby/object:Gem::Version
142
125
  version: '0'
143
- description: ! 'A set of extensions to markdown layered on top of the kramdown
144
-
145
- library for use in the UK Government Single Domain project'
126
+ description: |-
127
+ A set of extensions to markdown layered on top of the kramdown
128
+ library for use in the UK Government Single Domain project
146
129
  email:
147
130
  - ben@alphagov.co.uk
148
131
  - james.stewart@digital.cabinet-office.gov.uk
@@ -150,55 +133,48 @@ executables: []
150
133
  extensions: []
151
134
  extra_rdoc_files: []
152
135
  files:
153
- - lib/kramdown/parser/kramdown_with_automatic_external_links.rb
154
- - lib/with_deep_merge.rb
136
+ - CHANGELOG.md
137
+ - Gemfile
138
+ - README.md
139
+ - Rakefile
155
140
  - lib/govspeak.rb
156
- - lib/govspeak/html_sanitizer.rb
157
- - lib/govspeak/structured_header_extractor.rb
158
141
  - lib/govspeak/header_extractor.rb
142
+ - lib/govspeak/html_sanitizer.rb
159
143
  - lib/govspeak/html_validator.rb
160
144
  - lib/govspeak/kramdown_overrides.rb
145
+ - lib/govspeak/structured_header_extractor.rb
161
146
  - lib/govspeak/version.rb
162
- - README.md
163
- - CHANGELOG.md
164
- - Gemfile
165
- - Rakefile
166
- - test/govspeak_test_helper.rb
147
+ - lib/kramdown/parser/kramdown_with_automatic_external_links.rb
148
+ - lib/with_deep_merge.rb
149
+ - test/govspeak_structured_headers_test.rb
167
150
  - test/govspeak_test.rb
168
- - test/test_helper.rb
169
- - test/with_deep_merge_test.rb
151
+ - test/govspeak_test_helper.rb
170
152
  - test/html_sanitizer_test.rb
171
153
  - test/html_validator_test.rb
172
- - test/govspeak_structured_headers_test.rb
154
+ - test/test_helper.rb
155
+ - test/with_deep_merge_test.rb
173
156
  homepage: http://github.com/alphagov/govspeak
174
157
  licenses: []
158
+ metadata: {}
175
159
  post_install_message:
176
160
  rdoc_options: []
177
161
  require_paths:
178
162
  - lib
179
163
  required_ruby_version: !ruby/object:Gem::Requirement
180
- none: false
181
164
  requirements:
182
- - - ! '>='
165
+ - - ">="
183
166
  - !ruby/object:Gem::Version
184
167
  version: '0'
185
- segments:
186
- - 0
187
- hash: -842764078508591390
188
168
  required_rubygems_version: !ruby/object:Gem::Requirement
189
- none: false
190
169
  requirements:
191
- - - ! '>='
170
+ - - ">="
192
171
  - !ruby/object:Gem::Version
193
172
  version: '0'
194
- segments:
195
- - 0
196
- hash: -842764078508591390
197
173
  requirements: []
198
174
  rubyforge_project:
199
- rubygems_version: 1.8.23.2
175
+ rubygems_version: 2.2.5
200
176
  signing_key:
201
- specification_version: 3
177
+ specification_version: 4
202
178
  summary: Markup language for single domain
203
179
  test_files:
204
180
  - test/govspeak_test_helper.rb