[docmaker] Use field values as HTML link targets where possible.
* src/tools/docmaker/tohtml.py (HtmlFormatter::make_block_url): Accept second, optional argument to specify a name. (HtmlFormatter::html_source_quote): Link to field ID if possible. (HtmlFormatter::print_html_field_list): Emit `id' attribute.
This commit is contained in:
parent
785b1d0892
commit
0dbad7632b
|
@ -1,3 +1,12 @@
|
||||||
|
2014-11-29 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
|
[docmaker] Use field values as HTML link targets where possible.
|
||||||
|
|
||||||
|
* src/tools/docmaker/tohtml.py (HtmlFormatter::make_block_url):
|
||||||
|
Accept second, optional argument to specify a name.
|
||||||
|
(HtmlFormatter::html_source_quote): Link to field ID if possible.
|
||||||
|
(HtmlFormatter::print_html_field_list): Emit `id' attribute.
|
||||||
|
|
||||||
2014-11-29 Werner Lemberg <wl@gnu.org>
|
2014-11-29 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
[docmaker] Allow empty lines in `<Order>' blocks.
|
[docmaker] Allow empty lines in `<Order>' blocks.
|
||||||
|
|
|
@ -306,8 +306,10 @@ class HtmlFormatter( Formatter ):
|
||||||
def make_section_url( self, section ):
|
def make_section_url( self, section ):
|
||||||
return self.file_prefix + section.name + ".html"
|
return self.file_prefix + section.name + ".html"
|
||||||
|
|
||||||
def make_block_url( self, block ):
|
def make_block_url( self, block, name = None ):
|
||||||
return self.make_section_url( block.section ) + "#" + block.name
|
if name == None:
|
||||||
|
name = block.name
|
||||||
|
return self.make_section_url( block.section ) + "#" + name
|
||||||
|
|
||||||
def make_html_word( self, word ):
|
def make_html_word( self, word ):
|
||||||
"""Analyze a simple word to detect cross-references and markup."""
|
"""Analyze a simple word to detect cross-references and markup."""
|
||||||
|
@ -412,8 +414,18 @@ class HtmlFormatter( Formatter ):
|
||||||
elif self.identifiers.has_key( name ):
|
elif self.identifiers.has_key( name ):
|
||||||
# this is a known identifier
|
# this is a known identifier
|
||||||
block = self.identifiers[name]
|
block = self.identifiers[name]
|
||||||
|
id = block.name
|
||||||
|
|
||||||
|
# link to a field ID if possible
|
||||||
|
for markup in block.markups:
|
||||||
|
if markup.tag == 'values':
|
||||||
|
for field in markup.fields:
|
||||||
|
if field.name:
|
||||||
|
id = name
|
||||||
|
|
||||||
result = ( result + prefix
|
result = ( result + prefix
|
||||||
+ '<a href="' + self.make_block_url( block )
|
+ '<a href="'
|
||||||
|
+ self.make_block_url( block, id )
|
||||||
+ '">' + name + '</a>' )
|
+ '">' + name + '</a>' )
|
||||||
else:
|
else:
|
||||||
result = result + html_quote( line[:length] )
|
result = result + html_quote( line[:length] )
|
||||||
|
@ -428,7 +440,7 @@ class HtmlFormatter( Formatter ):
|
||||||
def print_html_field_list( self, fields ):
|
def print_html_field_list( self, fields ):
|
||||||
print '<table class="fields">'
|
print '<table class="fields">'
|
||||||
for field in fields:
|
for field in fields:
|
||||||
print ( '<tr><td class="val">'
|
print ( '<tr><td class="val" id="' + field.name + '">'
|
||||||
+ field.name
|
+ field.name
|
||||||
+ '</td><td class="desc">' )
|
+ '</td><td class="desc">' )
|
||||||
self.print_html_items( field.items )
|
self.print_html_items( field.items )
|
||||||
|
|
Loading…
Reference in New Issue