govspeak 3.2.0 → 3.3.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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 3.3.0
2
+
3
+ * Relax Nokogiri dependency to `1.5.x` rather than `1.5.10`. This allows
4
+ Govspeak to work with Rails 4.2 and greater.
5
+
1
6
  ## 3.2.0
2
7
 
3
8
  * `span` elements are now allowed through the sanitization process.
data/README.md CHANGED
@@ -30,7 +30,7 @@ In addition to the [standard Markdown syntax](http://daringfireball.net/projects
30
30
 
31
31
  creates a callout with an info (i) icon.
32
32
 
33
- <div class="application-notice info-notice">
33
+ <div role="note" aria-label="Information" class="application-notice info-notice">
34
34
  <p>This is an information callout</p>
35
35
  </div>
36
36
 
@@ -40,7 +40,7 @@ creates a callout with an info (i) icon.
40
40
 
41
41
  creates a callout with a warning or alert (!) icon
42
42
 
43
- <div class="application-notice help-notice">
43
+ <div role="note" aria-label="Help" class="application-notice help-notice">
44
44
  <p>This is a warning callout</p>
45
45
  </div>
46
46
 
@@ -64,7 +64,7 @@ creates an example box
64
64
 
65
65
  highlights the enclosed text in yellow
66
66
 
67
- <h3 class="advisory">
67
+ <h3 role="note" aria-label="Important" class="advisory">
68
68
  <span>This is a very important message or warning</span>
69
69
  </h3>
70
70
 
data/lib/govspeak.rb CHANGED
@@ -24,8 +24,8 @@ module Govspeak
24
24
 
25
25
  def initialize(source, options = {})
26
26
  @source = source ? source.dup : ""
27
+ @images = options.delete(:images) || []
27
28
  @options = {input: PARSER_CLASS_NAME, entity_output: :symbolic}.merge(options)
28
- @images = []
29
29
  end
30
30
 
31
31
  def kramdown_doc
@@ -116,16 +116,16 @@ module Govspeak
116
116
  }
117
117
 
118
118
  extension('informational', surrounded_by("^")) { |body|
119
- %{\n\n<div class="application-notice info-notice">
119
+ %{\n\n<div role="note" aria-label="Information" class="application-notice info-notice">
120
120
  #{Govspeak::Document.new(body.strip).to_html}</div>\n}
121
121
  }
122
122
 
123
123
  extension('important', surrounded_by("@")) { |body|
124
- %{\n\n<div class="advisory">#{insert_strong_inside_p(body)}</div>\n}
124
+ %{\n\n<div role="note" aria-label="Important" class="advisory">#{insert_strong_inside_p(body)}</div>\n}
125
125
  }
126
126
 
127
127
  extension('helpful', surrounded_by("%")) { |body|
128
- %{\n\n<div class="application-notice help-notice">\n#{Govspeak::Document.new(body.strip).to_html}</div>\n}
128
+ %{\n\n<div role="note" aria-label="Help" class="application-notice help-notice">\n#{Govspeak::Document.new(body.strip).to_html}</div>\n}
129
129
  }
130
130
 
131
131
  extension('attached-image', /^!!([0-9]+)/) do |image_number|
@@ -42,7 +42,7 @@ class Govspeak::HtmlSanitizer
42
42
  def sanitize_config
43
43
  deep_merge(Sanitize::Config::RELAXED, {
44
44
  attributes: {
45
- :all => Sanitize::Config::RELAXED[:attributes][:all] + [ "id", "class" ],
45
+ :all => Sanitize::Config::RELAXED[:attributes][:all] + [ "id", "class", "role", "aria-label" ],
46
46
  "a" => Sanitize::Config::RELAXED[:attributes]["a"] + [ "rel" ],
47
47
  },
48
48
  elements: Sanitize::Config::RELAXED[:elements] + [ "div", "span" ],
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "3.2.0"
2
+ VERSION = "3.3.0"
3
3
  end
@@ -82,7 +82,7 @@ Teston
82
82
 
83
83
  test_given_govspeak("^ I am very informational ^") do
84
84
  assert_html_output %{
85
- <div class="application-notice info-notice">
85
+ <div role="note" aria-label="Information" class="application-notice info-notice">
86
86
  <p>I am very informational</p>
87
87
  </div>}
88
88
  assert_text_output "I am very informational"
@@ -98,7 +98,7 @@ Teston
98
98
  assert_html_output %{
99
99
  <p>The following is very informational</p>
100
100
 
101
- <div class="application-notice info-notice">
101
+ <div role="note" aria-label="Information" class="application-notice info-notice">
102
102
  <p>I am very informational</p>
103
103
  </div>}
104
104
  assert_text_output "The following is very informational I am very informational"
@@ -106,7 +106,7 @@ Teston
106
106
 
107
107
  test_given_govspeak "^ I am very informational" do
108
108
  assert_html_output %{
109
- <div class="application-notice info-notice">
109
+ <div role="note" aria-label="Information" class="application-notice info-notice">
110
110
  <p>I am very informational</p>
111
111
  </div>}
112
112
  assert_text_output "I am very informational"
@@ -114,7 +114,7 @@ Teston
114
114
 
115
115
  test_given_govspeak "@ I am very important @" do
116
116
  assert_html_output %{
117
- <div class="advisory"><p><strong>I am very important</strong></p>
117
+ <div role="note" aria-label="Important" class="advisory"><p><strong>I am very important</strong></p>
118
118
  </div>}
119
119
  assert_text_output "I am very important"
120
120
  end
@@ -126,14 +126,14 @@ Teston
126
126
  assert_html_output %{
127
127
  <p>The following is very important</p>
128
128
 
129
- <div class="advisory"><p><strong>I am very important</strong></p>
129
+ <div role="note" aria-label="Important" class="advisory"><p><strong>I am very important</strong></p>
130
130
  </div>}
131
131
  assert_text_output "The following is very important I am very important"
132
132
  end
133
133
 
134
134
  test_given_govspeak "% I am very helpful %" do
135
135
  assert_html_output %{
136
- <div class="application-notice help-notice">
136
+ <div role="note" aria-label="Help" class="application-notice help-notice">
137
137
  <p>I am very helpful</p>
138
138
  </div>}
139
139
  assert_text_output "I am very helpful"
@@ -143,7 +143,7 @@ Teston
143
143
  assert_html_output %{
144
144
  <p>The following is very helpful</p>
145
145
 
146
- <div class="application-notice help-notice">
146
+ <div role="note" aria-label="Help" class="application-notice help-notice">
147
147
  <p>I am very helpful</p>
148
148
  </div>}
149
149
  assert_text_output "The following is very helpful I am very helpful"
@@ -153,7 +153,7 @@ Teston
153
153
  assert_html_output %{
154
154
  <h2 id="hello">Hello</h2>
155
155
 
156
- <div class="application-notice help-notice">
156
+ <div role="note" aria-label="Help" class="application-notice help-notice">
157
157
  <p>I am very helpful</p>
158
158
  </div>
159
159
 
@@ -163,7 +163,7 @@ Teston
163
163
 
164
164
  test_given_govspeak "% I am very helpful" do
165
165
  assert_html_output %{
166
- <div class="application-notice help-notice">
166
+ <div role="note" aria-label="Help" class="application-notice help-notice">
167
167
  <p>I am very helpful</p>
168
168
  </div>}
169
169
  assert_text_output "I am very helpful"
@@ -533,7 +533,7 @@ $CTA
533
533
 
534
534
  test_given_govspeak "@ Message with [a link](http://foo.bar/)@" do
535
535
  assert_html_output %{
536
- <div class="advisory"><p><strong>Message with <a rel="external" href="http://foo.bar/">a link</a></strong></p>
536
+ <div role="note" aria-label="Important" class="advisory"><p><strong>Message with <a rel="external" href="http://foo.bar/">a link</a></strong></p>
537
537
  </div>
538
538
  }
539
539
  end
@@ -13,9 +13,7 @@ module GovspeakTestHelper
13
13
  end
14
14
 
15
15
  def document
16
- Govspeak::Document.new(@govspeak, @options).tap do |doc|
17
- doc.images = @images
18
- end
16
+ Govspeak::Document.new(@govspeak, @options.merge(:images => @images))
19
17
  end
20
18
 
21
19
  def assert_text_output(raw_expected)
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: 3.2.0
4
+ version: 3.3.0
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-10-03 00:00:00.000000000 Z
13
+ date: 2015-01-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: kramdown
@@ -67,7 +67,7 @@ dependencies:
67
67
  requirements:
68
68
  - - ~>
69
69
  - !ruby/object:Gem::Version
70
- version: 1.5.10
70
+ version: '1.5'
71
71
  type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -75,7 +75,7 @@ dependencies:
75
75
  requirements:
76
76
  - - ~>
77
77
  - !ruby/object:Gem::Version
78
- version: 1.5.10
78
+ version: '1.5'
79
79
  - !ruby/object:Gem::Dependency
80
80
  name: rake
81
81
  requirement: !ruby/object:Gem::Requirement
@@ -184,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  segments:
186
186
  - 0
187
- hash: 1030204254121178856
187
+ hash: 4296798786801736357
188
188
  required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  none: false
190
190
  requirements:
@@ -193,10 +193,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  version: '0'
194
194
  segments:
195
195
  - 0
196
- hash: 1030204254121178856
196
+ hash: 4296798786801736357
197
197
  requirements: []
198
198
  rubyforge_project:
199
- rubygems_version: 1.8.23
199
+ rubygems_version: 1.8.23.2
200
200
  signing_key:
201
201
  specification_version: 3
202
202
  summary: Markup language for single domain