Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Advisory component #357

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

* Remove Advisory component ([#357](https://github.com/alphagov/govspeak/pull/357))

## 8.8.3

* Update dependencies (actionview < 8.0.2, sanitize < 8, rubocop-govuk = 5.0.7)
Expand Down
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,6 @@ creates an example box

## Highlights

### Advisory (DEPRECATED: marked for removal. Use 'Information callouts' instead.)

@This is a very important message or warning@

highlights the enclosed text in yellow

```html
<h3 role="note" aria-label="Important" class="advisory">
<span>This is a very important message or warning</span>
</h3>
```

### Answer (DEPRECATED: marked for removal)

{::highlight-answer}
Expand Down
4 changes: 0 additions & 4 deletions lib/govspeak.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,6 @@ def insert_strong_inside_p(body, parser = Govspeak::Document)
#{Govspeak::Document.new(body.strip).to_html}</div>\n)
end

extension("important", surrounded_by("@")) do |body|
%(\n\n<div role="note" aria-label="Important" class="advisory">#{insert_strong_inside_p(body)}</div>\n)
end

extension("helpful", surrounded_by("%")) do |body|
%(\n\n<div role="note" aria-label="Warning" class="application-notice help-notice">\n#{Govspeak::Document.new(body.strip).to_html}</div>\n)
end
Expand Down
29 changes: 0 additions & 29 deletions test/govspeak_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,27 +209,6 @@ class GovspeakTest < Minitest::Test
assert_text_output "I am very informational"
end

test_given_govspeak "@ I am very important @" do
assert_html_output %(
<div role="note" aria-label="Important" class="advisory">
<p><strong>I am very important</strong></p>
</div>)
assert_text_output "I am very important"
end

test_given_govspeak "
The following is very important
@ I am very important @
" do
assert_html_output %(
<p>The following is very important</p>

<div role="note" aria-label="Important" class="advisory">
<p><strong>I am very important</strong></p>
</div>)
assert_text_output "The following is very important I am very important"
end

test_given_govspeak "% I am very helpful %" do
assert_html_output %(
<div role="note" aria-label="Warning" class="application-notice help-notice">
Expand Down Expand Up @@ -1527,14 +1506,6 @@ class GovspeakTest < Minitest::Test
'
end

test_given_govspeak "@ Message with [a link](http://foo.bar/)@" do
assert_html_output %(
<div role="note" aria-label="Important" class="advisory">
<p><strong>Message with <a rel="external" href="http://foo.bar/">a link</a></strong></p>
</div>
)
end

test "sanitize source input by default" do
document = Govspeak::Document.new("<script>doBadThings();</script>")
assert_equal "", document.to_html.strip
Expand Down
Loading