lib/asciidoctor/iso/inline.rb in asciidoctor-iso-0.6.1 vs lib/asciidoctor/iso/inline.rb in asciidoctor-iso-0.7.0
- old
+ new
@@ -1,12 +1,11 @@
-require 'asciidoctor/extensions'
+require "asciidoctor/extensions"
module Asciidoctor
module ISO
module Inline
-
- def is_refid?(x)
+ def refid?(x)
@refids.include? x
end
def inline_anchor(node)
case node.type
@@ -16,28 +15,26 @@
inline_anchor_xref node
when :link
inline_anchor_link node
when :bibref
inline_anchor_bibref node
- else
- warning(node, "unknown anchor type", node.type.inspect)
end
end
def inline_anchor_ref(node)
noko do |xml|
xml.bookmark nil, **attr_code(id: node.id)
end.join
end
def inline_anchor_xref(node)
- matched = /^fn(: (?<text>.*))?$/.match node.text
+ matched = /^fn(:\s*(?<text>.*))?$/.match node.text
f = matched.nil? ? "inline" : "footnote"
c = matched.nil? ? node.text : matched[:text]
t = node.target.gsub(/^#/, "").gsub(%r{(.)(\.xml)?#.*$}, "\\1")
- noko do |xml|
- xml.xref c, **attr_code(target: t, type: f)
+ noko do |xml|
+ xml.xref c, **attr_code(target: t, type: f)
end.join
end
def inline_anchor_link(node)
contents = node.text
@@ -64,11 +61,11 @@
end
def inline_footnote(node)
noko do |xml|
@fn_number += 1
- xml.fn **{reference: @fn_number} do |fn|
+ xml.fn **{ reference: @fn_number } do |fn|
fn.p { |p| p << node.text }
footnote_style(node, node.text)
end
end.join("\n")
end
@@ -78,26 +75,18 @@
xml << node.text
xml.br
end.join("\n")
end
- def page_break(node)
- noko do |xml|
- xml << node.text
- xml.pagebreak
- end.join("\n")
+ def page_break(_node)
+ noko { |xml| xml.pagebreak }.join("\n")
end
- def thematic_break(node)
- noko do |xml|
- xml << node.text
- xml.hr
- end.join("\n")
+ def thematic_break(_node)
+ noko { |xml| xml.hr }.join("\n")
end
-
-
def inline_quoted(node)
noko do |xml|
case node.type
when :emphasis then xml.em node.text
when :strong then xml.strong node.text
@@ -120,9 +109,8 @@
xml << node.text
end
end
end.join
end
-
end
end
end