diff options
-rwxr-xr-x | asciidoc.py | 12 | ||||
-rw-r--r-- | doc/asciidoc.txt | 32 |
2 files changed, 24 insertions, 20 deletions
diff --git a/asciidoc.py b/asciidoc.py index a0b91d1..7564e36 100755 --- a/asciidoc.py +++ b/asciidoc.py @@ -2516,18 +2516,20 @@ class AbstractBlock: self.presubs = config.subsnormal if reader.cursor: self.start = reader.cursor[:] - def push_blockname(self, blockname): + def push_blockname(self, blockname=None): ''' On block entry set the 'blockname' attribute. Only applies to delimited blocks, lists and tables. ''' + if blockname is None: + blockname = self.attributes.get('style', self.short_name()).lower() trace('push blockname', blockname) self.blocknames.append(blockname) document.attributes['blockname'] = blockname def pop_blockname(self): ''' - On block exits restore previous parent 'blockname' or undefine it - if we're no longer inside a block. + On block exits restore previous (parent) 'blockname' attribute or + undefine it if we're no longer inside a block. ''' assert len(self.blocknames) > 0 blockname = self.blocknames.pop() @@ -2913,7 +2915,7 @@ class List(AbstractBlock): BlockTitle.consume(attrs) AttributeList.consume(attrs) self.merge_attributes(attrs,['tags']) - self.push_blockname(self.attributes.get('name', self.short_name())) + self.push_blockname() if self.type in ('numbered','callout'): self.number_style = self.attributes.get('style') if self.number_style not in self.NUMBER_STYLES: @@ -3032,7 +3034,7 @@ class DelimitedBlock(AbstractBlock): BlockTitle.consume(attrs) AttributeList.consume(attrs) self.merge_attributes(attrs) - self.push_blockname(self.attributes.get('name', self.short_name())) + self.push_blockname() options = self.parameters.options if 'skip' in options: reader.read_until(self.delimiter,same_file=True) diff --git a/doc/asciidoc.txt b/doc/asciidoc.txt index 3c8c73b..2522b12 100644 --- a/doc/asciidoc.txt +++ b/doc/asciidoc.txt @@ -804,11 +804,13 @@ The IDs are generated by the following algorithm: `idprefix` attribute is not defined. - A numbered suffix (`_2`, `_3` ...) is added if a same named auto-generated section ID exists. -- If the `ascii-ids` attribute is defined then non-ASCII characters are - stripped from auto-generated IDs. +- If the `ascii-ids` attribute is defined then non-ASCII characters + are stripped from auto-generated IDs. This attribute may be + deprecated in future releases and *should be avoided*, it's sole + purpose is to accomodate deficient downstream applications that + cannot process non-ASCII ID attributes. -For example the title 'Jim's House' would generate the ID -`_jim_s_house`. +Example: the title 'Jim's House' would generate the ID `_jim_s_house`. Section ID synthesis can be disabled by undefining the `sectids` attribute. @@ -4635,20 +4637,20 @@ predefined intrinsic attributes: 7. See http://en.wikipedia.org/wiki/Non-English_usage_of_quotation_marks[non-English usage of quotation marks]. -8. The `{blockname}` attribute identifies the current block. It - applies to delimited block, lists and tables. Here is a list of - `{blockname}` values: +8. The `{blockname}` attribute identifies the style of the current + block. It applies to delimited blocks, lists and tables. Here is a + list of `{blockname}` values (does not include filters or custom + block and style names): - delimited blocks:: 'comment', 'sidebar', 'open', 'pass', 'literal', - 'verse', 'listing', 'quote', 'example', 'note', 'tip', 'important', - 'caution', 'warning', 'abstract, 'partintro' + delimited blocks:: comment, sidebar, open, pass, literal, verse, + listing, quote, example, note, tip, important, caution, warning, + abstract, partintro - lists:: 'bulleted', 'bulleted1 ... bulleted5', 'numbered1 ... - numbered5', 'labeled', 'labeled2 .. labeled4', 'arabic', - 'loweralpha', 'upperalpha', 'lowerroman', 'upperroman', 'qanda', - 'horizonatal', 'callout', 'bibliography', 'glossary' + lists:: arabic, loweralpha, upperalpha, lowerroman, upperroman, + labeled, labeled3, labeled4, qanda, horizonatal, bibliography, + glossary - tables:: 'table' + tables:: table ====== |