@@ -1038,7 +1038,6 @@ def html_chapter_table(f, table_num, chapter_name, nr_defs, tags, tag_fname2url)
10381038 instances_str = "[" + nr . instances . join ( ', ' ) + "]"
10391039 rule_name = "instances"
10401040 end
1041- instances_str = ( nr . instances . size > 1 ) ? ( "[" + nr . instances . join ( ', ' ) + "]" ) : nr . instances [ 0 ]
10421041 f . puts ( %Q{ <tr>} ) unless row_started
10431042 f . puts ( %Q{ <td>#{ instances_str } </td>} )
10441043 f . puts ( %Q{ <td>Rule's "#{ rule_name } " property</td>} )
@@ -1050,24 +1049,29 @@ def html_chapter_table(f, table_num, chapter_name, nr_defs, tags, tag_fname2url)
10501049 tag = tags . get_tag ( tag_ref )
10511050 fatal ( "Normative rule #{ nr . name } defined in file #{ nr . def_filename } references non-existent tag #{ tag_ref } " ) if tag . nil?
10521051
1053- tag_text = tag . text
1052+ html_fname = tag_fname2url [ tag . tag_filename ]
1053+ fatal ( "No fname tag to HTML mapping (-tag2url cmd line arg) for tag fname #{ tag . tag_filename } for tag name #{ tag . name } " ) if html_fname . nil?
1054+
1055+ tag_text = html_convert_newlines ( limit_table_rows ( Adoc2HTML ::convert ( tag . text ) ) )
10541056
1055- tag_text = html_convert_newlines ( limit_table_rows ( Adoc2HTML ::convert ( tag_text ) ) )
10561057
10571058 # Convert adoc links to normative text in tag text to html links.
10581059 #
10591060 # Supported formats:
1060- # <<#{NORM_PREFIX}foo>>
1061- # <<#{NORM_PREFIX}foo,custom text>>
1062- tag_text . gsub! ( /#{ LT_UNICODE_STR } #{ LT_UNICODE_STR } #{ NORM_PREFIX } ([^,]+)#{ GT_UNICODE_STR } #{ GT_UNICODE_STR } / ) do
1063- tag2html_link ( "#{ NORM_PREFIX } #{ $1} " , nr , tags , tag_fname2url )
1061+ # <<link>>
1062+ # <<link,custom text>>
1063+ #
1064+ # Can assume that the link is to the same HTML standards document as the
1065+ # tag text that it is found in because these kind of links only link within their document.
1066+ tag_text . gsub! ( /#{ LT_UNICODE_STR } #{ LT_UNICODE_STR } ([^,]+)#{ GT_UNICODE_STR } #{ GT_UNICODE_STR } / ) do
1067+ tag2html_link ( $1, $1, html_fname )
10641068 end
10651069
1066- tag_text . gsub! ( /#{ LT_UNICODE_STR } #{ LT_UNICODE_STR } #{ NORM_PREFIX } ([^,]+),(.+)#{ GT_UNICODE_STR } #{ GT_UNICODE_STR } / ) do
1067- tag2html_link ( " #{ NORM_PREFIX } #{ $1 } " , nr , tags , tag_fname2url , $2 )
1070+ tag_text . gsub! ( /#{ LT_UNICODE_STR } #{ LT_UNICODE_STR } ([^,]+),(.+)#{ GT_UNICODE_STR } #{ GT_UNICODE_STR } / ) do
1071+ tag2html_link ( $1 , $2 , html_fname )
10681072 end
10691073
1070- tag_link = tag2html_link ( tag_ref , nr , tags , tag_fname2url )
1074+ tag_link = tag2html_link ( tag_ref , tag_ref , html_fname )
10711075
10721076 f . puts ( %Q{ <tr>} ) unless row_started
10731077 f . puts ( %Q{ <td>#{ tag_text } </td>} )
@@ -1082,21 +1086,12 @@ def html_chapter_table(f, table_num, chapter_name, nr_defs, tags, tag_fname2url)
10821086 f . puts ( %Q{ </section>} )
10831087end
10841088
1085- def tag2html_link ( tag_ref , nr , tags , tag_fname2url , custom_text = nil )
1089+ def tag2html_link ( tag_ref , link_text , html_fname )
10861090 fatal ( "Expected String for tag_ref but was passed a #{ tag_ref } .class" ) unless tag_ref . is_a? ( String )
1087- fatal ( "Need NormativeRule for nr but passed a #{ nr . class } " ) unless nr . is_a? ( NormativeRuleDef )
1088- fatal ( "Need NormativeTags for tags but passed a #{ tags . class } " ) unless tags . is_a? ( NormativeTags )
1089- fatal ( "Need Hash for tag_fname2url but passed a #{ tag_fname2url . class } " ) unless tag_fname2url . is_a? ( Hash )
1090-
1091- tag = tags . get_tag ( tag_ref )
1092- fatal ( "Normative rule #{ nr . name } defined in file #{ nr . def_filename } references non-existent tag #{ tag_ref } " ) if tag . nil?
1093-
1094- html_fname = tag_fname2url [ tag . tag_filename ]
1095- fatal ( "No fname tag to HTML mapping (-tag2url cmd line arg) for tag fname #{ tag . tag_filename } for tag name #{ tag . name } " ) if html_fname . nil?
1096-
1097- text = custom_text . nil? ? tag_ref : custom_text
1091+ fatal ( "Expected String for link_text but was passed a #{ link_text } .class" ) unless link_text . is_a? ( String )
1092+ fatal ( "Expected String for html_fname but was passed a #{ html_fname } .class" ) unless html_fname . is_a? ( String )
10981093
1099- return %Q{<a href="#{ html_fname } ##{ tag_ref } ">#{ text } </a>}
1094+ return %Q{<a href="#{ html_fname } ##{ tag_ref } ">#{ link_text } </a>}
11001095end
11011096
11021097def html_script ( f )
0 commit comments