[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kdoc
Subject:    SGML and cross references
From:       Wolfgang Bangerth <Wolfgang.Bangerth () IWR ! Uni-Heidelberg ! De>
Date:       1999-12-13 17:14:53
[Download RAW message or body]


Another patch: SGML (or at least jade) has a hardcoded maximal length for
xref names of only 44 characters. This is not much in our case, since up
to now, xref names contained class names, etc. Therefore the appended
patch.

Note: I am not familiar with perl packages, so the declaration of global
variables may be against all rules. Also, I don't know about the right
format for documenting the new function encodeXref.

Note 2: the second hunk of the patch just assigns a name to the output, if
none was given (which is what I always forget).

Regards
  Wolfgang

-------------------------------------------------------------------------
Wolfgang Bangerth          email: wolfgang.bangerth@iwr.uni-heidelberg.de
                             www: http://gaia.iwr.uni-heidelberg.de/~wolf


*** kdocCxxDocbook.pm.2	Sat Dec  4 13:59:23 1999
--- kdocCxxDocbook.pm	Mon Dec 13 18:09:16 1999
***************
*** 8,13 ****
--- 8,22 ----
  
  use vars qw/ $lib $rootnode $outputdir $opt @docqueue /;
  
+ 
+ # the following two variables are used to encode function and 
+ # other names into numbers, since SGML has a maximum length
+ # of 44 characters per xref label, which is not so very much
+ # if names include class names, etc
+ my $xrefCounter = 0;
+ my %xrefEncoding;
+ 
+ 
  # public, protected, private
  # within each:
  	# types/typedefs
***************
*** 20,25 ****
--- 29,39 ----
  {
  	( $lib, $rootnode, $outputdir, $opt ) = @_;
  
+ 	# if no library name given: assign one
+ 	if ( $lib eq "" ) {
+ 	    $lib = "noname";
+ 	}
+ 
  	@docqueue = ();
  
  	mkpath( $outputdir) unless -f $outputdir;
***************
*** 147,153 ****
  	
  	## document self and children
  	
! 	print DOC '<Sect1 id="doc-', escapeSGML( fullName( $node, '-' ) ), 
  		'" XRefLabel="', escapeSGML( fullName( $node, "::") ) ,'">', "\n",
  		tblk( "title", $node->{NodeType}." ". fullName( $node, "::" ) );
  
--- 161,167 ----
  	
  	## document self and children
  	
! 	print DOC '<Sect1 id="doc-', encodeXref(escapeSGML( fullName( $node, '--' ) ) ), 
  		'" XRefLabel="', escapeSGML( fullName( $node, "::") ) ,'">', "\n",
  		tblk( "title", $node->{NodeType}." ". fullName( $node, "::" ) );
  
***************
*** 347,353 ****
  		|| !kdocAstUtil::hasDoc( $node );
  
  	return "<xref LinkEnd=\"doc-" .
!                escapeSGML(fullName( $node, "--")) . "\">";
  }
  
  sub fullName
--- 361,367 ----
  		|| !kdocAstUtil::hasDoc( $node );
  
  	return "<xref LinkEnd=\"doc-" .
!                encodeXref (escapeSGML(fullName( $node, "--"))) . "\">";
  }
  
  sub fullName
***************
*** 367,372 ****
--- 381,402 ----
      return $name;
  }
  
+ 
+ sub encodeXref
+ {
+     my ( $name ) = $_[0];
+ 
+     # if this $name has not been encode before: enter it 
+     # to the global list of encoded names
+     if ( ! defined $xrefEncoding{$name} ) {
+ 	$xrefEncoding{$name} = $xrefCounter;
+ 	$xrefCounter++;
+     }
+ 
+     return $xrefEncoding{$name};
+ }
+ 
+ 
  sub print
  {
  	

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic