@@ -30,7 +30,50 @@ use Log::Log4perl;
3030
3131our $VERSION = ' 1.72' ;
3232$VERSION = eval $VERSION ;
33+ our $labelCnt = 0; # label counter to see to it that when e.g. twice a =head1 NAME in a file it is still an unique label
34+ our $sectionLabel = ' x' ;
3335
36+ sub convertText
37+ {
38+ # based on e.g. a file name try to create a doxygen label prefix
39+ my $label = shift ;
40+ $label =~ s / _/ __/ g ;
41+ $label =~ s / :/ _1/ g ;
42+ $label =~ s /\/ / _2/ g ;
43+ $label =~ s / </ _3/ g ;
44+ $label =~ s / >/ _4/ g ;
45+ $label =~ s /\* / _5/ g ;
46+ $label =~ s / &/ _6/ g ;
47+ $label =~ s /\| / _7/ g ;
48+ $label =~ s /\. / _8/ g ;
49+ $label =~ s / !/ _9/ g ;
50+ $label =~ s / ,/ _00/ g ;
51+ $label =~ s / / _01/ g ;
52+ $label =~ s / {/ _02/ g ;
53+ $label =~ s / }/ _03/ g ;
54+ $label =~ s /\? / _04/ g ;
55+ $label =~ s /\^ / _05/ g ;
56+ $label =~ s / %/ _06/ g ;
57+ $label =~ s /\( / _07/ g ;
58+ $label =~ s /\) / _08/ g ;
59+ $label =~ s /\+ / _09/ g ;
60+ $label =~ s / =/ _0A/ g ;
61+ $label =~ s /\$ / _0B/ g ;
62+ $label =~ s /\\ / _0C/ g ;
63+ $label =~ s / @/ _0D/ g ;
64+ $label =~ s / -/ _0E/ g ;
65+ $label =~ s / [^a-z0-9A-Z]/ _/ g ;
66+ print (" New $label \n " );
67+
68+ $label = " x$label " ; # label should not start with a underscore
69+ }
70+ sub setAsLabel
71+ {
72+ # based on e.g. a file name try to create a doxygen label prefix
73+ my $self = shift ;
74+ my $tmpLabel = shift ;
75+ $sectionLabel = convertText($tmpLabel );
76+ }
3477
3578sub view_pod
3679{
@@ -42,18 +85,36 @@ sub view_head1
4285{
4386 my ($self , $head1 ) = @_ ;
4487 my $title = $head1 -> title-> present($self );
45- my $name = $title ;
46- $name =~ s / \s / _ / g ;
47- return " \n\@ section $name $title \n " . $head1 -> content-> present($self );
88+ my $name = convertText( $title ) ;
89+ $labelCnt += 1 ;
90+ return " \n\@ section $sectionLabel$ name$labelCnt $title \n " . $head1 -> content-> present($self );
4891}
4992
5093sub view_head2
5194{
5295 my ($self , $head2 ) = @_ ;
5396 my $title = $head2 -> title-> present($self );
54- my $name = $title ;
55- $name =~ s /\s / _/ g ;
56- return " \n\@ subsection $name $title \n " . $head2 -> content-> present($self );
97+ my $name = convertText($title );
98+ $labelCnt += 1;
99+ return " \n\@ subsection $sectionLabel$name$labelCnt $title \n " . $head2 -> content-> present($self );
100+ }
101+
102+ sub view_head3
103+ {
104+ my ($self , $head3 ) = @_ ;
105+ my $title = $head3 -> title-> present($self );
106+ my $name = convertText($title );
107+ $labelCnt += 1;
108+ return " \n\@ subsubsection $sectionLabel$name$labelCnt $title \n " . $head3 -> content-> present($self );
109+ }
110+
111+ sub view_head4
112+ {
113+ my ($self , $head4 ) = @_ ;
114+ my $title = $head4 -> title-> present($self );
115+ my $name = convertText($title );
116+ $labelCnt += 1;
117+ return " \n\@ paragraph $sectionLabel$name$labelCnt $title \n " . $head4 -> content-> present($self );
57118}
58119
59120sub view_seq_code
0 commit comments