->{'float_number'}; my $tree; if ($type_element) { if (defined($float_number)) { $tree = $self->cdt("{float_type} {float_number}", {'float_type' => $type_element, 'float_number' => {'text' => $float_number}}); } else { $tree = $self->cdt("{float_type}", {'float_type' => $type_element}); } } elsif (defined($float_number)) { $tree = $self->cdt("{float_number}", {'float_number' => {'text' => $float_number}}); } return $tree; } sub float_name_caption($$) { my $self = shift; my $element = shift; my $caption_element; if ($element->{'extra'} and $element->{'extra'}->{'caption'}) { $caption_element = $element->{'extra'}->{'caption'}; } elsif ($element->{'extra'} and $element->{'extra'}->{'shortcaption'}) { $caption_element = $element->{'extra'}->{'shortcaption'}; } #if ($self->get_conf('DEBUG')) { # my $caption_texi = # Texinfo::Convert::Texinfo::convert_to_texinfo( # { 'contents' => $caption_element->{'contents'}}); # print STDERR " CAPTION: $caption_texi\n"; #} my $substrings = {}; my $float_number_element; if ($element->{'extra'} and defined($element->{'extra'}->{'float_number'})) { $float_number_element = {'text' => $element->{'extra'}->{'float_number'}}; $substrings->{'float_number'} = $float_number_element; } my $prepended; if ($element->{'extra'} and defined($element->{'extra'}->{'float_type'}) and $element->{'extra'}->{'float_type'} ne '') { $substrings->{'float_type'} = $element->{'args'}->[0]; if ($caption_element) { if ($float_number_element) { # TRANSLATORS: added before caption $prepended = $self->cdt('{float_type} {float_number}: ', $substrings); } else { # TRANSLATORS: added before caption, no float label $prepended = $self->cdt('{float_type}: ', $substrings); } } else { if ($float_number_element) { $prepended = $self->cdt("{float_type} {float_number}", $substrings); } else { $prepended = $self->cdt("{float_type}", $substrings); } } } elsif ($float_number_element) { if ($caption_element) { # TRANSLATORS: added before caption, no float type $prepended = $self->cdt('{float_number}: ', $substrings); } else { $prepended = $self->cdt("{float_number}", $substrings); } } return ($caption_element, $prepended); } sub table_item_content_tree($$) { my $self = shift; my $element = shift; my $table_command = $element->{'parent'}->{'parent'}->{'parent'}; if ($element->{'args'} and $table_command->{'extra'} and $table_command->{'extra'}->{'command_as_argument'}) { my $command_as_argument = $table_command->{'extra'}->{'command_as_argument'}; my $command_as_argument_cmdname = $command_as_argument->{'cmdname'}; my $command = {'cmdname' => $command_as_argument_cmdname, 'source_info' => $element->{'source_info'},}; if ($table_command->{'extra'}->{'command_as_argument_kbd_code'}) { $command->{'extra'} = {'code' => 1}; } # command name for the Texinfo::Commands hashes tests my $builtin_cmdname; if ($command_as_argument->{'type'} and $command_as_argument->{'type'} eq 'definfoenclose_command') { $command->{'type'} = $command_as_argument->{'type'}; $command->{'extra'} = {} if (!$command->{'extra'}); $command->{'extra'}->{'begin'} = $command_as_argument->{'extra'}->{'begin'}; $command->{'extra'}->{'end'} = $command_as_argument->{'extra'}->{'end'}; $builtin_cmdname = 'definfoenclose_command'; } else { $builtin_cmdname = $command_as_argument_cmdname; } my $arg; if ($Texinfo::Commands::brace_commands{$builtin_cmdname} eq 'context') { # This corresponds to a bogus @*table line with command line @footnote # or @math. We do not really care about the formatting of the result # but we want to avoid debug messages, so we setup expected trees # for those @-commands. $arg = {'type' => 'brace_command_context', 'parent' => $command,}; if ($Texinfo::Commands::math_commands{$builtin_cmdname}) { $arg->{'contents'} = [$element->{'args'}->[0]]; } else { my $paragraph = {'type' => 'paragraph', 'contents' => [$element->{'args'}->[0]], 'parent' => $arg}; $arg->{'contents'} = [$paragraph]; } } elsif ($Texinfo::Commands::brace_commands{$builtin_cmdname} eq 'arguments') { $arg = {'type' => 'brace_arg', 'contents' => [$element->{'args'}->[0]], 'parent' => $command,}; } else { $arg = {'type' => 'brace_container', 'contents' => [$element->{'args'}->[0]], 'parent' => $command,}; } $command->{'args'} = [$arg]; return $command; } return undef; } sub convert_accents($$$;$$) { my $self = shift; my $accent = shift; my $format_accents = shift; my $output_encoded_characters = shift; my $in_upper_case = shift; my ($contents_element, $stack) = Texinfo::Convert::Utils::find_innermost_accent_contents($accent); my $arg_text = ''; if (defined($contents_element)) { # NOTE the explanation argument is HTML specific, it may theoretically # be used for something else in other formats. The type (string) should # be fixed to the type used in C/XS. $arg_text = $self->convert_tree($contents_element, "ACCENT ARG ".$accent->{'cmdname'}); } if ($output_encoded_characters) { my $encoded = Texinfo::Convert::Unicode::encoded_accents($self, $arg_text, $stack, $self->get_conf('OUTPUT_ENCODING_NAME'), $format_accents, $in_upper_case); if (defined($encoded)) { return $encoded; } } my $result = $arg_text; foreach my $accent_command (reverse(@$stack)) { $result = &$format_accents ($self, $result, $accent_command, $in_upper_case); } return $result; } # index sub-entries specified with @subentry, separated by commas, or by # $SEPARATOR, if set sub comma_index_subentries_tree { my ($self, $current_entry, $separator) = @_; $separator = ', ' if (!defined($separator)); my @contents; while ($current_entry->{'extra'} and $current_entry->{'extra'}->{'subentry'}) { $current_entry = $current_entry->{'extra'}->{'subentry'}; push @contents, {'text' => $separator}, $current_entry->{'args'}->[0]; } if (scalar(@contents)) { return {'contents' => \@contents}; } return undef; } sub get_converter_indices_sorted_by_letter($) { my $self = shift; my $indices_information; if ($self->{'document'}) { $indices_information = $self->{'document'}->indices_information(); if ($indices_information) { my $use_unicode_collation = $self->get_conf('USE_UNICODE_COLLATION'); my $locale_lang; if (!(defined($use_unicode_collation) and !$use_unicode_collation)) { $locale_lang = $self->get_conf('COLLATION_LANGUAGE'); if (!defined($locale_lang) and $self->get_conf('DOCUMENTLANGUAGE_COLLATION')) { $locale_lang = $self->get_conf('documentlanguage'); } } return Texinfo::Document::sorted_indices_by_letter($self->{'document'}, $self, $use_unicode_collation, $locale_lang); } } return undef; } sub get_converter_indices_sorted_by_index($) { my $self = shift; my $indices_information; if ($self->{'document'}) { $indices_information = $self->{'document'}->indices_information(); if ($indices_information) { my $use_unicode_collation = $self->get_conf('USE_UNICODE_COLLATION'); my $locale_lang; if (!(defined($use_unicode_collation) and !$use_unicode_collation)) { $locale_lang = $self->get_conf('COLLATION_LANGUAGE'); if (!defined($locale_lang) and $self->get_conf('DOCUMENTLANGUAGE_COLLATION')) { $locale_lang = $self->get_conf('documentlanguage'); } } return Texinfo::Document::sorted_indices_by_index($self->{'document'}, $self, $use_unicode_collation, $locale_lang); } } return undef; }