[interchange-docs] xmldocs - docelic modified 2 files

docs at icdevgroup.org docs at icdevgroup.org
Wed Apr 12 21:32:07 EDT 2006


User:      docelic
Date:      2006-04-13 01:32:07 GMT
Modified:  bin      generic-autogen refs-autogen
Log:
- add id= to autogenerated docs to suppress xsl 1.69.1 warnings

Revision  Changes    Path
1.15      +2 -1      xmldocs/bin/generic-autogen


rev 1.15, prev_rev 1.14
Index: generic-autogen
===================================================================
RCS file: /var/cvs/xmldocs/bin/generic-autogen,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- generic-autogen	17 Sep 2005 21:24:01 -0000	1.14
+++ generic-autogen	13 Apr 2006 01:32:07 -0000	1.15
@@ -111,7 +111,8 @@
 		next unless $alphabet{$letter}; # Next if no entries on that letter
 		print "Passed on $letter\n" if $verbose;
 
-		$document .= '<glossdiv><title>' . uc($letter) . '</title>' . "\n";
+		$document .= '<glossdiv id="' . uc($letter) . '"><title>' .
+			uc($letter) . '</title>' . "\n";
 
 		my @keys = sort grep {/^$letter/i} keys %items;
 		for my $key ( @keys ) {



1.108     +24 -4     xmldocs/bin/refs-autogen


rev 1.108, prev_rev 1.107
Index: refs-autogen
===================================================================
RCS file: /var/cvs/xmldocs/bin/refs-autogen,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -r1.107 -r1.108
--- refs-autogen	8 Apr 2006 23:45:55 -0000	1.107
+++ refs-autogen	13 Apr 2006 01:32:07 -0000	1.108
@@ -151,7 +151,7 @@
 # The header is inserted
 # *after* <title>, if title was specified in section definition.
 my %item_header = (
-	example => "<example>\n%s<para>",
+	example => "<example id='%s'>\n%s<para>",
 	online => "<example>\n%s<para>",
 );
 my %item_footer = (
@@ -526,10 +526,11 @@
 
 					{ no warnings; # XXX If someone can figure out which of the used vars here is undefined...
 #<screen linenumbering='numbered' startinglinenumber='$ls'>
+					my $id = make_ok_for_id('context', "$loc $revinfo$ctxmeta", 1);
 					$$ag{source} .= <<ENDD;
 <para>
 </para>
-<figure>
+<figure id="$id">
 <title>$loc $revinfo$ctxmeta</title>
 
 <screen>
@@ -1100,8 +1101,11 @@
 					# XXX in the next line we don't treat ** example"2": title **
 					# properly!
 					$section = $sec;
-					$title = $title ? "<title>$title</title>" : "";
-					$pre_content =  sprintf($item_header{$section}||"", $title);
+
+					my $id = make_ok_for_id('', $title||"", 1);
+					$title = $title ?  "<title id='title_$id'>$title</title>" : '';
+					$pre_content =  sprintf($item_header{$section}||"",
+							"example_$id", $title);
 					$post_content = sprintf($item_footer{$section}||"", $title);
 					next
 
@@ -1325,5 +1329,21 @@
 		next if /CVS|svn/;
 		$templates{$_} = readfile("docbook/symbol-templates/$_");
 	}
+}
+
+# Turn any text into text suitable to put as ID. Needed at least for 
+# 1.69.1 xsl stylesheets to satisfy warnings.
+# First argument is prefix, such as 'context', 'example', etc.. Should
+# be meaningful but anything is OK. Second is the text to "IDize", and 
+# third optional field is a yes/no for unique number appended (that's 
+# good when you want to forcibly avoid the call to return already 
+# defined IO).
+my $uniq = 0;
+sub make_ok_for_id {
+	my ($pref, $text, $unq) = @_;
+	$pref and $pref .= '_';
+	$text =~ s/\W/_/g;
+	$unq and $unq = '_' . $uniq++ or $unq = '';
+	"${pref}${text}$unq"
 }
 








More information about the docs mailing list