diff --git a/app/views/markup/_blockquote.html.slim b/app/views/markup/_blockquote.html.slim new file mode 100644 index 00000000..3813600f --- /dev/null +++ b/app/views/markup/_blockquote.html.slim @@ -0,0 +1,4 @@ +.application-notice.info-notice role='note' aria-label='Information' + == quote + +p= citation diff --git a/app/views/markup/_quote.html.slim b/app/views/markup/_quote.html.slim index 3813600f..01959044 100644 --- a/app/views/markup/_quote.html.slim +++ b/app/views/markup/_quote.html.slim @@ -1,4 +1,5 @@ -.application-notice.info-notice role='note' aria-label='Information' - == quote +.blockquote-container + blockquote.quote + == quote -p= citation + cite= citation diff --git a/config/initializers/markdown.rb b/config/initializers/markdown.rb index 399be5e7..d236e0ac 100644 --- a/config/initializers/markdown.rb +++ b/config/initializers/markdown.rb @@ -3,7 +3,7 @@ class CustomPreprocessor < GovukMarkdown::Preprocessor # @return [CustomPreprocessor] def apply_all - inject_inset_text.inject_details.two_thirds.button.external.quote.video + inject_inset_text.inject_details.two_thirds.button.external.quote.blockquote.video end # @example @@ -69,7 +69,7 @@ def external # This is the citation # {/quote} # - # @return [CustomPreprocessor] + # @return [CustomPreprocessor] CDT style def quote pattern = build_regexp('quote') @output = output.gsub(pattern) do @@ -79,6 +79,21 @@ def quote self end + # @example + # {blockquote} + # This is the quote and the citation + # {/blockquote} + # + # @return [CustomPreprocessor] Govspeak style + def blockquote + pattern = build_regexp('blockquote') + @output = output.gsub(pattern) do + quote, citation = split_content Regexp.last_match(1) + blockquote_template.render(nil, quote: nested_markdown(quote), citation: citation) + end + self + end + # @example # {video}872080640{/video} # @@ -117,6 +132,11 @@ def quote_template @quote_template ||= Slim::Template.new('app/views/markup/_quote.html.slim') end + # @return [Slim::Template] + def blockquote_template + @blockquote_template ||= Slim::Template.new('app/views/markup/_blockquote.html.slim') + end + # @return [Slim::Template] def video_template @video_template ||= Slim::Template.new('app/views/markup/_video.html.slim')