lib/asciidoctor/parser.rb in asciidoctor-2.0.13 vs lib/asciidoctor/parser.rb in asciidoctor-2.0.14
- old
+ new
@@ -142,11 +142,14 @@
if doctitle_attr_val
# NOTE doctitle attribute (set above or below implicit doctitle) overrides implicit doctitle
l0_section_title = nil
else
document.title = l0_section_title
- doc_attrs['doctitle'] = doctitle_attr_val = document.apply_header_subs l0_section_title
+ if (doc_attrs['doctitle'] = doctitle_attr_val = document.sub_specialchars l0_section_title).include? ATTR_REF_HEAD
+ # QUESTION should we defer substituting attributes until the end of the header? or should we substitute again if necessary?
+ doc_attrs['doctitle'] = doctitle_attr_val = document.sub_attributes doctitle_attr_val, attribute_missing: 'skip'
+ end
end
document.header.source_location = source_location if source_location
# default to compat-mode if document has setext doctitle
doc_attrs['compat-mode'] = '' unless atx || (document.attribute_locked? 'compat-mode')
if (separator = block_attrs['separator'])
@@ -903,13 +906,11 @@
# FIXME we've got to clean this up, it's horrible!
block.source_location = reader.cursor_at_mark if document.sourcemap
# FIXME title and caption should be assigned when block is constructed (though we need to handle all cases)
if attributes['title']
block.title = block_title = attributes.delete 'title'
- if (caption_attr_name = CAPTION_ATTRIBUTE_NAMES[block.context]) && document.attributes[caption_attr_name]
- block.assign_caption (attributes.delete 'caption')
- end
+ block.assign_caption (attributes.delete 'caption') if CAPTION_ATTRIBUTE_NAMES[block.context]
end
# TODO eventually remove the style attribute from the attributes hash
#block.style = attributes.delete 'style'
block.style = attributes['style']
if (block_id = block.id || (block.id = attributes['id']))
@@ -1317,10 +1318,10 @@
elsif list_type == :olist
sibling_trait, implicit_style = resolve_ordered_list_marker(sibling_trait, (ordinal = list_block.items.size), true, reader)
list_item.marker = sibling_trait
if ordinal == 0 && !style
# using list level makes more sense, but we don't track it
- # basing style on marker level is compliant with AsciiDoc Python
+ # basing style on marker level is compliant with AsciiDoc.py
list_block.style = implicit_style || ((ORDERED_LIST_STYLES[sibling_trait.length - 1] || 'arabic').to_s)
end
if item_text.start_with?('[[') && LeadingInlineAnchorRx =~ item_text
catalog_inline_anchor $1, $2, list_item, reader
end