[docmaker] Honour empty lines in `<Order>' section element.
This greatly improves the readability of the `Synopsis' links. * src/tools/docmaker/content.py (DocBlock::get_markup_words_all): Insert string `/empty/' between items. * src/tools/docmaker/formatter.py (Formatter::section_dump): Make it robust against nonexistent keys. * src/tools/docmaker/tohtml.py (HtmlFormatter::section_enter): Emit empty <td> elements for `/empty/'.
This commit is contained in:
parent
2af25ac0f9
commit
102d4a76ed
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2014-12-02 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
|
[docmaker] Honour empty lines in `<Order>' section element.
|
||||||
|
|
||||||
|
This greatly improves the readability of the `Synopsis' links.
|
||||||
|
|
||||||
|
* src/tools/docmaker/content.py (DocBlock::get_markup_words_all):
|
||||||
|
Insert string `/empty/' between items.
|
||||||
|
|
||||||
|
* src/tools/docmaker/formatter.py (Formatter::section_dump): Make it
|
||||||
|
robust against nonexistent keys.
|
||||||
|
|
||||||
|
* src/tools/docmaker/tohtml.py (HtmlFormatter::section_enter): Emit
|
||||||
|
empty <td> elements for `/empty/'.
|
||||||
|
|
||||||
2014-12-02 Werner Lemberg <wl@gnu.org>
|
2014-12-02 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
[docmaker] Ensure Python 3 compatibility.
|
[docmaker] Ensure Python 3 compatibility.
|
||||||
|
|
|
@ -610,9 +610,15 @@ class DocBlock:
|
||||||
def get_markup_words_all( self, tag_name ):
|
def get_markup_words_all( self, tag_name ):
|
||||||
try:
|
try:
|
||||||
m = self.get_markup( tag_name )
|
m = self.get_markup( tag_name )
|
||||||
return [word
|
words = m.fields[0].items[0].words
|
||||||
for items in m.fields[0].items
|
for item in m.fields[0].items[1:]:
|
||||||
for word in items.words]
|
# We honour empty lines in an `<Order>' section element by
|
||||||
|
# adding the sentinel `/empty/'. The formatter should then
|
||||||
|
# convert it to an appropriate representation in the
|
||||||
|
# `section_enter' function.
|
||||||
|
words.append( "/empty/" )
|
||||||
|
words += item.words
|
||||||
|
return words
|
||||||
except:
|
except:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
|
@ -183,13 +183,17 @@ class Formatter:
|
||||||
|
|
||||||
for name in section.block_names:
|
for name in section.block_names:
|
||||||
skip_entry = 0
|
skip_entry = 0
|
||||||
block = self.identifiers[name]
|
try:
|
||||||
# `block_names' can contain field names also, which we filter out
|
block = self.identifiers[name]
|
||||||
for markup in block.markups:
|
# `block_names' can contain field names also,
|
||||||
if markup.tag == 'values':
|
# which we filter out
|
||||||
for field in markup.fields:
|
for markup in block.markups:
|
||||||
if field.name == name:
|
if markup.tag == 'values':
|
||||||
skip_entry = 1
|
for field in markup.fields:
|
||||||
|
if field.name == name:
|
||||||
|
skip_entry = 1
|
||||||
|
except:
|
||||||
|
skip_entry = 1 # this happens e.g. for `/empty/' entries
|
||||||
|
|
||||||
if skip_entry:
|
if skip_entry:
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -582,6 +582,9 @@ class HtmlFormatter( Formatter ):
|
||||||
columns = 1
|
columns = 1
|
||||||
|
|
||||||
count = len( section.block_names )
|
count = len( section.block_names )
|
||||||
|
# don't handle last entry if it is empty
|
||||||
|
if section.block_names[-1] == "/empty/":
|
||||||
|
count -= 1
|
||||||
rows = ( count + columns - 1 ) // columns
|
rows = ( count + columns - 1 ) // columns
|
||||||
|
|
||||||
for r in range( rows ):
|
for r in range( rows ):
|
||||||
|
@ -591,8 +594,9 @@ class HtmlFormatter( Formatter ):
|
||||||
line = line + '<td>'
|
line = line + '<td>'
|
||||||
if i < count:
|
if i < count:
|
||||||
name = section.block_names[i]
|
name = section.block_names[i]
|
||||||
line = ( line + '<a href="#' + name + '">'
|
if name != "/empty/":
|
||||||
+ name + '</a>' )
|
line = ( line + '<a href="#' + name + '">'
|
||||||
|
+ name + '</a>' )
|
||||||
|
|
||||||
line = line + '</td>'
|
line = line + '</td>'
|
||||||
line = line + "</tr>"
|
line = line + "</tr>"
|
||||||
|
|
Loading…
Reference in New Issue