lib/fcb.rb in markdown_exec-2.6.0 vs lib/fcb.rb in markdown_exec-2.7.0
- old
+ new
@@ -155,16 +155,22 @@
# Expand variables in `dname` and `body` attributes
def expand_variables_in_attributes!(pattern, replacements)
### update name, nickname, title, label ???
# Replace variables in `dname` using the replacements dictionary
- @attrs[:dname] = @attrs[:dname].gsub(pattern) do |match|
+ @attrs[:dname] = @attrs[:dname]&.gsub(pattern) do |match|
replacements[match]
end
+ @attrs[:s0printable] = @attrs[:s0printable]&.gsub(pattern) do |match|
+ replacements[match]
+ end
+ @attrs[:s1decorated] = @attrs[:s1decorated]&.gsub(pattern) do |match|
+ replacements[match]
+ end
# Replace variables in each line of `body` if `body` is present
if @attrs[:body]
- @attrs[:body] = @attrs[:body].map do |line|
+ @attrs[:body] = @attrs[:body]&.map do |line|
if line.empty?
line
else
line.gsub(pattern) { |match| replacements[match] }
end