From c98422f9bd642dbca411985ffebb231aeade2da4 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Sat, 8 Apr 2023 23:58:12 -0600 Subject: change Block#content to return empty string instead of nil if raw or verbatim block has no lines * makes return value type consistent --- lib/asciidoctor/block.rb | 2 +- lib/asciidoctor/converter/docbook5.rb | 4 ++-- lib/asciidoctor/converter/html5.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/asciidoctor/block.rb b/lib/asciidoctor/block.rb index a1bf00cc..ecd2a1bd 100644 --- a/lib/asciidoctor/block.rb +++ b/lib/asciidoctor/block.rb @@ -116,7 +116,7 @@ class Block < AbstractBlock # maybe apply_subs can know how to strip whitespace? result = apply_subs @lines, @subs if result.size < 2 - result[0] + result[0] || '' else result.shift while (first = result[0]) && first.rstrip.empty? result.pop while (last = result[-1]) && last.rstrip.empty? diff --git a/lib/asciidoctor/converter/docbook5.rb b/lib/asciidoctor/converter/docbook5.rb index 30fad2d1..4ae11127 100644 --- a/lib/asciidoctor/converter/docbook5.rb +++ b/lib/asciidoctor/converter/docbook5.rb @@ -250,10 +250,10 @@ class Converter::DocBook5Converter < Converter::Base def convert_stem node if (idx = node.subs.index :specialcharacters) node.subs.delete_at idx - equation = node.content || '' + equation = node.content idx > 0 ? (node.subs.insert idx, :specialcharacters) : (node.subs.unshift :specialcharacters) else - equation = node.content || '' + equation = node.content end if node.style == 'asciimath' # NOTE fop requires jeuclid to process mathml markup diff --git a/lib/asciidoctor/converter/html5.rb b/lib/asciidoctor/converter/html5.rb index 46efb92e..0c0b6362 100644 --- a/lib/asciidoctor/converter/html5.rb +++ b/lib/asciidoctor/converter/html5.rb @@ -678,7 +678,7 @@ Your browser does not support the audio tag. title_element = node.title? ? %(
#{node.captioned_title}
\n) : '' %( #{title_element}
-#{syntax_hl ? (syntax_hl.format node, lang, opts) : pre_open + (node.content || '') + pre_close} +#{syntax_hl ? (syntax_hl.format node, lang, opts) : pre_open + node.content + pre_close}
) end -- cgit v1.2.3