104 |
sub start_section ($%) { |
sub start_section ($%) { |
105 |
my ($self, %opt) = @_; |
my ($self, %opt) = @_; |
106 |
|
|
107 |
|
my $class = 'section'; |
108 |
if (defined $opt{role}) { |
if (defined $opt{role}) { |
109 |
if ($opt{role} eq 'parse-errors') { |
if ($opt{role} eq 'parse-errors') { |
110 |
$opt{id} ||= 'parse-errors'; |
$opt{id} ||= 'parse-errors'; |
111 |
$opt{title} ||= 'Parse Errors Section'; |
$opt{title} ||= 'Parse Errors Section'; |
112 |
$opt{short_title} ||= 'Parse Errors'; |
$opt{short_title} ||= 'Parse Errors'; |
113 |
|
$class .= ' errors'; |
114 |
delete $opt{role}; |
delete $opt{role}; |
115 |
} elsif ($opt{role} eq 'structure-errors') { |
} elsif ($opt{role} eq 'structure-errors') { |
116 |
$opt{id} ||= 'document-errors'; |
$opt{id} ||= 'document-errors'; |
117 |
$opt{title} ||= 'Structural Errors'; |
$opt{title} ||= 'Structural Errors'; |
118 |
$opt{short_title} ||= 'Struct. Errors'; |
$opt{short_title} ||= 'Struct. Errors'; |
119 |
|
$class .= ' errors'; |
120 |
delete $opt{role}; |
delete $opt{role}; |
121 |
} elsif ($opt{role} eq 'reformatted') { |
} elsif ($opt{role} eq 'reformatted') { |
122 |
$opt{id} ||= 'document-tree'; |
$opt{id} ||= 'document-tree'; |
123 |
$opt{title} ||= 'Reformatted Document Source'; |
$opt{title} ||= 'Reformatted Document Source'; |
124 |
$opt{short_title} ||= 'Reformatted'; |
$opt{short_title} ||= 'Reformatted'; |
125 |
|
$class .= ' dump'; |
126 |
delete $opt{role} |
delete $opt{role} |
127 |
} elsif ($opt{role} eq 'tree') { |
} elsif ($opt{role} eq 'tree') { |
128 |
$opt{id} ||= 'document-tree'; |
$opt{id} ||= 'document-tree'; |
129 |
$opt{title} ||= 'Document Tree'; |
$opt{title} ||= 'Document Tree'; |
130 |
$opt{short_title} ||= 'Tree'; |
$opt{short_title} ||= 'Tree'; |
131 |
|
$class .= ' dump'; |
132 |
delete $opt{role}; |
delete $opt{role}; |
133 |
} elsif ($opt{role} eq 'structure') { |
} elsif ($opt{role} eq 'structure') { |
134 |
$opt{id} ||= 'document-structure'; |
$opt{id} ||= 'document-structure'; |
135 |
$opt{title} ||= 'Document Structure'; |
$opt{title} ||= 'Document Structure'; |
136 |
$opt{short_title} ||= 'Structure'; |
$opt{short_title} ||= 'Structure'; |
137 |
|
$class .= ' dump'; |
138 |
|
delete $opt{role}; |
139 |
|
} elsif ($opt{role} eq 'subdoc') { |
140 |
|
$class .= ' subdoc'; |
141 |
|
delete $opt{role}; |
142 |
|
} elsif ($opt{role} eq 'source') { |
143 |
|
$opt{id} ||= 'source-string'; |
144 |
|
$opt{title} ||= 'Document Source'; |
145 |
|
$opt{short_title} ||= 'Source'; |
146 |
|
$class .= ' source'; |
147 |
delete $opt{role}; |
delete $opt{role}; |
148 |
} |
} |
149 |
} |
} |
150 |
|
|
151 |
$self->{section_rank}++; |
$self->{section_rank}++; |
152 |
$self->html ('<div class=section'); |
$self->html (qq[<div class="$class"]); |
153 |
if (defined $opt{id}) { |
if (defined $opt{id}) { |
154 |
my $id = $self->input->id_prefix . $opt{id}; |
my $prefix = $self->input->id_prefix; |
155 |
|
$opt{parent_id} ||= $prefix; |
156 |
|
my $id = $prefix . $opt{id}; |
157 |
$self->html (' id="' . $htescape->($id) . '">'); |
$self->html (' id="' . $htescape->($id) . '">'); |
158 |
if ($self->{section_rank} == 2 or defined $opt{parent_id}) { |
if ($self->{section_rank} == 2 or length $opt{parent_id}) { |
159 |
my $st = $opt{short_title} || $opt{title}; |
my $st = $opt{short_title} || $opt{title}; |
160 |
push @{$self->{nav}}, |
push @{$self->{nav}}, |
161 |
[$id => $st => $opt{text}]; |
[$id => $st => $opt{text}]; |
162 |
|
|
163 |
$self->start_tag ('script'); |
$self->start_tag ('script'); |
164 |
$self->html (qq[ addSectionLink ('] . $self->input->id_prefix . |
$self->html (qq[ addSectionLink ('$id', ']); |
|
qq[$id', ']); |
|
165 |
$self->nl_text ($st, text => $opt{text}); |
$self->nl_text ($st, text => $opt{text}); |
166 |
if (defined $opt{parent_id}) { |
if (defined $opt{parent_id}) { |
167 |
$self->html (q[', '] . $opt{parent_id}); |
$self->html (q[', '] . $opt{parent_id}); |