summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2023-04-08 23:58:12 -0600
committerDan Allen <dan.j.allen@gmail.com>2023-04-09 01:28:21 -0600
commitc98422f9bd642dbca411985ffebb231aeade2da4 (patch)
treed3deb1f32cf3a48ce752c031747a93b051e84134 /lib
parent2fd7523bd7631a3f5d343f50c44b108e11b81eb5 (diff)
change Block#content to return empty string instead of nil if raw or verbatim block has no lines
* makes return value type consistent
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor/block.rb2
-rw-r--r--lib/asciidoctor/converter/docbook5.rb4
-rw-r--r--lib/asciidoctor/converter/html5.rb2
3 files changed, 4 insertions, 4 deletions
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? ? %(<div class="title">#{node.captioned_title}</div>\n) : ''
%(<div#{id_attribute} class="listingblock#{(role = node.role) ? " #{role}" : ''}">
#{title_element}<div class="content">
-#{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}
</div>
</div>)
end