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'; |
131 |
$opt{title} ||= 'Document Structure'; |
$opt{title} ||= 'Document Structure'; |
132 |
$opt{short_title} ||= 'Structure'; |
$opt{short_title} ||= 'Structure'; |
133 |
delete $opt{role}; |
delete $opt{role}; |
134 |
|
} elsif ($opt{role} eq 'subdoc') { |
135 |
|
$class .= ' subdoc'; |
136 |
|
delete $opt{role}; |
137 |
} |
} |
138 |
} |
} |
139 |
|
|
140 |
$self->{section_rank}++; |
$self->{section_rank}++; |
141 |
$self->html ('<div class=section'); |
$self->html (qq[<div class="$class"]); |
142 |
if (defined $opt{id}) { |
if (defined $opt{id}) { |
143 |
my $id = $self->input->id_prefix . $opt{id}; |
my $prefix = $self->input->id_prefix; |
144 |
|
$opt{parent_id} ||= $prefix; |
145 |
|
my $id = $prefix . $opt{id}; |
146 |
$self->html (' id="' . $htescape->($id) . '">'); |
$self->html (' id="' . $htescape->($id) . '">'); |
147 |
if ($self->{section_rank} == 2 or defined $opt{parent_id}) { |
if ($self->{section_rank} == 2 or length $opt{parent_id}) { |
148 |
my $st = $opt{short_title} || $opt{title}; |
my $st = $opt{short_title} || $opt{title}; |
149 |
push @{$self->{nav}}, |
push @{$self->{nav}}, |
150 |
[$id => $st => $opt{text}]; |
[$id => $st => $opt{text}]; |
151 |
|
|
152 |
$self->start_tag ('script'); |
$self->start_tag ('script'); |
153 |
$self->html (qq[ addSectionLink ('] . $self->input->id_prefix . |
$self->html (qq[ addSectionLink ('$id', ']); |
|
qq[$id', ']); |
|
154 |
$self->nl_text ($st, text => $opt{text}); |
$self->nl_text ($st, text => $opt{text}); |
155 |
if (defined $opt{parent_id}) { |
if (defined $opt{parent_id}) { |
156 |
$self->html (q[', '] . $opt{parent_id}); |
$self->html (q[', '] . $opt{parent_id}); |