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 ContentBlock related functionality #358

Merged
merged 2 commits into from
Oct 30, 2024
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,3 +1,7 @@
### 8.6.0

* Remove embed functionality ([#358](https://github.com/alphagov/govspeak/pull/358))

### 8.5.1

* Rename embed-related code to `content block`
Expand Down
28 changes: 0 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,34 +608,6 @@ will output
</div>
```

### Content blocks

Authors can embed different types of [supported content](https://github.com/alphagov/govspeak/blob/main/lib/govspeak/content_block.rb#L3) created by the Content Block Manager

```
{{embed:content_block_email_address:d308f561-e5ee-45b5-90b2-3ac36a23fad9}}
```

with options provided

```
{
content_blocks: [
{
content_id: "d308f561-e5ee-45b5-90b2-3ac36a23fad9",
title: "Government Digital Service",
details: { email_address: "[email protected]" },
}
]
}
```

will output

```html
<span class="embed_content_block_email_address" id="embed_d308f561-e5ee-45b5-90b2-3ac36a23fad9">[email protected]</span>
```

### Button

An accessible way to add button links into content, that can also allow cross domain tracking with [Google Analytics](https://support.google.com/analytics/answer/7372977?hl=en)
Expand Down
15 changes: 1 addition & 14 deletions lib/govspeak.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@
require "govspeak/html_validator"
require "govspeak/html_sanitizer"
require "govspeak/blockquote_extra_quote_remover"
require "govspeak/content_block_extractor"
require "govspeak/content_block"
require "govspeak/post_processor"
require "govspeak/link_extractor"
require "govspeak/template_renderer"
require "govspeak/presenters/attachment_presenter"
require "govspeak/presenters/contact_presenter"
require "govspeak/presenters/content_block_presenter"
require "govspeak/presenters/h_card_presenter"
require "govspeak/presenters/image_presenter"
require "govspeak/presenters/attachment_image_presenter"
Expand All @@ -40,7 +37,7 @@ class Document
@extensions = []

attr_accessor :images
attr_reader :attachments, :contacts, :links, :locale, :content_blocks
attr_reader :attachments, :contacts, :links, :locale

def self.to_html(source, options = {})
new(source, options).to_html
Expand All @@ -60,7 +57,6 @@ def initialize(source, options = {})
@attachments = Array.wrap(options.delete(:attachments))
@links = Array.wrap(options.delete(:links))
@contacts = Array.wrap(options.delete(:contacts))
@content_blocks = Array.wrap(options.delete(:content_blocks))
@locale = options.fetch(:locale, "en")
@options = { input: PARSER_CLASS_NAME,
sanitize: true,
Expand Down Expand Up @@ -259,15 +255,6 @@ def insert_strong_inside_p(body, parser = Govspeak::Document)
render_image(AttachmentImagePresenter.new(attachment))
end

extension("content blocks", Govspeak::ContentBlock::EMBED_REGEX) do |embed_code, _document_type, content_id|
next embed_code if content_blocks.empty?

embed = content_blocks.detect { |e| e[:content_id] == content_id }
next "" unless embed

ContentBlockPresenter.new(embed).render
end

# As of version 1.12.0 of Kramdown the block elements (div & figcaption)
# inside this html block will have it's < > converted into HTML Entities
# when ever this code is used inside block level elements.
Expand Down
15 changes: 0 additions & 15 deletions lib/govspeak/content_block.rb

This file was deleted.

17 changes: 0 additions & 17 deletions lib/govspeak/content_block_extractor.rb

This file was deleted.

32 changes: 0 additions & 32 deletions lib/govspeak/presenters/content_block_presenter.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/govspeak/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Govspeak
VERSION = "8.5.1".freeze
VERSION = "8.6.0".freeze
end
59 changes: 0 additions & 59 deletions test/content_block_extractor_test.rb

This file was deleted.

98 changes: 0 additions & 98 deletions test/govspeak_content_blocks_test.rb

This file was deleted.