Annotation of OpenXM/src/asir-doc/texi2html, Revision 1.3
1.3 ! takayama 1: #! /usr/local/bin/perl --
! 2: # perl
1.1 noro 3: 'di ';
4: 'ig 00 ';
1.3 ! takayama 5: # texi2html: generated by addformats.sh from texi2html.temp and formats/html.init formats/info.init formats/docbook.init formats/xml.init formats/plaintext.init
! 6: # texi2html.temp: generated by buildt2h.sh from texi2html_configured.pl and MySimple.pm T2h_i18n.pm texi2html.init translations.pl examples/l2h.init T2h_l2h.pm documentlanguages.pl
1.1 noro 7: #+##############################################################################
1.3 ! takayama 8: #
! 9: # texi2html: Program to transform Texinfo documents to HTML
! 10: #
! 11: # Copyright (C) 1999-2010 Patrice Dumas <pertusus@free.fr>,
! 12: # Derek Price <derek@ximbiot.com>,
! 13: # Adrian Aichner <adrian@xemacs.org>,
! 14: # & others.
! 15: #
! 16: # This program is free software; you can redistribute it and/or modify
! 17: # it under the terms of the GNU General Public License as published by
! 18: # the Free Software Foundation; either version 2 of the License, or
! 19: # (at your option) any later version.
! 20: #
! 21: # This program is distributed in the hope that it will be useful,
! 22: # but WITHOUT ANY WARRANTY; without even the implied warranty of
! 23: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 24: # GNU General Public License for more details.
! 25: #
! 26: # You should have received a copy of the GNU General Public License
! 27: # along with this program; if not, write to the Free Software
! 28: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
! 29: # 02110-1301 USA
! 30: #
! 31: # Some error messages come from texinfo (makeinfo), so copyright holder
! 32: # is the FSF or the individual who wrote them. All come from before the
! 33: # switch of texinfo to GPLv3+.
! 34: #
1.1 noro 35: #-##############################################################################
36: # The man page for this program is included at the end of this file and can be
37: # viewed using the command 'nroff -man texi2html'.
38:
1.3 ! takayama 39: # for POSIX::setlocale and File::Spec
! 40: require 5.00405;
! 41: # Perl pragma to restrict unsafe constructs
! 42: use strict;
! 43: # used in case of tests, to revert to "C" locale.
! 44: use POSIX qw(setlocale LC_ALL LC_CTYPE);
! 45: # used to obtain the name of the current working directory
! 46: use Cwd;
! 47: # Used to find the parent directory of this script.
! 48: use File::Basename;
! 49: # used to find a relative path back to the current working directory
! 50: use File::Spec;
! 51: # to determine the path separator and null file
! 52: use Config;
! 53:
! 54: #use encoding::warnings;
! 55: # for translations
! 56: #use encoding 'utf8';
! 57: #use utf8;
1.1 noro 58:
59: #
1.3 ! takayama 60: # According to
! 61: # larry.jones@sdrc.com (Larry Jones)
! 62: # this pragma is not present in perl5.004_02:
1.1 noro 63: #
1.3 ! takayama 64: # Perl pragma to control optional warnings
! 65: # use warnings;
1.1 noro 66:
1.3 ! takayama 67: # determine the path separators
! 68: my $path_separator = $Config{'path_sep'};
! 69: $path_separator = ':' if (!defined($path_separator));
! 70: my $quoted_path_separator = quotemeta($path_separator);
! 71:
! 72: #++##########################################################################
1.1 noro 73: #
1.3 ! takayama 74: # NOTE FOR DEBUGGING THIS SCRIPT:
! 75: # You can run 'perl -x texi2html.pl' directly, provided you have the script
! 76: # in the same directory with, or the environment variable T2H_HOME set to
! 77: # the directory containing, the texi2html.init, T2h_i18n.pm, translations.pl,
! 78: # l2h.init, & T2h_l2h.pm files. Ditto makeinfo.pl, if you make it a
! 79: # symlink to texi2html.pl.
1.1 noro 80: #
1.3 ! takayama 81: #--##########################################################################
! 82: my $T2H_HOME = defined $ENV{T2H_HOME} ? $ENV{T2H_HOME} : dirname $0;
! 83: if ($0 =~ /\.pl$/)
! 84: {
! 85: # Issue a warning in debugging mode if $T2H_HOME is set but isn't
! 86: # accessible.
! 87: if (!-e $T2H_HOME)
! 88: { warn "T2H_HOME ($T2H_HOME) does not exist."; }
! 89: elsif (!-d $T2H_HOME)
! 90: { warn "T2H_HOME ($T2H_HOME) is not a directory."; }
! 91: elsif (!-x $T2H_HOME)
! 92: { warn "T2H_HOME ($T2H_HOME) is not accessible."; }
! 93: }
! 94:
! 95: # CVS version:
! 96: # $Id: texi2html.pl,v 1.393 2010/06/30 22:01:27 pertusus Exp $
! 97:
! 98: # FIXME. Change for texinfo, and also simplify.
! 99:
! 100: # Homepage:
! 101: my $T2H_HOMEPAGE = "http://www.nongnu.org/texi2html/";
! 102:
! 103: # Authors (appears in comments):
! 104: my $T2H_AUTHORS = <<EOT;
! 105: texi2html was written by:
! 106: Lionel Cons <Lionel.Cons\@cern.ch> (original author)
! 107: Karl Berry <karl\@freefriends.org>
! 108: Olaf Bachmann <obachman\@mathematik.uni-kl.de>
! 109: and many others.
! 110: Maintained by: Many creative people.
! 111: Send bugs and suggestions to <texi2html-bug\@nongnu.org>
! 112: EOT
! 113:
! 114: # Version: set in configure.in
! 115: my $THISVERSION = '5.0';
! 116: my $THISPROG = "texi2html $THISVERSION"; # program name and version
! 117:
! 118: #+++########################################################################
! 119: # #
! 120: # Paths and file names #
! 121: # #
! 122: #---########################################################################
! 123:
! 124: # set by configure, prefix for the sysconfdir and so on
! 125: my $prefix = '/usr/local';
! 126: my $datarootdir;# = '${prefix}/share';
! 127: my $sysconfdir;
! 128: my $pkgdatadir;
! 129: my $datadir;
! 130:
! 131: # We need to eval as $prefix has to be expanded. However when we haven't
! 132: # run configure @sysconfdir will be expanded as an array, thus we verify
! 133: # whether configure was run or not
! 134: if ('${prefix}/etc' ne '@' . 'sysconfdir@')
! 135: {
! 136: $sysconfdir = eval '"${prefix}/etc"';
! 137: }
! 138: else
! 139: {
! 140: $sysconfdir = "/usr/local/etc";
! 141: }
! 142:
! 143: if ('${prefix}/share' ne '@' . 'datarootdir@')
! 144: {
! 145: $datarootdir = eval '"${prefix}/share"';
! 146: }
! 147: else
! 148: {
! 149: $datarootdir = "/usr/local/share";
! 150: }
! 151:
! 152: if ('${datarootdir}' ne '@' . 'datadir@')
! 153: {
! 154: $pkgdatadir = eval '"${datarootdir}/texi2html"';
! 155: $datadir = eval '"${datarootdir}"';
! 156: }
! 157: else
! 158: {
! 159: $pkgdatadir = "/usr/local/share/texi2html";
! 160: $datadir = "/usr/local/share";
! 161: }
! 162:
! 163: my $target_prefix = "t_h";
1.1 noro 164:
165:
166:
1.3 ! takayama 167: #+++########################################################################
! 168: # #
! 169: # Constants #
! 170: # #
! 171: #---########################################################################
! 172:
! 173: my $DEBUG_MENU = 1;
! 174: my $DEBUG_INDEX = 2;
! 175: my $DEBUG_TEXI = 4;
! 176: my $DEBUG_MACROS = 8;
! 177: my $DEBUG_FORMATS = 16;
! 178: my $DEBUG_ELEMENTS = 32;
! 179: my $DEBUG_USER = 64;
! 180: my $DEBUG_L2H = 128;
! 181:
! 182: my $VARRE = '[\w\-]+'; # RE for a variable name
! 183:
! 184: my $MAX_LEVEL = 4;
! 185: my $MIN_LEVEL = 1;
! 186:
! 187: #+++########################################################################
! 188: # #
! 189: # Command name and default format #
! 190: # #
! 191: #---########################################################################
! 192:
! 193: my $real_command_name = $0;
! 194: $real_command_name =~ s/.*\///;
! 195: $real_command_name =~ s/\.pl$//;
! 196:
! 197: my %command_format = (
! 198: 'texi2html' => 'html',
! 199: 'makeinfo' => 'info',
! 200: 'texi2any' => 'raw-text',
! 201: );
! 202:
! 203: # Config files
! 204:
! 205: my $i18n_dir = 'i18n'; # name of the directory containing the per language files
! 206: my $conf_file_name = 'Config' ;
! 207: my $texinfo_htmlxref = 'htmlxref.cnf';
! 208:
! 209: # directories for texinfo configuration files
! 210: my @texinfo_config_dirs = ('./.texinfo');
! 211: push @texinfo_config_dirs, "$ENV{'HOME'}/.texinfo" if (defined($ENV{'HOME'}));
! 212: push @texinfo_config_dirs, "$sysconfdir/texinfo" if (defined($sysconfdir));
! 213: push @texinfo_config_dirs, "$datadir/texinfo" if (defined($datadir));
! 214:
! 215: my @program_config_dirs;
! 216: my @program_init_dirs;
! 217:
! 218: # program name dependent initializations: config directories and default
! 219: # format.
! 220: sub set_config_init_dirs_output($)
! 221: {
! 222: my $program_name = shift;
! 223: if (!defined($command_format{$program_name}))
! 224: {
! 225: # user can make any link to set $0, or use --program with an unknown name.
! 226: # In that case the default is to use texi2any
! 227: $program_name = 'texi2any';
! 228: }
! 229: my $default_output_format = $command_format{$program_name};
! 230:
! 231:
! 232: # directories for config files
! 233: @program_config_dirs = ('./');
! 234: push @program_config_dirs, "$ENV{'HOME'}/.$program_name/" if (defined($ENV{'HOME'}));
! 235: push @program_config_dirs, "$sysconfdir/$program_name/" if (defined($sysconfdir));
! 236: push @program_config_dirs, "$datadir/$program_name" if (defined($datadir));
! 237:
! 238: # directories for init files
! 239: @program_init_dirs = @program_config_dirs;
! 240: # common directories for all command names
! 241: foreach my $texinfo_config_dir (@texinfo_config_dirs)
! 242: {
! 243: push @program_init_dirs, "${texinfo_config_dir}/init/";
! 244: }
! 245: $Texi2HTML::Config::DEFAULT_OUTPUT_FORMAT = $default_output_format;
! 246: $Texi2HTML::Config::COMMAND_NAME = $program_name;
! 247: Texi2HTML::Config::t2h_default_load_format($default_output_format, 0);
! 248: }
1.1 noro 249:
1.3 ! takayama 250: #+++###########################################################################
! 251: # #
! 252: # Initialization #
! 253: # Some declarations, some functions that are GPL and therefore cannot be in #
! 254: # texi2html.init, some functions that are not to be customized. #
! 255: # Pasted content of File $(srcdir)/texi2html.init: Default initializations #
! 256: # #
! 257: #---###########################################################################
! 258: {
! 259: package Texi2HTML::Config;
! 260:
! 261: use Config;
! 262:
! 263: # customization options variables
! 264:
! 265: use vars qw(
! 266: $DEBUG
! 267: $PREFIX
! 268: $VERBOSE
! 269: $SUBDIR
! 270: $IDX_SUMMARY
! 271: $SPLIT
! 272: $SPLIT_SIZE
! 273: $SHORT_REF
! 274: @EXPAND
! 275: $TOP
! 276: $DOCTYPE
! 277: $FRAMESET_DOCTYPE
! 278: $ERROR_LIMIT
! 279: $CHECK
! 280: $TEST
! 281: $DUMP_TEXI
! 282: $MACRO_EXPAND
! 283: $CAPTION_STYLE
! 284: $USE_ISO
! 285: $TOP_FILE
! 286: $TOC_FILE
! 287: $FRAMES
! 288: $SHOW_MENU
! 289: $SHOW_TITLE
! 290: $NUMBER_SECTIONS
! 291: $NUMBER_FOOTNOTES
! 292: $USE_NODES
! 293: $USE_SECTIONS
! 294: $USE_NODE_TARGET
! 295: $USE_UNICODE
! 296: $USE_UNIDECODE
! 297: $TRANSLITERATE_FILE_NAMES
! 298: $NODE_FILES
! 299: $NODE_FILENAMES
! 300: $NODE_NAME_IN_MENU
! 301: $NODE_NAME_IN_INDEX
! 302: $AVOID_MENU_REDUNDANCY
! 303: $HEADERS
! 304: $NO_WARN
! 305: $FORCE
! 306: $MONOLITHIC
! 307: $SHORTEXTN
! 308: $EXTENSION
! 309: $OUT
! 310: $NOVALIDATE
! 311: $DEF_TABLE
! 312: $DOCUMENTLANGUAGE
! 313: $CONTENTS
! 314: $SHORTCONTENTS
! 315: $FOOTNOTESTYLE
! 316: $FILLCOLUMN
! 317: $SETCONTENTSAFTERTITLEPAGE
! 318: $SETSHORTCONTENTSAFTERTITLEPAGE
! 319: $KBDINPUTSTYLE
! 320: $FRENCHSPACING
! 321: $ALLOWCODEBREAKS
! 322: $SETFILENAME
! 323: $TOC_LINKS
! 324: $L2H
! 325: $L2H_L2H
! 326: $L2H_SKIP
! 327: $L2H_TMP
! 328: $L2H_CLEAN
! 329: $L2H_FILE
! 330: $L2H_HTML_VERSION
! 331: $EXTERNAL_DIR
! 332: @INCLUDE_DIRS
! 333: @PREPEND_DIRS
! 334: @CONF_DIRS
! 335: $IGNORE_PREAMBLE_TEXT
! 336: @CSS_FILES
! 337: @CSS_REFS
! 338: $INLINE_CONTENTS
! 339: $INLINE_INSERTCOPYING
! 340: $PARAGRAPHINDENT
! 341: $FIRSTPARAGRAPHINDENT
! 342: $ENABLE_ENCODING
! 343: $INTERNAL_LINKS
! 344: $DEFAULT_OUTPUT_FORMAT
! 345: $OUTPUT_FORMAT
! 346: $COMMAND_NAME
! 347: @COMMANDS
! 348: );
! 349:
! 350: # customization variables
! 351: use vars qw(
! 352: $ENCODING_NAME
! 353: $DOCUMENT_ENCODING
! 354: $OUT_ENCODING
! 355: $IN_ENCODING
! 356: $DEFAULT_ENCODING
! 357: $MENU_PRE_STYLE
! 358: $MENU_PRE_COMPLEX_FORMAT
! 359: $EXAMPLE_INDENT_CELL
! 360: $SMALL_EXAMPLE_INDENT_CELL
! 361: $SMALL_FONT_SIZE
! 362: $SMALL_RULE
! 363: $DEFAULT_RULE
! 364: $MIDDLE_RULE
! 365: $BIG_RULE
! 366: $TOP_HEADING
! 367: $INDEX_CHAPTER
! 368: $SPLIT_INDEX
! 369: $USE_MENU_DIRECTIONS
! 370: $USE_UP_FOR_ADJACENT_NODES
! 371: $AFTER_BODY_OPEN
! 372: $PRE_BODY_CLOSE
! 373: $EXTRA_HEAD
! 374: $VERTICAL_HEAD_NAVIGATION
! 375: $WORDS_IN_PAGE
! 376: $ICONS
! 377: $UNNUMBERED_SYMBOL_IN_MENU
! 378: $SIMPLE_MENU
! 379: $MENU_SYMBOL
! 380: $MENU_ENTRY_COLON
! 381: $INDEX_ENTRY_COLON
! 382: $USE_ACCESSKEY
! 383: $USE_REL_REV
! 384: $USE_LINKS
! 385: $OPEN_QUOTE_SYMBOL
! 386: $CLOSE_QUOTE_SYMBOL
! 387: $NO_NUMBER_FOOTNOTE_SYMBOL
! 388: $NO_BULLET_LIST_STYLE
! 389: $NO_BULLET_LIST_ATTRIBUTE
! 390: $NO_BULLET_LIST_CLASS
! 391: $TOP_NODE_FILE
! 392: $TOP_NODE_FILE_TARGET
! 393: $TOP_NODE_UP
! 394: $NODE_FILE_EXTENSION
! 395: $STDIN_DOCU_NAME
! 396: $STDOUT_DOCU_NAME
! 397: $BEFORE_OVERVIEW
! 398: $AFTER_OVERVIEW
! 399: $BEFORE_TOC_LINES
! 400: $AFTER_TOC_LINES
! 401: $NEW_CROSSREF_STYLE
! 402: $TOP_HEADING_AT_BEGINNING
! 403: $USE_NUMERIC_ENTITY
! 404: $USE_SETFILENAME
! 405: $USE_SETFILENAME_EXTENSION
! 406: $SEPARATE_DESCRIPTION
! 407: $IGNORE_BEFORE_SETFILENAME
! 408: $OVERVIEW_LINK_TO_TOC
! 409: $COMPLETE_IMAGE_PATHS
! 410: $DATE
! 411: %ACTIVE_ICONS
! 412: %NAVIGATION_TEXT
! 413: %PASSIVE_ICONS
! 414: %BUTTONS_NAME
! 415: %BUTTONS_GOTO
! 416: %BUTTONS_EXAMPLE
! 417: %BUTTONS_ACCESSKEY
! 418: %BUTTONS_REL
! 419: %BUTTONS_TEXT
! 420: @T2H_FORMAT_EXPAND
! 421: @CHAPTER_BUTTONS
! 422: @MISC_BUTTONS
! 423: @SECTION_BUTTONS
! 424: @SECTION_FOOTER_BUTTONS
! 425: @NODE_FOOTER_BUTTONS
! 426: @TOP_BUTTONS
! 427: @LINKS_BUTTONS
! 428: @IMAGE_EXTENSIONS
! 429: @INPUT_FILE_SUFFIXES
! 430: $ENABLE_ENCODING_USE_ENTITY
! 431: $PROGRAM_NAME_IN_FOOTER
! 432: $HEADER_IN_TABLE
! 433: $DATE_IN_HEADER
! 434: $COMPLEX_FORMAT_IN_TABLE
! 435: $USE_TITLEPAGE_FOR_TITLE
! 436: $INLINE_CSS_STYLE
! 437: $NO_CSS
! 438: $I18N_PERL_HASH
! 439: $USE_NLS
! 440: );
! 441:
! 442: # customization variables which may be guessed in the script
! 443: #our $ADDRESS;
! 444: use vars qw(
! 445: $BODYTEXT
! 446: $CSS_LINES
! 447: $DOCUMENT_DESCRIPTION
! 448: $EXTERNAL_CROSSREF_SPLIT
! 449: );
! 450:
! 451: # I18n
! 452: use vars qw(
! 453: $I
! 454: $LANGUAGES
! 455: );
! 456:
! 457: # customizable subroutines references
! 458: use vars qw(
! 459: $print_section
! 460: $one_section
! 461: $end_section
! 462: $print_Top_header
! 463: $print_Top_footer
! 464: $print_Top
! 465: $print_Toc
! 466: $print_Overview
! 467: $print_Footnotes
! 468: $print_About
! 469: $print_misc_header
! 470: $print_misc_footer
! 471: $print_misc
! 472: $print_section_header
! 473: $print_section_footer
! 474: $print_chapter_header
! 475: $print_chapter_footer
! 476: $print_element_header
! 477: $print_page_head
! 478: $print_page_foot
! 479: $print_head_navigation
! 480: $print_foot_navigation
! 481: $print_title
! 482: $button_icon_img
! 483: $button_formatting
! 484: $print_navigation
! 485: $about_body
! 486: $print_frame
! 487: $print_toc_frame
! 488: $toc_body
! 489: $contents
! 490: $internal_links
! 491: $shortcontents
! 492: $titlepage
! 493: $insertcopying
! 494: $css_lines
! 495: $print_redirection_page
! 496: $translate_names
! 497: $init_out
! 498: $finish_out
! 499: $node_file_name
! 500: $element_file_name
! 501: $node_target_name
! 502: $element_target_name
! 503: $placed_target_file_name
! 504: $inline_contents
! 505: $program_string
! 506:
! 507: $preserve_misc_command
! 508: $misc_command_line
! 509: $misc_command_line_texi
! 510: $protect_text
! 511: $anchor
! 512: $anchor_label
! 513: $element_label
! 514: $misc_element_label
! 515: $def_item
! 516: $def
! 517: $menu
! 518: $menu_command
! 519: $menu_link
! 520: $menu_description
! 521: $menu_comment
! 522: $simple_menu_link
! 523: $ref_beginning
! 524: $info_ref
! 525: $book_ref
! 526: $external_href
! 527: $external_ref
! 528: $internal_ref
! 529: $table_item
! 530: $table_line
! 531: $row
! 532: $cell
! 533: $list_item
! 534: $comment
! 535: $def_line
! 536: $def_line_no_texi
! 537: $heading_no_texi
! 538: $raw
! 539: $raw_no_texi
! 540: $heading
! 541: $element_heading
! 542: $heading_text
! 543: $heading_text_preformatted
! 544: $paragraph
! 545: $preformatted
! 546: $empty_preformatted
! 547: $foot_line_and_ref
! 548: $foot_section
! 549: $image
! 550: $image_files
! 551: $index_entry_label
! 552: $index_entry
! 553: $index_entry_command
! 554: $index_letter
! 555: $print_index
! 556: $printindex
! 557: $index_summary
! 558: $summary_letter
! 559: $complex_format
! 560: $cartouche
! 561: $sp
! 562: $definition_category
! 563: $definition_index_entry
! 564: $table_list
! 565: $copying_comment
! 566: $documentdescription
! 567: $index_summary_file_entry
! 568: $index_summary_file_end
! 569: $index_summary_file_begin
! 570: $style
! 571: $line_command
! 572: $format
! 573: $normal_text
! 574: $empty_line
! 575: $unknown
! 576: $unknown_style
! 577: $float
! 578: $caption_shortcaption
! 579: $caption_shortcaption_command
! 580: $listoffloats
! 581: $listoffloats_entry
! 582: $listoffloats_caption
! 583: $listoffloats_float_style
! 584: $listoffloats_style
! 585: $acronym_like
! 586: $quotation
! 587: $quotation_prepend_text
! 588: $paragraph_style_command
! 589: $heading_texi
! 590: $index_element_heading_texi
! 591: $format_list_item_texi
! 592: $begin_format_texi
! 593: $begin_style_texi
! 594: $begin_paragraph_texi
! 595: $tab_item_texi
! 596: $footnote_texi
! 597: $colon_command
! 598: $simple_command
! 599: $thing_command
! 600: $begin_special_region
! 601: $end_special_region
! 602:
! 603: $PRE_ABOUT
! 604: $AFTER_ABOUT
! 605: );
! 606:
! 607: # hash which entries might be redefined by the user
! 608: use vars qw(
! 609: $complex_format_map
! 610: %complex_format_map
! 611: %accent_map
! 612: %def_map
! 613: %format_map
! 614: %simple_map
! 615: %simple_map_pre
! 616: %simple_map_texi
! 617: %simple_map_math
! 618: %style_map
! 619: %style_map_pre
! 620: %style_map_math
! 621: %style_map_texi
! 622: %simple_format_simple_map_texi
! 623: %simple_format_style_map_texi
! 624: %simple_format_texi_map
! 625: %line_command_map
! 626: %command_type
! 627: %paragraph_style
! 628: %stop_paragraph_command
! 629: %format_code_style
! 630: %region_formats_kept
! 631: %texi_formats_map
! 632: %things_map
! 633: %pre_map
! 634: %math_map
! 635: %texi_map
! 636: %sorting_things_map
! 637: %unicode_map
! 638: %unicode_diacritical
! 639: %transliterate_map
! 640: %transliterate_accent_map
! 641: %no_transliterate_map
! 642: %ascii_character_map
! 643: %default_simple_map
! 644: %default_things_map
! 645: %default_texi_map
! 646: %default_style_map
! 647: %default_style_map_pre
! 648: %default_style_map_texi
! 649: %default_simple_format_style_map_texi
! 650: %numeric_entity_map
! 651: %perl_charset_to_html
! 652: %misc_pages_targets
! 653: %misc_command
! 654: %no_paragraph_commands
! 655: %css_map
! 656: %format_in_paragraph
! 657: %special_list_commands
! 658: %accent_letters
! 659: %unicode_accents
! 660: %special_accents
! 661: %inter_item_commands
! 662: $def_always_delimiters
! 663: $def_in_type_delimiters
! 664: $def_argument_separator_delimiters
! 665: %colon_command_punctuation_characters
! 666: $punctuation_characters
! 667: $after_punctuation_characters
! 668: @command_handler_setup
! 669: @command_handler_init
! 670: @command_handler_names
! 671: @command_handler_process
! 672: @command_handler_output
! 673: @command_handler_finish
! 674: %command_handler
! 675: %special_style
! 676: %null_device_file
! 677: %language_codes
! 678: %region_codes
! 679: %deprecated_commands
! 680: %output_format_names
! 681: %canonical_texinfo_encodings
! 682: @text_substitutions_normal
! 683: @text_substitutions_texi
! 684: @text_substitutions_simple_format
! 685: @text_substitutions_pre
! 686: %htmlxref_entries
! 687: );
! 688:
! 689: # deprecated
! 690: use vars qw(
! 691: $address
! 692: %iso_symbols
! 693: %simple_map_pre_math
! 694: %simple_map_texi_math
! 695: $ENCODING
! 696: $CENTER_IMAGE
! 697: $HREF_DIR_INSTEAD_FILE
! 698: $EXPAND
! 699: $USE_GLOSSARY
! 700: $INVISIBLE_MARK
! 701: );
! 702:
! 703: # subject to change
! 704: use vars qw(
! 705: %makeinfo_encoding_to_map
! 706: %makeinfo_unicode_to_eight_bit
! 707: %eight_bit_to_unicode
! 708: %t2h_encoding_aliases
! 709: );
! 710:
! 711: # FIXME i18n ?
! 712: %output_format_names = (
! 713: 'info' => 'Info',
! 714: 'html' => 'HTML',
! 715: 'docbook' => 'Docbook XML',
! 716: 'xml' => 'Texinfo XML',
! 717: 'plaintext' => 'plain text',
! 718: 'raw-text' => 'raw text',
! 719: );
! 720:
! 721: sub load($)
! 722: {
! 723: my $file = shift;
! 724: # If required like other init files, the functions would be redefined
! 725: # and the format dependent stuff wouldn't be loaded. Having the
! 726: # formats loaded could be worked around, for example there could be
! 727: # a variable that, and if the variable is defined a function reference
! 728: # should be called right after the require. There is no real
! 729: # workaround for having the function redefined, though.
! 730: foreach my $output_format (keys(%output_format_names))
! 731: {
! 732: if ($file =~ /\/$output_format\.init$/)
! 733: {
! 734: t2h_default_load_format($output_format, 1);
! 735: return 1;
! 736: }
! 737: }
! 738: eval { require($file) ;};
! 739: if ($@ ne '')
! 740: {
! 741: print STDERR "error loading $file: $@\n";
! 742: return 0;
! 743: }
! 744: return 1;
! 745: }
1.1 noro 746:
747:
1.3 ! takayama 748: sub set_conf($$;$)
! 749: {
! 750: my $name = shift;
! 751: my $value = shift;
! 752: my $not_global = shift;
! 753:
! 754: unless ($not_global)
! 755: {
! 756: if (defined($value))
! 757: {
! 758: $Texi2HTML::GLOBAL{$name} = $value;
! 759: }
! 760: else
! 761: {
! 762: delete $Texi2HTML::GLOBAL{$name};
! 763: }
! 764: return 1;
! 765: }
! 766: return 0 if (defined($Texi2HTML::GLOBAL{$name}));
! 767: if (defined($value))
! 768: {
! 769: $Texi2HTML::THISDOC{$name} = $value;
! 770: }
! 771: else
! 772: {
! 773: delete $Texi2HTML::THISDOC{$name};
! 774: }
! 775: return 1;
! 776: }
1.1 noro 777:
1.3 ! takayama 778: my %config_map = (
! 779: 'paragraphindent' => \$PARAGRAPHINDENT,
! 780: 'firstparagraphindent' => \$FIRSTPARAGRAPHINDENT,
! 781: 'footnotestyle' => \$FOOTNOTESTYLE,
! 782: 'fillcolumn' => \$FILLCOLUMN,
! 783: 'documentlanguage' => \$DOCUMENTLANGUAGE,
! 784: 'novalidate' => \$NOVALIDATE,
! 785: 'SPLIT' => \$SPLIT,
! 786: 'SPLIT_SIZE' => \$SPLIT_SIZE,
! 787: 'contents' => \$CONTENTS,
! 788: 'shortcontents' => \$SHORTCONTENTS,
! 789: 'doctype' => \$DOCTYPE,
! 790: 'headers' => \$HEADERS,
! 791: 'DOCUMENT_ENCODING' => \$DOCUMENT_ENCODING,
! 792: 'IN_ENCODING' => \$IN_ENCODING,
! 793: 'setcontentsaftertitlepage' => \$SETCONTENTSAFTERTITLEPAGE,
! 794: 'setshortcontentsaftertitlepage' => \$SETSHORTCONTENTSAFTERTITLEPAGE,
! 795: 'kbdinputstyle' => \$KBDINPUTSTYLE,
! 796: 'frenchspacing' => \$FRENCHSPACING,
! 797: 'allowcodebreaks' => \$ALLOWCODEBREAKS,
! 798: 'setfilename' => \$SETFILENAME,
! 799: 'use_nls' => \$USE_NLS,
! 800: );
! 801:
! 802: sub get_conf($)
! 803: {
! 804: my $name = shift;
! 805: return $Texi2HTML::THISDOC{$name} if (defined($Texi2HTML::THISDOC{$name}));
! 806: return $Texi2HTML::GLOBAL{$name} if (defined($Texi2HTML::GLOBAL{$name}));
! 807: return ${$config_map{$name}} if (defined($config_map{$name}));
! 808: # there is no default value for many @-commmands, like headings....
! 809: #print STDERR "Unknown conf string: $name\n";
! 810: }
1.1 noro 811:
1.3 ! takayama 812: # manage expanded sections
! 813: sub set_expansion($$)
! 814: {
! 815: my $region = shift;
! 816: my $set = shift;
! 817: $set = 1 if (!defined($set));
! 818: if ($set)
! 819: {
! 820: push (@EXPAND, $region) unless (grep {$_ eq $region} @EXPAND);
! 821: }
! 822: else
! 823: {
! 824: @EXPAND = grep {$_ ne $region} @EXPAND;
! 825: @T2H_FORMAT_EXPAND = grep {$_ ne $region} @T2H_FORMAT_EXPAND;
1.1 noro 826: }
827: }
1.3 ! takayama 828:
! 829: # needed in this namespace for translations
! 830: $I = \&Texi2HTML::I18n::get_string;
! 831: sub gdt($;$$)
! 832: {
! 833: return &main::gdt(@_);
! 834: }
! 835:
! 836: sub __($)
! 837: {
! 838: return &main::__(@_);
! 839: }
! 840:
! 841: sub __p($$)
! 842: {
! 843: return &main::__p(@_);
! 844: }
! 845:
! 846: sub N__($)
! 847: {
! 848: return $_[0];
1.1 noro 849: }
850:
851: #
1.3 ! takayama 852: # Function refs covered by the GPL as part of the texi2html.pl original
! 853: # code. As such they cannot appear in texi2html.init which is public
! 854: # domain (at least the things coded by me, and, if I'm not wrong also the
! 855: # things coded by Olaf -- Pat).
1.1 noro 856: #
1.3 ! takayama 857:
! 858: sub HTML_DEFAULT_shortcontents($$)
! 859: {
! 860: my $elements_list = shift;
! 861: my $stoc_file = shift;
! 862: return unless (Texi2HTML::Config::get_conf('shortcontents') or $FRAMES);
! 863: my $ul_class = '';
! 864: $ul_class = $NO_BULLET_LIST_CLASS if ($NUMBER_SECTIONS);
! 865: my @result = ();
! 866: foreach my $element (@$elements_list)
! 867: {
! 868: next if ($element->{'tag'} eq 'top' or $element->{'toc_level'} != 1);
! 869: my $dest_for_stoc = $element->{'file'};
! 870: my $dest_target_for_stoc = $element->{'target'};
! 871: if ($Texi2HTML::Config::OVERVIEW_LINK_TO_TOC)
! 872: {
! 873: $dest_for_stoc = $Texi2HTML::THISDOC{'toc_file'};
! 874: $dest_target_for_stoc = $element->{'tocid'};
! 875: }
! 876: $dest_for_stoc = '' if ($dest_for_stoc eq $stoc_file);
! 877: my $text = $element->{'text'};
! 878: my $stoc_entry = "<li>" . &$anchor ($element->{'stocid'}, "$dest_for_stoc#$dest_target_for_stoc",$text);
! 879: push(@result, $stoc_entry. "</li>\n");
! 880: }
! 881: if (@result)
! 882: {
! 883: unshift @result, html_default_attribute_class('ul', $ul_class) .">\n";
! 884: push @result, "</ul>\n";
! 885: unshift @result, $BEFORE_OVERVIEW;
! 886: push @result, $AFTER_OVERVIEW;
! 887: }
! 888: return \@result;
1.1 noro 889: }
890:
1.3 ! takayama 891:
! 892: sub HTML_DEFAULT_contents($$)
! 893: {
! 894: my $elements_list = shift;
! 895: my $toc_file = shift;
! 896:
! 897: return unless (Texi2HTML::Config::get_conf('contents'));
! 898:
! 899: my $current_level = 0;
! 900: my $ul_class = '';
! 901: $ul_class = $NO_BULLET_LIST_CLASS if ($NUMBER_SECTIONS);
! 902: my @result = ();
! 903: foreach my $element (@$elements_list)
! 904: {
! 905: next if ($element->{'tag'} eq 'top');
! 906: my $ind = ' ' x $current_level;
! 907: my $level = $element->{'toc_level'};
! 908: print STDERR "Bug no toc_level for ($element) $element->{'texi'}\n" if (!defined ($level));
! 909: if ($level > $current_level)
! 910: {
! 911: while ($level > $current_level)
! 912: {
! 913: $current_level++;
! 914: my $ln = "\n$ind".html_default_attribute_class('ul', $ul_class).">\n";
! 915: $ind = ' ' x $current_level;
! 916: push(@result, $ln);
! 917: }
! 918: }
! 919: elsif ($level < $current_level)
! 920: {
! 921: while ($level < $current_level)
! 922: {
! 923: $current_level--;
! 924: $ind = ' ' x $current_level;
! 925: my $line = "</li>\n$ind</ul>";
! 926: $line .= "</li>" if ($level == $current_level);
! 927: push(@result, "$line\n");
! 928: }
! 929: }
! 930: else
! 931: {
! 932: push(@result, "</li>\n");
! 933: }
! 934: my $dest_for_toc = $element->{'file'};
! 935: my $dest_for_stoc = $element->{'file'};
! 936: my $dest_target_for_stoc = $element->{'target'};
! 937: $dest_for_toc = '' if ($dest_for_toc eq $toc_file);
! 938: my $text = $element->{'text'};
! 939: my $toc_entry = "<li>" . &$anchor ($element->{'tocid'}, "$dest_for_toc#$element->{'target'}",$text);
! 940: push (@result, $ind . $toc_entry);
! 941: }
! 942: while (0 < $current_level)
! 943: {
! 944: $current_level--;
! 945: my $ind = ' ' x $current_level;
! 946: push(@result, "</li>\n$ind</ul>\n");
! 947: }
! 948: if (@result)
! 949: {
! 950: unshift @result, $BEFORE_TOC_LINES;
! 951: push @result, $AFTER_TOC_LINES;
! 952: }
! 953: return \@result;
! 954: }
! 955:
! 956: #$toc_body = \&T2H_GPL_toc_body;
! 957: #$style = \&T2H_GPL_style;
! 958: #$format = \&T2H_GPL_format;
! 959: #$printindex = \&t2h_GPL_default_printindex;
! 960: #$summary_letter = \&t2h_default_summary_letter;
! 961:
! 962:
! 963: sub T2H_GPL_style($$$$$$$$$$)
! 964: { # known style
! 965: my $style = shift;
! 966: my $command = shift;
! 967: my $text = shift;
! 968: my $args = shift;
! 969: my $no_close = shift;
! 970: my $no_open = shift;
! 971: my $line_nr = shift;
! 972: my $state = shift;
! 973: my $style_stack = shift;
! 974: my $kept_line_nrs = shift;
! 975:
! 976: my $do_quotes = 0;
! 977: my $use_attribute = 0;
! 978: my $use_begin_end = 0;
! 979: my $inline_attribute = 0;
! 980: if (ref($style) eq 'HASH')
! 981: {
! 982: #print STDERR "GPL_STYLE $command ($style)\n";
! 983: #print STDERR " @$args\n";
! 984: if (ref($style->{'args'}) ne 'ARRAY')
! 985: {
! 986: print STDERR "BUG: args not an array for command `$command'\n";
! 987: }
! 988: $do_quotes = $style->{'quote'};
! 989: if (defined($style->{'function'}))
! 990: {
! 991: $text = &{$style->{'function'}}($command, $args, $style_stack, $state, $line_nr, $kept_line_nrs);
! 992: }
! 993: elsif (@{$style->{'args'}} == 1)
! 994: {
! 995: if (defined($style->{'inline_attribute'}))
! 996: {
! 997: $style = $style->{'inline_attribute'};
! 998: $use_attribute = 1;
! 999: $inline_attribute = 1;
! 1000: }
! 1001: elsif (defined($style->{'attribute'}))
! 1002: {
! 1003: $style = $style->{'attribute'};
! 1004: $use_attribute = 1;
! 1005: }
! 1006: #$text = $args->[0];
! 1007: }
! 1008: }
! 1009: else
! 1010: {
! 1011: if ($style =~ s/^\"//)
! 1012: { # add quotes
! 1013: $do_quotes = 1;
! 1014: }
! 1015: if ($style =~ s/^\&//)
! 1016: { # custom
! 1017: $style = 'Texi2HTML::Config::' . $style;
! 1018: eval "\$text = &$style(\$text, \$command, \$style_stack)";
! 1019: }
! 1020: elsif ($style ne '')
! 1021: {
! 1022: $use_attribute = 1;
! 1023: }
! 1024: else
! 1025: { # no style
! 1026: }
! 1027: }
! 1028: if ($use_attribute)
! 1029: {
! 1030: my ($attribute_text, $class);
! 1031: ($style, $class, $attribute_text) = html_default_parse_attribute ($style);
! 1032: $text = html_default_attribute_class($style, $class) . "$attribute_text>" . "$text" if (!$no_open or $inline_attribute);
! 1033: $text .= "</$style>" if (!$no_close or $inline_attribute);
! 1034: if ($do_quotes)
! 1035: {
! 1036: $text = $OPEN_QUOTE_SYMBOL . "$text" if (!$no_open);
! 1037: $text .= $CLOSE_QUOTE_SYMBOL if (!$no_close);
! 1038: }
! 1039: }
! 1040: if (ref($style) eq 'HASH')
! 1041: {
! 1042: if (defined($style->{'begin'}) and !$no_open)
! 1043: {
! 1044: $text = $style->{'begin'} . $text;
! 1045: }
! 1046: if (defined($style->{'end'}) and !$no_close)
! 1047: {
! 1048: $text = $text . $style->{'end'};
! 1049: }
! 1050: if (defined($style->{'inline_begin'}))
! 1051: {
! 1052: $text = $style->{'inline_begin'} . $text;
! 1053: }
! 1054: if (defined($style->{'inline_end'}))
! 1055: {
! 1056: $text = $text . $style->{'inline_end'};
! 1057: }
! 1058: }
! 1059: if ($do_quotes and !$use_attribute)
! 1060: {
! 1061: $text = $OPEN_QUOTE_SYMBOL . "$text" if (!$no_open);
! 1062: $text .= $CLOSE_QUOTE_SYMBOL if (!$no_close);
! 1063: }
! 1064: return $text;
! 1065: }
! 1066:
! 1067: sub T2H_GPL_format($$$)
! 1068: {
! 1069: my $tag = shift;
! 1070: my $element = shift;
! 1071: my $text = shift;
! 1072: return '' if (!defined($element) or ($text !~ /\S/));
! 1073: return $text if ($element eq '');
! 1074: my $attribute_text = '';
! 1075: if ($element =~ /^(\w+)(\s+.*)/)
! 1076: {
! 1077: $element = $1;
! 1078: $attribute_text = $2;
! 1079: }
! 1080: return "<${element}$attribute_text>\n" . $text. "</$element>\n";
1.1 noro 1081: }
1.3 ! takayama 1082:
! 1083: # for each index holds the letters split as determined by SPLIT_INDEX.
! 1084: my %t2h_default_index_letters_array;
! 1085: # equivalent of doc_nr, but with files (and hence numbers) added when
! 1086: # a split index leads to an additional element and a file is created.
! 1087: my $t2h_default_file_number;
! 1088: # this is an increasing number to construct the id for each newly
! 1089: # created index element.
! 1090: my $t2h_default_index_id_nr;
! 1091: # this holds the file name associated with an element file, such
! 1092: # as to follow the splitting coming from the main program, and also use
! 1093: # the newly generated files.
! 1094: my %t2h_default_seen_files;
! 1095: # holds the elements and indices that are split to easily set the
! 1096: # directions after they are done in the main program.
! 1097: my $t2h_default_element_split_printindices;
! 1098:
! 1099: # construct a hash of index names holding the letter grouped how they will
! 1100: # be split.
! 1101: sub t2h_default_init_split_indices()
! 1102: {
! 1103: push @command_handler_process, \&t2h_default_index_rearrange_directions;
! 1104: %t2h_default_index_letters_array = ();
! 1105: %t2h_default_seen_files = ();
! 1106: $t2h_default_element_split_printindices = undef;
! 1107: $t2h_default_index_id_nr = 0;
! 1108: $t2h_default_file_number = 0;
! 1109:
! 1110: foreach my $index_name(keys %{$Texi2HTML::THISDOC{'index_letters_array'}})
! 1111: {
! 1112: my $entries_count = 0;
! 1113: my @letters = ();
! 1114: foreach my $letter_entry (@{$Texi2HTML::THISDOC{'index_letters_array'}->{$index_name}})
! 1115: {
! 1116: push @letters, $letter_entry;
! 1117: $entries_count += scalar(@{$letter_entry->{'entries'}});
! 1118: # Don't split if document is not split
! 1119: if (get_conf('SPLIT') and $SPLIT_INDEX and $entries_count >= $SPLIT_INDEX)
! 1120: {
! 1121: push @{$t2h_default_index_letters_array{$index_name}}, [ @letters ];
! 1122: @letters = ();
! 1123: $entries_count = 0;
! 1124: }
! 1125: }
! 1126: push @{$t2h_default_index_letters_array{$index_name}}, [ @letters ] if (scalar(@letters));
1.1 noro 1127: }
1128: }
1129:
1.3 ! takayama 1130: sub t2h_default_associate_index_element($$$$)
! 1131: {
! 1132: my $element = shift;
! 1133: my $is_top = shift;
! 1134: my $docu_name = shift;
! 1135: my $use_node_file = shift;
! 1136:
! 1137: my $default_element_file = $element->{'file'};
! 1138:
! 1139: # redo the file naming -- the doc_nr part -- in case new elements were
! 1140: # inserted upon index split. But respect the default splitting to keep
! 1141: # the elements that are associated with the same file in the same file,
! 1142: # or the added file.
! 1143: if (!$use_node_file or $t2h_default_seen_files{$default_element_file})
! 1144: {
! 1145: my $file;
! 1146: if ($t2h_default_seen_files{$default_element_file})
! 1147: {
! 1148: $file = $t2h_default_seen_files{$default_element_file};
! 1149: }
! 1150: else
! 1151: {
! 1152: if ($is_top eq 'top')
! 1153: { # this is the element_top, so we keep docu_top as associated file.
! 1154: # this, in fact, is not necessary since the element_top is never
! 1155: # associated with another element, but who knows.
! 1156: $t2h_default_seen_files{$default_element_file} = $default_element_file;
! 1157: }
! 1158: else
! 1159: {
! 1160: $file = "${docu_name}_$t2h_default_file_number";
! 1161: $file .= '.' . $Texi2HTML::THISDOC{'extension'} if
! 1162: (defined($Texi2HTML::THISDOC{'extension'}));
! 1163: $t2h_default_seen_files{$default_element_file} = $file;
! 1164: }
! 1165: $t2h_default_file_number++;
! 1166: }
! 1167: $element->{'file'} = $file if (defined($file));
! 1168: }
! 1169:
! 1170: my $level = $element->{'level'};
! 1171:
! 1172: # Even if, without USE_SECTION, output can be split at chapter or
! 1173: # section we don't split indices accordingly. We don't want to add
! 1174: # more cases where users want split indices, this was a very difficult
! 1175: # to maintain feature from the beginning.
! 1176: #$level = $element->{'with_section'}->{'level'} if (!defined($level) and
! 1177: # defined($element->{'with_section'}));
! 1178:
! 1179: # if the element is not the level of splitting, then we don't split.
! 1180: # also if 'top' is set we don't split since the formatting is different
! 1181: # in that case and the result would be quite unpredictable.
! 1182: return if ($element->{'top'} or ((get_conf('SPLIT') ne 'node')
! 1183: and (!defined($level) or $level > $Texi2HTML::THISDOC{'split_level'})));
! 1184:
! 1185: #print STDERR "Doing printindices for $element $element->{'texi'}, file $element->{'file'} (@{$element->{'place'}})\n";
! 1186:
! 1187:
! 1188: # iterate over the @places of the element, which includes associated nodes,
! 1189: # associated elements, anchors, footnotes, floats, index entries,
! 1190: # printindices (including the element command itself, be it a @node or
! 1191: # a sectioning @-command).
! 1192: # during the iteration, split printindices that needs it, and reassociate
! 1193: # other placed elements with files and elements.
! 1194:
! 1195: my $current_element = $element;
! 1196: my @places = @{$element->{'place'}};
! 1197: @{$element->{'place'}} = ();
! 1198:
! 1199: foreach my $place (@places)
! 1200: {
! 1201: my ($printindex, $printindex_to_split, $index_name);
! 1202:
! 1203: # determines if the placed thing is a printindex to be split
! 1204: if ($place->{'command'} and $place->{'command'} eq 'printindex')
! 1205: {
! 1206: $printindex = $place;
! 1207: $index_name = $printindex->{'name'};
! 1208: # ! empty index
! 1209: if (exists($t2h_default_index_letters_array{$index_name}) and
! 1210: # split index
! 1211: scalar(@{$t2h_default_index_letters_array{$index_name}} > 1)
! 1212: # the condition defined($printindex->{'associated_element'} implies
! 1213: # that we don't split printindex before first element, otherwise
! 1214: # there will be a need to begin document without a first element
! 1215: # which would be annoying.
! 1216: and defined($printindex->{'associated_element'}))
! 1217: {
! 1218: $printindex_to_split = 1;
! 1219: }
! 1220: }
! 1221:
! 1222: # this is a non split printindex or any other placed thing.
! 1223: if (!$printindex_to_split)
! 1224: {
! 1225: push @{$current_element->{'place'}}, $place;
! 1226: # don't remodify the original element file, it was set right at the
! 1227: # beginning of the function.
! 1228: $place->{'file'} = $current_element->{'file'} if ($place ne $element);
! 1229: # the 'element_ref' has to be reset. Otherwise, $place->{'element_ref'}
! 1230: # will appear as a new element and trigger closing the file and
! 1231: # opening a new one.
! 1232: $place->{'element_ref'} = $current_element if ($place->{'element_ref'} and $current_element ne $element);
! 1233: # this resets the element associated with a printindex.
! 1234: if ($place->{'associated_element'} and $current_element ne $element)
! 1235: {
! 1236: $place->{'associated_element'} = $current_element;
! 1237: }
! 1238: next;
! 1239: }
! 1240:
! 1241: # now split the index
! 1242:
! 1243: my @letter_groups = ();
! 1244: my @letters_split = @{$t2h_default_index_letters_array{$index_name}};
! 1245: foreach my $letters_split (@letters_split)
! 1246: {
! 1247: push @letter_groups, {'letters' => [@$letters_split]};
! 1248: }
! 1249:
! 1250: $letter_groups[0]->{'element'} = $current_element;
1.1 noro 1251:
1.3 ! takayama 1252: # besides preparing the new elements corresponding with split indices,
! 1253: # they are recorded for later directions rearrangements in
! 1254: # t2h_default_index_rearrange_directions.
! 1255:
! 1256: # this weird construct is there because the element used as a key is
! 1257: # converted to a string by perl, losing its meaning as a reference,
! 1258: # the reference must be recorded explicitly
! 1259: $t2h_default_element_split_printindices->{$element}->{'element'} = $element;
! 1260: push @{$t2h_default_element_split_printindices->{$element}->{'printindices'}}, $printindex;
! 1261: #print STDERR "Setting $element, $element->{'texi'}, $printindex $printindex->{'name'} as a split element\n";
! 1262: foreach my $split_group (@letter_groups)
! 1263: {
! 1264: my $first_letter = $split_group->{'letters'}->[0]->{'letter'};
! 1265: my $last_letter = $split_group->{'letters'}->[-1]->{'letter'};
! 1266: if (!$split_group->{'element'})
! 1267: { # this is not the first letters group, which is already associated
! 1268: # with an element, a new element is done.
! 1269:
! 1270: # construct new element name
! 1271: my $letters_heading;
! 1272: if ($last_letter ne $first_letter)
! 1273: {
! 1274: $letters_heading = &$normal_text("$first_letter -- $last_letter");
! 1275: }
! 1276: else
! 1277: {
! 1278: $letters_heading = &$normal_text("$first_letter");
! 1279: }
! 1280: my ($name, $simple);
! 1281: my $texi = "ADDED ELEMENT $element->{'texi'}: $letters_heading";
! 1282: if (!defined($element->{'text'}))
! 1283: {
! 1284: my $element_heading_texi = &$heading_texi($element->{'tag'}, $element->{'texi'}, $element->{'number'});
! 1285:
! 1286: my $index_heading_texi = &$index_element_heading_texi(
! 1287: $element_heading_texi,
! 1288: $element->{'tag'},
! 1289: $element->{'texi'},
! 1290: $element->{'number'},
! 1291: $first_letter, $last_letter);
! 1292: $name = main::substitute_line($index_heading_texi, sprintf(__p("\@sectionning_command index page","\@%s index page"), $element->{'tag'}));
! 1293: $simple = main::simple_format(undef,undef,"simple_format \@$element->{'tag'} index page", $index_heading_texi);
! 1294: }
! 1295: else
! 1296: { # should never happen, at this point 'text' is always undefined.
! 1297: $name = "$element->{'text'}: $letters_heading";
! 1298: $simple = "$element->{'simple_format'}: $letters_heading";
! 1299: }
! 1300:
! 1301: #file and id
! 1302: my $relative_file = $Texi2HTML::THISDOC{'file_base_name'} . '_' . $t2h_default_file_number;
! 1303: $t2h_default_file_number++;
! 1304: $relative_file .= '.' . $Texi2HTML::THISDOC{'extension'} if
! 1305: (defined($Texi2HTML::THISDOC{'extension'}));
! 1306: my $id = "index_split-$t2h_default_index_id_nr";
! 1307: $t2h_default_index_id_nr++;
! 1308:
! 1309: my $new_element = { 'file' => $relative_file, 'id' => $id, 'target' => $id, 'text' => $name, 'texi' => $texi, 'seen' => 1, 'simple_format' => $simple };
! 1310: # to avoid crashing when there is a filename collision.
! 1311: main::add_file($new_element->{'file'});
! 1312:
! 1313: $split_group->{'element'} = $new_element;
! 1314: $current_element = $new_element;
! 1315: #print STDERR "Added file $new_element->{'file'} ($new_element, $new_element->{'id'}) for $new_element->{'texi'} ($first_letter:$last_letter)\n";
! 1316: }
! 1317: else
! 1318: { # this is the first index split, it is still associated with the element
! 1319: #print STDERR "No file added for ($first_letter:$last_letter)\n";
! 1320: }
! 1321: }
! 1322: $t2h_default_seen_files{$default_element_file} = $current_element->{'file'};
! 1323: $printindex->{'split_groups'} = \@letter_groups;
! 1324: #print STDERR "$index_name processed for $element, $element->{'texi'} (@{$printindex->{'split_groups'}})\n";
! 1325: }
! 1326: }
1.1 noro 1327:
1.3 ! takayama 1328: # set directions for added elements now that they are done in the
! 1329: # main program for all the other elements.
! 1330: sub t2h_default_index_rearrange_directions()
! 1331: {
! 1332: return if (!defined($t2h_default_element_split_printindices));
! 1333: foreach my $element_string (keys(%$t2h_default_element_split_printindices))
! 1334: {
! 1335: my $element = $t2h_default_element_split_printindices->{$element_string}->{'element'};
! 1336: my $current_element = $element;
! 1337: #print STDERR " E Processing $element_string,$current_element $current_element->{'texi'}\n";
! 1338: foreach my $printindex (@{$t2h_default_element_split_printindices->{$element_string}->{'printindices'}})
! 1339: {
! 1340: #print STDERR " I Processing $printindex $printindex->{'name'} (@{$printindex->{'split_groups'}})\n";
! 1341: foreach my $split_group (@{$printindex->{'split_groups'}})
! 1342: {
! 1343: my $first_letter = $split_group->{'letters'}->[0]->{'letter'};
! 1344: my $last_letter = $split_group->{'letters'}->[-1]->{'letter'};
! 1345:
! 1346: my $new_element = $split_group->{'element'};
! 1347: next if ($current_element eq $new_element);
! 1348: #print STDERR " G Processing ($first_letter:$last_letter) in $element->{'texi'}, index $printindex->{'name'}: $new_element->{'texi'}\n";
! 1349: $new_element->{'This'} = $new_element;
! 1350: if ($current_element->{'Forward'})
! 1351: {
! 1352: $current_element->{'Forward'}->{'Back'} = $new_element;
! 1353: $new_element->{'Forward'} = $current_element->{'Forward'};
! 1354: }
! 1355: $current_element->{'Forward'} = $new_element;
! 1356: $new_element->{'Back'} = $current_element;
! 1357: if ($current_element->{'Following'})
! 1358: {
! 1359: #print STDERR "F: C($current_element): $current_element->{'texi'}, N($new_element): $new_element->{'texi'} -- C->F: $current_element->{'Following'}->{'texi'}\n";
! 1360: $new_element->{'Following'} = $current_element->{'Following'};
! 1361: $current_element->{'Following'} = $new_element;
! 1362: }
! 1363: foreach my $key ('FastForward', 'FastBack', 'Up', 'tag_level', 'tag',
! 1364: 'level', 'node')
! 1365: {
! 1366: $new_element->{$key} = $element->{$key} if (defined($element->{$key}));
! 1367: }
! 1368: $new_element->{'this'} = $new_element;
! 1369: $new_element->{'element_ref'} = $new_element;
! 1370: $current_element = $new_element;
! 1371: }
1.1 noro 1372: }
1.3 ! takayama 1373: }
1.1 noro 1374: }
1375:
1.3 ! takayama 1376: # not needed to initialize it for a document, since it is reset
! 1377: # in index_summary
! 1378: my $t2h_symbol_indices = 0;
! 1379:
! 1380: # format a letter appearing in a summary for an index. The letter links to
! 1381: # the place where the index elements beginning with this letter are (called
! 1382: # a letter entry).
! 1383: #
! 1384: # arguments:
! 1385: # letter
! 1386: # file where the target letter entry is
! 1387: # identifier for the target letter entry
! 1388:
! 1389: sub html_default_summary_letter($$$$$$$)
! 1390: {
! 1391: my $letter = shift;
! 1392: my $file = shift;
! 1393: my $default_identifier = shift;
! 1394: my $index_element_id = shift;
! 1395: my $number = shift;
! 1396: my $index_element = shift;
! 1397: my $index_name = shift;
! 1398:
! 1399: return '' if ($letter =~ /^\s*$/);
! 1400: my $is_symbol = $letter !~ /^[A-Za-z]/;
! 1401: my $identifier = $default_identifier;
! 1402:
! 1403: if ($NEW_CROSSREF_STYLE)
! 1404: {
! 1405: if ($is_symbol)
! 1406: {
! 1407: $t2h_symbol_indices++;
! 1408: $identifier = $index_element_id . "_${index_name}_symbol-$t2h_symbol_indices";
! 1409: }
! 1410: else
! 1411: {
! 1412: $identifier = $index_element_id . "_${index_name}_letter-${letter}";
! 1413: }
! 1414: }
! 1415: my $result = &$anchor('', $file . '#' . $identifier, '<b>' . &$protect_text($letter) . '</b>', 'class="summary-letter"');
! 1416: return $result unless ($NEW_CROSSREF_STYLE);
! 1417: return ($result, $identifier, $is_symbol);
! 1418: }
! 1419:
! 1420: # this replaces do_index_page
! 1421: # args should be:
! 1422: # index_name
! 1423: # printindex
! 1424: sub t2h_GPL_default_printindex($$)
! 1425: {
! 1426: my $index_name = shift;
! 1427: my $printindex = shift;
! 1428: # could be cross verified with argument
! 1429:
! 1430: my $identifier_index_nr = 0;
! 1431: my @split_letters;
! 1432:
! 1433: if (defined($printindex->{'split_groups'}) and scalar(@{$printindex->{'split_groups'}}))
! 1434: {
! 1435: @split_letters = @{$printindex->{'split_groups'}};
! 1436: }
! 1437: elsif (defined($Texi2HTML::THISDOC{'index_letters_array'}->{$index_name}) and scalar(@{$Texi2HTML::THISDOC{'index_letters_array'}->{$index_name}}))
! 1438: {
! 1439: my $element = $printindex->{'associated_element'};
! 1440: # this happens for printindex before the first element.
! 1441: if (!defined($element))
! 1442: {
! 1443: $element = {'file' => '', 'id' => "$printindex->{'region'}_printindex"};
! 1444: }
! 1445: elsif (defined($element->{'element_ref'}))
! 1446: {
! 1447: $element = $element->{'element_ref'};
! 1448: }
! 1449: @split_letters = ({ 'letters' => $Texi2HTML::THISDOC{'index_letters_array'}->{$index_name}, 'element' => $element});
! 1450: }
! 1451: else
! 1452: {
! 1453: return '';
! 1454: }
! 1455:
! 1456: foreach my $split_group (@split_letters)
! 1457: {
! 1458: #do summmary
! 1459: my @non_alpha = ();
! 1460: my @alpha = ();
! 1461: #print STDERR "$index_name @{$split_group->{'letters'}}\n";
! 1462: # letter_id could be done once for all instead of for each split_group
! 1463: # and outside of t2h_default_summary_letter (or t2h_default_summary_letter
! 1464: # could be simplified and inlined
! 1465: my %letter_id;
! 1466: foreach my $summary_split_group (@split_letters)
! 1467: {
! 1468: foreach my $letter_entry (@{$summary_split_group->{'letters'}})
! 1469: {
! 1470: my $letter = $letter_entry->{'letter'};
! 1471: my $dest_file = '';
! 1472:
! 1473: ####################################### debug
! 1474: if (!defined($summary_split_group->{'element'}))
! 1475: {
! 1476: main::msg_debug ("index $index_name, letter $letter, element for summary_split_group $summary_split_group not defined");
! 1477: }
! 1478: elsif (!defined($summary_split_group->{'element'}->{'id'}))
! 1479: {
! 1480: main::msg_debug ("index $index_name, letter $letter, element $summary_split_group->{'element'} `$summary_split_group->{'element'}->{'texi'}', id undef");
! 1481: }
! 1482: ####################################### end debug
! 1483: $dest_file = $summary_split_group->{'element'}->{'file'}
! 1484: if ($summary_split_group ne $split_group);
! 1485: my $index_element_id = $summary_split_group->{'element'}->{'id'};
! 1486: my $default_identifier = $index_element_id . "_$identifier_index_nr";
! 1487: #print STDERR "$split_group $summary_split_group $summary_split_group->{'element'} $summary_split_group->{'element'}->{'id'} $identifier_index_nr $index_element_id $default_identifier\n";
! 1488: $identifier_index_nr++;
! 1489: my ($result, $identifier, $is_symbol) =
! 1490: &$summary_letter($letter, $dest_file, $default_identifier, $index_element_id, '', '', $index_name);
! 1491: $identifier = $default_identifier if (!defined($identifier));
! 1492: $letter_id{$letter} = $identifier;
! 1493: $is_symbol = $letter !~ /^[A-Za-z]/ if (!defined($is_symbol));
! 1494:
! 1495: if ($result ne '')
! 1496: {
! 1497: if ($is_symbol)
! 1498: {
! 1499: push @non_alpha, $result;
! 1500: }
! 1501: else
! 1502: {
! 1503: push @alpha, $result;
! 1504: }
! 1505: }
! 1506: }
1.1 noro 1507: }
1.3 ! takayama 1508: my $summary = &$index_summary(\@alpha, \@non_alpha);
! 1509:
! 1510: # reset symbols numbering
! 1511: $t2h_symbol_indices = 0;
! 1512:
! 1513: my $letters_text = '';
! 1514: foreach my $letter_entry (@{$split_group->{'letters'}})
! 1515: {
! 1516: my $letter = $letter_entry->{'letter'};
! 1517: my $entries_text = '';
! 1518: foreach my $index_entry_ref (@{$letter_entry->{'entries'}})
! 1519: {
! 1520: my ($text_href, $entry_file, $element_file, $entry_target,
! 1521: $entry_element_target, $formatted_entry, $element_href,
! 1522: $entry_element_text, $in_region_not_in_output)
! 1523: = main::get_index_entry_infos($index_entry_ref, $split_group->{'element'});
! 1524: $entries_text .= &$index_entry ($text_href, $formatted_entry, $element_href, $entry_element_text, $entry_file, $element_file, $entry_target, $entry_element_target, $in_region_not_in_output, $index_entry_ref);
! 1525: }
! 1526: $letters_text .= &$index_letter ($letter, $letter_id{$letter}, $entries_text)
1.1 noro 1527: }
1.3 ! takayama 1528: my $index_text = &$print_index($letters_text, $index_name);
! 1529: $split_group->{'text'} = $summary . $index_text . $summary;
! 1530: # print STDERR " ---> $index_name @{$split_group->{'letters'}}
! 1531: # * elt: $split_group->{'element'}->{'id'}, $split_group->{'element'}->{'file'}, $split_group->{'element'}->{'name'}
! 1532: # * directions: B: $split_group->{'element'}->{'Back'}->{'name'}, F: $split_group->{'element'}->{'Forward'}->{'name'}, FB: $split_group->{'element'}->{'FastBack'}->{'name'}, FF: $split_group->{'element'}->{'FastForward'}->{'name'}
! 1533: # * text
! 1534: #
! 1535: #$split_group->{'text'}
! 1536: #
! 1537: #";
! 1538: }
! 1539: my $current_page = shift @split_letters;
! 1540: if (!scalar(@split_letters))
! 1541: {
! 1542: return $current_page->{'text'};
! 1543: }
! 1544:
! 1545: while (1)
! 1546: {
! 1547: # print the index letters
! 1548: push @{$Texi2HTML::THIS_SECTION}, $current_page->{'text'};
! 1549:
! 1550: $current_page = shift @split_letters;
! 1551: last if (!defined($current_page));
! 1552:
! 1553: # there is no need to begin first element if not already done, since
! 1554: # the index is not split if not already in an element.
! 1555: # end the previous element
! 1556: main::finish_element ($Texi2HTML::THISDOC{'FH'}, $Texi2HTML::THIS_ELEMENT, $Texi2HTML::THIS_ELEMENT->{'Forward'}, 0);
! 1557:
! 1558: # do the new element beginning
! 1559: $Texi2HTML::THIS_ELEMENT = $current_page->{'element'};
! 1560: my $new_element = $Texi2HTML::THIS_ELEMENT;
! 1561: main::unref_file($new_element->{'file'});
! 1562: main::do_element_directions($new_element);
! 1563: my $do_page_head = main::open_out_file($new_element->{'file'});
! 1564: if ($do_page_head)
! 1565: {
! 1566: &$print_page_head($Texi2HTML::THISDOC{'FH'});
! 1567: &$print_chapter_header($Texi2HTML::THISDOC{'FH'}, $new_element) if Texi2HTML::Config::get_conf('SPLIT') eq 'chapter';
! 1568: &$print_section_header($Texi2HTML::THISDOC{'FH'}, $new_element) if Texi2HTML::Config::get_conf('SPLIT') eq 'section';
1.1 noro 1569: }
1.3 ! takayama 1570: # almost nothing of this is used in the default html output
! 1571: @{$Texi2HTML::THIS_SECTION} = &$element_heading($new_element, $new_element->{'tag'}, $new_element->{'texi'},
! 1572: $new_element->{'text'}, 0, 0, $new_element->{'this'}, 1, 0, 0, "\@$new_element->{'tag'} $new_element->{'texi'}",
! 1573: $new_element->{'id'}, $new_element);
! 1574:
! 1575: }
! 1576: return '';
! 1577: }
! 1578:
! 1579: # leave this within comments, and keep the require statement
! 1580: # This way, you can directly run texi2html.pl,
! 1581: # if $T2H_HOME/documentlanguages.pl exists.
! 1582: #
! 1583: # @T2H_DOCUMENT_LANGUAGES@
! 1584: %language_codes = (
! 1585: 'aa' => 1,
! 1586: 'ab' => 1,
! 1587: 'ae' => 1,
! 1588: 'af' => 1,
! 1589: 'ak' => 1,
! 1590: 'am' => 1,
! 1591: 'an' => 1,
! 1592: 'ar' => 1,
! 1593: 'as' => 1,
! 1594: 'av' => 1,
! 1595: 'ay' => 1,
! 1596: 'az' => 1,
! 1597: 'ba' => 1,
! 1598: 'be' => 1,
! 1599: 'bg' => 1,
! 1600: 'bh' => 1,
! 1601: 'bi' => 1,
! 1602: 'bm' => 1,
! 1603: 'bn' => 1,
! 1604: 'bo' => 1,
! 1605: 'br' => 1,
! 1606: 'ca' => 1,
! 1607: 'ce' => 1,
! 1608: 'ch' => 1,
! 1609: 'co' => 1,
! 1610: 'cr' => 1,
! 1611: 'cs' => 1,
! 1612: 'cu' => 1,
! 1613: 'cv' => 1,
! 1614: 'cy' => 1,
! 1615: 'da' => 1,
! 1616: 'de' => 1,
! 1617: 'dv' => 1,
! 1618: 'dz' => 1,
! 1619: 'ee' => 1,
! 1620: 'el' => 1,
! 1621: 'en' => 1,
! 1622: 'eo' => 1,
! 1623: 'es' => 1,
! 1624: 'et' => 1,
! 1625: 'eu' => 1,
! 1626: 'fa' => 1,
! 1627: 'ff' => 1,
! 1628: 'fi' => 1,
! 1629: 'fj' => 1,
! 1630: 'fo' => 1,
! 1631: 'fr' => 1,
! 1632: 'fy' => 1,
! 1633: 'ga' => 1,
! 1634: 'gd' => 1,
! 1635: 'gl' => 1,
! 1636: 'gn' => 1,
! 1637: 'gu' => 1,
! 1638: 'gv' => 1,
! 1639: 'ha' => 1,
! 1640: 'he' => 1,
! 1641: 'hi' => 1,
! 1642: 'ho' => 1,
! 1643: 'ht' => 1,
! 1644: 'hu' => 1,
! 1645: 'hy' => 1,
! 1646: 'hz' => 1,
! 1647: 'ia' => 1,
! 1648: 'ie' => 1,
! 1649: 'ig' => 1,
! 1650: 'ii' => 1,
! 1651: 'ik' => 1,
! 1652: 'io' => 1,
! 1653: 'is' => 1,
! 1654: 'it' => 1,
! 1655: 'iu' => 1,
! 1656: 'iw' => 1,
! 1657: 'ja' => 1,
! 1658: 'ji' => 1,
! 1659: 'jv' => 1,
! 1660: 'jw' => 1,
! 1661: 'ka' => 1,
! 1662: 'kg' => 1,
! 1663: 'ki' => 1,
! 1664: 'kj' => 1,
! 1665: 'kk' => 1,
! 1666: 'kl' => 1,
! 1667: 'km' => 1,
! 1668: 'kn' => 1,
! 1669: 'ko' => 1,
! 1670: 'kr' => 1,
! 1671: 'ks' => 1,
! 1672: 'ku' => 1,
! 1673: 'kv' => 1,
! 1674: 'kw' => 1,
! 1675: 'ky' => 1,
! 1676: 'la' => 1,
! 1677: 'lb' => 1,
! 1678: 'lg' => 1,
! 1679: 'li' => 1,
! 1680: 'ln' => 1,
! 1681: 'lo' => 1,
! 1682: 'lt' => 1,
! 1683: 'lu' => 1,
! 1684: 'lv' => 1,
! 1685: 'mg' => 1,
! 1686: 'mh' => 1,
! 1687: 'mi' => 1,
! 1688: 'mk' => 1,
! 1689: 'ml' => 1,
! 1690: 'mn' => 1,
! 1691: 'mo' => 1,
! 1692: 'mr' => 1,
! 1693: 'ms' => 1,
! 1694: 'mt' => 1,
! 1695: 'my' => 1,
! 1696: 'na' => 1,
! 1697: 'nd' => 1,
! 1698: 'ne' => 1,
! 1699: 'ng' => 1,
! 1700: 'nl' => 1,
! 1701: 'no' => 1,
! 1702: 'nr' => 1,
! 1703: 'nv' => 1,
! 1704: 'ny' => 1,
! 1705: 'oc' => 1,
! 1706: 'oj' => 1,
! 1707: 'om' => 1,
! 1708: 'or' => 1,
! 1709: 'os' => 1,
! 1710: 'pa' => 1,
! 1711: 'pi' => 1,
! 1712: 'pl' => 1,
! 1713: 'ps' => 1,
! 1714: 'pt' => 1,
! 1715: 'qu' => 1,
! 1716: 'rm' => 1,
! 1717: 'rn' => 1,
! 1718: 'ro' => 1,
! 1719: 'ru' => 1,
! 1720: 'rw' => 1,
! 1721: 'sa' => 1,
! 1722: 'sc' => 1,
! 1723: 'sd' => 1,
! 1724: 'se' => 1,
! 1725: 'sg' => 1,
! 1726: 'sh' => 1,
! 1727: 'si' => 1,
! 1728: 'sk' => 1,
! 1729: 'sl' => 1,
! 1730: 'sm' => 1,
! 1731: 'sn' => 1,
! 1732: 'so' => 1,
! 1733: 'sq' => 1,
! 1734: 'ss' => 1,
! 1735: 'st' => 1,
! 1736: 'su' => 1,
! 1737: 'sv' => 1,
! 1738: 'sw' => 1,
! 1739: 'ta' => 1,
! 1740: 'te' => 1,
! 1741: 'tg' => 1,
! 1742: 'th' => 1,
! 1743: 'ti' => 1,
! 1744: 'tk' => 1,
! 1745: 'tl' => 1,
! 1746: 'tn' => 1,
! 1747: 'to' => 1,
! 1748: 'tr' => 1,
! 1749: 'ts' => 1,
! 1750: 'tt' => 1,
! 1751: 'ty' => 1,
! 1752: 'ug' => 1,
! 1753: 'uk' => 1,
! 1754: 'ur' => 1,
! 1755: 'uz' => 1,
! 1756: 've' => 1,
! 1757: 'vi' => 1,
! 1758: 'vo' => 1,
! 1759: 'wa' => 1,
! 1760: 'wo' => 1,
! 1761: 'xh' => 1,
! 1762: 'yi' => 1,
! 1763: 'yo' => 1,
! 1764: 'za' => 1,
! 1765: 'zh' => 1,
! 1766: 'zu' => 1,
! 1767: 'aaa' => 1,
! 1768: 'aab' => 1,
! 1769: 'aac' => 1,
! 1770: 'aad' => 1,
! 1771: 'aaf' => 1,
! 1772: 'aag' => 1,
! 1773: 'aah' => 1,
! 1774: 'aai' => 1,
! 1775: 'aak' => 1,
! 1776: 'aal' => 1,
! 1777: 'aam' => 1,
! 1778: 'aan' => 1,
! 1779: 'aap' => 1,
! 1780: 'aaq' => 1,
! 1781: 'aas' => 1,
! 1782: 'aau' => 1,
! 1783: 'aav' => 1,
! 1784: 'aaw' => 1,
! 1785: 'aax' => 1,
! 1786: 'aaz' => 1,
! 1787: 'aba' => 1,
! 1788: 'abb' => 1,
! 1789: 'abc' => 1,
! 1790: 'abd' => 1,
! 1791: 'abe' => 1,
! 1792: 'abf' => 1,
! 1793: 'abg' => 1,
! 1794: 'abi' => 1,
! 1795: 'abj' => 1,
! 1796: 'abl' => 1,
! 1797: 'abm' => 1,
! 1798: 'abn' => 1,
! 1799: 'abo' => 1,
! 1800: 'abp' => 1,
! 1801: 'abq' => 1,
! 1802: 'abr' => 1,
! 1803: 'abs' => 1,
! 1804: 'abt' => 1,
! 1805: 'abu' => 1,
! 1806: 'abw' => 1,
! 1807: 'abx' => 1,
! 1808: 'aby' => 1,
! 1809: 'abz' => 1,
! 1810: 'aca' => 1,
! 1811: 'acb' => 1,
! 1812: 'acd' => 1,
! 1813: 'ace' => 1,
! 1814: 'acf' => 1,
! 1815: 'ach' => 1,
! 1816: 'aci' => 1,
! 1817: 'ack' => 1,
! 1818: 'acl' => 1,
! 1819: 'acn' => 1,
! 1820: 'acp' => 1,
! 1821: 'acr' => 1,
! 1822: 'acs' => 1,
! 1823: 'act' => 1,
! 1824: 'acu' => 1,
! 1825: 'acv' => 1,
! 1826: 'acz' => 1,
! 1827: 'ada' => 1,
! 1828: 'adb' => 1,
! 1829: 'add' => 1,
! 1830: 'ade' => 1,
! 1831: 'adg' => 1,
! 1832: 'adh' => 1,
! 1833: 'adi' => 1,
! 1834: 'adj' => 1,
! 1835: 'adl' => 1,
! 1836: 'adn' => 1,
! 1837: 'ado' => 1,
! 1838: 'adp' => 1,
! 1839: 'adq' => 1,
! 1840: 'adr' => 1,
! 1841: 'ads' => 1,
! 1842: 'adt' => 1,
! 1843: 'adu' => 1,
! 1844: 'adw' => 1,
! 1845: 'adx' => 1,
! 1846: 'ady' => 1,
! 1847: 'adz' => 1,
! 1848: 'aea' => 1,
! 1849: 'aed' => 1,
! 1850: 'aee' => 1,
! 1851: 'aek' => 1,
! 1852: 'ael' => 1,
! 1853: 'aem' => 1,
! 1854: 'aen' => 1,
! 1855: 'aeq' => 1,
! 1856: 'aer' => 1,
! 1857: 'aes' => 1,
! 1858: 'aeu' => 1,
! 1859: 'aew' => 1,
! 1860: 'aey' => 1,
! 1861: 'aez' => 1,
! 1862: 'afa' => 1,
! 1863: 'afd' => 1,
! 1864: 'afe' => 1,
! 1865: 'afg' => 1,
! 1866: 'afh' => 1,
! 1867: 'afi' => 1,
! 1868: 'afk' => 1,
! 1869: 'afn' => 1,
! 1870: 'afo' => 1,
! 1871: 'afp' => 1,
! 1872: 'afs' => 1,
! 1873: 'aft' => 1,
! 1874: 'afu' => 1,
! 1875: 'afz' => 1,
! 1876: 'aga' => 1,
! 1877: 'agb' => 1,
! 1878: 'agc' => 1,
! 1879: 'agd' => 1,
! 1880: 'age' => 1,
! 1881: 'agf' => 1,
! 1882: 'agg' => 1,
! 1883: 'agh' => 1,
! 1884: 'agi' => 1,
! 1885: 'agj' => 1,
! 1886: 'agk' => 1,
! 1887: 'agl' => 1,
! 1888: 'agm' => 1,
! 1889: 'agn' => 1,
! 1890: 'ago' => 1,
! 1891: 'agp' => 1,
! 1892: 'agq' => 1,
! 1893: 'agr' => 1,
! 1894: 'ags' => 1,
! 1895: 'agt' => 1,
! 1896: 'agu' => 1,
! 1897: 'agv' => 1,
! 1898: 'agw' => 1,
! 1899: 'agx' => 1,
! 1900: 'agy' => 1,
! 1901: 'agz' => 1,
! 1902: 'aha' => 1,
! 1903: 'ahb' => 1,
! 1904: 'ahg' => 1,
! 1905: 'ahh' => 1,
! 1906: 'ahi' => 1,
! 1907: 'ahk' => 1,
! 1908: 'ahl' => 1,
! 1909: 'ahm' => 1,
! 1910: 'ahn' => 1,
! 1911: 'aho' => 1,
! 1912: 'ahp' => 1,
! 1913: 'ahr' => 1,
! 1914: 'ahs' => 1,
! 1915: 'aht' => 1,
! 1916: 'aia' => 1,
! 1917: 'aib' => 1,
! 1918: 'aic' => 1,
! 1919: 'aid' => 1,
! 1920: 'aie' => 1,
! 1921: 'aif' => 1,
! 1922: 'aig' => 1,
! 1923: 'aih' => 1,
! 1924: 'aij' => 1,
! 1925: 'aik' => 1,
! 1926: 'ail' => 1,
! 1927: 'aim' => 1,
! 1928: 'ain' => 1,
! 1929: 'aio' => 1,
! 1930: 'aip' => 1,
! 1931: 'aiq' => 1,
! 1932: 'air' => 1,
! 1933: 'ais' => 1,
! 1934: 'ait' => 1,
! 1935: 'aiw' => 1,
! 1936: 'aix' => 1,
! 1937: 'aiy' => 1,
! 1938: 'aja' => 1,
! 1939: 'ajg' => 1,
! 1940: 'aji' => 1,
! 1941: 'ajw' => 1,
! 1942: 'ajz' => 1,
! 1943: 'akb' => 1,
! 1944: 'akc' => 1,
! 1945: 'akd' => 1,
! 1946: 'ake' => 1,
! 1947: 'akf' => 1,
! 1948: 'akg' => 1,
! 1949: 'akh' => 1,
! 1950: 'aki' => 1,
! 1951: 'akj' => 1,
! 1952: 'akk' => 1,
! 1953: 'akl' => 1,
! 1954: 'akm' => 1,
! 1955: 'ako' => 1,
! 1956: 'akp' => 1,
! 1957: 'akq' => 1,
! 1958: 'akr' => 1,
! 1959: 'aks' => 1,
! 1960: 'akt' => 1,
! 1961: 'aku' => 1,
! 1962: 'akv' => 1,
! 1963: 'akw' => 1,
! 1964: 'akx' => 1,
! 1965: 'aky' => 1,
! 1966: 'akz' => 1,
! 1967: 'ala' => 1,
! 1968: 'alc' => 1,
! 1969: 'ald' => 1,
! 1970: 'ale' => 1,
! 1971: 'alf' => 1,
! 1972: 'alg' => 1,
! 1973: 'alh' => 1,
! 1974: 'ali' => 1,
! 1975: 'alj' => 1,
! 1976: 'alk' => 1,
! 1977: 'all' => 1,
! 1978: 'alm' => 1,
! 1979: 'alo' => 1,
! 1980: 'alp' => 1,
! 1981: 'alq' => 1,
! 1982: 'alr' => 1,
! 1983: 'alt' => 1,
! 1984: 'alu' => 1,
! 1985: 'alv' => 1,
! 1986: 'alw' => 1,
! 1987: 'alx' => 1,
! 1988: 'aly' => 1,
! 1989: 'alz' => 1,
! 1990: 'ama' => 1,
! 1991: 'amb' => 1,
! 1992: 'amc' => 1,
! 1993: 'ame' => 1,
! 1994: 'amf' => 1,
! 1995: 'amg' => 1,
! 1996: 'ami' => 1,
! 1997: 'amj' => 1,
! 1998: 'amk' => 1,
! 1999: 'aml' => 1,
! 2000: 'amm' => 1,
! 2001: 'amn' => 1,
! 2002: 'amo' => 1,
! 2003: 'amp' => 1,
! 2004: 'amq' => 1,
! 2005: 'amr' => 1,
! 2006: 'ams' => 1,
! 2007: 'amt' => 1,
! 2008: 'amu' => 1,
! 2009: 'amv' => 1,
! 2010: 'amw' => 1,
! 2011: 'amx' => 1,
! 2012: 'amy' => 1,
! 2013: 'amz' => 1,
! 2014: 'ana' => 1,
! 2015: 'anb' => 1,
! 2016: 'anc' => 1,
! 2017: 'and' => 1,
! 2018: 'ane' => 1,
! 2019: 'anf' => 1,
! 2020: 'ang' => 1,
! 2021: 'anh' => 1,
! 2022: 'ani' => 1,
! 2023: 'anj' => 1,
! 2024: 'ank' => 1,
! 2025: 'anl' => 1,
! 2026: 'anm' => 1,
! 2027: 'ann' => 1,
! 2028: 'ano' => 1,
! 2029: 'anp' => 1,
! 2030: 'anq' => 1,
! 2031: 'anr' => 1,
! 2032: 'ans' => 1,
! 2033: 'ant' => 1,
! 2034: 'anu' => 1,
! 2035: 'anv' => 1,
! 2036: 'anw' => 1,
! 2037: 'anx' => 1,
! 2038: 'any' => 1,
! 2039: 'anz' => 1,
! 2040: 'aoa' => 1,
! 2041: 'aob' => 1,
! 2042: 'aoc' => 1,
! 2043: 'aod' => 1,
! 2044: 'aoe' => 1,
! 2045: 'aof' => 1,
! 2046: 'aog' => 1,
! 2047: 'aoh' => 1,
! 2048: 'aoi' => 1,
! 2049: 'aoj' => 1,
! 2050: 'aok' => 1,
! 2051: 'aol' => 1,
! 2052: 'aom' => 1,
! 2053: 'aon' => 1,
! 2054: 'aor' => 1,
! 2055: 'aos' => 1,
! 2056: 'aot' => 1,
! 2057: 'aox' => 1,
! 2058: 'aoz' => 1,
! 2059: 'apa' => 1,
! 2060: 'apb' => 1,
! 2061: 'ape' => 1,
! 2062: 'apg' => 1,
! 2063: 'aph' => 1,
! 2064: 'api' => 1,
! 2065: 'apj' => 1,
! 2066: 'apk' => 1,
! 2067: 'apl' => 1,
! 2068: 'apm' => 1,
! 2069: 'apn' => 1,
! 2070: 'apo' => 1,
! 2071: 'app' => 1,
! 2072: 'apq' => 1,
! 2073: 'apr' => 1,
! 2074: 'aps' => 1,
! 2075: 'apt' => 1,
! 2076: 'apu' => 1,
! 2077: 'apv' => 1,
! 2078: 'apw' => 1,
! 2079: 'apx' => 1,
! 2080: 'apy' => 1,
! 2081: 'apz' => 1,
! 2082: 'aqa' => 1,
! 2083: 'aqc' => 1,
! 2084: 'aqg' => 1,
! 2085: 'aql' => 1,
! 2086: 'aqm' => 1,
! 2087: 'aqn' => 1,
! 2088: 'aqp' => 1,
! 2089: 'aqr' => 1,
! 2090: 'arc' => 1,
! 2091: 'ard' => 1,
! 2092: 'are' => 1,
! 2093: 'arh' => 1,
! 2094: 'ari' => 1,
! 2095: 'arj' => 1,
! 2096: 'ark' => 1,
! 2097: 'arl' => 1,
! 2098: 'arn' => 1,
! 2099: 'aro' => 1,
! 2100: 'arp' => 1,
! 2101: 'arr' => 1,
! 2102: 'art' => 1,
! 2103: 'aru' => 1,
! 2104: 'arv' => 1,
! 2105: 'arw' => 1,
! 2106: 'arx' => 1,
! 2107: 'asa' => 1,
! 2108: 'asb' => 1,
! 2109: 'asc' => 1,
! 2110: 'asd' => 1,
! 2111: 'ase' => 1,
! 2112: 'asf' => 1,
! 2113: 'asg' => 1,
! 2114: 'ash' => 1,
! 2115: 'asi' => 1,
! 2116: 'asj' => 1,
! 2117: 'ask' => 1,
! 2118: 'asl' => 1,
! 2119: 'asn' => 1,
! 2120: 'aso' => 1,
! 2121: 'asp' => 1,
! 2122: 'asq' => 1,
! 2123: 'asr' => 1,
! 2124: 'ass' => 1,
! 2125: 'ast' => 1,
! 2126: 'asu' => 1,
! 2127: 'asv' => 1,
! 2128: 'asw' => 1,
! 2129: 'asx' => 1,
! 2130: 'asy' => 1,
! 2131: 'asz' => 1,
! 2132: 'ata' => 1,
! 2133: 'atb' => 1,
! 2134: 'atc' => 1,
! 2135: 'atd' => 1,
! 2136: 'ate' => 1,
! 2137: 'atg' => 1,
! 2138: 'ath' => 1,
! 2139: 'ati' => 1,
! 2140: 'atj' => 1,
! 2141: 'atk' => 1,
! 2142: 'atl' => 1,
! 2143: 'atm' => 1,
! 2144: 'atn' => 1,
! 2145: 'ato' => 1,
! 2146: 'atp' => 1,
! 2147: 'atq' => 1,
! 2148: 'atr' => 1,
! 2149: 'ats' => 1,
! 2150: 'att' => 1,
! 2151: 'atu' => 1,
! 2152: 'atv' => 1,
! 2153: 'atw' => 1,
! 2154: 'atx' => 1,
! 2155: 'aty' => 1,
! 2156: 'atz' => 1,
! 2157: 'aua' => 1,
! 2158: 'aub' => 1,
! 2159: 'auc' => 1,
! 2160: 'aud' => 1,
! 2161: 'aue' => 1,
! 2162: 'auf' => 1,
! 2163: 'aug' => 1,
! 2164: 'auh' => 1,
! 2165: 'aui' => 1,
! 2166: 'auj' => 1,
! 2167: 'auk' => 1,
! 2168: 'aul' => 1,
! 2169: 'aum' => 1,
! 2170: 'aun' => 1,
! 2171: 'auo' => 1,
! 2172: 'aup' => 1,
! 2173: 'auq' => 1,
! 2174: 'aur' => 1,
! 2175: 'aus' => 1,
! 2176: 'aut' => 1,
! 2177: 'auu' => 1,
! 2178: 'auw' => 1,
! 2179: 'aux' => 1,
! 2180: 'auy' => 1,
! 2181: 'avb' => 1,
! 2182: 'avd' => 1,
! 2183: 'avi' => 1,
! 2184: 'avk' => 1,
! 2185: 'avn' => 1,
! 2186: 'avo' => 1,
! 2187: 'avs' => 1,
! 2188: 'avt' => 1,
! 2189: 'avu' => 1,
! 2190: 'avv' => 1,
! 2191: 'awa' => 1,
! 2192: 'awb' => 1,
! 2193: 'awc' => 1,
! 2194: 'awd' => 1,
! 2195: 'awe' => 1,
! 2196: 'awh' => 1,
! 2197: 'awi' => 1,
! 2198: 'awk' => 1,
! 2199: 'awm' => 1,
! 2200: 'awn' => 1,
! 2201: 'awo' => 1,
! 2202: 'awr' => 1,
! 2203: 'aws' => 1,
! 2204: 'awt' => 1,
! 2205: 'awu' => 1,
! 2206: 'awv' => 1,
! 2207: 'aww' => 1,
! 2208: 'awx' => 1,
! 2209: 'awy' => 1,
! 2210: 'axb' => 1,
! 2211: 'axg' => 1,
! 2212: 'axk' => 1,
! 2213: 'axm' => 1,
! 2214: 'axx' => 1,
! 2215: 'aya' => 1,
! 2216: 'ayb' => 1,
! 2217: 'ayd' => 1,
! 2218: 'aye' => 1,
! 2219: 'ayg' => 1,
! 2220: 'ayi' => 1,
! 2221: 'ayk' => 1,
! 2222: 'ayo' => 1,
! 2223: 'ayq' => 1,
! 2224: 'ays' => 1,
! 2225: 'ayt' => 1,
! 2226: 'ayu' => 1,
! 2227: 'ayx' => 1,
! 2228: 'ayy' => 1,
! 2229: 'ayz' => 1,
! 2230: 'aza' => 1,
! 2231: 'azc' => 1,
! 2232: 'azg' => 1,
! 2233: 'azm' => 1,
! 2234: 'azo' => 1,
! 2235: 'azt' => 1,
! 2236: 'azz' => 1,
! 2237: 'baa' => 1,
! 2238: 'bab' => 1,
! 2239: 'bac' => 1,
! 2240: 'bad' => 1,
! 2241: 'bae' => 1,
! 2242: 'baf' => 1,
! 2243: 'bag' => 1,
! 2244: 'bah' => 1,
! 2245: 'bai' => 1,
! 2246: 'baj' => 1,
! 2247: 'bal' => 1,
! 2248: 'ban' => 1,
! 2249: 'bao' => 1,
! 2250: 'bap' => 1,
! 2251: 'bar' => 1,
! 2252: 'bas' => 1,
! 2253: 'bat' => 1,
! 2254: 'bau' => 1,
! 2255: 'bav' => 1,
! 2256: 'baw' => 1,
! 2257: 'bax' => 1,
! 2258: 'bay' => 1,
! 2259: 'baz' => 1,
! 2260: 'bba' => 1,
! 2261: 'bbb' => 1,
! 2262: 'bbc' => 1,
! 2263: 'bbd' => 1,
! 2264: 'bbe' => 1,
! 2265: 'bbf' => 1,
! 2266: 'bbg' => 1,
! 2267: 'bbh' => 1,
! 2268: 'bbi' => 1,
! 2269: 'bbj' => 1,
! 2270: 'bbk' => 1,
! 2271: 'bbl' => 1,
! 2272: 'bbm' => 1,
! 2273: 'bbn' => 1,
! 2274: 'bbo' => 1,
! 2275: 'bbp' => 1,
! 2276: 'bbq' => 1,
! 2277: 'bbr' => 1,
! 2278: 'bbs' => 1,
! 2279: 'bbt' => 1,
! 2280: 'bbu' => 1,
! 2281: 'bbv' => 1,
! 2282: 'bbw' => 1,
! 2283: 'bbx' => 1,
! 2284: 'bby' => 1,
! 2285: 'bca' => 1,
! 2286: 'bcb' => 1,
! 2287: 'bcd' => 1,
! 2288: 'bce' => 1,
! 2289: 'bcf' => 1,
! 2290: 'bcg' => 1,
! 2291: 'bch' => 1,
! 2292: 'bci' => 1,
! 2293: 'bcj' => 1,
! 2294: 'bck' => 1,
! 2295: 'bcm' => 1,
! 2296: 'bcn' => 1,
! 2297: 'bco' => 1,
! 2298: 'bcp' => 1,
! 2299: 'bcq' => 1,
! 2300: 'bcr' => 1,
! 2301: 'bcs' => 1,
! 2302: 'bct' => 1,
! 2303: 'bcu' => 1,
! 2304: 'bcv' => 1,
! 2305: 'bcw' => 1,
! 2306: 'bcy' => 1,
! 2307: 'bcz' => 1,
! 2308: 'bda' => 1,
! 2309: 'bdb' => 1,
! 2310: 'bdc' => 1,
! 2311: 'bdd' => 1,
! 2312: 'bde' => 1,
! 2313: 'bdg' => 1,
! 2314: 'bdh' => 1,
! 2315: 'bdi' => 1,
! 2316: 'bdj' => 1,
! 2317: 'bdk' => 1,
! 2318: 'bdl' => 1,
! 2319: 'bdm' => 1,
! 2320: 'bdn' => 1,
! 2321: 'bdo' => 1,
! 2322: 'bdp' => 1,
! 2323: 'bdq' => 1,
! 2324: 'bdr' => 1,
! 2325: 'bds' => 1,
! 2326: 'bdu' => 1,
! 2327: 'bdv' => 1,
! 2328: 'bdw' => 1,
! 2329: 'bdx' => 1,
! 2330: 'bdy' => 1,
! 2331: 'bdz' => 1,
! 2332: 'bea' => 1,
! 2333: 'beb' => 1,
! 2334: 'bec' => 1,
! 2335: 'bed' => 1,
! 2336: 'bee' => 1,
! 2337: 'bef' => 1,
! 2338: 'beg' => 1,
! 2339: 'beh' => 1,
! 2340: 'bei' => 1,
! 2341: 'bej' => 1,
! 2342: 'bek' => 1,
! 2343: 'bem' => 1,
! 2344: 'beo' => 1,
! 2345: 'bep' => 1,
! 2346: 'beq' => 1,
! 2347: 'ber' => 1,
! 2348: 'bes' => 1,
! 2349: 'bet' => 1,
! 2350: 'beu' => 1,
! 2351: 'bev' => 1,
! 2352: 'bew' => 1,
! 2353: 'bex' => 1,
! 2354: 'bey' => 1,
! 2355: 'bez' => 1,
! 2356: 'bfa' => 1,
! 2357: 'bfb' => 1,
! 2358: 'bfc' => 1,
! 2359: 'bfd' => 1,
! 2360: 'bfe' => 1,
! 2361: 'bff' => 1,
! 2362: 'bfg' => 1,
! 2363: 'bfh' => 1,
! 2364: 'bfi' => 1,
! 2365: 'bfj' => 1,
! 2366: 'bfk' => 1,
! 2367: 'bfl' => 1,
! 2368: 'bfm' => 1,
! 2369: 'bfn' => 1,
! 2370: 'bfo' => 1,
! 2371: 'bfp' => 1,
! 2372: 'bfq' => 1,
! 2373: 'bfr' => 1,
! 2374: 'bfs' => 1,
! 2375: 'bft' => 1,
! 2376: 'bfu' => 1,
! 2377: 'bfw' => 1,
! 2378: 'bfy' => 1,
! 2379: 'bfz' => 1,
! 2380: 'bga' => 1,
! 2381: 'bgb' => 1,
! 2382: 'bgc' => 1,
! 2383: 'bgd' => 1,
! 2384: 'bge' => 1,
! 2385: 'bgf' => 1,
! 2386: 'bgg' => 1,
! 2387: 'bgi' => 1,
! 2388: 'bgj' => 1,
! 2389: 'bgk' => 1,
! 2390: 'bgl' => 1,
! 2391: 'bgm' => 1,
! 2392: 'bgo' => 1,
! 2393: 'bgr' => 1,
! 2394: 'bgs' => 1,
! 2395: 'bgt' => 1,
! 2396: 'bgu' => 1,
! 2397: 'bgv' => 1,
! 2398: 'bgw' => 1,
! 2399: 'bgx' => 1,
! 2400: 'bgy' => 1,
! 2401: 'bgz' => 1,
! 2402: 'bha' => 1,
! 2403: 'bhb' => 1,
! 2404: 'bhc' => 1,
! 2405: 'bhd' => 1,
! 2406: 'bhe' => 1,
! 2407: 'bhf' => 1,
! 2408: 'bhg' => 1,
! 2409: 'bhh' => 1,
! 2410: 'bhi' => 1,
! 2411: 'bhj' => 1,
! 2412: 'bhl' => 1,
! 2413: 'bhm' => 1,
! 2414: 'bhn' => 1,
! 2415: 'bho' => 1,
! 2416: 'bhp' => 1,
! 2417: 'bhq' => 1,
! 2418: 'bhs' => 1,
! 2419: 'bht' => 1,
! 2420: 'bhu' => 1,
! 2421: 'bhv' => 1,
! 2422: 'bhw' => 1,
! 2423: 'bhx' => 1,
! 2424: 'bhy' => 1,
! 2425: 'bhz' => 1,
! 2426: 'bia' => 1,
! 2427: 'bib' => 1,
! 2428: 'bic' => 1,
! 2429: 'bid' => 1,
! 2430: 'bie' => 1,
! 2431: 'bif' => 1,
! 2432: 'big' => 1,
! 2433: 'bij' => 1,
! 2434: 'bik' => 1,
! 2435: 'bil' => 1,
! 2436: 'bim' => 1,
! 2437: 'bin' => 1,
! 2438: 'bio' => 1,
! 2439: 'bip' => 1,
! 2440: 'biq' => 1,
! 2441: 'bir' => 1,
! 2442: 'bit' => 1,
! 2443: 'biu' => 1,
! 2444: 'biv' => 1,
! 2445: 'biw' => 1,
! 2446: 'bix' => 1,
! 2447: 'biy' => 1,
! 2448: 'biz' => 1,
! 2449: 'bja' => 1,
! 2450: 'bjb' => 1,
! 2451: 'bjc' => 1,
! 2452: 'bjd' => 1,
! 2453: 'bje' => 1,
! 2454: 'bjf' => 1,
! 2455: 'bjg' => 1,
! 2456: 'bjh' => 1,
! 2457: 'bji' => 1,
! 2458: 'bjj' => 1,
! 2459: 'bjk' => 1,
! 2460: 'bjl' => 1,
! 2461: 'bjm' => 1,
! 2462: 'bjo' => 1,
! 2463: 'bjr' => 1,
! 2464: 'bjs' => 1,
! 2465: 'bjt' => 1,
! 2466: 'bju' => 1,
! 2467: 'bjv' => 1,
! 2468: 'bjw' => 1,
! 2469: 'bjx' => 1,
! 2470: 'bjy' => 1,
! 2471: 'bjz' => 1,
! 2472: 'bka' => 1,
! 2473: 'bkb' => 1,
! 2474: 'bkc' => 1,
! 2475: 'bkd' => 1,
! 2476: 'bkf' => 1,
! 2477: 'bkg' => 1,
! 2478: 'bkh' => 1,
! 2479: 'bki' => 1,
! 2480: 'bkj' => 1,
! 2481: 'bkk' => 1,
! 2482: 'bkl' => 1,
! 2483: 'bkm' => 1,
! 2484: 'bkn' => 1,
! 2485: 'bko' => 1,
! 2486: 'bkp' => 1,
! 2487: 'bkq' => 1,
! 2488: 'bkr' => 1,
! 2489: 'bks' => 1,
! 2490: 'bkt' => 1,
! 2491: 'bku' => 1,
! 2492: 'bkv' => 1,
! 2493: 'bkw' => 1,
! 2494: 'bkx' => 1,
! 2495: 'bky' => 1,
! 2496: 'bkz' => 1,
! 2497: 'bla' => 1,
! 2498: 'blb' => 1,
! 2499: 'blc' => 1,
! 2500: 'bld' => 1,
! 2501: 'ble' => 1,
! 2502: 'blf' => 1,
! 2503: 'blg' => 1,
! 2504: 'blh' => 1,
! 2505: 'bli' => 1,
! 2506: 'blj' => 1,
! 2507: 'blk' => 1,
! 2508: 'bll' => 1,
! 2509: 'blm' => 1,
! 2510: 'blo' => 1,
! 2511: 'blp' => 1,
! 2512: 'blq' => 1,
! 2513: 'blr' => 1,
! 2514: 'bls' => 1,
! 2515: 'blt' => 1,
! 2516: 'blv' => 1,
! 2517: 'blw' => 1,
! 2518: 'blx' => 1,
! 2519: 'bly' => 1,
! 2520: 'blz' => 1,
! 2521: 'bma' => 1,
! 2522: 'bmb' => 1,
! 2523: 'bmc' => 1,
! 2524: 'bmd' => 1,
! 2525: 'bme' => 1,
! 2526: 'bmf' => 1,
! 2527: 'bmg' => 1,
! 2528: 'bmh' => 1,
! 2529: 'bmi' => 1,
! 2530: 'bmj' => 1,
! 2531: 'bmk' => 1,
! 2532: 'bml' => 1,
! 2533: 'bmn' => 1,
! 2534: 'bmo' => 1,
! 2535: 'bmp' => 1,
! 2536: 'bmq' => 1,
! 2537: 'bmr' => 1,
! 2538: 'bms' => 1,
! 2539: 'bmt' => 1,
! 2540: 'bmu' => 1,
! 2541: 'bmv' => 1,
! 2542: 'bmw' => 1,
! 2543: 'bmx' => 1,
! 2544: 'bmy' => 1,
! 2545: 'bmz' => 1,
! 2546: 'bna' => 1,
! 2547: 'bnb' => 1,
! 2548: 'bnc' => 1,
! 2549: 'bnd' => 1,
! 2550: 'bne' => 1,
! 2551: 'bnf' => 1,
! 2552: 'bng' => 1,
! 2553: 'bni' => 1,
! 2554: 'bnj' => 1,
! 2555: 'bnk' => 1,
! 2556: 'bnl' => 1,
! 2557: 'bnm' => 1,
! 2558: 'bnn' => 1,
! 2559: 'bno' => 1,
! 2560: 'bnp' => 1,
! 2561: 'bnq' => 1,
! 2562: 'bnr' => 1,
! 2563: 'bns' => 1,
! 2564: 'bnt' => 1,
! 2565: 'bnu' => 1,
! 2566: 'bnv' => 1,
! 2567: 'bnw' => 1,
! 2568: 'bnx' => 1,
! 2569: 'bny' => 1,
! 2570: 'bnz' => 1,
! 2571: 'boa' => 1,
! 2572: 'bob' => 1,
! 2573: 'boe' => 1,
! 2574: 'bof' => 1,
! 2575: 'bog' => 1,
! 2576: 'boh' => 1,
! 2577: 'boi' => 1,
! 2578: 'boj' => 1,
! 2579: 'bok' => 1,
! 2580: 'bol' => 1,
! 2581: 'bom' => 1,
! 2582: 'bon' => 1,
! 2583: 'boo' => 1,
! 2584: 'bop' => 1,
! 2585: 'boq' => 1,
! 2586: 'bor' => 1,
! 2587: 'bot' => 1,
! 2588: 'bou' => 1,
! 2589: 'bov' => 1,
! 2590: 'bow' => 1,
! 2591: 'box' => 1,
! 2592: 'boy' => 1,
! 2593: 'boz' => 1,
! 2594: 'bpa' => 1,
! 2595: 'bpb' => 1,
! 2596: 'bpd' => 1,
! 2597: 'bpg' => 1,
! 2598: 'bph' => 1,
! 2599: 'bpi' => 1,
! 2600: 'bpj' => 1,
! 2601: 'bpk' => 1,
! 2602: 'bpl' => 1,
! 2603: 'bpm' => 1,
! 2604: 'bpn' => 1,
! 2605: 'bpo' => 1,
! 2606: 'bpp' => 1,
! 2607: 'bpq' => 1,
! 2608: 'bpr' => 1,
! 2609: 'bps' => 1,
! 2610: 'bpt' => 1,
! 2611: 'bpu' => 1,
! 2612: 'bpv' => 1,
! 2613: 'bpw' => 1,
! 2614: 'bpx' => 1,
! 2615: 'bpy' => 1,
! 2616: 'bpz' => 1,
! 2617: 'bqa' => 1,
! 2618: 'bqb' => 1,
! 2619: 'bqc' => 1,
! 2620: 'bqd' => 1,
! 2621: 'bqf' => 1,
! 2622: 'bqg' => 1,
! 2623: 'bqh' => 1,
! 2624: 'bqi' => 1,
! 2625: 'bqj' => 1,
! 2626: 'bqk' => 1,
! 2627: 'bql' => 1,
! 2628: 'bqm' => 1,
! 2629: 'bqn' => 1,
! 2630: 'bqo' => 1,
! 2631: 'bqp' => 1,
! 2632: 'bqq' => 1,
! 2633: 'bqr' => 1,
! 2634: 'bqs' => 1,
! 2635: 'bqt' => 1,
! 2636: 'bqu' => 1,
! 2637: 'bqv' => 1,
! 2638: 'bqw' => 1,
! 2639: 'bqx' => 1,
! 2640: 'bqy' => 1,
! 2641: 'bqz' => 1,
! 2642: 'bra' => 1,
! 2643: 'brb' => 1,
! 2644: 'brc' => 1,
! 2645: 'brd' => 1,
! 2646: 'brf' => 1,
! 2647: 'brg' => 1,
! 2648: 'brh' => 1,
! 2649: 'bri' => 1,
! 2650: 'brj' => 1,
! 2651: 'brk' => 1,
! 2652: 'brl' => 1,
! 2653: 'brm' => 1,
! 2654: 'brn' => 1,
! 2655: 'bro' => 1,
! 2656: 'brp' => 1,
! 2657: 'brq' => 1,
! 2658: 'brr' => 1,
! 2659: 'brs' => 1,
! 2660: 'brt' => 1,
! 2661: 'bru' => 1,
! 2662: 'brv' => 1,
! 2663: 'brw' => 1,
! 2664: 'brx' => 1,
! 2665: 'bry' => 1,
! 2666: 'brz' => 1,
! 2667: 'bsa' => 1,
! 2668: 'bsb' => 1,
! 2669: 'bsc' => 1,
! 2670: 'bse' => 1,
! 2671: 'bsf' => 1,
! 2672: 'bsg' => 1,
! 2673: 'bsh' => 1,
! 2674: 'bsi' => 1,
! 2675: 'bsj' => 1,
! 2676: 'bsk' => 1,
! 2677: 'bsl' => 1,
! 2678: 'bsm' => 1,
! 2679: 'bsn' => 1,
! 2680: 'bso' => 1,
! 2681: 'bsp' => 1,
! 2682: 'bsq' => 1,
! 2683: 'bsr' => 1,
! 2684: 'bss' => 1,
! 2685: 'bst' => 1,
! 2686: 'bsu' => 1,
! 2687: 'bsv' => 1,
! 2688: 'bsw' => 1,
! 2689: 'bsx' => 1,
! 2690: 'bsy' => 1,
! 2691: 'bta' => 1,
! 2692: 'btb' => 1,
! 2693: 'btc' => 1,
! 2694: 'btd' => 1,
! 2695: 'bte' => 1,
! 2696: 'btf' => 1,
! 2697: 'btg' => 1,
! 2698: 'bth' => 1,
! 2699: 'bti' => 1,
! 2700: 'btk' => 1,
! 2701: 'btl' => 1,
! 2702: 'btm' => 1,
! 2703: 'btn' => 1,
! 2704: 'btp' => 1,
! 2705: 'btq' => 1,
! 2706: 'btr' => 1,
! 2707: 'bts' => 1,
! 2708: 'btt' => 1,
! 2709: 'btu' => 1,
! 2710: 'btv' => 1,
! 2711: 'btw' => 1,
! 2712: 'btx' => 1,
! 2713: 'bty' => 1,
! 2714: 'btz' => 1,
! 2715: 'bua' => 1,
! 2716: 'bub' => 1,
! 2717: 'buc' => 1,
! 2718: 'bud' => 1,
! 2719: 'bue' => 1,
! 2720: 'buf' => 1,
! 2721: 'bug' => 1,
! 2722: 'buh' => 1,
! 2723: 'bui' => 1,
! 2724: 'buj' => 1,
! 2725: 'buk' => 1,
! 2726: 'bum' => 1,
! 2727: 'bun' => 1,
! 2728: 'buo' => 1,
! 2729: 'bup' => 1,
! 2730: 'buq' => 1,
! 2731: 'bus' => 1,
! 2732: 'but' => 1,
! 2733: 'buu' => 1,
! 2734: 'buv' => 1,
! 2735: 'buw' => 1,
! 2736: 'bux' => 1,
! 2737: 'buy' => 1,
! 2738: 'buz' => 1,
! 2739: 'bva' => 1,
! 2740: 'bvb' => 1,
! 2741: 'bvc' => 1,
! 2742: 'bvd' => 1,
! 2743: 'bvf' => 1,
! 2744: 'bvg' => 1,
! 2745: 'bvh' => 1,
! 2746: 'bvi' => 1,
! 2747: 'bvj' => 1,
! 2748: 'bvk' => 1,
! 2749: 'bvl' => 1,
! 2750: 'bvm' => 1,
! 2751: 'bvn' => 1,
! 2752: 'bvo' => 1,
! 2753: 'bvq' => 1,
! 2754: 'bvr' => 1,
! 2755: 'bvt' => 1,
! 2756: 'bvv' => 1,
! 2757: 'bvw' => 1,
! 2758: 'bvx' => 1,
! 2759: 'bvz' => 1,
! 2760: 'bwa' => 1,
! 2761: 'bwb' => 1,
! 2762: 'bwc' => 1,
! 2763: 'bwd' => 1,
! 2764: 'bwe' => 1,
! 2765: 'bwf' => 1,
! 2766: 'bwg' => 1,
! 2767: 'bwh' => 1,
! 2768: 'bwi' => 1,
! 2769: 'bwj' => 1,
! 2770: 'bwk' => 1,
! 2771: 'bwl' => 1,
! 2772: 'bwm' => 1,
! 2773: 'bwn' => 1,
! 2774: 'bwo' => 1,
! 2775: 'bwp' => 1,
! 2776: 'bwq' => 1,
! 2777: 'bwr' => 1,
! 2778: 'bws' => 1,
! 2779: 'bwt' => 1,
! 2780: 'bwu' => 1,
! 2781: 'bww' => 1,
! 2782: 'bwx' => 1,
! 2783: 'bwy' => 1,
! 2784: 'bwz' => 1,
! 2785: 'bxa' => 1,
! 2786: 'bxb' => 1,
! 2787: 'bxc' => 1,
! 2788: 'bxd' => 1,
! 2789: 'bxe' => 1,
! 2790: 'bxf' => 1,
! 2791: 'bxg' => 1,
! 2792: 'bxh' => 1,
! 2793: 'bxi' => 1,
! 2794: 'bxj' => 1,
! 2795: 'bxl' => 1,
! 2796: 'bxn' => 1,
! 2797: 'bxo' => 1,
! 2798: 'bxp' => 1,
! 2799: 'bxq' => 1,
! 2800: 'bxs' => 1,
! 2801: 'bxv' => 1,
! 2802: 'bxw' => 1,
! 2803: 'bxx' => 1,
! 2804: 'bxz' => 1,
! 2805: 'bya' => 1,
! 2806: 'byb' => 1,
! 2807: 'byc' => 1,
! 2808: 'byd' => 1,
! 2809: 'bye' => 1,
! 2810: 'byf' => 1,
! 2811: 'byg' => 1,
! 2812: 'byh' => 1,
! 2813: 'byi' => 1,
! 2814: 'byj' => 1,
! 2815: 'byk' => 1,
! 2816: 'byl' => 1,
! 2817: 'bym' => 1,
! 2818: 'byn' => 1,
! 2819: 'byo' => 1,
! 2820: 'byp' => 1,
! 2821: 'byq' => 1,
! 2822: 'byr' => 1,
! 2823: 'bys' => 1,
! 2824: 'byt' => 1,
! 2825: 'byv' => 1,
! 2826: 'byw' => 1,
! 2827: 'byx' => 1,
! 2828: 'byy' => 1,
! 2829: 'byz' => 1,
! 2830: 'bza' => 1,
! 2831: 'bzb' => 1,
! 2832: 'bzd' => 1,
! 2833: 'bze' => 1,
! 2834: 'bzf' => 1,
! 2835: 'bzg' => 1,
! 2836: 'bzh' => 1,
! 2837: 'bzi' => 1,
! 2838: 'bzj' => 1,
! 2839: 'bzk' => 1,
! 2840: 'bzl' => 1,
! 2841: 'bzm' => 1,
! 2842: 'bzn' => 1,
! 2843: 'bzo' => 1,
! 2844: 'bzp' => 1,
! 2845: 'bzq' => 1,
! 2846: 'bzr' => 1,
! 2847: 'bzs' => 1,
! 2848: 'bzt' => 1,
! 2849: 'bzu' => 1,
! 2850: 'bzv' => 1,
! 2851: 'bzw' => 1,
! 2852: 'bzx' => 1,
! 2853: 'bzy' => 1,
! 2854: 'bzz' => 1,
! 2855: 'caa' => 1,
! 2856: 'cab' => 1,
! 2857: 'cac' => 1,
! 2858: 'cad' => 1,
! 2859: 'cae' => 1,
! 2860: 'caf' => 1,
! 2861: 'cag' => 1,
! 2862: 'cah' => 1,
! 2863: 'cai' => 1,
! 2864: 'caj' => 1,
! 2865: 'cak' => 1,
! 2866: 'cal' => 1,
! 2867: 'cam' => 1,
! 2868: 'can' => 1,
! 2869: 'cao' => 1,
! 2870: 'cap' => 1,
! 2871: 'caq' => 1,
! 2872: 'car' => 1,
! 2873: 'cas' => 1,
! 2874: 'cau' => 1,
! 2875: 'cav' => 1,
! 2876: 'caw' => 1,
! 2877: 'cax' => 1,
! 2878: 'cay' => 1,
! 2879: 'caz' => 1,
! 2880: 'cba' => 1,
! 2881: 'cbb' => 1,
! 2882: 'cbc' => 1,
! 2883: 'cbd' => 1,
! 2884: 'cbe' => 1,
! 2885: 'cbg' => 1,
! 2886: 'cbh' => 1,
! 2887: 'cbi' => 1,
! 2888: 'cbj' => 1,
! 2889: 'cbk' => 1,
! 2890: 'cbl' => 1,
! 2891: 'cbn' => 1,
! 2892: 'cbo' => 1,
! 2893: 'cbr' => 1,
! 2894: 'cbs' => 1,
! 2895: 'cbt' => 1,
! 2896: 'cbu' => 1,
! 2897: 'cbv' => 1,
! 2898: 'cby' => 1,
! 2899: 'cca' => 1,
! 2900: 'ccc' => 1,
! 2901: 'ccd' => 1,
! 2902: 'cce' => 1,
! 2903: 'ccg' => 1,
! 2904: 'cch' => 1,
! 2905: 'ccj' => 1,
! 2906: 'ccl' => 1,
! 2907: 'ccm' => 1,
! 2908: 'ccn' => 1,
! 2909: 'cco' => 1,
! 2910: 'ccp' => 1,
! 2911: 'ccq' => 1,
! 2912: 'ccr' => 1,
! 2913: 'ccs' => 1,
! 2914: 'cda' => 1,
! 2915: 'cdc' => 1,
! 2916: 'cdd' => 1,
! 2917: 'cde' => 1,
! 2918: 'cdf' => 1,
! 2919: 'cdg' => 1,
! 2920: 'cdh' => 1,
! 2921: 'cdi' => 1,
! 2922: 'cdj' => 1,
! 2923: 'cdm' => 1,
! 2924: 'cdn' => 1,
! 2925: 'cdr' => 1,
! 2926: 'cds' => 1,
! 2927: 'cdy' => 1,
! 2928: 'cdz' => 1,
! 2929: 'cea' => 1,
! 2930: 'ceb' => 1,
! 2931: 'ceg' => 1,
! 2932: 'cel' => 1,
! 2933: 'cen' => 1,
! 2934: 'cet' => 1,
! 2935: 'cfa' => 1,
! 2936: 'cfd' => 1,
! 2937: 'cfg' => 1,
! 2938: 'cfm' => 1,
! 2939: 'cga' => 1,
! 2940: 'cgc' => 1,
! 2941: 'cgg' => 1,
! 2942: 'cgk' => 1,
! 2943: 'chb' => 1,
! 2944: 'chc' => 1,
! 2945: 'chd' => 1,
! 2946: 'chf' => 1,
! 2947: 'chg' => 1,
! 2948: 'chh' => 1,
! 2949: 'chj' => 1,
! 2950: 'chk' => 1,
! 2951: 'chl' => 1,
! 2952: 'chm' => 1,
! 2953: 'chn' => 1,
! 2954: 'cho' => 1,
! 2955: 'chp' => 1,
! 2956: 'chq' => 1,
! 2957: 'chr' => 1,
! 2958: 'cht' => 1,
! 2959: 'chw' => 1,
! 2960: 'chx' => 1,
! 2961: 'chy' => 1,
! 2962: 'chz' => 1,
! 2963: 'cia' => 1,
! 2964: 'cib' => 1,
! 2965: 'cic' => 1,
! 2966: 'cid' => 1,
! 2967: 'cie' => 1,
! 2968: 'cih' => 1,
! 2969: 'cik' => 1,
! 2970: 'cim' => 1,
! 2971: 'cin' => 1,
! 2972: 'cip' => 1,
! 2973: 'cir' => 1,
! 2974: 'ciy' => 1,
! 2975: 'cja' => 1,
! 2976: 'cje' => 1,
! 2977: 'cjh' => 1,
! 2978: 'cji' => 1,
! 2979: 'cjk' => 1,
! 2980: 'cjm' => 1,
! 2981: 'cjn' => 1,
! 2982: 'cjo' => 1,
! 2983: 'cjp' => 1,
! 2984: 'cjr' => 1,
! 2985: 'cjs' => 1,
! 2986: 'cjv' => 1,
! 2987: 'cka' => 1,
! 2988: 'ckh' => 1,
! 2989: 'ckl' => 1,
! 2990: 'cko' => 1,
! 2991: 'ckq' => 1,
! 2992: 'ckr' => 1,
! 2993: 'cks' => 1,
! 2994: 'ckt' => 1,
! 2995: 'cku' => 1,
! 2996: 'ckv' => 1,
! 2997: 'ckx' => 1,
! 2998: 'cky' => 1,
! 2999: 'ckz' => 1,
! 3000: 'cla' => 1,
! 3001: 'clc' => 1,
! 3002: 'cle' => 1,
! 3003: 'clh' => 1,
! 3004: 'cli' => 1,
! 3005: 'clk' => 1,
! 3006: 'cll' => 1,
! 3007: 'clm' => 1,
! 3008: 'clo' => 1,
! 3009: 'clu' => 1,
! 3010: 'clw' => 1,
! 3011: 'cly' => 1,
! 3012: 'cma' => 1,
! 3013: 'cmc' => 1,
! 3014: 'cme' => 1,
! 3015: 'cmg' => 1,
! 3016: 'cmi' => 1,
! 3017: 'cmk' => 1,
! 3018: 'cml' => 1,
! 3019: 'cmm' => 1,
! 3020: 'cmo' => 1,
! 3021: 'cmr' => 1,
! 3022: 'cms' => 1,
! 3023: 'cmt' => 1,
! 3024: 'cna' => 1,
! 3025: 'cnb' => 1,
! 3026: 'cnc' => 1,
! 3027: 'cng' => 1,
! 3028: 'cnh' => 1,
! 3029: 'cni' => 1,
! 3030: 'cnk' => 1,
! 3031: 'cnl' => 1,
! 3032: 'cno' => 1,
! 3033: 'cns' => 1,
! 3034: 'cnt' => 1,
! 3035: 'cnu' => 1,
! 3036: 'cnw' => 1,
! 3037: 'cnx' => 1,
! 3038: 'cob' => 1,
! 3039: 'coc' => 1,
! 3040: 'cod' => 1,
! 3041: 'coe' => 1,
! 3042: 'cof' => 1,
! 3043: 'cog' => 1,
! 3044: 'coh' => 1,
! 3045: 'coj' => 1,
! 3046: 'cok' => 1,
! 3047: 'col' => 1,
! 3048: 'com' => 1,
! 3049: 'con' => 1,
! 3050: 'coo' => 1,
! 3051: 'cop' => 1,
! 3052: 'coq' => 1,
! 3053: 'cot' => 1,
! 3054: 'cou' => 1,
! 3055: 'cov' => 1,
! 3056: 'cow' => 1,
! 3057: 'cox' => 1,
! 3058: 'coy' => 1,
! 3059: 'coz' => 1,
! 3060: 'cpa' => 1,
! 3061: 'cpb' => 1,
! 3062: 'cpc' => 1,
! 3063: 'cpe' => 1,
! 3064: 'cpf' => 1,
! 3065: 'cpg' => 1,
! 3066: 'cpi' => 1,
! 3067: 'cpn' => 1,
! 3068: 'cpp' => 1,
! 3069: 'cps' => 1,
! 3070: 'cpu' => 1,
! 3071: 'cpy' => 1,
! 3072: 'cra' => 1,
! 3073: 'crb' => 1,
! 3074: 'crc' => 1,
! 3075: 'crd' => 1,
! 3076: 'crf' => 1,
! 3077: 'crg' => 1,
! 3078: 'crh' => 1,
! 3079: 'cri' => 1,
! 3080: 'crn' => 1,
! 3081: 'cro' => 1,
! 3082: 'crp' => 1,
! 3083: 'crq' => 1,
! 3084: 'crr' => 1,
! 3085: 'crs' => 1,
! 3086: 'crt' => 1,
! 3087: 'crv' => 1,
! 3088: 'crw' => 1,
! 3089: 'crx' => 1,
! 3090: 'cry' => 1,
! 3091: 'crz' => 1,
! 3092: 'csa' => 1,
! 3093: 'csb' => 1,
! 3094: 'csc' => 1,
! 3095: 'csd' => 1,
! 3096: 'cse' => 1,
! 3097: 'csf' => 1,
! 3098: 'csg' => 1,
! 3099: 'csh' => 1,
! 3100: 'csi' => 1,
! 3101: 'csk' => 1,
! 3102: 'csl' => 1,
! 3103: 'csm' => 1,
! 3104: 'csn' => 1,
! 3105: 'cso' => 1,
! 3106: 'csq' => 1,
! 3107: 'csr' => 1,
! 3108: 'css' => 1,
! 3109: 'cst' => 1,
! 3110: 'csu' => 1,
! 3111: 'csy' => 1,
! 3112: 'csz' => 1,
! 3113: 'cta' => 1,
! 3114: 'ctc' => 1,
! 3115: 'ctd' => 1,
! 3116: 'cte' => 1,
! 3117: 'ctg' => 1,
! 3118: 'ctl' => 1,
! 3119: 'ctm' => 1,
! 3120: 'ctn' => 1,
! 3121: 'cto' => 1,
! 3122: 'ctp' => 1,
! 3123: 'ctt' => 1,
! 3124: 'ctu' => 1,
! 3125: 'ctz' => 1,
! 3126: 'cua' => 1,
! 3127: 'cub' => 1,
! 3128: 'cuc' => 1,
! 3129: 'cug' => 1,
! 3130: 'cuh' => 1,
! 3131: 'cui' => 1,
! 3132: 'cuj' => 1,
! 3133: 'cuk' => 1,
! 3134: 'cul' => 1,
! 3135: 'cum' => 1,
! 3136: 'cuo' => 1,
! 3137: 'cup' => 1,
! 3138: 'cuq' => 1,
! 3139: 'cur' => 1,
! 3140: 'cus' => 1,
! 3141: 'cut' => 1,
! 3142: 'cuu' => 1,
! 3143: 'cuv' => 1,
! 3144: 'cuw' => 1,
! 3145: 'cux' => 1,
! 3146: 'cvg' => 1,
! 3147: 'cvn' => 1,
! 3148: 'cwa' => 1,
! 3149: 'cwb' => 1,
! 3150: 'cwe' => 1,
! 3151: 'cwg' => 1,
! 3152: 'cwt' => 1,
! 3153: 'cya' => 1,
! 3154: 'cyb' => 1,
! 3155: 'cyo' => 1,
! 3156: 'czk' => 1,
! 3157: 'czn' => 1,
! 3158: 'czt' => 1,
! 3159: 'daa' => 1,
! 3160: 'dac' => 1,
! 3161: 'dad' => 1,
! 3162: 'dae' => 1,
! 3163: 'daf' => 1,
! 3164: 'dag' => 1,
! 3165: 'dah' => 1,
! 3166: 'dai' => 1,
! 3167: 'daj' => 1,
! 3168: 'dak' => 1,
! 3169: 'dal' => 1,
! 3170: 'dam' => 1,
! 3171: 'dao' => 1,
! 3172: 'dap' => 1,
! 3173: 'daq' => 1,
! 3174: 'dar' => 1,
! 3175: 'das' => 1,
! 3176: 'dau' => 1,
! 3177: 'dav' => 1,
! 3178: 'daw' => 1,
! 3179: 'dax' => 1,
! 3180: 'day' => 1,
! 3181: 'daz' => 1,
! 3182: 'dba' => 1,
! 3183: 'dbb' => 1,
! 3184: 'dbd' => 1,
! 3185: 'dbe' => 1,
! 3186: 'dbf' => 1,
! 3187: 'dbg' => 1,
! 3188: 'dbi' => 1,
! 3189: 'dbj' => 1,
! 3190: 'dbl' => 1,
! 3191: 'dbm' => 1,
! 3192: 'dbn' => 1,
! 3193: 'dbo' => 1,
! 3194: 'dbp' => 1,
! 3195: 'dbq' => 1,
! 3196: 'dbr' => 1,
! 3197: 'dbu' => 1,
! 3198: 'dbv' => 1,
! 3199: 'dby' => 1,
! 3200: 'dcc' => 1,
! 3201: 'dcr' => 1,
! 3202: 'ddd' => 1,
! 3203: 'dde' => 1,
! 3204: 'ddg' => 1,
! 3205: 'ddi' => 1,
! 3206: 'ddj' => 1,
! 3207: 'ddn' => 1,
! 3208: 'ddo' => 1,
! 3209: 'dds' => 1,
! 3210: 'ddw' => 1,
! 3211: 'dec' => 1,
! 3212: 'ded' => 1,
! 3213: 'dee' => 1,
! 3214: 'def' => 1,
! 3215: 'deg' => 1,
! 3216: 'deh' => 1,
! 3217: 'dei' => 1,
! 3218: 'dek' => 1,
! 3219: 'del' => 1,
! 3220: 'dem' => 1,
! 3221: 'den' => 1,
! 3222: 'dep' => 1,
! 3223: 'deq' => 1,
! 3224: 'der' => 1,
! 3225: 'des' => 1,
! 3226: 'dev' => 1,
! 3227: 'dez' => 1,
! 3228: 'dga' => 1,
! 3229: 'dgb' => 1,
! 3230: 'dgc' => 1,
! 3231: 'dgd' => 1,
! 3232: 'dge' => 1,
! 3233: 'dgg' => 1,
! 3234: 'dgh' => 1,
! 3235: 'dgi' => 1,
! 3236: 'dgk' => 1,
! 3237: 'dgn' => 1,
! 3238: 'dgr' => 1,
! 3239: 'dgs' => 1,
! 3240: 'dgu' => 1,
! 3241: 'dgx' => 1,
! 3242: 'dgz' => 1,
! 3243: 'dha' => 1,
! 3244: 'dhg' => 1,
! 3245: 'dhi' => 1,
! 3246: 'dhl' => 1,
! 3247: 'dhm' => 1,
! 3248: 'dhn' => 1,
! 3249: 'dho' => 1,
! 3250: 'dhr' => 1,
! 3251: 'dhs' => 1,
! 3252: 'dhu' => 1,
! 3253: 'dhv' => 1,
! 3254: 'dhw' => 1,
! 3255: 'dia' => 1,
! 3256: 'dic' => 1,
! 3257: 'did' => 1,
! 3258: 'dif' => 1,
! 3259: 'dig' => 1,
! 3260: 'dih' => 1,
! 3261: 'dii' => 1,
! 3262: 'dij' => 1,
! 3263: 'dil' => 1,
! 3264: 'dim' => 1,
! 3265: 'din' => 1,
! 3266: 'dio' => 1,
! 3267: 'dir' => 1,
! 3268: 'dis' => 1,
! 3269: 'dit' => 1,
! 3270: 'diu' => 1,
! 3271: 'dix' => 1,
! 3272: 'diy' => 1,
! 3273: 'diz' => 1,
! 3274: 'djb' => 1,
! 3275: 'djc' => 1,
! 3276: 'djd' => 1,
! 3277: 'dje' => 1,
! 3278: 'djf' => 1,
! 3279: 'dji' => 1,
! 3280: 'djj' => 1,
! 3281: 'djk' => 1,
! 3282: 'djl' => 1,
! 3283: 'djm' => 1,
! 3284: 'djn' => 1,
! 3285: 'djo' => 1,
! 3286: 'djr' => 1,
! 3287: 'dju' => 1,
! 3288: 'djw' => 1,
! 3289: 'dka' => 1,
! 3290: 'dkk' => 1,
! 3291: 'dkl' => 1,
! 3292: 'dkr' => 1,
! 3293: 'dkx' => 1,
! 3294: 'dlg' => 1,
! 3295: 'dlm' => 1,
! 3296: 'dln' => 1,
! 3297: 'dma' => 1,
! 3298: 'dmc' => 1,
! 3299: 'dme' => 1,
! 3300: 'dmg' => 1,
! 3301: 'dmk' => 1,
! 3302: 'dml' => 1,
! 3303: 'dmm' => 1,
! 3304: 'dmn' => 1,
! 3305: 'dmo' => 1,
! 3306: 'dmr' => 1,
! 3307: 'dms' => 1,
! 3308: 'dmu' => 1,
! 3309: 'dmv' => 1,
! 3310: 'dmx' => 1,
! 3311: 'dmy' => 1,
! 3312: 'dna' => 1,
! 3313: 'dnd' => 1,
! 3314: 'dne' => 1,
! 3315: 'dng' => 1,
! 3316: 'dni' => 1,
! 3317: 'dnk' => 1,
! 3318: 'dnn' => 1,
! 3319: 'dnr' => 1,
! 3320: 'dnt' => 1,
! 3321: 'dnu' => 1,
! 3322: 'dnw' => 1,
! 3323: 'dny' => 1,
! 3324: 'doa' => 1,
! 3325: 'dob' => 1,
! 3326: 'doc' => 1,
! 3327: 'doe' => 1,
! 3328: 'dof' => 1,
! 3329: 'doh' => 1,
! 3330: 'doi' => 1,
! 3331: 'dok' => 1,
! 3332: 'dol' => 1,
! 3333: 'don' => 1,
! 3334: 'doo' => 1,
! 3335: 'dop' => 1,
! 3336: 'doq' => 1,
! 3337: 'dor' => 1,
! 3338: 'dos' => 1,
! 3339: 'dot' => 1,
! 3340: 'dov' => 1,
! 3341: 'dow' => 1,
! 3342: 'dox' => 1,
! 3343: 'doy' => 1,
! 3344: 'doz' => 1,
! 3345: 'dpp' => 1,
! 3346: 'dra' => 1,
! 3347: 'drb' => 1,
! 3348: 'drd' => 1,
! 3349: 'dre' => 1,
! 3350: 'drg' => 1,
! 3351: 'drh' => 1,
! 3352: 'dri' => 1,
! 3353: 'drl' => 1,
! 3354: 'drn' => 1,
! 3355: 'dro' => 1,
! 3356: 'drq' => 1,
! 3357: 'drr' => 1,
! 3358: 'drs' => 1,
! 3359: 'drt' => 1,
! 3360: 'dru' => 1,
! 3361: 'drw' => 1,
! 3362: 'dry' => 1,
! 3363: 'dsb' => 1,
! 3364: 'dse' => 1,
! 3365: 'dsh' => 1,
! 3366: 'dsi' => 1,
! 3367: 'dsl' => 1,
! 3368: 'dsn' => 1,
! 3369: 'dso' => 1,
! 3370: 'dsq' => 1,
! 3371: 'dta' => 1,
! 3372: 'dtb' => 1,
! 3373: 'dti' => 1,
! 3374: 'dtk' => 1,
! 3375: 'dtm' => 1,
! 3376: 'dtp' => 1,
! 3377: 'dtr' => 1,
! 3378: 'dts' => 1,
! 3379: 'dtt' => 1,
! 3380: 'dtu' => 1,
! 3381: 'dua' => 1,
! 3382: 'dub' => 1,
! 3383: 'duc' => 1,
! 3384: 'dud' => 1,
! 3385: 'due' => 1,
! 3386: 'duf' => 1,
! 3387: 'dug' => 1,
! 3388: 'duh' => 1,
! 3389: 'dui' => 1,
! 3390: 'duj' => 1,
! 3391: 'duk' => 1,
! 3392: 'dul' => 1,
! 3393: 'dum' => 1,
! 3394: 'dun' => 1,
! 3395: 'duo' => 1,
! 3396: 'duq' => 1,
! 3397: 'dur' => 1,
! 3398: 'dus' => 1,
! 3399: 'duu' => 1,
! 3400: 'duv' => 1,
! 3401: 'duw' => 1,
! 3402: 'dux' => 1,
! 3403: 'duy' => 1,
! 3404: 'duz' => 1,
! 3405: 'dva' => 1,
! 3406: 'dwa' => 1,
! 3407: 'dwl' => 1,
! 3408: 'dwr' => 1,
! 3409: 'dws' => 1,
! 3410: 'dww' => 1,
! 3411: 'dya' => 1,
! 3412: 'dyb' => 1,
! 3413: 'dyd' => 1,
! 3414: 'dyg' => 1,
! 3415: 'dyi' => 1,
! 3416: 'dym' => 1,
! 3417: 'dyn' => 1,
! 3418: 'dyo' => 1,
! 3419: 'dyu' => 1,
! 3420: 'dyy' => 1,
! 3421: 'dza' => 1,
! 3422: 'dzd' => 1,
! 3423: 'dzg' => 1,
! 3424: 'dzl' => 1,
! 3425: 'dzn' => 1,
! 3426: 'ebg' => 1,
! 3427: 'ebo' => 1,
! 3428: 'ebr' => 1,
! 3429: 'ebu' => 1,
! 3430: 'ecr' => 1,
! 3431: 'ecs' => 1,
! 3432: 'ecy' => 1,
! 3433: 'eee' => 1,
! 3434: 'efa' => 1,
! 3435: 'efe' => 1,
! 3436: 'efi' => 1,
! 3437: 'ega' => 1,
! 3438: 'egl' => 1,
! 3439: 'ego' => 1,
! 3440: 'egx' => 1,
! 3441: 'egy' => 1,
! 3442: 'ehu' => 1,
! 3443: 'eip' => 1,
! 3444: 'eit' => 1,
! 3445: 'eiv' => 1,
! 3446: 'eja' => 1,
! 3447: 'eka' => 1,
! 3448: 'eke' => 1,
! 3449: 'ekg' => 1,
! 3450: 'eki' => 1,
! 3451: 'ekl' => 1,
! 3452: 'ekm' => 1,
! 3453: 'eko' => 1,
! 3454: 'ekp' => 1,
! 3455: 'ekr' => 1,
! 3456: 'eky' => 1,
! 3457: 'ele' => 1,
! 3458: 'elh' => 1,
! 3459: 'eli' => 1,
! 3460: 'elk' => 1,
! 3461: 'elm' => 1,
! 3462: 'elo' => 1,
! 3463: 'elp' => 1,
! 3464: 'elu' => 1,
! 3465: 'elx' => 1,
! 3466: 'ema' => 1,
! 3467: 'emb' => 1,
! 3468: 'eme' => 1,
! 3469: 'emg' => 1,
! 3470: 'emi' => 1,
! 3471: 'emm' => 1,
! 3472: 'emn' => 1,
! 3473: 'emo' => 1,
! 3474: 'emp' => 1,
! 3475: 'ems' => 1,
! 3476: 'emu' => 1,
! 3477: 'emw' => 1,
! 3478: 'emy' => 1,
! 3479: 'ena' => 1,
! 3480: 'enc' => 1,
! 3481: 'end' => 1,
! 3482: 'enf' => 1,
! 3483: 'enh' => 1,
! 3484: 'enm' => 1,
! 3485: 'enn' => 1,
! 3486: 'eno' => 1,
! 3487: 'enq' => 1,
! 3488: 'enr' => 1,
! 3489: 'enu' => 1,
! 3490: 'env' => 1,
! 3491: 'enw' => 1,
! 3492: 'eot' => 1,
! 3493: 'epi' => 1,
! 3494: 'era' => 1,
! 3495: 'erg' => 1,
! 3496: 'erh' => 1,
! 3497: 'eri' => 1,
! 3498: 'erk' => 1,
! 3499: 'ero' => 1,
! 3500: 'err' => 1,
! 3501: 'ers' => 1,
! 3502: 'ert' => 1,
! 3503: 'erw' => 1,
! 3504: 'ese' => 1,
! 3505: 'esh' => 1,
! 3506: 'esl' => 1,
! 3507: 'esm' => 1,
! 3508: 'esn' => 1,
! 3509: 'eso' => 1,
! 3510: 'esq' => 1,
! 3511: 'ess' => 1,
! 3512: 'esu' => 1,
! 3513: 'esx' => 1,
! 3514: 'etb' => 1,
! 3515: 'etc' => 1,
! 3516: 'eth' => 1,
! 3517: 'etn' => 1,
! 3518: 'eto' => 1,
! 3519: 'etr' => 1,
! 3520: 'ets' => 1,
! 3521: 'ett' => 1,
! 3522: 'etu' => 1,
! 3523: 'etx' => 1,
! 3524: 'etz' => 1,
! 3525: 'euq' => 1,
! 3526: 'eve' => 1,
! 3527: 'evh' => 1,
! 3528: 'evn' => 1,
! 3529: 'ewo' => 1,
! 3530: 'ext' => 1,
! 3531: 'eya' => 1,
! 3532: 'eze' => 1,
! 3533: 'faa' => 1,
! 3534: 'fab' => 1,
! 3535: 'fad' => 1,
! 3536: 'faf' => 1,
! 3537: 'fag' => 1,
! 3538: 'fah' => 1,
! 3539: 'fai' => 1,
! 3540: 'faj' => 1,
! 3541: 'fak' => 1,
! 3542: 'fal' => 1,
! 3543: 'fam' => 1,
! 3544: 'fan' => 1,
! 3545: 'fap' => 1,
! 3546: 'far' => 1,
! 3547: 'fau' => 1,
! 3548: 'fax' => 1,
! 3549: 'fay' => 1,
! 3550: 'faz' => 1,
! 3551: 'fcs' => 1,
! 3552: 'fer' => 1,
! 3553: 'ffi' => 1,
! 3554: 'fgr' => 1,
! 3555: 'fia' => 1,
! 3556: 'fie' => 1,
! 3557: 'fil' => 1,
! 3558: 'fip' => 1,
! 3559: 'fir' => 1,
! 3560: 'fit' => 1,
! 3561: 'fiu' => 1,
! 3562: 'fiw' => 1,
! 3563: 'fkv' => 1,
! 3564: 'fla' => 1,
! 3565: 'flh' => 1,
! 3566: 'fli' => 1,
! 3567: 'fll' => 1,
! 3568: 'fln' => 1,
! 3569: 'flr' => 1,
! 3570: 'fly' => 1,
! 3571: 'fmp' => 1,
! 3572: 'fmu' => 1,
! 3573: 'fng' => 1,
! 3574: 'fni' => 1,
! 3575: 'fod' => 1,
! 3576: 'foi' => 1,
! 3577: 'fom' => 1,
! 3578: 'fon' => 1,
! 3579: 'for' => 1,
! 3580: 'fos' => 1,
! 3581: 'fox' => 1,
! 3582: 'fpe' => 1,
! 3583: 'fqs' => 1,
! 3584: 'frc' => 1,
! 3585: 'frd' => 1,
! 3586: 'frk' => 1,
! 3587: 'frm' => 1,
! 3588: 'fro' => 1,
! 3589: 'frp' => 1,
! 3590: 'frq' => 1,
! 3591: 'frr' => 1,
! 3592: 'frs' => 1,
! 3593: 'frt' => 1,
! 3594: 'fse' => 1,
! 3595: 'fsl' => 1,
! 3596: 'fss' => 1,
! 3597: 'fud' => 1,
! 3598: 'fuj' => 1,
! 3599: 'fum' => 1,
! 3600: 'fun' => 1,
! 3601: 'fur' => 1,
! 3602: 'fut' => 1,
! 3603: 'fuu' => 1,
! 3604: 'fuy' => 1,
! 3605: 'fvr' => 1,
! 3606: 'fwa' => 1,
! 3607: 'fwe' => 1,
! 3608: 'gaa' => 1,
! 3609: 'gab' => 1,
! 3610: 'gad' => 1,
! 3611: 'gae' => 1,
! 3612: 'gaf' => 1,
! 3613: 'gag' => 1,
! 3614: 'gah' => 1,
! 3615: 'gai' => 1,
! 3616: 'gaj' => 1,
! 3617: 'gak' => 1,
! 3618: 'gal' => 1,
! 3619: 'gam' => 1,
! 3620: 'gao' => 1,
! 3621: 'gap' => 1,
! 3622: 'gaq' => 1,
! 3623: 'gar' => 1,
! 3624: 'gas' => 1,
! 3625: 'gat' => 1,
! 3626: 'gau' => 1,
! 3627: 'gav' => 1,
! 3628: 'gaw' => 1,
! 3629: 'gay' => 1,
! 3630: 'gba' => 1,
! 3631: 'gbb' => 1,
! 3632: 'gbc' => 1,
! 3633: 'gbd' => 1,
! 3634: 'gbe' => 1,
! 3635: 'gbf' => 1,
! 3636: 'gbg' => 1,
! 3637: 'gbh' => 1,
! 3638: 'gbi' => 1,
! 3639: 'gbj' => 1,
! 3640: 'gbk' => 1,
! 3641: 'gbl' => 1,
! 3642: 'gbm' => 1,
! 3643: 'gbn' => 1,
! 3644: 'gbr' => 1,
! 3645: 'gbs' => 1,
! 3646: 'gbu' => 1,
! 3647: 'gbv' => 1,
! 3648: 'gbx' => 1,
! 3649: 'gby' => 1,
! 3650: 'gbz' => 1,
! 3651: 'gcc' => 1,
! 3652: 'gcd' => 1,
! 3653: 'gce' => 1,
! 3654: 'gcf' => 1,
! 3655: 'gcl' => 1,
! 3656: 'gcn' => 1,
! 3657: 'gcr' => 1,
! 3658: 'gct' => 1,
! 3659: 'gdb' => 1,
! 3660: 'gdc' => 1,
! 3661: 'gdd' => 1,
! 3662: 'gde' => 1,
! 3663: 'gdf' => 1,
! 3664: 'gdg' => 1,
! 3665: 'gdh' => 1,
! 3666: 'gdi' => 1,
! 3667: 'gdj' => 1,
! 3668: 'gdk' => 1,
! 3669: 'gdl' => 1,
! 3670: 'gdm' => 1,
! 3671: 'gdn' => 1,
! 3672: 'gdo' => 1,
! 3673: 'gdq' => 1,
! 3674: 'gdr' => 1,
! 3675: 'gdu' => 1,
! 3676: 'gdx' => 1,
! 3677: 'gea' => 1,
! 3678: 'geb' => 1,
! 3679: 'ged' => 1,
! 3680: 'geg' => 1,
! 3681: 'geh' => 1,
! 3682: 'gei' => 1,
! 3683: 'gej' => 1,
! 3684: 'gek' => 1,
! 3685: 'gel' => 1,
! 3686: 'gem' => 1,
! 3687: 'geq' => 1,
! 3688: 'ges' => 1,
! 3689: 'gew' => 1,
! 3690: 'gex' => 1,
! 3691: 'gey' => 1,
! 3692: 'gez' => 1,
! 3693: 'gfk' => 1,
! 3694: 'gft' => 1,
! 3695: 'gga' => 1,
! 3696: 'ggb' => 1,
! 3697: 'ggd' => 1,
! 3698: 'gge' => 1,
! 3699: 'ggg' => 1,
! 3700: 'ggk' => 1,
! 3701: 'ggl' => 1,
! 3702: 'ggn' => 1,
! 3703: 'ggr' => 1,
! 3704: 'ggt' => 1,
! 3705: 'ggu' => 1,
! 3706: 'ggw' => 1,
! 3707: 'gha' => 1,
! 3708: 'ghc' => 1,
! 3709: 'ghe' => 1,
! 3710: 'ghh' => 1,
! 3711: 'ghk' => 1,
! 3712: 'ghl' => 1,
! 3713: 'ghn' => 1,
! 3714: 'gho' => 1,
! 3715: 'ghr' => 1,
! 3716: 'ghs' => 1,
! 3717: 'ght' => 1,
! 3718: 'gia' => 1,
! 3719: 'gib' => 1,
! 3720: 'gic' => 1,
! 3721: 'gid' => 1,
! 3722: 'gig' => 1,
! 3723: 'gil' => 1,
! 3724: 'gim' => 1,
! 3725: 'gin' => 1,
! 3726: 'gio' => 1,
! 3727: 'gip' => 1,
! 3728: 'giq' => 1,
! 3729: 'gir' => 1,
! 3730: 'gis' => 1,
! 3731: 'git' => 1,
! 3732: 'giw' => 1,
! 3733: 'gix' => 1,
! 3734: 'giy' => 1,
! 3735: 'giz' => 1,
! 3736: 'gji' => 1,
! 3737: 'gjk' => 1,
! 3738: 'gjn' => 1,
! 3739: 'gka' => 1,
! 3740: 'gke' => 1,
! 3741: 'gkn' => 1,
! 3742: 'glc' => 1,
! 3743: 'gld' => 1,
! 3744: 'glh' => 1,
! 3745: 'gli' => 1,
! 3746: 'glj' => 1,
! 3747: 'glk' => 1,
! 3748: 'glo' => 1,
! 3749: 'glr' => 1,
! 3750: 'glu' => 1,
! 3751: 'glw' => 1,
! 3752: 'gly' => 1,
! 3753: 'gma' => 1,
! 3754: 'gmb' => 1,
! 3755: 'gmd' => 1,
! 3756: 'gme' => 1,
! 3757: 'gmh' => 1,
! 3758: 'gml' => 1,
! 3759: 'gmn' => 1,
! 3760: 'gmq' => 1,
! 3761: 'gmu' => 1,
! 3762: 'gmv' => 1,
! 3763: 'gmw' => 1,
! 3764: 'gmx' => 1,
! 3765: 'gmy' => 1,
! 3766: 'gna' => 1,
! 3767: 'gnb' => 1,
! 3768: 'gnc' => 1,
! 3769: 'gnd' => 1,
! 3770: 'gne' => 1,
! 3771: 'gng' => 1,
! 3772: 'gnh' => 1,
! 3773: 'gni' => 1,
! 3774: 'gnk' => 1,
! 3775: 'gnl' => 1,
! 3776: 'gnm' => 1,
! 3777: 'gnn' => 1,
! 3778: 'gnq' => 1,
! 3779: 'gnr' => 1,
! 3780: 'gnt' => 1,
! 3781: 'gnu' => 1,
! 3782: 'gnz' => 1,
! 3783: 'goa' => 1,
! 3784: 'gob' => 1,
! 3785: 'goc' => 1,
! 3786: 'god' => 1,
! 3787: 'goe' => 1,
! 3788: 'gof' => 1,
! 3789: 'gog' => 1,
! 3790: 'goh' => 1,
! 3791: 'goi' => 1,
! 3792: 'goj' => 1,
! 3793: 'gok' => 1,
! 3794: 'gol' => 1,
! 3795: 'gon' => 1,
! 3796: 'goo' => 1,
! 3797: 'gop' => 1,
! 3798: 'goq' => 1,
! 3799: 'gor' => 1,
! 3800: 'gos' => 1,
! 3801: 'got' => 1,
! 3802: 'gou' => 1,
! 3803: 'gow' => 1,
! 3804: 'gox' => 1,
! 3805: 'goy' => 1,
! 3806: 'goz' => 1,
! 3807: 'gpa' => 1,
! 3808: 'gpn' => 1,
! 3809: 'gqa' => 1,
! 3810: 'gqi' => 1,
! 3811: 'gqn' => 1,
! 3812: 'gqr' => 1,
! 3813: 'gra' => 1,
! 3814: 'grb' => 1,
! 3815: 'grc' => 1,
! 3816: 'grd' => 1,
! 3817: 'grg' => 1,
! 3818: 'grh' => 1,
! 3819: 'gri' => 1,
! 3820: 'grk' => 1,
! 3821: 'grm' => 1,
! 3822: 'gro' => 1,
! 3823: 'grq' => 1,
! 3824: 'grr' => 1,
! 3825: 'grs' => 1,
! 3826: 'grt' => 1,
! 3827: 'gru' => 1,
! 3828: 'grw' => 1,
! 3829: 'grx' => 1,
! 3830: 'grz' => 1,
! 3831: 'gse' => 1,
! 3832: 'gsg' => 1,
! 3833: 'gsl' => 1,
! 3834: 'gsm' => 1,
! 3835: 'gsn' => 1,
! 3836: 'gsp' => 1,
! 3837: 'gss' => 1,
! 3838: 'gsw' => 1,
! 3839: 'gta' => 1,
! 3840: 'gti' => 1,
! 3841: 'gua' => 1,
! 3842: 'gub' => 1,
! 3843: 'guc' => 1,
! 3844: 'gud' => 1,
! 3845: 'gue' => 1,
! 3846: 'guf' => 1,
! 3847: 'guh' => 1,
! 3848: 'guk' => 1,
! 3849: 'gul' => 1,
! 3850: 'gum' => 1,
! 3851: 'guo' => 1,
! 3852: 'gup' => 1,
! 3853: 'guq' => 1,
! 3854: 'gur' => 1,
! 3855: 'gus' => 1,
! 3856: 'gut' => 1,
! 3857: 'guu' => 1,
! 3858: 'guv' => 1,
! 3859: 'guw' => 1,
! 3860: 'gux' => 1,
! 3861: 'guz' => 1,
! 3862: 'gva' => 1,
! 3863: 'gvc' => 1,
! 3864: 'gve' => 1,
! 3865: 'gvf' => 1,
! 3866: 'gvj' => 1,
! 3867: 'gvl' => 1,
! 3868: 'gvm' => 1,
! 3869: 'gvn' => 1,
! 3870: 'gvo' => 1,
! 3871: 'gvp' => 1,
! 3872: 'gvr' => 1,
! 3873: 'gvs' => 1,
! 3874: 'gvy' => 1,
! 3875: 'gwa' => 1,
! 3876: 'gwb' => 1,
! 3877: 'gwc' => 1,
! 3878: 'gwd' => 1,
! 3879: 'gwe' => 1,
! 3880: 'gwf' => 1,
! 3881: 'gwg' => 1,
! 3882: 'gwi' => 1,
! 3883: 'gwj' => 1,
! 3884: 'gwn' => 1,
! 3885: 'gwr' => 1,
! 3886: 'gwt' => 1,
! 3887: 'gwu' => 1,
! 3888: 'gww' => 1,
! 3889: 'gwx' => 1,
! 3890: 'gxx' => 1,
! 3891: 'gyb' => 1,
! 3892: 'gyd' => 1,
! 3893: 'gye' => 1,
! 3894: 'gyf' => 1,
! 3895: 'gyg' => 1,
! 3896: 'gyi' => 1,
! 3897: 'gyl' => 1,
! 3898: 'gym' => 1,
! 3899: 'gyn' => 1,
! 3900: 'gyr' => 1,
! 3901: 'gyy' => 1,
! 3902: 'gza' => 1,
! 3903: 'gzi' => 1,
! 3904: 'gzn' => 1,
! 3905: 'haa' => 1,
! 3906: 'hab' => 1,
! 3907: 'hac' => 1,
! 3908: 'had' => 1,
! 3909: 'haf' => 1,
! 3910: 'hag' => 1,
! 3911: 'hah' => 1,
! 3912: 'hai' => 1,
! 3913: 'haj' => 1,
! 3914: 'hal' => 1,
! 3915: 'ham' => 1,
! 3916: 'han' => 1,
! 3917: 'hao' => 1,
! 3918: 'hap' => 1,
! 3919: 'haq' => 1,
! 3920: 'har' => 1,
! 3921: 'has' => 1,
! 3922: 'hav' => 1,
! 3923: 'haw' => 1,
! 3924: 'hay' => 1,
! 3925: 'haz' => 1,
! 3926: 'hba' => 1,
! 3927: 'hbb' => 1,
! 3928: 'hbn' => 1,
! 3929: 'hbo' => 1,
! 3930: 'hbu' => 1,
! 3931: 'hca' => 1,
! 3932: 'hch' => 1,
! 3933: 'hds' => 1,
! 3934: 'hdy' => 1,
! 3935: 'hed' => 1,
! 3936: 'heg' => 1,
! 3937: 'heh' => 1,
! 3938: 'hei' => 1,
! 3939: 'hem' => 1,
! 3940: 'hgm' => 1,
! 3941: 'hgw' => 1,
! 3942: 'hhi' => 1,
! 3943: 'hhr' => 1,
! 3944: 'hhy' => 1,
! 3945: 'hia' => 1,
! 3946: 'hib' => 1,
! 3947: 'hid' => 1,
! 3948: 'hif' => 1,
! 3949: 'hig' => 1,
! 3950: 'hih' => 1,
! 3951: 'hii' => 1,
! 3952: 'hij' => 1,
! 3953: 'hik' => 1,
! 3954: 'hil' => 1,
! 3955: 'him' => 1,
! 3956: 'hio' => 1,
! 3957: 'hir' => 1,
! 3958: 'hit' => 1,
! 3959: 'hiw' => 1,
! 3960: 'hix' => 1,
! 3961: 'hka' => 1,
! 3962: 'hke' => 1,
! 3963: 'hkk' => 1,
! 3964: 'hks' => 1,
! 3965: 'hla' => 1,
! 3966: 'hlb' => 1,
! 3967: 'hld' => 1,
! 3968: 'hle' => 1,
! 3969: 'hlt' => 1,
! 3970: 'hlu' => 1,
! 3971: 'hmb' => 1,
! 3972: 'hmf' => 1,
! 3973: 'hmk' => 1,
! 3974: 'hmn' => 1,
! 3975: 'hmr' => 1,
! 3976: 'hmt' => 1,
! 3977: 'hmu' => 1,
! 3978: 'hmv' => 1,
! 3979: 'hmx' => 1,
! 3980: 'hmz' => 1,
! 3981: 'hna' => 1,
! 3982: 'hne' => 1,
! 3983: 'hnh' => 1,
! 3984: 'hni' => 1,
! 3985: 'hnn' => 1,
! 3986: 'hns' => 1,
! 3987: 'hnu' => 1,
! 3988: 'hoa' => 1,
! 3989: 'hob' => 1,
! 3990: 'hoc' => 1,
! 3991: 'hod' => 1,
! 3992: 'hoe' => 1,
! 3993: 'hoh' => 1,
! 3994: 'hoi' => 1,
! 3995: 'hok' => 1,
! 3996: 'hol' => 1,
! 3997: 'hom' => 1,
! 3998: 'hoo' => 1,
! 3999: 'hop' => 1,
! 4000: 'hor' => 1,
! 4001: 'hos' => 1,
! 4002: 'hot' => 1,
! 4003: 'hov' => 1,
! 4004: 'how' => 1,
! 4005: 'hoy' => 1,
! 4006: 'hoz' => 1,
! 4007: 'hpo' => 1,
! 4008: 'hps' => 1,
! 4009: 'hra' => 1,
! 4010: 'hre' => 1,
! 4011: 'hrk' => 1,
! 4012: 'hro' => 1,
! 4013: 'hrr' => 1,
! 4014: 'hrt' => 1,
! 4015: 'hru' => 1,
! 4016: 'hrx' => 1,
! 4017: 'hrz' => 1,
! 4018: 'hsb' => 1,
! 4019: 'hsh' => 1,
! 4020: 'hsl' => 1,
! 4021: 'hss' => 1,
! 4022: 'hti' => 1,
! 4023: 'hto' => 1,
! 4024: 'hts' => 1,
! 4025: 'htu' => 1,
! 4026: 'htx' => 1,
! 4027: 'hub' => 1,
! 4028: 'huc' => 1,
! 4029: 'hud' => 1,
! 4030: 'hue' => 1,
! 4031: 'huf' => 1,
! 4032: 'hug' => 1,
! 4033: 'huh' => 1,
! 4034: 'hui' => 1,
! 4035: 'huk' => 1,
! 4036: 'hul' => 1,
! 4037: 'hum' => 1,
! 4038: 'huo' => 1,
! 4039: 'hup' => 1,
! 4040: 'huq' => 1,
! 4041: 'hur' => 1,
! 4042: 'hus' => 1,
! 4043: 'hut' => 1,
! 4044: 'huu' => 1,
! 4045: 'huv' => 1,
! 4046: 'huw' => 1,
! 4047: 'hux' => 1,
! 4048: 'huy' => 1,
! 4049: 'huz' => 1,
! 4050: 'hvc' => 1,
! 4051: 'hve' => 1,
! 4052: 'hvk' => 1,
! 4053: 'hvn' => 1,
! 4054: 'hvv' => 1,
! 4055: 'hwa' => 1,
! 4056: 'hwc' => 1,
! 4057: 'hwo' => 1,
! 4058: 'hya' => 1,
! 4059: 'hyx' => 1,
! 4060: 'iai' => 1,
! 4061: 'ian' => 1,
! 4062: 'iap' => 1,
! 4063: 'iar' => 1,
! 4064: 'iba' => 1,
! 4065: 'ibb' => 1,
! 4066: 'ibd' => 1,
! 4067: 'ibe' => 1,
! 4068: 'ibg' => 1,
! 4069: 'ibi' => 1,
! 4070: 'ibl' => 1,
! 4071: 'ibm' => 1,
! 4072: 'ibn' => 1,
! 4073: 'ibr' => 1,
! 4074: 'ibu' => 1,
! 4075: 'iby' => 1,
! 4076: 'ica' => 1,
! 4077: 'ich' => 1,
! 4078: 'icl' => 1,
! 4079: 'icr' => 1,
! 4080: 'idb' => 1,
! 4081: 'idc' => 1,
! 4082: 'idd' => 1,
! 4083: 'ide' => 1,
! 4084: 'idi' => 1,
! 4085: 'idr' => 1,
! 4086: 'ids' => 1,
! 4087: 'idt' => 1,
! 4088: 'idu' => 1,
! 4089: 'ifa' => 1,
! 4090: 'ifb' => 1,
! 4091: 'ife' => 1,
! 4092: 'iff' => 1,
! 4093: 'ifk' => 1,
! 4094: 'ifm' => 1,
! 4095: 'ifu' => 1,
! 4096: 'ify' => 1,
! 4097: 'igb' => 1,
! 4098: 'ige' => 1,
! 4099: 'igg' => 1,
! 4100: 'igl' => 1,
! 4101: 'igm' => 1,
! 4102: 'ign' => 1,
! 4103: 'igo' => 1,
! 4104: 'igs' => 1,
! 4105: 'igw' => 1,
! 4106: 'ihb' => 1,
! 4107: 'ihi' => 1,
! 4108: 'ihp' => 1,
! 4109: 'iir' => 1,
! 4110: 'ijc' => 1,
! 4111: 'ije' => 1,
! 4112: 'ijj' => 1,
! 4113: 'ijn' => 1,
! 4114: 'ijo' => 1,
! 4115: 'ijs' => 1,
! 4116: 'iki' => 1,
! 4117: 'ikk' => 1,
! 4118: 'ikl' => 1,
! 4119: 'iko' => 1,
! 4120: 'ikp' => 1,
! 4121: 'ikv' => 1,
! 4122: 'ikw' => 1,
! 4123: 'ikx' => 1,
! 4124: 'ikz' => 1,
! 4125: 'ila' => 1,
! 4126: 'ilb' => 1,
! 4127: 'ilg' => 1,
! 4128: 'ili' => 1,
! 4129: 'ilk' => 1,
! 4130: 'ill' => 1,
! 4131: 'ilo' => 1,
! 4132: 'ils' => 1,
! 4133: 'ilu' => 1,
! 4134: 'ilv' => 1,
! 4135: 'ilw' => 1,
! 4136: 'ima' => 1,
! 4137: 'ime' => 1,
! 4138: 'imi' => 1,
! 4139: 'iml' => 1,
! 4140: 'imn' => 1,
! 4141: 'imo' => 1,
! 4142: 'imr' => 1,
! 4143: 'ims' => 1,
! 4144: 'imy' => 1,
! 4145: 'inb' => 1,
! 4146: 'inc' => 1,
! 4147: 'ine' => 1,
! 4148: 'ing' => 1,
! 4149: 'inh' => 1,
! 4150: 'inj' => 1,
! 4151: 'inl' => 1,
! 4152: 'inm' => 1,
! 4153: 'inn' => 1,
! 4154: 'ino' => 1,
! 4155: 'inp' => 1,
! 4156: 'ins' => 1,
! 4157: 'int' => 1,
! 4158: 'inz' => 1,
! 4159: 'ior' => 1,
! 4160: 'iou' => 1,
! 4161: 'iow' => 1,
! 4162: 'ipi' => 1,
! 4163: 'ipo' => 1,
! 4164: 'iqu' => 1,
! 4165: 'ira' => 1,
! 4166: 'ire' => 1,
! 4167: 'irh' => 1,
! 4168: 'iri' => 1,
! 4169: 'irk' => 1,
! 4170: 'irn' => 1,
! 4171: 'iro' => 1,
! 4172: 'irr' => 1,
! 4173: 'iru' => 1,
! 4174: 'irx' => 1,
! 4175: 'iry' => 1,
! 4176: 'isa' => 1,
! 4177: 'isc' => 1,
! 4178: 'isd' => 1,
! 4179: 'ise' => 1,
! 4180: 'isg' => 1,
! 4181: 'ish' => 1,
! 4182: 'isi' => 1,
! 4183: 'ism' => 1,
! 4184: 'isn' => 1,
! 4185: 'iso' => 1,
! 4186: 'isr' => 1,
! 4187: 'ist' => 1,
! 4188: 'isu' => 1,
! 4189: 'itb' => 1,
! 4190: 'itc' => 1,
! 4191: 'ite' => 1,
! 4192: 'iti' => 1,
! 4193: 'itk' => 1,
! 4194: 'itl' => 1,
! 4195: 'itm' => 1,
! 4196: 'ito' => 1,
! 4197: 'itr' => 1,
! 4198: 'its' => 1,
! 4199: 'itt' => 1,
! 4200: 'itv' => 1,
! 4201: 'itw' => 1,
! 4202: 'itx' => 1,
! 4203: 'ity' => 1,
! 4204: 'itz' => 1,
! 4205: 'ium' => 1,
! 4206: 'ivb' => 1,
! 4207: 'ivv' => 1,
! 4208: 'iwk' => 1,
! 4209: 'iwm' => 1,
! 4210: 'iwo' => 1,
! 4211: 'iws' => 1,
! 4212: 'ixc' => 1,
! 4213: 'ixl' => 1,
! 4214: 'iya' => 1,
! 4215: 'iyo' => 1,
! 4216: 'iyx' => 1,
! 4217: 'izh' => 1,
! 4218: 'izi' => 1,
! 4219: 'izr' => 1,
! 4220: 'jaa' => 1,
! 4221: 'jab' => 1,
! 4222: 'jac' => 1,
! 4223: 'jad' => 1,
! 4224: 'jae' => 1,
! 4225: 'jaf' => 1,
! 4226: 'jah' => 1,
! 4227: 'jaj' => 1,
! 4228: 'jal' => 1,
! 4229: 'jam' => 1,
! 4230: 'jao' => 1,
! 4231: 'jaq' => 1,
! 4232: 'jar' => 1,
! 4233: 'jas' => 1,
! 4234: 'jau' => 1,
! 4235: 'jay' => 1,
! 4236: 'jaz' => 1,
! 4237: 'jbe' => 1,
! 4238: 'jbj' => 1,
! 4239: 'jbn' => 1,
! 4240: 'jbo' => 1,
! 4241: 'jbr' => 1,
! 4242: 'jbt' => 1,
! 4243: 'jbu' => 1,
! 4244: 'jcs' => 1,
! 4245: 'jct' => 1,
! 4246: 'jda' => 1,
! 4247: 'jdg' => 1,
! 4248: 'jdt' => 1,
! 4249: 'jeb' => 1,
! 4250: 'jee' => 1,
! 4251: 'jeg' => 1,
! 4252: 'jeh' => 1,
! 4253: 'jei' => 1,
! 4254: 'jek' => 1,
! 4255: 'jel' => 1,
! 4256: 'jen' => 1,
! 4257: 'jer' => 1,
! 4258: 'jet' => 1,
! 4259: 'jeu' => 1,
! 4260: 'jgb' => 1,
! 4261: 'jge' => 1,
! 4262: 'jgo' => 1,
! 4263: 'jhi' => 1,
! 4264: 'jhs' => 1,
! 4265: 'jia' => 1,
! 4266: 'jib' => 1,
! 4267: 'jic' => 1,
! 4268: 'jid' => 1,
! 4269: 'jie' => 1,
! 4270: 'jig' => 1,
! 4271: 'jih' => 1,
! 4272: 'jii' => 1,
! 4273: 'jil' => 1,
! 4274: 'jim' => 1,
! 4275: 'jio' => 1,
! 4276: 'jiq' => 1,
! 4277: 'jit' => 1,
! 4278: 'jiu' => 1,
! 4279: 'jiv' => 1,
! 4280: 'jiy' => 1,
! 4281: 'jko' => 1,
! 4282: 'jku' => 1,
! 4283: 'jle' => 1,
! 4284: 'jma' => 1,
! 4285: 'jmb' => 1,
! 4286: 'jmc' => 1,
! 4287: 'jmd' => 1,
! 4288: 'jmi' => 1,
! 4289: 'jml' => 1,
! 4290: 'jmn' => 1,
! 4291: 'jmr' => 1,
! 4292: 'jms' => 1,
! 4293: 'jmx' => 1,
! 4294: 'jna' => 1,
! 4295: 'jnd' => 1,
! 4296: 'jng' => 1,
! 4297: 'jni' => 1,
! 4298: 'jnj' => 1,
! 4299: 'jnl' => 1,
! 4300: 'jns' => 1,
! 4301: 'job' => 1,
! 4302: 'jod' => 1,
! 4303: 'jor' => 1,
! 4304: 'jos' => 1,
! 4305: 'jow' => 1,
! 4306: 'jpa' => 1,
! 4307: 'jpr' => 1,
! 4308: 'jpx' => 1,
! 4309: 'jqr' => 1,
! 4310: 'jra' => 1,
! 4311: 'jrb' => 1,
! 4312: 'jrr' => 1,
! 4313: 'jrt' => 1,
! 4314: 'jru' => 1,
! 4315: 'jsl' => 1,
! 4316: 'jua' => 1,
! 4317: 'jub' => 1,
! 4318: 'juc' => 1,
! 4319: 'jud' => 1,
! 4320: 'juh' => 1,
! 4321: 'juk' => 1,
! 4322: 'jul' => 1,
! 4323: 'jum' => 1,
! 4324: 'jun' => 1,
! 4325: 'juo' => 1,
! 4326: 'jup' => 1,
! 4327: 'jur' => 1,
! 4328: 'jus' => 1,
! 4329: 'jut' => 1,
! 4330: 'juu' => 1,
! 4331: 'juw' => 1,
! 4332: 'juy' => 1,
! 4333: 'jvd' => 1,
! 4334: 'jvn' => 1,
! 4335: 'jwi' => 1,
! 4336: 'jya' => 1,
! 4337: 'jyy' => 1,
! 4338: 'kaa' => 1,
! 4339: 'kab' => 1,
! 4340: 'kac' => 1,
! 4341: 'kad' => 1,
! 4342: 'kae' => 1,
! 4343: 'kaf' => 1,
! 4344: 'kag' => 1,
! 4345: 'kah' => 1,
! 4346: 'kai' => 1,
! 4347: 'kaj' => 1,
! 4348: 'kak' => 1,
! 4349: 'kam' => 1,
! 4350: 'kao' => 1,
! 4351: 'kap' => 1,
! 4352: 'kaq' => 1,
! 4353: 'kar' => 1,
! 4354: 'kav' => 1,
! 4355: 'kaw' => 1,
! 4356: 'kax' => 1,
! 4357: 'kay' => 1,
! 4358: 'kba' => 1,
! 4359: 'kbb' => 1,
! 4360: 'kbc' => 1,
! 4361: 'kbd' => 1,
! 4362: 'kbe' => 1,
! 4363: 'kbf' => 1,
! 4364: 'kbg' => 1,
! 4365: 'kbh' => 1,
! 4366: 'kbi' => 1,
! 4367: 'kbj' => 1,
! 4368: 'kbk' => 1,
! 4369: 'kbl' => 1,
! 4370: 'kbm' => 1,
! 4371: 'kbn' => 1,
! 4372: 'kbo' => 1,
! 4373: 'kbp' => 1,
! 4374: 'kbq' => 1,
! 4375: 'kbr' => 1,
! 4376: 'kbs' => 1,
! 4377: 'kbt' => 1,
! 4378: 'kbu' => 1,
! 4379: 'kbv' => 1,
! 4380: 'kbw' => 1,
! 4381: 'kbx' => 1,
! 4382: 'kbz' => 1,
! 4383: 'kca' => 1,
! 4384: 'kcb' => 1,
! 4385: 'kcc' => 1,
! 4386: 'kcd' => 1,
! 4387: 'kce' => 1,
! 4388: 'kcf' => 1,
! 4389: 'kcg' => 1,
! 4390: 'kch' => 1,
! 4391: 'kci' => 1,
! 4392: 'kcj' => 1,
! 4393: 'kck' => 1,
! 4394: 'kcl' => 1,
! 4395: 'kcm' => 1,
! 4396: 'kcn' => 1,
! 4397: 'kco' => 1,
! 4398: 'kcp' => 1,
! 4399: 'kcq' => 1,
! 4400: 'kcr' => 1,
! 4401: 'kcs' => 1,
! 4402: 'kct' => 1,
! 4403: 'kcu' => 1,
! 4404: 'kcv' => 1,
! 4405: 'kcw' => 1,
! 4406: 'kcx' => 1,
! 4407: 'kcy' => 1,
! 4408: 'kcz' => 1,
! 4409: 'kda' => 1,
! 4410: 'kdc' => 1,
! 4411: 'kdd' => 1,
! 4412: 'kde' => 1,
! 4413: 'kdf' => 1,
! 4414: 'kdg' => 1,
! 4415: 'kdh' => 1,
! 4416: 'kdi' => 1,
! 4417: 'kdj' => 1,
! 4418: 'kdk' => 1,
! 4419: 'kdl' => 1,
! 4420: 'kdm' => 1,
! 4421: 'kdn' => 1,
! 4422: 'kdo' => 1,
! 4423: 'kdp' => 1,
! 4424: 'kdq' => 1,
! 4425: 'kdr' => 1,
! 4426: 'kdt' => 1,
! 4427: 'kdu' => 1,
! 4428: 'kdv' => 1,
! 4429: 'kdw' => 1,
! 4430: 'kdx' => 1,
! 4431: 'kdy' => 1,
! 4432: 'kdz' => 1,
! 4433: 'kea' => 1,
! 4434: 'keb' => 1,
! 4435: 'kec' => 1,
! 4436: 'ked' => 1,
! 4437: 'kee' => 1,
! 4438: 'kef' => 1,
! 4439: 'keg' => 1,
! 4440: 'keh' => 1,
! 4441: 'kei' => 1,
! 4442: 'kej' => 1,
! 4443: 'kek' => 1,
! 4444: 'kel' => 1,
! 4445: 'kem' => 1,
! 4446: 'ken' => 1,
! 4447: 'keo' => 1,
! 4448: 'kep' => 1,
! 4449: 'keq' => 1,
! 4450: 'ker' => 1,
! 4451: 'kes' => 1,
! 4452: 'ket' => 1,
! 4453: 'keu' => 1,
! 4454: 'kev' => 1,
! 4455: 'kew' => 1,
! 4456: 'kex' => 1,
! 4457: 'key' => 1,
! 4458: 'kez' => 1,
! 4459: 'kfa' => 1,
! 4460: 'kfb' => 1,
! 4461: 'kfc' => 1,
! 4462: 'kfd' => 1,
! 4463: 'kfe' => 1,
! 4464: 'kff' => 1,
! 4465: 'kfg' => 1,
! 4466: 'kfh' => 1,
! 4467: 'kfi' => 1,
! 4468: 'kfj' => 1,
! 4469: 'kfk' => 1,
! 4470: 'kfl' => 1,
! 4471: 'kfm' => 1,
! 4472: 'kfn' => 1,
! 4473: 'kfo' => 1,
! 4474: 'kfp' => 1,
! 4475: 'kfq' => 1,
! 4476: 'kfr' => 1,
! 4477: 'kfs' => 1,
! 4478: 'kft' => 1,
! 4479: 'kfu' => 1,
! 4480: 'kfv' => 1,
! 4481: 'kfw' => 1,
! 4482: 'kfx' => 1,
! 4483: 'kfy' => 1,
! 4484: 'kfz' => 1,
! 4485: 'kga' => 1,
! 4486: 'kgb' => 1,
! 4487: 'kgc' => 1,
! 4488: 'kgd' => 1,
! 4489: 'kge' => 1,
! 4490: 'kgf' => 1,
! 4491: 'kgg' => 1,
! 4492: 'kgh' => 1,
! 4493: 'kgi' => 1,
! 4494: 'kgj' => 1,
! 4495: 'kgk' => 1,
! 4496: 'kgl' => 1,
! 4497: 'kgm' => 1,
! 4498: 'kgn' => 1,
! 4499: 'kgo' => 1,
! 4500: 'kgp' => 1,
! 4501: 'kgq' => 1,
! 4502: 'kgr' => 1,
! 4503: 'kgs' => 1,
! 4504: 'kgt' => 1,
! 4505: 'kgu' => 1,
! 4506: 'kgv' => 1,
! 4507: 'kgw' => 1,
! 4508: 'kgx' => 1,
! 4509: 'kgy' => 1,
! 4510: 'kha' => 1,
! 4511: 'khb' => 1,
! 4512: 'khc' => 1,
! 4513: 'khd' => 1,
! 4514: 'khe' => 1,
! 4515: 'khf' => 1,
! 4516: 'khg' => 1,
! 4517: 'khh' => 1,
! 4518: 'khi' => 1,
! 4519: 'khj' => 1,
! 4520: 'khl' => 1,
! 4521: 'khn' => 1,
! 4522: 'kho' => 1,
! 4523: 'khp' => 1,
! 4524: 'khq' => 1,
! 4525: 'khr' => 1,
! 4526: 'khs' => 1,
! 4527: 'kht' => 1,
! 4528: 'khu' => 1,
! 4529: 'khv' => 1,
! 4530: 'khw' => 1,
! 4531: 'khx' => 1,
! 4532: 'khy' => 1,
! 4533: 'khz' => 1,
! 4534: 'kia' => 1,
! 4535: 'kib' => 1,
! 4536: 'kic' => 1,
! 4537: 'kid' => 1,
! 4538: 'kie' => 1,
! 4539: 'kif' => 1,
! 4540: 'kig' => 1,
! 4541: 'kih' => 1,
! 4542: 'kii' => 1,
! 4543: 'kij' => 1,
! 4544: 'kil' => 1,
! 4545: 'kim' => 1,
! 4546: 'kio' => 1,
! 4547: 'kip' => 1,
! 4548: 'kiq' => 1,
! 4549: 'kis' => 1,
! 4550: 'kit' => 1,
! 4551: 'kiv' => 1,
! 4552: 'kiw' => 1,
! 4553: 'kix' => 1,
! 4554: 'kiy' => 1,
! 4555: 'kiz' => 1,
! 4556: 'kja' => 1,
! 4557: 'kjb' => 1,
! 4558: 'kjc' => 1,
! 4559: 'kjd' => 1,
! 4560: 'kje' => 1,
! 4561: 'kjf' => 1,
! 4562: 'kjg' => 1,
! 4563: 'kjh' => 1,
! 4564: 'kji' => 1,
! 4565: 'kjj' => 1,
! 4566: 'kjk' => 1,
! 4567: 'kjl' => 1,
! 4568: 'kjm' => 1,
! 4569: 'kjn' => 1,
! 4570: 'kjo' => 1,
! 4571: 'kjp' => 1,
! 4572: 'kjq' => 1,
! 4573: 'kjr' => 1,
! 4574: 'kjs' => 1,
! 4575: 'kjt' => 1,
! 4576: 'kju' => 1,
! 4577: 'kjx' => 1,
! 4578: 'kjy' => 1,
! 4579: 'kjz' => 1,
! 4580: 'kka' => 1,
! 4581: 'kkb' => 1,
! 4582: 'kkc' => 1,
! 4583: 'kkd' => 1,
! 4584: 'kke' => 1,
! 4585: 'kkf' => 1,
! 4586: 'kkg' => 1,
! 4587: 'kkh' => 1,
! 4588: 'kki' => 1,
! 4589: 'kkj' => 1,
! 4590: 'kkk' => 1,
! 4591: 'kkl' => 1,
! 4592: 'kkm' => 1,
! 4593: 'kkn' => 1,
! 4594: 'kko' => 1,
! 4595: 'kkp' => 1,
! 4596: 'kkq' => 1,
! 4597: 'kkr' => 1,
! 4598: 'kks' => 1,
! 4599: 'kkt' => 1,
! 4600: 'kku' => 1,
! 4601: 'kkv' => 1,
! 4602: 'kkw' => 1,
! 4603: 'kkx' => 1,
! 4604: 'kky' => 1,
! 4605: 'kkz' => 1,
! 4606: 'kla' => 1,
! 4607: 'klb' => 1,
! 4608: 'klc' => 1,
! 4609: 'kld' => 1,
! 4610: 'kle' => 1,
! 4611: 'klf' => 1,
! 4612: 'klg' => 1,
! 4613: 'klh' => 1,
! 4614: 'kli' => 1,
! 4615: 'klj' => 1,
! 4616: 'klk' => 1,
! 4617: 'kll' => 1,
! 4618: 'klm' => 1,
! 4619: 'kln' => 1,
! 4620: 'klo' => 1,
! 4621: 'klp' => 1,
! 4622: 'klq' => 1,
! 4623: 'klr' => 1,
! 4624: 'kls' => 1,
! 4625: 'klt' => 1,
! 4626: 'klu' => 1,
! 4627: 'klv' => 1,
! 4628: 'klw' => 1,
! 4629: 'klx' => 1,
! 4630: 'kly' => 1,
! 4631: 'klz' => 1,
! 4632: 'kma' => 1,
! 4633: 'kmb' => 1,
! 4634: 'kmc' => 1,
! 4635: 'kmd' => 1,
! 4636: 'kme' => 1,
! 4637: 'kmf' => 1,
! 4638: 'kmg' => 1,
! 4639: 'kmh' => 1,
! 4640: 'kmi' => 1,
! 4641: 'kmj' => 1,
! 4642: 'kmk' => 1,
! 4643: 'kml' => 1,
! 4644: 'kmm' => 1,
! 4645: 'kmn' => 1,
! 4646: 'kmo' => 1,
! 4647: 'kmp' => 1,
! 4648: 'kmq' => 1,
! 4649: 'kms' => 1,
! 4650: 'kmt' => 1,
! 4651: 'kmu' => 1,
! 4652: 'kmv' => 1,
! 4653: 'kmw' => 1,
! 4654: 'kmx' => 1,
! 4655: 'kmy' => 1,
! 4656: 'kmz' => 1,
! 4657: 'kna' => 1,
! 4658: 'knb' => 1,
! 4659: 'knd' => 1,
! 4660: 'kne' => 1,
! 4661: 'knf' => 1,
! 4662: 'kni' => 1,
! 4663: 'knj' => 1,
! 4664: 'knk' => 1,
! 4665: 'knl' => 1,
! 4666: 'knm' => 1,
! 4667: 'kno' => 1,
! 4668: 'knp' => 1,
! 4669: 'knq' => 1,
! 4670: 'knr' => 1,
! 4671: 'kns' => 1,
! 4672: 'knt' => 1,
! 4673: 'knu' => 1,
! 4674: 'knv' => 1,
! 4675: 'knw' => 1,
! 4676: 'knx' => 1,
! 4677: 'kny' => 1,
! 4678: 'knz' => 1,
! 4679: 'koa' => 1,
! 4680: 'koc' => 1,
! 4681: 'kod' => 1,
! 4682: 'koe' => 1,
! 4683: 'kof' => 1,
! 4684: 'kog' => 1,
! 4685: 'koh' => 1,
! 4686: 'koj' => 1,
! 4687: 'kok' => 1,
! 4688: 'kol' => 1,
! 4689: 'koo' => 1,
! 4690: 'kop' => 1,
! 4691: 'koq' => 1,
! 4692: 'kos' => 1,
! 4693: 'kot' => 1,
! 4694: 'kou' => 1,
! 4695: 'kov' => 1,
! 4696: 'kow' => 1,
! 4697: 'kox' => 1,
! 4698: 'koy' => 1,
! 4699: 'koz' => 1,
! 4700: 'kpa' => 1,
! 4701: 'kpb' => 1,
! 4702: 'kpc' => 1,
! 4703: 'kpd' => 1,
! 4704: 'kpe' => 1,
! 4705: 'kpf' => 1,
! 4706: 'kpg' => 1,
! 4707: 'kph' => 1,
! 4708: 'kpi' => 1,
! 4709: 'kpj' => 1,
! 4710: 'kpk' => 1,
! 4711: 'kpl' => 1,
! 4712: 'kpm' => 1,
! 4713: 'kpn' => 1,
! 4714: 'kpo' => 1,
! 4715: 'kpp' => 1,
! 4716: 'kpq' => 1,
! 4717: 'kpr' => 1,
! 4718: 'kps' => 1,
! 4719: 'kpt' => 1,
! 4720: 'kpu' => 1,
! 4721: 'kpw' => 1,
! 4722: 'kpx' => 1,
! 4723: 'kpy' => 1,
! 4724: 'kpz' => 1,
! 4725: 'kqa' => 1,
! 4726: 'kqb' => 1,
! 4727: 'kqc' => 1,
! 4728: 'kqd' => 1,
! 4729: 'kqe' => 1,
! 4730: 'kqf' => 1,
! 4731: 'kqg' => 1,
! 4732: 'kqh' => 1,
! 4733: 'kqi' => 1,
! 4734: 'kqj' => 1,
! 4735: 'kqk' => 1,
! 4736: 'kql' => 1,
! 4737: 'kqm' => 1,
! 4738: 'kqn' => 1,
! 4739: 'kqo' => 1,
! 4740: 'kqp' => 1,
! 4741: 'kqq' => 1,
! 4742: 'kqr' => 1,
! 4743: 'kqs' => 1,
! 4744: 'kqt' => 1,
! 4745: 'kqu' => 1,
! 4746: 'kqv' => 1,
! 4747: 'kqw' => 1,
! 4748: 'kqx' => 1,
! 4749: 'kqy' => 1,
! 4750: 'kqz' => 1,
! 4751: 'kra' => 1,
! 4752: 'krb' => 1,
! 4753: 'krc' => 1,
! 4754: 'krd' => 1,
! 4755: 'kre' => 1,
! 4756: 'krf' => 1,
! 4757: 'krh' => 1,
! 4758: 'kri' => 1,
! 4759: 'krj' => 1,
! 4760: 'krk' => 1,
! 4761: 'krl' => 1,
! 4762: 'krm' => 1,
! 4763: 'krn' => 1,
! 4764: 'kro' => 1,
! 4765: 'krp' => 1,
! 4766: 'krr' => 1,
! 4767: 'krs' => 1,
! 4768: 'kru' => 1,
! 4769: 'krv' => 1,
! 4770: 'krw' => 1,
! 4771: 'krx' => 1,
! 4772: 'kry' => 1,
! 4773: 'krz' => 1,
! 4774: 'ksa' => 1,
! 4775: 'ksb' => 1,
! 4776: 'ksc' => 1,
! 4777: 'ksd' => 1,
! 4778: 'kse' => 1,
! 4779: 'ksf' => 1,
! 4780: 'ksg' => 1,
! 4781: 'ksh' => 1,
! 4782: 'ksi' => 1,
! 4783: 'ksj' => 1,
! 4784: 'ksk' => 1,
! 4785: 'ksl' => 1,
! 4786: 'ksm' => 1,
! 4787: 'ksn' => 1,
! 4788: 'kso' => 1,
! 4789: 'ksp' => 1,
! 4790: 'ksq' => 1,
! 4791: 'ksr' => 1,
! 4792: 'kss' => 1,
! 4793: 'kst' => 1,
! 4794: 'ksu' => 1,
! 4795: 'ksv' => 1,
! 4796: 'ksw' => 1,
! 4797: 'ksx' => 1,
! 4798: 'ksy' => 1,
! 4799: 'ksz' => 1,
! 4800: 'kta' => 1,
! 4801: 'ktb' => 1,
! 4802: 'ktc' => 1,
! 4803: 'ktd' => 1,
! 4804: 'kte' => 1,
! 4805: 'ktf' => 1,
! 4806: 'ktg' => 1,
! 4807: 'kth' => 1,
! 4808: 'kti' => 1,
! 4809: 'ktj' => 1,
! 4810: 'ktk' => 1,
! 4811: 'ktl' => 1,
! 4812: 'ktm' => 1,
! 4813: 'ktn' => 1,
! 4814: 'kto' => 1,
! 4815: 'ktp' => 1,
! 4816: 'ktq' => 1,
! 4817: 'ktr' => 1,
! 4818: 'kts' => 1,
! 4819: 'ktt' => 1,
! 4820: 'ktu' => 1,
! 4821: 'ktv' => 1,
! 4822: 'ktw' => 1,
! 4823: 'ktx' => 1,
! 4824: 'kty' => 1,
! 4825: 'ktz' => 1,
! 4826: 'kub' => 1,
! 4827: 'kuc' => 1,
! 4828: 'kud' => 1,
! 4829: 'kue' => 1,
! 4830: 'kuf' => 1,
! 4831: 'kug' => 1,
! 4832: 'kuh' => 1,
! 4833: 'kui' => 1,
! 4834: 'kuj' => 1,
! 4835: 'kuk' => 1,
! 4836: 'kul' => 1,
! 4837: 'kum' => 1,
! 4838: 'kun' => 1,
! 4839: 'kuo' => 1,
! 4840: 'kup' => 1,
! 4841: 'kuq' => 1,
! 4842: 'kus' => 1,
! 4843: 'kut' => 1,
! 4844: 'kuu' => 1,
! 4845: 'kuv' => 1,
! 4846: 'kuw' => 1,
! 4847: 'kux' => 1,
! 4848: 'kuy' => 1,
! 4849: 'kuz' => 1,
! 4850: 'kva' => 1,
! 4851: 'kvc' => 1,
! 4852: 'kvd' => 1,
! 4853: 'kve' => 1,
! 4854: 'kvf' => 1,
! 4855: 'kvg' => 1,
! 4856: 'kvh' => 1,
! 4857: 'kvi' => 1,
! 4858: 'kvj' => 1,
! 4859: 'kvk' => 1,
! 4860: 'kvl' => 1,
! 4861: 'kvm' => 1,
! 4862: 'kvn' => 1,
! 4863: 'kvo' => 1,
! 4864: 'kvp' => 1,
! 4865: 'kvq' => 1,
! 4866: 'kvs' => 1,
! 4867: 'kvt' => 1,
! 4868: 'kvu' => 1,
! 4869: 'kvv' => 1,
! 4870: 'kvw' => 1,
! 4871: 'kvx' => 1,
! 4872: 'kvy' => 1,
! 4873: 'kvz' => 1,
! 4874: 'kwa' => 1,
! 4875: 'kwb' => 1,
! 4876: 'kwc' => 1,
! 4877: 'kwd' => 1,
! 4878: 'kwe' => 1,
! 4879: 'kwf' => 1,
! 4880: 'kwg' => 1,
! 4881: 'kwh' => 1,
! 4882: 'kwi' => 1,
! 4883: 'kwj' => 1,
! 4884: 'kwk' => 1,
! 4885: 'kwl' => 1,
! 4886: 'kwm' => 1,
! 4887: 'kwn' => 1,
! 4888: 'kwo' => 1,
! 4889: 'kwp' => 1,
! 4890: 'kwq' => 1,
! 4891: 'kwr' => 1,
! 4892: 'kws' => 1,
! 4893: 'kwt' => 1,
! 4894: 'kwu' => 1,
! 4895: 'kwv' => 1,
! 4896: 'kww' => 1,
! 4897: 'kwx' => 1,
! 4898: 'kwz' => 1,
! 4899: 'kxa' => 1,
! 4900: 'kxb' => 1,
! 4901: 'kxc' => 1,
! 4902: 'kxe' => 1,
! 4903: 'kxf' => 1,
! 4904: 'kxh' => 1,
! 4905: 'kxi' => 1,
! 4906: 'kxj' => 1,
! 4907: 'kxk' => 1,
! 4908: 'kxl' => 1,
! 4909: 'kxm' => 1,
! 4910: 'kxn' => 1,
! 4911: 'kxo' => 1,
! 4912: 'kxp' => 1,
! 4913: 'kxq' => 1,
! 4914: 'kxr' => 1,
! 4915: 'kxs' => 1,
! 4916: 'kxt' => 1,
! 4917: 'kxu' => 1,
! 4918: 'kxv' => 1,
! 4919: 'kxw' => 1,
! 4920: 'kxx' => 1,
! 4921: 'kxy' => 1,
! 4922: 'kxz' => 1,
! 4923: 'kya' => 1,
! 4924: 'kyb' => 1,
! 4925: 'kyc' => 1,
! 4926: 'kyd' => 1,
! 4927: 'kye' => 1,
! 4928: 'kyf' => 1,
! 4929: 'kyg' => 1,
! 4930: 'kyh' => 1,
! 4931: 'kyi' => 1,
! 4932: 'kyj' => 1,
! 4933: 'kyk' => 1,
! 4934: 'kyl' => 1,
! 4935: 'kym' => 1,
! 4936: 'kyn' => 1,
! 4937: 'kyo' => 1,
! 4938: 'kyp' => 1,
! 4939: 'kyq' => 1,
! 4940: 'kyr' => 1,
! 4941: 'kys' => 1,
! 4942: 'kyt' => 1,
! 4943: 'kyu' => 1,
! 4944: 'kyv' => 1,
! 4945: 'kyw' => 1,
! 4946: 'kyx' => 1,
! 4947: 'kyy' => 1,
! 4948: 'kyz' => 1,
! 4949: 'kza' => 1,
! 4950: 'kzb' => 1,
! 4951: 'kzc' => 1,
! 4952: 'kzd' => 1,
! 4953: 'kze' => 1,
! 4954: 'kzf' => 1,
! 4955: 'kzg' => 1,
! 4956: 'kzh' => 1,
! 4957: 'kzi' => 1,
! 4958: 'kzj' => 1,
! 4959: 'kzk' => 1,
! 4960: 'kzl' => 1,
! 4961: 'kzm' => 1,
! 4962: 'kzn' => 1,
! 4963: 'kzo' => 1,
! 4964: 'kzp' => 1,
! 4965: 'kzq' => 1,
! 4966: 'kzr' => 1,
! 4967: 'kzs' => 1,
! 4968: 'kzt' => 1,
! 4969: 'kzu' => 1,
! 4970: 'kzv' => 1,
! 4971: 'kzw' => 1,
! 4972: 'kzx' => 1,
! 4973: 'kzy' => 1,
! 4974: 'kzz' => 1,
! 4975: 'laa' => 1,
! 4976: 'lab' => 1,
! 4977: 'lac' => 1,
! 4978: 'lad' => 1,
! 4979: 'lae' => 1,
! 4980: 'laf' => 1,
! 4981: 'lag' => 1,
! 4982: 'lah' => 1,
! 4983: 'lai' => 1,
! 4984: 'laj' => 1,
! 4985: 'lak' => 1,
! 4986: 'lal' => 1,
! 4987: 'lam' => 1,
! 4988: 'lan' => 1,
! 4989: 'lap' => 1,
! 4990: 'laq' => 1,
! 4991: 'lar' => 1,
! 4992: 'las' => 1,
! 4993: 'lau' => 1,
! 4994: 'law' => 1,
! 4995: 'lax' => 1,
! 4996: 'lay' => 1,
! 4997: 'laz' => 1,
! 4998: 'lba' => 1,
! 4999: 'lbb' => 1,
! 5000: 'lbc' => 1,
! 5001: 'lbe' => 1,
! 5002: 'lbf' => 1,
! 5003: 'lbg' => 1,
! 5004: 'lbi' => 1,
! 5005: 'lbj' => 1,
! 5006: 'lbm' => 1,
! 5007: 'lbn' => 1,
! 5008: 'lbo' => 1,
! 5009: 'lbq' => 1,
! 5010: 'lbr' => 1,
! 5011: 'lbs' => 1,
! 5012: 'lbt' => 1,
! 5013: 'lbu' => 1,
! 5014: 'lbv' => 1,
! 5015: 'lbw' => 1,
! 5016: 'lbx' => 1,
! 5017: 'lby' => 1,
! 5018: 'lbz' => 1,
! 5019: 'lcc' => 1,
! 5020: 'lcd' => 1,
! 5021: 'lch' => 1,
! 5022: 'lcl' => 1,
! 5023: 'lcm' => 1,
! 5024: 'lcp' => 1,
! 5025: 'lcq' => 1,
! 5026: 'lcs' => 1,
! 5027: 'ldb' => 1,
! 5028: 'ldd' => 1,
! 5029: 'ldg' => 1,
! 5030: 'ldh' => 1,
! 5031: 'ldj' => 1,
! 5032: 'ldk' => 1,
! 5033: 'ldl' => 1,
! 5034: 'ldm' => 1,
! 5035: 'ldn' => 1,
! 5036: 'ldo' => 1,
! 5037: 'ldp' => 1,
! 5038: 'ldq' => 1,
! 5039: 'lea' => 1,
! 5040: 'leb' => 1,
! 5041: 'lec' => 1,
! 5042: 'led' => 1,
! 5043: 'lee' => 1,
! 5044: 'lef' => 1,
! 5045: 'leg' => 1,
! 5046: 'leh' => 1,
! 5047: 'lei' => 1,
! 5048: 'lej' => 1,
! 5049: 'lek' => 1,
! 5050: 'lel' => 1,
! 5051: 'lem' => 1,
! 5052: 'len' => 1,
! 5053: 'leo' => 1,
! 5054: 'lep' => 1,
! 5055: 'leq' => 1,
! 5056: 'ler' => 1,
! 5057: 'les' => 1,
! 5058: 'let' => 1,
! 5059: 'leu' => 1,
! 5060: 'lev' => 1,
! 5061: 'lew' => 1,
! 5062: 'lex' => 1,
! 5063: 'ley' => 1,
! 5064: 'lez' => 1,
! 5065: 'lfa' => 1,
! 5066: 'lfn' => 1,
! 5067: 'lga' => 1,
! 5068: 'lgb' => 1,
! 5069: 'lgg' => 1,
! 5070: 'lgh' => 1,
! 5071: 'lgi' => 1,
! 5072: 'lgk' => 1,
! 5073: 'lgl' => 1,
! 5074: 'lgm' => 1,
! 5075: 'lgn' => 1,
! 5076: 'lgq' => 1,
! 5077: 'lgr' => 1,
! 5078: 'lgt' => 1,
! 5079: 'lgu' => 1,
! 5080: 'lgz' => 1,
! 5081: 'lha' => 1,
! 5082: 'lhh' => 1,
! 5083: 'lhi' => 1,
! 5084: 'lhl' => 1,
! 5085: 'lhm' => 1,
! 5086: 'lhn' => 1,
! 5087: 'lhp' => 1,
! 5088: 'lhs' => 1,
! 5089: 'lht' => 1,
! 5090: 'lhu' => 1,
! 5091: 'lia' => 1,
! 5092: 'lib' => 1,
! 5093: 'lic' => 1,
! 5094: 'lid' => 1,
! 5095: 'lie' => 1,
! 5096: 'lif' => 1,
! 5097: 'lig' => 1,
! 5098: 'lih' => 1,
! 5099: 'lii' => 1,
! 5100: 'lij' => 1,
! 5101: 'lik' => 1,
! 5102: 'lil' => 1,
! 5103: 'lio' => 1,
! 5104: 'lip' => 1,
! 5105: 'liq' => 1,
! 5106: 'lir' => 1,
! 5107: 'lis' => 1,
! 5108: 'liu' => 1,
! 5109: 'liv' => 1,
! 5110: 'lix' => 1,
! 5111: 'liy' => 1,
! 5112: 'liz' => 1,
! 5113: 'lje' => 1,
! 5114: 'lji' => 1,
! 5115: 'ljl' => 1,
! 5116: 'ljp' => 1,
! 5117: 'lka' => 1,
! 5118: 'lkc' => 1,
! 5119: 'lkd' => 1,
! 5120: 'lke' => 1,
! 5121: 'lkh' => 1,
! 5122: 'lki' => 1,
! 5123: 'lkj' => 1,
! 5124: 'lkl' => 1,
! 5125: 'lkn' => 1,
! 5126: 'lkr' => 1,
! 5127: 'lkt' => 1,
! 5128: 'lky' => 1,
! 5129: 'lla' => 1,
! 5130: 'llb' => 1,
! 5131: 'llc' => 1,
! 5132: 'lld' => 1,
! 5133: 'lle' => 1,
! 5134: 'llf' => 1,
! 5135: 'llg' => 1,
! 5136: 'llh' => 1,
! 5137: 'lli' => 1,
! 5138: 'llk' => 1,
! 5139: 'lll' => 1,
! 5140: 'llm' => 1,
! 5141: 'lln' => 1,
! 5142: 'llo' => 1,
! 5143: 'llp' => 1,
! 5144: 'llq' => 1,
! 5145: 'lls' => 1,
! 5146: 'llu' => 1,
! 5147: 'llx' => 1,
! 5148: 'lma' => 1,
! 5149: 'lmb' => 1,
! 5150: 'lmc' => 1,
! 5151: 'lmd' => 1,
! 5152: 'lme' => 1,
! 5153: 'lmf' => 1,
! 5154: 'lmg' => 1,
! 5155: 'lmh' => 1,
! 5156: 'lmi' => 1,
! 5157: 'lmj' => 1,
! 5158: 'lmk' => 1,
! 5159: 'lml' => 1,
! 5160: 'lmm' => 1,
! 5161: 'lmn' => 1,
! 5162: 'lmo' => 1,
! 5163: 'lmp' => 1,
! 5164: 'lmq' => 1,
! 5165: 'lmr' => 1,
! 5166: 'lmu' => 1,
! 5167: 'lmv' => 1,
! 5168: 'lmw' => 1,
! 5169: 'lmx' => 1,
! 5170: 'lmy' => 1,
! 5171: 'lmz' => 1,
! 5172: 'lna' => 1,
! 5173: 'lnb' => 1,
! 5174: 'lnd' => 1,
! 5175: 'lng' => 1,
! 5176: 'lnh' => 1,
! 5177: 'lni' => 1,
! 5178: 'lnj' => 1,
! 5179: 'lnl' => 1,
! 5180: 'lnm' => 1,
! 5181: 'lnn' => 1,
! 5182: 'lno' => 1,
! 5183: 'lns' => 1,
! 5184: 'lnu' => 1,
! 5185: 'lnz' => 1,
! 5186: 'loa' => 1,
! 5187: 'lob' => 1,
! 5188: 'loc' => 1,
! 5189: 'loe' => 1,
! 5190: 'lof' => 1,
! 5191: 'log' => 1,
! 5192: 'loh' => 1,
! 5193: 'loi' => 1,
! 5194: 'loj' => 1,
! 5195: 'lok' => 1,
! 5196: 'lol' => 1,
! 5197: 'lom' => 1,
! 5198: 'lon' => 1,
! 5199: 'loo' => 1,
! 5200: 'lop' => 1,
! 5201: 'loq' => 1,
! 5202: 'lor' => 1,
! 5203: 'los' => 1,
! 5204: 'lot' => 1,
! 5205: 'lou' => 1,
! 5206: 'lov' => 1,
! 5207: 'low' => 1,
! 5208: 'lox' => 1,
! 5209: 'loy' => 1,
! 5210: 'loz' => 1,
! 5211: 'lpa' => 1,
! 5212: 'lpe' => 1,
! 5213: 'lpn' => 1,
! 5214: 'lpo' => 1,
! 5215: 'lpx' => 1,
! 5216: 'lra' => 1,
! 5217: 'lrc' => 1,
! 5218: 'lre' => 1,
! 5219: 'lrg' => 1,
! 5220: 'lrk' => 1,
! 5221: 'lrl' => 1,
! 5222: 'lrn' => 1,
! 5223: 'lro' => 1,
! 5224: 'lrr' => 1,
! 5225: 'lrt' => 1,
! 5226: 'lrv' => 1,
! 5227: 'lrz' => 1,
! 5228: 'lsa' => 1,
! 5229: 'lsd' => 1,
! 5230: 'lse' => 1,
! 5231: 'lsg' => 1,
! 5232: 'lsh' => 1,
! 5233: 'lsi' => 1,
! 5234: 'lsl' => 1,
! 5235: 'lso' => 1,
! 5236: 'lsp' => 1,
! 5237: 'lsr' => 1,
! 5238: 'lss' => 1,
! 5239: 'lst' => 1,
! 5240: 'ltc' => 1,
! 5241: 'lti' => 1,
! 5242: 'ltn' => 1,
! 5243: 'ltu' => 1,
! 5244: 'lua' => 1,
! 5245: 'luc' => 1,
! 5246: 'lud' => 1,
! 5247: 'lue' => 1,
! 5248: 'luf' => 1,
! 5249: 'lui' => 1,
! 5250: 'luj' => 1,
! 5251: 'luk' => 1,
! 5252: 'lul' => 1,
! 5253: 'lum' => 1,
! 5254: 'lun' => 1,
! 5255: 'luo' => 1,
! 5256: 'lup' => 1,
! 5257: 'luq' => 1,
! 5258: 'lur' => 1,
! 5259: 'lus' => 1,
! 5260: 'lut' => 1,
! 5261: 'luu' => 1,
! 5262: 'luv' => 1,
! 5263: 'luw' => 1,
! 5264: 'luy' => 1,
! 5265: 'luz' => 1,
! 5266: 'lva' => 1,
! 5267: 'lvk' => 1,
! 5268: 'lvu' => 1,
! 5269: 'lwa' => 1,
! 5270: 'lwe' => 1,
! 5271: 'lwh' => 1,
! 5272: 'lwl' => 1,
! 5273: 'lwm' => 1,
! 5274: 'lwo' => 1,
! 5275: 'lwt' => 1,
! 5276: 'lww' => 1,
! 5277: 'lya' => 1,
! 5278: 'lyg' => 1,
! 5279: 'lyn' => 1,
! 5280: 'lzl' => 1,
! 5281: 'lzn' => 1,
! 5282: 'lzz' => 1,
! 5283: 'maa' => 1,
! 5284: 'mab' => 1,
! 5285: 'mad' => 1,
! 5286: 'mae' => 1,
! 5287: 'maf' => 1,
! 5288: 'mag' => 1,
! 5289: 'mai' => 1,
! 5290: 'maj' => 1,
! 5291: 'mak' => 1,
! 5292: 'mam' => 1,
! 5293: 'man' => 1,
! 5294: 'map' => 1,
! 5295: 'maq' => 1,
! 5296: 'mas' => 1,
! 5297: 'mat' => 1,
! 5298: 'mau' => 1,
! 5299: 'mav' => 1,
! 5300: 'maw' => 1,
! 5301: 'maz' => 1,
! 5302: 'mba' => 1,
! 5303: 'mbb' => 1,
! 5304: 'mbc' => 1,
! 5305: 'mbd' => 1,
! 5306: 'mbe' => 1,
! 5307: 'mbf' => 1,
! 5308: 'mbh' => 1,
! 5309: 'mbi' => 1,
! 5310: 'mbj' => 1,
! 5311: 'mbk' => 1,
! 5312: 'mbl' => 1,
! 5313: 'mbm' => 1,
! 5314: 'mbn' => 1,
! 5315: 'mbo' => 1,
! 5316: 'mbp' => 1,
! 5317: 'mbq' => 1,
! 5318: 'mbr' => 1,
! 5319: 'mbs' => 1,
! 5320: 'mbt' => 1,
! 5321: 'mbu' => 1,
! 5322: 'mbv' => 1,
! 5323: 'mbw' => 1,
! 5324: 'mbx' => 1,
! 5325: 'mby' => 1,
! 5326: 'mbz' => 1,
! 5327: 'mca' => 1,
! 5328: 'mcb' => 1,
! 5329: 'mcc' => 1,
! 5330: 'mcd' => 1,
! 5331: 'mce' => 1,
! 5332: 'mcf' => 1,
! 5333: 'mcg' => 1,
! 5334: 'mch' => 1,
! 5335: 'mci' => 1,
! 5336: 'mcj' => 1,
! 5337: 'mck' => 1,
! 5338: 'mcl' => 1,
! 5339: 'mcm' => 1,
! 5340: 'mcn' => 1,
! 5341: 'mco' => 1,
! 5342: 'mcp' => 1,
! 5343: 'mcq' => 1,
! 5344: 'mcr' => 1,
! 5345: 'mcs' => 1,
! 5346: 'mct' => 1,
! 5347: 'mcu' => 1,
! 5348: 'mcv' => 1,
! 5349: 'mcw' => 1,
! 5350: 'mcx' => 1,
! 5351: 'mcy' => 1,
! 5352: 'mcz' => 1,
! 5353: 'mda' => 1,
! 5354: 'mdb' => 1,
! 5355: 'mdc' => 1,
! 5356: 'mdd' => 1,
! 5357: 'mde' => 1,
! 5358: 'mdf' => 1,
! 5359: 'mdg' => 1,
! 5360: 'mdh' => 1,
! 5361: 'mdi' => 1,
! 5362: 'mdj' => 1,
! 5363: 'mdk' => 1,
! 5364: 'mdl' => 1,
! 5365: 'mdm' => 1,
! 5366: 'mdn' => 1,
! 5367: 'mdp' => 1,
! 5368: 'mdq' => 1,
! 5369: 'mdr' => 1,
! 5370: 'mds' => 1,
! 5371: 'mdt' => 1,
! 5372: 'mdu' => 1,
! 5373: 'mdv' => 1,
! 5374: 'mdw' => 1,
! 5375: 'mdx' => 1,
! 5376: 'mdy' => 1,
! 5377: 'mdz' => 1,
! 5378: 'mea' => 1,
! 5379: 'meb' => 1,
! 5380: 'mec' => 1,
! 5381: 'med' => 1,
! 5382: 'mee' => 1,
! 5383: 'mef' => 1,
! 5384: 'meg' => 1,
! 5385: 'meh' => 1,
! 5386: 'mei' => 1,
! 5387: 'mej' => 1,
! 5388: 'mek' => 1,
! 5389: 'mel' => 1,
! 5390: 'mem' => 1,
! 5391: 'men' => 1,
! 5392: 'mep' => 1,
! 5393: 'meq' => 1,
! 5394: 'mer' => 1,
! 5395: 'mes' => 1,
! 5396: 'met' => 1,
! 5397: 'meu' => 1,
! 5398: 'mev' => 1,
! 5399: 'mew' => 1,
! 5400: 'mey' => 1,
! 5401: 'mez' => 1,
! 5402: 'mfc' => 1,
! 5403: 'mfd' => 1,
! 5404: 'mfe' => 1,
! 5405: 'mff' => 1,
! 5406: 'mfg' => 1,
! 5407: 'mfh' => 1,
! 5408: 'mfi' => 1,
! 5409: 'mfj' => 1,
! 5410: 'mfk' => 1,
! 5411: 'mfl' => 1,
! 5412: 'mfm' => 1,
! 5413: 'mfn' => 1,
! 5414: 'mfo' => 1,
! 5415: 'mfp' => 1,
! 5416: 'mfq' => 1,
! 5417: 'mfr' => 1,
! 5418: 'mfs' => 1,
! 5419: 'mft' => 1,
! 5420: 'mfu' => 1,
! 5421: 'mfv' => 1,
! 5422: 'mfw' => 1,
! 5423: 'mfx' => 1,
! 5424: 'mfy' => 1,
! 5425: 'mfz' => 1,
! 5426: 'mga' => 1,
! 5427: 'mgb' => 1,
! 5428: 'mgc' => 1,
! 5429: 'mgd' => 1,
! 5430: 'mge' => 1,
! 5431: 'mgf' => 1,
! 5432: 'mgg' => 1,
! 5433: 'mgh' => 1,
! 5434: 'mgi' => 1,
! 5435: 'mgj' => 1,
! 5436: 'mgk' => 1,
! 5437: 'mgl' => 1,
! 5438: 'mgm' => 1,
! 5439: 'mgn' => 1,
! 5440: 'mgo' => 1,
! 5441: 'mgp' => 1,
! 5442: 'mgq' => 1,
! 5443: 'mgr' => 1,
! 5444: 'mgs' => 1,
! 5445: 'mgt' => 1,
! 5446: 'mgu' => 1,
! 5447: 'mgv' => 1,
! 5448: 'mgw' => 1,
! 5449: 'mgx' => 1,
! 5450: 'mgy' => 1,
! 5451: 'mgz' => 1,
! 5452: 'mha' => 1,
! 5453: 'mhb' => 1,
! 5454: 'mhc' => 1,
! 5455: 'mhd' => 1,
! 5456: 'mhe' => 1,
! 5457: 'mhf' => 1,
! 5458: 'mhg' => 1,
! 5459: 'mhh' => 1,
! 5460: 'mhi' => 1,
! 5461: 'mhj' => 1,
! 5462: 'mhk' => 1,
! 5463: 'mhl' => 1,
! 5464: 'mhm' => 1,
! 5465: 'mhn' => 1,
! 5466: 'mho' => 1,
! 5467: 'mhp' => 1,
! 5468: 'mhq' => 1,
! 5469: 'mhs' => 1,
! 5470: 'mht' => 1,
! 5471: 'mhu' => 1,
! 5472: 'mhw' => 1,
! 5473: 'mhx' => 1,
! 5474: 'mhy' => 1,
! 5475: 'mhz' => 1,
! 5476: 'mia' => 1,
! 5477: 'mib' => 1,
! 5478: 'mic' => 1,
! 5479: 'mid' => 1,
! 5480: 'mie' => 1,
! 5481: 'mif' => 1,
! 5482: 'mig' => 1,
! 5483: 'mih' => 1,
! 5484: 'mii' => 1,
! 5485: 'mij' => 1,
! 5486: 'mik' => 1,
! 5487: 'mil' => 1,
! 5488: 'mim' => 1,
! 5489: 'mio' => 1,
! 5490: 'mip' => 1,
! 5491: 'miq' => 1,
! 5492: 'mir' => 1,
! 5493: 'mit' => 1,
! 5494: 'miu' => 1,
! 5495: 'miw' => 1,
! 5496: 'mix' => 1,
! 5497: 'miy' => 1,
! 5498: 'miz' => 1,
! 5499: 'mja' => 1,
! 5500: 'mjc' => 1,
! 5501: 'mjd' => 1,
! 5502: 'mje' => 1,
! 5503: 'mjg' => 1,
! 5504: 'mjh' => 1,
! 5505: 'mji' => 1,
! 5506: 'mjj' => 1,
! 5507: 'mjk' => 1,
! 5508: 'mjl' => 1,
! 5509: 'mjm' => 1,
! 5510: 'mjn' => 1,
! 5511: 'mjo' => 1,
! 5512: 'mjp' => 1,
! 5513: 'mjq' => 1,
! 5514: 'mjr' => 1,
! 5515: 'mjs' => 1,
! 5516: 'mjt' => 1,
! 5517: 'mju' => 1,
! 5518: 'mjv' => 1,
! 5519: 'mjw' => 1,
! 5520: 'mjx' => 1,
! 5521: 'mjy' => 1,
! 5522: 'mjz' => 1,
! 5523: 'mka' => 1,
! 5524: 'mkb' => 1,
! 5525: 'mkc' => 1,
! 5526: 'mke' => 1,
! 5527: 'mkf' => 1,
! 5528: 'mkg' => 1,
! 5529: 'mkh' => 1,
! 5530: 'mki' => 1,
! 5531: 'mkj' => 1,
! 5532: 'mkk' => 1,
! 5533: 'mkl' => 1,
! 5534: 'mkm' => 1,
! 5535: 'mkn' => 1,
! 5536: 'mko' => 1,
! 5537: 'mkp' => 1,
! 5538: 'mkq' => 1,
! 5539: 'mkr' => 1,
! 5540: 'mks' => 1,
! 5541: 'mkt' => 1,
! 5542: 'mkv' => 1,
! 5543: 'mkw' => 1,
! 5544: 'mkx' => 1,
! 5545: 'mky' => 1,
! 5546: 'mkz' => 1,
! 5547: 'mla' => 1,
! 5548: 'mlb' => 1,
! 5549: 'mlc' => 1,
! 5550: 'mld' => 1,
! 5551: 'mle' => 1,
! 5552: 'mlf' => 1,
! 5553: 'mlh' => 1,
! 5554: 'mli' => 1,
! 5555: 'mlj' => 1,
! 5556: 'mlk' => 1,
! 5557: 'mll' => 1,
! 5558: 'mlm' => 1,
! 5559: 'mln' => 1,
! 5560: 'mlo' => 1,
! 5561: 'mlp' => 1,
! 5562: 'mlr' => 1,
! 5563: 'mls' => 1,
! 5564: 'mlu' => 1,
! 5565: 'mlv' => 1,
! 5566: 'mlw' => 1,
! 5567: 'mlx' => 1,
! 5568: 'mlz' => 1,
! 5569: 'mma' => 1,
! 5570: 'mmb' => 1,
! 5571: 'mmc' => 1,
! 5572: 'mmd' => 1,
! 5573: 'mme' => 1,
! 5574: 'mmf' => 1,
! 5575: 'mmg' => 1,
! 5576: 'mmh' => 1,
! 5577: 'mmi' => 1,
! 5578: 'mmj' => 1,
! 5579: 'mmk' => 1,
! 5580: 'mml' => 1,
! 5581: 'mmm' => 1,
! 5582: 'mmn' => 1,
! 5583: 'mmo' => 1,
! 5584: 'mmp' => 1,
! 5585: 'mmq' => 1,
! 5586: 'mmt' => 1,
! 5587: 'mmu' => 1,
! 5588: 'mmv' => 1,
! 5589: 'mmw' => 1,
! 5590: 'mmx' => 1,
! 5591: 'mmy' => 1,
! 5592: 'mmz' => 1,
! 5593: 'mna' => 1,
! 5594: 'mnb' => 1,
! 5595: 'mnc' => 1,
! 5596: 'mnd' => 1,
! 5597: 'mne' => 1,
! 5598: 'mnf' => 1,
! 5599: 'mng' => 1,
! 5600: 'mnh' => 1,
! 5601: 'mni' => 1,
! 5602: 'mnj' => 1,
! 5603: 'mnl' => 1,
! 5604: 'mnm' => 1,
! 5605: 'mnn' => 1,
! 5606: 'mno' => 1,
! 5607: 'mnq' => 1,
! 5608: 'mnr' => 1,
! 5609: 'mns' => 1,
! 5610: 'mnt' => 1,
! 5611: 'mnu' => 1,
! 5612: 'mnv' => 1,
! 5613: 'mnw' => 1,
! 5614: 'mnx' => 1,
! 5615: 'mny' => 1,
! 5616: 'mnz' => 1,
! 5617: 'moa' => 1,
! 5618: 'moc' => 1,
! 5619: 'mod' => 1,
! 5620: 'moe' => 1,
! 5621: 'mof' => 1,
! 5622: 'mog' => 1,
! 5623: 'moh' => 1,
! 5624: 'moi' => 1,
! 5625: 'moj' => 1,
! 5626: 'mok' => 1,
! 5627: 'mom' => 1,
! 5628: 'moo' => 1,
! 5629: 'mop' => 1,
! 5630: 'moq' => 1,
! 5631: 'mor' => 1,
! 5632: 'mos' => 1,
! 5633: 'mot' => 1,
! 5634: 'mou' => 1,
! 5635: 'mov' => 1,
! 5636: 'mow' => 1,
! 5637: 'mox' => 1,
! 5638: 'moy' => 1,
! 5639: 'moz' => 1,
! 5640: 'mpa' => 1,
! 5641: 'mpb' => 1,
! 5642: 'mpc' => 1,
! 5643: 'mpd' => 1,
! 5644: 'mpe' => 1,
! 5645: 'mpg' => 1,
! 5646: 'mph' => 1,
! 5647: 'mpi' => 1,
! 5648: 'mpj' => 1,
! 5649: 'mpk' => 1,
! 5650: 'mpl' => 1,
! 5651: 'mpm' => 1,
! 5652: 'mpn' => 1,
! 5653: 'mpo' => 1,
! 5654: 'mpp' => 1,
! 5655: 'mpq' => 1,
! 5656: 'mpr' => 1,
! 5657: 'mps' => 1,
! 5658: 'mpt' => 1,
! 5659: 'mpu' => 1,
! 5660: 'mpv' => 1,
! 5661: 'mpw' => 1,
! 5662: 'mpx' => 1,
! 5663: 'mpy' => 1,
! 5664: 'mpz' => 1,
! 5665: 'mqa' => 1,
! 5666: 'mqb' => 1,
! 5667: 'mqc' => 1,
! 5668: 'mqe' => 1,
! 5669: 'mqf' => 1,
! 5670: 'mqh' => 1,
! 5671: 'mqi' => 1,
! 5672: 'mqj' => 1,
! 5673: 'mqk' => 1,
! 5674: 'mql' => 1,
! 5675: 'mqm' => 1,
! 5676: 'mqn' => 1,
! 5677: 'mqo' => 1,
! 5678: 'mqp' => 1,
! 5679: 'mqq' => 1,
! 5680: 'mqr' => 1,
! 5681: 'mqs' => 1,
! 5682: 'mqt' => 1,
! 5683: 'mqu' => 1,
! 5684: 'mqv' => 1,
! 5685: 'mqw' => 1,
! 5686: 'mqx' => 1,
! 5687: 'mqy' => 1,
! 5688: 'mqz' => 1,
! 5689: 'mra' => 1,
! 5690: 'mrb' => 1,
! 5691: 'mrc' => 1,
! 5692: 'mrd' => 1,
! 5693: 'mre' => 1,
! 5694: 'mrf' => 1,
! 5695: 'mrg' => 1,
! 5696: 'mrh' => 1,
! 5697: 'mrk' => 1,
! 5698: 'mrl' => 1,
! 5699: 'mrm' => 1,
! 5700: 'mrn' => 1,
! 5701: 'mro' => 1,
! 5702: 'mrp' => 1,
! 5703: 'mrq' => 1,
! 5704: 'mrr' => 1,
! 5705: 'mrs' => 1,
! 5706: 'mrt' => 1,
! 5707: 'mru' => 1,
! 5708: 'mrv' => 1,
! 5709: 'mrw' => 1,
! 5710: 'mrx' => 1,
! 5711: 'mry' => 1,
! 5712: 'mrz' => 1,
! 5713: 'msb' => 1,
! 5714: 'msd' => 1,
! 5715: 'mse' => 1,
! 5716: 'msf' => 1,
! 5717: 'msg' => 1,
! 5718: 'msj' => 1,
! 5719: 'msk' => 1,
! 5720: 'msl' => 1,
! 5721: 'msm' => 1,
! 5722: 'msn' => 1,
! 5723: 'mso' => 1,
! 5724: 'msp' => 1,
! 5725: 'msq' => 1,
! 5726: 'msr' => 1,
! 5727: 'mss' => 1,
! 5728: 'mst' => 1,
! 5729: 'msu' => 1,
! 5730: 'msv' => 1,
! 5731: 'msw' => 1,
! 5732: 'msx' => 1,
! 5733: 'msy' => 1,
! 5734: 'msz' => 1,
! 5735: 'mta' => 1,
! 5736: 'mtb' => 1,
! 5737: 'mtc' => 1,
! 5738: 'mtd' => 1,
! 5739: 'mte' => 1,
! 5740: 'mtf' => 1,
! 5741: 'mtg' => 1,
! 5742: 'mth' => 1,
! 5743: 'mti' => 1,
! 5744: 'mtj' => 1,
! 5745: 'mtk' => 1,
! 5746: 'mtl' => 1,
! 5747: 'mtm' => 1,
! 5748: 'mtn' => 1,
! 5749: 'mto' => 1,
! 5750: 'mtp' => 1,
! 5751: 'mtq' => 1,
! 5752: 'mts' => 1,
! 5753: 'mtt' => 1,
! 5754: 'mtu' => 1,
! 5755: 'mtv' => 1,
! 5756: 'mtw' => 1,
! 5757: 'mtx' => 1,
! 5758: 'mty' => 1,
! 5759: 'mua' => 1,
! 5760: 'mub' => 1,
! 5761: 'muc' => 1,
! 5762: 'mud' => 1,
! 5763: 'mue' => 1,
! 5764: 'mug' => 1,
! 5765: 'muh' => 1,
! 5766: 'muj' => 1,
! 5767: 'muk' => 1,
! 5768: 'mum' => 1,
! 5769: 'mun' => 1,
! 5770: 'muo' => 1,
! 5771: 'mur' => 1,
! 5772: 'mus' => 1,
! 5773: 'mut' => 1,
! 5774: 'muu' => 1,
! 5775: 'muv' => 1,
! 5776: 'mux' => 1,
! 5777: 'muy' => 1,
! 5778: 'muz' => 1,
! 5779: 'mva' => 1,
! 5780: 'mvb' => 1,
! 5781: 'mvd' => 1,
! 5782: 'mvg' => 1,
! 5783: 'mvh' => 1,
! 5784: 'mvi' => 1,
! 5785: 'mvk' => 1,
! 5786: 'mvl' => 1,
! 5787: 'mvm' => 1,
! 5788: 'mvn' => 1,
! 5789: 'mvo' => 1,
! 5790: 'mvp' => 1,
! 5791: 'mvq' => 1,
! 5792: 'mvr' => 1,
! 5793: 'mvs' => 1,
! 5794: 'mvt' => 1,
! 5795: 'mvu' => 1,
! 5796: 'mvv' => 1,
! 5797: 'mvw' => 1,
! 5798: 'mvx' => 1,
! 5799: 'mvy' => 1,
! 5800: 'mvz' => 1,
! 5801: 'mwa' => 1,
! 5802: 'mwb' => 1,
! 5803: 'mwc' => 1,
! 5804: 'mwd' => 1,
! 5805: 'mwe' => 1,
! 5806: 'mwf' => 1,
! 5807: 'mwg' => 1,
! 5808: 'mwh' => 1,
! 5809: 'mwi' => 1,
! 5810: 'mwj' => 1,
! 5811: 'mwl' => 1,
! 5812: 'mwm' => 1,
! 5813: 'mwn' => 1,
! 5814: 'mwo' => 1,
! 5815: 'mwp' => 1,
! 5816: 'mwq' => 1,
! 5817: 'mwr' => 1,
! 5818: 'mws' => 1,
! 5819: 'mwt' => 1,
! 5820: 'mwu' => 1,
! 5821: 'mwv' => 1,
! 5822: 'mwx' => 1,
! 5823: 'mwy' => 1,
! 5824: 'mwz' => 1,
! 5825: 'mxa' => 1,
! 5826: 'mxb' => 1,
! 5827: 'mxc' => 1,
! 5828: 'mxd' => 1,
! 5829: 'mxe' => 1,
! 5830: 'mxf' => 1,
! 5831: 'mxg' => 1,
! 5832: 'mxh' => 1,
! 5833: 'mxi' => 1,
! 5834: 'mxj' => 1,
! 5835: 'mxk' => 1,
! 5836: 'mxl' => 1,
! 5837: 'mxm' => 1,
! 5838: 'mxn' => 1,
! 5839: 'mxo' => 1,
! 5840: 'mxp' => 1,
! 5841: 'mxq' => 1,
! 5842: 'mxr' => 1,
! 5843: 'mxs' => 1,
! 5844: 'mxt' => 1,
! 5845: 'mxu' => 1,
! 5846: 'mxv' => 1,
! 5847: 'mxw' => 1,
! 5848: 'mxx' => 1,
! 5849: 'mxy' => 1,
! 5850: 'mxz' => 1,
! 5851: 'myb' => 1,
! 5852: 'myc' => 1,
! 5853: 'myd' => 1,
! 5854: 'mye' => 1,
! 5855: 'myf' => 1,
! 5856: 'myg' => 1,
! 5857: 'myh' => 1,
! 5858: 'myi' => 1,
! 5859: 'myj' => 1,
! 5860: 'myk' => 1,
! 5861: 'myl' => 1,
! 5862: 'mym' => 1,
! 5863: 'myn' => 1,
! 5864: 'myo' => 1,
! 5865: 'myp' => 1,
! 5866: 'myr' => 1,
! 5867: 'mys' => 1,
! 5868: 'myt' => 1,
! 5869: 'myu' => 1,
! 5870: 'myv' => 1,
! 5871: 'myw' => 1,
! 5872: 'myx' => 1,
! 5873: 'myy' => 1,
! 5874: 'myz' => 1,
! 5875: 'mza' => 1,
! 5876: 'mzb' => 1,
! 5877: 'mzc' => 1,
! 5878: 'mzd' => 1,
! 5879: 'mze' => 1,
! 5880: 'mzg' => 1,
! 5881: 'mzh' => 1,
! 5882: 'mzi' => 1,
! 5883: 'mzj' => 1,
! 5884: 'mzk' => 1,
! 5885: 'mzl' => 1,
! 5886: 'mzm' => 1,
! 5887: 'mzn' => 1,
! 5888: 'mzo' => 1,
! 5889: 'mzp' => 1,
! 5890: 'mzq' => 1,
! 5891: 'mzr' => 1,
! 5892: 'mzs' => 1,
! 5893: 'mzt' => 1,
! 5894: 'mzu' => 1,
! 5895: 'mzv' => 1,
! 5896: 'mzw' => 1,
! 5897: 'mzx' => 1,
! 5898: 'mzy' => 1,
! 5899: 'mzz' => 1,
! 5900: 'naa' => 1,
! 5901: 'nab' => 1,
! 5902: 'nac' => 1,
! 5903: 'nad' => 1,
! 5904: 'nae' => 1,
! 5905: 'naf' => 1,
! 5906: 'nag' => 1,
! 5907: 'nah' => 1,
! 5908: 'nai' => 1,
! 5909: 'naj' => 1,
! 5910: 'nak' => 1,
! 5911: 'nal' => 1,
! 5912: 'nam' => 1,
! 5913: 'nao' => 1,
! 5914: 'nap' => 1,
! 5915: 'naq' => 1,
! 5916: 'nar' => 1,
! 5917: 'nas' => 1,
! 5918: 'nat' => 1,
! 5919: 'naw' => 1,
! 5920: 'nax' => 1,
! 5921: 'nay' => 1,
! 5922: 'naz' => 1,
! 5923: 'nba' => 1,
! 5924: 'nbb' => 1,
! 5925: 'nbc' => 1,
! 5926: 'nbd' => 1,
! 5927: 'nbe' => 1,
! 5928: 'nbf' => 1,
! 5929: 'nbg' => 1,
! 5930: 'nbh' => 1,
! 5931: 'nbi' => 1,
! 5932: 'nbj' => 1,
! 5933: 'nbk' => 1,
! 5934: 'nbm' => 1,
! 5935: 'nbn' => 1,
! 5936: 'nbo' => 1,
! 5937: 'nbp' => 1,
! 5938: 'nbq' => 1,
! 5939: 'nbr' => 1,
! 5940: 'nbs' => 1,
! 5941: 'nbt' => 1,
! 5942: 'nbu' => 1,
! 5943: 'nbv' => 1,
! 5944: 'nbw' => 1,
! 5945: 'nbx' => 1,
! 5946: 'nby' => 1,
! 5947: 'nca' => 1,
! 5948: 'ncb' => 1,
! 5949: 'ncc' => 1,
! 5950: 'ncd' => 1,
! 5951: 'nce' => 1,
! 5952: 'ncf' => 1,
! 5953: 'ncg' => 1,
! 5954: 'nch' => 1,
! 5955: 'nci' => 1,
! 5956: 'ncj' => 1,
! 5957: 'nck' => 1,
! 5958: 'ncl' => 1,
! 5959: 'ncm' => 1,
! 5960: 'ncn' => 1,
! 5961: 'nco' => 1,
! 5962: 'ncp' => 1,
! 5963: 'ncr' => 1,
! 5964: 'ncs' => 1,
! 5965: 'nct' => 1,
! 5966: 'ncu' => 1,
! 5967: 'ncx' => 1,
! 5968: 'ncz' => 1,
! 5969: 'nda' => 1,
! 5970: 'ndb' => 1,
! 5971: 'ndc' => 1,
! 5972: 'ndd' => 1,
! 5973: 'ndf' => 1,
! 5974: 'ndg' => 1,
! 5975: 'ndh' => 1,
! 5976: 'ndi' => 1,
! 5977: 'ndj' => 1,
! 5978: 'ndk' => 1,
! 5979: 'ndl' => 1,
! 5980: 'ndm' => 1,
! 5981: 'ndn' => 1,
! 5982: 'ndp' => 1,
! 5983: 'ndq' => 1,
! 5984: 'ndr' => 1,
! 5985: 'nds' => 1,
! 5986: 'ndt' => 1,
! 5987: 'ndu' => 1,
! 5988: 'ndv' => 1,
! 5989: 'ndw' => 1,
! 5990: 'ndx' => 1,
! 5991: 'ndy' => 1,
! 5992: 'ndz' => 1,
! 5993: 'nea' => 1,
! 5994: 'neb' => 1,
! 5995: 'nec' => 1,
! 5996: 'ned' => 1,
! 5997: 'nee' => 1,
! 5998: 'nef' => 1,
! 5999: 'neg' => 1,
! 6000: 'neh' => 1,
! 6001: 'nei' => 1,
! 6002: 'nej' => 1,
! 6003: 'nek' => 1,
! 6004: 'nem' => 1,
! 6005: 'nen' => 1,
! 6006: 'neo' => 1,
! 6007: 'neq' => 1,
! 6008: 'ner' => 1,
! 6009: 'nes' => 1,
! 6010: 'net' => 1,
! 6011: 'nev' => 1,
! 6012: 'new' => 1,
! 6013: 'nex' => 1,
! 6014: 'ney' => 1,
! 6015: 'nez' => 1,
! 6016: 'nfa' => 1,
! 6017: 'nfd' => 1,
! 6018: 'nfl' => 1,
! 6019: 'nfr' => 1,
! 6020: 'nfu' => 1,
! 6021: 'nga' => 1,
! 6022: 'ngb' => 1,
! 6023: 'ngc' => 1,
! 6024: 'ngd' => 1,
! 6025: 'nge' => 1,
! 6026: 'ngf' => 1,
! 6027: 'ngg' => 1,
! 6028: 'ngh' => 1,
! 6029: 'ngi' => 1,
! 6030: 'ngj' => 1,
! 6031: 'ngk' => 1,
! 6032: 'ngl' => 1,
! 6033: 'ngm' => 1,
! 6034: 'ngn' => 1,
! 6035: 'ngo' => 1,
! 6036: 'ngp' => 1,
! 6037: 'ngq' => 1,
! 6038: 'ngr' => 1,
! 6039: 'ngs' => 1,
! 6040: 'ngt' => 1,
! 6041: 'ngu' => 1,
! 6042: 'ngv' => 1,
! 6043: 'ngw' => 1,
! 6044: 'ngx' => 1,
! 6045: 'ngy' => 1,
! 6046: 'ngz' => 1,
! 6047: 'nha' => 1,
! 6048: 'nhb' => 1,
! 6049: 'nhc' => 1,
! 6050: 'nhe' => 1,
! 6051: 'nhf' => 1,
! 6052: 'nhg' => 1,
! 6053: 'nhh' => 1,
! 6054: 'nhi' => 1,
! 6055: 'nhk' => 1,
! 6056: 'nhm' => 1,
! 6057: 'nhn' => 1,
! 6058: 'nho' => 1,
! 6059: 'nhp' => 1,
! 6060: 'nhq' => 1,
! 6061: 'nhr' => 1,
! 6062: 'nht' => 1,
! 6063: 'nhu' => 1,
! 6064: 'nhv' => 1,
! 6065: 'nhw' => 1,
! 6066: 'nhx' => 1,
! 6067: 'nhy' => 1,
! 6068: 'nhz' => 1,
! 6069: 'nia' => 1,
! 6070: 'nib' => 1,
! 6071: 'nic' => 1,
! 6072: 'nid' => 1,
! 6073: 'nie' => 1,
! 6074: 'nif' => 1,
! 6075: 'nig' => 1,
! 6076: 'nih' => 1,
! 6077: 'nii' => 1,
! 6078: 'nij' => 1,
! 6079: 'nik' => 1,
! 6080: 'nil' => 1,
! 6081: 'nim' => 1,
! 6082: 'nin' => 1,
! 6083: 'nio' => 1,
! 6084: 'nir' => 1,
! 6085: 'nis' => 1,
! 6086: 'nit' => 1,
! 6087: 'niu' => 1,
! 6088: 'niv' => 1,
! 6089: 'niw' => 1,
! 6090: 'nix' => 1,
! 6091: 'niy' => 1,
! 6092: 'niz' => 1,
! 6093: 'nja' => 1,
! 6094: 'njb' => 1,
! 6095: 'njd' => 1,
! 6096: 'njh' => 1,
! 6097: 'nji' => 1,
! 6098: 'njj' => 1,
! 6099: 'njl' => 1,
! 6100: 'njm' => 1,
! 6101: 'njn' => 1,
! 6102: 'njo' => 1,
! 6103: 'njr' => 1,
! 6104: 'njs' => 1,
! 6105: 'njt' => 1,
! 6106: 'nju' => 1,
! 6107: 'njx' => 1,
! 6108: 'njy' => 1,
! 6109: 'nka' => 1,
! 6110: 'nkb' => 1,
! 6111: 'nkc' => 1,
! 6112: 'nkd' => 1,
! 6113: 'nke' => 1,
! 6114: 'nkf' => 1,
! 6115: 'nkg' => 1,
! 6116: 'nkh' => 1,
! 6117: 'nki' => 1,
! 6118: 'nkj' => 1,
! 6119: 'nkk' => 1,
! 6120: 'nkm' => 1,
! 6121: 'nkn' => 1,
! 6122: 'nko' => 1,
! 6123: 'nkp' => 1,
! 6124: 'nkr' => 1,
! 6125: 'nks' => 1,
! 6126: 'nkt' => 1,
! 6127: 'nku' => 1,
! 6128: 'nkv' => 1,
! 6129: 'nkw' => 1,
! 6130: 'nkx' => 1,
! 6131: 'nkz' => 1,
! 6132: 'nla' => 1,
! 6133: 'nlc' => 1,
! 6134: 'nlg' => 1,
! 6135: 'nli' => 1,
! 6136: 'nlj' => 1,
! 6137: 'nlk' => 1,
! 6138: 'nll' => 1,
! 6139: 'nln' => 1,
! 6140: 'nlo' => 1,
! 6141: 'nlr' => 1,
! 6142: 'nlu' => 1,
! 6143: 'nlv' => 1,
! 6144: 'nlx' => 1,
! 6145: 'nly' => 1,
! 6146: 'nlz' => 1,
! 6147: 'nma' => 1,
! 6148: 'nmb' => 1,
! 6149: 'nmc' => 1,
! 6150: 'nmd' => 1,
! 6151: 'nme' => 1,
! 6152: 'nmf' => 1,
! 6153: 'nmg' => 1,
! 6154: 'nmh' => 1,
! 6155: 'nmi' => 1,
! 6156: 'nmj' => 1,
! 6157: 'nmk' => 1,
! 6158: 'nml' => 1,
! 6159: 'nmm' => 1,
! 6160: 'nmn' => 1,
! 6161: 'nmo' => 1,
! 6162: 'nmp' => 1,
! 6163: 'nmq' => 1,
! 6164: 'nmr' => 1,
! 6165: 'nms' => 1,
! 6166: 'nmt' => 1,
! 6167: 'nmu' => 1,
! 6168: 'nmv' => 1,
! 6169: 'nmw' => 1,
! 6170: 'nmx' => 1,
! 6171: 'nmy' => 1,
! 6172: 'nmz' => 1,
! 6173: 'nna' => 1,
! 6174: 'nnb' => 1,
! 6175: 'nnc' => 1,
! 6176: 'nnd' => 1,
! 6177: 'nne' => 1,
! 6178: 'nnf' => 1,
! 6179: 'nng' => 1,
! 6180: 'nnh' => 1,
! 6181: 'nni' => 1,
! 6182: 'nnj' => 1,
! 6183: 'nnk' => 1,
! 6184: 'nnl' => 1,
! 6185: 'nnm' => 1,
! 6186: 'nnn' => 1,
! 6187: 'nnp' => 1,
! 6188: 'nnq' => 1,
! 6189: 'nnr' => 1,
! 6190: 'nns' => 1,
! 6191: 'nnt' => 1,
! 6192: 'nnu' => 1,
! 6193: 'nnv' => 1,
! 6194: 'nnw' => 1,
! 6195: 'nnx' => 1,
! 6196: 'nny' => 1,
! 6197: 'nnz' => 1,
! 6198: 'noa' => 1,
! 6199: 'noc' => 1,
! 6200: 'nod' => 1,
! 6201: 'noe' => 1,
! 6202: 'nof' => 1,
! 6203: 'nog' => 1,
! 6204: 'noh' => 1,
! 6205: 'noi' => 1,
! 6206: 'nok' => 1,
! 6207: 'nom' => 1,
! 6208: 'non' => 1,
! 6209: 'noo' => 1,
! 6210: 'nop' => 1,
! 6211: 'noq' => 1,
! 6212: 'nos' => 1,
! 6213: 'not' => 1,
! 6214: 'nou' => 1,
! 6215: 'nov' => 1,
! 6216: 'now' => 1,
! 6217: 'noy' => 1,
! 6218: 'noz' => 1,
! 6219: 'npa' => 1,
! 6220: 'npb' => 1,
! 6221: 'nph' => 1,
! 6222: 'npl' => 1,
! 6223: 'npn' => 1,
! 6224: 'npo' => 1,
! 6225: 'nps' => 1,
! 6226: 'npu' => 1,
! 6227: 'npy' => 1,
! 6228: 'nqg' => 1,
! 6229: 'nqk' => 1,
! 6230: 'nqm' => 1,
! 6231: 'nqn' => 1,
! 6232: 'nqo' => 1,
! 6233: 'nra' => 1,
! 6234: 'nrb' => 1,
! 6235: 'nrc' => 1,
! 6236: 'nre' => 1,
! 6237: 'nrg' => 1,
! 6238: 'nri' => 1,
! 6239: 'nrl' => 1,
! 6240: 'nrm' => 1,
! 6241: 'nrn' => 1,
! 6242: 'nrp' => 1,
! 6243: 'nrr' => 1,
! 6244: 'nrt' => 1,
! 6245: 'nrx' => 1,
! 6246: 'nrz' => 1,
! 6247: 'nsa' => 1,
! 6248: 'nsc' => 1,
! 6249: 'nsd' => 1,
! 6250: 'nse' => 1,
! 6251: 'nsg' => 1,
! 6252: 'nsh' => 1,
! 6253: 'nsi' => 1,
! 6254: 'nsk' => 1,
! 6255: 'nsl' => 1,
! 6256: 'nsm' => 1,
! 6257: 'nsn' => 1,
! 6258: 'nso' => 1,
! 6259: 'nsp' => 1,
! 6260: 'nsq' => 1,
! 6261: 'nsr' => 1,
! 6262: 'nss' => 1,
! 6263: 'nst' => 1,
! 6264: 'nsu' => 1,
! 6265: 'nsv' => 1,
! 6266: 'nsw' => 1,
! 6267: 'nsx' => 1,
! 6268: 'nsy' => 1,
! 6269: 'nsz' => 1,
! 6270: 'nte' => 1,
! 6271: 'nti' => 1,
! 6272: 'ntj' => 1,
! 6273: 'ntk' => 1,
! 6274: 'ntm' => 1,
! 6275: 'nto' => 1,
! 6276: 'ntp' => 1,
! 6277: 'ntr' => 1,
! 6278: 'nts' => 1,
! 6279: 'ntu' => 1,
! 6280: 'ntw' => 1,
! 6281: 'nty' => 1,
! 6282: 'ntz' => 1,
! 6283: 'nua' => 1,
! 6284: 'nub' => 1,
! 6285: 'nuc' => 1,
! 6286: 'nud' => 1,
! 6287: 'nue' => 1,
! 6288: 'nuf' => 1,
! 6289: 'nug' => 1,
! 6290: 'nuh' => 1,
! 6291: 'nui' => 1,
! 6292: 'nuj' => 1,
! 6293: 'nul' => 1,
! 6294: 'num' => 1,
! 6295: 'nun' => 1,
! 6296: 'nuo' => 1,
! 6297: 'nup' => 1,
! 6298: 'nuq' => 1,
! 6299: 'nur' => 1,
! 6300: 'nus' => 1,
! 6301: 'nut' => 1,
! 6302: 'nuu' => 1,
! 6303: 'nuv' => 1,
! 6304: 'nuw' => 1,
! 6305: 'nux' => 1,
! 6306: 'nuy' => 1,
! 6307: 'nuz' => 1,
! 6308: 'nvh' => 1,
! 6309: 'nvm' => 1,
! 6310: 'nwa' => 1,
! 6311: 'nwb' => 1,
! 6312: 'nwc' => 1,
! 6313: 'nwe' => 1,
! 6314: 'nwi' => 1,
! 6315: 'nwm' => 1,
! 6316: 'nwr' => 1,
! 6317: 'nwx' => 1,
! 6318: 'nwy' => 1,
! 6319: 'nxa' => 1,
! 6320: 'nxd' => 1,
! 6321: 'nxe' => 1,
! 6322: 'nxg' => 1,
! 6323: 'nxi' => 1,
! 6324: 'nxl' => 1,
! 6325: 'nxm' => 1,
! 6326: 'nxn' => 1,
! 6327: 'nxr' => 1,
! 6328: 'nxu' => 1,
! 6329: 'nxx' => 1,
! 6330: 'nyb' => 1,
! 6331: 'nyc' => 1,
! 6332: 'nye' => 1,
! 6333: 'nyf' => 1,
! 6334: 'nyg' => 1,
! 6335: 'nyh' => 1,
! 6336: 'nyi' => 1,
! 6337: 'nyj' => 1,
! 6338: 'nyk' => 1,
! 6339: 'nyl' => 1,
! 6340: 'nym' => 1,
! 6341: 'nyn' => 1,
! 6342: 'nyo' => 1,
! 6343: 'nyp' => 1,
! 6344: 'nyq' => 1,
! 6345: 'nyr' => 1,
! 6346: 'nys' => 1,
! 6347: 'nyt' => 1,
! 6348: 'nyu' => 1,
! 6349: 'nyv' => 1,
! 6350: 'nyw' => 1,
! 6351: 'nyx' => 1,
! 6352: 'nyy' => 1,
! 6353: 'nza' => 1,
! 6354: 'nzb' => 1,
! 6355: 'nzi' => 1,
! 6356: 'nzk' => 1,
! 6357: 'nzm' => 1,
! 6358: 'nzs' => 1,
! 6359: 'nzu' => 1,
! 6360: 'nzy' => 1,
! 6361: 'oaa' => 1,
! 6362: 'oac' => 1,
! 6363: 'oar' => 1,
! 6364: 'oav' => 1,
! 6365: 'obi' => 1,
! 6366: 'obl' => 1,
! 6367: 'obm' => 1,
! 6368: 'obo' => 1,
! 6369: 'obr' => 1,
! 6370: 'obt' => 1,
! 6371: 'obu' => 1,
! 6372: 'oca' => 1,
! 6373: 'och' => 1,
! 6374: 'oco' => 1,
! 6375: 'ocu' => 1,
! 6376: 'oda' => 1,
! 6377: 'odk' => 1,
! 6378: 'odt' => 1,
! 6379: 'odu' => 1,
! 6380: 'ofo' => 1,
! 6381: 'ofs' => 1,
! 6382: 'ofu' => 1,
! 6383: 'ogb' => 1,
! 6384: 'ogc' => 1,
! 6385: 'oge' => 1,
! 6386: 'ogg' => 1,
! 6387: 'ogo' => 1,
! 6388: 'ogu' => 1,
! 6389: 'oht' => 1,
! 6390: 'ohu' => 1,
! 6391: 'oia' => 1,
! 6392: 'oin' => 1,
! 6393: 'ojp' => 1,
! 6394: 'ojv' => 1,
! 6395: 'oka' => 1,
! 6396: 'okb' => 1,
! 6397: 'okd' => 1,
! 6398: 'oke' => 1,
! 6399: 'okh' => 1,
! 6400: 'okj' => 1,
! 6401: 'okk' => 1,
! 6402: 'okl' => 1,
! 6403: 'okm' => 1,
! 6404: 'okn' => 1,
! 6405: 'oko' => 1,
! 6406: 'okr' => 1,
! 6407: 'oks' => 1,
! 6408: 'oku' => 1,
! 6409: 'okv' => 1,
! 6410: 'okx' => 1,
! 6411: 'ola' => 1,
! 6412: 'old' => 1,
! 6413: 'ole' => 1,
! 6414: 'olm' => 1,
! 6415: 'olo' => 1,
! 6416: 'olr' => 1,
! 6417: 'oma' => 1,
! 6418: 'omb' => 1,
! 6419: 'omc' => 1,
! 6420: 'ome' => 1,
! 6421: 'omg' => 1,
! 6422: 'omi' => 1,
! 6423: 'omk' => 1,
! 6424: 'oml' => 1,
! 6425: 'omn' => 1,
! 6426: 'omo' => 1,
! 6427: 'omp' => 1,
! 6428: 'omq' => 1,
! 6429: 'omr' => 1,
! 6430: 'omt' => 1,
! 6431: 'omu' => 1,
! 6432: 'omv' => 1,
! 6433: 'omw' => 1,
! 6434: 'omx' => 1,
! 6435: 'ona' => 1,
! 6436: 'onb' => 1,
! 6437: 'one' => 1,
! 6438: 'ong' => 1,
! 6439: 'oni' => 1,
! 6440: 'onj' => 1,
! 6441: 'onk' => 1,
! 6442: 'onn' => 1,
! 6443: 'ono' => 1,
! 6444: 'onp' => 1,
! 6445: 'onr' => 1,
! 6446: 'ons' => 1,
! 6447: 'ont' => 1,
! 6448: 'onu' => 1,
! 6449: 'onw' => 1,
! 6450: 'onx' => 1,
! 6451: 'ood' => 1,
! 6452: 'oog' => 1,
! 6453: 'oon' => 1,
! 6454: 'oor' => 1,
! 6455: 'oos' => 1,
! 6456: 'opa' => 1,
! 6457: 'opk' => 1,
! 6458: 'opm' => 1,
! 6459: 'opo' => 1,
! 6460: 'opt' => 1,
! 6461: 'opy' => 1,
! 6462: 'ora' => 1,
! 6463: 'ore' => 1,
! 6464: 'org' => 1,
! 6465: 'orh' => 1,
! 6466: 'oro' => 1,
! 6467: 'orr' => 1,
! 6468: 'ort' => 1,
! 6469: 'oru' => 1,
! 6470: 'orv' => 1,
! 6471: 'orw' => 1,
! 6472: 'orx' => 1,
! 6473: 'orz' => 1,
! 6474: 'osa' => 1,
! 6475: 'osc' => 1,
! 6476: 'osi' => 1,
! 6477: 'oso' => 1,
! 6478: 'osp' => 1,
! 6479: 'ost' => 1,
! 6480: 'osu' => 1,
! 6481: 'osx' => 1,
! 6482: 'ota' => 1,
! 6483: 'otb' => 1,
! 6484: 'otd' => 1,
! 6485: 'ote' => 1,
! 6486: 'oti' => 1,
! 6487: 'otk' => 1,
! 6488: 'otl' => 1,
! 6489: 'otm' => 1,
! 6490: 'otn' => 1,
! 6491: 'oto' => 1,
! 6492: 'otq' => 1,
! 6493: 'otr' => 1,
! 6494: 'ots' => 1,
! 6495: 'ott' => 1,
! 6496: 'otu' => 1,
! 6497: 'otx' => 1,
! 6498: 'oty' => 1,
! 6499: 'otz' => 1,
! 6500: 'oua' => 1,
! 6501: 'oub' => 1,
! 6502: 'oue' => 1,
! 6503: 'oui' => 1,
! 6504: 'oum' => 1,
! 6505: 'oun' => 1,
! 6506: 'owi' => 1,
! 6507: 'owl' => 1,
! 6508: 'oyb' => 1,
! 6509: 'oyd' => 1,
! 6510: 'oym' => 1,
! 6511: 'oyy' => 1,
! 6512: 'ozm' => 1,
! 6513: 'paa' => 1,
! 6514: 'pab' => 1,
! 6515: 'pac' => 1,
! 6516: 'pad' => 1,
! 6517: 'pae' => 1,
! 6518: 'paf' => 1,
! 6519: 'pag' => 1,
! 6520: 'pah' => 1,
! 6521: 'pai' => 1,
! 6522: 'pak' => 1,
! 6523: 'pal' => 1,
! 6524: 'pam' => 1,
! 6525: 'pao' => 1,
! 6526: 'pap' => 1,
! 6527: 'paq' => 1,
! 6528: 'par' => 1,
! 6529: 'pas' => 1,
! 6530: 'pat' => 1,
! 6531: 'pau' => 1,
! 6532: 'pav' => 1,
! 6533: 'paw' => 1,
! 6534: 'pax' => 1,
! 6535: 'pay' => 1,
! 6536: 'paz' => 1,
! 6537: 'pbb' => 1,
! 6538: 'pbc' => 1,
! 6539: 'pbe' => 1,
! 6540: 'pbf' => 1,
! 6541: 'pbg' => 1,
! 6542: 'pbh' => 1,
! 6543: 'pbi' => 1,
! 6544: 'pbl' => 1,
! 6545: 'pbn' => 1,
! 6546: 'pbo' => 1,
! 6547: 'pbp' => 1,
! 6548: 'pbr' => 1,
! 6549: 'pbs' => 1,
! 6550: 'pbv' => 1,
! 6551: 'pby' => 1,
! 6552: 'pbz' => 1,
! 6553: 'pca' => 1,
! 6554: 'pcb' => 1,
! 6555: 'pcc' => 1,
! 6556: 'pcd' => 1,
! 6557: 'pce' => 1,
! 6558: 'pcf' => 1,
! 6559: 'pcg' => 1,
! 6560: 'pch' => 1,
! 6561: 'pci' => 1,
! 6562: 'pcj' => 1,
! 6563: 'pck' => 1,
! 6564: 'pcl' => 1,
! 6565: 'pcm' => 1,
! 6566: 'pcn' => 1,
! 6567: 'pcp' => 1,
! 6568: 'pcr' => 1,
! 6569: 'pcw' => 1,
! 6570: 'pda' => 1,
! 6571: 'pdc' => 1,
! 6572: 'pdi' => 1,
! 6573: 'pdn' => 1,
! 6574: 'pdo' => 1,
! 6575: 'pdt' => 1,
! 6576: 'pdu' => 1,
! 6577: 'pea' => 1,
! 6578: 'peb' => 1,
! 6579: 'ped' => 1,
! 6580: 'pee' => 1,
! 6581: 'pef' => 1,
! 6582: 'peg' => 1,
! 6583: 'peh' => 1,
! 6584: 'pei' => 1,
! 6585: 'pej' => 1,
! 6586: 'pek' => 1,
! 6587: 'pem' => 1,
! 6588: 'peo' => 1,
! 6589: 'pep' => 1,
! 6590: 'peq' => 1,
! 6591: 'pev' => 1,
! 6592: 'pex' => 1,
! 6593: 'pey' => 1,
! 6594: 'pez' => 1,
! 6595: 'pfa' => 1,
! 6596: 'pfe' => 1,
! 6597: 'pfl' => 1,
! 6598: 'pgg' => 1,
! 6599: 'pgi' => 1,
! 6600: 'pgk' => 1,
! 6601: 'pgn' => 1,
! 6602: 'pgs' => 1,
! 6603: 'pgu' => 1,
! 6604: 'pgy' => 1,
! 6605: 'pha' => 1,
! 6606: 'phd' => 1,
! 6607: 'phg' => 1,
! 6608: 'phh' => 1,
! 6609: 'phi' => 1,
! 6610: 'phk' => 1,
! 6611: 'phl' => 1,
! 6612: 'phm' => 1,
! 6613: 'phn' => 1,
! 6614: 'pho' => 1,
! 6615: 'phq' => 1,
! 6616: 'pht' => 1,
! 6617: 'phu' => 1,
! 6618: 'phv' => 1,
! 6619: 'phw' => 1,
! 6620: 'pia' => 1,
! 6621: 'pib' => 1,
! 6622: 'pic' => 1,
! 6623: 'pid' => 1,
! 6624: 'pie' => 1,
! 6625: 'pif' => 1,
! 6626: 'pig' => 1,
! 6627: 'pih' => 1,
! 6628: 'pii' => 1,
! 6629: 'pij' => 1,
! 6630: 'pil' => 1,
! 6631: 'pim' => 1,
! 6632: 'pin' => 1,
! 6633: 'pio' => 1,
! 6634: 'pip' => 1,
! 6635: 'pir' => 1,
! 6636: 'pis' => 1,
! 6637: 'pit' => 1,
! 6638: 'piu' => 1,
! 6639: 'piv' => 1,
! 6640: 'piw' => 1,
! 6641: 'pix' => 1,
! 6642: 'piy' => 1,
! 6643: 'piz' => 1,
! 6644: 'pjt' => 1,
! 6645: 'pka' => 1,
! 6646: 'pkb' => 1,
! 6647: 'pkc' => 1,
! 6648: 'pkg' => 1,
! 6649: 'pkh' => 1,
! 6650: 'pkn' => 1,
! 6651: 'pkp' => 1,
! 6652: 'pkr' => 1,
! 6653: 'pks' => 1,
! 6654: 'pkt' => 1,
! 6655: 'pku' => 1,
! 6656: 'pla' => 1,
! 6657: 'plb' => 1,
! 6658: 'plc' => 1,
! 6659: 'pld' => 1,
! 6660: 'ple' => 1,
! 6661: 'plf' => 1,
! 6662: 'plg' => 1,
! 6663: 'plh' => 1,
! 6664: 'plj' => 1,
! 6665: 'plk' => 1,
! 6666: 'pll' => 1,
! 6667: 'pln' => 1,
! 6668: 'plo' => 1,
! 6669: 'plp' => 1,
! 6670: 'plq' => 1,
! 6671: 'plr' => 1,
! 6672: 'pls' => 1,
! 6673: 'plu' => 1,
! 6674: 'plv' => 1,
! 6675: 'plw' => 1,
! 6676: 'ply' => 1,
! 6677: 'plz' => 1,
! 6678: 'pma' => 1,
! 6679: 'pmb' => 1,
! 6680: 'pmc' => 1,
! 6681: 'pme' => 1,
! 6682: 'pmf' => 1,
! 6683: 'pmh' => 1,
! 6684: 'pmi' => 1,
! 6685: 'pmj' => 1,
! 6686: 'pmk' => 1,
! 6687: 'pml' => 1,
! 6688: 'pmm' => 1,
! 6689: 'pmn' => 1,
! 6690: 'pmo' => 1,
! 6691: 'pmq' => 1,
! 6692: 'pmr' => 1,
! 6693: 'pms' => 1,
! 6694: 'pmt' => 1,
! 6695: 'pmw' => 1,
! 6696: 'pmx' => 1,
! 6697: 'pmy' => 1,
! 6698: 'pmz' => 1,
! 6699: 'pna' => 1,
! 6700: 'pnc' => 1,
! 6701: 'pne' => 1,
! 6702: 'png' => 1,
! 6703: 'pnh' => 1,
! 6704: 'pni' => 1,
! 6705: 'pnm' => 1,
! 6706: 'pnn' => 1,
! 6707: 'pno' => 1,
! 6708: 'pnp' => 1,
! 6709: 'pnq' => 1,
! 6710: 'pnr' => 1,
! 6711: 'pns' => 1,
! 6712: 'pnt' => 1,
! 6713: 'pnu' => 1,
! 6714: 'pnv' => 1,
! 6715: 'pnw' => 1,
! 6716: 'pnx' => 1,
! 6717: 'pny' => 1,
! 6718: 'pnz' => 1,
! 6719: 'poc' => 1,
! 6720: 'pod' => 1,
! 6721: 'poe' => 1,
! 6722: 'pof' => 1,
! 6723: 'pog' => 1,
! 6724: 'poh' => 1,
! 6725: 'poi' => 1,
! 6726: 'pok' => 1,
! 6727: 'pom' => 1,
! 6728: 'pon' => 1,
! 6729: 'poo' => 1,
! 6730: 'pop' => 1,
! 6731: 'poq' => 1,
! 6732: 'pos' => 1,
! 6733: 'pot' => 1,
! 6734: 'pov' => 1,
! 6735: 'pow' => 1,
! 6736: 'pox' => 1,
! 6737: 'poy' => 1,
! 6738: 'poz' => 1,
! 6739: 'ppa' => 1,
! 6740: 'ppe' => 1,
! 6741: 'ppi' => 1,
! 6742: 'ppk' => 1,
! 6743: 'ppl' => 1,
! 6744: 'ppm' => 1,
! 6745: 'ppn' => 1,
! 6746: 'ppo' => 1,
! 6747: 'ppp' => 1,
! 6748: 'ppq' => 1,
! 6749: 'ppr' => 1,
! 6750: 'pps' => 1,
! 6751: 'ppt' => 1,
! 6752: 'ppu' => 1,
! 6753: 'pqa' => 1,
! 6754: 'pqe' => 1,
! 6755: 'pqm' => 1,
! 6756: 'pqw' => 1,
! 6757: 'pra' => 1,
! 6758: 'prb' => 1,
! 6759: 'prc' => 1,
! 6760: 'prd' => 1,
! 6761: 'pre' => 1,
! 6762: 'prg' => 1,
! 6763: 'prh' => 1,
! 6764: 'pri' => 1,
! 6765: 'prk' => 1,
! 6766: 'prl' => 1,
! 6767: 'prm' => 1,
! 6768: 'prn' => 1,
! 6769: 'pro' => 1,
! 6770: 'prp' => 1,
! 6771: 'prq' => 1,
! 6772: 'prr' => 1,
! 6773: 'prt' => 1,
! 6774: 'pru' => 1,
! 6775: 'prw' => 1,
! 6776: 'prx' => 1,
! 6777: 'pry' => 1,
! 6778: 'prz' => 1,
! 6779: 'psa' => 1,
! 6780: 'psc' => 1,
! 6781: 'psd' => 1,
! 6782: 'psg' => 1,
! 6783: 'psh' => 1,
! 6784: 'psi' => 1,
! 6785: 'psl' => 1,
! 6786: 'psm' => 1,
! 6787: 'psn' => 1,
! 6788: 'pso' => 1,
! 6789: 'psp' => 1,
! 6790: 'psq' => 1,
! 6791: 'psr' => 1,
! 6792: 'pss' => 1,
! 6793: 'psu' => 1,
! 6794: 'psw' => 1,
! 6795: 'psy' => 1,
! 6796: 'pta' => 1,
! 6797: 'pth' => 1,
! 6798: 'pti' => 1,
! 6799: 'ptn' => 1,
! 6800: 'pto' => 1,
! 6801: 'ptp' => 1,
! 6802: 'ptr' => 1,
! 6803: 'ptt' => 1,
! 6804: 'ptu' => 1,
! 6805: 'ptv' => 1,
! 6806: 'ptw' => 1,
! 6807: 'pty' => 1,
! 6808: 'pua' => 1,
! 6809: 'pub' => 1,
! 6810: 'puc' => 1,
! 6811: 'pud' => 1,
! 6812: 'pue' => 1,
! 6813: 'puf' => 1,
! 6814: 'pug' => 1,
! 6815: 'pui' => 1,
! 6816: 'puj' => 1,
! 6817: 'puk' => 1,
! 6818: 'pum' => 1,
! 6819: 'puo' => 1,
! 6820: 'pup' => 1,
! 6821: 'puq' => 1,
! 6822: 'pur' => 1,
! 6823: 'put' => 1,
! 6824: 'puu' => 1,
! 6825: 'puw' => 1,
! 6826: 'pux' => 1,
! 6827: 'puy' => 1,
! 6828: 'puz' => 1,
! 6829: 'pwa' => 1,
! 6830: 'pwb' => 1,
! 6831: 'pwg' => 1,
! 6832: 'pwm' => 1,
! 6833: 'pwn' => 1,
! 6834: 'pwo' => 1,
! 6835: 'pwr' => 1,
! 6836: 'pww' => 1,
! 6837: 'pxm' => 1,
! 6838: 'pye' => 1,
! 6839: 'pym' => 1,
! 6840: 'pyn' => 1,
! 6841: 'pyu' => 1,
! 6842: 'pyx' => 1,
! 6843: 'pyy' => 1,
! 6844: 'pzn' => 1,
! 6845: 'qua' => 1,
! 6846: 'quc' => 1,
! 6847: 'qui' => 1,
! 6848: 'qum' => 1,
! 6849: 'qun' => 1,
! 6850: 'quq' => 1,
! 6851: 'quv' => 1,
! 6852: 'qvy' => 1,
! 6853: 'qwe' => 1,
! 6854: 'qwm' => 1,
! 6855: 'qwt' => 1,
! 6856: 'qxq' => 1,
! 6857: 'qxs' => 1,
! 6858: 'qya' => 1,
! 6859: 'qyp' => 1,
! 6860: 'raa' => 1,
! 6861: 'rab' => 1,
! 6862: 'rac' => 1,
! 6863: 'rad' => 1,
! 6864: 'raf' => 1,
! 6865: 'rah' => 1,
! 6866: 'rai' => 1,
! 6867: 'raj' => 1,
! 6868: 'rak' => 1,
! 6869: 'ral' => 1,
! 6870: 'ram' => 1,
! 6871: 'ran' => 1,
! 6872: 'rao' => 1,
! 6873: 'rap' => 1,
! 6874: 'raq' => 1,
! 6875: 'rar' => 1,
! 6876: 'ras' => 1,
! 6877: 'rat' => 1,
! 6878: 'rau' => 1,
! 6879: 'rav' => 1,
! 6880: 'raw' => 1,
! 6881: 'rax' => 1,
! 6882: 'ray' => 1,
! 6883: 'raz' => 1,
! 6884: 'rbb' => 1,
! 6885: 'rcf' => 1,
! 6886: 'rdb' => 1,
! 6887: 'rea' => 1,
! 6888: 'reb' => 1,
! 6889: 'ree' => 1,
! 6890: 'reg' => 1,
! 6891: 'rei' => 1,
! 6892: 'rej' => 1,
! 6893: 'rel' => 1,
! 6894: 'rem' => 1,
! 6895: 'ren' => 1,
! 6896: 'rer' => 1,
! 6897: 'res' => 1,
! 6898: 'ret' => 1,
! 6899: 'rey' => 1,
! 6900: 'rga' => 1,
! 6901: 'rge' => 1,
! 6902: 'rgk' => 1,
! 6903: 'rgn' => 1,
! 6904: 'rgr' => 1,
! 6905: 'rgs' => 1,
! 6906: 'rgu' => 1,
! 6907: 'rhg' => 1,
! 6908: 'rhp' => 1,
! 6909: 'ria' => 1,
! 6910: 'rie' => 1,
! 6911: 'rif' => 1,
! 6912: 'ril' => 1,
! 6913: 'rim' => 1,
! 6914: 'rin' => 1,
! 6915: 'rir' => 1,
! 6916: 'rit' => 1,
! 6917: 'riu' => 1,
! 6918: 'rjg' => 1,
! 6919: 'rji' => 1,
! 6920: 'rjs' => 1,
! 6921: 'rka' => 1,
! 6922: 'rkb' => 1,
! 6923: 'rkh' => 1,
! 6924: 'rki' => 1,
! 6925: 'rkm' => 1,
! 6926: 'rkt' => 1,
! 6927: 'rma' => 1,
! 6928: 'rmb' => 1,
! 6929: 'rmd' => 1,
! 6930: 'rme' => 1,
! 6931: 'rmg' => 1,
! 6932: 'rmh' => 1,
! 6933: 'rmi' => 1,
! 6934: 'rmk' => 1,
! 6935: 'rmm' => 1,
! 6936: 'rmp' => 1,
! 6937: 'rmr' => 1,
! 6938: 'rms' => 1,
! 6939: 'rmt' => 1,
! 6940: 'rmu' => 1,
! 6941: 'rmv' => 1,
! 6942: 'rmx' => 1,
! 6943: 'rmz' => 1,
! 6944: 'rna' => 1,
! 6945: 'rnd' => 1,
! 6946: 'rng' => 1,
! 6947: 'rnl' => 1,
! 6948: 'rnn' => 1,
! 6949: 'rnp' => 1,
! 6950: 'rnw' => 1,
! 6951: 'roa' => 1,
! 6952: 'rob' => 1,
! 6953: 'roc' => 1,
! 6954: 'rod' => 1,
! 6955: 'roe' => 1,
! 6956: 'rof' => 1,
! 6957: 'rog' => 1,
! 6958: 'rol' => 1,
! 6959: 'rom' => 1,
! 6960: 'roo' => 1,
! 6961: 'rop' => 1,
! 6962: 'ror' => 1,
! 6963: 'rou' => 1,
! 6964: 'row' => 1,
! 6965: 'rpn' => 1,
! 6966: 'rpt' => 1,
! 6967: 'rri' => 1,
! 6968: 'rro' => 1,
! 6969: 'rsb' => 1,
! 6970: 'rsi' => 1,
! 6971: 'rsl' => 1,
! 6972: 'rth' => 1,
! 6973: 'rtm' => 1,
! 6974: 'rtw' => 1,
! 6975: 'rub' => 1,
! 6976: 'ruc' => 1,
! 6977: 'rue' => 1,
! 6978: 'ruf' => 1,
! 6979: 'rug' => 1,
! 6980: 'ruh' => 1,
! 6981: 'rui' => 1,
! 6982: 'ruk' => 1,
! 6983: 'ruo' => 1,
! 6984: 'rup' => 1,
! 6985: 'ruq' => 1,
! 6986: 'rut' => 1,
! 6987: 'ruu' => 1,
! 6988: 'ruy' => 1,
! 6989: 'ruz' => 1,
! 6990: 'rwa' => 1,
! 6991: 'rwk' => 1,
! 6992: 'rwm' => 1,
! 6993: 'rwo' => 1,
! 6994: 'ryn' => 1,
! 6995: 'rys' => 1,
! 6996: 'ryu' => 1,
! 6997: 'saa' => 1,
! 6998: 'sab' => 1,
! 6999: 'sac' => 1,
! 7000: 'sad' => 1,
! 7001: 'sae' => 1,
! 7002: 'saf' => 1,
! 7003: 'sah' => 1,
! 7004: 'sai' => 1,
! 7005: 'saj' => 1,
! 7006: 'sak' => 1,
! 7007: 'sal' => 1,
! 7008: 'sam' => 1,
! 7009: 'sao' => 1,
! 7010: 'sap' => 1,
! 7011: 'saq' => 1,
! 7012: 'sar' => 1,
! 7013: 'sas' => 1,
! 7014: 'sat' => 1,
! 7015: 'sau' => 1,
! 7016: 'sav' => 1,
! 7017: 'saw' => 1,
! 7018: 'sax' => 1,
! 7019: 'say' => 1,
! 7020: 'saz' => 1,
! 7021: 'sba' => 1,
! 7022: 'sbb' => 1,
! 7023: 'sbc' => 1,
! 7024: 'sbd' => 1,
! 7025: 'sbe' => 1,
! 7026: 'sbf' => 1,
! 7027: 'sbg' => 1,
! 7028: 'sbh' => 1,
! 7029: 'sbi' => 1,
! 7030: 'sbj' => 1,
! 7031: 'sbk' => 1,
! 7032: 'sbl' => 1,
! 7033: 'sbm' => 1,
! 7034: 'sbn' => 1,
! 7035: 'sbo' => 1,
! 7036: 'sbp' => 1,
! 7037: 'sbq' => 1,
! 7038: 'sbr' => 1,
! 7039: 'sbs' => 1,
! 7040: 'sbt' => 1,
! 7041: 'sbu' => 1,
! 7042: 'sbv' => 1,
! 7043: 'sbw' => 1,
! 7044: 'sbx' => 1,
! 7045: 'sby' => 1,
! 7046: 'sbz' => 1,
! 7047: 'sca' => 1,
! 7048: 'scb' => 1,
! 7049: 'sce' => 1,
! 7050: 'scf' => 1,
! 7051: 'scg' => 1,
! 7052: 'sch' => 1,
! 7053: 'sci' => 1,
! 7054: 'sck' => 1,
! 7055: 'scl' => 1,
! 7056: 'scn' => 1,
! 7057: 'sco' => 1,
! 7058: 'scp' => 1,
! 7059: 'scq' => 1,
! 7060: 'scu' => 1,
! 7061: 'scv' => 1,
! 7062: 'scw' => 1,
! 7063: 'scx' => 1,
! 7064: 'sda' => 1,
! 7065: 'sdb' => 1,
! 7066: 'sde' => 1,
! 7067: 'sdf' => 1,
! 7068: 'sdg' => 1,
! 7069: 'sdj' => 1,
! 7070: 'sdk' => 1,
! 7071: 'sdl' => 1,
! 7072: 'sdm' => 1,
! 7073: 'sdo' => 1,
! 7074: 'sdp' => 1,
! 7075: 'sdr' => 1,
! 7076: 'sds' => 1,
! 7077: 'sdt' => 1,
! 7078: 'sdu' => 1,
! 7079: 'sdv' => 1,
! 7080: 'sdx' => 1,
! 7081: 'sdz' => 1,
! 7082: 'sea' => 1,
! 7083: 'seb' => 1,
! 7084: 'sec' => 1,
! 7085: 'sed' => 1,
! 7086: 'see' => 1,
! 7087: 'sef' => 1,
! 7088: 'seg' => 1,
! 7089: 'seh' => 1,
! 7090: 'sei' => 1,
! 7091: 'sej' => 1,
! 7092: 'sek' => 1,
! 7093: 'sel' => 1,
! 7094: 'sem' => 1,
! 7095: 'sen' => 1,
! 7096: 'seo' => 1,
! 7097: 'sep' => 1,
! 7098: 'seq' => 1,
! 7099: 'ser' => 1,
! 7100: 'ses' => 1,
! 7101: 'set' => 1,
! 7102: 'seu' => 1,
! 7103: 'sev' => 1,
! 7104: 'sew' => 1,
! 7105: 'sey' => 1,
! 7106: 'sez' => 1,
! 7107: 'sfb' => 1,
! 7108: 'sfs' => 1,
! 7109: 'sfw' => 1,
! 7110: 'sga' => 1,
! 7111: 'sgb' => 1,
! 7112: 'sge' => 1,
! 7113: 'sgg' => 1,
! 7114: 'sgh' => 1,
! 7115: 'sgi' => 1,
! 7116: 'sgk' => 1,
! 7117: 'sgl' => 1,
! 7118: 'sgm' => 1,
! 7119: 'sgn' => 1,
! 7120: 'sgo' => 1,
! 7121: 'sgp' => 1,
! 7122: 'sgr' => 1,
! 7123: 'sgt' => 1,
! 7124: 'sgu' => 1,
! 7125: 'sgw' => 1,
! 7126: 'sgx' => 1,
! 7127: 'sgz' => 1,
! 7128: 'sha' => 1,
! 7129: 'shb' => 1,
! 7130: 'shc' => 1,
! 7131: 'she' => 1,
! 7132: 'shg' => 1,
! 7133: 'shh' => 1,
! 7134: 'shi' => 1,
! 7135: 'shj' => 1,
! 7136: 'shk' => 1,
! 7137: 'shl' => 1,
! 7138: 'shm' => 1,
! 7139: 'shn' => 1,
! 7140: 'sho' => 1,
! 7141: 'shp' => 1,
! 7142: 'shq' => 1,
! 7143: 'shr' => 1,
! 7144: 'shs' => 1,
! 7145: 'sht' => 1,
! 7146: 'shv' => 1,
! 7147: 'shw' => 1,
! 7148: 'shx' => 1,
! 7149: 'shy' => 1,
! 7150: 'shz' => 1,
! 7151: 'sia' => 1,
! 7152: 'sib' => 1,
! 7153: 'sid' => 1,
! 7154: 'sie' => 1,
! 7155: 'sif' => 1,
! 7156: 'sig' => 1,
! 7157: 'sih' => 1,
! 7158: 'sii' => 1,
! 7159: 'sij' => 1,
! 7160: 'sik' => 1,
! 7161: 'sil' => 1,
! 7162: 'sim' => 1,
! 7163: 'sio' => 1,
! 7164: 'sip' => 1,
! 7165: 'siq' => 1,
! 7166: 'sir' => 1,
! 7167: 'sis' => 1,
! 7168: 'sit' => 1,
! 7169: 'siu' => 1,
! 7170: 'siv' => 1,
! 7171: 'siw' => 1,
! 7172: 'six' => 1,
! 7173: 'siy' => 1,
! 7174: 'siz' => 1,
! 7175: 'sja' => 1,
! 7176: 'sjb' => 1,
! 7177: 'sjd' => 1,
! 7178: 'sje' => 1,
! 7179: 'sjg' => 1,
! 7180: 'sjk' => 1,
! 7181: 'sjl' => 1,
! 7182: 'sjm' => 1,
! 7183: 'sjn' => 1,
! 7184: 'sjo' => 1,
! 7185: 'sjp' => 1,
! 7186: 'sjr' => 1,
! 7187: 'sjs' => 1,
! 7188: 'sjt' => 1,
! 7189: 'sju' => 1,
! 7190: 'sjw' => 1,
! 7191: 'ska' => 1,
! 7192: 'skb' => 1,
! 7193: 'skc' => 1,
! 7194: 'skd' => 1,
! 7195: 'ske' => 1,
! 7196: 'skf' => 1,
! 7197: 'skh' => 1,
! 7198: 'ski' => 1,
! 7199: 'skj' => 1,
! 7200: 'skk' => 1,
! 7201: 'skm' => 1,
! 7202: 'skn' => 1,
! 7203: 'sko' => 1,
! 7204: 'skp' => 1,
! 7205: 'skq' => 1,
! 7206: 'sks' => 1,
! 7207: 'skt' => 1,
! 7208: 'sku' => 1,
! 7209: 'skv' => 1,
! 7210: 'skw' => 1,
! 7211: 'skx' => 1,
! 7212: 'sky' => 1,
! 7213: 'skz' => 1,
! 7214: 'sla' => 1,
! 7215: 'slc' => 1,
! 7216: 'sld' => 1,
! 7217: 'sle' => 1,
! 7218: 'slf' => 1,
! 7219: 'slg' => 1,
! 7220: 'slh' => 1,
! 7221: 'sli' => 1,
! 7222: 'slj' => 1,
! 7223: 'sll' => 1,
! 7224: 'slm' => 1,
! 7225: 'sln' => 1,
! 7226: 'slp' => 1,
! 7227: 'slq' => 1,
! 7228: 'slr' => 1,
! 7229: 'sls' => 1,
! 7230: 'slt' => 1,
! 7231: 'slu' => 1,
! 7232: 'slw' => 1,
! 7233: 'slx' => 1,
! 7234: 'sly' => 1,
! 7235: 'slz' => 1,
! 7236: 'sma' => 1,
! 7237: 'smb' => 1,
! 7238: 'smc' => 1,
! 7239: 'smd' => 1,
! 7240: 'smf' => 1,
! 7241: 'smg' => 1,
! 7242: 'smh' => 1,
! 7243: 'smi' => 1,
! 7244: 'smj' => 1,
! 7245: 'smk' => 1,
! 7246: 'sml' => 1,
! 7247: 'smm' => 1,
! 7248: 'smn' => 1,
! 7249: 'smp' => 1,
! 7250: 'smq' => 1,
! 7251: 'smr' => 1,
! 7252: 'sms' => 1,
! 7253: 'smt' => 1,
! 7254: 'smu' => 1,
! 7255: 'smv' => 1,
! 7256: 'smw' => 1,
! 7257: 'smx' => 1,
! 7258: 'smy' => 1,
! 7259: 'smz' => 1,
! 7260: 'snb' => 1,
! 7261: 'snc' => 1,
! 7262: 'sne' => 1,
! 7263: 'snf' => 1,
! 7264: 'sng' => 1,
! 7265: 'snh' => 1,
! 7266: 'sni' => 1,
! 7267: 'snj' => 1,
! 7268: 'snk' => 1,
! 7269: 'snl' => 1,
! 7270: 'snm' => 1,
! 7271: 'snn' => 1,
! 7272: 'sno' => 1,
! 7273: 'snp' => 1,
! 7274: 'snq' => 1,
! 7275: 'snr' => 1,
! 7276: 'sns' => 1,
! 7277: 'snu' => 1,
! 7278: 'snv' => 1,
! 7279: 'snw' => 1,
! 7280: 'snx' => 1,
! 7281: 'sny' => 1,
! 7282: 'snz' => 1,
! 7283: 'soa' => 1,
! 7284: 'sob' => 1,
! 7285: 'soc' => 1,
! 7286: 'sod' => 1,
! 7287: 'soe' => 1,
! 7288: 'sog' => 1,
! 7289: 'soh' => 1,
! 7290: 'soi' => 1,
! 7291: 'soj' => 1,
! 7292: 'sok' => 1,
! 7293: 'sol' => 1,
! 7294: 'son' => 1,
! 7295: 'soo' => 1,
! 7296: 'sop' => 1,
! 7297: 'soq' => 1,
! 7298: 'sor' => 1,
! 7299: 'sos' => 1,
! 7300: 'sou' => 1,
! 7301: 'sov' => 1,
! 7302: 'sow' => 1,
! 7303: 'sox' => 1,
! 7304: 'soy' => 1,
! 7305: 'soz' => 1,
! 7306: 'spb' => 1,
! 7307: 'spc' => 1,
! 7308: 'spd' => 1,
! 7309: 'spe' => 1,
! 7310: 'spg' => 1,
! 7311: 'spi' => 1,
! 7312: 'spk' => 1,
! 7313: 'spl' => 1,
! 7314: 'spm' => 1,
! 7315: 'spo' => 1,
! 7316: 'spp' => 1,
! 7317: 'spq' => 1,
! 7318: 'spr' => 1,
! 7319: 'sps' => 1,
! 7320: 'spt' => 1,
! 7321: 'spu' => 1,
! 7322: 'spx' => 1,
! 7323: 'sqa' => 1,
! 7324: 'sqh' => 1,
! 7325: 'sqj' => 1,
! 7326: 'sqm' => 1,
! 7327: 'sqn' => 1,
! 7328: 'sqo' => 1,
! 7329: 'sqq' => 1,
! 7330: 'sqr' => 1,
! 7331: 'sqs' => 1,
! 7332: 'sqt' => 1,
! 7333: 'squ' => 1,
! 7334: 'sra' => 1,
! 7335: 'srb' => 1,
! 7336: 'sre' => 1,
! 7337: 'srf' => 1,
! 7338: 'srg' => 1,
! 7339: 'srh' => 1,
! 7340: 'sri' => 1,
! 7341: 'srk' => 1,
! 7342: 'srl' => 1,
! 7343: 'srm' => 1,
! 7344: 'srn' => 1,
! 7345: 'srq' => 1,
! 7346: 'srr' => 1,
! 7347: 'srs' => 1,
! 7348: 'srt' => 1,
! 7349: 'sru' => 1,
! 7350: 'srv' => 1,
! 7351: 'srw' => 1,
! 7352: 'srx' => 1,
! 7353: 'sry' => 1,
! 7354: 'srz' => 1,
! 7355: 'ssa' => 1,
! 7356: 'ssb' => 1,
! 7357: 'ssc' => 1,
! 7358: 'ssd' => 1,
! 7359: 'sse' => 1,
! 7360: 'ssf' => 1,
! 7361: 'ssg' => 1,
! 7362: 'ssi' => 1,
! 7363: 'ssj' => 1,
! 7364: 'ssk' => 1,
! 7365: 'ssl' => 1,
! 7366: 'ssm' => 1,
! 7367: 'ssn' => 1,
! 7368: 'sso' => 1,
! 7369: 'ssp' => 1,
! 7370: 'ssq' => 1,
! 7371: 'ssr' => 1,
! 7372: 'sss' => 1,
! 7373: 'sst' => 1,
! 7374: 'ssu' => 1,
! 7375: 'ssv' => 1,
! 7376: 'ssx' => 1,
! 7377: 'ssy' => 1,
! 7378: 'ssz' => 1,
! 7379: 'sta' => 1,
! 7380: 'stb' => 1,
! 7381: 'std' => 1,
! 7382: 'ste' => 1,
! 7383: 'stf' => 1,
! 7384: 'stg' => 1,
! 7385: 'sth' => 1,
! 7386: 'sti' => 1,
! 7387: 'stj' => 1,
! 7388: 'stk' => 1,
! 7389: 'stl' => 1,
! 7390: 'stm' => 1,
! 7391: 'stn' => 1,
! 7392: 'sto' => 1,
! 7393: 'stp' => 1,
! 7394: 'stq' => 1,
! 7395: 'str' => 1,
! 7396: 'sts' => 1,
! 7397: 'stt' => 1,
! 7398: 'stu' => 1,
! 7399: 'stv' => 1,
! 7400: 'stw' => 1,
! 7401: 'sua' => 1,
! 7402: 'sub' => 1,
! 7403: 'suc' => 1,
! 7404: 'sue' => 1,
! 7405: 'sug' => 1,
! 7406: 'sui' => 1,
! 7407: 'suj' => 1,
! 7408: 'suk' => 1,
! 7409: 'sul' => 1,
! 7410: 'sum' => 1,
! 7411: 'suq' => 1,
! 7412: 'sur' => 1,
! 7413: 'sus' => 1,
! 7414: 'sut' => 1,
! 7415: 'suv' => 1,
! 7416: 'suw' => 1,
! 7417: 'sux' => 1,
! 7418: 'suy' => 1,
! 7419: 'suz' => 1,
! 7420: 'sva' => 1,
! 7421: 'svb' => 1,
! 7422: 'svc' => 1,
! 7423: 'sve' => 1,
! 7424: 'svk' => 1,
! 7425: 'svr' => 1,
! 7426: 'svs' => 1,
! 7427: 'svx' => 1,
! 7428: 'swb' => 1,
! 7429: 'swf' => 1,
! 7430: 'swg' => 1,
! 7431: 'swi' => 1,
! 7432: 'swj' => 1,
! 7433: 'swk' => 1,
! 7434: 'swl' => 1,
! 7435: 'swm' => 1,
! 7436: 'swn' => 1,
! 7437: 'swo' => 1,
! 7438: 'swp' => 1,
! 7439: 'swq' => 1,
! 7440: 'swr' => 1,
! 7441: 'sws' => 1,
! 7442: 'swt' => 1,
! 7443: 'swu' => 1,
! 7444: 'sww' => 1,
! 7445: 'swx' => 1,
! 7446: 'swy' => 1,
! 7447: 'sxb' => 1,
! 7448: 'sxc' => 1,
! 7449: 'sxe' => 1,
! 7450: 'sxg' => 1,
! 7451: 'sxk' => 1,
! 7452: 'sxl' => 1,
! 7453: 'sxm' => 1,
! 7454: 'sxn' => 1,
! 7455: 'sxo' => 1,
! 7456: 'sxr' => 1,
! 7457: 'sxs' => 1,
! 7458: 'sxu' => 1,
! 7459: 'sxw' => 1,
! 7460: 'sya' => 1,
! 7461: 'syb' => 1,
! 7462: 'syc' => 1,
! 7463: 'syd' => 1,
! 7464: 'syi' => 1,
! 7465: 'syk' => 1,
! 7466: 'syl' => 1,
! 7467: 'sym' => 1,
! 7468: 'syn' => 1,
! 7469: 'syo' => 1,
! 7470: 'syr' => 1,
! 7471: 'sys' => 1,
! 7472: 'syw' => 1,
! 7473: 'syy' => 1,
! 7474: 'sza' => 1,
! 7475: 'szb' => 1,
! 7476: 'szc' => 1,
! 7477: 'szd' => 1,
! 7478: 'sze' => 1,
! 7479: 'szg' => 1,
! 7480: 'szl' => 1,
! 7481: 'szn' => 1,
! 7482: 'szp' => 1,
! 7483: 'szv' => 1,
! 7484: 'szw' => 1,
! 7485: 'taa' => 1,
! 7486: 'tab' => 1,
! 7487: 'tac' => 1,
! 7488: 'tad' => 1,
! 7489: 'tae' => 1,
! 7490: 'taf' => 1,
! 7491: 'tag' => 1,
! 7492: 'tai' => 1,
! 7493: 'taj' => 1,
! 7494: 'tak' => 1,
! 7495: 'tal' => 1,
! 7496: 'tan' => 1,
! 7497: 'tao' => 1,
! 7498: 'tap' => 1,
! 7499: 'tar' => 1,
! 7500: 'tas' => 1,
! 7501: 'tau' => 1,
! 7502: 'tav' => 1,
! 7503: 'taw' => 1,
! 7504: 'tax' => 1,
! 7505: 'tay' => 1,
! 7506: 'taz' => 1,
! 7507: 'tba' => 1,
! 7508: 'tbb' => 1,
! 7509: 'tbc' => 1,
! 7510: 'tbd' => 1,
! 7511: 'tbe' => 1,
! 7512: 'tbf' => 1,
! 7513: 'tbg' => 1,
! 7514: 'tbh' => 1,
! 7515: 'tbi' => 1,
! 7516: 'tbj' => 1,
! 7517: 'tbk' => 1,
! 7518: 'tbl' => 1,
! 7519: 'tbm' => 1,
! 7520: 'tbn' => 1,
! 7521: 'tbo' => 1,
! 7522: 'tbp' => 1,
! 7523: 'tbq' => 1,
! 7524: 'tbr' => 1,
! 7525: 'tbs' => 1,
! 7526: 'tbt' => 1,
! 7527: 'tbu' => 1,
! 7528: 'tbv' => 1,
! 7529: 'tbw' => 1,
! 7530: 'tbx' => 1,
! 7531: 'tby' => 1,
! 7532: 'tbz' => 1,
! 7533: 'tca' => 1,
! 7534: 'tcb' => 1,
! 7535: 'tcc' => 1,
! 7536: 'tcd' => 1,
! 7537: 'tce' => 1,
! 7538: 'tcf' => 1,
! 7539: 'tcg' => 1,
! 7540: 'tch' => 1,
! 7541: 'tci' => 1,
! 7542: 'tck' => 1,
! 7543: 'tcl' => 1,
! 7544: 'tcm' => 1,
! 7545: 'tcn' => 1,
! 7546: 'tco' => 1,
! 7547: 'tcp' => 1,
! 7548: 'tcq' => 1,
! 7549: 'tcs' => 1,
! 7550: 'tct' => 1,
! 7551: 'tcu' => 1,
! 7552: 'tcw' => 1,
! 7553: 'tcx' => 1,
! 7554: 'tcy' => 1,
! 7555: 'tcz' => 1,
! 7556: 'tda' => 1,
! 7557: 'tdb' => 1,
! 7558: 'tdc' => 1,
! 7559: 'tdd' => 1,
! 7560: 'tdf' => 1,
! 7561: 'tdg' => 1,
! 7562: 'tdh' => 1,
! 7563: 'tdi' => 1,
! 7564: 'tdj' => 1,
! 7565: 'tdk' => 1,
! 7566: 'tdl' => 1,
! 7567: 'tdn' => 1,
! 7568: 'tdo' => 1,
! 7569: 'tdq' => 1,
! 7570: 'tdr' => 1,
! 7571: 'tds' => 1,
! 7572: 'tdt' => 1,
! 7573: 'tdu' => 1,
! 7574: 'tdv' => 1,
! 7575: 'tdy' => 1,
! 7576: 'tea' => 1,
! 7577: 'teb' => 1,
! 7578: 'ted' => 1,
! 7579: 'tee' => 1,
! 7580: 'tef' => 1,
! 7581: 'teg' => 1,
! 7582: 'teh' => 1,
! 7583: 'tei' => 1,
! 7584: 'tek' => 1,
! 7585: 'tem' => 1,
! 7586: 'ten' => 1,
! 7587: 'teo' => 1,
! 7588: 'tep' => 1,
! 7589: 'teq' => 1,
! 7590: 'ter' => 1,
! 7591: 'tes' => 1,
! 7592: 'tet' => 1,
! 7593: 'teu' => 1,
! 7594: 'tev' => 1,
! 7595: 'tew' => 1,
! 7596: 'tex' => 1,
! 7597: 'tey' => 1,
! 7598: 'tfi' => 1,
! 7599: 'tfn' => 1,
! 7600: 'tfo' => 1,
! 7601: 'tfr' => 1,
! 7602: 'tft' => 1,
! 7603: 'tga' => 1,
! 7604: 'tgb' => 1,
! 7605: 'tgc' => 1,
! 7606: 'tgd' => 1,
! 7607: 'tge' => 1,
! 7608: 'tgf' => 1,
! 7609: 'tgg' => 1,
! 7610: 'tgh' => 1,
! 7611: 'tgi' => 1,
! 7612: 'tgo' => 1,
! 7613: 'tgp' => 1,
! 7614: 'tgq' => 1,
! 7615: 'tgr' => 1,
! 7616: 'tgs' => 1,
! 7617: 'tgt' => 1,
! 7618: 'tgu' => 1,
! 7619: 'tgv' => 1,
! 7620: 'tgw' => 1,
! 7621: 'tgx' => 1,
! 7622: 'tgy' => 1,
! 7623: 'thc' => 1,
! 7624: 'thd' => 1,
! 7625: 'the' => 1,
! 7626: 'thf' => 1,
! 7627: 'thh' => 1,
! 7628: 'thi' => 1,
! 7629: 'thk' => 1,
! 7630: 'thl' => 1,
! 7631: 'thm' => 1,
! 7632: 'thn' => 1,
! 7633: 'thp' => 1,
! 7634: 'thq' => 1,
! 7635: 'thr' => 1,
! 7636: 'ths' => 1,
! 7637: 'tht' => 1,
! 7638: 'thu' => 1,
! 7639: 'thw' => 1,
! 7640: 'thx' => 1,
! 7641: 'thy' => 1,
! 7642: 'tia' => 1,
! 7643: 'tic' => 1,
! 7644: 'tid' => 1,
! 7645: 'tie' => 1,
! 7646: 'tif' => 1,
! 7647: 'tig' => 1,
! 7648: 'tih' => 1,
! 7649: 'tii' => 1,
! 7650: 'tij' => 1,
! 7651: 'tik' => 1,
! 7652: 'til' => 1,
! 7653: 'tim' => 1,
! 7654: 'tin' => 1,
! 7655: 'tio' => 1,
! 7656: 'tip' => 1,
! 7657: 'tiq' => 1,
! 7658: 'tis' => 1,
! 7659: 'tit' => 1,
! 7660: 'tiu' => 1,
! 7661: 'tiv' => 1,
! 7662: 'tiw' => 1,
! 7663: 'tix' => 1,
! 7664: 'tiy' => 1,
! 7665: 'tiz' => 1,
! 7666: 'tja' => 1,
! 7667: 'tjg' => 1,
! 7668: 'tji' => 1,
! 7669: 'tjm' => 1,
! 7670: 'tjn' => 1,
! 7671: 'tjo' => 1,
! 7672: 'tjs' => 1,
! 7673: 'tju' => 1,
! 7674: 'tka' => 1,
! 7675: 'tkb' => 1,
! 7676: 'tkd' => 1,
! 7677: 'tke' => 1,
! 7678: 'tkf' => 1,
! 7679: 'tkk' => 1,
! 7680: 'tkl' => 1,
! 7681: 'tkm' => 1,
! 7682: 'tkn' => 1,
! 7683: 'tkp' => 1,
! 7684: 'tkq' => 1,
! 7685: 'tkr' => 1,
! 7686: 'tks' => 1,
! 7687: 'tkt' => 1,
! 7688: 'tku' => 1,
! 7689: 'tkw' => 1,
! 7690: 'tkx' => 1,
! 7691: 'tkz' => 1,
! 7692: 'tla' => 1,
! 7693: 'tlb' => 1,
! 7694: 'tlc' => 1,
! 7695: 'tld' => 1,
! 7696: 'tlf' => 1,
! 7697: 'tlg' => 1,
! 7698: 'tlh' => 1,
! 7699: 'tli' => 1,
! 7700: 'tlj' => 1,
! 7701: 'tlk' => 1,
! 7702: 'tll' => 1,
! 7703: 'tlm' => 1,
! 7704: 'tln' => 1,
! 7705: 'tlo' => 1,
! 7706: 'tlp' => 1,
! 7707: 'tlq' => 1,
! 7708: 'tlr' => 1,
! 7709: 'tls' => 1,
! 7710: 'tlt' => 1,
! 7711: 'tlu' => 1,
! 7712: 'tlv' => 1,
! 7713: 'tlw' => 1,
! 7714: 'tlx' => 1,
! 7715: 'tly' => 1,
! 7716: 'tma' => 1,
! 7717: 'tmb' => 1,
! 7718: 'tmc' => 1,
! 7719: 'tmd' => 1,
! 7720: 'tme' => 1,
! 7721: 'tmf' => 1,
! 7722: 'tmg' => 1,
! 7723: 'tmh' => 1,
! 7724: 'tmi' => 1,
! 7725: 'tmj' => 1,
! 7726: 'tmk' => 1,
! 7727: 'tml' => 1,
! 7728: 'tmm' => 1,
! 7729: 'tmn' => 1,
! 7730: 'tmo' => 1,
! 7731: 'tmp' => 1,
! 7732: 'tmq' => 1,
! 7733: 'tmr' => 1,
! 7734: 'tms' => 1,
! 7735: 'tmt' => 1,
! 7736: 'tmu' => 1,
! 7737: 'tmv' => 1,
! 7738: 'tmy' => 1,
! 7739: 'tmz' => 1,
! 7740: 'tna' => 1,
! 7741: 'tnb' => 1,
! 7742: 'tnc' => 1,
! 7743: 'tnd' => 1,
! 7744: 'tne' => 1,
! 7745: 'tnf' => 1,
! 7746: 'tng' => 1,
! 7747: 'tnh' => 1,
! 7748: 'tni' => 1,
! 7749: 'tnk' => 1,
! 7750: 'tnl' => 1,
! 7751: 'tnm' => 1,
! 7752: 'tnn' => 1,
! 7753: 'tno' => 1,
! 7754: 'tnp' => 1,
! 7755: 'tnq' => 1,
! 7756: 'tnr' => 1,
! 7757: 'tns' => 1,
! 7758: 'tnt' => 1,
! 7759: 'tnu' => 1,
! 7760: 'tnv' => 1,
! 7761: 'tnw' => 1,
! 7762: 'tnx' => 1,
! 7763: 'tny' => 1,
! 7764: 'tnz' => 1,
! 7765: 'tob' => 1,
! 7766: 'toc' => 1,
! 7767: 'tod' => 1,
! 7768: 'toe' => 1,
! 7769: 'tof' => 1,
! 7770: 'tog' => 1,
! 7771: 'toh' => 1,
! 7772: 'toi' => 1,
! 7773: 'toj' => 1,
! 7774: 'tol' => 1,
! 7775: 'tom' => 1,
! 7776: 'too' => 1,
! 7777: 'top' => 1,
! 7778: 'toq' => 1,
! 7779: 'tor' => 1,
! 7780: 'tos' => 1,
! 7781: 'tou' => 1,
! 7782: 'tov' => 1,
! 7783: 'tow' => 1,
! 7784: 'tox' => 1,
! 7785: 'toy' => 1,
! 7786: 'toz' => 1,
! 7787: 'tpa' => 1,
! 7788: 'tpc' => 1,
! 7789: 'tpe' => 1,
! 7790: 'tpf' => 1,
! 7791: 'tpg' => 1,
! 7792: 'tpi' => 1,
! 7793: 'tpj' => 1,
! 7794: 'tpk' => 1,
! 7795: 'tpl' => 1,
! 7796: 'tpm' => 1,
! 7797: 'tpn' => 1,
! 7798: 'tpo' => 1,
! 7799: 'tpp' => 1,
! 7800: 'tpq' => 1,
! 7801: 'tpr' => 1,
! 7802: 'tpt' => 1,
! 7803: 'tpu' => 1,
! 7804: 'tpv' => 1,
! 7805: 'tpw' => 1,
! 7806: 'tpx' => 1,
! 7807: 'tpy' => 1,
! 7808: 'tpz' => 1,
! 7809: 'tqb' => 1,
! 7810: 'tql' => 1,
! 7811: 'tqm' => 1,
! 7812: 'tqn' => 1,
! 7813: 'tqo' => 1,
! 7814: 'tqp' => 1,
! 7815: 'tqq' => 1,
! 7816: 'tqr' => 1,
! 7817: 'tqt' => 1,
! 7818: 'tqu' => 1,
! 7819: 'tqw' => 1,
! 7820: 'tra' => 1,
! 7821: 'trb' => 1,
! 7822: 'trc' => 1,
! 7823: 'trd' => 1,
! 7824: 'tre' => 1,
! 7825: 'trf' => 1,
! 7826: 'trg' => 1,
! 7827: 'trh' => 1,
! 7828: 'tri' => 1,
! 7829: 'trj' => 1,
! 7830: 'trk' => 1,
! 7831: 'trl' => 1,
! 7832: 'trm' => 1,
! 7833: 'trn' => 1,
! 7834: 'tro' => 1,
! 7835: 'trp' => 1,
! 7836: 'trq' => 1,
! 7837: 'trr' => 1,
! 7838: 'trs' => 1,
! 7839: 'trt' => 1,
! 7840: 'tru' => 1,
! 7841: 'trv' => 1,
! 7842: 'trw' => 1,
! 7843: 'trx' => 1,
! 7844: 'try' => 1,
! 7845: 'trz' => 1,
! 7846: 'tsa' => 1,
! 7847: 'tsb' => 1,
! 7848: 'tsc' => 1,
! 7849: 'tsd' => 1,
! 7850: 'tse' => 1,
! 7851: 'tsf' => 1,
! 7852: 'tsg' => 1,
! 7853: 'tsh' => 1,
! 7854: 'tsi' => 1,
! 7855: 'tsj' => 1,
! 7856: 'tsk' => 1,
! 7857: 'tsl' => 1,
! 7858: 'tsm' => 1,
! 7859: 'tsp' => 1,
! 7860: 'tsq' => 1,
! 7861: 'tsr' => 1,
! 7862: 'tss' => 1,
! 7863: 'tsu' => 1,
! 7864: 'tsv' => 1,
! 7865: 'tsw' => 1,
! 7866: 'tsx' => 1,
! 7867: 'tsy' => 1,
! 7868: 'tsz' => 1,
! 7869: 'tta' => 1,
! 7870: 'ttb' => 1,
! 7871: 'ttc' => 1,
! 7872: 'ttd' => 1,
! 7873: 'tte' => 1,
! 7874: 'ttf' => 1,
! 7875: 'ttg' => 1,
! 7876: 'tth' => 1,
! 7877: 'tti' => 1,
! 7878: 'ttj' => 1,
! 7879: 'ttk' => 1,
! 7880: 'ttl' => 1,
! 7881: 'ttm' => 1,
! 7882: 'ttn' => 1,
! 7883: 'tto' => 1,
! 7884: 'ttp' => 1,
! 7885: 'ttr' => 1,
! 7886: 'tts' => 1,
! 7887: 'ttt' => 1,
! 7888: 'ttu' => 1,
! 7889: 'ttv' => 1,
! 7890: 'ttw' => 1,
! 7891: 'tty' => 1,
! 7892: 'ttz' => 1,
! 7893: 'tua' => 1,
! 7894: 'tub' => 1,
! 7895: 'tuc' => 1,
! 7896: 'tud' => 1,
! 7897: 'tue' => 1,
! 7898: 'tuf' => 1,
! 7899: 'tug' => 1,
! 7900: 'tuh' => 1,
! 7901: 'tui' => 1,
! 7902: 'tuj' => 1,
! 7903: 'tul' => 1,
! 7904: 'tum' => 1,
! 7905: 'tun' => 1,
! 7906: 'tuo' => 1,
! 7907: 'tup' => 1,
! 7908: 'tuq' => 1,
! 7909: 'tus' => 1,
! 7910: 'tut' => 1,
! 7911: 'tuu' => 1,
! 7912: 'tuv' => 1,
! 7913: 'tuw' => 1,
! 7914: 'tux' => 1,
! 7915: 'tuz' => 1,
! 7916: 'tva' => 1,
! 7917: 'tvd' => 1,
! 7918: 'tve' => 1,
! 7919: 'tvk' => 1,
! 7920: 'tvl' => 1,
! 7921: 'tvm' => 1,
! 7922: 'tvn' => 1,
! 7923: 'tvo' => 1,
! 7924: 'tvs' => 1,
! 7925: 'tvt' => 1,
! 7926: 'tvw' => 1,
! 7927: 'tvy' => 1,
! 7928: 'twa' => 1,
! 7929: 'twb' => 1,
! 7930: 'twc' => 1,
! 7931: 'twd' => 1,
! 7932: 'twe' => 1,
! 7933: 'twf' => 1,
! 7934: 'twg' => 1,
! 7935: 'twh' => 1,
! 7936: 'twl' => 1,
! 7937: 'twm' => 1,
! 7938: 'twn' => 1,
! 7939: 'two' => 1,
! 7940: 'twp' => 1,
! 7941: 'twq' => 1,
! 7942: 'twr' => 1,
! 7943: 'twt' => 1,
! 7944: 'twu' => 1,
! 7945: 'tww' => 1,
! 7946: 'twx' => 1,
! 7947: 'twy' => 1,
! 7948: 'txa' => 1,
! 7949: 'txb' => 1,
! 7950: 'txc' => 1,
! 7951: 'txe' => 1,
! 7952: 'txg' => 1,
! 7953: 'txh' => 1,
! 7954: 'txi' => 1,
! 7955: 'txm' => 1,
! 7956: 'txn' => 1,
! 7957: 'txo' => 1,
! 7958: 'txq' => 1,
! 7959: 'txr' => 1,
! 7960: 'txs' => 1,
! 7961: 'txt' => 1,
! 7962: 'txu' => 1,
! 7963: 'txx' => 1,
! 7964: 'tya' => 1,
! 7965: 'tye' => 1,
! 7966: 'tyh' => 1,
! 7967: 'tyi' => 1,
! 7968: 'tyj' => 1,
! 7969: 'tyl' => 1,
! 7970: 'tyn' => 1,
! 7971: 'typ' => 1,
! 7972: 'tyr' => 1,
! 7973: 'tys' => 1,
! 7974: 'tyt' => 1,
! 7975: 'tyu' => 1,
! 7976: 'tyv' => 1,
! 7977: 'tyx' => 1,
! 7978: 'tyz' => 1,
! 7979: 'tza' => 1,
! 7980: 'tzh' => 1,
! 7981: 'tzj' => 1,
! 7982: 'tzm' => 1,
! 7983: 'tzn' => 1,
! 7984: 'tzo' => 1,
! 7985: 'tzx' => 1,
! 7986: 'uam' => 1,
! 7987: 'uan' => 1,
! 7988: 'uar' => 1,
! 7989: 'uba' => 1,
! 7990: 'ubi' => 1,
! 7991: 'ubr' => 1,
! 7992: 'ubu' => 1,
! 7993: 'uby' => 1,
! 7994: 'uda' => 1,
! 7995: 'ude' => 1,
! 7996: 'udg' => 1,
! 7997: 'udi' => 1,
! 7998: 'udj' => 1,
! 7999: 'udl' => 1,
! 8000: 'udm' => 1,
! 8001: 'udu' => 1,
! 8002: 'ues' => 1,
! 8003: 'ufi' => 1,
! 8004: 'uga' => 1,
! 8005: 'ugb' => 1,
! 8006: 'uge' => 1,
! 8007: 'ugn' => 1,
! 8008: 'ugo' => 1,
! 8009: 'ugy' => 1,
! 8010: 'uha' => 1,
! 8011: 'uhn' => 1,
! 8012: 'uis' => 1,
! 8013: 'uiv' => 1,
! 8014: 'uji' => 1,
! 8015: 'uka' => 1,
! 8016: 'ukg' => 1,
! 8017: 'ukh' => 1,
! 8018: 'ukl' => 1,
! 8019: 'ukp' => 1,
! 8020: 'ukq' => 1,
! 8021: 'uks' => 1,
! 8022: 'uku' => 1,
! 8023: 'ukw' => 1,
! 8024: 'ula' => 1,
! 8025: 'ulb' => 1,
! 8026: 'ulc' => 1,
! 8027: 'ulf' => 1,
! 8028: 'uli' => 1,
! 8029: 'ulk' => 1,
! 8030: 'ull' => 1,
! 8031: 'ulm' => 1,
! 8032: 'uln' => 1,
! 8033: 'ulu' => 1,
! 8034: 'uma' => 1,
! 8035: 'umb' => 1,
! 8036: 'umc' => 1,
! 8037: 'umd' => 1,
! 8038: 'umg' => 1,
! 8039: 'umi' => 1,
! 8040: 'umm' => 1,
! 8041: 'umn' => 1,
! 8042: 'umo' => 1,
! 8043: 'ump' => 1,
! 8044: 'umr' => 1,
! 8045: 'ums' => 1,
! 8046: 'una' => 1,
! 8047: 'une' => 1,
! 8048: 'ung' => 1,
! 8049: 'unk' => 1,
! 8050: 'unp' => 1,
! 8051: 'unr' => 1,
! 8052: 'unx' => 1,
! 8053: 'unz' => 1,
! 8054: 'uok' => 1,
! 8055: 'upi' => 1,
! 8056: 'upv' => 1,
! 8057: 'ura' => 1,
! 8058: 'urb' => 1,
! 8059: 'urc' => 1,
! 8060: 'ure' => 1,
! 8061: 'urf' => 1,
! 8062: 'urg' => 1,
! 8063: 'urh' => 1,
! 8064: 'uri' => 1,
! 8065: 'urj' => 1,
! 8066: 'url' => 1,
! 8067: 'urm' => 1,
! 8068: 'urn' => 1,
! 8069: 'uro' => 1,
! 8070: 'urp' => 1,
! 8071: 'urr' => 1,
! 8072: 'urt' => 1,
! 8073: 'uru' => 1,
! 8074: 'urv' => 1,
! 8075: 'urw' => 1,
! 8076: 'urx' => 1,
! 8077: 'ury' => 1,
! 8078: 'urz' => 1,
! 8079: 'usa' => 1,
! 8080: 'ush' => 1,
! 8081: 'usi' => 1,
! 8082: 'usk' => 1,
! 8083: 'usp' => 1,
! 8084: 'usu' => 1,
! 8085: 'uta' => 1,
! 8086: 'ute' => 1,
! 8087: 'utp' => 1,
! 8088: 'utr' => 1,
! 8089: 'utu' => 1,
! 8090: 'uum' => 1,
! 8091: 'uun' => 1,
! 8092: 'uur' => 1,
! 8093: 'uuu' => 1,
! 8094: 'uve' => 1,
! 8095: 'uvh' => 1,
! 8096: 'uvl' => 1,
! 8097: 'uwa' => 1,
! 8098: 'uya' => 1,
! 8099: 'vaa' => 1,
! 8100: 'vae' => 1,
! 8101: 'vaf' => 1,
! 8102: 'vag' => 1,
! 8103: 'vah' => 1,
! 8104: 'vai' => 1,
! 8105: 'vaj' => 1,
! 8106: 'val' => 1,
! 8107: 'vam' => 1,
! 8108: 'van' => 1,
! 8109: 'vao' => 1,
! 8110: 'vap' => 1,
! 8111: 'var' => 1,
! 8112: 'vas' => 1,
! 8113: 'vau' => 1,
! 8114: 'vav' => 1,
! 8115: 'vay' => 1,
! 8116: 'vbb' => 1,
! 8117: 'vec' => 1,
! 8118: 'ved' => 1,
! 8119: 'vel' => 1,
! 8120: 'vem' => 1,
! 8121: 'veo' => 1,
! 8122: 'vep' => 1,
! 8123: 'ver' => 1,
! 8124: 'vgr' => 1,
! 8125: 'vgt' => 1,
! 8126: 'vic' => 1,
! 8127: 'vid' => 1,
! 8128: 'vif' => 1,
! 8129: 'vig' => 1,
! 8130: 'vil' => 1,
! 8131: 'vin' => 1,
! 8132: 'vis' => 1,
! 8133: 'vit' => 1,
! 8134: 'viv' => 1,
! 8135: 'vka' => 1,
! 8136: 'vki' => 1,
! 8137: 'vkj' => 1,
! 8138: 'vkl' => 1,
! 8139: 'vkm' => 1,
! 8140: 'vko' => 1,
! 8141: 'vkp' => 1,
! 8142: 'vku' => 1,
! 8143: 'vlp' => 1,
! 8144: 'vls' => 1,
! 8145: 'vma' => 1,
! 8146: 'vmb' => 1,
! 8147: 'vmc' => 1,
! 8148: 'vmd' => 1,
! 8149: 'vme' => 1,
! 8150: 'vmf' => 1,
! 8151: 'vmg' => 1,
! 8152: 'vmh' => 1,
! 8153: 'vmi' => 1,
! 8154: 'vmj' => 1,
! 8155: 'vmk' => 1,
! 8156: 'vml' => 1,
! 8157: 'vmm' => 1,
! 8158: 'vmp' => 1,
! 8159: 'vmq' => 1,
! 8160: 'vmr' => 1,
! 8161: 'vms' => 1,
! 8162: 'vmu' => 1,
! 8163: 'vmv' => 1,
! 8164: 'vmw' => 1,
! 8165: 'vmx' => 1,
! 8166: 'vmy' => 1,
! 8167: 'vmz' => 1,
! 8168: 'vnk' => 1,
! 8169: 'vnm' => 1,
! 8170: 'vnp' => 1,
! 8171: 'vor' => 1,
! 8172: 'vot' => 1,
! 8173: 'vra' => 1,
! 8174: 'vrs' => 1,
! 8175: 'vrt' => 1,
! 8176: 'vsi' => 1,
! 8177: 'vsl' => 1,
! 8178: 'vsv' => 1,
! 8179: 'vto' => 1,
! 8180: 'vum' => 1,
! 8181: 'vun' => 1,
! 8182: 'vut' => 1,
! 8183: 'vwa' => 1,
! 8184: 'waa' => 1,
! 8185: 'wab' => 1,
! 8186: 'wac' => 1,
! 8187: 'wad' => 1,
! 8188: 'wae' => 1,
! 8189: 'waf' => 1,
! 8190: 'wag' => 1,
! 8191: 'wah' => 1,
! 8192: 'wai' => 1,
! 8193: 'waj' => 1,
! 8194: 'wak' => 1,
! 8195: 'wal' => 1,
! 8196: 'wam' => 1,
! 8197: 'wan' => 1,
! 8198: 'wao' => 1,
! 8199: 'wap' => 1,
! 8200: 'waq' => 1,
! 8201: 'war' => 1,
! 8202: 'was' => 1,
! 8203: 'wat' => 1,
! 8204: 'wau' => 1,
! 8205: 'wav' => 1,
! 8206: 'waw' => 1,
! 8207: 'wax' => 1,
! 8208: 'way' => 1,
! 8209: 'waz' => 1,
! 8210: 'wba' => 1,
! 8211: 'wbb' => 1,
! 8212: 'wbe' => 1,
! 8213: 'wbf' => 1,
! 8214: 'wbh' => 1,
! 8215: 'wbi' => 1,
! 8216: 'wbj' => 1,
! 8217: 'wbk' => 1,
! 8218: 'wbl' => 1,
! 8219: 'wbm' => 1,
! 8220: 'wbp' => 1,
! 8221: 'wbq' => 1,
! 8222: 'wbt' => 1,
! 8223: 'wbv' => 1,
! 8224: 'wbw' => 1,
! 8225: 'wca' => 1,
! 8226: 'wci' => 1,
! 8227: 'wdd' => 1,
! 8228: 'wdg' => 1,
! 8229: 'wdj' => 1,
! 8230: 'wdu' => 1,
! 8231: 'wea' => 1,
! 8232: 'wec' => 1,
! 8233: 'wed' => 1,
! 8234: 'weh' => 1,
! 8235: 'wei' => 1,
! 8236: 'wem' => 1,
! 8237: 'wen' => 1,
! 8238: 'weo' => 1,
! 8239: 'wep' => 1,
! 8240: 'wer' => 1,
! 8241: 'wes' => 1,
! 8242: 'wet' => 1,
! 8243: 'weu' => 1,
! 8244: 'wew' => 1,
! 8245: 'wfg' => 1,
! 8246: 'wga' => 1,
! 8247: 'wgg' => 1,
! 8248: 'wgi' => 1,
! 8249: 'wgo' => 1,
! 8250: 'wgw' => 1,
! 8251: 'wgy' => 1,
! 8252: 'wha' => 1,
! 8253: 'whg' => 1,
! 8254: 'whk' => 1,
! 8255: 'whu' => 1,
! 8256: 'wib' => 1,
! 8257: 'wic' => 1,
! 8258: 'wie' => 1,
! 8259: 'wif' => 1,
! 8260: 'wig' => 1,
! 8261: 'wih' => 1,
! 8262: 'wii' => 1,
! 8263: 'wij' => 1,
! 8264: 'wik' => 1,
! 8265: 'wil' => 1,
! 8266: 'wim' => 1,
! 8267: 'win' => 1,
! 8268: 'wir' => 1,
! 8269: 'wit' => 1,
! 8270: 'wiu' => 1,
! 8271: 'wiv' => 1,
! 8272: 'wiw' => 1,
! 8273: 'wiy' => 1,
! 8274: 'wja' => 1,
! 8275: 'wji' => 1,
! 8276: 'wka' => 1,
! 8277: 'wkb' => 1,
! 8278: 'wkd' => 1,
! 8279: 'wkl' => 1,
! 8280: 'wku' => 1,
! 8281: 'wkw' => 1,
! 8282: 'wla' => 1,
! 8283: 'wlc' => 1,
! 8284: 'wle' => 1,
! 8285: 'wlg' => 1,
! 8286: 'wli' => 1,
! 8287: 'wlk' => 1,
! 8288: 'wll' => 1,
! 8289: 'wlm' => 1,
! 8290: 'wlo' => 1,
! 8291: 'wlr' => 1,
! 8292: 'wls' => 1,
! 8293: 'wlu' => 1,
! 8294: 'wlv' => 1,
! 8295: 'wlw' => 1,
! 8296: 'wlx' => 1,
! 8297: 'wly' => 1,
! 8298: 'wma' => 1,
! 8299: 'wmb' => 1,
! 8300: 'wmc' => 1,
! 8301: 'wmd' => 1,
! 8302: 'wme' => 1,
! 8303: 'wmh' => 1,
! 8304: 'wmi' => 1,
! 8305: 'wmm' => 1,
! 8306: 'wmn' => 1,
! 8307: 'wmo' => 1,
! 8308: 'wms' => 1,
! 8309: 'wmt' => 1,
! 8310: 'wmw' => 1,
! 8311: 'wmx' => 1,
! 8312: 'wnb' => 1,
! 8313: 'wnc' => 1,
! 8314: 'wnd' => 1,
! 8315: 'wne' => 1,
! 8316: 'wng' => 1,
! 8317: 'wni' => 1,
! 8318: 'wnk' => 1,
! 8319: 'wnm' => 1,
! 8320: 'wno' => 1,
! 8321: 'wnp' => 1,
! 8322: 'wnu' => 1,
! 8323: 'woa' => 1,
! 8324: 'wob' => 1,
! 8325: 'woc' => 1,
! 8326: 'wod' => 1,
! 8327: 'woe' => 1,
! 8328: 'wof' => 1,
! 8329: 'wog' => 1,
! 8330: 'woi' => 1,
! 8331: 'wok' => 1,
! 8332: 'wom' => 1,
! 8333: 'won' => 1,
! 8334: 'woo' => 1,
! 8335: 'wor' => 1,
! 8336: 'wos' => 1,
! 8337: 'wow' => 1,
! 8338: 'woy' => 1,
! 8339: 'wpc' => 1,
! 8340: 'wra' => 1,
! 8341: 'wrb' => 1,
! 8342: 'wrd' => 1,
! 8343: 'wrg' => 1,
! 8344: 'wrh' => 1,
! 8345: 'wri' => 1,
! 8346: 'wrl' => 1,
! 8347: 'wrm' => 1,
! 8348: 'wrn' => 1,
! 8349: 'wrp' => 1,
! 8350: 'wrr' => 1,
! 8351: 'wrs' => 1,
! 8352: 'wru' => 1,
! 8353: 'wrv' => 1,
! 8354: 'wrw' => 1,
! 8355: 'wrx' => 1,
! 8356: 'wrz' => 1,
! 8357: 'wsa' => 1,
! 8358: 'wsi' => 1,
! 8359: 'wsk' => 1,
! 8360: 'wsr' => 1,
! 8361: 'wss' => 1,
! 8362: 'wsu' => 1,
! 8363: 'wsv' => 1,
! 8364: 'wtf' => 1,
! 8365: 'wti' => 1,
! 8366: 'wtk' => 1,
! 8367: 'wtm' => 1,
! 8368: 'wtw' => 1,
! 8369: 'wua' => 1,
! 8370: 'wub' => 1,
! 8371: 'wud' => 1,
! 8372: 'wuh' => 1,
! 8373: 'wul' => 1,
! 8374: 'wum' => 1,
! 8375: 'wun' => 1,
! 8376: 'wur' => 1,
! 8377: 'wut' => 1,
! 8378: 'wuv' => 1,
! 8379: 'wux' => 1,
! 8380: 'wuy' => 1,
! 8381: 'wwa' => 1,
! 8382: 'wwo' => 1,
! 8383: 'wwr' => 1,
! 8384: 'www' => 1,
! 8385: 'wxa' => 1,
! 8386: 'wya' => 1,
! 8387: 'wyb' => 1,
! 8388: 'wym' => 1,
! 8389: 'wyr' => 1,
! 8390: 'wyy' => 1,
! 8391: 'xaa' => 1,
! 8392: 'xab' => 1,
! 8393: 'xac' => 1,
! 8394: 'xad' => 1,
! 8395: 'xae' => 1,
! 8396: 'xag' => 1,
! 8397: 'xai' => 1,
! 8398: 'xal' => 1,
! 8399: 'xam' => 1,
! 8400: 'xan' => 1,
! 8401: 'xao' => 1,
! 8402: 'xap' => 1,
! 8403: 'xaq' => 1,
! 8404: 'xar' => 1,
! 8405: 'xas' => 1,
! 8406: 'xat' => 1,
! 8407: 'xau' => 1,
! 8408: 'xav' => 1,
! 8409: 'xaw' => 1,
! 8410: 'xay' => 1,
! 8411: 'xba' => 1,
! 8412: 'xbc' => 1,
! 8413: 'xbi' => 1,
! 8414: 'xbm' => 1,
! 8415: 'xbo' => 1,
! 8416: 'xbr' => 1,
! 8417: 'xbw' => 1,
! 8418: 'xbx' => 1,
! 8419: 'xcb' => 1,
! 8420: 'xcc' => 1,
! 8421: 'xce' => 1,
! 8422: 'xcg' => 1,
! 8423: 'xch' => 1,
! 8424: 'xcl' => 1,
! 8425: 'xcm' => 1,
! 8426: 'xcn' => 1,
! 8427: 'xco' => 1,
! 8428: 'xcr' => 1,
! 8429: 'xct' => 1,
! 8430: 'xcu' => 1,
! 8431: 'xcv' => 1,
! 8432: 'xcw' => 1,
! 8433: 'xcy' => 1,
! 8434: 'xdc' => 1,
! 8435: 'xdm' => 1,
! 8436: 'xdy' => 1,
! 8437: 'xeb' => 1,
! 8438: 'xed' => 1,
! 8439: 'xeg' => 1,
! 8440: 'xel' => 1,
! 8441: 'xem' => 1,
! 8442: 'xep' => 1,
! 8443: 'xer' => 1,
! 8444: 'xes' => 1,
! 8445: 'xet' => 1,
! 8446: 'xeu' => 1,
! 8447: 'xfa' => 1,
! 8448: 'xga' => 1,
! 8449: 'xgf' => 1,
! 8450: 'xgl' => 1,
! 8451: 'xgn' => 1,
! 8452: 'xgr' => 1,
! 8453: 'xha' => 1,
! 8454: 'xhc' => 1,
! 8455: 'xhd' => 1,
! 8456: 'xhr' => 1,
! 8457: 'xht' => 1,
! 8458: 'xhu' => 1,
! 8459: 'xhv' => 1,
! 8460: 'xia' => 1,
! 8461: 'xib' => 1,
! 8462: 'xii' => 1,
! 8463: 'xil' => 1,
! 8464: 'xin' => 1,
! 8465: 'xip' => 1,
! 8466: 'xir' => 1,
! 8467: 'xiv' => 1,
! 8468: 'xiy' => 1,
! 8469: 'xka' => 1,
! 8470: 'xkb' => 1,
! 8471: 'xkc' => 1,
! 8472: 'xkd' => 1,
! 8473: 'xke' => 1,
! 8474: 'xkf' => 1,
! 8475: 'xkg' => 1,
! 8476: 'xkh' => 1,
! 8477: 'xki' => 1,
! 8478: 'xkj' => 1,
! 8479: 'xkk' => 1,
! 8480: 'xkl' => 1,
! 8481: 'xkn' => 1,
! 8482: 'xko' => 1,
! 8483: 'xkp' => 1,
! 8484: 'xkq' => 1,
! 8485: 'xkr' => 1,
! 8486: 'xks' => 1,
! 8487: 'xkt' => 1,
! 8488: 'xku' => 1,
! 8489: 'xkv' => 1,
! 8490: 'xkw' => 1,
! 8491: 'xkx' => 1,
! 8492: 'xky' => 1,
! 8493: 'xkz' => 1,
! 8494: 'xla' => 1,
! 8495: 'xlb' => 1,
! 8496: 'xlc' => 1,
! 8497: 'xld' => 1,
! 8498: 'xle' => 1,
! 8499: 'xlg' => 1,
! 8500: 'xli' => 1,
! 8501: 'xln' => 1,
! 8502: 'xlo' => 1,
! 8503: 'xlp' => 1,
! 8504: 'xls' => 1,
! 8505: 'xlu' => 1,
! 8506: 'xly' => 1,
! 8507: 'xma' => 1,
! 8508: 'xmb' => 1,
! 8509: 'xmc' => 1,
! 8510: 'xmd' => 1,
! 8511: 'xme' => 1,
! 8512: 'xmf' => 1,
! 8513: 'xmg' => 1,
! 8514: 'xmh' => 1,
! 8515: 'xmj' => 1,
! 8516: 'xmk' => 1,
! 8517: 'xml' => 1,
! 8518: 'xmn' => 1,
! 8519: 'xmo' => 1,
! 8520: 'xmp' => 1,
! 8521: 'xmq' => 1,
! 8522: 'xmr' => 1,
! 8523: 'xms' => 1,
! 8524: 'xmt' => 1,
! 8525: 'xmu' => 1,
! 8526: 'xmx' => 1,
! 8527: 'xmy' => 1,
! 8528: 'xmz' => 1,
! 8529: 'xna' => 1,
! 8530: 'xnb' => 1,
! 8531: 'xnd' => 1,
! 8532: 'xng' => 1,
! 8533: 'xnh' => 1,
! 8534: 'xnn' => 1,
! 8535: 'xno' => 1,
! 8536: 'xns' => 1,
! 8537: 'xoc' => 1,
! 8538: 'xod' => 1,
! 8539: 'xog' => 1,
! 8540: 'xoi' => 1,
! 8541: 'xok' => 1,
! 8542: 'xom' => 1,
! 8543: 'xon' => 1,
! 8544: 'xoo' => 1,
! 8545: 'xop' => 1,
! 8546: 'xor' => 1,
! 8547: 'xow' => 1,
! 8548: 'xpc' => 1,
! 8549: 'xpg' => 1,
! 8550: 'xpi' => 1,
! 8551: 'xpk' => 1,
! 8552: 'xpm' => 1,
! 8553: 'xpn' => 1,
! 8554: 'xpo' => 1,
! 8555: 'xpp' => 1,
! 8556: 'xpr' => 1,
! 8557: 'xps' => 1,
! 8558: 'xpu' => 1,
! 8559: 'xpy' => 1,
! 8560: 'xqa' => 1,
! 8561: 'xqt' => 1,
! 8562: 'xra' => 1,
! 8563: 'xrb' => 1,
! 8564: 'xre' => 1,
! 8565: 'xri' => 1,
! 8566: 'xrm' => 1,
! 8567: 'xrn' => 1,
! 8568: 'xrr' => 1,
! 8569: 'xrt' => 1,
! 8570: 'xru' => 1,
! 8571: 'xrw' => 1,
! 8572: 'xsa' => 1,
! 8573: 'xsb' => 1,
! 8574: 'xsc' => 1,
! 8575: 'xsd' => 1,
! 8576: 'xse' => 1,
! 8577: 'xsh' => 1,
! 8578: 'xsi' => 1,
! 8579: 'xsj' => 1,
! 8580: 'xsm' => 1,
! 8581: 'xsn' => 1,
! 8582: 'xso' => 1,
! 8583: 'xsp' => 1,
! 8584: 'xsq' => 1,
! 8585: 'xsr' => 1,
! 8586: 'xss' => 1,
! 8587: 'xsu' => 1,
! 8588: 'xsv' => 1,
! 8589: 'xsy' => 1,
! 8590: 'xta' => 1,
! 8591: 'xtb' => 1,
! 8592: 'xtc' => 1,
! 8593: 'xtd' => 1,
! 8594: 'xte' => 1,
! 8595: 'xtg' => 1,
! 8596: 'xti' => 1,
! 8597: 'xtj' => 1,
! 8598: 'xtl' => 1,
! 8599: 'xtm' => 1,
! 8600: 'xtn' => 1,
! 8601: 'xto' => 1,
! 8602: 'xtp' => 1,
! 8603: 'xtq' => 1,
! 8604: 'xtr' => 1,
! 8605: 'xts' => 1,
! 8606: 'xtt' => 1,
! 8607: 'xtu' => 1,
! 8608: 'xtw' => 1,
! 8609: 'xty' => 1,
! 8610: 'xtz' => 1,
! 8611: 'xua' => 1,
! 8612: 'xub' => 1,
! 8613: 'xug' => 1,
! 8614: 'xuj' => 1,
! 8615: 'xum' => 1,
! 8616: 'xuo' => 1,
! 8617: 'xup' => 1,
! 8618: 'xur' => 1,
! 8619: 'xut' => 1,
! 8620: 'xuu' => 1,
! 8621: 'xve' => 1,
! 8622: 'xvi' => 1,
! 8623: 'xvn' => 1,
! 8624: 'xvo' => 1,
! 8625: 'xvs' => 1,
! 8626: 'xwa' => 1,
! 8627: 'xwc' => 1,
! 8628: 'xwe' => 1,
! 8629: 'xwg' => 1,
! 8630: 'xwl' => 1,
! 8631: 'xwo' => 1,
! 8632: 'xwr' => 1,
! 8633: 'xxb' => 1,
! 8634: 'xxk' => 1,
! 8635: 'xxr' => 1,
! 8636: 'xxt' => 1,
! 8637: 'xyl' => 1,
! 8638: 'xzh' => 1,
! 8639: 'xzm' => 1,
! 8640: 'xzp' => 1,
! 8641: 'yaa' => 1,
! 8642: 'yab' => 1,
! 8643: 'yac' => 1,
! 8644: 'yad' => 1,
! 8645: 'yae' => 1,
! 8646: 'yaf' => 1,
! 8647: 'yag' => 1,
! 8648: 'yah' => 1,
! 8649: 'yai' => 1,
! 8650: 'yaj' => 1,
! 8651: 'yak' => 1,
! 8652: 'yal' => 1,
! 8653: 'yam' => 1,
! 8654: 'yao' => 1,
! 8655: 'yap' => 1,
! 8656: 'yaq' => 1,
! 8657: 'yar' => 1,
! 8658: 'yas' => 1,
! 8659: 'yat' => 1,
! 8660: 'yau' => 1,
! 8661: 'yav' => 1,
! 8662: 'yaw' => 1,
! 8663: 'yax' => 1,
! 8664: 'yay' => 1,
! 8665: 'yaz' => 1,
! 8666: 'yba' => 1,
! 8667: 'ybb' => 1,
! 8668: 'ybd' => 1,
! 8669: 'ybe' => 1,
! 8670: 'ybh' => 1,
! 8671: 'ybi' => 1,
! 8672: 'ybj' => 1,
! 8673: 'ybk' => 1,
! 8674: 'ybl' => 1,
! 8675: 'ybm' => 1,
! 8676: 'ybn' => 1,
! 8677: 'ybo' => 1,
! 8678: 'ybx' => 1,
! 8679: 'yby' => 1,
! 8680: 'ych' => 1,
! 8681: 'ycl' => 1,
! 8682: 'ycn' => 1,
! 8683: 'ycp' => 1,
! 8684: 'yde' => 1,
! 8685: 'ydg' => 1,
! 8686: 'ydk' => 1,
! 8687: 'yds' => 1,
! 8688: 'yea' => 1,
! 8689: 'yec' => 1,
! 8690: 'yee' => 1,
! 8691: 'yei' => 1,
! 8692: 'yej' => 1,
! 8693: 'yel' => 1,
! 8694: 'yen' => 1,
! 8695: 'yer' => 1,
! 8696: 'yes' => 1,
! 8697: 'yet' => 1,
! 8698: 'yeu' => 1,
! 8699: 'yev' => 1,
! 8700: 'yey' => 1,
! 8701: 'ygl' => 1,
! 8702: 'ygm' => 1,
! 8703: 'ygp' => 1,
! 8704: 'ygr' => 1,
! 8705: 'ygw' => 1,
! 8706: 'yha' => 1,
! 8707: 'yhl' => 1,
! 8708: 'yia' => 1,
! 8709: 'yif' => 1,
! 8710: 'yig' => 1,
! 8711: 'yii' => 1,
! 8712: 'yij' => 1,
! 8713: 'yik' => 1,
! 8714: 'yil' => 1,
! 8715: 'yim' => 1,
! 8716: 'yin' => 1,
! 8717: 'yip' => 1,
! 8718: 'yiq' => 1,
! 8719: 'yir' => 1,
! 8720: 'yis' => 1,
! 8721: 'yit' => 1,
! 8722: 'yiu' => 1,
! 8723: 'yiv' => 1,
! 8724: 'yix' => 1,
! 8725: 'yiy' => 1,
! 8726: 'yiz' => 1,
! 8727: 'yka' => 1,
! 8728: 'ykg' => 1,
! 8729: 'yki' => 1,
! 8730: 'ykk' => 1,
! 8731: 'ykl' => 1,
! 8732: 'ykm' => 1,
! 8733: 'yko' => 1,
! 8734: 'ykr' => 1,
! 8735: 'ykt' => 1,
! 8736: 'yky' => 1,
! 8737: 'yla' => 1,
! 8738: 'yle' => 1,
! 8739: 'ylg' => 1,
! 8740: 'yli' => 1,
! 8741: 'yll' => 1,
! 8742: 'ylm' => 1,
! 8743: 'yln' => 1,
! 8744: 'ylo' => 1,
! 8745: 'ylr' => 1,
! 8746: 'ylu' => 1,
! 8747: 'yly' => 1,
! 8748: 'yma' => 1,
! 8749: 'ymb' => 1,
! 8750: 'ymc' => 1,
! 8751: 'ymd' => 1,
! 8752: 'yme' => 1,
! 8753: 'ymg' => 1,
! 8754: 'ymh' => 1,
! 8755: 'ymi' => 1,
! 8756: 'ymk' => 1,
! 8757: 'yml' => 1,
! 8758: 'ymm' => 1,
! 8759: 'ymn' => 1,
! 8760: 'ymo' => 1,
! 8761: 'ymp' => 1,
! 8762: 'ymq' => 1,
! 8763: 'ymr' => 1,
! 8764: 'yms' => 1,
! 8765: 'ymt' => 1,
! 8766: 'ymx' => 1,
! 8767: 'ymz' => 1,
! 8768: 'yna' => 1,
! 8769: 'ynd' => 1,
! 8770: 'yne' => 1,
! 8771: 'yng' => 1,
! 8772: 'ynh' => 1,
! 8773: 'ynk' => 1,
! 8774: 'ynl' => 1,
! 8775: 'ynn' => 1,
! 8776: 'yno' => 1,
! 8777: 'yns' => 1,
! 8778: 'ynu' => 1,
! 8779: 'yob' => 1,
! 8780: 'yog' => 1,
! 8781: 'yoi' => 1,
! 8782: 'yok' => 1,
! 8783: 'yol' => 1,
! 8784: 'yom' => 1,
! 8785: 'yon' => 1,
! 8786: 'yos' => 1,
! 8787: 'yox' => 1,
! 8788: 'yoy' => 1,
! 8789: 'ypa' => 1,
! 8790: 'ypb' => 1,
! 8791: 'ypg' => 1,
! 8792: 'yph' => 1,
! 8793: 'ypk' => 1,
! 8794: 'ypm' => 1,
! 8795: 'ypn' => 1,
! 8796: 'ypo' => 1,
! 8797: 'ypp' => 1,
! 8798: 'ypz' => 1,
! 8799: 'yra' => 1,
! 8800: 'yrb' => 1,
! 8801: 'yre' => 1,
! 8802: 'yri' => 1,
! 8803: 'yrk' => 1,
! 8804: 'yrl' => 1,
! 8805: 'yrn' => 1,
! 8806: 'yrs' => 1,
! 8807: 'yrw' => 1,
! 8808: 'ysc' => 1,
! 8809: 'ysd' => 1,
! 8810: 'ysl' => 1,
! 8811: 'ysn' => 1,
! 8812: 'yso' => 1,
! 8813: 'ysp' => 1,
! 8814: 'ysr' => 1,
! 8815: 'yss' => 1,
! 8816: 'ysy' => 1,
! 8817: 'yta' => 1,
! 8818: 'ytl' => 1,
! 8819: 'ytp' => 1,
! 8820: 'yua' => 1,
! 8821: 'yub' => 1,
! 8822: 'yuc' => 1,
! 8823: 'yuf' => 1,
! 8824: 'yug' => 1,
! 8825: 'yui' => 1,
! 8826: 'yuj' => 1,
! 8827: 'yuk' => 1,
! 8828: 'yul' => 1,
! 8829: 'yum' => 1,
! 8830: 'yun' => 1,
! 8831: 'yup' => 1,
! 8832: 'yuq' => 1,
! 8833: 'yur' => 1,
! 8834: 'yut' => 1,
! 8835: 'yuu' => 1,
! 8836: 'yuw' => 1,
! 8837: 'yux' => 1,
! 8838: 'yuy' => 1,
! 8839: 'yuz' => 1,
! 8840: 'yva' => 1,
! 8841: 'yvt' => 1,
! 8842: 'ywa' => 1,
! 8843: 'ywl' => 1,
! 8844: 'ywn' => 1,
! 8845: 'ywq' => 1,
! 8846: 'ywr' => 1,
! 8847: 'ywt' => 1,
! 8848: 'ywu' => 1,
! 8849: 'yww' => 1,
! 8850: 'yyu' => 1,
! 8851: 'yyz' => 1,
! 8852: 'yzg' => 1,
! 8853: 'yzk' => 1,
! 8854: 'zag' => 1,
! 8855: 'zah' => 1,
! 8856: 'zaj' => 1,
! 8857: 'zak' => 1,
! 8858: 'zal' => 1,
! 8859: 'zap' => 1,
! 8860: 'zau' => 1,
! 8861: 'zay' => 1,
! 8862: 'zaz' => 1,
! 8863: 'zbc' => 1,
! 8864: 'zbe' => 1,
! 8865: 'zbl' => 1,
! 8866: 'zbt' => 1,
! 8867: 'zbw' => 1,
! 8868: 'zdj' => 1,
! 8869: 'zea' => 1,
! 8870: 'zeg' => 1,
! 8871: 'zen' => 1,
! 8872: 'zga' => 1,
! 8873: 'zgr' => 1,
! 8874: 'zhb' => 1,
! 8875: 'zhi' => 1,
! 8876: 'zhw' => 1,
! 8877: 'zhx' => 1,
! 8878: 'zia' => 1,
! 8879: 'zib' => 1,
! 8880: 'zik' => 1,
! 8881: 'zim' => 1,
! 8882: 'zin' => 1,
! 8883: 'zir' => 1,
! 8884: 'ziw' => 1,
! 8885: 'ziz' => 1,
! 8886: 'zka' => 1,
! 8887: 'zkb' => 1,
! 8888: 'zkg' => 1,
! 8889: 'zkh' => 1,
! 8890: 'zkk' => 1,
! 8891: 'zko' => 1,
! 8892: 'zkp' => 1,
! 8893: 'zkr' => 1,
! 8894: 'zkt' => 1,
! 8895: 'zku' => 1,
! 8896: 'zkv' => 1,
! 8897: 'zkz' => 1,
! 8898: 'zle' => 1,
! 8899: 'zls' => 1,
! 8900: 'zlw' => 1,
! 8901: 'zma' => 1,
! 8902: 'zmb' => 1,
! 8903: 'zmc' => 1,
! 8904: 'zmd' => 1,
! 8905: 'zme' => 1,
! 8906: 'zmf' => 1,
! 8907: 'zmg' => 1,
! 8908: 'zmh' => 1,
! 8909: 'zmj' => 1,
! 8910: 'zmk' => 1,
! 8911: 'zml' => 1,
! 8912: 'zmm' => 1,
! 8913: 'zmn' => 1,
! 8914: 'zmo' => 1,
! 8915: 'zmp' => 1,
! 8916: 'zmq' => 1,
! 8917: 'zmr' => 1,
! 8918: 'zms' => 1,
! 8919: 'zmt' => 1,
! 8920: 'zmu' => 1,
! 8921: 'zmv' => 1,
! 8922: 'zmw' => 1,
! 8923: 'zmx' => 1,
! 8924: 'zmy' => 1,
! 8925: 'zmz' => 1,
! 8926: 'zna' => 1,
! 8927: 'znd' => 1,
! 8928: 'zne' => 1,
! 8929: 'zng' => 1,
! 8930: 'znk' => 1,
! 8931: 'zns' => 1,
! 8932: 'zoc' => 1,
! 8933: 'zoh' => 1,
! 8934: 'zom' => 1,
! 8935: 'zoq' => 1,
! 8936: 'zor' => 1,
! 8937: 'zos' => 1,
! 8938: 'zra' => 1,
! 8939: 'zrg' => 1,
! 8940: 'zrn' => 1,
! 8941: 'zro' => 1,
! 8942: 'zrp' => 1,
! 8943: 'zrs' => 1,
! 8944: 'zsa' => 1,
! 8945: 'zsk' => 1,
! 8946: 'zsl' => 1,
! 8947: 'zsu' => 1,
! 8948: 'zua' => 1,
! 8949: 'zuh' => 1,
! 8950: 'zum' => 1,
! 8951: 'zun' => 1,
! 8952: 'zuy' => 1,
! 8953: 'zwa' => 1,
! 8954: 'zyp' => 1,
! 8955: 'zza' => 1,
! 8956: );
! 8957:
! 8958: %region_codes = (
! 8959: 'AC' => 1,
! 8960: 'AD' => 1,
! 8961: 'AE' => 1,
! 8962: 'AF' => 1,
! 8963: 'AG' => 1,
! 8964: 'AI' => 1,
! 8965: 'AL' => 1,
! 8966: 'AM' => 1,
! 8967: 'AN' => 1,
! 8968: 'AO' => 1,
! 8969: 'AQ' => 1,
! 8970: 'AR' => 1,
! 8971: 'AS' => 1,
! 8972: 'AT' => 1,
! 8973: 'AU' => 1,
! 8974: 'AW' => 1,
! 8975: 'AX' => 1,
! 8976: 'AZ' => 1,
! 8977: 'BA' => 1,
! 8978: 'BB' => 1,
! 8979: 'BD' => 1,
! 8980: 'BE' => 1,
! 8981: 'BF' => 1,
! 8982: 'BG' => 1,
! 8983: 'BH' => 1,
! 8984: 'BI' => 1,
! 8985: 'BJ' => 1,
! 8986: 'BL' => 1,
! 8987: 'BM' => 1,
! 8988: 'BN' => 1,
! 8989: 'BO' => 1,
! 8990: 'BR' => 1,
! 8991: 'BS' => 1,
! 8992: 'BT' => 1,
! 8993: 'BU' => 1,
! 8994: 'BV' => 1,
! 8995: 'BW' => 1,
! 8996: 'BY' => 1,
! 8997: 'BZ' => 1,
! 8998: 'CA' => 1,
! 8999: 'CC' => 1,
! 9000: 'CD' => 1,
! 9001: 'CF' => 1,
! 9002: 'CG' => 1,
! 9003: 'CH' => 1,
! 9004: 'CI' => 1,
! 9005: 'CK' => 1,
! 9006: 'CL' => 1,
! 9007: 'CM' => 1,
! 9008: 'CN' => 1,
! 9009: 'CO' => 1,
! 9010: 'CP' => 1,
! 9011: 'CR' => 1,
! 9012: 'CS' => 1,
! 9013: 'CU' => 1,
! 9014: 'CV' => 1,
! 9015: 'CX' => 1,
! 9016: 'CY' => 1,
! 9017: 'CZ' => 1,
! 9018: 'DD' => 1,
! 9019: 'DE' => 1,
! 9020: 'DG' => 1,
! 9021: 'DJ' => 1,
! 9022: 'DK' => 1,
! 9023: 'DM' => 1,
! 9024: 'DO' => 1,
! 9025: 'DZ' => 1,
! 9026: 'EA' => 1,
! 9027: 'EC' => 1,
! 9028: 'EE' => 1,
! 9029: 'EG' => 1,
! 9030: 'EH' => 1,
! 9031: 'ER' => 1,
! 9032: 'ES' => 1,
! 9033: 'ET' => 1,
! 9034: 'EU' => 1,
! 9035: 'FI' => 1,
! 9036: 'FJ' => 1,
! 9037: 'FK' => 1,
! 9038: 'FM' => 1,
! 9039: 'FO' => 1,
! 9040: 'FR' => 1,
! 9041: 'FX' => 1,
! 9042: 'GA' => 1,
! 9043: 'GB' => 1,
! 9044: 'GD' => 1,
! 9045: 'GE' => 1,
! 9046: 'GF' => 1,
! 9047: 'GG' => 1,
! 9048: 'GH' => 1,
! 9049: 'GI' => 1,
! 9050: 'GL' => 1,
! 9051: 'GM' => 1,
! 9052: 'GN' => 1,
! 9053: 'GP' => 1,
! 9054: 'GQ' => 1,
! 9055: 'GR' => 1,
! 9056: 'GS' => 1,
! 9057: 'GT' => 1,
! 9058: 'GU' => 1,
! 9059: 'GW' => 1,
! 9060: 'GY' => 1,
! 9061: 'HK' => 1,
! 9062: 'HM' => 1,
! 9063: 'HN' => 1,
! 9064: 'HR' => 1,
! 9065: 'HT' => 1,
! 9066: 'HU' => 1,
! 9067: 'IC' => 1,
! 9068: 'ID' => 1,
! 9069: 'IE' => 1,
! 9070: 'IL' => 1,
! 9071: 'IM' => 1,
! 9072: 'IN' => 1,
! 9073: 'IO' => 1,
! 9074: 'IQ' => 1,
! 9075: 'IR' => 1,
! 9076: 'IS' => 1,
! 9077: 'IT' => 1,
! 9078: 'JE' => 1,
! 9079: 'JM' => 1,
! 9080: 'JO' => 1,
! 9081: 'JP' => 1,
! 9082: 'KE' => 1,
! 9083: 'KG' => 1,
! 9084: 'KH' => 1,
! 9085: 'KI' => 1,
! 9086: 'KM' => 1,
! 9087: 'KN' => 1,
! 9088: 'KP' => 1,
! 9089: 'KR' => 1,
! 9090: 'KW' => 1,
! 9091: 'KY' => 1,
! 9092: 'KZ' => 1,
! 9093: 'LA' => 1,
! 9094: 'LB' => 1,
! 9095: 'LC' => 1,
! 9096: 'LI' => 1,
! 9097: 'LK' => 1,
! 9098: 'LR' => 1,
! 9099: 'LS' => 1,
! 9100: 'LT' => 1,
! 9101: 'LU' => 1,
! 9102: 'LV' => 1,
! 9103: 'LY' => 1,
! 9104: 'MA' => 1,
! 9105: 'MC' => 1,
! 9106: 'MD' => 1,
! 9107: 'ME' => 1,
! 9108: 'MF' => 1,
! 9109: 'MG' => 1,
! 9110: 'MH' => 1,
! 9111: 'MK' => 1,
! 9112: 'ML' => 1,
! 9113: 'MM' => 1,
! 9114: 'MN' => 1,
! 9115: 'MO' => 1,
! 9116: 'MP' => 1,
! 9117: 'MQ' => 1,
! 9118: 'MR' => 1,
! 9119: 'MS' => 1,
! 9120: 'MT' => 1,
! 9121: 'MU' => 1,
! 9122: 'MV' => 1,
! 9123: 'MW' => 1,
! 9124: 'MX' => 1,
! 9125: 'MY' => 1,
! 9126: 'MZ' => 1,
! 9127: 'NA' => 1,
! 9128: 'NC' => 1,
! 9129: 'NE' => 1,
! 9130: 'NF' => 1,
! 9131: 'NG' => 1,
! 9132: 'NI' => 1,
! 9133: 'NL' => 1,
! 9134: 'NO' => 1,
! 9135: 'NP' => 1,
! 9136: 'NR' => 1,
! 9137: 'NT' => 1,
! 9138: 'NU' => 1,
! 9139: 'NZ' => 1,
! 9140: 'OM' => 1,
! 9141: 'PA' => 1,
! 9142: 'PE' => 1,
! 9143: 'PF' => 1,
! 9144: 'PG' => 1,
! 9145: 'PH' => 1,
! 9146: 'PK' => 1,
! 9147: 'PL' => 1,
! 9148: 'PM' => 1,
! 9149: 'PN' => 1,
! 9150: 'PR' => 1,
! 9151: 'PS' => 1,
! 9152: 'PT' => 1,
! 9153: 'PW' => 1,
! 9154: 'PY' => 1,
! 9155: 'QA' => 1,
! 9156: 'RE' => 1,
! 9157: 'RO' => 1,
! 9158: 'RS' => 1,
! 9159: 'RU' => 1,
! 9160: 'RW' => 1,
! 9161: 'SA' => 1,
! 9162: 'SB' => 1,
! 9163: 'SC' => 1,
! 9164: 'SD' => 1,
! 9165: 'SE' => 1,
! 9166: 'SG' => 1,
! 9167: 'SH' => 1,
! 9168: 'SI' => 1,
! 9169: 'SJ' => 1,
! 9170: 'SK' => 1,
! 9171: 'SL' => 1,
! 9172: 'SM' => 1,
! 9173: 'SN' => 1,
! 9174: 'SO' => 1,
! 9175: 'SR' => 1,
! 9176: 'ST' => 1,
! 9177: 'SU' => 1,
! 9178: 'SV' => 1,
! 9179: 'SY' => 1,
! 9180: 'SZ' => 1,
! 9181: 'TA' => 1,
! 9182: 'TC' => 1,
! 9183: 'TD' => 1,
! 9184: 'TF' => 1,
! 9185: 'TG' => 1,
! 9186: 'TH' => 1,
! 9187: 'TJ' => 1,
! 9188: 'TK' => 1,
! 9189: 'TL' => 1,
! 9190: 'TM' => 1,
! 9191: 'TN' => 1,
! 9192: 'TO' => 1,
! 9193: 'TP' => 1,
! 9194: 'TR' => 1,
! 9195: 'TT' => 1,
! 9196: 'TV' => 1,
! 9197: 'TW' => 1,
! 9198: 'TZ' => 1,
! 9199: 'UA' => 1,
! 9200: 'UG' => 1,
! 9201: 'UM' => 1,
! 9202: 'US' => 1,
! 9203: 'UY' => 1,
! 9204: 'UZ' => 1,
! 9205: 'VA' => 1,
! 9206: 'VC' => 1,
! 9207: 'VE' => 1,
! 9208: 'VG' => 1,
! 9209: 'VI' => 1,
! 9210: 'VN' => 1,
! 9211: 'VU' => 1,
! 9212: 'WF' => 1,
! 9213: 'WS' => 1,
! 9214: 'YD' => 1,
! 9215: 'YE' => 1,
! 9216: 'YT' => 1,
! 9217: 'YU' => 1,
! 9218: 'ZA' => 1,
! 9219: 'ZM' => 1,
! 9220: 'ZR' => 1,
! 9221: 'ZW' => 1,
! 9222: );
! 9223:
! 9224:
! 9225: require "$T2H_HOME/documentlanguages.pl"
! 9226: if ($0 =~ /\.pl$/ &&
! 9227: -e "$T2H_HOME/documentlanguages.pl" && -r "$T2H_HOME/documentlanguages.pl");
! 9228:
! 9229: # leave this within comments, and keep the require statement
! 9230: # This way, you can directly run texi2html.pl, if
! 9231: # $T2H_HOME/texi2html.init exists.
! 9232:
! 9233: # @INIT@
! 9234: # -*-perl-*-
! 9235: # vim: set filetype=perl:
! 9236: ######################################################################
! 9237: # File: texi2html.init
! 9238: #
! 9239: # Default values for command-line arguments and for various customizable
! 9240: # procedures are set in this file.
! 9241: #
! 9242: # A copy of this file is pasted into the beginning of texi2html by
! 9243: # running './configure'.
! 9244: #
! 9245: # Copy this file, rename it and make changes to it, if you like.
! 9246: # Afterwards, load the file with command-line
! 9247: # option --init-file <your_init_file>
! 9248: #
! 9249: # $Id: texi2html.init,v 1.272 2010/06/26 09:54:22 pertusus Exp $
! 9250:
! 9251: ######################################################################
! 9252: # The following variables can also be set by command-line options
! 9253: #
! 9254: #
! 9255: # The default values are set in this file, texi2html.init and the content
! 9256: # of this file is included at the beginning of the texi2html script file.
! 9257: # Those values may be overrided by values set in $sysconfdir/texi2html/Config
! 9258: # and then by values set in $HOME/texi2html/Config.
! 9259: #
! 9260: # command line switches may override these values, and values set in files
! 9261: # specified by --init-file are also taken into account.
! 9262: # values set in these files overwrite values set by the command-line
! 9263: # options appearing before --init-file and might still be overwritten by
! 9264: # command-line arguments following the --init-file option.
! 9265:
! 9266: ##################################################################
! 9267: # options common with makeinfo
! 9268: # -I
! 9269: # add a directory to the list of directories where @include files are
! 9270: # searched for (besides the directory of the file). additional '-I'
! 9271: # args are appended to this list.
! 9272: # (APA: Don't implicitely search ., to conform with the docs!)
! 9273: # my @INCLUDE_DIRS = (".");
! 9274:
! 9275: #use strict;
! 9276:
! 9277: @INCLUDE_DIRS = ();
! 9278:
! 9279: # -P
! 9280: # prepend a directory to the list of directories where @include files are
! 9281: # searched for before the directory of the file. additional '-P'
! 9282: # args are prepended to this list.
! 9283: @PREPEND_DIRS = ();
! 9284:
! 9285: # --split section|chapter|node|none
! 9286: # if $SPLIT is set to 'section' (resp. 'chapter') one html file per section
! 9287: # (resp. chapter) is generated. If $SPLIT is set to 'node' one html file per
! 9288: # node or sectioning element is generated. In all these cases separate pages
! 9289: # for Top, Table of content (Toc), Overview and About are generated.
! 9290: # Otherwise a monolithic html file that contains the whole document is
! 9291: # created.
! 9292: #$SPLIT = 'section';
! 9293: $SPLIT = '';
! 9294:
! 9295: # --separated-footnotes
! 9296: # if this is set footnotes are on a separated page. Otherwise they are at
! 9297: # the end of each file (if the document is split).
! 9298: $FOOTNOTESTYLE = 'end';
! 9299:
! 9300: # --fill-column
! 9301: $FILLCOLUMN = 72;
! 9302:
! 9303: # --number | --no-number
! 9304: # if this is set the sections are numbered, and section names and numbers
! 9305: # are used in references and menus (instead of node names).
! 9306: $NUMBER_SECTIONS = 1;
! 9307:
! 9308: # --headers
! 9309: # if this is set then navigation panels are printed at the beginning of each
! 9310: # section.
! 9311: # If the document is split at nodes then navigation panels are
! 9312: # printed at the end if there were more than $WORDS_IN_PAGE words on page.
! 9313: #
! 9314: # Navigation panels are always printed at the beginning of output files.
! 9315: #
! 9316: # This is most useful if you do not want to have section navigation
! 9317: # with --split chapter. There will be chapter navigation panel at the
! 9318: # beginning and at the end of chapters anyway.
! 9319: # this is mostly not used in the default case, important for html.
! 9320: $HEADERS = 0;
! 9321:
! 9322: # -o filename
! 9323: # If this is set a monolithic document is outputted into $filename.
! 9324: $OUT = undef;
! 9325:
! 9326: # --split-size
! 9327: # if undef, the info output is not split
! 9328: $SPLIT_SIZE = 300000;
! 9329:
! 9330: # --internal-links
! 9331: $INTERNAL_LINKS = undef;
! 9332:
! 9333: # --no-validate
! 9334: # suppress node cross-reference validation
! 9335: $NOVALIDATE = 0;
! 9336:
! 9337: # --documentlanguage
! 9338: # use gdt('my string') if you want to have translations of 'my string'
! 9339: # and provide the translations in $LANGUAGES->{$DOCUMENTLANGUAGE} with
! 9340: # 'my string' as key.
! 9341: # To add a new language use ISO 639 language codes (see e.g. perl module
! 9342: # Locale-Codes-1.02 for definitions). Supply translations in the
! 9343: # $LANGUAGES hash and put it in a file with $LANG as name in an i18n
! 9344: # directory.
! 9345: # This is used for the initial language, it is overriden during
! 9346: # document processing if there is a @documentlanguage.
! 9347: # It is ignored if the language is passed on the command line.
! 9348: $DOCUMENTLANGUAGE = 'en';
! 9349:
! 9350: # --transliterate-file-names
! 9351: # transliterate node names for external refs (and internal if NODE_FILES)
! 9352: $TRANSLITERATE_FILE_NAMES = 1;
! 9353:
! 9354: # --error-limit
! 9355: # quit after NUM errors (default 1000).
! 9356: $ERROR_LIMIT = 1000;
! 9357:
! 9358: # --css-include
! 9359: # All the specified css files are used. More precisely the @import sections
! 9360: # are added to the beginning of the CSS_LINES the remaining is added at
! 9361: # the end of the CSS_LINES (after the css rules generated by the program).
! 9362: # cf texinfo manual for more info.
! 9363: # - means STDIN
! 9364: @CSS_FILES = ();
! 9365:
! 9366: # --css-ref
! 9367: # the specified url are used as stylesheet links
! 9368: @CSS_REFS = ();
! 9369:
! 9370: # --paragraph-indent
! 9371: $PARAGRAPHINDENT = 3;
! 9372:
! 9373: # --enable-encoding
! 9374: $ENABLE_ENCODING = 0;
! 9375:
! 9376: # --force
! 9377: $FORCE = 0;
! 9378:
! 9379: # --no-warn
! 9380: $NO_WARN = 0;
! 9381:
! 9382: # --number-footnotes
! 9383: $NUMBER_FOOTNOTES = 1;
! 9384:
! 9385: # not in makeinfo but in texi2dvi
! 9386: # --command
! 9387: @COMMANDS = ();
! 9388:
! 9389: ##################################################################
! 9390: # option specific of texi2html
! 9391: # --debug
! 9392: # The integer value specifies what kind of debugging output is generated.
! 9393: $DEBUG = 0;
! 9394:
! 9395: # --doctype
! 9396: # The value is the 'SystemLiteral' which identifies the canonical DTD
! 9397: # for the document.
! 9398: # Definition: The SystemLiteral is called the entity's system
! 9399: # identifier. It is a URI, which may be used to retrieve the entity.
! 9400: # See http://www.xml.com/axml/target.html#NT-ExternalID
! 9401: $DOCTYPE = '';
! 9402:
! 9403: # --frameset-doctype
! 9404: # When frames are used, this SystemLiteral identifies the DTD used for
! 9405: # the file containing the frame description.
! 9406: $FRAMESET_DOCTYPE = '';
! 9407:
! 9408: # --test
! 9409: # If this value is true, some variables which should be dynamically generated
! 9410: # (the date, the user running texi2html, the version of texi2html) are set to
! 9411: # fix and given values. This is usefull in case the resulting manual is
! 9412: # compared with a reference. For example this is used in the tests.
! 9413: $TEST = 0;
! 9414:
! 9415: # --dump-texi
! 9416: # This value is usefull for debugging purposes. The result of the first pass is
! 9417: # put in <document name>.passtexi, the result of the second pass is put in
! 9418: # <document name>.passfirst.
! 9419: $DUMP_TEXI = 0;
! 9420:
! 9421: # --expand
! 9422: # the @EXPAND array contains the expanded section names.
! 9423: @EXPAND = ();
! 9424:
! 9425: # --invisible
! 9426: # This seems obsolete and is not used anywhere.
! 9427: # This was a workaround for a known bug of many WWW browsers, including
! 9428: # netscape. This was used to create invisible destination in anchors.
! 9429: $INVISIBLE_MARK = '';
! 9430: # $INVISIBLE_MARK = ' ';
! 9431:
! 9432: # --iso
! 9433: # if this value is true, ISO8859 characters are used for quotes.
! 9434: # --iso does more than what USE_ISO does.
! 9435: $USE_ISO = 0;
! 9436:
! 9437: # --conf-dir
! 9438: # append to the files searched for init files.
! 9439: @CONF_DIRS = ();
! 9440:
! 9441: # --top-file
! 9442: # This file name is used for the top-level file.
! 9443: # The extension is set appropriately, if necessary.
! 9444: # If empty, <basename of document>.html is used.
! 9445: # Typically, you would set this to "index.html".
! 9446: $TOP_FILE = '';
! 9447:
! 9448: # --toc-file
! 9449: # This file name is used for the table of contents. The
! 9450: # extension is set appropriately, if necessary.
! 9451: # If empty, <basename of document>_toc.html is used.
! 9452: $TOC_FILE = '';
! 9453:
! 9454: # --frames
! 9455: # if the value is true, HTML 4.0 "frames" are used.
! 9456: # A file describing the frame layout is generated, together with a file
! 9457: # with the short table of contents.
! 9458: $FRAMES = 0;
! 9459:
! 9460: # --menu | --no-menu
! 9461: # if the value is true the Texinfo menus are shown.
! 9462: # this is defined in all the formats
! 9463: $SHOW_MENU = 1;
! 9464:
! 9465: # --use-nodes
! 9466: # if this is set the nodes are used as sectioning elements.
! 9467: # Otherwise the nodes are incorporated in sections.
! 9468: $USE_NODES = 1;
! 9469:
! 9470: # --node-files
! 9471: # if this is set one file per node is generated, which can be a target for
! 9472: # cross manual references.
! 9473: $NODE_FILES = 0;
! 9474:
! 9475: # --toc-links
! 9476: # if this is set, links from headings to toc entries are created.
! 9477: $TOC_LINKS = 0;
! 9478:
! 9479: # --subdir
! 9480: # If this is set, then put result files into the specified directory.
! 9481: # If not set, then result files are put into the current directory.
! 9482: #$SUBDIR = 'html';
! 9483: $SUBDIR = '';
! 9484:
! 9485: # --short-extn
! 9486: # If this is set, then all HTML files will have extension ".htm" instead of
! 9487: # ".html". This is helpful when shipping the document to DOS-based systems.
! 9488: $SHORTEXTN = 0;
! 9489:
! 9490: # --prefix
! 9491: # This set the output file prefix, prepended to all .html, .gif and .pl files.
! 9492: # By default, this is the basename of the document.
! 9493: $PREFIX = '';
! 9494:
! 9495: # --short-ref
! 9496: # if this is set cross-references are given without section.
! 9497: $SHORT_REF = 1;
! 9498:
! 9499: # --idx-sum
! 9500: # if value is set, then for each @printindex <index name>
! 9501: # <document name>_<index name>.idx is created which contains lines of the form
! 9502: # key ref sorted alphabetically (case matters).
! 9503: $IDX_SUMMARY = 0;
! 9504:
! 9505: # --def-table
! 9506: # If this is set a table construction for @def.... instead of definition
! 9507: # lists.
! 9508: # (New Option: 27.07.2000 Karl Heinz Marbaise)
! 9509: $DEF_TABLE = 0;
! 9510:
! 9511: # --verbose
! 9512: # if this is set chatter about what we are doing.
! 9513: $VERBOSE = '';
! 9514:
! 9515: # --ignore-preamble-text
! 9516: # If this is set the text before @node and sectioning commands is ignored.
! 9517: $IGNORE_PREAMBLE_TEXT = 0;
! 9518:
! 9519: # --html-xref-prefix
! 9520: # base directory for external manuals.
! 9521: #$EXTERNAL_DIR = '../';
! 9522: $EXTERNAL_DIR = undef;
! 9523:
! 9524: # --l2h
! 9525: # if this is set, latex2html is used for generation of math content.
! 9526: $L2H = '';
! 9527:
! 9528: # --monolithic
! 9529: # output only one file including ToC. It only makes sense when not split
! 9530: $MONOLITHIC = 1;
! 9531:
! 9532: ######################
! 9533: # The following options are only relevant if $L2H is set
! 9534: #
! 9535: # --l2h-l2h
! 9536: # name/location of latex2html program
! 9537: $L2H_L2H = "latex2html";
! 9538:
! 9539: # --l2h-skip
! 9540: # If this is set the actual call to latex2html is skipped. The previously
! 9541: # generated content is reused, instead.
! 9542: # If set to 0, the cache is not used.
! 9543: # If undef the cache is used for as many tex fragments as possible
! 9544: # and for the remaining the command is run.
! 9545: $L2H_SKIP = undef;
! 9546:
! 9547: # --l2h-tmp
! 9548: # If this is set l2h uses the specified directory for temporary files. The path
! 9549: # leading to this directory may not contain a dot (i.e., a ".");
! 9550: # otherwise, l2h will fail.
! 9551: $L2H_TMP = '';
! 9552:
! 9553: # --l2h-file
! 9554: # If set, l2h uses the file as latex2html init file
! 9555: $L2H_FILE = 'l2h.init';
! 9556:
! 9557: # --l2h-clean
! 9558: # if this is set the intermediate files generated by texi2html in relation with
! 9559: # latex2html are cleaned (they all have the prefix <document name>_l2h_).
! 9560: $L2H_CLEAN = 1;
! 9561:
! 9562: ##############################################################################
! 9563: #
! 9564: # The following can only be set in the init file
! 9565: #
! 9566: ##############################################################################
! 9567:
! 9568: @INPUT_FILE_SUFFIXES = ('.txi','.texinfo','.texi','.txinfo','');
! 9569:
! 9570: $FIRSTPARAGRAPHINDENT = 'none';
! 9571:
! 9572: @T2H_FORMAT_EXPAND = ('plaintext');
! 9573:
! 9574: # simple headers formatting, not in a table and using node names.
! 9575: $HEADER_IN_TABLE = 0;
! 9576:
! 9577: # output the generation date in the header.
! 9578: $DATE_IN_HEADER = 0;
! 9579:
! 9580: # use table for indentation of complex formats
! 9581: $COMPLEX_FORMAT_IN_TABLE = 0;
! 9582:
! 9583: # if set, node names are used to construct file names
! 9584: # if undef, it is set if split at node, or $NODE_FILES is set.
! 9585: $NODE_FILENAMES = undef;
! 9586:
! 9587: # If true do table of contents even if there is no @content
! 9588: $CONTENTS = undef;
! 9589:
! 9590: # If true do short table of contents even if there is no @shortcontent
! 9591: $SHORTCONTENTS = undef;
! 9592:
! 9593: # set by @setcontentsaftertitlepage/@setshortcontentsaftertitlepage
! 9594: $SETCONTENTSAFTERTITLEPAGE = undef;
! 9595: $SETSHORTCONTENTSAFTERTITLEPAGE = undef;
! 9596:
! 9597: # corresponds with @kbdinputstyle
! 9598: $KBDINPUTSTYLE = 'distinct';
! 9599:
! 9600: # corresponds with @frenchspacing
! 9601: $FRENCHSPACING = 'off';
! 9602:
! 9603: # correspond with @allowcodebreaks
! 9604: $ALLOWCODEBREAKS = 'true';
! 9605:
! 9606: # corresponds with @setfilename. Set with caution.
! 9607: $SETFILENAME = undef;
! 9608:
! 9609: # if unset, don't show a title
! 9610: $SHOW_TITLE = 1;
! 9611:
! 9612: # if set style is added in attribute.
! 9613: $INLINE_CSS_STYLE = 0;
! 9614:
! 9615: # if set, no css is used.
! 9616: $NO_CSS = 0;
! 9617:
! 9618: # if set, the image files are completed to be relative from the
! 9619: # document directory, to the source manual directory and then to
! 9620: # the image
! 9621: $COMPLETE_IMAGE_PATHS = 0;
! 9622:
! 9623: # if true, begin outputting at @setfilename, if this command is present.
! 9624: $IGNORE_BEFORE_SETFILENAME = 1;
! 9625:
! 9626: # if true the link in Overview link to the corresponding Toc entry.
! 9627: $OVERVIEW_LINK_TO_TOC = 1;
! 9628:
! 9629: # if set, use node anchors for sections targets
! 9630: $USE_NODE_TARGET = 1;
! 9631:
! 9632: # new style for crossrefs
! 9633: $NEW_CROSSREF_STYLE = 1;
! 9634:
! 9635: # top heading is always at the beginning of the element.
! 9636: $TOP_HEADING_AT_BEGINNING = 0;
! 9637:
! 9638: # use titlepage for the title instead of a simplest title
! 9639: $USE_TITLEPAGE_FOR_TITLE = 0;
! 9640:
! 9641: # if set, center @image by default
! 9642: # otherwise, do not center by default
! 9643: # Deprecated and not used anymore
! 9644: $CENTER_IMAGE = 1;
! 9645:
! 9646: # used as identation for block enclosing command @example, etc
! 9647: # If not empty, must be enclosed in <td></td>
! 9648: $EXAMPLE_INDENT_CELL = '';
! 9649:
! 9650: # same as above, only for @small
! 9651: $SMALL_EXAMPLE_INDENT_CELL = '';
! 9652:
! 9653: # unused
! 9654: $SMALL_FONT_SIZE = '-1';
! 9655:
! 9656: # horizontal rules
! 9657: # not used
! 9658: $SMALL_RULE = '';
! 9659: $MIDDLE_RULE = '';
! 9660: # used in html
! 9661: $DEFAULT_RULE = '';
! 9662: $BIG_RULE = '';
! 9663:
! 9664: # output the program name in the footer
! 9665: $PROGRAM_NAME_IN_FOOTER = 0;
! 9666:
! 9667: # if non-empty, and no @..heading appeared in Top node, then
! 9668: # use this as header for top node/section, otherwise use value of
! 9669: # @settitle or @shorttitle (in that order)
! 9670: $TOP_HEADING = '';
! 9671:
! 9672: # if set, use this chapter for 'Index' button, else
! 9673: # use first chapter with @printindex
! 9674: $INDEX_CHAPTER = '';
! 9675:
! 9676: $SIMPLE_MENU = 1;
! 9677:
! 9678: $OPEN_QUOTE_SYMBOL = "\`";
! 9679: $CLOSE_QUOTE_SYMBOL = "'";
! 9680:
! 9681: $NO_NUMBER_FOOTNOTE_SYMBOL = '*';
! 9682:
! 9683: # if true put a $MENU_SYMBOL before unnumbered in menus
! 9684: $UNNUMBERED_SYMBOL_IN_MENU = 0;
! 9685:
! 9686: # extension for nodes files when NODE_FILES is true
! 9687: $NODE_FILE_EXTENSION = 'txt';
! 9688:
! 9689: # extension
! 9690: $EXTENSION = 'txt';
! 9691:
! 9692: # file name used for Top node when NODE_FILES is true
! 9693: #$TOP_NODE_FILE = 'index';
! 9694: $TOP_NODE_FILE = undef;
! 9695:
! 9696: # file name used for Top node in references
! 9697: $TOP_NODE_FILE_TARGET = 'index';
! 9698:
! 9699: # file used as document basename, when input file is -
! 9700: $STDIN_DOCU_NAME = 'stdin';
! 9701:
! 9702: # file used as document output basename, when output file is -
! 9703: $STDOUT_DOCU_NAME = 'stdout';
! 9704:
! 9705: # node name used for Top node when automatic node directions are used
! 9706: $TOP_NODE_UP = '(dir)';
! 9707:
! 9708: # this controls the pre style for menus
! 9709: $MENU_PRE_STYLE = 'font-family: serif';
! 9710:
! 9711: # on bug-texinfo is has been said the the style is not code_style
! 9712: # for menus (except for the node name).
! 9713: # this controls the menu preformatted format
! 9714: # FIXME this is not dynamic, so change in MENU_PRE_STYLE is not taken
! 9715: # into account.
! 9716: # This is used if the menu appears within a preformatted format (which
! 9717: # is certainly an invalid construct), and SIMPLE_MENU is not set.
! 9718: $MENU_PRE_COMPLEX_FORMAT = {
! 9719: 'class' => 'menu-preformatted',
! 9720: # 'style' => 'code'
! 9721: };
! 9722:
! 9723: # This controls the ul style for toc
! 9724: $NO_BULLET_LIST_STYLE = '';
! 9725: $NO_BULLET_LIST_ATTRIBUTE = '';
! 9726:
! 9727: # These lines are inserted before and after the shortcontents
! 9728: $BEFORE_OVERVIEW = "";
! 9729: $AFTER_OVERVIEW = "";
! 9730:
! 9731: # These lines are inserted before and after the contents
! 9732: $BEFORE_TOC_LINES = "";
! 9733: $AFTER_TOC_LINES = "";
! 9734:
! 9735: # if set (e.g., to index.html) replace hrefs to this file
! 9736: # (i.e., to index.html) by ./
! 9737: # Obsolete. Worked around a bug that is fixed now.
! 9738: $HREF_DIR_INSTEAD_FILE = '';
! 9739:
! 9740: # text inserted after <body ...>
! 9741: $AFTER_BODY_OPEN = '';
! 9742:
! 9743: # text inserted before </body>, this will be automatically inside <p></p>
! 9744: $PRE_BODY_CLOSE = '';
! 9745:
! 9746: # this is added inside <head></head> after <title> and some <meta name>
! 9747: # stuff, it can be used for eg. <style>, <script>, <meta> etc. tags.
! 9748: $EXTRA_HEAD = '';
! 9749:
! 9750: # Specifies the minimum page length required before a navigation panel
! 9751: # is placed at the bottom of a page
! 9752: # FIXME this is not true:
! 9753: # THIS_WORDS_IN_PAGE holds number of words of current page
! 9754: $WORDS_IN_PAGE = 300;
! 9755:
! 9756: # if this is set a vertical navigation panel is used.
! 9757: $VERTICAL_HEAD_NAVIGATION = 0;
! 9758:
! 9759: # html version for latex2html
! 9760: $L2H_HTML_VERSION = "4.0";
! 9761:
! 9762: # use icons.
! 9763: $ICONS = 0;
! 9764:
! 9765: # use old framework for translations
! 9766: $I18N_PERL_HASH = 0;
! 9767:
! 9768:
! 9769: # this resets some defaults, those that are also set in formats and
! 9770: # not set in every formats.
! 9771: #
! 9772: # this is called below after %default_style_map_texi is defined
! 9773: sub t2h_default_set_variables_default()
! 9774: {
! 9775: $CAPTION_STYLE = 'strong';
! 9776:
! 9777: # if this variable is true, @setfilename is used if found to determine the
! 9778: # out file name
! 9779: $USE_SETFILENAME = 1;
! 9780:
! 9781: # if true, use the filename and extension from setfilename. For Info.
! 9782: $USE_SETFILENAME_EXTENSION = 0;
! 9783:
! 9784: # FIXME is this right?
! 9785: # default used in init_out for the setting of the ENCODING_NAME variable
! 9786: $DEFAULT_ENCODING = 'utf8';
! 9787:
! 9788: # if set and menu entry equals menu description, then do not print
! 9789: # menu description.
! 9790: # Likewise, if node name equals entry name, do not print entry name.
! 9791: $AVOID_MENU_REDUNDANCY = 0;
! 9792:
! 9793: # if true, use the original command if the result is an entity
! 9794: $ENABLE_ENCODING_USE_ENTITY = 0;
! 9795:
! 9796: # if set, output the contents where the command is located
! 9797: # This is ignored if set*contentsaftertitlepage is set
! 9798: $INLINE_CONTENTS = 1;
! 9799:
! 9800: # symbol put at the beginning of nodes entry in menu (and optionnaly of
! 9801: # unnumbered in menus, see UNNUMBERED_SYMBOL_IN_MENU variable)
! 9802: $MENU_SYMBOL = '*';
! 9803:
! 9804: # symbol put at the end of nodes entry in menu
! 9805: $MENU_ENTRY_COLON = ':';
! 9806:
! 9807: # symbol put at the end of index entries
! 9808: $INDEX_ENTRY_COLON = ':';
! 9809:
! 9810: # if set, then use node names in menu entries, instead of section names
! 9811: $NODE_NAME_IN_MENU = 1;
! 9812:
! 9813: # if set use the node names in index entry, instead of section names
! 9814: # if not set, it is set to the same value than NODE_NAME_IN_MENU
! 9815: $NODE_NAME_IN_INDEX = undef;
! 9816:
! 9817: # if set always separate description and menu link, even in
! 9818: # preformatted environment
! 9819: $SEPARATE_DESCRIPTION = 0;
! 9820:
! 9821: # try up sections to complete the node directions
! 9822: $USE_UP_FOR_ADJACENT_NODES = 0;
! 9823:
! 9824: # use accesskey in hrefs
! 9825: $USE_ACCESSKEY = 1;
! 9826:
! 9827: # use rel= and rev= in hrefs. Currently only rel is used
! 9828: $USE_REL_REV = 1;
! 9829:
! 9830: # generate <link> elements in head
! 9831: $USE_LINKS = 1;
! 9832:
! 9833: # if this variable is true, numeric entities are used when there is no
! 9834: # corresponding textual entity.
! 9835: $USE_NUMERIC_ENTITY = 0;
! 9836:
! 9837: # if set and $SPLIT is set, then split index pages at the next letter
! 9838: # after they have more than that many entries
! 9839: $SPLIT_INDEX = 0;
! 9840:
! 9841: # file name used for Top node when NODE_FILES is true
! 9842: $TOP_NODE_FILE = undef;
! 9843:
! 9844: # extensions used for images
! 9845: @IMAGE_EXTENSIONS = ('png','jpg', 'txt');
! 9846:
! 9847: $USE_NODES = 1;
! 9848:
! 9849: $USE_SECTIONS = 1;
! 9850:
! 9851: # also set by command line options
! 9852: $FOOTNOTESTYLE = 'end';
! 9853:
! 9854: $DOCTYPE = '';
! 9855:
! 9856: $USE_ISO = 0;
! 9857:
! 9858: $NUMBER_SECTIONS = 1;
! 9859:
! 9860: $TOP_FILE = '';
! 9861:
! 9862: $ENABLE_ENCODING = 0;
! 9863:
! 9864: #
! 9865: # Formatting functions
! 9866: #
! 9867: # They will be reset here between formats switch
! 9868: # if they are defined in this function.
! 9869: #
! 9870:
! 9871: # these are more or less the documented vanilla versions, so they
! 9872: # are reset
! 9873: $unknown = \&t2h_default_unknown;
! 9874: $unknown_style = \&t2h_default_unknown_style;
! 9875: $external_ref = \&t2h_default_external_ref;
! 9876: $internal_ref = \&t2h_default_internal_ref;
! 9877: $tab_item_texi = \&t2h_default_tab_item_texi;
! 9878: $complex_format = \&t2h_default_complex_format;
! 9879: $toc_body = \&T2H_DEFAULT_toc_body;
! 9880: $misc_command_line = \&t2h_default_misc_command_line;
! 9881: $misc_command_line_texi = \&t2h_default_misc_command_line;
! 9882: $print_title = \&T2H_DEFAULT_print_title;
! 9883: # reset in info and xml
! 9884: $element_heading = \&t2h_default_element_heading;
! 9885: # reset in html
! 9886: $inline_contents = \&T2H_DEFAULT_inline_contents;
! 9887: # reset in docbook and info.
! 9888: $style = \&T2H_GPL_style;
! 9889: $format = \&T2H_GPL_format;
! 9890: # reset in info
! 9891: $simple_command = \&t2h_default_simple_command;
! 9892: # reset in info
! 9893: $thing_command = \&t2h_default_thing_command;
! 9894: # reset in html and xml
! 9895: $caption_shortcaption = \&t2h_default_caption_shortcaption;
! 9896: $caption_shortcaption_command = \&t2h_default_caption_shortcaption_command;
! 9897: # reset in docbook and xml. Not really vanilla, but documented.
! 9898: $printindex = \&t2h_GPL_default_printindex;
! 9899: # reset by xml and html
! 9900: $misc_element_label = \&t2h_default_misc_element_label;
! 9901: # set in html
! 9902: $init_out = \&t2h_default_init_out;
! 9903: # set in info and xml
! 9904: $paragraph_style_command = \&t2h_default_paragraph_style_command;
! 9905: # set in info
! 9906: $colon_command = \&t2h_default_colon_command;
! 9907: # set in docbook
! 9908: $quotation_prepend_text = \&t2h_default_quotation_prepend_text;
! 9909: # set in info
! 9910: $copying_comment = \&t2h_default_copying_comment;
! 9911:
! 9912: # set in html and info
! 9913: $print_section = \&T2H_DEFAULT_print_section;
! 9914:
! 9915: # set in docbook and xml
! 9916: %colon_command_punctuation_characters = (
! 9917: '.' => '.',
! 9918: ':' => ':',
! 9919: '?' => '?',
! 9920: '!' => '!'
! 9921: );
! 9922:
! 9923:
! 9924:
! 9925: # in info
! 9926: $footnote_texi = undef;
! 9927: $begin_paragraph_texi = undef;
! 9928: $begin_style_texi = undef;
! 9929: $begin_special_region = undef;
! 9930: $end_special_region = undef;
! 9931: $empty_preformatted = undef;
! 9932:
! 9933: %line_command_map = (
! 9934: 'title' => '',
! 9935: 'subtitle' => '',
! 9936: 'author' => '',
! 9937: );
! 9938:
! 9939: %format_in_paragraph = (
! 9940: );
! 9941: # map mapping css specification to style
! 9942:
! 9943: %css_map =
! 9944: (
! 9945: );
! 9946:
! 9947: @text_substitutions_normal = ();
! 9948: @text_substitutions_texi = ();
! 9949: @text_substitutions_simple_format = ();
! 9950: @text_substitutions_pre = ();
! 9951:
! 9952: %region_formats_kept = ();
! 9953:
! 9954: %style_map_texi = ();
! 9955: t2h_default_copy_style_map (\%default_style_map_texi, \%style_map_texi);
! 9956:
! 9957: # reset in info
! 9958: %simple_map_texi = %default_simple_map;
! 9959:
! 9960: # modified in docbook
! 9961: %special_accents = (
! 9962: 'ringaccent' => 'aA',
! 9963: "'" => 'aeiouyAEIOUY',
! 9964: ',' => 'cC',
! 9965: '^' => 'aeiouAEIOU',
! 9966: '`' => 'aeiouAEIOU',
! 9967: '~' => 'nNaoAO',
! 9968: '"' => 'aeiouyAEIOU',
! 9969: # according to http://www2.lib.virginia.edu/small/vhp/download/ISO.txt
! 9970: # however this doesn't seems to work in firefox
! 9971: # 'ogonek' => 'aeiuAEIU',
! 9972: );
! 9973:
! 9974: # modified by info, xml, docbook
! 9975: # %no_paragraph_commands should not be reset since it has been
! 9976: # filled with defaults for many other commands.
! 9977:
! 9978: # FIXME this prevents the user from setting those entries.
! 9979: $no_paragraph_commands{'cindex'} = 1;
! 9980: $no_paragraph_commands{'float'} = 1;
! 9981: delete $no_paragraph_commands{'anchor'};
! 9982:
! 9983: # modified in docbook and xml
! 9984: %stop_paragraph_command = (
! 9985: 'titlefont' => 1,
! 9986: 'insertcopying' => 1,
! 9987: 'sp' => 1,
! 9988: 'verbatiminclude' => 1,
! 9989: 'page' => 1,
! 9990: # FIXME they also stop preformatted, so cannot be here.
! 9991: # 'printindex' => 1,
! 9992: # 'listoffloats' => 1
! 9993: );
! 9994:
! 9995: }
! 9996:
! 9997: sub t2h_default_raw_text_load()
! 9998: {
! 9999: $SPLIT = '';
! 10000: # extension for nodes files when NODE_FILES is true
! 10001: $NODE_FILE_EXTENSION = 'txt';
! 10002:
! 10003: # extension
! 10004: $EXTENSION = 'txt';
! 10005: @T2H_FORMAT_EXPAND = ('plaintext');
! 10006: $USE_TITLEPAGE_FOR_TITLE = 0;
! 10007: $HEADERS = 0;
! 10008: $SIMPLE_MENU = 1;
! 10009: $INLINE_INSERTCOPYING = 0;
! 10010: $NODE_FILENAMES = undef;
! 10011:
! 10012: %simple_map = %default_simple_map;
! 10013: %simple_map_pre = %simple_map;
! 10014:
! 10015: %things_map = %default_things_map;
! 10016: %pre_map = %things_map;
! 10017:
! 10018: %style_map = ();
! 10019: %style_map_pre = ();
! 10020: t2h_default_copy_style_map (\%default_style_map, \%style_map);
! 10021: t2h_default_copy_style_map (\%default_style_map_pre, \%style_map_pre);
! 10022:
! 10023: # could also be t2h_default_set_iso_symbols()
! 10024: t2h_remove_text_substitutions("'", 1, 0, 0, 1);
! 10025: t2h_remove_text_substitutions('`', 1, 0, 0, 1);
! 10026: $OPEN_QUOTE_SYMBOL = '`';
! 10027: $CLOSE_QUOTE_SYMBOL = "'";
! 10028:
! 10029: $BEFORE_OVERVIEW = "";
! 10030: $AFTER_OVERVIEW = "";
! 10031:
! 10032: $BEFORE_TOC_LINES = "";
! 10033: $AFTER_TOC_LINES = "";
! 10034:
! 10035:
! 10036: foreach my $complex_format ('example', 'smallexample', 'display',
! 10037: 'smalldisplay', 'lisp', 'smalllisp', 'format', 'smallformat',
! 10038: 'menu', 'detailmenu', 'direntry', 'menu_comment')
! 10039: {
! 10040: $complex_format_map{$complex_format}->{'begin'} = '';
! 10041: $complex_format_map{$complex_format}->{'end'} = '';
! 10042: }
! 10043:
! 10044: %format_map = (
! 10045: # 'quotation' => 'blockquote',
! 10046: # lists
! 10047: # 'itemize' => 'ul',
! 10048: 'enumerate' => '',
! 10049: # 'multitable' => 'table',
! 10050: 'table' => '',
! 10051: 'vtable' => '',
! 10052: 'ftable' => '',
! 10053: 'group' => '',
! 10054: 'raggedright' => '',
! 10055: # 'detailmenu' => '',
! 10056: );
! 10057:
! 10058: #
! 10059: # Controls the layout
! 10060: #
! 10061:
! 10062: $print_page_head = \&T2H_DEFAULT_print_page_head;
! 10063: $contents = \&T2H_DEFAULT_contents;
! 10064: $shortcontents = \&T2H_DEFAULT_shortcontents;
! 10065: $one_section = \&T2H_DEFAULT_one_section;
! 10066: $print_Top = \&T2H_DEFAULT_print_Top;
! 10067: $print_Top_footer = \&T2H_DEFAULT_print_Top_footer;
! 10068: $print_misc_header = \&T2H_DEFAULT_print_misc_header;
! 10069: $print_misc_footer = \&T2H_DEFAULT_print_misc_footer;
! 10070: $print_section_footer = \&T2H_DEFAULT_print_section_footer;
! 10071: $print_chapter_header = \&T2H_DEFAULT_print_chapter_header;
! 10072: $print_section_header = \&T2H_DEFAULT_print_section_header;
! 10073: $print_chapter_footer = \&T2H_DEFAULT_print_chapter_footer;
! 10074: $print_page_foot = \&T2H_DEFAULT_print_page_foot;
! 10075: $print_head_navigation = \&T2H_DEFAULT_print_head_navigation;
! 10076: $print_foot_navigation = \&T2H_DEFAULT_print_foot_navigation;
! 10077: $end_section = \&T2H_DEFAULT_end_section;
! 10078: # changed in info
! 10079: $print_Footnotes = \&T2H_DEFAULT_print_Footnotes;
! 10080: # used if split
! 10081: $about_body = \&T2H_DEFAULT_about_body;
! 10082: $print_navigation = \&T2H_DEFAULT_print_navigation;
! 10083:
! 10084: #
! 10085: # Controls the formatting
! 10086: #
! 10087:
! 10088: $empty_line = \&t2h_default_empty_line;
! 10089: $anchor = \&t2h_default_anchor;
! 10090: $anchor_label = \&t2h_default_anchor_label;
! 10091: $image = \&t2h_default_image;
! 10092: $heading = \&t2h_default_heading;
! 10093: $heading_text = \&t2h_default_heading_text;
! 10094: $heading_text_preformatted = \&t2h_default_heading_text_preformatted;
! 10095: $element_label = \&t2h_default_element_label;
! 10096: $index_entry_label = \&t2h_default_index_entry_label;
! 10097: #$menu_command = \&t2h_default_menu_command;
! 10098: $menu_link = \&t2h_default_menu_link;
! 10099: #$menu_description = \&t2h_default_menu_description;
! 10100: $paragraph = \&t2h_default_paragraph;
! 10101: $preformatted = \&t2h_default_preformatted;
! 10102: $protect_text = \&t2h_default_protect_text;
! 10103: $normal_text = \&t2h_default_normal_text;
! 10104: $acronym_like = \&t2h_default_acronym_like;
! 10105: $sp = \&t2h_default_sp;
! 10106: $quotation = \&t2h_default_quotation;
! 10107: $table_list = \&t2h_default_table_list;
! 10108: $list_item = \&t2h_default_list_item;
! 10109: $table_line = \&t2h_default_table_line;
! 10110: $table_item = \&t2h_default_table_item;
! 10111: $cell = \&t2h_default_cell;
! 10112: $row = \&t2h_default_row;
! 10113: $def_item = \&t2h_default_def_item;
! 10114: $def = \&t2h_default_def;
! 10115: $def_line = \&t2h_default_def_line;
! 10116: $cartouche = \&t2h_default_cartouche;
! 10117: $raw = \&t2h_default_raw;
! 10118: $format_list_item_texi = \&t2h_default_format_list_item_texi;
! 10119: $print_index = \&t2h_default_print_index;
! 10120: $index_summary = \&t2h_default_index_summary;
! 10121: $index_entry = \&t2h_default_index_entry;
! 10122: $index_letter = \&t2h_default_index_letter;
! 10123: $foot_line_and_ref = \&t2h_default_foot_line_and_ref;
! 10124: $foot_section = \&t2h_default_foot_section;
! 10125: $tab_item_texi = \&t2h_default_tab_item_texi;
! 10126: $listoffloats = \&t2h_default_listoffloats;
! 10127: $listoffloats_entry = \&t2h_default_listoffloats_entry;
! 10128: $float = \&t2h_default_float;
! 10129:
! 10130: t2h_default_set_variables_default();
! 10131: }
! 10132:
! 10133: my %things_map_xml;
! 10134: my %pre_map_xml;
! 10135:
! 10136: sub t2h_default_set_variables_xml()
! 10137: {
! 10138: t2h_default_set_variables_default();
! 10139: $ENABLE_ENCODING_USE_ENTITY = 1;
! 10140: $EXTENSION = 'xml';
! 10141: t2h_default_set_iso_symbols(1);
! 10142:
! 10143: $empty_line = \&t2h_default_empty_line;
! 10144: $comment = \&xml_default_comment;
! 10145: $line_command = \&xml_default_line_command;
! 10146:
! 10147: %things_map = %things_map_xml;
! 10148: %pre_map = %pre_map_xml;
! 10149: %simple_format_texi_map = %pre_map;
! 10150:
! 10151: %simple_format_style_map_texi = ();
! 10152: t2h_default_copy_style_map (\%default_style_map_texi, \%simple_format_style_map_texi);
! 10153: foreach my $accent_command ('tieaccent', 'dotless', keys(%unicode_accents))
! 10154: {
! 10155: # $simple_format_style_map_texi{$accent_command}->{'args'} = ['normal'];
! 10156: $simple_format_style_map_texi{$accent_command}->{'function'} = \&xml_default_accent;
! 10157: }
! 10158: }
! 10159:
! 10160: sub t2h_default_set_variables_texi2html()
! 10161: {
! 10162: $USE_SETFILENAME = 0;
! 10163: $USE_SETFILENAME_EXTENSION = 0;
! 10164: $FOOTNOTESTYLE = 'separate';
! 10165: $INLINE_CONTENTS = 0;
! 10166: $FORCE = 1;
! 10167: $AVOID_MENU_REDUNDANCY = 1;
! 10168: $TOP_HEADING_AT_BEGINNING = 1;
! 10169: $TOP_FILE = '';
! 10170: $USE_ACCESSKEY = 0;
! 10171: $NODE_NAME_IN_MENU = 0;
! 10172: $OVERVIEW_LINK_TO_TOC = 0;
! 10173: $USE_UP_FOR_ADJACENT_NODES = 1;
! 10174: $USE_ACCESSKEY = 0;
! 10175: $USE_REL_REV = 0;
! 10176: $USE_LINKS = 0;
! 10177: $USE_NODES = undef;
! 10178: $USE_SECTIONS = 1;
! 10179: $NODE_FILENAMES = 0;
! 10180: $USE_NUMERIC_ENTITY = 1;
! 10181: $SPLIT = '';
! 10182: $SPLIT_INDEX = 100;
! 10183: $PROGRAM_NAME_IN_FOOTER = 1;
! 10184: $HEADER_IN_TABLE = 1;
! 10185: $SHORT_REF = 0;
! 10186: $USE_TITLEPAGE_FOR_TITLE = 1;
! 10187: $MENU_ENTRY_COLON = '';
! 10188: $INDEX_ENTRY_COLON = '';
! 10189:
! 10190: $ENABLE_ENCODING_USE_ENTITY = 1;
! 10191: }
! 10192:
! 10193: # specify in this array which "buttons" should appear in which order
! 10194: # in the navigation panel for sections; use ' ' for empty buttons (space)
! 10195: @SECTION_BUTTONS =
! 10196: (
! 10197: 'FastBack', 'Back', 'Up', 'Forward', 'FastForward',
! 10198: ' ', ' ', ' ', ' ',
! 10199: 'Top', 'Contents', 'Index', 'About',
! 10200: );
! 10201:
! 10202: # buttons for misc stuff
! 10203: @MISC_BUTTONS = ('Top', 'Contents', 'Index', 'About');
! 10204:
! 10205: @TOP_BUTTONS = ( 'Back', 'Forward', ' ','Contents', 'Index', 'About');
! 10206: #@TOP_BUTTONS = ('Top', 'Contents', 'Index', 'About');
! 10207:
! 10208:
! 10209: # buttons for chapter file footers
! 10210: # (and headers but only if HEADERS is false)
! 10211: @CHAPTER_BUTTONS =
! 10212: (
! 10213: 'FastBack', 'FastForward', ' ',
! 10214: ' ', ' ', ' ', ' ',
! 10215: 'Top', 'Contents', 'Index', 'About',
! 10216: );
! 10217:
! 10218: # buttons for section file footers
! 10219: @SECTION_FOOTER_BUTTONS =
! 10220: (
! 10221: 'FastBack', 'Back', 'Up', 'Forward', 'FastForward',
! 10222: );
! 10223:
! 10224: @NODE_FOOTER_BUTTONS = @SECTION_BUTTONS;
! 10225:
! 10226: @LINKS_BUTTONS =
! 10227: (
! 10228: 'Top', 'Index', 'Contents', 'About', 'Up', 'NextFile', 'PrevFile'
! 10229: );
! 10230:
! 10231:
! 10232: # insert here name of icon images for buttons
! 10233: # Icons are used, if $ICONS and resp. value are set
! 10234: %ACTIVE_ICONS =
! 10235: (
! 10236: 'Top', '',
! 10237: 'Contents', '',
! 10238: 'Overview', '',
! 10239: 'Index', '',
! 10240: 'This', '',
! 10241: 'Back', '',
! 10242: 'FastBack', '',
! 10243: 'Prev', '',
! 10244: 'Up', '',
! 10245: 'Next', '',
! 10246: 'NodeUp', '',
! 10247: 'NodeNext', '',
! 10248: 'NodePrev', '',
! 10249: 'Following', '',
! 10250: 'Forward', '',
! 10251: 'FastForward', '',
! 10252: 'About' , '',
! 10253: 'First', '',
! 10254: 'Last', '',
! 10255: 'NextFile', '',
! 10256: 'PrevFile', '',
! 10257: ' ', '',
! 10258: );
! 10259:
! 10260: # insert here name of icon images for these, if button is inactive
! 10261: %PASSIVE_ICONS =
! 10262: (
! 10263: 'Top', '',
! 10264: 'Contents', '',
! 10265: 'Overview', '',
! 10266: 'Index', '',
! 10267: 'This', '',
! 10268: 'Back', '',
! 10269: 'FastBack', '',
! 10270: 'Prev', '',
! 10271: 'Up', '',
! 10272: 'Next', '',
! 10273: 'NodeUp', '',
! 10274: 'NodeNext', '',
! 10275: 'NodePrev', '',
! 10276: 'Following', '',
! 10277: 'Forward', '',
! 10278: 'FastForward', '',
! 10279: 'About', '',
! 10280: 'First', '',
! 10281: 'Last', '',
! 10282: 'NextFile', '',
! 10283: 'PrevFile', '',
! 10284: );
! 10285:
! 10286: %misc_pages_targets = (
! 10287: 'Overview' => 'SEC_Overview',
! 10288: 'Contents' => 'SEC_Contents',
! 10289: 'Footnotes' => 'SEC_Foot',
! 10290: 'About' => 'SEC_About'
! 10291: );
! 10292:
! 10293: # determine the null devices
! 10294: my $default_null_device = File::Spec->devnull();
! 10295: %null_device_file = (
! 10296: $default_null_device => 1
! 10297: );
! 10298: # special case, djgpp recognizes both null devices
! 10299: if ($Config{osname} eq 'dos' and $Config{osvers} eq 'djgpp')
! 10300: {
! 10301: $null_device_file{'/dev/null'} = 1;
! 10302: $null_device_file{'NUL'} = 1;
! 10303: }
! 10304:
! 10305: $finish_out = \&t2h_default_finish_out;
! 10306: $translate_names = \&t2h_default_translate_names;
! 10307:
! 10308: sub t2h_default_translate_names()
! 10309: {
! 10310: # Names of text as alternative for icons
! 10311: # FIXME maybe get those in simple_format?
! 10312: %NAVIGATION_TEXT =
! 10313: (
! 10314: 'Top', gdt('Top'),
! 10315: 'Contents', gdt('Contents'),
! 10316: 'Overview', gdt('Overview'),
! 10317: 'Index', gdt('Index'),
! 10318: ' ', ' ',
! 10319: 'This', gdt('Current'),
! 10320: 'Back', ' < ',
! 10321: 'FastBack', ' << ',
! 10322: 'Prev', gdt('Previous'),
! 10323: 'Up', gdt('Up'),
! 10324: 'Next', gdt('Next'),
! 10325: 'NodeUp', gdt('Up'),
! 10326: 'NodeNext', gdt('Next'),
! 10327: 'NodePrev', gdt('Previous'),
! 10328: 'Following', gdt('Following'),
! 10329: 'Forward', ' > ',
! 10330: 'FastForward', ' >> ',
! 10331: 'About', ' ? ',
! 10332: 'First', ' |< ',
! 10333: 'Last', ' >| ',
! 10334: 'NextFile', gdt('Next file'),
! 10335: 'PrevFile', gdt('Previous file'),
! 10336: );
! 10337: %BUTTONS_TEXT = %NAVIGATION_TEXT;
! 10338:
! 10339: %BUTTONS_GOTO =
! 10340: (
! 10341: 'Top', gdt('Cover (top) of document'),
! 10342: 'Contents', gdt('Table of contents'),
! 10343: 'Overview', gdt('Short table of contents'),
! 10344: 'Index', gdt('Index'),
! 10345: 'This', gdt('Current section'),
! 10346: 'Back', gdt('Previous section in reading order'),
! 10347: 'FastBack', gdt('Beginning of this chapter or previous chapter'),
! 10348: 'Prev', gdt('Previous section on same level'),
! 10349: 'Up', gdt('Up section'),
! 10350: 'Next', gdt('Next section on same level'),
! 10351: 'NodeUp', gdt('Up node'),
! 10352: 'NodeNext', gdt('Next node'),
! 10353: 'NodePrev', gdt('Previous node'),
! 10354: 'Following', gdt('Node following in node reading order'),
! 10355: 'Forward', gdt('Next section in reading order'),
! 10356: 'FastForward', gdt('Next chapter'),
! 10357: 'About' , gdt('About (help)'),
! 10358: 'First', gdt('First section in reading order'),
! 10359: 'Last', gdt('Last section in reading order'),
! 10360: 'NextFile', gdt('Forward section in next file'),
! 10361: 'PrevFile', gdt('Back section in previous file'),
! 10362: );
! 10363:
! 10364: %BUTTONS_NAME =
! 10365: (
! 10366: 'Top', gdt('Top'),
! 10367: 'Contents', gdt('Contents'),
! 10368: 'Overview', gdt('Overview'),
! 10369: 'Index', gdt('Index'),
! 10370: ' ', ' ',
! 10371: 'This', gdt('This'),
! 10372: 'Back', gdt('Back'),
! 10373: 'FastBack', gdt('FastBack'),
! 10374: 'Prev', gdt('Prev'),
! 10375: 'Up', gdt('Up'),
! 10376: 'Next', gdt('Next'),
! 10377: 'NodeUp', gdt('NodeUp'),
! 10378: 'NodeNext', gdt('NodeNext'),
! 10379: 'NodePrev', gdt('NodePrev'),
! 10380: 'Following', gdt('Following'),
! 10381: 'Forward', gdt('Forward'),
! 10382: 'FastForward', gdt('FastForward'),
! 10383: 'About', gdt('About'),
! 10384: 'First', gdt('First'),
! 10385: 'Last', gdt('Last'),
! 10386: 'NextFile', gdt('NextFile'),
! 10387: 'PrevFile', gdt('PrevFile'),
! 10388: );
! 10389:
! 10390: }
! 10391:
! 10392: sub t2h_default_set_iso_symbols($)
! 10393: {
! 10394: my $value = shift;
! 10395: $USE_ISO = $value;
! 10396: if ($value)
! 10397: {
! 10398: foreach my $association ([\%things_map, \%things_map_xml],
! 10399: [\%pre_map, \%pre_map_xml],
! 10400: [\%simple_format_simple_map_texi, \%pre_map_xml])
! 10401: {
! 10402: foreach my $thing (keys(%{$association->[0]}))
! 10403: {
! 10404: if (defined($association->[0]->{$thing}) and $association->[0]->{$thing} !~ /^\&\w+\;$/ and defined($association->[1]->{$thing}) and $association->[1]->{$thing} =~ /^\&\w+\;$/)
! 10405: {
! 10406: $association->[0]->{$thing} = $association->[1]->{$thing};
! 10407: }
! 10408: }
! 10409: }
! 10410: t2h_add_text_substitutions(["'", '’'], 1, 0, 0, 1);
! 10411: t2h_add_text_substitutions(['`', '‘'], 1, 0, 0, 1);
! 10412: $OPEN_QUOTE_SYMBOL = '‘';
! 10413: $CLOSE_QUOTE_SYMBOL = '’';
! 10414: }
! 10415: else
! 10416: {
! 10417: foreach my $association ([\%things_map, \%default_things_map],
! 10418: [\%pre_map, \%default_things_map],
! 10419: [\%simple_format_simple_map_texi, \%default_things_map])
! 10420: {
! 10421: foreach my $thing (keys(%{$association->[0]}))
! 10422: {
! 10423: if (defined($association->[0]->{$thing}) and $association->[0]->{$thing} =~ /^\&\w+\;$/ and defined($association->[1]->{$thing}) and $association->[1]->{$thing} !~ /^\&\w+\;$/)
! 10424: {
! 10425: $association->[0]->{$thing} = &$protect_text($association->[1]->{$thing});
! 10426: }
! 10427: }
! 10428: }
! 10429: t2h_remove_text_substitutions("'", 1, 0, 0, 1);
! 10430: t2h_remove_text_substitutions('`', 1, 0, 0, 1);
! 10431: $OPEN_QUOTE_SYMBOL = '`';
! 10432: $CLOSE_QUOTE_SYMBOL = "'";
! 10433: }
! 10434: }
! 10435:
! 10436: # is used in main program for dumping texi too.
! 10437: sub t2h_default_set_out_encoding()
! 10438: {
! 10439: # these variables are used for the corresponding
! 10440: # $Texi2HTML::THISDOC{'*_ENCODING'} to keep code shorter
! 10441: my ($out_encoding, $encoding_name, $document_encoding);
! 10442:
! 10443: $document_encoding = get_conf('DOCUMENT_ENCODING');
! 10444:
! 10445: if (defined($OUT_ENCODING))
! 10446: {
! 10447: $out_encoding = $OUT_ENCODING;
! 10448: }
! 10449:
! 10450: if (defined($ENCODING_NAME))
! 10451: {
! 10452: $encoding_name = $ENCODING_NAME;
! 10453: }
! 10454:
! 10455: if (!defined($out_encoding) and (defined($encoding_name)))
! 10456: {
! 10457: my $possible_out_encoding = main::encoding_alias ($encoding_name, undef, 'determining encoding from default encoding');
! 10458: $out_encoding = $possible_out_encoding if (defined($possible_out_encoding));
! 10459: }
! 10460: if (!defined($out_encoding) and (defined(get_conf('IN_ENCODING'))))
! 10461: {
! 10462: $out_encoding = get_conf('IN_ENCODING');
! 10463: }
! 10464: if (!defined($out_encoding) and (defined($document_encoding)))
! 10465: {
! 10466: my $possible_out_encoding = main::encoding_alias ($document_encoding, undef, 'determining encoding from documentencoding');
! 10467: $out_encoding = $possible_out_encoding if (defined($possible_out_encoding));
! 10468: }
! 10469:
! 10470: if (!defined($encoding_name))
! 10471: {
! 10472: if (defined($out_encoding) and defined($perl_charset_to_html{$out_encoding}))
! 10473: {
! 10474: $encoding_name = $perl_charset_to_html{$out_encoding};
! 10475: }
! 10476: elsif (defined(get_conf('IN_ENCODING')) and defined($perl_charset_to_html{get_conf('IN_ENCODING')}))
! 10477: {
! 10478: $encoding_name = $perl_charset_to_html{get_conf('IN_ENCODING')};
! 10479: }
! 10480: elsif (defined($document_encoding) and defined($perl_charset_to_html{$document_encoding}))
! 10481: {
! 10482: $encoding_name = $perl_charset_to_html{$document_encoding};
! 10483: }
! 10484: elsif (defined($out_encoding))
! 10485: {
! 10486: $encoding_name = $out_encoding;
! 10487: }
! 10488: elsif (defined(get_conf('IN_ENCODING')))
! 10489: {
! 10490: $encoding_name = get_conf('IN_ENCODING');
! 10491: }
! 10492: elsif (defined($document_encoding))
! 10493: {
! 10494: $encoding_name = $document_encoding;
! 10495: }
! 10496: elsif (defined($perl_charset_to_html{$DEFAULT_ENCODING}))
! 10497: {
! 10498: $encoding_name = $perl_charset_to_html{$DEFAULT_ENCODING};
! 10499: }
! 10500: else
! 10501: {
! 10502: $encoding_name = 'us-ascii';
! 10503: }
! 10504: }
! 10505:
! 10506: $Texi2HTML::THISDOC{'OUT_ENCODING'} = $out_encoding;
! 10507: $Texi2HTML::THISDOC{'ENCODING_NAME'} = $encoding_name;
! 10508:
! 10509: $out_encoding = 'UNDEF' if (!defined($out_encoding));
! 10510: my $in_encoding = get_conf('IN_ENCODING');
! 10511: $in_encoding = 'UNDEF' if (!defined($in_encoding));
! 10512: $document_encoding = 'UNDEF' if (!defined($document_encoding));
! 10513: print STDERR "# Encodings: doc $document_encoding, in $in_encoding out $out_encoding, name $encoding_name\n" if ($VERBOSE);
! 10514: }
! 10515:
! 10516: sub t2h_default_init_out()
! 10517: {
! 10518: &$translate_names;
! 10519: # set external cross ref splitting like splitting.
! 10520: if (!defined($EXTERNAL_CROSSREF_SPLIT))
! 10521: {
! 10522: if (get_conf('SPLIT'))
! 10523: {
! 10524: $Texi2HTML::THISDOC{'EXTERNAL_CROSSREF_SPLIT'} = 1;
! 10525: }
! 10526: else
! 10527: {
! 10528: $Texi2HTML::THISDOC{'EXTERNAL_CROSSREF_SPLIT'} = 0;
! 10529: }
! 10530: }
! 10531: else
! 10532: {
! 10533: $Texi2HTML::THISDOC{'EXTERNAL_CROSSREF_SPLIT'} = $EXTERNAL_CROSSREF_SPLIT;
! 10534: }
! 10535:
! 10536:
! 10537: }
! 10538:
! 10539: my %t2h_default_formats_load_table = (
! 10540: 'html' => \&html_default_load,
! 10541: 'info' => \&info_default_load,
! 10542: 'docbook' => \&docbook_default_load,
! 10543: 'xml' => \&xml_default_load,
! 10544: 'plaintext' => \&plaintext_default_load,
! 10545: 'raw-text' => \&t2h_default_raw_text_load,
! 10546: );
! 10547:
! 10548: sub t2h_default_load_format($;$)
! 10549: {
! 10550: my $format = shift;
! 10551: my $from_command_line = shift;
! 10552: if (defined($t2h_default_formats_load_table{$format}))
! 10553: {
! 10554: $OUTPUT_FORMAT = $format;
! 10555: &{$t2h_default_formats_load_table{$format}}($from_command_line);
! 10556: $Texi2HTML::THISDOC{'format_from_command_line'} = $format if ($from_command_line);
! 10557: return 1;
! 10558: }
! 10559: else
! 10560: {
! 10561: return 0;
! 10562: }
! 10563: }
! 10564:
! 10565: sub t2h_encoding_is_entity($)
! 10566: {
! 10567: my $text = shift;
! 10568: return 0 if (!$ENABLE_ENCODING_USE_ENTITY);
! 10569: return 1 if ($text =~ /^&/ and $text =~ /;$/);
! 10570: }
! 10571:
! 10572: # this is for info.init
! 10573: use vars qw(%t2h_enable_encoding_default_accent);
! 10574: my @t2h_enable_encoding_accents_stack;
! 10575: my %t2h_enable_encoding_default_commands;
! 10576:
! 10577: sub t2h_enable_encoding_load()
! 10578: {
! 10579: t2h_default_push_handler(\&t2h_enable_encoding_init, \@command_handler_names);
! 10580: t2h_default_push_handler(\&t2h_enable_encoding_finish, \@command_handler_finish);
! 10581: #push @command_handler_process, \&t2h_enable_encoding_init;
! 10582: #push @command_handler_finish, \&t2h_enable_encoding_finish;
! 10583: foreach my $key (keys(%unicode_accents), 'dotless')
! 10584: {
! 10585: $t2h_enable_encoding_default_accent{'normal'}->{$key} = $style_map{$key}->{'function'};
! 10586: $t2h_enable_encoding_default_accent{'texi'}->{$key} = $style_map_texi{$key}->{'function'};
! 10587: $t2h_enable_encoding_default_accent{'pre'}->{$key} = $style_map_pre{$key}->{'function'};
! 10588: $style_map{$key}->{'function'} = \&t2h_enable_encoding_normal_accent;
! 10589: $style_map_texi{$key}->{'function'} = \&t2h_enable_encoding_texi_accent;
! 10590: $style_map_pre{$key}->{'function'} = \&t2h_enable_encoding_pre_accent;
! 10591: }
! 10592: foreach my $key (%things_map)
! 10593: {
! 10594: if (exists($unicode_map{$key}) and ($unicode_map{$key} ne ''))
! 10595: {
! 10596: $t2h_enable_encoding_default_commands{'normal'}->{$key} = $things_map{$key};
! 10597: $t2h_enable_encoding_default_commands{'texi'}->{$key} = $texi_map{$key};
! 10598: $t2h_enable_encoding_default_commands{'sorting'}->{$key} = $sorting_things_map{$key};
! 10599: $t2h_enable_encoding_default_commands{'pre'}->{$key} = $pre_map{$key};
! 10600: }
! 10601: }
! 10602: }
! 10603:
! 10604: sub t2h_enable_encoding_finish()
! 10605: {
! 10606: foreach my $key (%things_map)
! 10607: {
! 10608: if (exists($unicode_map{$key}) and ($unicode_map{$key} ne ''))
! 10609: {
! 10610: $things_map{$key} = $t2h_enable_encoding_default_commands{'normal'}->{$key};
! 10611: $texi_map{$key} = $t2h_enable_encoding_default_commands{'texi'}->{$key};
! 10612: $sorting_things_map{$key} = $t2h_enable_encoding_default_commands{'sorting'}->{$key};
! 10613: $pre_map{$key} = $t2h_enable_encoding_default_commands{'pre'}->{$key};
! 10614: }
! 10615: }
! 10616: }
! 10617:
! 10618: sub t2h_enable_encoding_init()
! 10619: {
! 10620: if ($Texi2HTML::THISDOC{'ENCODING_NAME'} eq 'utf-8')
! 10621: {
! 10622: foreach my $key (%things_map)
! 10623: {
! 10624: if (exists($unicode_map{$key}) and ($unicode_map{$key} ne ''))
! 10625: {
! 10626: $things_map{$key} = chr(hex($unicode_map{$key})) unless (t2h_encoding_is_entity($things_map{$key}));
! 10627: $texi_map{$key} = chr(hex($unicode_map{$key})) unless (t2h_encoding_is_entity($texi_map{$key}));
! 10628: $sorting_things_map{$key} = chr(hex($unicode_map{$key})) unless (t2h_encoding_is_entity($sorting_things_map{$key}));
! 10629: $pre_map{$key} = chr(hex($unicode_map{$key})) unless (t2h_encoding_is_entity($pre_map{$key}));
! 10630: }
! 10631: }
! 10632: }
! 10633: elsif (exists($makeinfo_encoding_to_map{$Texi2HTML::THISDOC{'ENCODING_NAME'}}))
! 10634: {
! 10635: my $enc_map = $makeinfo_encoding_to_map{$Texi2HTML::THISDOC{'ENCODING_NAME'}};
! 10636:
! 10637: foreach my $key (%things_map)
! 10638: {
! 10639: if (exists($unicode_map{$key}) and ($unicode_map{$key} ne '') and
! 10640: exists($makeinfo_unicode_to_eight_bit{$enc_map}->{$unicode_map{$key}}))
! 10641: { # we let perl handle the conversion
! 10642: $things_map{$key} = chr(hex($unicode_map{$key})) unless (t2h_encoding_is_entity($things_map{$key}));
! 10643: $texi_map{$key} = chr(hex($unicode_map{$key})) unless (t2h_encoding_is_entity($texi_map{$key}));
! 10644: $sorting_things_map{$key} = chr(hex($unicode_map{$key})) unless (t2h_encoding_is_entity($sorting_things_map{$key}));
! 10645: $pre_map{$key} = chr(hex($unicode_map{$key})) unless (t2h_encoding_is_entity($pre_map{$key}));
! 10646: }
! 10647: }
! 10648: @t2h_enable_encoding_accents_stack = ();
! 10649: }
! 10650: }
! 10651:
! 10652: sub t2h_default_string_width($)
! 10653: {
! 10654: my $string = shift;
! 10655: if ($USE_UNICODE)
! 10656: {
! 10657: my $width = 0;
! 10658: foreach my $character(split '', $string)
! 10659: {
! 10660: if ($character =~ /\p{Unicode::EastAsianWidth::InFullwidth}/)
! 10661: {
! 10662: $width += 2;
! 10663: }
! 10664: else
! 10665: {
! 10666: $width += 1;
! 10667: }
! 10668: }
! 10669: return $width;
! 10670: }
! 10671: else
! 10672: {
! 10673: return length($string);
! 10674: }
! 10675: }
! 10676:
! 10677: sub t2h_default_finish_out()
! 10678: {
! 10679: }
! 10680:
! 10681: #######################################################################
! 10682: #
! 10683: # Values guessed if not set here. The value used is in
! 10684: # $Texi2HTML::THISDOC{'VARNAME'}
! 10685: #
! 10686: #######################################################################
! 10687:
! 10688: # In file encoding. The @documentencoding allows autodetection of
! 10689: # that variable.
! 10690: $DOCUMENT_ENCODING = undef;
! 10691:
! 10692: # In file encoding, understandable by perl. Set according to DOCUMENT_ENCODING
! 10693: $IN_ENCODING = undef;
! 10694:
! 10695: # Formatted document encoding name. If undef, set in init_out based on
! 10696: # $OUT_ENCODING or $DOCUMENT_ENCODING if they are defined
! 10697: $ENCODING_NAME = undef;
! 10698:
! 10699: # Out files encoding, understandable by perl. If undef, set in init_out
! 10700: # using $ENCODING_NAME or $IN_ENCODING if they are defined
! 10701: $OUT_ENCODING = undef;
! 10702:
! 10703: # Used to set $Texi2HTML::THISDOC{'DOCUMENT_DESCRIPTION'}.
! 10704: # if undef set to @documentdescription. If there is no @documentdescription,
! 10705: # set in page_head.
! 10706: $DOCUMENT_DESCRIPTION = undef;
! 10707:
! 10708: # if undef $Texi2HTML::THISDOC{'EXTERNAL_CROSSREF_SPLIT'} set 1 if SPLIT,
! 10709: # to 0 otherwise
! 10710: $EXTERNAL_CROSSREF_SPLIT = undef;
! 10711:
! 10712: $DATE = undef;
! 10713:
! 10714:
! 10715: ########################################################################
! 10716: # Control of Page layout:
! 10717: # You can make changes of the Page layout at two levels:
! 10718: # 1.) For small changes, it is often enough to change the value of
! 10719: # some global string/hash/array variables
! 10720: # 2.) For larger changes, reimplement one of the T2H_DEFAULT_<fnc>* routines,
! 10721: # give them another name, and assign them to the respective
! 10722: # $<fnc> variable.
! 10723:
! 10724: # As a general interface, the hashes Texi2HTML::HREF, Texi2HTML::NAME, Texi2HTML::NODE, Texi2HTML::NO_TEXI, Texi2HTML::SIMPLE_TEXT hold
! 10725: # href, html-name, node-name, name after removal of texi commands of
! 10726: # This -- current section (resp. html page)
! 10727: # Top -- top element
! 10728: # Contents -- Table of contents element
! 10729: # Overview -- Short table of contents element
! 10730: # Index -- Index page element
! 10731: # About -- page which explain "navigation buttons" element
! 10732: # First -- first node element
! 10733: # Last -- last node element
! 10734: #
! 10735: # Whether or not the following hash values are set, depends on the context
! 10736: # (all values are w.r.t. 'This' section)
! 10737: # Next -- next element of texinfo
! 10738: # Prev -- previous element of texinfo
! 10739: # NodeUp -- up node of texinfo
! 10740: # Following -- following node in node reading order, taking menu into account
! 10741: # Forward -- next node in reading order
! 10742: # Back -- previous node in reading order
! 10743: # Up -- parent given by sectioning commands
! 10744: # FastForward -- if leave node, up and next, else next node
! 10745: # FastBackward-- if leave node, up and prev, else prev node
! 10746: #
! 10747: # Furthermore, the following global variabels are set:
! 10748: # $Texi2HTML::THISDOC{title} -- title as set by @title...
! 10749: # $Texi2HTML::THISDOC{title_no_texi} -- title without texi (without html elements)
! 10750: # $Texi2HTML::THISDOC{title_texi} -- title with texinfo @-commands
! 10751: # $Texi2HTML::THISDOC{fulltitle} -- full title as set by @title...
! 10752: # $Texi2HTML::THISDOC{subtitle} -- subtitle as set by @subtitle
! 10753: # $Texi2HTML::THISDOC{author} -- author as set by @author
! 10754: # $Texi2HTML::THISDOC{copying_comment} -- text of @copying and @end copying in comment
! 10755: #
! 10756: # $Texi2HTML::THISDOC{program} -- name and version of texi2html
! 10757: # $Texi2HTML::THISDOC{program_homepage} -- homepage for texi2html
! 10758: # $Texi2HTML::THISDOC{program_authors} -- authors of texi2html
! 10759: # $Texi2HTML::THISDOC{today} -- date formatted with pretty_date
! 10760: # $Texi2HTML::THISDOC{toc_file} -- table of contents file
! 10761: # $Texi2HTML::THISDOC{file_base_name} -- base name of the texinfo manual file
! 10762: # $Texi2HTML::THISDOC{input_file_name} -- name of the texinfo manual file
! 10763: # $Texi2HTML::THISDOC{destination_directory}
! 10764: # -- directory for the resulting files
! 10765: # $Texi2HTML::THISDOC{user} -- user running the script
! 10766: # $Texi2HTML::THISDOC{css_import_lines} -- ref on @import lines in css files
! 10767: # $Texi2HTML::THISDOC{css_rule_lines} -- ref on css rules lines
! 10768: # other $Texi2HTML::THISDOC keys corresponds with texinfo commands, the value
! 10769: # being the command arg, for the following commands:
! 10770: # kbdinputstyle, paragraphindent, setchapternewpage, headings, footnotestyle,
! 10771: # exampleindent, firstparagraphindent, everyheading, everyfooting,
! 10772: # evenheading, evenfooting, oddheading, oddfooting
! 10773: #
! 10774: # and pointer to arrays of lines which need to be printed by main::print_lines
! 10775: # $Texi2HTML::THIS_SECTION -- lines of 'This' section
! 10776: # $Texi2HTML::OVERVIEW -- lines of short table of contents
! 10777: # $Texi2HTML::TOC_LINES -- lines of table of contents
! 10778: # $Texi2HTML::TITLEPAGE -- lines of title page
! 10779: #
! 10780: # $Texi2HTML::THIS_ELEMENT holds the element reference.
! 10781:
! 10782: # most of the functions are either reset when switching format, in
! 10783: # t2h_default_set_variables_default, or set in format, the simplest
! 10784: # one being setup above in t2h_default_raw_text_load
! 10785:
! 10786: #
! 10787: # The following generic subs control the layout:
! 10788: #
! 10789: # misc element formatting functions. They are rather generic,
! 10790: # their call is controlled by other variables (separate or not
! 10791: # footnotes, about_body, handling of table of contents...).
! 10792: # print_Footnotes is the only to be redefined, in info
! 10793: $print_Toc = \&T2H_DEFAULT_print_Toc;
! 10794: $print_Overview = \&T2H_DEFAULT_print_Overview;
! 10795: $print_About = \&T2H_DEFAULT_print_About;
! 10796: $print_misc = \&T2H_DEFAULT_print_misc;
! 10797: # generic enough (call print_page_head if needed)
! 10798: $print_Top_header = \&T2H_DEFAULT_print_Top_header;
! 10799:
! 10800: # the following are less generic, but in case a specific format
! 10801: # doesn't redefine them, the raw text functions are always defined.
! 10802: $print_page_head = \&T2H_DEFAULT_print_page_head;
! 10803: $contents = \&T2H_DEFAULT_contents;
! 10804: $shortcontents = \&T2H_DEFAULT_shortcontents;
! 10805: $one_section = \&T2H_DEFAULT_one_section;
! 10806: $print_Top = \&T2H_DEFAULT_print_Top;
! 10807: $print_Top_footer = \&T2H_DEFAULT_print_Top_footer;
! 10808: $print_misc_header = \&T2H_DEFAULT_print_misc_header;
! 10809: $print_misc_footer = \&T2H_DEFAULT_print_misc_footer;
! 10810: $print_section_footer = \&T2H_DEFAULT_print_section_footer;
! 10811: $print_chapter_header = \&T2H_DEFAULT_print_chapter_header;
! 10812: $print_section_header = \&T2H_DEFAULT_print_section_header;
! 10813: $print_chapter_footer = \&T2H_DEFAULT_print_chapter_footer;
! 10814: $print_page_foot = \&T2H_DEFAULT_print_page_foot;
! 10815: $print_head_navigation = \&T2H_DEFAULT_print_head_navigation;
! 10816: $print_foot_navigation = \&T2H_DEFAULT_print_foot_navigation;
! 10817: $end_section = \&T2H_DEFAULT_end_section;
! 10818: # changed in info
! 10819: $print_Footnotes = \&T2H_DEFAULT_print_Footnotes;
! 10820: # used if split
! 10821: $about_body = \&T2H_DEFAULT_about_body;
! 10822: $print_navigation = \&T2H_DEFAULT_print_navigation;
! 10823:
! 10824: #
! 10825: # generic formatting functions
! 10826: #
! 10827:
! 10828: $button_icon_img = \&T2H_DEFAULT_button_icon_img;
! 10829: # not really needed nor relevant except for html
! 10830: $print_frame = \&T2H_DEFAULT_print_frame;
! 10831: $print_toc_frame = \&T2H_DEFAULT_print_toc_frame;
! 10832: # generic
! 10833: $titlepage = \&T2H_DEFAULT_titlepage;
! 10834: $css_lines = \&T2H_DEFAULT_css_lines;
! 10835: $print_redirection_page = \&T2H_DEFAULT_print_redirection_page;
! 10836: $node_file_name = \&T2H_DEFAULT_node_file_name;
! 10837: $inline_contents = \&T2H_DEFAULT_inline_contents;
! 10838: $program_string = \&T2H_DEFAULT_program_string;
! 10839: $element_file_name = \&t2h_default_element_file_name;
! 10840:
! 10841: ########################################################################
! 10842: # Layout for every sections
! 10843: #
! 10844:
! 10845: sub T2H_DEFAULT_print_section($$$$)
! 10846: {
! 10847: my $fh = shift;
! 10848: my $first_in_page = shift;
! 10849: my $previous_is_top = shift;
! 10850: my $element = shift;
! 10851:
! 10852: my $nw = main::print_lines($fh);
! 10853: }
! 10854:
! 10855: sub T2H_DEFAULT_one_section($$)
! 10856: {
! 10857: my $fh = shift;
! 10858: my $element = shift;
! 10859: main::print_lines($fh);
! 10860: &$print_page_foot($fh);
! 10861: }
! 10862:
! 10863: ###################################################################
! 10864: # Layout of top-page. It is possible to use @ifnothtml, @ifhtml,
! 10865: # @html within the Top texinfo node to specify content of top-level
! 10866: # page.
! 10867: #
! 10868: sub T2H_DEFAULT_print_Top_header($$)
! 10869: {
! 10870: my $fh = shift;
! 10871: my $do_page_head = shift;
! 10872: &$print_page_head($fh) if ($do_page_head);
! 10873: }
! 10874: sub T2H_DEFAULT_print_Top_footer($$$)
! 10875: {
! 10876: my $fh = shift;
! 10877: my $end_page = shift;
! 10878: my $element = shift;
! 10879: if ($end_page)
! 10880: {
! 10881: &$print_page_foot($fh);
! 10882: }
! 10883: }
! 10884:
! 10885: sub T2H_DEFAULT_print_Top($$$)
! 10886: {
! 10887: my $fh = shift;
! 10888: my $has_top_heading = shift;
! 10889: my $element = shift;
! 10890:
! 10891: if ($Texi2HTML::THISDOC{'setshortcontentsaftertitlepage'})
! 10892: {
! 10893: my $shortcontents = &$inline_contents($fh, 'shortcontents');
! 10894: print $fh "".join('',@$shortcontents) if (defined($shortcontents));
! 10895: }
! 10896: if ($Texi2HTML::THISDOC{'setcontentsaftertitlepage'})
! 10897: {
! 10898: my $contents = &$inline_contents($fh, 'contents');
! 10899: print $fh "".join('',@$contents) if (defined($contents));
! 10900: }
! 10901:
! 10902: main::print_lines($fh, $Texi2HTML::THIS_SECTION);
! 10903: }
! 10904:
! 10905: ###################################################################
! 10906: # Layout of Toc, Overview, and Footnotes pages
! 10907: # By default, we use "normal" layout
! 10908: # Texi2HTML::HREF of Next, Prev, Up, Forward, Back, etc are not defined
! 10909: # redefine \@MISC_BUTTONS to change the navigation
! 10910: sub T2H_DEFAULT_print_Toc
! 10911: {
! 10912: return &$print_misc(@_);
! 10913: }
! 10914: sub T2H_DEFAULT_print_Overview
! 10915: {
! 10916: return &$print_misc(@_);
! 10917: }
! 10918: sub T2H_DEFAULT_print_Footnotes
! 10919: {
! 10920: return &$print_misc(@_);
! 10921: }
! 10922: sub T2H_DEFAULT_print_About
! 10923: {
! 10924: return &$print_misc(@_);
! 10925: }
! 10926:
! 10927: sub T2H_DEFAULT_print_misc_header($$$$)
! 10928: {
! 10929: my $fh = shift;
! 10930: my $buttons = shift;
! 10931: my $new_file = shift;
! 10932: my $misc_page = shift;
! 10933: &$print_page_head($fh) if ($new_file);
! 10934: }
! 10935:
! 10936: sub T2H_DEFAULT_print_misc_footer($$$)
! 10937: {
! 10938: my $fh = shift;
! 10939: my $buttons = shift;
! 10940: my $new_file = shift;
! 10941: if ($new_file)
! 10942: {
! 10943: &$print_page_foot($fh);
! 10944: }
! 10945: }
! 10946:
! 10947: use vars qw(
! 10948: %t2h_default_underline_symbol
! 10949: );
! 10950:
! 10951: %t2h_default_underline_symbol = (
! 10952: 0 => '*',
! 10953: 1 => '*',
! 10954: 2 => '=',
! 10955: 3 => '-',
! 10956: 4 => '.'
! 10957: );
! 10958:
! 10959: sub t2h_default_heading_text($$$)
! 10960: {
! 10961: my $command = shift;
! 10962: my $text = shift;
! 10963: my $level = shift;
! 10964:
! 10965: return '' if ($text !~ /\S/);
! 10966: my $result = $text ."\n";
! 10967: # as seen in encodings/nodetest_utf8_no_unicode, the length can be in
! 10968: # bytes (certainly) when there hasn't been a require Encode
! 10969: #$result .=($t2h_default_underline_symbol{$level} x length($text))."\n";
! 10970: $result .=($t2h_default_underline_symbol{$level} x t2h_default_string_width($text))."\n";
! 10971: return $result;
! 10972: }
! 10973:
! 10974: sub t2h_default_heading_text_preformatted($$$)
! 10975: {
! 10976: my $command = shift;
! 10977: my $text = shift;
! 10978: my $level = shift;
! 10979:
! 10980: return t2h_default_heading_text($command, $text, $level);
! 10981: }
! 10982:
! 10983: sub T2H_DEFAULT_print_misc($$$)
! 10984: {
! 10985: my $fh = shift;
! 10986: my $new_file = shift;
! 10987: my $misc_page = shift;
! 10988: my $buttons = \@MISC_BUTTONS;
! 10989: &$print_misc_header($fh, $buttons, $new_file, $misc_page);
! 10990: print $fh "".&$heading_text('misc heading', $Texi2HTML::NAME{This}, 1) . "\n";
! 10991: main::print_lines($fh);
! 10992: &$print_misc_footer($fh, $buttons, $new_file);
! 10993: }
! 10994: ##################################################################
! 10995: # section_footer is only called if SPLIT eq 'section'
! 10996: # section_footer: after print_section of last section, before print_page_foot
! 10997: #
! 10998:
! 10999: sub T2H_DEFAULT_print_section_footer
! 11000: {
! 11001: my $fh = shift;
! 11002: my $element = shift;
! 11003: }
! 11004:
! 11005: ###################################################################
! 11006: # chapter_header and chapter_footer are only called if
! 11007: # SPLIT eq 'chapter'
! 11008: # chapter_header: after print_page_head, before print_section
! 11009: # chapter_footer: after print_section of last section, before print_page_foot
! 11010:
! 11011: sub T2H_DEFAULT_print_chapter_header
! 11012: {
! 11013: my $fh = shift;
! 11014: my $element = shift;
! 11015: }
! 11016:
! 11017: sub T2H_DEFAULT_print_chapter_footer
! 11018: {
! 11019: my $fh = shift;
! 11020: my $element = shift;
! 11021: }
! 11022:
! 11023: sub T2H_DEFAULT_print_section_header
! 11024: {
! 11025: my $fh = shift;
! 11026: }
! 11027:
! 11028:
! 11029: ###################################################################
! 11030: # Layout of standard header and footer
! 11031: #
! 11032:
! 11033: sub T2H_DEFAULT_print_page_head($)
! 11034: {
! 11035: my $fh = shift;
! 11036: }
! 11037:
! 11038: sub T2H_DEFAULT_program_string()
! 11039: {
! 11040: my $date = $Texi2HTML::THISDOC{'today'};
! 11041: $date = '' if (!defined($date));
! 11042: if ($date ne '')
! 11043: {
! 11044: return gdt('This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.', {
! 11045: 'date' => $date, 'program_homepage' => $Texi2HTML::THISDOC{'program_homepage'}, 'program' => $Texi2HTML::THISDOC{'program'} },{'duplicate'=>1});
! 11046: }
! 11047: return gdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.', {
! 11048: 'program_homepage' => $Texi2HTML::THISDOC{'program_homepage'}, 'program'
! 11049: => $Texi2HTML::THISDOC{'program'} },{'duplicate'=>1});
! 11050: }
! 11051:
! 11052: sub T2H_DEFAULT_end_section($$$)
! 11053: {
! 11054: my $fh = shift;
! 11055: my $misc_or_top_and_section_separation = shift;
! 11056: my $element = shift;
! 11057: }
! 11058:
! 11059: sub T2H_DEFAULT_print_page_foot($)
! 11060: {
! 11061: my $fh = shift;
! 11062: }
! 11063:
! 11064: ###################################################################
! 11065: # Layout of navigation panel
! 11066:
! 11067: sub T2H_DEFAULT_print_head_navigation($$$$$)
! 11068: {
! 11069: my $fh = shift;
! 11070: my $buttons = shift;
! 11071: my $first_in_page = shift;
! 11072: my $previous_is_top = shift;
! 11073: my $element = shift;
! 11074:
! 11075: return '';
! 11076: }
! 11077:
! 11078: sub T2H_DEFAULT_print_foot_navigation
! 11079: {
! 11080: my $fh = shift;
! 11081: my $buttons = shift;
! 11082: my $rule = shift;
! 11083: my $print_navigation_panel = shift;
! 11084: my $element = shift;
! 11085:
! 11086: $rule = '' if (!defined($rule));
! 11087: print $fh "$rule\n" if ($rule ne '');
! 11088: }
! 11089:
! 11090: ######################################################################
! 11091: # navigation panel
! 11092: #
! 11093: # how to create IMG tag
! 11094: # this is only used in html, and only if ICONS is set and the button
! 11095: # is active.
! 11096: sub T2H_DEFAULT_button_icon_img
! 11097: {
! 11098: my $button = shift;
! 11099: my $icon = shift;
! 11100: my $name = shift;
! 11101: return '' if (!defined($icon));
! 11102: $button = "" if (!defined ($button));
! 11103: $name = '' if (!defined($name));
! 11104: my $alt = '';
! 11105: if ($name ne '')
! 11106: {
! 11107: if ($button ne '')
! 11108: {
! 11109: $alt = "$button: $name";
! 11110: }
! 11111: else
! 11112: {
! 11113: $alt = $name;
! 11114: }
! 11115: }
! 11116: else
! 11117: {
! 11118: $alt = $button;
! 11119: }
! 11120: return "$icon $alt";
! 11121: }
! 11122:
! 11123: sub T2H_DEFAULT_print_navigation
! 11124: {
! 11125: my $buttons = shift;
! 11126: my $vertical = shift;
! 11127:
! 11128: return '';
! 11129: }
! 11130:
! 11131: ######################################################################
! 11132: # Frames: this is from "Richard Y. Kim" <ryk@coho.net>
! 11133: # Should be improved to be more conforming to other _print* functions
! 11134: # toc_file and main_file passed as args are relative to the texinfo manual
! 11135: # location, and therefore are not used.
! 11136:
! 11137: # no-ops in the default case, doesn't really make sense if output is
! 11138: # not html
! 11139:
! 11140: sub T2H_DEFAULT_print_frame
! 11141: {
! 11142: my $fh = shift;
! 11143: my $toc_file = shift;
! 11144: my $main_file = shift;
! 11145: $main_file = $Texi2HTML::THISDOC{'filename'}->{'top'};
! 11146: $toc_file = $Texi2HTML::THISDOC{'filename'}->{'toc_frame'};
! 11147: }
! 11148:
! 11149: sub T2H_DEFAULT_print_toc_frame
! 11150: {
! 11151: my $fh = shift;
! 11152: my $stoc_lines = shift;
! 11153: }
! 11154:
! 11155: # This subroutine is intended to fill @Texi2HTML::TOC_LINES and
! 11156: # @Texi2HTML::OVERVIEW with the table of contents and short table of
! 11157: # contents.
! 11158: #
! 11159: # arguments:
! 11160: # ref on an array containing all the elements
! 11161:
! 11162: # each element is a reference on a hash. The following keys might be of
! 11163: # use:
! 11164: # 'top': true if this is the top element
! 11165: # 'toc_level': level of the element in the table of content. Highest level
! 11166: # is 1 for the @top element and for chapters, appendix and so on,
! 11167: # 2 for section, unnumberedsec and so on...
! 11168: # 'tocid': label used for reference linking to the element in table of
! 11169: # contents
! 11170: # 'file': the file containing the element, usefull to do href to that file
! 11171: # in case the document is split.
! 11172: # 'text': text of the element, with section number
! 11173: # 'text_nonumber': text of the element, without section number
! 11174:
! 11175: # Relevant configuration variables are:
! 11176: # $NO_BULLET_LIST_ATTRIBUTE: usefull in case a list is used
! 11177: # $FRAMES: @Texi2HTML::OVERVIEW is used in one of the frames.
! 11178: # $BEFORE_OVERVIEW
! 11179: # $AFTER_OVERVIEW
! 11180: # $BEFORE_TOC_LINES
! 11181: # $AFTER_TOC_LINES
! 11182: # get_conf('contents')
! 11183: # get_conf('shortcontents')
! 11184:
! 11185: sub T2H_DEFAULT_contents($$)
! 11186: {
! 11187: my $elements = shift;
! 11188: my $toc_file = shift;
! 11189: my @result;
! 11190: return unless (get_conf('contents'));
! 11191: foreach my $element (@$elements)
! 11192: {
! 11193: my $level = $element->{'toc_level'};
! 11194: $level = 1 if ($level < 1);
! 11195: my $text = $element->{'text'};
! 11196: my $result = (' ' x ($level - 1)) . $text ."\n";
! 11197: push @result, $result;
! 11198: }
! 11199: if (@result)
! 11200: {
! 11201: unshift @result, $BEFORE_TOC_LINES;
! 11202: push @result, $AFTER_TOC_LINES;
! 11203: }
! 11204: return \@result;
! 11205: }
! 11206:
! 11207: sub T2H_DEFAULT_shortcontents($$)
! 11208: {
! 11209: my $elements = shift;
! 11210: my $stoc_file = shift;
! 11211: my @result;
! 11212: return unless (get_conf('shortcontents'));
! 11213: foreach my $element (@$elements)
! 11214: {
! 11215: my $level = $element->{'toc_level'};
! 11216: next if ($level > 1);
! 11217: $level = 1 if ($level < 1);
! 11218: my $text = $element->{'text'};
! 11219: push @result, $text ."\n";
! 11220: }
! 11221: if (@result)
! 11222: {
! 11223: unshift @result, $BEFORE_OVERVIEW;
! 11224: push @result, $AFTER_OVERVIEW;
! 11225: }
! 11226: return \@result;
! 11227: }
! 11228:
! 11229: sub T2H_DEFAULT_print_title()
! 11230: {
! 11231: my $element = shift;
! 11232: return undef unless ($SHOW_TITLE);
! 11233: if ($USE_TITLEPAGE_FOR_TITLE)
! 11234: {
! 11235: my ($titlepage_text, $titlepage_no_texi, $titlepage_simple_format) = main::do_special_region_lines('titlepage',$Texi2HTML::THISDOC{'state'});
! 11236:
! 11237: &$titlepage([],$titlepage_text, $titlepage_no_texi, $titlepage_simple_format);
! 11238: return $Texi2HTML::TITLEPAGE;
! 11239: }
! 11240: else
! 11241: {
! 11242: my $title = '';
! 11243: $title = $Texi2HTML::THISDOC{'simpletitle'} if (defined($Texi2HTML::THISDOC{'simpletitle'}) and $Texi2HTML::THISDOC{'simpletitle'} !~ /^\s*$/);
! 11244: if ($title ne '')
! 11245: {
! 11246: return &$heading_text('@settitle', $title, 0) . "\n";
! 11247: }
! 11248: }
! 11249: }
! 11250:
! 11251: sub T2H_DEFAULT_toc_body($)
! 11252: {
! 11253: my $elements_list = shift;
! 11254: my $toc_lines = &$contents($elements_list, $Texi2HTML::THISDOC{'toc_file'});
! 11255: @{$Texi2HTML::TOC_LINES} = @$toc_lines if ($toc_lines);
! 11256: my $stoc_lines = &$shortcontents($elements_list, $Texi2HTML::THISDOC{'stoc_file'});
! 11257: @{$Texi2HTML::OVERVIEW} = @$stoc_lines if ($stoc_lines);
! 11258: }
! 11259:
! 11260: # element and elements_list may not be undef when called from the
! 11261: # main program, but may be if called from other customization function,
! 11262: # for example, here, print_Top.
! 11263: sub T2H_DEFAULT_inline_contents($$$$)
! 11264: {
! 11265: my $fh = shift;
! 11266: my $command = shift;
! 11267: my $element = shift;
! 11268: my $elements_list = shift;
! 11269: my $name;
! 11270: my $lines;
! 11271:
! 11272: my $toc_file;
! 11273: $toc_file = $element->{'file'} if (defined($element));
! 11274:
! 11275: my $result = undef;
! 11276:
! 11277: if ($command eq 'contents')
! 11278: {
! 11279: $name = $Texi2HTML::NAME{'Contents'};
! 11280: $toc_file = $Texi2HTML::THISDOC{'toc_file'} if (!defined($toc_file));
! 11281: if (defined($elements_list))
! 11282: {
! 11283: $lines = &$contents($elements_list, $toc_file);
! 11284: }
! 11285: else
! 11286: {
! 11287: $lines = $Texi2HTML::TOC_LINES;
! 11288: }
! 11289: }
! 11290: else
! 11291: {
! 11292: $name = $Texi2HTML::NAME{'Overview'};
! 11293: $toc_file = $Texi2HTML::THISDOC{'stoc_file'} if (!defined($toc_file));
! 11294: if (defined($elements_list))
! 11295: {
! 11296: $lines = &$shortcontents($elements_list, $toc_file);
! 11297: }
! 11298: else
! 11299: {
! 11300: $lines = $Texi2HTML::OVERVIEW;
! 11301: }
! 11302: }
! 11303: if ($lines and @{$lines})
! 11304: {
! 11305: $result = [ &$heading_text("\@$command", $name, 1), "\n" ];
! 11306: my $contents_anchor = &$anchor($element->{'id'});
! 11307: if (defined($contents_anchor) and $contents_anchor =~ /\S/)
! 11308: {
! 11309: unshift @$result, $contents_anchor."\n";
! 11310: }
! 11311: push @$result, (@$lines, "\n");
! 11312: }
! 11313: return $result;
! 11314: }
! 11315:
! 11316:
! 11317: sub T2H_DEFAULT_css_lines ($$)
! 11318: {
! 11319: my $import_lines = shift;
! 11320: my $rule_lines = shift;
! 11321: # return if (defined($CSS_LINES) or (!@$rule_lines and !@$import_lines and (! keys(%css_map))));
! 11322: if (defined($CSS_LINES))
! 11323: { # if predefined, use CSS_LINES.
! 11324: $Texi2HTML::THISDOC{'CSS_LINES'} = $CSS_LINES;
! 11325: return;
! 11326: }
! 11327: return if ((!@$rule_lines and !@$import_lines and !keys(%css_map) and !@CSS_REFS) or $NO_CSS);
! 11328: my $css_text = "<style type=\"text/css\">\n<!--\n";
! 11329: $css_text .= join('',@$import_lines) . "\n" if (@$import_lines);
! 11330: foreach my $css_rule (sort(keys(%css_map)))
! 11331: {
! 11332: next unless ($css_map{$css_rule});
! 11333: $css_text .= "$css_rule {$css_map{$css_rule}}\n";
! 11334: }
! 11335: $css_text .= join('',@$rule_lines) . "\n" if (@$rule_lines);
! 11336: $css_text .= "-->\n</style>\n";
! 11337: foreach my $ref (@CSS_REFS)
! 11338: {
! 11339: $css_text .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"$ref\">\n";
! 11340: }
! 11341: $Texi2HTML::THISDOC{'CSS_LINES'} = $css_text;
! 11342: }
! 11343:
! 11344: ######################################################################
! 11345: # About page
! 11346: #
! 11347:
! 11348: # PRE_ABOUT can be a function reference or a scalar.
! 11349: # Note that if it is a scalar, T2H_InitGlobals has not been called,
! 11350: # and all global variables like $ADDRESS are not available.
! 11351: $PRE_ABOUT = sub
! 11352: {
! 11353: return ' ' . &$program_string() . "\n";
! 11354: };
! 11355:
! 11356: # If customizing $AFTER_ABOUT, be sure to put the content inside <p></p>.
! 11357: $AFTER_ABOUT = '';
! 11358:
! 11359: %BUTTONS_EXAMPLE =
! 11360: (
! 11361: 'Top', ' ',
! 11362: 'Contents', ' ',
! 11363: 'Overview', ' ',
! 11364: 'Index', ' ',
! 11365: 'This', '1.2.3',
! 11366: 'Back', '1.2.2',
! 11367: 'FastBack', '1',
! 11368: 'Prev', '1.2.2',
! 11369: 'Up', '1.2',
! 11370: 'Next', '1.2.4',
! 11371: 'NodeUp', '1.2',
! 11372: 'NodeNext', '1.2.4',
! 11373: 'NodePrev', '1.2.2',
! 11374: 'Following', '1.2.4',
! 11375: 'Forward', '1.2.4',
! 11376: 'FastForward', '2',
! 11377: 'About', ' ',
! 11378: 'First', '1.',
! 11379: 'Last', '1.2.4',
! 11380: 'NextFile', ' ',
! 11381: 'PrevFile', ' ',
! 11382: );
! 11383:
! 11384: sub T2H_DEFAULT_about_body
! 11385: {
! 11386: my $about = "";
! 11387: if (ref($PRE_ABOUT) eq 'CODE')
! 11388: {
! 11389: $about .= &$PRE_ABOUT();
! 11390: }
! 11391: else
! 11392: {
! 11393: $about .= $PRE_ABOUT;
! 11394: }
! 11395: return $about;
! 11396: }
! 11397:
! 11398: # return value is currently ignored
! 11399: sub T2H_DEFAULT_titlepage($$$$)
! 11400: {
! 11401: my $titlepage_lines = shift;
! 11402: my $titlepage_text = shift;
! 11403: my $titlepage_no_texi = shift;
! 11404: my $titlepage_simple_format = shift;
! 11405:
! 11406: $Texi2HTML::TITLEPAGE = $titlepage_text;
! 11407: if ($titlepage_text eq '')
! 11408: {
! 11409: my $title = '';
! 11410: $title = $Texi2HTML::THISDOC{'simpletitle'} if (defined($Texi2HTML::THISDOC{'simpletitle'}) and $Texi2HTML::THISDOC{'simpletitle'} !~ /^\s*$/);
! 11411: if ($title ne '')
! 11412: {
! 11413: $Texi2HTML::TITLEPAGE = &$heading_text('@settitle', $title, 0);
! 11414: $Texi2HTML::TITLEPAGE .= "$DEFAULT_RULE\n";
! 11415: }
! 11416: }
! 11417: else
! 11418: {
! 11419: $Texi2HTML::TITLEPAGE .= "$DEFAULT_RULE\n";
! 11420: }
! 11421:
! 11422: if ($Texi2HTML::THISDOC{'setcontentsaftertitlepage'} and (defined($Texi2HTML::THISDOC{'inline_contents'}->{'contents'})) and @{$Texi2HTML::THISDOC{'inline_contents'}->{'contents'}})
! 11423: {
! 11424: foreach my $line(@{$Texi2HTML::THISDOC{'inline_contents'}->{'contents'}})
! 11425: {
! 11426: $Texi2HTML::TITLEPAGE .= $line;
! 11427: }
! 11428: $Texi2HTML::TITLEPAGE .= "$DEFAULT_RULE\n";
! 11429: }
! 11430: if ($Texi2HTML::THISDOC{'setshortcontentsaftertitlepage'} and (defined($Texi2HTML::THISDOC{'inline_contents'}->{'shortcontents'})) and @{$Texi2HTML::THISDOC{'inline_contents'}->{'shortcontents'}})
! 11431: {
! 11432: foreach my $line(@{$Texi2HTML::THISDOC{'inline_contents'}->{'shortcontents'}})
! 11433: {
! 11434: $Texi2HTML::TITLEPAGE .= $line;
! 11435: }
! 11436: $Texi2HTML::TITLEPAGE .= "$DEFAULT_RULE\n";
! 11437: }
! 11438: return $Texi2HTML::TITLEPAGE;
! 11439: }
! 11440:
! 11441:
! 11442: sub T2H_DEFAULT_print_redirection_page()
! 11443: {
! 11444: #return "Redirection files are not of use for the current format.\n";
! 11445: return undef;
! 11446: }
! 11447:
! 11448: sub T2H_DEFAULT_node_file_name($$)
! 11449: {
! 11450: my $node = shift;
! 11451: my $type = shift;
! 11452: return undef if ($node->{'external_node'}
! 11453: or ($type eq 'top' and !$NEW_CROSSREF_STYLE));
! 11454: my $node_file_base;
! 11455: if ($type eq 'top' and defined($TOP_NODE_FILE))
! 11456: {
! 11457: $node_file_base = $TOP_NODE_FILE;
! 11458: }
! 11459: elsif ($NEW_CROSSREF_STYLE)
! 11460: {
! 11461: if ($TRANSLITERATE_FILE_NAMES)
! 11462: {
! 11463: $node_file_base = $node->{'cross_manual_file'};
! 11464: }
! 11465: else
! 11466: {
! 11467: $node_file_base = $node->{'cross_manual_target'};
! 11468: }
! 11469: }
! 11470: else
! 11471: {
! 11472: $node_file_base = main::remove_texi($node->{'texi'});
! 11473: $node_file_base =~ s/[^\w\.\-]/-/g;
! 11474: }
! 11475: if (defined($NODE_FILE_EXTENSION) and $NODE_FILE_EXTENSION ne '')
! 11476: {
! 11477: return ($node_file_base . ".$NODE_FILE_EXTENSION");
! 11478: }
! 11479: return $node_file_base;
! 11480: }
! 11481:
! 11482: ########################################################################
! 11483: # Control of formatting:
! 11484: # 1.) For some changes, it is often enough to change the value of
! 11485: # some global map. It might necessitate building a little
! 11486: # function along with the change in hash, if the change is the use
! 11487: # of another function (in style_map).
! 11488: # 2.) For other changes, reimplement one of the t2h_default_<fnc>* routines,
! 11489: # give them another name, and assign them to the respective
! 11490: # $<fnc> variable (below).
! 11491:
! 11492: %deprecated_commands = (
! 11493: 'ctrl' => '',
! 11494: 'allow-recursion' => N__('recursion is always allowed'),
! 11495: 'quote-arg' => N__('arguments are quoted by default'),
! 11496: );
! 11497:
! 11498: #
! 11499: # This hash should have keys corresponding with the nonletter command accent
! 11500: # whose following character is considered to be the argument
! 11501: # This hash associates an accent macro to the ISO name for the accent if any.
! 11502: # The customary use of this map is to find the ISO name appearing in html
! 11503: # entity (like é) associated with a texinfo accent macro.
! 11504: #
! 11505: # The keys of the hash are
! 11506: # ": umlaut
! 11507: # ~: tilda accent
! 11508: # ^: circumflex accent
! 11509: # `: grave accent
! 11510: # ': acute accent
! 11511: # =: macron accent
! 11512: %accent_map = (
! 11513: '"', 'uml',
! 11514: '~', 'tilde',
! 11515: '^', 'circ',
! 11516: '`', 'grave',
! 11517: "'", 'acute',
! 11518: ",", 'cedil',
! 11519: '=', '',
! 11520: 'ringaccent', 'ring',
! 11521: 'H', '',
! 11522: 'dotaccent', '',
! 11523: 'u', '',
! 11524: 'ubaraccent', '',
! 11525: 'udotaccent', '',
! 11526: 'v', '',
! 11527: 'ogonek', 'ogon',
! 11528: );
! 11529:
! 11530: #
! 11531: # ascii representation of texinfo "simple things" @-commands
! 11532: %default_simple_map = (
! 11533: '*', "\n",
! 11534: ' ', ' ',
! 11535: "\t", ' ',
! 11536: "\n", ' ',
! 11537: '-', '', # hyphenation hint
! 11538: '|', '', # used in formatting commands @evenfooting and friends
! 11539: '/', '',
! 11540: ':', '',
! 11541: '!', '!',
! 11542: '?', '?',
! 11543: '.', '.',
! 11544: '@', '@',
! 11545: '}', '}',
! 11546: '{', '{',
! 11547: );
! 11548:
! 11549: # texinfo "simple things" @-commands
! 11550: %simple_map = %default_simple_map;
! 11551:
! 11552: # this map is used in preformatted text
! 11553: %simple_map_pre = %simple_map;
! 11554:
! 11555: # This map is used when texi elements are removed and replaced
! 11556: # by simple text
! 11557: %simple_map_texi = %default_simple_map;
! 11558:
! 11559: # maps for the math specific commands
! 11560: %simple_map_math = (
! 11561: '\\', '\\'
! 11562: );
! 11563:
! 11564: #%simple_map_pre_math = %simple_map_math;
! 11565: #%simple_map_texi_math = %simple_map_math;
! 11566:
! 11567: $punctuation_characters = '.?!';
! 11568: $after_punctuation_characters = '"\')]';
! 11569:
! 11570:
! 11571: %default_things_map = (
! 11572: 'TeX' => 'TeX',
! 11573: 'LaTeX' => 'LaTeX',
! 11574: 'bullet' => '*',
! 11575: 'copyright' => '(C)',
! 11576: 'registeredsymbol' => '(R)',
! 11577: 'dots' => '...',
! 11578: 'enddots' => '...',
! 11579: 'equiv' => '==',
! 11580: # FIXME i18n
! 11581: 'error' => 'error-->',
! 11582: 'expansion' => '==>',
! 11583: 'arrow' => '->',
! 11584: 'minus' => '-',
! 11585: 'point' => '-!-',
! 11586: 'print' => '-|',
! 11587: 'result' => '=>',
! 11588: 'today' => '',
! 11589: 'aa' => 'aa',
! 11590: 'AA' => 'AA',
! 11591: 'ae' => 'ae',
! 11592: 'oe' => 'oe',
! 11593: 'AE' => 'AE',
! 11594: 'OE' => 'OE',
! 11595: 'o' => '/o',
! 11596: 'O' => '/O',
! 11597: 'ss' => 'ss',
! 11598: 'l' => '/l',
! 11599: 'L' => '/L',
! 11600: 'DH' => 'D',
! 11601: 'dh' => 'd',
! 11602: 'TH' => 'TH', # http://www.evertype.com/standards/wynnyogh/thorn.html
! 11603:
! 11604: 'th' => 'th',
! 11605: 'exclamdown' => '!',
! 11606: 'questiondown' => '?',
! 11607: 'pounds' => '#',
! 11608: 'ordf' => 'a',
! 11609: 'ordm' => 'o',
! 11610: 'comma' => ',',
! 11611: 'euro' => 'Euro',
! 11612: 'geq' => '>=',
! 11613: 'leq' => '<=',
! 11614: 'tie' => ' ',
! 11615: 'textdegree' => 'o',
! 11616: 'quotedblleft' => '``',
! 11617: 'quotedblright' => "''",
! 11618: 'quoteleft' => '`',
! 11619: 'quoteright' => "'",
! 11620: 'quotedblbase' => ',,',
! 11621: 'quotesinglbase' => ',',
! 11622: 'guillemetleft' => '<<',
! 11623: 'guillemetright' => '>>',
! 11624: 'guillemotleft' => '<<',
! 11625: 'guillemotright' => '>>',
! 11626: 'guilsinglleft' => '<',
! 11627: 'guilsinglright' => '>',
! 11628: );
! 11629:
! 11630: %things_map = %default_things_map;
! 11631:
! 11632: # This map is used in preformatted environments
! 11633: %pre_map = %things_map;
! 11634:
! 11635: # used in math. If not found, pre_map is used.
! 11636: %math_map = ();
! 11637:
! 11638: # text replacing macros when texi commands are removed and plain text is
! 11639: # produced.
! 11640: %texi_map = %default_things_map;
! 11641:
! 11642: # used for index sorting.
! 11643: %sorting_things_map = %default_things_map;
! 11644: foreach my $accent_letter ('o','O','l','L')
! 11645: {
! 11646: $sorting_things_map{$accent_letter} = $accent_letter;
! 11647: }
! 11648: $sorting_things_map{'copyright'} = 'C';
! 11649: $sorting_things_map{'registeredsymbol'} = 'R';
! 11650: $sorting_things_map{'today'} = 't';
! 11651:
! 11652: %default_texi_map = %texi_map;
! 11653:
! 11654: #
! 11655: # texinfo "things" (@foo{}) to XML ones
! 11656: #
! 11657: %things_map_xml = (
! 11658: 'TeX' => 'TeX',
! 11659: 'LaTeX' => 'LaTeX',
! 11660: # pertusus: unknown by makeinfo, not in texinfo manual (@* is the right thing)
! 11661: # 'br', '<br>', # paragraph break
! 11662: 'bullet' => '•',
! 11663: # #'copyright' => '(C)',
! 11664: 'copyright' => '©',
! 11665: 'registeredsymbol' => '®',
! 11666: 'dots' => '…',
! 11667: 'enddots' => '...',
! 11668: 'equiv' => '≡',
! 11669: # FIXME i18n
! 11670: 'error' => 'error-->',
! 11671: 'expansion' => '→',
! 11672: 'arrow' => '→',
! 11673: 'minus' => '-',
! 11674: 'point' => '∗',
! 11675: 'print' => '-|',
! 11676: 'result' => '⇒',
! 11677: # set in code using the language
! 11678: # 'today', &pretty_date,
! 11679: 'today' => '',
! 11680: 'aa' => 'å',
! 11681: 'AA' => 'Å',
! 11682: 'ae' => 'æ',
! 11683: 'oe' => 'œ', #pertusus: also œ. œ not in html 3.2
! 11684: 'AE' => 'Æ',
! 11685: 'OE' => 'Œ', #pertusus: also Œ. Œ not in html 3.2
! 11686: 'o' => 'ø',
! 11687: 'O' => 'Ø',
! 11688: 'ss' => 'ß',
! 11689: 'DH' => 'Ð',
! 11690: 'dh' => 'ð',
! 11691: 'TH' => 'Þ',
! 11692: 'th' => 'þ',
! 11693: 'l' => 'ł',
! 11694: 'L' => 'Ł',
! 11695: 'exclamdown' => '¡',
! 11696: 'questiondown' => '¿',
! 11697: 'pounds' => '£',
! 11698: 'ordf' => 'ª',
! 11699: 'ordm' => 'º',
! 11700: 'comma' => ',',
! 11701: 'euro' => '€',
! 11702: 'geq' => '≥',
! 11703: 'leq' => '≤',
! 11704: 'tie' => ' ',
! 11705: 'textdegree' => '°',
! 11706: 'quotedblleft' => '“',
! 11707: 'quotedblright' => '”',
! 11708: 'quoteleft' => '‘',
! 11709: 'quoteright' => '’',
! 11710: 'quotedblbase' => '„',
! 11711: 'quotesinglbase' => '‚',
! 11712: 'guillemetleft' => '«',
! 11713: 'guillemetright' => '»',
! 11714: 'guillemotleft' => '«',
! 11715: 'guillemotright' => '»',
! 11716: 'guilsinglleft' => '‹',
! 11717: 'guilsinglright' => '›',
! 11718: );
! 11719:
! 11720: # This map is used in preformatted environments
! 11721: %pre_map_xml = %things_map_xml;
! 11722:
! 11723: # taken from
! 11724: #Latin extended additionnal
! 11725: #http://www.alanwood.net/unicode/latin_extended_additional.html
! 11726: #C1 Controls and Latin-1 Supplement
! 11727: #http://www.alanwood.net/unicode/latin_1_supplement.html
! 11728: #Latin Extended-A
! 11729: #http://www.alanwood.net/unicode/latin_extended_a.html
! 11730: #Latin Extended-B
! 11731: #http://www.alanwood.net/unicode/latin_extended_b.html
! 11732: #dotless i: 0131
! 11733:
! 11734: #http://www.alanwood.net/unicode/arrows.html 21**
! 11735: #http://www.alanwood.net/unicode/general_punctuation.html 20**
! 11736: #http://www.alanwood.net/unicode/mathematical_operators.html 22**
! 11737:
! 11738: %unicode_map = (
! 11739: 'bullet' => '2022',
! 11740: 'copyright' => '00A9',
! 11741: 'registeredsymbol' => '00AE',
! 11742: 'dots' => '2026',
! 11743: 'enddots' => '',
! 11744: 'equiv' => '2261',
! 11745: 'error' => '',
! 11746: 'expansion' => '2192',
! 11747: 'arrow' => '2192',
! 11748: 'minus' => '2212', # in mathematical operators
! 11749: # 'minus' => '002D', # in latin1
! 11750: 'point' => '2605',
! 11751: 'print' => '22A3',
! 11752: 'result' => '21D2',
! 11753: 'today' => '',
! 11754: 'aa' => '00E5',
! 11755: 'AA' => '00C5',
! 11756: 'ae' => '00E6',
! 11757: 'oe' => '0153',
! 11758: 'AE' => '00C6',
! 11759: 'OE' => '0152',
! 11760: 'o' => '00F8',
! 11761: 'O' => '00D8',
! 11762: 'ss' => '00DF',
! 11763: 'DH' => '00D0',
! 11764: 'dh' => '00F0',
! 11765: 'TH' => '00DE',
! 11766: 'th' => '00FE',
! 11767: 'l' => '0142',
! 11768: 'L' => '0141',
! 11769: 'exclamdown' => '00A1',
! 11770: 'questiondown' => '00BF',
! 11771: 'pounds' => '00A3',
! 11772: 'ordf' => '00AA',
! 11773: 'ordm' => '00BA',
! 11774: 'comma' => '002C',
! 11775: 'euro' => '20AC',
! 11776: 'geq' => '2265',
! 11777: 'leq' => '2264',
! 11778: 'tie' => '',
! 11779: # 'tie' => '0020',
! 11780: 'textdegree' => '00B0',
! 11781: 'quotedblleft' => '201C',
! 11782: 'quotedblright' => '201D',
! 11783: 'quoteleft' => '2018',
! 11784: 'quoteright' => '2019',
! 11785: 'quotedblbase' => '201E',
! 11786: 'quotesinglbase' => '201A',
! 11787: 'guillemetleft' => '00AB',
! 11788: 'guillemetright' => '00BB',
! 11789: 'guillemotleft' => '00AB',
! 11790: 'guillemotright' => '00BB',
! 11791: 'guilsinglleft' => '2039',
! 11792: 'guilsinglright' => '203A',
! 11793: );
! 11794:
! 11795: %makeinfo_encoding_to_map = (
! 11796: "iso-8859-1", 'iso8859_1',
! 11797: "iso-8859-2", 'iso8859_2',
! 11798: "iso-8859-15", 'iso8859_15',
! 11799: "koi8-r", 'koi8',
! 11800: "koi8-u", 'koi8',
! 11801: );
! 11802:
! 11803: foreach my $encoding (keys(%makeinfo_encoding_to_map))
! 11804: {
! 11805: $t2h_encoding_aliases{$encoding} = $encoding;
! 11806: $t2h_encoding_aliases{$makeinfo_encoding_to_map{$encoding}} = $encoding;
! 11807: }
! 11808:
! 11809: # cut and pasted from eigth_bit_makeinfo_maps.pl, in turn generated with
! 11810: # ./parse_8bit_makeinfo_maps.pl
! 11811:
! 11812: %makeinfo_unicode_to_eight_bit = (
! 11813: 'iso8859_1' => {
! 11814: '00A0' => 'A0',
! 11815: '00A1' => 'A1',
! 11816: '00A2' => 'A2',
! 11817: '00A3' => 'A3',
! 11818: '00A4' => 'A4',
! 11819: '00A5' => 'A5',
! 11820: '00A6' => 'A6',
! 11821: '00A7' => 'A7',
! 11822: '00A8' => 'A8',
! 11823: '00A9' => 'A9',
! 11824: '00AA' => 'AA',
! 11825: '00AB' => 'AB',
! 11826: '00AC' => 'AC',
! 11827: '00AD' => 'AD',
! 11828: '00AE' => 'AE',
! 11829: '00AF' => 'AF',
! 11830: '00B0' => 'B0',
! 11831: '00B1' => 'B1',
! 11832: '00B2' => 'B2',
! 11833: '00B3' => 'B3',
! 11834: '00B4' => 'B4',
! 11835: '00B5' => 'B5',
! 11836: '00B6' => 'B6',
! 11837: '00B7' => 'B7',
! 11838: '00B8' => 'B8',
! 11839: '00B9' => 'B9',
! 11840: '00BA' => 'BA',
! 11841: '00BB' => 'BB',
! 11842: '00BC' => 'BC',
! 11843: '00BD' => 'BD',
! 11844: '00BE' => 'BE',
! 11845: '00BF' => 'BF',
! 11846: '00C0' => 'C0',
! 11847: '00C1' => 'C1',
! 11848: '00C2' => 'C2',
! 11849: '00C3' => 'C3',
! 11850: '00C4' => 'C4',
! 11851: '00C5' => 'C5',
! 11852: '00C6' => 'C6',
! 11853: '00C7' => 'C7',
! 11854: '00C7' => 'C7',
! 11855: '00C8' => 'C8',
! 11856: '00C9' => 'C9',
! 11857: '00CA' => 'CA',
! 11858: '00CB' => 'CB',
! 11859: '00CC' => 'CC',
! 11860: '00CD' => 'CD',
! 11861: '00CE' => 'CE',
! 11862: '00CF' => 'CF',
! 11863: '00D0' => 'D0',
! 11864: '00D1' => 'D1',
! 11865: '00D2' => 'D2',
! 11866: '00D3' => 'D3',
! 11867: '00D4' => 'D4',
! 11868: '00D5' => 'D5',
! 11869: '00D6' => 'D6',
! 11870: '00D7' => 'D7',
! 11871: '00D8' => 'D8',
! 11872: '00D9' => 'D9',
! 11873: '00DA' => 'DA',
! 11874: '00DB' => 'DB',
! 11875: '00DC' => 'DC',
! 11876: '00DD' => 'DD',
! 11877: '00DE' => 'DE',
! 11878: '00DF' => 'DF',
! 11879: '00E0' => 'E0',
! 11880: '00E1' => 'E1',
! 11881: '00E2' => 'E2',
! 11882: '00E3' => 'E3',
! 11883: '00E4' => 'E4',
! 11884: '00E5' => 'E5',
! 11885: '00E6' => 'E6',
! 11886: '00E7' => 'E7',
! 11887: '00E8' => 'E8',
! 11888: '00E9' => 'E9',
! 11889: '00EA' => 'EA',
! 11890: '00EB' => 'EB',
! 11891: '00EC' => 'EC',
! 11892: '00ED' => 'ED',
! 11893: '00EE' => 'EE',
! 11894: '00EF' => 'EF',
! 11895: '00F0' => 'F0',
! 11896: '00F1' => 'F1',
! 11897: '00F2' => 'F2',
! 11898: '00F3' => 'F3',
! 11899: '00F4' => 'F4',
! 11900: '00F5' => 'F5',
! 11901: '00F6' => 'F6',
! 11902: '00F7' => 'F7',
! 11903: '00F8' => 'F8',
! 11904: '00F9' => 'F9',
! 11905: '00FA' => 'FA',
! 11906: '00FB' => 'FB',
! 11907: '00FC' => 'FC',
! 11908: '00FD' => 'FD',
! 11909: '00FE' => 'FE',
! 11910: '00FF' => 'FF',
! 11911: },
! 11912: 'iso8859_15' => {
! 11913: '00A0' => 'A0',
! 11914: '00A1' => 'A1',
! 11915: '00A2' => 'A2',
! 11916: '00A3' => 'A3',
! 11917: '20AC' => 'A4',
! 11918: '00A5' => 'A5',
! 11919: '0160' => 'A6',
! 11920: '00A7' => 'A7',
! 11921: '0161' => 'A8',
! 11922: '00A9' => 'A9',
! 11923: '00AA' => 'AA',
! 11924: '00AB' => 'AB',
! 11925: '00AC' => 'AC',
! 11926: '00AD' => 'AD',
! 11927: '00AE' => 'AE',
! 11928: '00AF' => 'AF',
! 11929: '00B0' => 'B0',
! 11930: '00B1' => 'B1',
! 11931: '00B2' => 'B2',
! 11932: '00B3' => 'B3',
! 11933: '017D' => 'B4',
! 11934: '00B5' => 'B5',
! 11935: '00B6' => 'B6',
! 11936: '00B7' => 'B7',
! 11937: '017E' => 'B8',
! 11938: '00B9' => 'B9',
! 11939: '00BA' => 'BA',
! 11940: '00BB' => 'BB',
! 11941: '0152' => 'BC',
! 11942: '0153' => 'BD',
! 11943: '0178' => 'BE',
! 11944: '00BF' => 'BF',
! 11945: '00C0' => 'C0',
! 11946: '00C1' => 'C1',
! 11947: '00C2' => 'C2',
! 11948: '00C3' => 'C3',
! 11949: '00C4' => 'C4',
! 11950: '00C5' => 'C5',
! 11951: '00C6' => 'C6',
! 11952: '00C7' => 'C7',
! 11953: '00C8' => 'C8',
! 11954: '00C9' => 'C9',
! 11955: '00CA' => 'CA',
! 11956: '00CB' => 'CB',
! 11957: '00CC' => 'CC',
! 11958: '00CD' => 'CD',
! 11959: '00CE' => 'CE',
! 11960: '00CF' => 'CF',
! 11961: '00D0' => 'D0',
! 11962: '00D1' => 'D1',
! 11963: '00D2' => 'D2',
! 11964: '00D3' => 'D3',
! 11965: '00D4' => 'D4',
! 11966: '00D5' => 'D5',
! 11967: '00D6' => 'D6',
! 11968: '00D7' => 'D7',
! 11969: '00D8' => 'D8',
! 11970: '00D9' => 'D9',
! 11971: '00DA' => 'DA',
! 11972: '00DB' => 'DB',
! 11973: '00DC' => 'DC',
! 11974: '00DD' => 'DD',
! 11975: '00DE' => 'DE',
! 11976: '00DF' => 'DF',
! 11977: '00E0' => 'E0',
! 11978: '00E1' => 'E1',
! 11979: '00E2' => 'E2',
! 11980: '00E3' => 'E3',
! 11981: '00E4' => 'E4',
! 11982: '00E5' => 'E5',
! 11983: '00E6' => 'E6',
! 11984: '00E7' => 'E7',
! 11985: '00E8' => 'E8',
! 11986: '00E9' => 'E9',
! 11987: '00EA' => 'EA',
! 11988: '00EB' => 'EB',
! 11989: '00EC' => 'EC',
! 11990: '00ED' => 'ED',
! 11991: '00EE' => 'EE',
! 11992: '00EF' => 'EF',
! 11993: '00F0' => 'F0',
! 11994: '00F1' => 'F1',
! 11995: '00F2' => 'F2',
! 11996: '00F3' => 'F3',
! 11997: '00F4' => 'F4',
! 11998: '00F5' => 'F5',
! 11999: '00F6' => 'F6',
! 12000: '00F7' => 'F7',
! 12001: '00F8' => 'F8',
! 12002: '00F9' => 'F9',
! 12003: '00FA' => 'FA',
! 12004: '00FB' => 'FB',
! 12005: '00FC' => 'FC',
! 12006: '00FD' => 'FD',
! 12007: '00FE' => 'FE',
! 12008: '00FF' => 'FF',
! 12009: },
! 12010: 'iso8859_2' => {
! 12011: '00A0' => 'A0',
! 12012: '0104' => 'A1',
! 12013: '02D8' => 'A2',
! 12014: '0141' => 'A3',
! 12015: '00A4' => 'A4',
! 12016: '013D' => 'A5',
! 12017: '015A' => 'A6',
! 12018: '00A7' => 'A7',
! 12019: '00A8' => 'A8',
! 12020: '015E' => 'AA',
! 12021: '0164' => 'AB',
! 12022: '0179' => 'AC',
! 12023: '00AD' => 'AD',
! 12024: '017D' => 'AE',
! 12025: '017B' => 'AF',
! 12026: '00B0' => 'B0',
! 12027: '0105' => 'B1',
! 12028: '02DB' => 'B2',
! 12029: '0142' => 'B3',
! 12030: '00B4' => 'B4',
! 12031: '013E' => 'B5',
! 12032: '015B' => 'B6',
! 12033: '02C7' => 'B7',
! 12034: '00B8' => 'B8',
! 12035: '0161' => 'B9',
! 12036: '015F' => 'BA',
! 12037: '0165' => 'BB',
! 12038: '017A' => 'BC',
! 12039: '02DD' => 'BD',
! 12040: '017E' => 'BE',
! 12041: '017C' => 'BF',
! 12042: '0154' => 'C0',
! 12043: '00C1' => 'C1',
! 12044: '00C2' => 'C2',
! 12045: '0102' => 'C3',
! 12046: '00C4' => 'C4',
! 12047: '0139' => 'C5',
! 12048: '0106' => 'C6',
! 12049: '00C7' => 'C7',
! 12050: '010C' => 'C8',
! 12051: '00C9' => 'C9',
! 12052: '0118' => 'CA',
! 12053: '00CB' => 'CB',
! 12054: '011A' => 'CC',
! 12055: '00CD' => 'CD',
! 12056: '00CE' => 'CE',
! 12057: '010E' => 'CF',
! 12058: '0110' => 'D0',
! 12059: '0143' => 'D1',
! 12060: '0147' => 'D2',
! 12061: '00D3' => 'D3',
! 12062: '00D4' => 'D4',
! 12063: '0150' => 'D5',
! 12064: '00D6' => 'D6',
! 12065: '00D7' => 'D7',
! 12066: '0158' => 'D8',
! 12067: '016E' => 'D9',
! 12068: '00DA' => 'DA',
! 12069: '0170' => 'DB',
! 12070: '00DC' => 'DC',
! 12071: '00DD' => 'DD',
! 12072: '0162' => 'DE',
! 12073: '00DF' => 'DF',
! 12074: '0155' => 'E0',
! 12075: '00E1' => 'E1',
! 12076: '00E2' => 'E2',
! 12077: '0103' => 'E3',
! 12078: '00E4' => 'E4',
! 12079: '013A' => 'E5',
! 12080: '0107' => 'E6',
! 12081: '00E7' => 'E7',
! 12082: '010D' => 'E8',
! 12083: '00E9' => 'E9',
! 12084: '0119' => 'EA',
! 12085: '00EB' => 'EB',
! 12086: '011B' => 'EC',
! 12087: '00ED' => 'ED',
! 12088: '00EE' => 'EE',
! 12089: '010F' => 'EF',
! 12090: '0111' => 'F0',
! 12091: '0144' => 'F1',
! 12092: '0148' => 'F2',
! 12093: '00F3' => 'F3',
! 12094: '00F4' => 'F4',
! 12095: '0151' => 'F5',
! 12096: '00F6' => 'F6',
! 12097: '00F7' => 'F7',
! 12098: '0159' => 'F8',
! 12099: '016F' => 'F9',
! 12100: '00FA' => 'FA',
! 12101: '0171' => 'FB',
! 12102: '00FC' => 'FC',
! 12103: '00FD' => 'FD',
! 12104: '0163' => 'FE',
! 12105: '02D9' => 'FF',
! 12106: },
! 12107: 'koi8' => {
! 12108: '0415' => 'A3',
! 12109: '0454' => 'A4',
! 12110: '0456' => 'A6',
! 12111: '0457' => 'A7',
! 12112: '04D7' => 'B3',
! 12113: '0404' => 'B4',
! 12114: '0406' => 'B6',
! 12115: '0407' => 'B7',
! 12116: '042E' => 'C0',
! 12117: '0430' => 'C1',
! 12118: '0431' => 'C2',
! 12119: '0446' => 'C3',
! 12120: '0434' => 'C4',
! 12121: '0435' => 'C5',
! 12122: '0444' => 'C6',
! 12123: '0433' => 'C7',
! 12124: '0445' => 'C8',
! 12125: '0438' => 'C9',
! 12126: '0439' => 'CA',
! 12127: '043A' => 'CB',
! 12128: '043B' => 'CC',
! 12129: '043C' => 'CD',
! 12130: '043D' => 'CE',
! 12131: '043E' => 'CF',
! 12132: '043F' => 'D0',
! 12133: '044F' => 'D1',
! 12134: '0440' => 'D2',
! 12135: '0441' => 'D3',
! 12136: '0442' => 'D4',
! 12137: '0443' => 'D5',
! 12138: '0436' => 'D6',
! 12139: '0432' => 'D7',
! 12140: '044C' => 'D8',
! 12141: '044B' => 'D9',
! 12142: '0437' => 'DA',
! 12143: '0448' => 'DB',
! 12144: '044D' => 'DC',
! 12145: '0449' => 'DD',
! 12146: '0447' => 'DE',
! 12147: '044A' => 'DF',
! 12148: '042D' => 'E0',
! 12149: '0410' => 'E1',
! 12150: '0411' => 'E2',
! 12151: '0426' => 'E3',
! 12152: '0414' => 'E4',
! 12153: '0415' => 'E5',
! 12154: '0424' => 'E6',
! 12155: '0413' => 'E7',
! 12156: '0425' => 'E8',
! 12157: '0418' => 'E9',
! 12158: '0419' => 'EA',
! 12159: '041A' => 'EB',
! 12160: '041B' => 'EC',
! 12161: '041C' => 'ED',
! 12162: '041D' => 'EE',
! 12163: '041E' => 'EF',
! 12164: '041F' => 'F0',
! 12165: '042F' => 'F1',
! 12166: '0420' => 'F2',
! 12167: '0421' => 'F3',
! 12168: '0422' => 'F4',
! 12169: '0423' => 'F5',
! 12170: '0416' => 'F6',
! 12171: '0412' => 'F7',
! 12172: '042C' => 'F8',
! 12173: '042B' => 'F9',
! 12174: '0417' => 'FA',
! 12175: '0428' => 'FB',
! 12176: '042D' => 'FC',
! 12177: '0429' => 'FD',
! 12178: '0427' => 'FE',
! 12179: '042A' => 'FF',
! 12180: },
! 12181: );
! 12182:
! 12183: %eight_bit_to_unicode = ();
! 12184: foreach my $encoding (keys(%makeinfo_encoding_to_map))
! 12185: {
! 12186: my $unicode_to_eight = $makeinfo_unicode_to_eight_bit{$makeinfo_encoding_to_map{$encoding}};
! 12187: #print STDERR "$encoding, $makeinfo_encoding_to_map{$encoding}, $unicode_to_eight\n";
! 12188: foreach my $utf8_key (keys(%{$unicode_to_eight}))
! 12189: {
! 12190: $eight_bit_to_unicode{$encoding}->{$unicode_to_eight->{$utf8_key}} =
! 12191: $utf8_key;
! 12192: }
! 12193: }
! 12194:
! 12195: # currently unused
! 12196: my %makeinfo_transliterate_map = (
! 12197: '0416' => 'ZH',
! 12198: '0447' => 'ch',
! 12199: '00EB' => 'e',
! 12200: '0414' => 'D',
! 12201: '0159' => 'r',
! 12202: '00E6' => 'ae',
! 12203: '042B' => 'Y',
! 12204: '00FA' => 'u',
! 12205: '043B' => 'l',
! 12206: '00DE' => 'TH',
! 12207: '00D9' => 'U',
! 12208: '00C4' => 'A',
! 12209: '0148' => 'n',
! 12210: '00F6' => 'o',
! 12211: '0434' => 'd',
! 12212: '041E' => 'O',
! 12213: '041B' => 'L',
! 12214: '044B' => 'y',
! 12215: '0107' => 'c',
! 12216: '0415' => 'E',
! 12217: '00C1' => 'A',
! 12218: '00D3' => 'O',
! 12219: '00DB' => 'U',
! 12220: '016E' => 'U',
! 12221: '013A' => 'l',
! 12222: '017B' => 'Z',
! 12223: '00F1' => 'n',
! 12224: '0428' => 'SH',
! 12225: '0153' => 'oe',
! 12226: '00F4' => 'o',
! 12227: '0144' => 'n',
! 12228: '0404' => 'IE',
! 12229: '0427' => 'CH',
! 12230: '0162' => 'T',
! 12231: '017A' => 'z',
! 12232: '0448' => 'sh',
! 12233: '0436' => 'zh',
! 12234: '00F9' => 'u',
! 12235: '0406' => 'I',
! 12236: '0103' => 'a',
! 12237: '0422' => 'T',
! 12238: '0160' => 'S',
! 12239: '0165' => 't',
! 12240: '017E' => 'z',
! 12241: '00F0' => 'd',
! 12242: '043E' => 'o',
! 12243: '043D' => 'n',
! 12244: '013E' => 'l',
! 12245: '0412' => 'V',
! 12246: '0111' => 'd',
! 12247: '0155' => 's',
! 12248: '017C' => 'z',
! 12249: '00CE' => 'I',
! 12250: '042D' => 'E',
! 12251: '00C8' => 'E',
! 12252: '00F8' => 'oe',
! 12253: '00F2' => 'o',
! 12254: '00FF' => 'y',
! 12255: '0420' => 'R',
! 12256: '0119' => 'e',
! 12257: '00D2' => 'O',
! 12258: '043C' => 'm',
! 12259: '00D0' => 'DH',
! 12260: '0179' => 'Z',
! 12261: '0110' => 'D',
! 12262: '043F' => 'p',
! 12263: '0170' => 'U',
! 12264: '011A' => 'E',
! 12265: '010C' => 'C',
! 12266: '015A' => 'S',
! 12267: '0433' => 'g',
! 12268: '00E1' => 'a',
! 12269: '010D' => 'c',
! 12270: '00CC' => 'I',
! 12271: '016F' => 'u',
! 12272: '0457' => 'yi',
! 12273: '00C2' => 'A',
! 12274: '0438' => 'i',
! 12275: '00E3' => 'a',
! 12276: '0435' => 'e',
! 12277: '0440' => 'r',
! 12278: '042A' => 'W',
! 12279: '0431' => 'b',
! 12280: '00EE' => 'i',
! 12281: '0150' => 'O',
! 12282: '00E8' => 'e',
! 12283: '0418' => 'I',
! 12284: '00CF' => 'I',
! 12285: '015F' => 's',
! 12286: '0142' => 'l',
! 12287: '0147' => 'N',
! 12288: '00DF' => 'ss',
! 12289: '00E5' => 'aa',
! 12290: '00C3' => 'A',
! 12291: '0106' => 'C',
! 12292: '0141' => 'L',
! 12293: '0164' => 'T',
! 12294: '017D' => 'Z',
! 12295: '00EC' => 'i',
! 12296: '041C' => 'M',
! 12297: '00C9' => 'E',
! 12298: '00E0' => 'a',
! 12299: '043A' => 'k',
! 12300: '00F5' => 'o',
! 12301: '042C' => 'X',
! 12302: '0449' => 'shch',
! 12303: '0444' => 'f',
! 12304: '0139' => 'L',
! 12305: '0158' => 'R',
! 12306: '00F3' => 'o',
! 12307: '00FB' => 'u',
! 12308: '0424' => 'F',
! 12309: '0446' => 'c',
! 12310: '0423' => 'U',
! 12311: '0442' => 't',
! 12312: '00FD' => 'y',
! 12313: '0102' => 'A',
! 12314: '0104' => 'A',
! 12315: '00CB' => 'E',
! 12316: '0426' => 'C',
! 12317: '00CD' => 'I',
! 12318: '0437' => 'z',
! 12319: '0178' => 'y',
! 12320: '00D4' => 'O',
! 12321: '044D' => 'e',
! 12322: '0432' => 'v',
! 12323: '013D' => 'L',
! 12324: '0163' => 't',
! 12325: '0456' => 'i',
! 12326: '011B' => 'e',
! 12327: '044F' => 'ya',
! 12328: '0429' => 'SHCH',
! 12329: '0411' => 'B',
! 12330: '044A' => 'w',
! 12331: '00C6' => 'AE',
! 12332: '041D' => 'N',
! 12333: '00DA' => 'U',
! 12334: '00C0' => 'A',
! 12335: '0152' => 'OE',
! 12336: '00DD' => 'Y',
! 12337: '0154' => 'R',
! 12338: '00E9' => 'e',
! 12339: '00D5' => 'O',
! 12340: '041F' => 'P',
! 12341: '0161' => 's',
! 12342: '0430' => 'a',
! 12343: '0445' => 'h',
! 12344: '00E2' => 'a',
! 12345: '00D6' => 'O',
! 12346: '0407' => 'YI',
! 12347: '00CA' => 'E',
! 12348: '0439' => 'i',
! 12349: '0171' => 'u',
! 12350: '00DC' => 'U',
! 12351: '042F' => 'YA',
! 12352: '0425' => 'H',
! 12353: '00FE' => 'th',
! 12354: '00D1' => 'N',
! 12355: '044C' => 'x',
! 12356: '010F' => 'd',
! 12357: '0410' => 'A',
! 12358: '0443' => 'u',
! 12359: '00EF' => 'i',
! 12360: '0105' => 'a',
! 12361: '00EA' => 'e',
! 12362: '00E4' => 'a',
! 12363: '015E' => 'S',
! 12364: '0417' => 'Z',
! 12365: '00ED' => 'i',
! 12366: '00FC' => 'u',
! 12367: '04D7' => 'IO',
! 12368: '00D8' => 'OE',
! 12369: '0419' => 'I',
! 12370: '0421' => 'S',
! 12371: '0143' => 'N',
! 12372: '010E' => 'D',
! 12373: '0413' => 'G',
! 12374: '015B' => 's',
! 12375: '0151' => 'o',
! 12376: '00E7' => 'c',
! 12377: '00C5' => 'AA',
! 12378: '0441' => 's',
! 12379: '0118' => 'E',
! 12380: '00C7' => 'C',
! 12381: '041A' => 'K',
! 12382: '0454' => 'ie',
! 12383: '042E' => 'yu',
! 12384: );
! 12385:
! 12386:
! 12387: %transliterate_map = (
! 12388: '00C5' => 'AA',
! 12389: '00E5' => 'aa',
! 12390: '00D8' => 'O',
! 12391: '00F8' => 'o',
! 12392: '00E6' => 'ae',
! 12393: '0153' => 'oe',
! 12394: '00C6' => 'AE',
! 12395: '0152' => 'OE',
! 12396: '00DF' => 'ss',
! 12397: '0141' => 'L',
! 12398: '0142' => 'l',
! 12399: '00D0' => 'D',
! 12400: '00F0' => 'd',
! 12401: '00DE' => 'TH',
! 12402: '00FE' => 'th',
! 12403: '0415' => 'E',
! 12404: '0435' => 'e',
! 12405: '0426' => 'C',
! 12406: '042A' => 'W',
! 12407: '044A' => 'w',
! 12408: '042C' => 'X',
! 12409: '044C' => 'x',
! 12410: '042E' => 'yu',
! 12411: '042F' => 'YA',
! 12412: '044F' => 'ya',
! 12413: '0433' => 'g',
! 12414: '0446' => 'c',
! 12415: '04D7' => 'IO',
! 12416: '00DD' => 'Y', # unidecode gets this wrong ?
! 12417: # following appears in tests, this is required to have
! 12418: # the same output with and without unidecode
! 12419: '4E2D' => 'Zhong',
! 12420: '6587' => 'Wen',
! 12421: '793A' => 'Shi',
! 12422: '4F8B' => 'Li',
! 12423: '7B2C' => 'Di',
! 12424: '7AE0' => 'Zhang',
! 12425: '53E6' => 'Ling',
! 12426: '4E2A' => 'Ge',
! 12427: # in http://www.cantonese.sheik.co.uk/dictionary/characters/7/
! 12428: # unidecode certainly gets it wrong
! 12429: '4E00' => 'Yi',
! 12430: 'FF08' => '(',
! 12431: 'FF09' => ')',
! 12432: 'FF0C' => ',',
! 12433: '5B66' => 'Xue',
! 12434: '7FD2' => 'Xi',
! 12435: '30DE' => 'ma',
! 12436: '30CB' => 'ni',
! 12437: '30E5' => 'yu',
! 12438: '30A2' => 'a',
! 12439: '30EB' => 'ru',
! 12440: );
! 12441:
! 12442: foreach my $symbol(keys(%unicode_map))
! 12443: {
! 12444: if ($unicode_map{$symbol} ne '' and !exists($transliterate_map{$symbol}))
! 12445: {
! 12446: $no_transliterate_map{$unicode_map{$symbol}} = 1;
! 12447: }
! 12448: }
! 12449:
! 12450: %ascii_character_map = (
! 12451: ' ' => '0020',
! 12452: '!' => '0021',
! 12453: '"' => '0022',
! 12454: '#' => '0023',
! 12455: '$' => '0024',
! 12456: '%' => '0025',
! 12457: '&' => '0026',
! 12458: "'" => '0027',
! 12459: '(' => '0028',
! 12460: ')' => '0029',
! 12461: '*' => '002A',
! 12462: '+' => '002B',
! 12463: ',' => '002C',
! 12464: '-' => '002D',
! 12465: '.' => '002E',
! 12466: '/' => '002F',
! 12467: ':' => '003A',
! 12468: ';' => '003B',
! 12469: '<' => '003C',
! 12470: '=' => '003D',
! 12471: '>' => '003E',
! 12472: '?' => '003F',
! 12473: '@' => '0040',
! 12474: '[' => '005B',
! 12475: '\\' => '005C',
! 12476: ']' => '005D',
! 12477: '^' => '005E',
! 12478: '_' => '005F',
! 12479: '`' => '0060',
! 12480: '{' => '007B',
! 12481: '|' => '007C',
! 12482: '}' => '007D',
! 12483: '~' => '007E',
! 12484: );
! 12485:
! 12486: %perl_charset_to_html = (
! 12487: 'utf8' => 'utf-8',
! 12488: 'utf-8-strict' => 'utf-8',
! 12489: 'ascii' => 'us-ascii',
! 12490: 'shiftjis' => 'shift_jis',
! 12491: );
! 12492:
! 12493: %t2h_encoding_aliases = (
! 12494: 'latin1' => 'iso-8859-1',
! 12495: );
! 12496:
! 12497: foreach my $perl_charset (keys(%perl_charset_to_html))
! 12498: {
! 12499: $t2h_encoding_aliases{$perl_charset} = $perl_charset_to_html{$perl_charset};
! 12500: $t2h_encoding_aliases{$perl_charset_to_html{$perl_charset}} = $perl_charset_to_html{$perl_charset};
! 12501: }
! 12502:
! 12503: # These are the encodings from the texinfo manual
! 12504: foreach my $canonical_encoding('us-ascii', 'utf-8', 'iso-8859-1',
! 12505: 'iso-8859-15','iso-8859-2','koi8-r', 'koi8-u')
! 12506: {
! 12507: $canonical_texinfo_encodings{$canonical_encoding} = 1;
! 12508: }
! 12509:
! 12510: # not used currently for html, but used in chm.init
! 12511: %numeric_entity_map = ();
! 12512:
! 12513: foreach my $symbol (keys(%unicode_map))
! 12514: {
! 12515: if ($symbol ne '')
! 12516: {
! 12517: $numeric_entity_map{$symbol} = '&#' . hex($unicode_map{$symbol}) . ';';
! 12518: }
! 12519: }
! 12520:
! 12521: # When the value begins with & the function with that name is used to do the
! 12522: # html. The first argument is the text enclosed within {}, the second is the
! 12523: # style name (which is also the key of the hash)
! 12524: #
! 12525: # Otherwithe the value is the html element used to enclose the text, and if
! 12526: # there is a " the resulting text is also enclosed within `'
! 12527: my %old_style_map = (
! 12528: 'acronym', '',
! 12529: 'asis', '',
! 12530: 'b', 'b',
! 12531: 'cite', 'cite',
! 12532: 'clicksequence', '',
! 12533: 'code', 'code',
! 12534: 'command', 'code',
! 12535: 'ctrl', '&default_ctrl',
! 12536: 'dfn', 'em',
! 12537: 'dmn', '',
! 12538: 'email', '&default_email',
! 12539: 'emph', 'em',
! 12540: 'env', 'code',
! 12541: 'file', '"tt',
! 12542: 'i', 'i',
! 12543: 'kbd', 'kbd',
! 12544: 'key', 'kbd',
! 12545: 'math', 'em',
! 12546: 'option', '"samp',
! 12547: 'r', '',
! 12548: 'samp', '"samp',
! 12549: 'sc', '&default_sc',
! 12550: 'strong', 'strong',
! 12551: 't', 'tt',
! 12552: 'uref', '&default_uref',
! 12553: 'url', '&default_url',
! 12554: 'var', 'var',
! 12555: 'verb', 'tt',
! 12556: 'titlefont', '&default_titlefont',
! 12557: 'w', '',
! 12558: );
! 12559:
! 12560: sub t2h_default_copy_style_map ($$;$)
! 12561: {
! 12562: my $from = shift;
! 12563: my $to = shift;
! 12564: my $merge = shift;
! 12565:
! 12566: foreach my $command (keys(%$from))
! 12567: {
! 12568: $to->{$command} = {} if (!exists($to->{$command}));
! 12569: foreach my $key (keys(%{$from->{$command}}))
! 12570: {
! 12571: next if (exists($to->{$command}->{$key}) and $merge);
! 12572: if ($key eq 'args')
! 12573: {
! 12574: $to->{$command}->{$key} = [ @{$from->{$command}->{$key}} ];
! 12575: }
! 12576: else
! 12577: {
! 12578: $to->{$command}->{$key} = $from->{$command}->{$key};
! 12579: }
! 12580: }
! 12581: }
! 12582: }
! 12583:
! 12584: # default is {'args' => ['normal'], 'attribute' => ''},
! 12585: %style_map = (
! 12586: 'asis', {},
! 12587: 'b', {},
! 12588: 'cite', {},
! 12589: 'clicksequence', {},
! 12590: 'click', {'function' => \&t2h_default_click_normal, 'type' => 'simple_style'},
! 12591: 'code', {'args' => ['code']},
! 12592: 'command', {'args' => ['code']},
! 12593: 'ctrl', {'function' => \&t2h_default_ctrl,'type' => 'simple_style'},
! 12594: 'dfn', {},
! 12595: 'dmn', {'type' => 'simple_style'},
! 12596: 'email', {'args' => ['code', 'normal'],
! 12597: 'function' => \&t2h_default_email,
! 12598: 'type' => 'simple_style'},
! 12599: #'email', {'args' => ['normal', 'normal'],
! 12600: # 'function' => \&t2h_default_email},
! 12601: 'emph', {},
! 12602: 'env', {'args' => ['code']},
! 12603: 'file', {'args' => ['code'], 'quote' => '"'},
! 12604: 'headitemfont', {},
! 12605: 'i', {},
! 12606: 'slanted', {},
! 12607: 'sansserif', {},
! 12608: 'kbd', {'args' => ['code'], },
! 12609: 'key', {'args' => ['code'], 'begin' => '<', 'end' => '>'},
! 12610: 'math', {'function' => \&t2h_default_math, 'args' => ['math'] },
! 12611: 'option', {'args' => ['code'], 'quote' => '"'},
! 12612: 'r', {},
! 12613: 'samp', {'args' => ['code'], 'quote' => '"'},
! 12614: # 'sc', {'function' => \&t2h_default_sc},
! 12615: 'sc', {},
! 12616: 'strong', {},
! 12617: 't', {},
! 12618: 'uref', {'function' => \&t2h_default_uref,
! 12619: 'args' => ['code', 'normal', 'normal'],
! 12620: 'type' => 'simple_style' },
! 12621: #'uref', {'function' => \&t2h_default_uref,
! 12622: # 'args' => ['normal', 'normal', 'normal']},
! 12623: 'url', {'function' => \&t2h_default_uref,
! 12624: 'args' => ['code', 'normal', 'normal'],
! 12625: 'type' => 'simple_style'},
! 12626: 'indicateurl', {'args' => ['code'], 'begin' => '<', 'end' => '>','type' => 'simple_style'},
! 12627: 'var', {},
! 12628: 'verb', {'args' => ['code'], },
! 12629: 'titlefont', {'function' => \&t2h_default_titlefont,
! 12630: 'type' => 'simple_style'},
! 12631: 'w', {},
! 12632: 'hyphenation', {'function' => \&t2h_default_hyphenation, 'args' => ['keep']},
! 12633: );
! 12634:
! 12635: %command_type = ();
! 12636:
! 12637: foreach my $style (keys(%style_map))
! 12638: {
! 12639: if (exists($style_map{$style}->{'type'}))
! 12640: {
! 12641: $command_type{$style} = $style_map{$style}->{'type'};
! 12642: }
! 12643: else
! 12644: {
! 12645: $command_type{$style} = 'style';
! 12646: }
! 12647: }
! 12648:
! 12649:
! 12650: sub t2h_default_select_substitution($$$)
! 12651: {
! 12652: my $in_raw_text = shift;
! 12653: my $in_preformatted = shift;
! 12654: my $in_simple = shift;
! 12655:
! 12656: my $substitutions = \@text_substitutions_normal;
! 12657: if ($in_raw_text)
! 12658: {
! 12659: $substitutions = \@text_substitutions_texi;
! 12660: }
! 12661: elsif ($in_simple)
! 12662: {
! 12663: $substitutions = \@text_substitutions_simple_format;
! 12664: }
! 12665: elsif ($in_preformatted)
! 12666: {
! 12667: $substitutions = \@text_substitutions_pre;
! 12668: }
! 12669: return $substitutions;
! 12670: }
! 12671:
! 12672: sub t2h_text_substitutions($$$$)
! 12673: {
! 12674: my $text = shift;
! 12675: my $in_raw_text = shift;
! 12676: my $in_preformatted = shift;
! 12677: my $in_simple = shift;
! 12678:
! 12679: my $substitutions = t2h_default_select_substitution($in_raw_text, $in_preformatted, $in_simple);
! 12680: foreach my $substitution_entry (@$substitutions)
! 12681: {
! 12682: my $from = quotemeta($substitution_entry->[0]);
! 12683: my $to = $substitution_entry->[1];
! 12684: $text =~ s/$from/$to/g;
! 12685: }
! 12686: return $text;
! 12687: }
! 12688:
! 12689: sub t2h_add_text_substitutions($$$$$)
! 12690: {
! 12691: my $entry = shift;
! 12692: my $in_normal = shift;
! 12693: my $in_raw_text = shift;
! 12694: my $in_preformatted = shift;
! 12695: my $in_simple = shift;
! 12696:
! 12697: my @formats_to_be_done = ($in_normal, $in_raw_text, $in_preformatted, $in_simple);
! 12698:
! 12699: for (my $index = 0; $index < scalar(@formats_to_be_done); $index++)
! 12700: {
! 12701: next unless ($formats_to_be_done[$index]);
! 12702: my @args = (0, 0, 0);
! 12703: my $found = 0;
! 12704: $args[$index -1] = 1 if ($index > 0);
! 12705: my $substitutions = &t2h_default_select_substitution(@args);
! 12706: foreach my $substitution_entry (@$substitutions)
! 12707: {
! 12708: if ($substitution_entry->[0] eq $entry->[0])
! 12709: {
! 12710: $found = 1;
! 12711: $substitution_entry->[1] = $entry->[1];
! 12712: }
! 12713: }
! 12714: push @$substitutions, $entry unless ($found);
! 12715: }
! 12716: }
! 12717:
! 12718: sub t2h_remove_text_substitutions($$$$$)
! 12719: {
! 12720: my $entry = shift;
! 12721: my $in_normal = shift;
! 12722: my $in_raw_text = shift;
! 12723: my $in_preformatted = shift;
! 12724: my $in_simple = shift;
! 12725:
! 12726: my @formats_to_be_done = ($in_normal, $in_raw_text, $in_preformatted, $in_simple);
! 12727:
! 12728: for (my $index = 0; $index < scalar(@formats_to_be_done); $index++)
! 12729: {
! 12730: next unless ($formats_to_be_done[$index]);
! 12731: my @args = (0, 0, 0);
! 12732: $args[$index -1] = 1 if ($index > 0);
! 12733: my $substitutions = &t2h_default_select_substitution(@args);
! 12734:
! 12735: @$substitutions = grep {$_->[0] ne $entry} @$substitutions;
! 12736: }
! 12737: }
! 12738:
! 12739:
! 12740: %unicode_diacritical = (
! 12741: 'H' => '030B',
! 12742: 'ringaccent' => '030A',
! 12743: "'" => '0301',
! 12744: 'v' => '030C',
! 12745: ',' => '0327',
! 12746: '^' => '0302',
! 12747: 'dotaccent' => '0307',
! 12748: '`' => '0300',
! 12749: '=' => '0304',
! 12750: '~' => '0303',
! 12751: '"' => '0308',
! 12752: 'udotaccent' => '0323',
! 12753: 'ubaraccent' => '0332',
! 12754: 'u' => '0306',
! 12755: 'tieaccent' => '0361',
! 12756: 'ogonek' => '0328'
! 12757: );
! 12758:
! 12759: %unicode_accents = (
! 12760: 'dotaccent' => { # dot above
! 12761: 'A' => '0226', #C moz-1.2
! 12762: 'a' => '0227', #c moz-1.2
! 12763: 'B' => '1E02',
! 12764: 'b' => '1E03',
! 12765: 'C' => '010A',
! 12766: 'c' => '010B',
! 12767: 'D' => '1E0A',
! 12768: 'd' => '1E0B',
! 12769: 'E' => '0116',
! 12770: 'e' => '0117',
! 12771: 'F' => '1E1E',
! 12772: 'f' => '1E1F',
! 12773: 'G' => '0120',
! 12774: 'g' => '0121',
! 12775: 'H' => '1E22',
! 12776: 'h' => '1E23',
! 12777: 'i' => '0069',
! 12778: 'I' => '0130',
! 12779: 'N' => '1E44',
! 12780: 'n' => '1E45',
! 12781: 'O' => '022E', #Y moz-1.2
! 12782: 'o' => '022F', #v moz-1.2
! 12783: 'P' => '1E56',
! 12784: 'p' => '1E57',
! 12785: 'R' => '1E58',
! 12786: 'r' => '1E59',
! 12787: 'S' => '1E60',
! 12788: 's' => '1E61',
! 12789: 'T' => '1E6A',
! 12790: 't' => '1E6B',
! 12791: 'W' => '1E86',
! 12792: 'w' => '1E87',
! 12793: 'X' => '1E8A',
! 12794: 'x' => '1E8B',
! 12795: 'Y' => '1E8E',
! 12796: 'y' => '1E8F',
! 12797: 'Z' => '017B',
! 12798: 'z' => '017C',
! 12799: },
! 12800: 'udotaccent' => { # dot below
! 12801: 'A' => '1EA0',
! 12802: 'a' => '1EA1',
! 12803: 'B' => '1E04',
! 12804: 'b' => '1E05',
! 12805: 'D' => '1E0C',
! 12806: 'd' => '1E0D',
! 12807: 'E' => '1EB8',
! 12808: 'e' => '1EB9',
! 12809: 'H' => '1E24',
! 12810: 'h' => '1E25',
! 12811: 'I' => '1ECA',
! 12812: 'i' => '1ECB',
! 12813: 'K' => '1E32',
! 12814: 'k' => '1E33',
! 12815: 'L' => '1E36',
! 12816: 'l' => '1E37',
! 12817: 'M' => '1E42',
! 12818: 'm' => '1E43',
! 12819: 'N' => '1E46',
! 12820: 'n' => '1E47',
! 12821: 'O' => '1ECC',
! 12822: 'o' => '1ECD',
! 12823: 'R' => '1E5A',
! 12824: 'r' => '1E5B',
! 12825: 'S' => '1E62',
! 12826: 's' => '1E63',
! 12827: 'T' => '1E6C',
! 12828: 't' => '1E6D',
! 12829: 'U' => '1EE4',
! 12830: 'u' => '1EE5',
! 12831: 'V' => '1E7E',
! 12832: 'v' => '1E7F',
! 12833: 'W' => '1E88',
! 12834: 'w' => '1E89',
! 12835: 'Y' => '1EF4',
! 12836: 'y' => '1EF5',
! 12837: 'Z' => '1E92',
! 12838: 'z' => '1E93',
! 12839: },
! 12840: 'ubaraccent' => { # line below
! 12841: 'B' => '1E06',
! 12842: 'b' => '1E07',
! 12843: 'D' => '1E0E',
! 12844: 'd' => '1E0F',
! 12845: 'h' => '1E96',
! 12846: 'K' => '1E34',
! 12847: 'k' => '1E35',
! 12848: 'L' => '1E3A',
! 12849: 'l' => '1E3B',
! 12850: 'N' => '1E48',
! 12851: 'n' => '1E49',
! 12852: 'R' => '1E5E',
! 12853: 'r' => '1E5F',
! 12854: 'T' => '1E6E',
! 12855: 't' => '1E6F',
! 12856: 'Z' => '1E94',
! 12857: 'z' => '1E95',
! 12858: },
! 12859: ',' => { # cedilla
! 12860: 'C' => '00C7',
! 12861: 'c' => '00E7',
! 12862: 'D' => '1E10',
! 12863: 'd' => '1E11',
! 12864: 'E' => '0228', #C moz-1.2
! 12865: 'e' => '0229', #c moz-1.2
! 12866: 'G' => '0122',
! 12867: 'g' => '0123',
! 12868: 'H' => '1E28',
! 12869: 'h' => '1E29',
! 12870: 'K' => '0136',
! 12871: 'k' => '0137',
! 12872: 'L' => '013B',
! 12873: 'l' => '013C',
! 12874: 'N' => '0145',
! 12875: 'n' => '0146',
! 12876: 'R' => '0156',
! 12877: 'r' => '0157',
! 12878: 'S' => '015E',
! 12879: 's' => '015F',
! 12880: 'T' => '0162',
! 12881: 't' => '0163',
! 12882: },
! 12883: '=' => { # macron
! 12884: 'A' => '0100',
! 12885: 'a' => '0101',
! 12886: 'E' => '0112',
! 12887: 'e' => '0113',
! 12888: 'I' => '012A',
! 12889: 'i' => '012B',
! 12890: 'G' => '1E20',
! 12891: 'g' => '1E21',
! 12892: 'O' => '014C',
! 12893: 'o' => '014D',
! 12894: 'U' => '016A',
! 12895: 'u' => '016B',
! 12896: 'Y' => '0232', #? moz-1.2
! 12897: 'y' => '0233', #? moz-1.2
! 12898: },
! 12899: '"' => { # diaeresis
! 12900: 'A' => '00C4',
! 12901: 'a' => '00E4',
! 12902: 'E' => '00CB',
! 12903: 'e' => '00EB',
! 12904: 'H' => '1E26',
! 12905: 'h' => '1E27',
! 12906: 'I' => '00CF',
! 12907: 'i' => '00EF',
! 12908: 'O' => '00D6',
! 12909: 'o' => '00F6',
! 12910: 't' => '1E97',
! 12911: 'U' => '00DC',
! 12912: 'u' => '00FC',
! 12913: 'W' => '1E84',
! 12914: 'w' => '1E85',
! 12915: 'X' => '1E8C',
! 12916: 'x' => '1E8D',
! 12917: 'y' => '00FF',
! 12918: 'Y' => '0178',
! 12919: },
! 12920: 'u' => { # breve
! 12921: 'A' => '0102',
! 12922: 'a' => '0103',
! 12923: 'E' => '0114',
! 12924: 'e' => '0115',
! 12925: 'G' => '011E',
! 12926: 'g' => '011F',
! 12927: 'I' => '012C',
! 12928: 'i' => '012D',
! 12929: 'O' => '014E',
! 12930: 'o' => '014F',
! 12931: 'U' => '016C',
! 12932: 'u' => '016D',
! 12933: },
! 12934: "'" => { # acute
! 12935: 'A' => '00C1',
! 12936: 'a' => '00E1',
! 12937: 'C' => '0106',
! 12938: 'c' => '0107',
! 12939: 'E' => '00C9',
! 12940: 'e' => '00E9',
! 12941: 'G' => '01F4',
! 12942: 'g' => '01F5',
! 12943: 'I' => '00CD',
! 12944: 'i' => '00ED',
! 12945: 'K' => '1E30',
! 12946: 'k' => '1E31',
! 12947: 'L' => '0139',
! 12948: 'l' => '013A',
! 12949: 'M' => '1E3E',
! 12950: 'm' => '1E3F',
! 12951: 'N' => '0143',
! 12952: 'n' => '0144',
! 12953: 'O' => '00D3',
! 12954: 'o' => '00F3',
! 12955: 'P' => '1E54',
! 12956: 'p' => '1E55',
! 12957: 'R' => '0154',
! 12958: 'r' => '0155',
! 12959: 'S' => '015A',
! 12960: 's' => '015B',
! 12961: 'U' => '00DA',
! 12962: 'u' => '00FA',
! 12963: 'W' => '1E82',
! 12964: 'w' => '1E83',
! 12965: 'Y' => '00DD',
! 12966: 'y' => '00FD',
! 12967: 'Z' => '0179',
! 12968: 'z' => '018A',
! 12969: },
! 12970: '~' => { # tilde
! 12971: 'A' => '00C3',
! 12972: 'a' => '00E3',
! 12973: 'E' => '1EBC',
! 12974: 'e' => '1EBD',
! 12975: 'I' => '0128',
! 12976: 'i' => '0129',
! 12977: 'N' => '00D1',
! 12978: 'n' => '00F1',
! 12979: 'O' => '00D5',
! 12980: 'o' => '00F5',
! 12981: 'U' => '0168',
! 12982: 'u' => '0169',
! 12983: 'V' => '1E7C',
! 12984: 'v' => '1E7D',
! 12985: 'Y' => '1EF8',
! 12986: 'y' => '1EF9',
! 12987: },
! 12988: '`' => { # grave
! 12989: 'A' => '00C0',
! 12990: 'a' => '00E0',
! 12991: 'E' => '00C8',
! 12992: 'e' => '00E8',
! 12993: 'I' => '00CC',
! 12994: 'i' => '00EC',
! 12995: 'N' => '01F8',
! 12996: 'n' => '01F9',
! 12997: 'O' => '00D2',
! 12998: 'o' => '00F2',
! 12999: 'U' => '00D9',
! 13000: 'u' => '00F9',
! 13001: 'W' => '1E80',
! 13002: 'w' => '1E81',
! 13003: 'Y' => '1EF2',
! 13004: 'y' => '1EF3',
! 13005: },
! 13006: '^' => { # circumflex
! 13007: 'A' => '00C2',
! 13008: 'a' => '00E2',
! 13009: 'C' => '0108',
! 13010: 'c' => '0109',
! 13011: 'E' => '00CA',
! 13012: 'e' => '00EA',
! 13013: 'G' => '011C',
! 13014: 'g' => '011D',
! 13015: 'H' => '0124',
! 13016: 'h' => '0125',
! 13017: 'I' => '00CE',
! 13018: 'i' => '00EE',
! 13019: 'J' => '0134',
! 13020: 'j' => '0135',
! 13021: 'O' => '00D4',
! 13022: 'o' => '00F4',
! 13023: 'S' => '015C',
! 13024: 's' => '015D',
! 13025: 'U' => '00DB',
! 13026: 'u' => '00FB',
! 13027: 'W' => '0174',
! 13028: 'w' => '0175',
! 13029: 'Y' => '0176',
! 13030: 'y' => '0177',
! 13031: 'Z' => '1E90',
! 13032: 'z' => '1E91',
! 13033: },
! 13034: 'ringaccent' => { # ring
! 13035: 'A' => '00C5',
! 13036: 'a' => '00E5',
! 13037: 'U' => '016E',
! 13038: 'u' => '016F',
! 13039: 'w' => '1E98',
! 13040: 'y' => '1E99',
! 13041: },
! 13042: 'v' => { # caron
! 13043: 'A' => '01CD',
! 13044: 'a' => '01CE',
! 13045: 'C' => '010C',
! 13046: 'c' => '010D',
! 13047: 'D' => '010E',
! 13048: 'd' => '010F',
! 13049: 'E' => '011A',
! 13050: 'e' => '011B',
! 13051: 'G' => '01E6',
! 13052: 'g' => '01E7',
! 13053: 'H' => '021E', #K with moz-1.2
! 13054: 'h' => '021F', #k with moz-1.2
! 13055: 'I' => '01CF',
! 13056: 'i' => '01D0',
! 13057: 'K' => '01E8',
! 13058: 'k' => '01E9',
! 13059: 'L' => '013D', #L' with moz-1.2
! 13060: 'l' => '013E', #l' with moz-1.2
! 13061: 'N' => '0147',
! 13062: 'n' => '0148',
! 13063: 'O' => '01D1',
! 13064: 'o' => '01D2',
! 13065: 'R' => '0158',
! 13066: 'r' => '0159',
! 13067: 'S' => '0160',
! 13068: 's' => '0161',
! 13069: 'T' => '0164',
! 13070: 't' => '0165',
! 13071: 'U' => '01D3',
! 13072: 'u' => '01D4',
! 13073: 'Z' => '017D',
! 13074: 'z' => '017E',
! 13075: },
! 13076: 'H' => { # double acute
! 13077: 'O' => '0150',
! 13078: 'o' => '0151',
! 13079: 'U' => '0170',
! 13080: 'u' => '0171',
! 13081: },
! 13082: 'ogonek' => {
! 13083: 'A' => '0104',
! 13084: 'a' => '0105',
! 13085: 'E' => '0118',
! 13086: 'e' => '0119',
! 13087: 'I' => '012E',
! 13088: 'i' => '012F',
! 13089: 'U' => '0172',
! 13090: 'u' => '0173',
! 13091: 'O' => '01EA',
! 13092: 'o' => '01EB',
! 13093: },
! 13094: );
! 13095:
! 13096: foreach my $accent_command ('tieaccent', 'dotless', keys(%unicode_accents))
! 13097: {
! 13098: $style_map{$accent_command} = { 'function' => \&t2h_default_accent };
! 13099: $old_style_map{$accent_command} = '&default_accent';
! 13100: $style_map_texi{$accent_command} = { 'function' => \&t2h_default_accent };
! 13101: }
! 13102:
! 13103:
! 13104: %transliterate_accent_map = ();
! 13105: foreach my $command (keys(%unicode_accents))
! 13106: {
! 13107: foreach my $letter(keys (%{$unicode_accents{$command}}))
! 13108: {
! 13109: $transliterate_accent_map{$unicode_accents{$command}->{$letter}}
! 13110: = $letter
! 13111: unless (exists($transliterate_map{$unicode_accents{$command}->{$letter}}));
! 13112: }
! 13113: }
! 13114:
! 13115: sub default_accent($$)
! 13116: {
! 13117: my $text = shift;
! 13118: my $accent = shift;
! 13119: return "&${text}$accent_map{$accent};" if (defined($accent_map{$accent}) and defined($special_accents{$accent}) and ($text =~ /^[$special_accents{$accent}]$/));
! 13120: return '&' . $text . 'ring;' if (($accent eq 'ringaccent') and (defined($special_accents{$accent})) and ($text =~ /^[$special_accents{$accent}]$/));
! 13121: return $text . '<' if ($accent eq 'v');
! 13122: return ascii_accents($text, $accent);
! 13123: }
! 13124:
! 13125: sub t2h_default_accent($$)
! 13126: {
! 13127: my $accent = shift;
! 13128: my $args = shift;
! 13129:
! 13130: my $text = $args->[0];
! 13131:
! 13132: return ascii_accents($text, $accent);
! 13133: }
! 13134:
! 13135: ####################################################################
! 13136: # special accent/encoding commands
! 13137: #
! 13138: # Some functions used to override normal formatting functions in specific
! 13139: # cases. The user shouldn't want to change them, but can use them.
! 13140: #
! 13141:
! 13142: sub ascii_accents($$)
! 13143: {
! 13144: my $text = shift;
! 13145: my $accent = shift;
! 13146: return $text if ($accent eq 'dotless');
! 13147: return $text . "''" if ($accent eq 'H');
! 13148: return $text . '.' if ($accent eq 'dotaccent');
! 13149: return $text . '*' if ($accent eq 'ringaccent');
! 13150: return $text . '[' if ($accent eq 'tieaccent');
! 13151: return $text . '(' if ($accent eq 'u');
! 13152: return $text . '_' if ($accent eq 'ubaraccent');
! 13153: return '.' . $text if ($accent eq 'udotaccent');
! 13154: return $text . '<' if ($accent eq 'v');
! 13155: return $text . ';' if ($accent eq 'ogonek');
! 13156: return $text . $accent if (defined($accent_map{$accent}));
! 13157: }
! 13158:
! 13159: sub xml_default_accent($$)
! 13160: {
! 13161: my $accent = shift;
! 13162: my $args = shift;
! 13163:
! 13164: my $text = $args->[0];
! 13165:
! 13166: return "&${text}$accent_map{$accent};" if (defined($accent_map{$accent}) and defined($special_accents{$accent}) and ($text =~ /^[$special_accents{$accent}]$/));
! 13167: return '&' . $text . 'ring;' if (($accent eq 'ringaccent') and (defined($special_accents{$accent})) and ($text =~ /^[$special_accents{$accent}]$/));
! 13168: return $text . '<' if ($accent eq 'v');
! 13169: # FIXME here there could be a conversion to the character in the right
! 13170: # encoding, like
! 13171: # if ($USE_UNICODE and defined($OUT_ENCODING) and $OUT_ENCODING ne ''
! 13172: # and exists($unicode_accents{$accent}) and exists($unicode_accents{$accent}->{$text}))
! 13173: # {
! 13174: # my $encoded_char = Encode::encode($OUT_ENCODING, chr(hex($unicode_map{$thing})), Encode::FB_QUIET);
! 13175: # return $encoded_char if ($encoded_char ne '');
! 13176: # }
! 13177: if ($USE_NUMERIC_ENTITY)
! 13178: {
! 13179: if (exists($unicode_accents{$accent}) and exists($unicode_accents{$accent}->{$text}))
! 13180: {
! 13181: return ('&#' . hex($unicode_accents{$accent}->{$text}) . ';');
! 13182: }
! 13183: }
! 13184: return ascii_accents($text, $accent);
! 13185: }
! 13186:
! 13187: # used to utf8 encode the result
! 13188: sub t2h_utf8_accent($$$)
! 13189: {
! 13190: my $accent = shift;
! 13191: my $args = shift;
! 13192: my $style_stack = shift;
! 13193:
! 13194: my $text = $args->[0];
! 13195: #print STDERR "$accent\[".scalar(@$style_stack) ."\] (@$style_stack)\n";
! 13196:
! 13197: # special handling of @dotless{i}
! 13198: if ($accent eq 'dotless')
! 13199: {
! 13200: if (($text eq 'i') and (!defined($style_stack->[-1]) or (!defined($unicode_accents{$style_stack->[-1]})) or ($style_stack->[-1] eq 'tieaccent')))
! 13201: {
! 13202: return "\x{0131}";
! 13203: }
! 13204: #return "\x{}" if ($text eq 'j'); # not found !
! 13205: return $text;
! 13206: }
! 13207:
! 13208: # FIXME \x{0131}\x{0308} for @dotless{i} @" doesn't lead to NFC 00ef.
! 13209: return Unicode::Normalize::NFC($text . chr(hex($unicode_diacritical{$accent})))
! 13210: if (defined($unicode_diacritical{$accent}));
! 13211: return ascii_accents($text, $accent);
! 13212: }
! 13213:
! 13214: sub t2h_utf8_normal_text($$$$$$$;$)
! 13215: {
! 13216: my $text = shift;
! 13217: my $in_raw_text = shift;
! 13218: my $in_preformatted = shift;
! 13219: my $in_code = shift;
! 13220: my $in_math = shift;
! 13221: my $in_simple = shift;
! 13222: my $style_stack = shift;
! 13223: my $state = shift;
! 13224:
! 13225: $text = &$protect_text($text) unless($in_raw_text);
! 13226: $text = uc($text) if (in_small_caps($style_stack));
! 13227:
! 13228: if (!$in_code and !$in_preformatted)
! 13229: {
! 13230: $text =~ s/---/\x{2014}/g;
! 13231: $text =~ s/--/\x{2013}/g;
! 13232: $text =~ s/``/\x{201C}/g;
! 13233: $text =~ s/''/\x{201D}/g;
! 13234: }
! 13235: $text = t2h_text_substitutions($text, $in_raw_text, ($in_preformatted or $in_code), $in_simple);
! 13236: return Unicode::Normalize::NFC($text);
! 13237: }
! 13238:
! 13239: sub t2h_enable_encoding_normal_accent($$$)
! 13240: {
! 13241: return t2h_enable_encoding_accent ('normal', @_);
! 13242: }
! 13243: sub t2h_enable_encoding_texi_accent($$$)
! 13244: {
! 13245: return t2h_enable_encoding_accent ('texi', @_);
! 13246: }
! 13247: sub t2h_enable_encoding_pre_accent($$$)
! 13248: {
! 13249: return t2h_enable_encoding_accent ('pre', @_);
! 13250: }
! 13251:
! 13252: sub t2h_enable_encoding_accent($$$$)
! 13253: {
! 13254: my $context = shift;
! 13255: my @other_args = @_;
! 13256:
! 13257: my $accent = shift;
! 13258: my $args = shift;
! 13259: my $style_stack = shift;
! 13260: my $text = $args->[0];
! 13261:
! 13262: #print STDERR "enable_encoding_accent called($context) $accent (@$style_stack)\n";
! 13263:
! 13264: # in case ENCODING_NAME is not known, the accent functions saved previously
! 13265: # are used.
! 13266: # This should happen rarely, like during @setfilename parsing.
! 13267: return &{$t2h_enable_encoding_default_accent{$context}->{$accent}}(@other_args) if (!defined($Texi2HTML::THISDOC{'ENCODING_NAME'}));
! 13268:
! 13269: return t2h_utf8_accent($accent,[$text],$style_stack) if ($Texi2HTML::THISDOC{'ENCODING_NAME'} eq 'utf-8');
! 13270:
! 13271: # use the saved default handling if this is not a known 8 bit encoding
! 13272: return &{$t2h_enable_encoding_default_accent{$context}->{$accent}}(@other_args) if (!exists($makeinfo_encoding_to_map{$Texi2HTML::THISDOC{'ENCODING_NAME'}}));
! 13273:
! 13274: # the following is for the handling of known 8 bit encodings.
! 13275: if (scalar(@t2h_enable_encoding_accents_stack))
! 13276: {
! 13277: # in that case, we already have a result ready that corresponds with the
! 13278: # formatting of a part of the stack mapped to
! 13279: # t2h_enable_encoding_accents_stack, so it is emptied and the innermost
! 13280: # $text is returned as is, such that the unmodified already formatted
! 13281: # innermost formatted accented text is returned.
! 13282:
! 13283: #print STDERR " doing nothing, still in stack (@t2h_enable_encoding_accents_stack), accent: $accent";
! 13284: my $stack_accent = shift @t2h_enable_encoding_accents_stack;
! 13285: #print STDERR " stack_accent $stack_accent\n";
! 13286: return $text;
! 13287: }
! 13288:
! 13289: # in that case there is no t2h_enable_encoding_accents_stack, so we are
! 13290: # at the closing of the innermost accented command. We will try to format
! 13291: # all the stack in reverse(@$style_stack) that coresponds with
! 13292: # accent commands
! 13293: my @accents_stack = ();
! 13294: my @styles = reverse(@$style_stack);
! 13295:
! 13296: # accents are formatted and the intermediate results are kept, such
! 13297: # that we can return the maximum of multiaccented letters that can be
! 13298: # rendered with a given eight bit formatting.
! 13299:
! 13300: # first put the letter in the stack
! 13301: my @utf8_partial_results = { 'result' => $text,
! 13302: 'accents_stack' => [ @accents_stack ]};
! 13303:
! 13304: # then the accent that is associated with the function call
! 13305: my $current_accent = t2h_utf8_accent($accent,[$text],$style_stack);
! 13306: @accents_stack = ($accent);
! 13307: push @utf8_partial_results, { 'result' => $current_accent,
! 13308: 'accents_stack' => [ @accents_stack ]};
! 13309:
! 13310: # and then all the other accents on the stack
! 13311: while (scalar(@styles) and (defined($unicode_accents{$styles[0]}) or $styles[0] eq 'dotless'))
! 13312: {
! 13313: my $next_style = shift @styles;
! 13314: my @new_stack = reverse(@styles);
! 13315: $current_accent = t2h_utf8_accent($next_style,[$current_accent],\@new_stack);
! 13316: push @accents_stack, $next_style;
! 13317: push @utf8_partial_results, { 'result' => $current_accent,
! 13318: 'accents_stack' => [ @accents_stack ]}
! 13319: ;
! 13320: }
! 13321:
! 13322: my $enc_map = $makeinfo_encoding_to_map{$Texi2HTML::THISDOC{'ENCODING_NAME'}};
! 13323: my $eight_bit;
! 13324: my $result;
! 13325: # At this point we have the utf8 encoded results for the accent
! 13326: # commands stack, with all the intermediate results.
! 13327: # For each one we'll check if it is possible to encode it in the
! 13328: # current eight bit output encoding table
! 13329: foreach my $partial_result (@utf8_partial_results)
! 13330: {
! 13331: my $char = $partial_result->{'result'};
! 13332: my $new_eight_bit = '';
! 13333: my $new_codepoint;
! 13334:
! 13335: if (ord($char) <= 128)
! 13336: {
! 13337: $new_eight_bit = uc(sprintf("%02x",ord($char)));
! 13338: $new_codepoint = uc(sprintf("%04x",ord($char)));
! 13339: }
! 13340: elsif (ord($char) <= hex(0xFFFF))
! 13341: {
! 13342: $new_codepoint = uc(sprintf("%04x",ord($char)));
! 13343: if (exists($makeinfo_unicode_to_eight_bit{$enc_map}->{$new_codepoint}))
! 13344: {
! 13345: $new_eight_bit = $makeinfo_unicode_to_eight_bit{$enc_map}->{$new_codepoint};
! 13346: }
! 13347: }
! 13348: #my $eight_bit_txt = 'undef';
! 13349: #$eight_bit_txt = $eight_bit if (defined($eight_bit));
! 13350: #print STDERR "" . Encode::encode('utf8', "$char") . " (@{$partial_result->{'accents_stack'}}), new_codepoint: $new_codepoint 8bit: $new_eight_bit old:$eight_bit_txt\n";
! 13351: # no corresponding eight bit character found
! 13352: last if ($new_eight_bit eq '');
! 13353:
! 13354: # in that case, the new eight bit character is the same than the one
! 13355: # found with one less character (and it isnt a @dotless{i}). It may
! 13356: # mean 2 things
! 13357: # -> there are 2 characters in accent. This could happen, for example
! 13358: # if an accent that cannot be rendered is found and it leads to
! 13359: # appending or prepending a character. For example this happens for
! 13360: # @={@,{@~{n}}}, where @,{@~{n}} is expanded to a 2 character:
! 13361: # n with a tilde, followed by a ,
! 13362: # In nthat case, the additional utf8 accent is prepended, which
! 13363: # means that it is composed with the , and leaves n with a tilde
! 13364: # untouched.
! 13365: # -> ord(char) leads to the same for the more inner character.
! 13366: # this, for example, happens for @ubaraccent{a}, where ord(a) is
! 13367: # the same than ord(a with underbar).
! 13368: last if (defined($eight_bit) and (($new_eight_bit eq $eight_bit)
! 13369: and !($partial_result->{'accents_stack'}[0] eq 'dotless' and $char eq 'i')));
! 13370: $result = $partial_result;
! 13371: $eight_bit = $new_eight_bit;
! 13372: }
! 13373: if (defined($result) and scalar(@{$result->{'accents_stack'}}))
! 13374: {
! 13375: # we got a result, return it and put in t2h_enable_encoding_accents_stack
! 13376: # the stack of accent commands that were processed. They wont be used
! 13377: # further, but only unshifted.
! 13378:
! 13379: #print STDERR "Result: ".Encode::encode('utf8', $result->{'result'}) ." '$eight_bit' (@{$result->{'accents_stack'}})\n" if defined($result);
! 13380: @t2h_enable_encoding_accents_stack = @{$result->{'accents_stack'}};
! 13381: # remove the first, it is the accent being processed
! 13382: shift @t2h_enable_encoding_accents_stack;
! 13383: # it should be noted that we return the 'utf8' accent (which is really
! 13384: # a codepoint, and not the eight bit representation, we leave the
! 13385: # conversion to perl, which should handle it fine
! 13386: return $result->{'result'};
! 13387: }
! 13388:
! 13389: return &{$t2h_enable_encoding_default_accent{$context}->{$accent}}(@other_args);
! 13390: }
! 13391:
! 13392: # end special accent/encoding commands
! 13393: ####################################################################
! 13394:
! 13395: ####################################################################
! 13396: # TeX/LaTeX, that can especially be used in @math
! 13397: # To load the appropriate hash, use
! 13398: # default_load_tex_math
! 13399:
! 13400: my %tex_default_simple_map_math = (
! 13401: '{' => '\{',
! 13402: '}' => '\}',
! 13403: '\\' => '\\'
! 13404: );
! 13405:
! 13406: my %tex_default_math_things_map = %default_things_map;
! 13407:
! 13408: $tex_default_math_things_map{'bullet'} = '\bullet';
! 13409: $tex_default_math_things_map{'copyright'} = '\copyright';
! 13410: $tex_default_math_things_map{'registeredsymbol'} = '\circledR';
! 13411: $tex_default_math_things_map{'dots'} = '\dots';
! 13412: $tex_default_math_things_map{'endots'} = '\dots';
! 13413: $tex_default_math_things_map{'equiv'} = '\equiv';
! 13414: $tex_default_math_things_map{'expansion'} = '\mapsto';
! 13415: $tex_default_math_things_map{'arrow'} = '\rightarrow';
! 13416: $tex_default_math_things_map{'point'} = '\star';
! 13417: $tex_default_math_things_map{'print'} = '\dashv';
! 13418: $tex_default_math_things_map{'result'} = '\Rightarrow';
! 13419: $tex_default_math_things_map{'pounds'} = '\pounds';
! 13420: $tex_default_math_things_map{'geq'} = '\geq';
! 13421: $tex_default_math_things_map{'leq'} = '\leq';
! 13422: $tex_default_math_things_map{'textdegree'} = '^\circ';
! 13423:
! 13424: my %latex_default_math_things_map = %tex_default_math_things_map;
! 13425:
! 13426: $latex_default_math_things_map{'aa'} = '\mathring{a}';
! 13427: $latex_default_math_things_map{'AA'} = '\mathring{A}';
! 13428:
! 13429: # FIXME Maybe this should not be there since it is not for math but
! 13430: # more for a completly separate format.
! 13431: my %latex_default_things_map;
! 13432:
! 13433: foreach my $thing (keys(%default_things_map))
! 13434: {
! 13435: $latex_default_things_map{$thing} = '\\'.$thing;
! 13436: }
! 13437:
! 13438: $latex_default_things_map{'error'} = '\fbox{error}';
! 13439: $latex_default_things_map{'enddots'} = '\dots\@';
! 13440: $latex_default_things_map{'exclamdown'} = '\textexclamdown';
! 13441: $latex_default_things_map{'questiondown'} = '\textquestiondown';
! 13442: $latex_default_things_map{'tie'} = '~';
! 13443: $latex_default_things_map{'registeredsymbol'} = '\textregistered';
! 13444: $latex_default_things_map{'ordf'} = '\textordfeminine';
! 13445: $latex_default_things_map{'ordm'} = '\textordmasculine';
! 13446: $latex_default_things_map{'guillemetleft'} = '\guillemotleft';
! 13447: $latex_default_things_map{'guillemetright'} = '\guillemotright';
! 13448:
! 13449: foreach my $text_prefixed_symbols ('bullet', 'exclamdown', 'questiondown',
! 13450: 'quotedblleft', 'quotedblright', 'quoteleft', 'quoteright')
! 13451: {
! 13452: $latex_default_things_map{$text_prefixed_symbols} = '\text'.$text_prefixed_symbols;
! 13453: }
! 13454:
! 13455: foreach my $math_only ('equiv', 'expansion', 'arrow', 'minus', 'point',
! 13456: 'print', 'result', 'geq', 'leq')
! 13457: {
! 13458: $latex_default_things_map{$math_only} = '$'.$latex_default_math_things_map{$math_only}.'$';
! 13459: }
! 13460:
! 13461:
! 13462: # End TeX/LaTeX
! 13463: #############################################################
! 13464:
! 13465: sub default_sc($$)
! 13466: {
! 13467: return uc($_[0]);
! 13468: }
! 13469:
! 13470: sub default_ctrl($$)
! 13471: {
! 13472: return "^$_[0]";
! 13473: }
! 13474:
! 13475: # obsolete, no warning, but noop
! 13476: sub t2h_default_ctrl($$$)
! 13477: {
! 13478: shift;
! 13479: my $args = shift;
! 13480: #return "^$args->[0]";
! 13481: return "$args->[0]";
! 13482: }
! 13483:
! 13484: sub default_sc_pre($$)
! 13485: {
! 13486: return uc($_[0]);
! 13487: }
! 13488:
! 13489: sub default_titlefont($$)
! 13490: {
! 13491: return "<h1 class=\"titlefont\">$_[0]</h1>" if ($_[0] =~ /\S/);
! 13492: return '';
! 13493: }
! 13494:
! 13495: # Return nothing if the text is empty
! 13496: sub t2h_default_titlefont($$$)
! 13497: {
! 13498: shift;
! 13499: my $args = shift;
! 13500: my $heading = $args->[0];
! 13501: return '' unless ($heading =~ /\S/);
! 13502: return &$heading_text('@titlefont', $heading, 0);
! 13503: }
! 13504:
! 13505: # At some point in time (before 4.7?) according to the texinfo
! 13506: # manual, url shouldn't lead to a link but rather be formatted
! 13507: # like text. It is now what indicateurl do, url is the same that
! 13508: # uref with one arg. If we did like makeinfo did it would have been
! 13509: #sub url($$)
! 13510: #{
! 13511: # return '<<code>' . $_[0] . '</code>>';
! 13512: #}
! 13513: #
! 13514: # This is unused, t2h_default_uref is used instead
! 13515: sub t2h_default_url ($$)
! 13516: {
! 13517: shift;
! 13518: my $args = shift;
! 13519: my $url = shift @$args;
! 13520: $url = main::normalise_space($url);
! 13521: return '' unless ($url =~ /\S/);
! 13522: return t2h_default_url_and_text($url);
! 13523: }
! 13524:
! 13525: sub default_url ($$)
! 13526: {
! 13527: my $url = shift;
! 13528: my $command = shift;
! 13529: $url =~ s/\s*$//;
! 13530: $url =~ s/^\s*//;
! 13531: return t2h_default_url_and_text($url);
! 13532: }
! 13533:
! 13534: sub default_uref($$)
! 13535: {
! 13536: my $arg = shift;
! 13537: my $command = shift;
! 13538: my ($url, $text, $replacement);
! 13539: ($url, $text, $replacement) = split /,\s*/, $arg;
! 13540: $url =~ s/\s*$//;
! 13541: $url =~ s/^\s*//;
! 13542: $text = $replacement if (defined($replacement));
! 13543: return t2h_default_url_and_text($url, $text);
! 13544: }
! 13545:
! 13546: sub t2h_default_uref($$)
! 13547: {
! 13548: shift;
! 13549: my $args = shift;
! 13550: my $url = shift @$args;
! 13551: my $text = shift @$args;
! 13552: my $replacement = shift @$args;
! 13553: $url = main::normalise_space($url);
! 13554: $replacement = '' if (!defined($replacement));
! 13555: $replacement = main::normalise_space($replacement);
! 13556: $text = '' if (!defined($text));
! 13557: $text = main::normalise_space($text);
! 13558: $text = $replacement if ($replacement ne '');
! 13559: return t2h_default_url_and_text($url, $text);
! 13560: }
! 13561:
! 13562: sub t2h_default_math($$)
! 13563: {
! 13564: shift;
! 13565: my $args = shift;
! 13566: my $text = shift @$args;
! 13567: return "$text";
! 13568: }
! 13569:
! 13570: sub default_email($$)
! 13571: {
! 13572: my $arg = shift;
! 13573: my $command = shift;
! 13574: my ($mail, $text);
! 13575: ($mail, $text) = split /,\s*/, $arg;
! 13576: $mail =~ s/\s*$//;
! 13577: $mail =~ s/^\s*//;
! 13578: return t2h_default_url_and_text("mailto:$mail", $text);
! 13579: }
! 13580:
! 13581: sub t2h_default_email($$)
! 13582: {
! 13583: my $command = shift;
! 13584: my $args = shift;
! 13585: my $mail = shift @$args;
! 13586: my $text = shift @$args;
! 13587: $mail = main::normalise_space($mail);
! 13588: if (defined($text))
! 13589: {
! 13590: #$text =~ s/^\s*//;
! 13591: #$text =~ s/^\s*$//;
! 13592: $text = main::normalise_space($text);
! 13593: }
! 13594: my $mailto = '';
! 13595: $mailto = "mailto:$mail" if ($mail ne '');
! 13596: return t2h_default_url_and_text($mailto, $text);
! 13597: }
! 13598:
! 13599: sub t2h_default_click_normal($$$)
! 13600: {
! 13601: return t2h_default_click('normal', @_);
! 13602: }
! 13603:
! 13604: sub t2h_default_click_pre($$$)
! 13605: {
! 13606: return t2h_default_click('pre', @_);
! 13607: }
! 13608:
! 13609: sub t2h_default_click_texi($$$)
! 13610: {
! 13611: return t2h_default_click('texi', @_);
! 13612: }
! 13613:
! 13614: sub t2h_default_click($$$$$)
! 13615: {
! 13616: my $context = shift;
! 13617: my $command = shift;
! 13618: my $args = shift;
! 13619: my $arg = shift @$args;
! 13620: my $cmd = $Texi2HTML::THISDOC{'clickstyle'};
! 13621: $cmd = 'arrow' if (!defined($cmd) or ($cmd eq ''));
! 13622:
! 13623: my $hash = \%things_map;
! 13624: if ($context eq 'pre')
! 13625: {
! 13626: $hash = \%pre_map;
! 13627: }
! 13628: elsif ($context eq 'texi')
! 13629: {
! 13630: $hash = \%texi_map;
! 13631: }
! 13632: return $hash->{$cmd} . $arg if (exists($hash->{$cmd}));
! 13633: return $arg;
! 13634: }
! 13635:
! 13636: sub t2h_default_hyphenation($$)
! 13637: {
! 13638: my $command = shift;
! 13639: my $args = shift;
! 13640: my $text = shift @$args;
! 13641: $text =~ s/^\s*//;
! 13642: $text =~ s/\s*$//;
! 13643: my @list = split /\s+/, $text;
! 13644: foreach my $entry (@list)
! 13645: {
! 13646: my $word = $entry;
! 13647: $word =~ s/-//g;
! 13648: $Texi2HTML::THISDOC{'hyphenation'}->{$word} = $entry;
! 13649: }
! 13650: }
! 13651:
! 13652: sub t2h_default_no_texi_email
! 13653: {
! 13654: my $command = shift;
! 13655: my $args = shift;
! 13656: my $mail = shift @$args;
! 13657: my $text = shift @$args;
! 13658: $mail = main::normalise_space($mail);
! 13659: return $text if (defined($text) and ($text ne ''));
! 13660: return $mail;
! 13661: }
! 13662:
! 13663: sub t2h_default_no_texi_image($$$$)
! 13664: {
! 13665: my $command = shift;
! 13666: my $args = shift;
! 13667: my $file = $args->[0];
! 13668: $file = main::trim_around_spaces($file);
! 13669: return main::substitute_line($file, "\@$command", {'remove_texi' => 1, 'code_style' => 1});
! 13670: }
! 13671:
! 13672: sub t2h_default_no_texi_acronym_like($$)
! 13673: {
! 13674: my $command = shift;
! 13675: my $args = shift;
! 13676: my $acronym_texi = $args->[0];
! 13677: return (main::remove_texi($acronym_texi));
! 13678: }
! 13679:
! 13680: sub t2h_remove_command($$$$)
! 13681: {
! 13682: return '';
! 13683: }
! 13684:
! 13685: # This is used for style in preformatted sections
! 13686: my %old_style_map_pre = %old_style_map;
! 13687: $old_style_map_pre{'sc'} = '&default_sc_pre';
! 13688: $old_style_map_pre{'titlefont'} = '';
! 13689:
! 13690: foreach my $command (keys(%style_map))
! 13691: {
! 13692: $style_map_texi{$command} = {} if (!exists($style_map_texi{$command}));
! 13693: $style_map_texi{$command}->{'args'} = [ @{$style_map{$command}->{'args'}} ]
! 13694: if (exists($style_map{$command}->{'args'}));
! 13695: #print STDERR "COMMAND $command";
! 13696: }
! 13697:
! 13698: %style_map_pre = ();
! 13699:
! 13700: t2h_default_copy_style_map(\%style_map, \%style_map_pre);
! 13701:
! 13702: $style_map_pre{'sc'} = {};
! 13703: $style_map_pre{'titlefont'} = {};
! 13704: $style_map_pre{'click'}->{'function'} = \&t2h_default_click_pre;
! 13705:
! 13706: $style_map_texi{'sc'} = {};
! 13707: $style_map_texi{'email'}->{'function'} = \&t2h_default_no_texi_email;
! 13708: $style_map_texi{'click'}->{'function'} = \&t2h_default_click_texi;
! 13709:
! 13710: ####### special styles. You shouldn't need to change them
! 13711: %special_style = (
! 13712: #'xref' => ['keep','normal','normal','keep','normal'],
! 13713: 'xref' => { 'args' => ['keep','keep','keep','keep','keep'],
! 13714: 'function' => \&main::do_xref },
! 13715: 'ref' => { 'args' => ['keep','keep','keep','keep','keep'],
! 13716: 'function' => \&main::do_xref },
! 13717: 'pxref' => { 'args' => ['keep','keep','keep','keep','keep'],
! 13718: 'function' => \&main::do_xref },
! 13719: 'inforef' => { 'args' => ['keep','keep','keep'],
! 13720: 'function' => \&main::do_xref },
! 13721: 'image' => { 'args' => ['keep','keep','keep','keep','keep'], 'function' => \&main::do_image },
! 13722: 'anchor' => { 'args' => ['keep'], 'function' => \&main::do_anchor_label },
! 13723: 'footnote' => { 'args' => ['keep'], 'function' => \&main::do_footnote },
! 13724: 'shortcaption' => { 'args' => ['keep'], 'function' => \&main::do_caption_shortcaption },
! 13725: 'caption' => { 'args' => ['keep'], 'function' => \&main::do_caption_shortcaption },
! 13726: 'acronym', {'args' => ['keep','keep'], 'function' => \&main::do_acronym_like},
! 13727: 'abbr', {'args' => ['keep','keep'], 'function' => \&main::do_acronym_like},
! 13728: );
! 13729:
! 13730: # @image is replaced by the first arg in strings
! 13731: $style_map_texi{'image'} = { 'args' => ['keep','keep','keep','keep','keep'],
! 13732: 'function' => \&t2h_default_no_texi_image };
! 13733:
! 13734: $style_map_texi{'acronym'} = { 'args' => ['keep','keep'],
! 13735: 'function' => \&t2h_default_no_texi_acronym_like };
! 13736: $style_map_texi{'abbr'} = { 'args' => ['keep','keep'],
! 13737: 'function' => \&t2h_default_no_texi_acronym_like };
! 13738:
! 13739: foreach my $special (keys(%special_style))
! 13740: {
! 13741: $style_map{$special} = $special_style{$special}
! 13742: unless (defined($style_map{$special}));
! 13743: $style_map_pre{$special} = $special_style{$special}
! 13744: unless (defined($style_map_pre{$special}));
! 13745: $style_map_texi{$special} = { 'args' => ['keep'],
! 13746: 'function' => \&t2h_remove_command }
! 13747: unless (defined($style_map_texi{$special}));
! 13748: }
! 13749: ####### end special styles.
! 13750:
! 13751:
! 13752: #foreach my $command (keys(%style_map))
! 13753: #{
! 13754: # print STDERR "STYLE_MAP_TEXI $command($style_map_texi{$command}) ";
! 13755: # print STDERR "ARGS $style_map_texi{$command}->{'args'} " if (defined($style_map_texi{$command}->{'args'}));
! 13756: # print STDERR "FUN $style_map_texi{$command}->{'function'} " if (defined($style_map_texi{$command}->{'function'}));
! 13757: # print STDERR "\n";
! 13758: #}
! 13759:
! 13760: # uncomment to use the old interface
! 13761: #%style_map = %old_style_map;
! 13762: #%style_map_pre = %old_style_map_pre;
! 13763:
! 13764: %simple_format_simple_map_texi = %simple_map_pre;
! 13765: %simple_format_texi_map = %pre_map;
! 13766: %simple_format_style_map_texi = ();
! 13767:
! 13768: t2h_default_copy_style_map(\%style_map_texi, \%simple_format_style_map_texi);
! 13769:
! 13770: foreach my $accent_command ('tieaccent', 'dotless', keys(%unicode_accents))
! 13771: {
! 13772: # $simple_format_style_map_texi{$accent_command}->{'args'} = ['normal'];
! 13773: $simple_format_style_map_texi{$accent_command}->{'function'} = \&t2h_default_accent;
! 13774: }
! 13775:
! 13776: foreach my $hash (\%style_map, \%style_map_pre, \%style_map_texi, \%simple_format_style_map_texi)
! 13777: {
! 13778: foreach my $style (keys(%{$hash}))
! 13779: {
! 13780: $hash->{$style}->{'args'} = ['normal'] if (!exists($hash->{$style}->{'args'}));
! 13781: }
! 13782: }
! 13783:
! 13784: %default_style_map = ();
! 13785: %default_style_map_pre = ();
! 13786: %default_style_map_texi = ();
! 13787: %default_simple_format_style_map_texi = ();
! 13788:
! 13789: t2h_default_copy_style_map(\%style_map, \%default_style_map);
! 13790: t2h_default_copy_style_map(\%style_map_pre, \%default_style_map_pre);
! 13791: t2h_default_copy_style_map(\%style_map_texi, \%default_style_map_texi);
! 13792: t2h_default_copy_style_map(\%simple_format_style_map_texi, \%default_simple_format_style_map_texi);
! 13793:
! 13794: # called here because %default_style_map_texi is used.
! 13795: t2h_default_set_variables_default();
! 13796:
! 13797: #################################################################
! 13798: # TeX/LaTeX styles, that can be used in math
! 13799:
! 13800: my %default_style_tex_map;
! 13801: my %default_style_latex_map;
! 13802:
! 13803: t2h_default_copy_style_map(\%default_style_map, \%default_style_tex_map);
! 13804: t2h_default_copy_style_map(\%default_style_map, \%default_style_latex_map);
! 13805:
! 13806: # common in TeX and LaTeX and both for math and normal text
! 13807:
! 13808: $default_style_latex_map{'w'}->{'inline_begin'} = '\mbox{';
! 13809: $default_style_tex_map{'w'}->{'inline_begin'} = '\mbox{';
! 13810: $default_style_latex_map{'dmn'}->{'inline_begin'} = '{\thinspace ';
! 13811: $default_style_tex_map{'dmn'}->{'inline_begin'} = '{\thinspace ';
! 13812:
! 13813: my %default_style_latex_math_map;
! 13814:
! 13815: t2h_default_copy_style_map(\%default_style_latex_map, \%default_style_latex_math_map);
! 13816:
! 13817: my %default_tex_latex_map = (
! 13818: 'bf' => [ 'b', 'strong' ],
! 13819: 'tt' => [ 'code', 'command', 'env', 'file', 'option', 'samp', 't' ],
! 13820: 'it' => [ 'i', 'var', 'emph' ],
! 13821: 'sf' => [ 'sanserif' ],
! 13822: 'rm' => [ 'r' ],
! 13823: 'sl' => [ 'dfn', 'slanted' ],
! 13824: );
! 13825:
! 13826: foreach my $style (keys (%default_tex_latex_map))
! 13827: {
! 13828: foreach my $command (@{$default_tex_latex_map{$style}})
! 13829: {
! 13830: $default_style_tex_map{$command}->{'inline_begin'} = '{\\' . $style .' ';
! 13831: $default_style_latex_map{$command}->{'inline_begin'} = '\text' . $style .'{';
! 13832: $style = 'normal' if ($style eq 'sl');
! 13833: $default_style_latex_math_map{$command}->{'inline_begin'} = '\math' . $style .'{';
! 13834: }
! 13835: }
! 13836:
! 13837: # only in text
! 13838:
! 13839: $default_style_latex_map{'emph'}->{'inline_begin'} = '\emph{';
! 13840: $default_style_latex_map{'var'}->{'inline_begin'} = '\emph{';
! 13841: $default_style_latex_map{'sc'}->{'inline_begin'} = '\textsc{';
! 13842:
! 13843: foreach my $hash (\%default_style_tex_map, \%default_style_latex_map, \%default_style_latex_math_map)
! 13844: {
! 13845: foreach my $command (keys(%$hash))
! 13846: {
! 13847: $hash->{$command}->{'inline_end'} = '}' if ($hash->{$command}->{'inline_begin'});
! 13848: }
! 13849: }
! 13850:
! 13851: # no kbd key sc in math
! 13852: # 'kbd' - ?
! 13853: # 'key' - ?
! 13854:
! 13855: my %default_style_tex_math_map;
! 13856:
! 13857: t2h_default_copy_style_map(\%default_style_tex_map, \%default_style_tex_math_map);
! 13858:
! 13859: # We don't want to override special commands in math mode for now, as long
! 13860: # as they are not handled especially. Also we don't want to modify the math
! 13861: # function, it is called to close the @math command and we don't want
! 13862: # it to be the turned to the default one when calling
! 13863: # FIXME maybe it would be even better not to duplicate default styles in
! 13864: # math, like 'email', 'uref'....
! 13865: foreach my $command (keys(%special_style), 'math')
! 13866: {
! 13867: delete $default_style_tex_math_map{$command};
! 13868: delete $default_style_latex_math_map{$command};
! 13869: }
! 13870:
! 13871: foreach my $accent_command ('tieaccent', 'dotless', keys(%unicode_accents))
! 13872: {
! 13873: $default_style_latex_map{$accent_command} = { 'function' => \&default_tex_accent };
! 13874: $default_style_tex_map{$accent_command} = { 'function' => \&default_tex_accent };
! 13875: $default_style_tex_math_map{$accent_command} = { 'function' => \&default_tex_math_accent };
! 13876: $default_style_latex_math_map{$accent_command} = { 'function' => \&default_latex_math_accent };
! 13877: }
! 13878:
! 13879: my %tex_text_accent_map = (
! 13880: ',' => 'c',
! 13881: 'ringaccent' => 'r',
! 13882: 'dotaccent' => '.',
! 13883: 'ubaraccent' => 'b',
! 13884: 'udotaccent' => 'd',
! 13885: 'ogonek' => 'k',
! 13886: 'tieaccent' => 'tie',
! 13887: );
! 13888:
! 13889: sub default_tex_accent($$)
! 13890: {
! 13891: my $text = shift;
! 13892: my $accent = shift;
! 13893: return "\\$tex_text_accent_map{$accent}\{$text\}" if ($tex_text_accent_map{$accent});
! 13894: if ($accent eq 'dotless')
! 13895: {
! 13896: return "\\$text" if ($text eq 'i' or $text eq 'j');
! 13897: return $text;
! 13898: }
! 13899: return "\\$accent\{$text\}";
! 13900: }
! 13901:
! 13902: my %tex_math_accent_map = (
! 13903: "'" => 'acute',
! 13904: '^' => 'hat',
! 13905: '`' => 'grave',
! 13906: '~' => 'tilde',
! 13907: '"' => 'ddot',
! 13908: '=' => 'bar',
! 13909: 'dotaccent' => 'dot',
! 13910: 'u' => 'breve',
! 13911: 'ubaraccent' => 'underline',
! 13912: );
! 13913:
! 13914: sub default_latex_math_accent($$)
! 13915: {
! 13916: my $text = shift;
! 13917: my $accent = shift;
! 13918: return '\mathring{'.$text.'}' if ($accent eq 'ringaccent');
! 13919: return default_tex_math_accent($text, $accent);
! 13920: }
! 13921:
! 13922: sub default_tex_math_accent($$)
! 13923: {
! 13924: my $text = shift;
! 13925: my $accent = shift;
! 13926: return "\\$tex_text_accent_map{$accent}\{$text\}" if ($tex_text_accent_map{$accent});
! 13927: if ($accent eq 'dotless')
! 13928: {
! 13929: return "\\${text}math" if ($text eq 'i' or $text eq 'j');
! 13930: return $text;
! 13931: }
! 13932: return ascii_accent($text, $accent);
! 13933: }
! 13934:
! 13935: my $kept_normal_text;
! 13936:
! 13937: # We assume that in @math the TeX characters have already been
! 13938: # rightly protected and so don't protect once more.
! 13939: sub default_tex_normal_math_text($$$$$$$;$)
! 13940: {
! 13941: my @initial_args = @_;
! 13942: my $text = shift;
! 13943: my $in_raw_text = shift; # remove_texi
! 13944: my $in_preformatted = shift;
! 13945: my $in_code = shift;
! 13946: my $in_math = shift;
! 13947: my $in_simple = shift;
! 13948: my $style_stack = shift;
! 13949: my $state = shift;
! 13950:
! 13951: # Don't protect text in math
! 13952: if ($in_math)
! 13953: {
! 13954: $text = uc($text) if (in_cmd($style_stack, 'sc'));
! 13955: return $text;
! 13956: }
! 13957: return &kept_normal_text(@initial_args);
! 13958: }
! 13959:
! 13960: # This is the entry point to be used by users.
! 13961: sub default_load_tex_math(;$)
! 13962: {
! 13963: my $style = shift;
! 13964: $style = 'latex' if (!defined($style));
! 13965: %simple_map_math = %tex_default_simple_map_math;
! 13966: if ($style eq 'tex')
! 13967: {
! 13968: %math_map = %tex_default_math_things_map;
! 13969: t2h_default_copy_style_map(\%default_style_tex_math_map, \%style_map_math);
! 13970: }
! 13971: else
! 13972: {
! 13973: %math_map = %latex_default_math_things_map;
! 13974: t2h_default_copy_style_map(\%default_style_latex_math_map, \%style_map_math);
! 13975: }
! 13976: $kept_normal_text = $normal_text;
! 13977: $normal_text = \&default_tex_normal_math_text;
! 13978: }
! 13979:
! 13980: # End TeX/LaTeX styles
! 13981: #################################################################
! 13982:
! 13983: # regions expanded or not depending on the value of this hash.
! 13984: # @EXPAND sets entries in this hash, and you should better use
! 13985: # @EXPAND unless you know what you are doing.
! 13986: %texi_formats_map = (
! 13987: 'iftex' => 0,
! 13988: 'ignore' => 0,
! 13989: 'menu' => 0,
! 13990: 'ifplaintext' => 0,
! 13991: 'ifinfo' => 0,
! 13992: 'ifxml' => 0,
! 13993: 'ifhtml' => 0,
! 13994: 'ifdocbook' => 0,
! 13995: # 'html' => 0,
! 13996: # 'tex' => 0,
! 13997: # 'xml' => 0,
! 13998: # 'docbook' => 0,
! 13999: 'titlepage' => 1,
! 14000: 'documentdescription' => 1,
! 14001: 'copying' => 1,
! 14002: 'ifnothtml' => 1,
! 14003: 'ifnottex' => 1,
! 14004: 'ifnotplaintext' => 1,
! 14005: 'ifnotinfo' => 1,
! 14006: 'ifnotxml' => 1,
! 14007: 'ifnotdocbook' => 1,
! 14008: 'direntry' => 'normal',
! 14009: 'verbatim' => 'raw',
! 14010: 'macro' => 'raw',
! 14011: 'ifclear' => 'value',
! 14012: 'ifset' => 'value' ,
! 14013: );
! 14014:
! 14015: %format_map = (
! 14016: # 'quotation' => 'blockquote',
! 14017: # lists
! 14018: # 'itemize' => 'ul',
! 14019: 'enumerate' => '',
! 14020: # 'multitable' => 'table',
! 14021: 'table' => '',
! 14022: 'vtable' => '',
! 14023: 'ftable' => '',
! 14024: 'group' => '',
! 14025: 'raggedright' => '',
! 14026: # 'detailmenu' => '',
! 14027: );
! 14028:
! 14029: %special_list_commands = (
! 14030: 'table' => {},
! 14031: 'vtable' => {},
! 14032: 'ftable' => {},
! 14033: # 'itemize' => { 'bullet' => '' }
! 14034: 'itemize' => {},
! 14035: );
! 14036:
! 14037: %inter_item_commands = (
! 14038: 'c' => 1,
! 14039: 'comment' => 1,
! 14040: 'cindex' => 1
! 14041: );
! 14042: #
! 14043: # texinfo format to align attribute of paragraphs
! 14044: #
! 14045:
! 14046: %paragraph_style = (
! 14047: 'center' => 'center',
! 14048: 'flushleft' => 'left',
! 14049: 'flushright' => 'right',
! 14050: );
! 14051:
! 14052: # complex formats (preformatted)
! 14053: %complex_format_map = ();
! 14054: foreach my $complex_format ('example', 'smallexample', 'display',
! 14055: 'smalldisplay', 'lisp', 'smalllisp', 'format', 'smallformat',
! 14056: 'menu', 'detailmenu', 'direntry', 'menu_comment')
! 14057: {
! 14058: $complex_format_map{$complex_format} = { 'begin' => '', 'end' => '' };
! 14059: }
! 14060: foreach my $code_complex_format ('example', 'smallexample', 'lisp', 'smalllisp')
! 14061: {
! 14062: $complex_format_map{$code_complex_format}->{'style'} = 'code';
! 14063: }
! 14064:
! 14065: # not in code_style, according to post on bug-texinfo
! 14066: foreach my $format ('menu', 'detailmenu', 'direntry')
! 14067: {
! 14068: $complex_format_map{$format}->{'class'} = 'menu-preformatted';
! 14069: }
! 14070:
! 14071: # not in code_style, according to post on bug-texinfo
! 14072: $complex_format_map{'menu_comment'}->{'class'} = 'menu-comment';
! 14073:
! 14074: %def_map = (
! 14075: # basic commands
! 14076: 'deffn', [ 'f', 'category', 'name', 'arg' ],
! 14077: 'defvr', [ 'v', 'category', 'name' ],
! 14078: 'deftypefn', [ 'f', 'category', 'type', 'name', 'argtype' ],
! 14079: 'deftypeop', [ 'f', 'category', 'class' , 'type', 'name', 'argtype' ],
! 14080: 'deftypevr', [ 'v', 'category', 'type', 'name' ],
! 14081: 'defcv', [ 'v', 'category', 'class' , 'name' ],
! 14082: 'deftypecv', [ 'v', 'category', 'class' , 'type', 'name' ],
! 14083: 'defop', [ 'f', 'category', 'class' , 'name', 'arg' ],
! 14084: 'deftp', [ 't', 'category', 'name', 'argtype' ],
! 14085: # shortcuts
! 14086: # FIXME i18n
! 14087: 'defun', 'deffn Function',
! 14088: 'defmac', 'deffn Macro',
! 14089: 'defspec', 'deffn {Special Form}',
! 14090: 'defvar', 'defvr Variable',
! 14091: 'defopt', 'defvr {User Option}',
! 14092: 'deftypefun', 'deftypefn {Function}',
! 14093: 'deftypevar', 'deftypevr Variable',
! 14094: 'defivar', 'defcv {Instance Variable}',
! 14095: 'deftypeivar', 'deftypecv {Instance Variable}',
! 14096: 'defmethod', 'defop Method',
! 14097: 'deftypemethod', 'deftypeop Method',
! 14098: );
! 14099:
! 14100: $def_always_delimiters = "()[]";
! 14101: $def_in_type_delimiters = ",;";
! 14102: $def_argument_separator_delimiters = "()[],";
! 14103:
! 14104: # basic x commands
! 14105: foreach my $key (keys(%def_map))
! 14106: {
! 14107: $def_map{$key . 'x'} = $def_map{$key};
! 14108: }
! 14109:
! 14110: #
! 14111: # miscalleneous commands
! 14112: #
! 14113: # Depending on the value, the command arg or spaces following the command
! 14114: # are handled differently:
! 14115: #
! 14116: # the value is a reference on a hash.
! 14117: # the hash keys are
! 14118: # 'arg' if the value is 'line' then the remaining of the line is the arg
! 14119: # if it is a number it is the number of args (separated by spaces)
! 14120: # 'skip' if the value is 'line' then the remaining of the line is skipped
! 14121: # if the value is 'space' space but no newline is skipped
! 14122: # if the value is 'whitespace' space is skipped
! 14123: # if the value is 'linewhitespace' space is skipped if there are
! 14124: # only spaces remaining on the line
! 14125: # if the value is 'linespace' space but no newline is skipped if
! 14126: # there are only spaces remaining on the line
! 14127: # 'keep' if true the args and the macro are kept, otherwise the macro
! 14128: # args and skipped stuffs are removed
! 14129: %misc_command = (
! 14130: 'bye' => {'skip' => 'line'}, # no arg
! 14131: # set, clear
! 14132: 'set' => {'skip' => 'line'}, # special arg
! 14133: 'clear' => {'skip' => 'line'}, # special arg
! 14134: 'alias' => {'args' => 3, 'skip' => 'line'}, # special arg
! 14135: # comments
! 14136: 'comment' => {'arg' => 'line'},
! 14137: 'c' => {'arg' => 'line'},
! 14138:
! 14139: # not needed for formatting
! 14140: 'raisesections' => {'skip' => 'line'}, # no arg
! 14141: 'lowersections' => {'skip' => 'line'}, # no arg
! 14142: 'contents' => {}, # no arg
! 14143: 'shortcontents' => {}, # no arg
! 14144: 'summarycontents'=> {}, # no arg
! 14145: 'setcontentsaftertitlepage' => {}, # no arg
! 14146: 'setshortcontentsaftertitlepage' => {}, # no arg
! 14147: # 'detailmenu' => {'skip' => 'whitespace'}, # no arg
! 14148: # 'end detailmenu' => {'skip' => 'whitespace'}, # no arg
! 14149: 'clickstyle' => {'skip' => 'line'}, # arg should be an @-command
! 14150: # in preamble
! 14151: 'novalidate' => {}, # no arg
! 14152: 'dircategory'=> {'arg' => 'line'}, # line. Position with regard
! 14153: # with direntry is significant
! 14154: 'pagesizes' => {'skip' => 'line', 'arg' => 'line'}, # can have 2 args
! 14155: # or one? 200mm,150mm 11.5in
! 14156: 'finalout' => {'skip' => 'line'}, # no arg
! 14157: 'paragraphindent' => {'skip' => 'line', 'arg' => 1}, # arg none asis
! 14158: # or a number and forbids anything else on the line
! 14159: 'firstparagraphindent' => {'skip' => 'line', 'arg' => 1}, # none insert
! 14160: 'frenchspacing' => {'arg' => 1, 'skip' => 'line'}, # on off
! 14161: # not so sure about 'skip' => 'line'
! 14162: 'fonttextsize' => {'arg' => 1}, # 10 11
! 14163: 'allowcodebreaks' => {'arg' => 1, 'skip' => 'line'}, # false or true
! 14164: 'exampleindent' => {'skip' => 'line', 'arg' => 1}, # asis or a number
! 14165: 'footnotestyle'=> {'skip' => 'line', 'arg' => 1}, # end and separate
! 14166: # and nothing else on the line
! 14167: 'afourpaper' => {'skip' => 'line'}, # no arg
! 14168: 'afivepaper' => {'skip' => 'line'}, # no arg
! 14169: 'afourlatex' => {'skip' => 'line'}, # no arg
! 14170: 'afourwide' => {'skip' => 'line'}, # no arg
! 14171: 'headings'=> {'skip' => 'line', 'arg' => 1},
! 14172: #off on single double singleafter doubleafter
! 14173: # interacts with setchapternewpage
! 14174: 'setchapternewpage' => {'skip' => 'line', 'arg' => 1}, # off on odd
! 14175: 'everyheading' => {'arg' => 'line'},
! 14176: 'everyfooting' => {'arg' => 'line'},
! 14177: 'evenheading' => {'arg' => 'line'},
! 14178: 'evenfooting' => {'arg' => 'line'},
! 14179: 'oddheading' => {'arg' => 'line'},
! 14180: 'oddfooting' => {'arg' => 'line'},
! 14181: 'smallbook' => {'skip' => 'line'}, # no arg
! 14182: 'setfilename' => {'arg' => 'line'},
! 14183: 'definfoenclose' => {'arg' => 'line'},
! 14184: #'shorttitle' => {'arg' => 'line', 'texi' => 1},
! 14185: #'shorttitlepage' => {'arg' => 'line', 'texi' => 1},
! 14186: #'settitle' => {'arg' => 'line', 'texi' => 1},
! 14187: #'author' => {'arg' => 'line', 'texi' => 1},
! 14188: #'subtitle' => {'arg' => 'line', 'texi' => 1},
! 14189: #'title' => {'arg' => 'line', 'texi' => 1},
! 14190: 'shorttitle' => {'arg' => 'line'},
! 14191: 'shorttitlepage' => {'arg' => 'line'},
! 14192: 'settitle' => {'arg' => 'line'},
! 14193: 'author' => {'arg' => 'line'},
! 14194: 'subtitle' => {'arg' => 'line'},
! 14195: 'title' => {'arg' => 'line'},
! 14196: 'syncodeindex' => {'skip' => 'line', 'arg' => 2},
! 14197: # args are index identifiers
! 14198: 'synindex' => {'skip' => 'line', 'arg' => 2},
! 14199: 'defindex' => {'skip' => 'line', 'arg' => 1}, # one identifier arg
! 14200: 'defcodeindex' => {'skip' => 'line', 'arg' => 1}, # one identifier arg
! 14201: #'documentlanguage' => {'skip' => 'whitespace', 'arg' => 1},
! 14202: 'documentlanguage' => {'skip' => 'line', 'arg' => 1},
! 14203: # language code arg
! 14204: 'kbdinputstyle' => {'skip' => 'whitespace', 'arg' => 1}, # code
! 14205: #example distinct
! 14206: 'everyheadingmarks' => {'skip' => 'line', 'arg' => 1}, # top bottom
! 14207: 'everyfootingmarks' => {'skip' => 'whitespace', 'arg' => 1},
! 14208: 'evenheadingmarks' => {'skip' => 'whitespace', 'arg' => 1},
! 14209: 'oddheadingmarks' => {'skip' => 'whitespace', 'arg' => 1},
! 14210: 'evenfootingmarks' => {'skip' => 'whitespace', 'arg' => 1},
! 14211: 'oddfootingmarks' => {'skip' => 'whitespace', 'arg' => 1},
! 14212: 'sp' => {'skip' => 'line', 'arg' => 1}, # no arg
! 14213: # at the end of line or a numerical arg
! 14214: # formatting
! 14215: 'page' => {}, # no arg (pagebreak)
! 14216: 'refill' => {}, # no arg (obsolete, to be ignored)
! 14217: 'noindent' => {'skip' => 'whitespace'}, # no arg
! 14218: 'indent' => {'skip' => 'whitespace'},
! 14219: 'need' => {'skip' => 'line', 'arg' => 1}, # one numerical/real arg
! 14220: 'exdent' => {'skip' => 'space'},
! 14221: # not valid for info (should be in @iftex)
! 14222: 'vskip' => {'arg' => 'line'}, # arg line in TeX
! 14223: 'cropmarks' => {}, # no arg
! 14224: # miscalleneous
! 14225: 'verbatiminclude'=> {'skip' => 'line'},
! 14226: 'documentencoding' => {'arg' => 1, 'skip' => 'line'},
! 14227: # ???
! 14228: 'filbreak' => {},
! 14229: # obsolete @-commands. Remove spaces and end of lines after the
! 14230: # commands? If no, they can lead to empty lines
! 14231: 'quote-arg' => {'skip' => 'line'},
! 14232: 'allow-recursion' => {'skip' => 'line'},
! 14233: );
! 14234:
! 14235: my %misc_command_old = (
! 14236: # not needed for formatting
! 14237: 'raisesections', 'line', # no arg
! 14238: 'lowersections', 'line', # no arg
! 14239: 'contents', 1, # no arg
! 14240: 'shortcontents', 1, # no arg
! 14241: 'summarycontents', 1, # no arg
! 14242: 'detailmenu', 'whitespace', # no arg
! 14243: 'end detailmenu', 'whitespace', # no arg
! 14244: #'end detailmenu', 1, # no arg
! 14245: 'novalidate', 1, # no arg
! 14246: 'bye', 'line', # no arg
! 14247: # comments
! 14248: 'comment', 'line',
! 14249: 'c', 'line',
! 14250: # in preamble
! 14251: 'dircategory', 'line', # line. Position with regard with direntry is
! 14252: # significant
! 14253: 'pagesizes', 'line arg2', # can have 2 args
! 14254: 'finalout', 1, # no arg
! 14255: 'paragraphindent', 'line arg1', # in fact accepts only none asis
! 14256: # or a number and forbids anything else on the line
! 14257: 'firstparagraphindent', 'line arg1', # in fact accepts only none insert
! 14258: 'exampleindent', 'line arg1', # in fact accepts only asis or a number
! 14259: 'footnotestyle', 'line arg1', # in fact accepts only end and separate
! 14260: # and nothing else on the line
! 14261: 'afourpaper', 'line', # no arg
! 14262: 'afourlatex', 'line', # no arg
! 14263: 'afourwide', 'line', # no arg
! 14264: 'headings', 'line', # one arg, possibilities are
! 14265: #off on single double singleafter doubleafter
! 14266: # interacts with setchapternewpage
! 14267: 'setchapternewpage', 'line', # no arg
! 14268: 'everyheading', 'line',
! 14269: 'everyfooting', 'line',
! 14270: 'evenheading', 'line',
! 14271: 'evenfooting', 'line',
! 14272: 'oddheading', 'line',
! 14273: 'oddfooting', 'line',
! 14274: 'smallbook', 'line', # no arg
! 14275: 'setfilename', 'line',
! 14276: 'shorttitle', 'linetexi',
! 14277: 'shorttitlepage', 'linetexi',
! 14278: 'settitle', 'linetexi',
! 14279: 'author', 'linetexi',
! 14280: 'subtitle', 'linetexi',
! 14281: 'title','linetexi',
! 14282: 'syncodeindex','linespace arg2', # args are
! 14283: 'synindex','linespace arg2',
! 14284: 'defindex', 'line arg1', # one identifier arg
! 14285: 'defcodeindex', 'line arg1', # one identifier arg
! 14286: 'documentlanguage', 'whitespace arg1', # one language code arg
! 14287: 'kbdinputstyle', 'whitespace arg1', # one arg within
! 14288: #code example distnct
! 14289: 'sp', 'whitespace arg1', # no arg at the en of line or a numerical arg
! 14290: # formatting
! 14291: 'page', 1, # no arg (pagebreak)
! 14292: 'refill', 1, # no arg (obsolete, to be ignored))
! 14293: 'noindent', 'space', # no arg
! 14294: 'need', 'line arg1', # one numerical/real arg
! 14295: 'exdent', 'space',
! 14296: # not valid for info (should be in @iftex)
! 14297: 'vskip', 'line', # arg line in TeX
! 14298: 'cropmarks', 1, # no arg
! 14299: # miscalleneous
! 14300: 'verbatiminclude', 'line',
! 14301: 'documentencoding', 'arg1',
! 14302: # ???
! 14303: 'filbreak', 1,
! 14304: );
! 14305:
! 14306: # The command_handler arrays are for commands formatted externally.
! 14307: # The function references in @command_handler_init are called
! 14308: # before the second pass, before the @-commands text collection.
! 14309: # Those in @command_handler_process are called between the second pass
! 14310: # and the third pass, after collection of @-commands text and before their
! 14311: # expansion.
! 14312: # Those in @command_handler_process are called after the third pass,
! 14313: # after the document generation.
! 14314: @command_handler_setup = ();
! 14315: @command_handler_init = ();
! 14316: @command_handler_names = ();
! 14317: @command_handler_process = ();
! 14318: @command_handler_output = ();
! 14319: @command_handler_finish = ();
! 14320:
! 14321:
! 14322: sub t2h_default_push_handler($$)
! 14323: {
! 14324: my $function = shift;
! 14325: my $handlers = shift;
! 14326: push @$handlers, $function unless (grep {$_ eq $function} @$handlers);
! 14327: }
! 14328:
! 14329: # the keys of %command_handler are @-command names and the value
! 14330: # is a hash reference with the following keys:
! 14331: # 'init' function reference used to collect the @-command text
! 14332: # 'expand' function reference used when expanding the @-command text
! 14333: %command_handler = ();
! 14334:
! 14335:
! 14336: # formatting functions
! 14337:
! 14338: $anchor = \&t2h_default_anchor;
! 14339: $def_item = \&t2h_default_def_item;
! 14340: $def = \&t2h_default_def;
! 14341: $menu_command = \&t2h_default_menu_command;
! 14342: $menu_link = \&t2h_default_menu_link;
! 14343: #$menu_comment = \&t2h_default_menu_comment;
! 14344: $menu_description = \&t2h_default_menu_description;
! 14345: #$simple_menu_link = \&t2h_default_simple_menu_link;
! 14346: $table_item = \&t2h_default_table_item;
! 14347: $table_line = \&t2h_default_table_line;
! 14348: $table_list = \&t2h_default_table_list;
! 14349: $row = \&t2h_default_row;
! 14350: $cell = \&t2h_default_cell;
! 14351: $list_item = \&t2h_default_list_item;
! 14352: $comment = \&t2h_default_comment;
! 14353: $def_line = \&t2h_default_def_line;
! 14354: $def_line_no_texi = \&t2h_default_def_line_no_texi;
! 14355: $raw = \&t2h_default_raw;
! 14356: $raw_no_texi = \&t2h_default_raw_no_texi;
! 14357: $heading = \&t2h_default_heading;
! 14358: $heading_text = \&t2h_default_heading_text;
! 14359: $heading_text_preformatted = \&t2h_default_heading_text_preformatted;
! 14360: $element_heading = \&t2h_default_element_heading;
! 14361: $heading_no_texi = \&t2h_default_heading_no_texi;
! 14362: $external_href = \&t2h_default_external_href;
! 14363: $paragraph = \&t2h_default_paragraph;
! 14364: $preformatted = \&t2h_default_preformatted;
! 14365: $foot_line_and_ref = \&t2h_default_foot_line_and_ref;
! 14366: $foot_section = \&t2h_default_foot_section;
! 14367: $image_files = \&t2h_default_image_files;
! 14368: $image = \&t2h_default_image;
! 14369: $index_entry_label = \&t2h_default_index_entry_label;
! 14370: $index_summary = \&t2h_default_index_summary;
! 14371: $summary_letter = \&t2h_default_summary_letter;
! 14372: $index_entry = \&t2h_default_index_entry;
! 14373: $index_entry_command = \&t2h_default_index_entry_command;
! 14374: $index_letter = \&t2h_default_index_letter;
! 14375: #$printindex = \&t2h_default_printindex;
! 14376: $print_index = \&t2h_default_print_index;
! 14377: $protect_text = \&t2h_default_protect_text;
! 14378: $normal_text = \&t2h_default_normal_text;
! 14379: $cartouche = \&t2h_default_cartouche;
! 14380: $sp = \&t2h_default_sp;
! 14381: $definition_category = \&t2h_default_definition_category;
! 14382: $definition_index_entry = \&t2h_default_definition_index_entry;
! 14383: $copying_comment = \&t2h_default_copying_comment;
! 14384: $documentdescription = \&t2h_default_documentdescription;
! 14385: $index_summary_file_entry = \&t2h_default_index_summary_file_entry;
! 14386: $index_summary_file_end = \&t2h_default_index_summary_file_end;
! 14387: $index_summary_file_begin = \&t2h_default_index_summary_file_begin;
! 14388: $empty_line = \&t2h_default_empty_line;
! 14389: $float = \&t2h_default_float;
! 14390: $listoffloats = \&t2h_default_listoffloats;
! 14391: $listoffloats_entry = \&t2h_default_listoffloats_entry;
! 14392: $listoffloats_caption = \&t2h_default_listoffloats_caption;
! 14393: $listoffloats_float_style = \&t2h_default_listoffloats_float_style;
! 14394: $listoffloats_style = \&t2h_default_listoffloats_style;
! 14395: $acronym_like = \&t2h_default_acronym_like;
! 14396: $quotation = \&t2h_default_quotation;
! 14397: $paragraph_style_command = \&t2h_default_paragraph_style_command;
! 14398: $heading_texi = \&t2h_default_heading_texi;
! 14399: $index_element_heading_texi = \&t2h_default_index_element_heading_texi;
! 14400: $element_label = \&t2h_default_element_label;
! 14401: $anchor_label = \&t2h_default_anchor_label;
! 14402: $preserve_misc_command = \&t2h_default_preserve_misc_command;
! 14403: $format_list_item_texi = \&t2h_default_format_list_item_texi;
! 14404: $begin_format_texi = \&t2h_default_begin_format_texi;
! 14405: $insertcopying = \&t2h_default_insertcopying;
! 14406: $simple_command = \&t2h_default_simple_command;
! 14407: $thing_command = \&t2h_default_thing_command;
! 14408: $line_command = \&t2h_default_line_command;
! 14409: $internal_links = \&t2h_default_internal_links;
! 14410:
! 14411: # address is not used anymore
! 14412: $address = \&t2h_default_address;
! 14413:
! 14414: # return the line after preserving things according to misc_command map.
! 14415: # You should not change it. It is here, nevertheless, to be used
! 14416: # in other function references if needed.
! 14417: sub t2h_default_preserve_misc_command($$)
! 14418: {
! 14419: my $line = shift;
! 14420: my $macro = shift;
! 14421: my $text = '';
! 14422: my $args = [];
! 14423: my $skip_spec = '';
! 14424: my $arg_spec = '';
! 14425:
! 14426: #print STDERR "HHHHHHHHH $line $macro\n";
! 14427: $skip_spec = $misc_command{$macro}->{'skip'}
! 14428: if (defined($misc_command{$macro}->{'skip'}));
! 14429: $arg_spec = $misc_command{$macro}->{'arg'}
! 14430: if (defined($misc_command{$macro}->{'arg'}));
! 14431:
! 14432: if ($arg_spec eq 'line')
! 14433: {
! 14434: $text .= $line;
! 14435: $args = [ $line ];
! 14436: $line = '';
! 14437: }
! 14438: elsif ($arg_spec)
! 14439: {
! 14440: my $arg_nr = $misc_command{$macro}->{'arg'};
! 14441: while ($arg_nr)
! 14442: {
! 14443: $line =~ s/(\s+\S*)//o;
! 14444: my $argument = $1;
! 14445: if (defined($argument))
! 14446: {
! 14447: $text .= $argument;
! 14448: push @$args, $argument;
! 14449: }
! 14450: $arg_nr--;
! 14451: }
! 14452: }
! 14453:
! 14454: if ($macro eq 'bye')
! 14455: {
! 14456: $line = '';
! 14457: $text = "\n";
! 14458: }
! 14459: elsif ($skip_spec eq 'linespace')
! 14460: {
! 14461: if ($line =~ /^\s*$/o)
! 14462: {
! 14463: $line =~ s/([ \t]*)//o;
! 14464: $text .= $1;
! 14465: }
! 14466: }
! 14467: elsif ($skip_spec eq 'linewhitespace')
! 14468: {
! 14469: if ($line =~ /^\s*$/o)
! 14470: {
! 14471: $text .= $line;
! 14472: $line = '';
! 14473: }
! 14474: }
! 14475: elsif ($skip_spec eq 'line')
! 14476: {
! 14477: $text .= $line;
! 14478: $line = '';
! 14479: }
! 14480: elsif ($skip_spec eq 'whitespace')
! 14481: {
! 14482: $line =~ s/(\s*)//o;
! 14483: $text .= $1;
! 14484: }
! 14485: elsif ($skip_spec eq 'space')
! 14486: {
! 14487: $line =~ s/([ \t]*)//o;
! 14488: $text .= $1;
! 14489: }
! 14490: $line = '' if (!defined($line));
! 14491: return ($line, $text, $args);
! 14492: }
! 14493:
! 14494: sub t2h_default_simple_command($$$$$)
! 14495: {
! 14496: my $command = shift;
! 14497: my $in_preformatted = shift;
! 14498: my $in_math = shift;
! 14499: my $line_nr = shift;
! 14500: my $state = shift;
! 14501:
! 14502: if ($in_math)
! 14503: {
! 14504: my $result = $simple_map_pre{$command};
! 14505: $result = $simple_map_math{$command} if (defined($simple_map_math{$command}));
! 14506: return $result;
! 14507: }
! 14508: elsif ($in_preformatted)
! 14509: {
! 14510: return $simple_map_pre{$command};
! 14511: }
! 14512: else
! 14513: {
! 14514: return $simple_map{$command};
! 14515: }
! 14516: }
! 14517:
! 14518: sub t2h_default_thing_command($$$$$$)
! 14519: {
! 14520: my $command = shift;
! 14521: my $text = shift;
! 14522: my $in_preformatted = shift;
! 14523: my $in_math = shift;
! 14524: my $line_nr = shift;
! 14525: my $state = shift;
! 14526:
! 14527: my $result;
! 14528: if ($in_math)
! 14529: {
! 14530: $result = $pre_map{$command};
! 14531: $result = $math_map{$command} if (defined($math_map{$command}));
! 14532: }
! 14533: elsif ($in_preformatted)
! 14534: {
! 14535: $result = $pre_map{$command};
! 14536: }
! 14537: else
! 14538: {
! 14539: $result = $things_map{$command};
! 14540: }
! 14541: return $result . $text;
! 14542: }
! 14543:
! 14544: # this is called each time a format begins. Here it is used to keep a
! 14545: # record of the multitables to have a faithful count of the cell nr.
! 14546: sub t2h_default_begin_format_texi($$$)
! 14547: {
! 14548: my $command = shift;
! 14549: my $line = shift;
! 14550: my $state = shift;
! 14551:
! 14552: # remove space in front of center, unless it removes the end of line!
! 14553: $line =~ s/^\s*// if ($command eq 'center' and $line =~ /\S/);
! 14554: return $line;
! 14555: }
! 14556:
! 14557: # This function is called whenever a complex format is processed
! 14558: #
! 14559: # arguments:
! 14560: # name of the format
! 14561: # text appearing inside the format
! 14562: #
! 14563: # an eval of $complex_format->{format name}->{'begin'} should lead to the
! 14564: # beginning of the complex format, an eval of
! 14565: # $complex_format->{format name}->{'end'} should lead to the end of the
! 14566: # complex format.
! 14567: sub t2h_default_complex_format($$)
! 14568: {
! 14569: my $name = shift;
! 14570: my $text = shift;
! 14571: return '' if ($text eq '');
! 14572: return '' if ($name eq 'direntry');
! 14573: my $beginning;
! 14574: my $end;
! 14575: # FIXME obsoleted in nov 2009
! 14576: if (exists($complex_format_map->{$name}))
! 14577: {
! 14578: $beginning = eval "$complex_format_map->{$name}->{'begin'}";
! 14579: if ($@ ne '')
! 14580: {
! 14581: main::msg_debug("Evaluation of $complex_format_map->{$name}->{'begin'}: $@");
! 14582: $beginning = '';
! 14583:
! 14584: }
! 14585: $end = eval "$complex_format_map->{$name}->{'end'}";
! 14586: if ($@ ne '')
! 14587: {
! 14588: main::msg_debug("Evaluation of $complex_format_map->{$name}->{'end'}: $@");
! 14589: $end = '';
! 14590: }
! 14591: }
! 14592: else
! 14593: {
! 14594: $beginning = $complex_format_map{$name}->{'begin'};
! 14595: $beginning = '' if (!defined($beginning));
! 14596: $end = $complex_format_map{$name}->{'end'};
! 14597: $end = '' if (!defined($end));
! 14598: }
! 14599: return $beginning . $text . $end;
! 14600: }
! 14601:
! 14602: sub t2h_default_empty_line($$)
! 14603: {
! 14604: my $text = shift;
! 14605: my $state = shift;
! 14606: #ignore the line if it just follows a deff
! 14607: return '' if ($state->{'deff_line'});
! 14608: return $text;
! 14609: }
! 14610:
! 14611: sub t2h_default_unknown($$$$$)
! 14612: {
! 14613: my $macro = shift;
! 14614: my $line = shift;
! 14615: my $pass = shift;
! 14616: my $stack = shift;
! 14617: my $state = shift;
! 14618:
! 14619: my ($result_line, $result, $result_text, $message);
! 14620: return ($line, 0, undef, undef);
! 14621: }
! 14622:
! 14623: sub t2h_default_unknown_style($$$$$)
! 14624: {
! 14625: my $command = shift;
! 14626: my $text = shift;
! 14627: my $state = shift;
! 14628: my $no_close = shift;
! 14629: my $no_open = shift;
! 14630:
! 14631: my ($result, $result_text, $message);
! 14632: return (0, undef, undef);
! 14633: }
! 14634:
! 14635: sub t2h_default_caption_shortcaption($)
! 14636: {
! 14637: my $float = shift;
! 14638: my $caption_lines;
! 14639: my $shortcaption_lines;
! 14640: my $style = $float->{'style_texi'};
! 14641: if (defined($float->{'nr'}))
! 14642: {
! 14643: my $nr = $float->{'nr'};
! 14644: if ($style ne '')
! 14645: {
! 14646: $style = gdt('{style} {number}', { 'style' => $style, 'number' => $nr});
! 14647: }
! 14648: else
! 14649: {
! 14650: $style = $nr;
! 14651: }
! 14652: }
! 14653: my $empty_caption = 1;
! 14654: if (defined($float->{'caption_texi'}) and @{$float->{'caption_texi'}})
! 14655: {
! 14656: @$caption_lines = @{$float->{'caption_texi'}};
! 14657: $caption_lines->[0] =~ s/^\s*//;
! 14658: if ($caption_lines->[0] =~ /\S/ or @$caption_lines > 2)
! 14659: {
! 14660: $empty_caption = 0;
! 14661: }
! 14662: }
! 14663:
! 14664: if (!$empty_caption)
! 14665: {
! 14666: if (defined($style))
! 14667: {
! 14668: $caption_lines->[0] = '@'.$CAPTION_STYLE.'{' . gdt('{style}: {caption_first_line}', { 'style' => $style, 'caption_first_line' => $caption_lines->[0] });
! 14669: }
! 14670: else
! 14671: {
! 14672: $caption_lines->[0] = '@'.$CAPTION_STYLE.'{' . $caption_lines->[0];
! 14673: }
! 14674: push @$caption_lines, "}\n";
! 14675: }
! 14676: elsif (defined($style))
! 14677: {
! 14678: $caption_lines->[0] = '@'.$CAPTION_STYLE.'{' . $style . '}' . "\n";
! 14679: }
! 14680:
! 14681: my $empty_shortcaption = 1;
! 14682: if (defined($float->{'shortcaption_texi'}) and @{$float->{'shortcaption_texi'}})
! 14683: {
! 14684: @$shortcaption_lines = @{$float->{'shortcaption_texi'}};
! 14685: $shortcaption_lines->[0] =~ s/^\s*//;
! 14686: if ($shortcaption_lines->[0] =~ /\S/ or @$shortcaption_lines > 1)
! 14687: {
! 14688: $empty_shortcaption = 0;
! 14689: }
! 14690: }
! 14691:
! 14692: if (!$empty_shortcaption)
! 14693: {
! 14694: if (defined($style))
! 14695: {
! 14696: $shortcaption_lines->[0] = '@'.$CAPTION_STYLE.'{' . gdt('{style}: {shortcaption_first_line}', { 'style' => $style, 'shortcaption_first_line' => $shortcaption_lines->[0] });
! 14697: }
! 14698: else
! 14699: {
! 14700: $shortcaption_lines->[0] = '@'.$CAPTION_STYLE.'{' . $shortcaption_lines->[0];
! 14701: }
! 14702: push @$shortcaption_lines, "}\n";
! 14703: }
! 14704: elsif (defined($style))
! 14705: {
! 14706: $shortcaption_lines->[0] = '@'.$CAPTION_STYLE.'{' . $style . '}' . "\n";
! 14707: }
! 14708: return ($caption_lines, $shortcaption_lines);
! 14709: }
! 14710:
! 14711: # everything is done in &$float
! 14712: sub t2h_default_caption_shortcaption_command($$$$)
! 14713: {
! 14714: my $command = shift;
! 14715: my $text = shift;
! 14716: my $texi_lines = shift;
! 14717: my $float_element = shift;
! 14718: return '';
! 14719: }
! 14720:
! 14721: sub t2h_default_float($$$$$)
! 14722: {
! 14723: my $text = shift;
! 14724: my $float = shift;
! 14725: my $caption = shift;
! 14726: my $shortcaption = shift;
! 14727:
! 14728: my $label = '';
! 14729: if (exists($float->{'id'}))
! 14730: {
! 14731: $label = &$anchor($float->{'id'});
! 14732: }
! 14733: my $caption_text = '';
! 14734:
! 14735: if (defined($float->{'caption_texi'}))
! 14736: {
! 14737: $caption_text = $caption;
! 14738: }
! 14739: elsif (defined($float->{'shortcaption_texi'}))
! 14740: {
! 14741: $caption_text = $shortcaption;
! 14742: }
! 14743: elsif (defined($caption))
! 14744: {
! 14745: $caption_text = $caption;
! 14746: }
! 14747:
! 14748: return $text . "\n" . $caption_text;
! 14749: }
! 14750:
! 14751: sub t2h_default_listoffloats_style($)
! 14752: {
! 14753: my $style_texi = shift;
! 14754: return ($style_texi);
! 14755: }
! 14756:
! 14757: sub t2h_default_listoffloats_float_style($$)
! 14758: {
! 14759: my $style_texi = shift;
! 14760: my $float = shift;
! 14761:
! 14762: my $style = $float->{'style_texi'};
! 14763: #print STDERR "listoffloat/float style mismatch $style_texi $style\n" if ($style_texi ne $style);
! 14764: if (defined($float->{'nr'}))
! 14765: {
! 14766: my $nr = $float->{'nr'};
! 14767: if ($style ne '')
! 14768: {
! 14769: $style = gdt('{style} {number}', { 'style' => $style, 'number' => $nr});
! 14770: }
! 14771: else
! 14772: {
! 14773: $style = $nr;
! 14774: }
! 14775: }
! 14776: return $style;
! 14777: }
! 14778:
! 14779: sub t2h_default_listoffloats_caption($)
! 14780: {
! 14781: my $float = shift;
! 14782: if (defined($float->{'shortcaption_texi'}))
! 14783: {
! 14784: return ([ @{$float->{'shortcaption_texi'}} ], 'shortcaption');
! 14785: }
! 14786: elsif (defined($float->{'caption_texi'}))
! 14787: {
! 14788: return ([ @{$float->{'caption_texi'}} ], 'caption');
! 14789: }
! 14790: return ([ ], undef);
! 14791: }
! 14792:
! 14793: sub t2h_default_listoffloats_entry($$$$)
! 14794: {
! 14795: my $style_texi = shift;
! 14796: my $float = shift;
! 14797: my $float_style = shift;
! 14798: my $caption = shift;
! 14799: my $href = shift;
! 14800:
! 14801: my @lines = split /^/, $caption;
! 14802: $caption = $lines[0];
! 14803: $caption = '' if (!defined($caption));
! 14804: chomp ($caption);
! 14805:
! 14806: $caption = $float->{'text'} if ($caption eq '' and defined($float->{'text'}) and $float->{'text'} =~ /\S/);
! 14807:
! 14808: return "* $float_style: ${caption}\n";
! 14809: }
! 14810:
! 14811: sub t2h_default_listoffloats($$$)
! 14812: {
! 14813: my $style_texi = shift;
! 14814: my $style = shift;
! 14815: my $float_entries = shift;
! 14816:
! 14817: my $result = "* List of $style:\n";
! 14818: foreach my $float_entry (@$float_entries)
! 14819: {
! 14820: $result .= $float_entry;
! 14821: }
! 14822: return $result . "\n";
! 14823: }
! 14824:
! 14825: sub t2h_default_insertcopying($$$)
! 14826: {
! 14827: my $text = shift;
! 14828: my $comment = shift;
! 14829: my $simple_text = shift;
! 14830: return $text;
! 14831: }
! 14832:
! 14833: sub t2h_default_protect_text($)
! 14834: {
! 14835: my $text = shift;
! 14836: return $text;
! 14837: }
! 14838:
! 14839: # This function is used to protect characters which are special in xml
! 14840: # in inline text: &, ", <, and >.
! 14841: #
! 14842: # argument:
! 14843: # text to be protected
! 14844: sub xml_default_protect_text($)
! 14845: {
! 14846: my $text = shift;
! 14847: $text =~ s/&/&/g;
! 14848: $text =~ s/</</g;
! 14849: $text =~ s/>/>/g;
! 14850: $text =~ s/\"/"/g;
! 14851: return $text;
! 14852: }
! 14853:
! 14854: sub in_cmd($$)
! 14855: {
! 14856: my $style_stack = shift;
! 14857: my $command = shift;
! 14858: my $result = 0;
! 14859: if ($style_stack and scalar(@{$style_stack}))
! 14860: {
! 14861: my $level = $#$style_stack;
! 14862: #print STDERR ":::$level ::@{$style_stack}\n";
! 14863: while ($level >= 0)
! 14864: {
! 14865: if ($style_stack->[$level] eq $command)
! 14866: {
! 14867: $result = 1;
! 14868: last;
! 14869: }
! 14870: $level--;
! 14871: }
! 14872: }
! 14873: return $result;
! 14874: }
! 14875: #
! 14876: #
! 14877:
! 14878: sub in_small_caps($)
! 14879: {
! 14880: my $style_stack = shift;
! 14881: my $in_sc = 0;
! 14882: if ($style_stack and scalar(@{$style_stack}))
! 14883: {
! 14884: my $level = $#$style_stack;
! 14885: #print STDERR ":::$level ::@{$style_stack}\n";
! 14886: while ($level >= 0)
! 14887: {
! 14888: if ($style_stack->[$level] eq 'sc')
! 14889: {
! 14890: $in_sc = 1;
! 14891: last;
! 14892: }
! 14893: $level--;
! 14894: }
! 14895: }
! 14896: return $in_sc;
! 14897: }
! 14898: #
! 14899: #
! 14900: sub t2h_default_normal_text($$$$$$$;$)
! 14901: {
! 14902: my @initial_args = @_;
! 14903: my $text = shift;
! 14904: my $in_raw_text = shift; # remove_texi
! 14905: my $in_preformatted = shift;
! 14906: my $in_code = shift;
! 14907: my $in_math = shift;
! 14908: my $in_simple = shift;
! 14909: my $style_stack = shift;
! 14910: my $state = shift;
! 14911:
! 14912: # like utf8.init
! 14913: if ($ENABLE_ENCODING and !$ENABLE_ENCODING_USE_ENTITY and defined($Texi2HTML::THISDOC{'ENCODING_NAME'}) and $Texi2HTML::THISDOC{'ENCODING_NAME'} eq 'utf-8' and $USE_UNICODE)
! 14914: {
! 14915: return &t2h_utf8_normal_text(@initial_args);
! 14916: }
! 14917:
! 14918: $text = uc($text) if (in_cmd($style_stack, 'sc'));
! 14919: if (! $in_code and !$in_preformatted)
! 14920: {
! 14921: $text =~ s/---/\x{1F}/g;
! 14922: $text =~ s/--/-/g;
! 14923: $text =~ s/\x{1F}/--/g;
! 14924: $text =~ s/``/"/g;
! 14925: $text =~ s/\'\'/"/g;
! 14926: }
! 14927: else
! 14928: {
! 14929: # to be like tex. This would be wrong, however.
! 14930: # my $special_code = 0;
! 14931: # $special_code = 1 if (in_cmd($style_stack, 'code') or
! 14932: # in_cmd($style_stack, 'example') or in_cmd($style_stack, 'verbatim'));
! 14933: # $text =~ s/'/\&rsquo\;/g unless ($special_code and exists($main::value{'txicodequoteundirected'}));
! 14934: # $text =~ s/`/\&lsquo\;/g unless ($special_code and exists($main::value{'txicodequotebacktick'}));
! 14935: }
! 14936: $text = t2h_text_substitutions($text, $in_raw_text, ($in_preformatted or $in_code), $in_simple);
! 14937: return $text;
! 14938: }
! 14939:
! 14940: sub t2h_default_url_and_text($;$)
! 14941: {
! 14942: my $url = shift;
! 14943: my $text = shift;
! 14944: if (!defined($text) or $text eq '')
! 14945: {
! 14946: return "<$url>" if (defined($url) and $url ne '');
! 14947: return '';
! 14948: }
! 14949: else
! 14950: {
! 14951: return $text if (!defined($url) or $url eq '');
! 14952: return "$text <$url>";
! 14953: }
! 14954: }
! 14955:
! 14956: # This function produces an anchor. This need is quite html specific.
! 14957: #
! 14958: # arguments:
! 14959: # $name : anchor name
! 14960: # $href : anchor href
! 14961: # text : text displayed
! 14962: # extra_attribs : added to anchor attributes list
! 14963: sub t2h_default_anchor($;$$$)
! 14964: {
! 14965: my $name = shift;
! 14966: my $href = shift;
! 14967: my $text = shift;
! 14968: my $attributes = shift;
! 14969: return $text if (defined($text));
! 14970: return '';
! 14971: }
! 14972:
! 14973: # This function is used to format the text associated with a @deff/@end deff
! 14974: #
! 14975: # argument:
! 14976: # text
! 14977: #
! 14978: # $DEF_TABLE should be used to distinguish between @def formatted as table
! 14979: # and as definition lists.
! 14980: sub t2h_default_def_item($$$)
! 14981: {
! 14982: my $text = shift;
! 14983: my $only_inter_item_commands = shift;
! 14984: my $command = shift;
! 14985: if ($text =~ /\S/)
! 14986: {
! 14987: return $text;
! 14988: }
! 14989: return '';
! 14990: }
! 14991:
! 14992: sub t2h_default_definition_category($$$$)
! 14993: {
! 14994: my $name = shift;
! 14995: my $class = shift;
! 14996: my $style = shift;
! 14997: my $command = shift;
! 14998: return ($name) if (!defined($class) or $class =~ /^\s*$/);
! 14999: if ($style eq 'f')
! 15000: {
! 15001: return gdt('{name} on {class}', { 'name' => $name, 'class' => $class });
! 15002: }
! 15003: elsif ($style eq 'v')
! 15004: {
! 15005: return gdt('{name} of {class}', { 'name' => $name, 'class' => $class });
! 15006: }
! 15007: else
! 15008: {
! 15009: return $name;
! 15010: }
! 15011: }
! 15012:
! 15013: sub t2h_default_definition_index_entry($$$$)
! 15014: {
! 15015: my $name = shift;
! 15016: my $class = shift;
! 15017: my $style = shift;
! 15018: my $command = shift;
! 15019: return ($name) if (!defined($class) or $class =~ /^\s*$/);
! 15020: if ($style eq 'f')
! 15021: {
! 15022: return gdt('{name} on {class}', { 'name' => $name, 'class' => $class });
! 15023: }
! 15024: elsif ($style eq 'v' and $command ne 'defcv')
! 15025: {
! 15026: return gdt('{name} of {class}', { 'name' => $name, 'class' => $class });
! 15027: }
! 15028: else
! 15029: {
! 15030: return $name;
! 15031: }
! 15032: }
! 15033:
! 15034: sub t2h_default_summary_letter($$$$$$$)
! 15035: {
! 15036: my $letter = shift;
! 15037: my $file = shift;
! 15038: my $default_identifier = shift;
! 15039: my $index_element_id = shift;
! 15040: my $number = shift;
! 15041: my $index_element = shift;
! 15042: my $index_name = shift;
! 15043:
! 15044: return '';
! 15045: }
! 15046:
! 15047:
! 15048: # format the container for the @deffn line and text
! 15049: #
! 15050: # argument
! 15051: # text of the whole @def, line and associated text.
! 15052: #
! 15053: # $DEF_TABLE should be used.
! 15054: sub t2h_default_def($$)
! 15055: {
! 15056: my $text = shift;
! 15057: my $command = shift;
! 15058: if ($text =~ /\S/)
! 15059: {
! 15060: return $text;
! 15061: }
! 15062: return '';
! 15063:
! 15064: }
! 15065:
! 15066: # a whole menu
! 15067: #
! 15068: # argument:
! 15069: # the whole menu text (entries and menu comments)
! 15070: #
! 15071: # argument:
! 15072: # whole menu text.
! 15073: # not used since menu is a normal preformatted command with SIMPLE_MENU
! 15074: sub t2h_default_menu_command($$$)
! 15075: {
! 15076: my $format = shift;
! 15077: my $text = shift;
! 15078: my $in_preformatted = shift;
! 15079: return "* Menu:\n".$text."\n";
! 15080:
! 15081: }
! 15082:
! 15083: # formats a menu entry link pointing to a node or section
! 15084: #
! 15085: # arguments:
! 15086: # the entry text
! 15087: # the state, a hash reference holding informations about the context, with a
! 15088: # usefull entry, 'preformatted', true if we are in a preformatted format
! 15089: # (a format keeping space between words). In that case a function
! 15090: # of the main program, main::do_preformatted($text, $state) might
! 15091: # be used to format the text with the current format style.
! 15092: # href is optionnal. It is the reference to the section or the node anchor
! 15093: # which should be used to make the link (typically it is the argument
! 15094: # of a href= attribute in a <a> element).
! 15095: sub t2h_default_menu_link($$$$$$$$)
! 15096: {
! 15097: my $entry = shift;
! 15098: my $state = shift;
! 15099: my $href = shift;
! 15100: my $node = shift;
! 15101: my $title = shift;
! 15102: my $ending = shift;
! 15103: my $has_title = shift;
! 15104: my $command_stack = shift;
! 15105: my $preformatted = shift;
! 15106:
! 15107: $title = '' unless ($has_title);
! 15108: $title .= ':' if ($title ne '');
! 15109: return "$MENU_SYMBOL$title$node$ending" if ($NODE_NAME_IN_MENU);
! 15110: return "$MENU_SYMBOL$title$entry$ending";
! 15111: }
! 15112:
! 15113: # formats a menu entry description, ie the text appearing after the node
! 15114: # specification in a menu entry an spanning until there is another
! 15115: # menu entry, an empty line or some text at the very beginning of the line
! 15116: # (we consider that text at the beginning of the line begins a menu comment)
! 15117: #
! 15118: # arguments:
! 15119: # the description text
! 15120: # the state. See menu_entry.
! 15121: # the heading of the element associated with the node.
! 15122: # not usd since in SIMPLE_MENU
! 15123: sub t2h_default_menu_description($$$$)
! 15124: {
! 15125: my $text = shift;
! 15126: my $state = shift;
! 15127: my $element_text = shift;
! 15128: my $command_stack = shift;
! 15129: my $preformatted = shift;
! 15130:
! 15131: return $text;
! 15132: }
! 15133:
! 15134: %htmlxref_entries = (
! 15135: 'node' => [ 'node', 'section', 'chapter', 'mono' ],
! 15136: 'section' => [ 'section', 'chapter','node', 'mono' ],
! 15137: 'chapter' => [ 'chapter', 'section', 'node', 'mono' ],
! 15138: 'mono' => [ 'mono', 'chapter', 'section', 'node' ],
! 15139: );
! 15140:
! 15141:
! 15142: # Construct a href to an external source of information.
! 15143: # node is the node with texinfo @-commands
! 15144: # node_id is the node transliterated and transformed as explained in the
! 15145: # texinfo manual
! 15146: # node_xhtml_id is the node transformed such that it is unique and can
! 15147: # be used to make an html cross ref as explained in the texinfo manual
! 15148: # file is the file in '(file)node'
! 15149: # This is used to construct href, so is likely to be ignored oustside of
! 15150: # html.
! 15151: sub t2h_default_external_href($$$)
! 15152: {
! 15153: my $node = shift;
! 15154: my $node_id = shift;
! 15155: my $node_xhtml_id = shift;
! 15156: my $file = shift;
! 15157: $file = '' if (!defined($file));
! 15158: my $default_target_split = $Texi2HTML::THISDOC{'EXTERNAL_CROSSREF_SPLIT'};
! 15159: my $target_split;
! 15160: #my $target_mono;
! 15161: #my $href_split;
! 15162: #my $href_mono;
! 15163: if ($file ne '')
! 15164: {
! 15165: if ($NEW_CROSSREF_STYLE)
! 15166: {
! 15167: $file =~ s/\.[^\.]*$//;
! 15168: $file =~ s/^.*\///;
! 15169: my $href;
! 15170: my $document_split = get_conf('SPLIT');
! 15171: $document_split = 'mono' if (!$document_split);
! 15172: my $split_found;
! 15173: if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}))
! 15174: {
! 15175: foreach my $split_ordered (@{$htmlxref_entries{$document_split}})
! 15176: {
! 15177: if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}->{$split_ordered}))
! 15178: {
! 15179: $split_found = $split_ordered;
! 15180: $href = $Texi2HTML::THISDOC{'htmlxref'}->{$file}->{$split_ordered}->{'href'};
! 15181: last;
! 15182: }
! 15183: }
! 15184: }
! 15185: if (defined($split_found))
! 15186: {
! 15187: $target_split = 1 unless ($split_found eq 'mono');
! 15188: }
! 15189: else
! 15190: { # nothing specified for that manual, use default
! 15191: $target_split = $default_target_split;
! 15192: }
! 15193:
! 15194: if ($target_split)
! 15195: {
! 15196: if (defined($href))
! 15197: {
! 15198: $file = $href;
! 15199: }
! 15200: elsif (defined($EXTERNAL_DIR))
! 15201: {
! 15202: $file = "$EXTERNAL_DIR/$file";
! 15203: }
! 15204: elsif (get_conf('SPLIT'))
! 15205: {
! 15206: $file = "../$file";
! 15207: }
! 15208: $file .= "/";
! 15209: }
! 15210: else
! 15211: {# target not split
! 15212: if (defined($href))
! 15213: {
! 15214: $file = $href;
! 15215: }
! 15216: else
! 15217: {
! 15218: if (defined($EXTERNAL_DIR))
! 15219: {
! 15220: $file = "$EXTERNAL_DIR/$file";
! 15221: }
! 15222: elsif (get_conf('SPLIT'))
! 15223: {
! 15224: $file = "../$file";
! 15225: }
! 15226: $file .= "." . $NODE_FILE_EXTENSION;
! 15227: }
! 15228: }
! 15229: }
! 15230: else
! 15231: {
! 15232: $file .= "/";
! 15233: if (defined($EXTERNAL_DIR))
! 15234: {
! 15235: $file = $EXTERNAL_DIR . $file;
! 15236: }
! 15237: else
! 15238: {
! 15239: $file = '../' . $file;
! 15240: }
! 15241: }
! 15242: }
! 15243: else
! 15244: {
! 15245: $target_split = $default_target_split;
! 15246: }
! 15247: if ($node eq '')
! 15248: {
! 15249: if ($NEW_CROSSREF_STYLE)
! 15250: {
! 15251: if ($target_split)
! 15252: {
! 15253: if (defined($TOP_NODE_FILE_TARGET))
! 15254: {
! 15255: return $file . $TOP_NODE_FILE_TARGET . '.' . $NODE_FILE_EXTENSION . '#Top';
! 15256: }
! 15257: else
! 15258: {
! 15259: return $file . '#Top';
! 15260: }
! 15261: }
! 15262: else
! 15263: {
! 15264: return $file . '#Top';
! 15265: }
! 15266: }
! 15267: else
! 15268: {
! 15269: return $file;
! 15270: }
! 15271: }
! 15272: my $target;
! 15273: if ($NEW_CROSSREF_STYLE)
! 15274: {
! 15275: $node = $node_id;
! 15276: $target = $node_xhtml_id;
! 15277: }
! 15278: else
! 15279: {
! 15280: $node = main::remove_texi($node);
! 15281: $node =~ s/[^\w\.\-]/-/g;
! 15282: }
! 15283: my $file_basename = $node;
! 15284: $file_basename = $TOP_NODE_FILE_TARGET if ($node =~ /^top$/i and defined($TOP_NODE_FILE_TARGET));
! 15285: if ($NEW_CROSSREF_STYLE)
! 15286: {
! 15287: if ($target_split)
! 15288: {
! 15289: return $file . $file_basename . ".$NODE_FILE_EXTENSION" . '#' . $target;
! 15290: }
! 15291: else
! 15292: {
! 15293: return $file . '#' . $target;
! 15294: }
! 15295: }
! 15296: else
! 15297: {
! 15298: return $file . $file_basename . ".$NODE_FILE_EXTENSION";
! 15299: }
! 15300: }
! 15301:
! 15302: # format a reference external to the generated manual. This produces a full
! 15303: # reference with introductive words and the reference itself.
! 15304: #
! 15305: # arguments:
! 15306: # type of the reference: xref (reference at the beginning of a sentence),
! 15307: # pxref (reference in a parenthesis),
! 15308: # section in the book. This might be undef.
! 15309: # book name.
! 15310: # manual file name
! 15311: # href linking to the html page containing the referenced node. A typical
! 15312: # use for this href is a href attribute in an <a> element
! 15313: # cross reference name
! 15314: # array of texi arguments of the reference
! 15315: # array of the formatted arguments of the reference
! 15316: # node name
! 15317: sub t2h_default_external_ref($$$$$$$$$)
! 15318: {
! 15319: my $type = shift;
! 15320: my $section = shift;
! 15321: my $book = shift;
! 15322: my $file = shift;
! 15323: #my $file_node = shift;
! 15324: my $href = shift;
! 15325: my $cross_ref = shift;
! 15326: my $args_texi = shift;
! 15327: my $formatted_args = shift;
! 15328: my $node = shift;
! 15329:
! 15330: my $name = $section;
! 15331: $name = $cross_ref if ($name eq '');
! 15332: $name = $node if ($name eq '');
! 15333:
! 15334: my $reference = $name;
! 15335:
! 15336: if ($book eq '' and $file ne '')
! 15337: {
! 15338: $name = "($file)$name";
! 15339: }
! 15340: $reference = &$anchor('', $href, $name) if ($href ne '');
! 15341:
! 15342: # Yes, this is ugly, yet this helps internationalization
! 15343: if ($type eq 'pxref')
! 15344: {
! 15345: if (($book ne '') and ($href ne ''))
! 15346: {
! 15347: return gdt('see {reference} in @cite{{book}}', { 'reference' => $reference, 'book' => $book },{'duplicate'=>1});
! 15348: }
! 15349: elsif (($book ne '') and ($reference ne ''))
! 15350: {
! 15351: return gdt('see `{section}\' in @cite{{book}}', { 'section' => $reference, 'book' => $book },{'duplicate'=>1});
! 15352: }
! 15353: elsif ($book ne '')
! 15354: { # should seldom or even never happen
! 15355: return gdt('see @cite{{book}}', { 'book' => $book },{'duplicate'=>1});
! 15356: }
! 15357: elsif ($href ne '')
! 15358: {
! 15359: return gdt('see {reference}', { 'reference' => $reference },{'duplicate'=>1});
! 15360: }
! 15361: elsif ($reference ne '')
! 15362: {
! 15363: return gdt('see `{section}\'', { 'section' => $reference },{'duplicate'=>1});
! 15364: }
! 15365: }
! 15366: if ($type eq 'xref' or $type eq 'inforef')
! 15367: {
! 15368: if (($book ne '') and ($href ne ''))
! 15369: {
! 15370: return gdt('See {reference} in @cite{{book}}', { 'reference' => $reference, 'book' => $book },{'duplicate'=>1});
! 15371: }
! 15372: elsif (($book ne '') and ($reference ne ''))
! 15373: {
! 15374: return gdt('See `{section}\' in @cite{{book}}', { 'section' => $reference, 'book' => $book },{'duplicate'=>1});
! 15375: }
! 15376: elsif ($book ne '')
! 15377: { # should seldom or even never happen
! 15378: return gdt('See @cite{{book}}', { 'book' => $book },{'duplicate'=>1});
! 15379: }
! 15380: elsif ($href ne '')
! 15381: {
! 15382: return gdt('See {reference}', { 'reference' => $reference },{'duplicate'=>1});
! 15383: }
! 15384: elsif ($reference ne '')
! 15385: {
! 15386: return gdt('See `{section}\'', { 'section' => $reference },{'duplicate'=>1});
! 15387: }
! 15388: }
! 15389: if ($type eq 'ref')
! 15390: {
! 15391: if (($book ne '') and ($href ne ''))
! 15392: {
! 15393: return gdt('{reference} in @cite{{book}}', { 'reference' => $reference, 'book' => $book },{'duplicate'=>1});
! 15394: }
! 15395: elsif (($book ne '') and ($reference ne ''))
! 15396: {
! 15397: return gdt('`{section}\' in @cite{{book}}', { 'section' => $reference, 'book' => $book },{'duplicate'=>1});
! 15398: }
! 15399: elsif ($book ne '')
! 15400: { # should seldom or even never happen
! 15401: return gdt('@cite{{book}}', { 'book' => $book },{'duplicate'=>1});
! 15402: }
! 15403: elsif ($href ne '')
! 15404: {
! 15405: return gdt('{reference}', { 'reference' => $reference },{'duplicate'=>1});
! 15406: }
! 15407: elsif ($reference ne '')
! 15408: {
! 15409: return gdt('`{section}\'', { 'section' => $reference },{'duplicate'=>1});
! 15410: }
! 15411: }
! 15412: return '';
! 15413: }
! 15414:
! 15415: # format a reference to a node or a section in the generated manual. This
! 15416: # produces a full reference with introductive words and the reference itself.
! 15417: #
! 15418: # arguments:
! 15419: # type of the reference: xref (reference at the beginning of a sentence),
! 15420: # pxref (reference in a parenthesis),
! 15421: # href linking to the html page containing the node or the section. A typical
! 15422: # use for this href is a href attribute in an <a> element
! 15423: # short name for this reference
! 15424: # name for this reference
! 15425: # boolean true if the reference is a reference to a section
! 15426: #
! 15427: # $SHORT_REF should be used.
! 15428: sub t2h_default_internal_ref($$$$$$$$)
! 15429: {
! 15430: my $type = shift;
! 15431: my $href = shift;
! 15432: my $short_name = shift;
! 15433: my $name = shift;
! 15434: my $is_section = shift;
! 15435: my $args_texi = shift;
! 15436: my $formatted_args = shift;
! 15437: my $element = shift;
! 15438:
! 15439: if (! $SHORT_REF)
! 15440: {
! 15441: $name = &$anchor('', $href, $name);
! 15442: if ($type eq 'pxref')
! 15443: {
! 15444: return gdt('see section {reference_name}', { 'reference_name' => $name },{'duplicate'=>1}) if ($is_section);
! 15445: return gdt('see {reference_name}', { 'reference_name' => $name },{'duplicate'=>1});
! 15446: }
! 15447: elsif ($type eq 'xref' or $type eq 'inforef')
! 15448: {
! 15449: return gdt('See section {reference_name}', { 'reference_name' => $name },{'duplicate'=>1}) if ($is_section);
! 15450: return gdt('See {reference_name}', { 'reference_name' => $name },{'duplicate'=>1});
! 15451: }
! 15452: elsif ($type eq 'ref')
! 15453: {
! 15454: return gdt('{reference_name}', { 'reference_name' => $name },{'duplicate'=>1});
! 15455: }
! 15456: }
! 15457: else
! 15458: {
! 15459: $name = &$anchor('', $href, $short_name);
! 15460: if ($type eq 'pxref')
! 15461: {
! 15462: return gdt('see {reference_name}', { 'reference_name' => $name },{'duplicate'=>1});
! 15463: }
! 15464: elsif ($type eq 'xref' or $type eq 'inforef')
! 15465: {
! 15466: return gdt('See {reference_name}', { 'reference_name' => $name },{'duplicate'=>1});
! 15467: }
! 15468: elsif ($type eq 'ref')
! 15469: {
! 15470: return gdt('{reference_name}', { 'reference_name' => $name },{'duplicate'=>1});
! 15471: }
! 15472: }
! 15473: return '';
! 15474: }
! 15475:
! 15476: # text after @item in table, vtable and ftable
! 15477: sub t2h_default_table_item($$$$$$$)
! 15478: {
! 15479: my $text = shift;
! 15480: my $index_label = shift;
! 15481: my $format = shift;
! 15482: my $command = shift;
! 15483: my $style_stack = shift;
! 15484: my $item_cmd = shift;
! 15485: my $formatted_index_entry = shift;
! 15486:
! 15487: return $text . "\n";
! 15488: }
! 15489:
! 15490: # format text on the line following the @item line (in table, vtable and ftable)
! 15491: sub t2h_default_table_line($$$)
! 15492: {
! 15493: my $text = shift;
! 15494: my $only_inter_item_commands = shift;
! 15495: my $before_items = shift;
! 15496:
! 15497: $only_inter_item_commands = '' if (!defined($only_inter_item_commands));
! 15498:
! 15499: if ($text =~ /\S/)
! 15500: {
! 15501: return $text;
! 15502: }
! 15503: return '';
! 15504: }
! 15505:
! 15506: #my $cell_nr = -1;
! 15507:
! 15508: # row in multitable
! 15509: sub t2h_default_row($$$$$$$$)
! 15510: {
! 15511: my $text = shift;
! 15512: my $macro = shift;
! 15513: my $columnfractions = shift;
! 15514: my $prototype_row = shift;
! 15515: my $prototype_lengths = shift;
! 15516: my $column_number = shift;
! 15517: my $only_inter_item_commands = shift;
! 15518: my $before_items = shift;
! 15519:
! 15520: $only_inter_item_commands = '' if (!defined($only_inter_item_commands));
! 15521:
! 15522: if ($text =~ /\S/)
! 15523: {
! 15524: return $text ."\n";
! 15525: }
! 15526: return '';
! 15527: }
! 15528:
! 15529: # cell in multitable
! 15530: sub t2h_default_cell($$$$$$$$)
! 15531: {
! 15532: my $text = shift;
! 15533: my $row_macro = shift;
! 15534: my $columnfractions = shift;
! 15535: my $prototype_row = shift;
! 15536: my $prototype_lengths = shift;
! 15537: my $column_number = shift;
! 15538: my $only_inter_item_commands = shift;
! 15539: my $before_items = shift;
! 15540:
! 15541: $only_inter_item_commands = '' if (!defined($only_inter_item_commands));
! 15542:
! 15543: $text =~ s/^\s*//;
! 15544: $text =~ s/\s*$//;
! 15545:
! 15546: return " $text";
! 15547: }
! 15548:
! 15549: # format an itemize, enumerate or @*table @item line, returning
! 15550: # a texinfo line.
! 15551: sub t2h_default_format_list_item_texi($$$$$)
! 15552: {
! 15553: my $format = shift;
! 15554: my $line = shift;
! 15555: my $prepended = shift;
! 15556: my $command = shift;
! 15557: my $number = shift;
! 15558:
! 15559: my $result_line;
! 15560: my $open_command = 0;
! 15561:
! 15562: $command = 'bullet' if ((!defined($command) or $command eq '') and (!defined($prepended) or $prepended eq '') and $format eq 'itemize');
! 15563: $prepended = "\@$command\{\}" if (defined($command) and $command ne '');
! 15564: $prepended = "$number." if (defined($number) and $number ne '');
! 15565:
! 15566: if (defined($command) and $command ne '' and $format ne 'itemize')
! 15567: {
! 15568: #@*table
! 15569: $open_command = 1;
! 15570: $line =~ s/^\s*//;
! 15571: $line =~ s/\s*$//;
! 15572: if (exists ($style_map{$command}))
! 15573: {
! 15574: $result_line = "\@$command\{$line\}\n";
! 15575: }
! 15576: elsif (exists ($things_map{$command}))
! 15577: {
! 15578: $result_line = "\@$command\{\} $line\n";
! 15579: }
! 15580: else
! 15581: {
! 15582: $result_line = "\@$command $line\n";
! 15583: }
! 15584: }
! 15585: elsif (defined($prepended) and $prepended ne '')
! 15586: {
! 15587: $prepended =~ s/^\s*//;
! 15588: $prepended =~ s/\s*$//;
! 15589: $line =~ s/^\s*//;
! 15590: $result_line = $prepended . ' ' . $line;
! 15591: }
! 15592: return ($result_line, $open_command);
! 15593: }
! 15594:
! 15595:
! 15596: # format an item in a list
! 15597: #
! 15598: # argument:
! 15599: # text of the item
! 15600: # format of the list (itemize or enumerate)
! 15601: # command passed as argument to the format
! 15602: # formatted_command leading command formatted, if it is a thing command
! 15603: sub t2h_default_list_item($$$$$$$$$$$$)
! 15604: {
! 15605: my $text = shift;
! 15606: my $format = shift;
! 15607: my $command = shift;
! 15608: my $formatted_command = shift;
! 15609: my $item_nr = shift;
! 15610: my $enumerate_style = shift;
! 15611: my $number = shift;
! 15612: my $prepended = shift;
! 15613: my $prepended_formatted = shift;
! 15614: my $only_inter_item_commands = shift;
! 15615: my $before_items = shift;
! 15616: my $item_command = shift;
! 15617:
! 15618: $only_inter_item_commands = '' if (!defined($only_inter_item_commands));
! 15619:
! 15620: if ($text =~ /\S/)
! 15621: {
! 15622: return $text;
! 15623: }
! 15624: return '';
! 15625: }
! 15626:
! 15627: sub t2h_default_table_list($$$$$$$$$)
! 15628: {
! 15629: my $format_command = shift;
! 15630: my $text = shift;
! 15631: my $command = shift;
! 15632: my $formatted_command = shift;
! 15633: # enumerate
! 15634: my $item_nr = shift;
! 15635: my $enumerate_style = shift;
! 15636: # itemize
! 15637: my $prepended = shift;
! 15638: my $prepended_formatted = shift;
! 15639: # multitable
! 15640: my $columnfractions = shift;
! 15641: my $prototype_row = shift;
! 15642: my $prototype_lengths = shift;
! 15643: my $column_number = shift;
! 15644: # my $number = shift;
! 15645: return $text;
! 15646: }
! 15647:
! 15648: # an comment
! 15649: sub t2h_default_comment($)
! 15650: {
! 15651: my $text = shift;
! 15652: return '';
! 15653: }
! 15654:
! 15655: # an xml comment
! 15656: sub xml_default_comment($)
! 15657: {
! 15658: my $text = shift;
! 15659: $text =~ s/--+/-/go;
! 15660: return '<!-- ' . $text . ' -->' . "\n";
! 15661: }
! 15662:
! 15663: sub t2h_collect_styles($)
! 15664: {
! 15665: my $cmd_stack = shift;
! 15666: my @result = ();
! 15667: foreach my $style (reverse(@$cmd_stack))
! 15668: {
! 15669: # last unless (defined($command_type{$style}) and $command_type{$style} eq 'style');
! 15670: push @result, $style if (defined($command_type{$style}) and $command_type{$style} eq 'style');
! 15671: }
! 15672: return @result;
! 15673: }
! 15674:
! 15675: sub html_default_parse_attribute($)
! 15676: {
! 15677: my $element = shift;
! 15678: return ('', '', '') if (!defined($element));
! 15679: my ($class, $attributes) = ('', '');
! 15680: if ($element =~ /^(\w+)(\s+.*)/)
! 15681: {
! 15682: $element = $1;
! 15683: $attributes = $2;
! 15684: if ($attributes =~ s/^\s+class=\"([^\"]+)\"//)
! 15685: {
! 15686: $class = $1;
! 15687: }
! 15688: }
! 15689: return ($element, $class, $attributes);
! 15690: }
! 15691:
! 15692: sub t2h_get_attribute($;$)
! 15693: {
! 15694: my $command = shift;
! 15695: my $map_ref = shift;
! 15696: $map_ref = \%style_map if (!defined($map_ref));
! 15697: return unless (defined($map_ref->{$command}));
! 15698: my ($element, $class, $attributes) = ('', '', '');
! 15699: if (defined($map_ref->{$command}))
! 15700: {
! 15701: if (ref($map_ref->{$command}) eq 'HASH')
! 15702: {
! 15703: ($element, $class, $attributes) = t2h_html_parse_attribute ($map_ref->{$command}->{'attribute'});
! 15704: }
! 15705: elsif ($map_ref->{$command} !~ /^&/)
! 15706: {
! 15707: $element = $map_ref->{$command};
! 15708: $element =~ s/^\"//;
! 15709: }
! 15710: }
! 15711: return ($element, $class, $attributes);
! 15712: }
! 15713:
! 15714: # a paragraph
! 15715: # arguments:
! 15716: # $text of the paragraph
! 15717: # $align for the alignement
! 15718: # $indent for the indent style (indent or noindent)
! 15719: # The following is usefull if the paragraph is in an itemize.
! 15720: # $paragraph_command is the leading formatting command (like @minus)
! 15721: # $paragraph_command_formatted is the leading formatting command formatted
! 15722: # $paragraph_number is a reference on the number of paragraphs appearing
! 15723: # in the format. The value should be increased if a paragraph is done
! 15724: # $format is the format name (@itemize)
! 15725: sub t2h_default_paragraph($$$$$$$$$$$$)
! 15726: {
! 15727: my $text = shift;
! 15728: my $align = shift;
! 15729: my $indent = shift;
! 15730: my $paragraph_command = shift;
! 15731: my $paragraph_command_formatted = shift;
! 15732: my $paragraph_number = shift;
! 15733: my $format = shift;
! 15734: my $item_nr = shift;
! 15735: my $enumerate_style = shift;
! 15736: my $number = shift;
! 15737: my $command_stack_at_end = shift;
! 15738: my $command_stack_at_begin = shift;
! 15739: #print STDERR "format: $format\n" if (defined($format));
! 15740: #print STDERR "paragraph @$command_stack_at_end; @$command_stack_at_begin\n";
! 15741: # $paragraph_command_formatted = '' if (!defined($paragraph_command_formatted) or
! 15742: # exists($special_list_commands{$format}->{$paragraph_command}));
! 15743: return '' if ($text =~ /^\s*$/);
! 15744:
! 15745: return $text;
! 15746: }
! 15747:
! 15748: # a preformatted region
! 15749: # arguments:
! 15750: # $text of the preformatted region
! 15751: # $pre_style css style
! 15752: # $class identifier for the preformatted region (example, menu-comment)
! 15753: # The following is usefull if the preformatted is in an itemize.
! 15754: # $leading_command is the leading formatting command (like @minus)
! 15755: # $leading_command_formatted is the leading formatting command formatted
! 15756: # $preformatted_number is a reference on the number of preformatteds appearing
! 15757: # in the format. The value should be increased if a preformatted is done
! 15758: sub t2h_default_preformatted($$$$$$$$$$$$)
! 15759: {
! 15760: my $text = shift;
! 15761: my $pre_style = shift;
! 15762: my $class = shift;
! 15763: my $leading_command = shift;
! 15764: my $leading_command_formatted = shift;
! 15765: my $preformatted_number = shift;
! 15766: my $format = shift;
! 15767: my $item_nr = shift;
! 15768: my $enumerate_style = shift;
! 15769: my $number = shift;
! 15770: my $command_stack_at_end = shift;
! 15771: my $command_stack_at_begin = shift;
! 15772:
! 15773: #print STDERR "preformatted @$command_stack_at_end; @$command_stack_at_begin\n";
! 15774: return '' if ($text eq '');
! 15775:
! 15776: my $top_stack = '';
! 15777: $top_stack = $command_stack_at_begin->[-1] if (scalar (@$command_stack_at_begin));
! 15778: if ($top_stack eq 'multitable')
! 15779: {
! 15780: $text =~ s/^\s*//;
! 15781: $text =~ s/\s*$//;
! 15782: }
! 15783:
! 15784: # add a new line at the end in case there is none
! 15785: chomp($text);
! 15786: return $text . "\n";
! 15787: }
! 15788:
! 15789: # $new_element is set if the element is associated with a different
! 15790: # reference element than the preceding element. This is where we
! 15791: # do the navigation. For example it could be a @node before a @section.
! 15792: #
! 15793: # The heading function is always called, though -- in the default case
! 15794: # nodes don't lead to an outputted title.
! 15795: sub t2h_default_element_heading($$$$$$$$$$$$)
! 15796: {
! 15797: my $element = shift;
! 15798: my $command = shift;
! 15799: my $texi_line = shift;
! 15800: my $line = shift;
! 15801: my $in_preformatted = shift;
! 15802: my $one_section = shift;
! 15803: my $element_heading = shift;
! 15804: my $first_in_page = shift;
! 15805: my $is_top = shift;
! 15806: my $previous_is_top = shift;
! 15807: my $command_line = shift;
! 15808: my $element_id = shift;
! 15809: my $new_element = shift;
! 15810: #print STDERR ":::::::: $element $command i_p $in_preformatted o_s $one_section e_h $element_heading f_p $first_in_page i_t $is_top p_i_t $previous_is_top id $element_id new $new_element\n";
! 15811:
! 15812: # my $result = '';
! 15813: my $result = &$element_label($element_id, $element, $command, $command_line);
! 15814:
! 15815: # in default case, print_head_navigation and print_navigation are no-ops.
! 15816: # and $print_element_header is undef, so the following nothing.
! 15817: if ($new_element and !$one_section)
! 15818: {
! 15819: main::msg_debug ("For $element->{'texi'}, element_ref not defined", $element->{'line_nr'}) if (!defined($element->{'element_ref'}));
! 15820: if (!defined($element->{'element_ref'}->{'top'}))
! 15821: {
! 15822: if (defined($print_element_header))
! 15823: { # FIXME backward compatibility, print_element_header is obsoleted in nov 2009
! 15824: $result .= &$print_element_header($first_in_page, $previous_is_top);
! 15825: }
! 15826: else
! 15827: {
! 15828: if (($first_in_page or $previous_is_top) and get_conf('headers'))
! 15829: {
! 15830: $result .= &$print_head_navigation(undef, \@SECTION_BUTTONS, $first_in_page, $previous_is_top, $element);
! 15831: }
! 15832: else
! 15833: { # got to do this here, as it isn't done otherwise sinc
! 15834: # print_head_navigation is not called
! 15835: $result .= &$print_navigation(\@SECTION_BUTTONS) if (get_conf('headers') or get_conf('SPLIT') eq 'node');
! 15836: }
! 15837: }
! 15838: }
! 15839: else
! 15840: { # this is here because we want to always print the head navigation for top
! 15841: # and use TOP_BUTTONS
! 15842: $result .= &$print_head_navigation(undef, \@TOP_BUTTONS, $first_in_page, $previous_is_top, $element)
! 15843: if (get_conf('SPLIT') or get_conf('headers'));
! 15844: }
! 15845: }
! 15846: return $result. &$heading($element, $command, $texi_line, $line, $in_preformatted, $one_section, $element_heading);
! 15847: }
! 15848:
! 15849: # This function formats a heading for an element
! 15850: #
! 15851: # argument:
! 15852: # an element. It is a hash reference for a node or a sectioning command.
! 15853: # it may be the wrong one in case of headings.
! 15854: # The interesting keys are:
! 15855: # 'text': the heading text
! 15856: # 'text_nonumber': the heading text without section number
! 15857: # 'node': true if it is a node
! 15858: # 'level': level of the element. 0 for @top, 1 for chapter, heading,
! 15859: # appendix..., 2 for section and so on...
! 15860: # 'tag_level': the sectioning element name, raisesections and lowersections
! 15861: # taken into account
! 15862: sub t2h_default_heading($$$$$;$$)
! 15863: {
! 15864: my $element = shift;
! 15865: my $command = shift;
! 15866: my $texi_line = shift;
! 15867: my $line = shift;
! 15868: my $in_preformatted = shift;
! 15869: my $one_section = shift;
! 15870: my $element_heading = shift;
! 15871:
! 15872: my $level = $element->{'level'};
! 15873: if ($element->{'node'})
! 15874: {
! 15875: if ($element->{'text'} =~ /^top$/i)
! 15876: {
! 15877: $level = 0;
! 15878: }
! 15879: else
! 15880: {
! 15881: $level = 3;
! 15882: }
! 15883: return '' if (!$element->{'this'} or $element->{'with_section'})
! 15884: }
! 15885: else
! 15886: {
! 15887: $command = $element->{'tag_level'};
! 15888: }
! 15889: my $text = $element->{'text'};
! 15890:
! 15891: if ($TOC_LINKS and $command !~ /heading/ and defined($element->{'tocid'}))
! 15892: {
! 15893: $text = &$anchor ('', "$Texi2HTML::THISDOC{'toc_file'}#$element->{'tocid'}", $text);
! 15894: }
! 15895:
! 15896: my $result;
! 15897: if ($in_preformatted)
! 15898: {
! 15899: $result = &$heading_text_preformatted("\@$command", $text, $level);
! 15900: }
! 15901: else
! 15902: {
! 15903: $result = &$heading_text("\@$command", $text, $level);
! 15904: }
! 15905: #$result .= "\n";
! 15906: return $result;
! 15907: }
! 15908:
! 15909: sub t2h_default_heading_no_texi($$$)
! 15910: {
! 15911: my $element = shift;
! 15912: my $command = shift;
! 15913: my $line = shift;
! 15914: return main::remove_texi($line) . "\n";
! 15915: }
! 15916:
! 15917: # formatting of raw regions
! 15918: # if L2H is true another mechanism is used for tex
! 15919: sub t2h_default_raw($$;$)
! 15920: {
! 15921: my $style = shift;
! 15922: my $text = shift;
! 15923: my $line_nr = shift;
! 15924: my $expanded = 1 if (grep {$style eq $_} @EXPAND);
! 15925: if ($style eq 'verbatim' or $style eq 'verbatiminclude' or ($style eq 'tex' and $expanded))
! 15926: {
! 15927: return $text;
! 15928: }
! 15929: elsif ($expanded)
! 15930: {
! 15931: main::line_warn (sprintf(__("Raw format %s is not converted"), $style), $line_nr);
! 15932: return $text;
! 15933: }
! 15934: else
! 15935: {
! 15936: return '';
! 15937: }
! 15938: }
! 15939:
! 15940: # raw environment when removing texi (in comments)
! 15941: sub t2h_default_raw_no_texi($$)
! 15942: {
! 15943: my $style = shift;
! 15944: my $text = shift;
! 15945: if ($style eq 'verbatim' or $style eq 'verbatiminclude' or grep {$style eq $_} @EXPAND)
! 15946: {
! 15947: return $text;
! 15948: }
! 15949: return '';
! 15950: }
! 15951:
! 15952: # This function formats a footnote reference and the footnote text associated
! 15953: # with a given footnote.
! 15954: # The footnote reference is the text appearing in the main document pointing
! 15955: # to the footnote text.
! 15956: #
! 15957: # arguments:
! 15958: # absolute number of the footnote (in the document)
! 15959: # relative number of the footnote (in the page)
! 15960: # identifier for the footnote
! 15961: # identifier for the footnote reference in the main document
! 15962: # main document file
! 15963: # footnote text file
! 15964: # array with the footnote text lines
! 15965: # the state. See menu entry.
! 15966: #
! 15967: # returns:
! 15968: # reference on an array containing the footnote text lines which should
! 15969: # have been updated
! 15970: # the text for the reference pointing on the footnote text
! 15971: sub t2h_default_foot_line_and_ref($$$$$$$$$)
! 15972: {
! 15973: my $number_in_doc = shift;
! 15974: my $number_in_page = shift;
! 15975: my $footnote_id = shift;
! 15976: my $place_id = shift;
! 15977: my $document_file = shift;
! 15978: my $footnote_file = shift;
! 15979: my $lines = shift;
! 15980: my $document_state = shift;
! 15981:
! 15982: $number_in_doc = $NO_NUMBER_FOOTNOTE_SYMBOL if (!$NUMBER_FOOTNOTES);
! 15983:
! 15984: if ($document_file eq $footnote_file)
! 15985: {
! 15986: $document_file = $footnote_file = '';
! 15987: }
! 15988: unshift (@$lines, "($number_in_doc)\n");
! 15989: push @$lines, "\n";
! 15990: return ($lines, "($number_in_doc)");
! 15991: }
! 15992:
! 15993: # formats a group of footnotes.
! 15994: #
! 15995: # argument:
! 15996: # array reference on the footnotes texts lines
! 15997: #
! 15998: # returns an array reference on the group of footnotes lines
! 15999: sub t2h_default_foot_section($)
! 16000: {
! 16001: my $lines = shift;
! 16002: my $header = &$heading_text('footnotes', gdt('Footnotes'), 3);
! 16003: unshift (@$lines, "$header\n");
! 16004: return $lines;
! 16005: }
! 16006:
! 16007: sub t2h_default_image_files($$$$)
! 16008: {
! 16009: my $base = shift;
! 16010: my $extension = shift;
! 16011: my $texi_base = shift;
! 16012: my $texi_extension = shift;
! 16013: my @files = ();
! 16014: return @files if (!defined($base) or ($base eq ''));
! 16015: if (defined($extension) and ($extension ne ''))
! 16016: {
! 16017: push @files,["$base.$extension", "$texi_base.$texi_extension"];
! 16018: }
! 16019: foreach my $ext (@IMAGE_EXTENSIONS)
! 16020: {
! 16021: push @files,["$base.$ext", "$texi_base.$ext"];
! 16022: }
! 16023: return @files;
! 16024: }
! 16025:
! 16026: # format an image
! 16027: #
! 16028: # arguments:
! 16029: # image file name with path
! 16030: # image basename
! 16031: # a boolean true if we are in a preformatted format
! 16032: # image file name without path
! 16033: # alt text
! 16034: # width
! 16035: # height
! 16036: # raw alt
! 16037: # extension
! 16038: # path to working dir
! 16039: # path to file relative from working dir
! 16040: sub t2h_default_image($$$$$$$$$$$$$$$$$)
! 16041: {
! 16042: my $file = shift;
! 16043: my $base = shift;
! 16044: my $preformatted = shift;
! 16045: my $file_name = shift;
! 16046: my $alt = shift;
! 16047: my $width = shift;
! 16048: my $height = shift;
! 16049: my $raw_alt = shift;
! 16050: my $extension = shift;
! 16051: my $working_dir = shift;
! 16052: my $file_path = shift;
! 16053: my $in_paragraph = shift;
! 16054: my $file_locations = shift;
! 16055: my $base_simple_format = shift;
! 16056: my $extension_simple_format = shift;
! 16057: my $file_name_simple_format = shift;
! 16058: my $line_nr = shift;
! 16059:
! 16060: if (!defined($file_path) or $file_path eq '')
! 16061: {
! 16062: if (defined($extension) and $extension ne '')
! 16063: {
! 16064: $file = "$base.$extension";
! 16065: }
! 16066: else
! 16067: {
! 16068: $file = "$base.txt";
! 16069: }
! 16070: }
! 16071: elsif (! $COMPLETE_IMAGE_PATHS)
! 16072: {
! 16073: $file = $file_name;
! 16074: }
! 16075: my $alt_txt = '';
! 16076: $alt_txt = ": $alt" if (defined($alt) and $alt =~ /\S/);
! 16077: return "[ $file$alt_txt ]";
! 16078: # it is possible that $file_name is more correct as it allows the user
! 16079: # to chose the relative path.
! 16080: }
! 16081:
! 16082: # address put in footer describing when was generated and who did the manual
! 16083: # not used anymore
! 16084: sub t2h_default_address($)
! 16085: {
! 16086: my $date = shift;
! 16087: $date = '' if (!defined($date));
! 16088: if ($date ne '')
! 16089: {
! 16090: return gdt('on @emph{{date}}', { 'date' => $date });
! 16091: }
! 16092: return '';
! 16093: }
! 16094:
! 16095: # format a target in the main document for an index entry.
! 16096: #
! 16097: # arguments:
! 16098: # target identifier
! 16099: # boolean true if in preformatted format
! 16100: sub t2h_default_index_entry_label($$$$$$$$$)
! 16101: {
! 16102: my $identifier = shift;
! 16103: my $preformatted = shift;
! 16104: my $entry = shift;
! 16105: my $index_name = shift;
! 16106: my $index_command = shift;
! 16107: my $texi_entry = shift;
! 16108: my $formatted_entry = shift;
! 16109: my $in_region_not_in_output = shift;
! 16110: my $index_entry_ref = shift;
! 16111:
! 16112: return '' if (!defined($identifier) or ($identifier !~ /\S/));
! 16113: my $label = &$anchor($identifier);
! 16114: return $label;
! 16115: }
! 16116:
! 16117: sub t2h_default_index_entry_command($$$$$$)
! 16118: {
! 16119: my $command = shift;
! 16120: my $index_name = shift;
! 16121: my $label = shift;
! 16122: my $entry_texi = shift;
! 16123: my $entry_formatted = shift;
! 16124: my $index_entry_ref = shift;
! 16125:
! 16126: return $label;
! 16127: }
! 16128:
! 16129: # process definition commands line @deffn for example
! 16130: sub t2h_default_def_line($$$$$$$$$$$$$$$$)
! 16131: {
! 16132: my $category_prepared = shift;
! 16133: my $name = shift;
! 16134: my $type = shift;
! 16135: my $arguments = shift;
! 16136: my $index_label = shift;
! 16137: my $arguments_array = shift;
! 16138: my $arguments_type_array = shift;
! 16139: my $unformatted_arguments_array = shift;
! 16140: my $command = shift;
! 16141: my $class_name = shift;
! 16142: my $category = shift;
! 16143: my $class = shift;
! 16144: my $style = shift;
! 16145: my $original_command = shift;
! 16146:
! 16147: $name = '' if (!defined($name) or ($name =~ /^\s*$/));
! 16148: $type = '' if (!defined($type) or $type =~ /^\s*$/);
! 16149: $arguments = '' if (!defined($arguments) or $arguments =~ /^\s*$/);
! 16150:
! 16151: my $type_name = '';
! 16152: $type_name .= "$type " if ($type ne '');
! 16153: $type_name .= $name if ($name ne '');
! 16154:
! 16155: my $result = " -- $category_prepared: ${type_name}$arguments";
! 16156: $result =~ s/\s*$//;
! 16157: $result .= "\n";
! 16158:
! 16159: }
! 16160:
! 16161: # process definition commands line @deffn for example while removing texi
! 16162: # commands
! 16163: sub t2h_default_def_line_no_texi($$$$$)
! 16164: {
! 16165: my $category = shift;
! 16166: my $name = shift;
! 16167: my $type = shift;
! 16168: my $arguments = shift;
! 16169: $name = '' if (!defined($name) or ($name =~ /^\s*$/));
! 16170: $type = '' if (!defined($type) or $type =~ /^\s*$/);
! 16171: if (!defined($arguments) or $arguments =~ /^\s*$/)
! 16172: {
! 16173: $arguments = '';
! 16174: }
! 16175: my $type_name = '';
! 16176: $type_name = " $type" if ($type ne '');
! 16177: $type_name .= ' ' . $name if ($name ne '');
! 16178: $type_name .= $arguments;
! 16179: if (! $DEF_TABLE)
! 16180: {
! 16181: return $category . ':' . $type_name . "\n";
! 16182: }
! 16183: else
! 16184: {
! 16185:
! 16186: return $type_name . " " . $category . "\n";
! 16187: }
! 16188: }
! 16189:
! 16190: # a cartouche
! 16191: sub t2h_default_cartouche($$)
! 16192: {
! 16193: my $text = shift;
! 16194:
! 16195: if ($text =~ /\S/)
! 16196: {
! 16197: return $text;
! 16198: }
! 16199: return '';
! 16200: }
! 16201:
! 16202: my $IDXFILE;
! 16203: # key:
! 16204: # origin_href:
! 16205: # entry:
! 16206: # texi entry:
! 16207: # element_href:
! 16208: # element_text:
! 16209: sub t2h_default_index_summary_file_entry ($$$$$$$$$)
! 16210: {
! 16211: my $index_name = shift;
! 16212: my $key = shift;
! 16213: my $origin_href = shift;
! 16214: my $entry = shift;
! 16215: my $texi_entry = shift;
! 16216: my $element_href = shift;
! 16217: my $element_text = shift;
! 16218: my $is_printed = shift;
! 16219: my $manual_name = shift;
! 16220:
! 16221: $element_text = 'UNDEF' if (!defined($element_text));
! 16222: print $IDXFILE "key: $key\n origin_href: $origin_href\n entry: $entry\n"
! 16223: . " texi_entry: $texi_entry\n"
! 16224: . " element_href: $element_href\n element_text: $element_text\n";
! 16225: }
! 16226:
! 16227: sub t2h_default_index_summary_file_begin($$$)
! 16228: {
! 16229: my $name = shift;
! 16230: my $is_printed = shift;
! 16231: my $manual_name = shift;
! 16232:
! 16233: $IDXFILE = main::open_out("$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'file_base_name'}" . "_$name.idx");
! 16234: #open(IDXFILE, ">$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'file_base_name'}" . "_$name.idx")
! 16235: # || die "Can't open >$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'file_base_name'}" . "_$name.idx for writing: $!\n";
! 16236: }
! 16237:
! 16238: sub t2h_default_index_summary_file_end($$$)
! 16239: {
! 16240: my $name = shift;
! 16241: my $is_printed = shift;
! 16242: my $manual_name = shift;
! 16243:
! 16244: close ($IDXFILE);
! 16245: }
! 16246:
! 16247: sub t2h_default_sp($$)
! 16248: {
! 16249: my $number = shift;
! 16250: my $preformatted = shift;
! 16251: return "\n" x $number;
! 16252: }
! 16253:
! 16254: sub t2h_default_acronym_like($$$$$$)
! 16255: {
! 16256: my $command = shift;
! 16257: my $acronym_texi = shift;
! 16258: my $acronym_text = shift;
! 16259: my $with_explanation = shift;
! 16260: my $explanation_lines = shift;
! 16261: my $explanation_text = shift;
! 16262: my $explanation_simply_formatted = shift;
! 16263:
! 16264: if ($with_explanation)
! 16265: {
! 16266: #return "$acronym_text ($explanation_text)";
! 16267: return gdt('{acronym_like} ({explanation})', {'acronym_like' => $acronym_text, 'explanation' => $explanation_text},{'duplicate'=>1});
! 16268: }
! 16269: else
! 16270: {
! 16271: return "$acronym_text";
! 16272: }
! 16273:
! 16274: }
! 16275:
! 16276: sub t2h_default_quotation_prepend_text($$)
! 16277: {
! 16278: my $command = shift;
! 16279: my $text = shift;
! 16280: return undef if (!defined($text) or $text =~ /^$/);
! 16281: # If there is a @ protecting the end of line the result is,
! 16282: # after the chomp:
! 16283: # @b{some text @:}
! 16284: # It is likely not to be what was intended, but it is certainly right.
! 16285: # this is tested in formatting/quotation.texi
! 16286: chomp($text);
! 16287: return gdt('@b{{quotation_arg}:} ', {'quotation_arg' => $text}, {'keep_texi' => 1});
! 16288: }
! 16289:
! 16290: sub t2h_default_quotation($$$$$)
! 16291: {
! 16292: my $command = shift;
! 16293: my $text = shift;
! 16294: my $argument_text = shift;
! 16295: my $argument_text_texi = shift;
! 16296: my $authors = shift;
! 16297: my $class_text = '';
! 16298: # this allows to add an end of line if there was none, which can happen
! 16299: # if there is an argument to @quotation, but an empty quotation, like
! 16300: # @quotation something
! 16301: # @end quotation
! 16302: chomp($text);
! 16303: $text .= "\n";
! 16304: return $text;
! 16305: }
! 16306:
! 16307: # format the text within a paragraph style format,
! 16308: #
! 16309: # argument:
! 16310: # format name
! 16311: # text within the format
! 16312: sub t2h_default_paragraph_style_command($$)
! 16313: {
! 16314: my $format = shift;
! 16315: my $text = shift;
! 16316: return $text;
! 16317: }
! 16318:
! 16319: # format a whole index
! 16320: #
! 16321: # argument:
! 16322: # index text
! 16323: # index name
! 16324: sub t2h_default_print_index($$)
! 16325: {
! 16326: my $text = shift;
! 16327: my $name = shift;
! 16328: return '' if (!defined($text));
! 16329: return "* Index:\n" . $text;
! 16330: }
! 16331:
! 16332: # format a letter entry in an index page. The letter entry contains
! 16333: # the index entries for the words beginning with that letter. It is
! 16334: # a target for links pointing from the summary of the index.
! 16335: #
! 16336: # arguments:
! 16337: # the letter
! 16338: # identifier for the letter entry. This should be used to make the target
! 16339: # identifier
! 16340: # text of the index entries
! 16341: sub t2h_default_index_letter($$$)
! 16342: {
! 16343: my $letter = shift;
! 16344: my $id = shift;
! 16345: my $text = shift;
! 16346: return $text;
! 16347: }
! 16348:
! 16349: # format an index entry (in a letter entry).
! 16350: #
! 16351: # arguments:
! 16352: # href to the main text, linking to the place where the index entry appears
! 16353: # entry text
! 16354: # href to the main text, linking to the section or node where the index
! 16355: # entry appears
! 16356: # section or node heading
! 16357: sub t2h_default_index_entry($$$$$$$$$$)
! 16358: {
! 16359: my $text_href = shift;
! 16360: my $entry = shift;
! 16361: my $element_href = shift;
! 16362: my $element_text = shift;
! 16363: my $entry_file = shift;
! 16364: my $current_element_file = shift;
! 16365: my $entry_target = shift;
! 16366: my $entry_element_target = shift;
! 16367: my $in_region_not_in_output = shift;
! 16368: my $index_entry_ref = shift;
! 16369:
! 16370: return '' if ($in_region_not_in_output);
! 16371: #!$index_entry_ref->{'seen_in_output'} and defined($index_entry_ref->{'region'}));
! 16372: $entry = main::substitute_line($index_entry_ref->{'texi'}, "index entry in \@printindex");
! 16373: return '' if ($entry =~ /^\s*$/);
! 16374:
! 16375: my $real_element_text;
! 16376: my $element = $index_entry_ref->{'real_element'};
! 16377: # in case $element->{'text'} is not defined, it certainly means that we
! 16378: # are n a special elemet, most likely the virtual element appearing
! 16379: # before anything else
! 16380: if (defined($element->{'text'}))
! 16381: {
! 16382: my $element_set = 0;
! 16383: if ($NODE_NAME_IN_INDEX)
! 16384: {
! 16385: if ($element->{'node'})
! 16386: {
! 16387: $element_set = 1;
! 16388: }
! 16389: elsif ($element->{'with_node'})
! 16390: {
! 16391: $element = $element->{'with_node'};
! 16392: $element_set = 1;
! 16393: }
! 16394: }
! 16395: elsif (defined($NODE_NAME_IN_INDEX))
! 16396: {
! 16397: if (!$element->{'node'})
! 16398: {
! 16399: $element_set = 1;
! 16400: }
! 16401: elsif ($element->{'with_section'})
! 16402: {
! 16403: $element = $element->{'with_section'};
! 16404: $element_set = 1;
! 16405: }
! 16406: }
! 16407: $element = $element->{'element_ref'} if ($element->{'element_ref'} and !$element_set);
! 16408: $real_element_text = $element->{'text'};
! 16409: }
! 16410: else
! 16411: {
! 16412: $real_element_text = gdt('(outside of any element)');
! 16413: }
! 16414: return "* $entry: ".$real_element_text . '.'."\n";
! 16415: }
! 16416:
! 16417:
! 16418: sub t2h_default_copying_comment($$$$)
! 16419: {
! 16420: my $copying_lines = shift;
! 16421: my $copying_text = shift;
! 16422: my $copying_no_texi = shift;
! 16423: my $copying_simple_text = shift;
! 16424: return '' if ($copying_no_texi eq '');
! 16425: my $text = &$comment($copying_no_texi);
! 16426: return $text;
! 16427: }
! 16428:
! 16429: # return value is currently ignored
! 16430: sub t2h_default_documentdescription($$$$)
! 16431: {
! 16432: my $decription_lines = shift;
! 16433: my $description_text = shift;
! 16434: my $description_no_texi = shift;
! 16435: my $description_simple_text = shift;
! 16436:
! 16437: if (defined($DOCUMENT_DESCRIPTION))
! 16438: {
! 16439: $Texi2HTML::THISDOC{'DOCUMENT_DESCRIPTION'} = $DOCUMENT_DESCRIPTION;
! 16440: return $DOCUMENT_DESCRIPTION;
! 16441: }
! 16442:
! 16443: #return '' if ($description_no_texi eq '');
! 16444: #my @documentdescription = split (/\n/, $description_no_texi);
! 16445: if ($description_simple_text eq '')
! 16446: {
! 16447: $Texi2HTML::THISDOC{'DOCUMENT_DESCRIPTION'} = undef;
! 16448: return undef;
! 16449: }
! 16450: my @documentdescription = split (/\n/, $description_simple_text);
! 16451: my $document_description = shift @documentdescription;
! 16452: chomp $document_description;
! 16453: foreach my $line (@documentdescription)
! 16454: {
! 16455: chomp $line;
! 16456: $document_description .= ' ' . $line;
! 16457: }
! 16458: $Texi2HTML::THISDOC{'DOCUMENT_DESCRIPTION'} = $document_description;
! 16459: return $document_description;
! 16460: }
! 16461:
! 16462: # format an index summary. This is a list of letters linking to the letter
! 16463: # entries.
! 16464: #
! 16465: # arguments:
! 16466: # array reference containing the formatted alphabetical letters
! 16467: # array reference containing the formatted non lphabetical letters
! 16468: sub t2h_default_index_summary($$)
! 16469: {
! 16470: my $alpha = shift;
! 16471: my $nonalpha = shift;
! 16472:
! 16473: my $join = '';
! 16474: my $nonalpha_text = '';
! 16475: my $alpha_text = '';
! 16476: return '';
! 16477: }
! 16478:
! 16479: # return the heading with number texinfo text
! 16480: # also called for nodes.
! 16481: sub t2h_default_heading_texi($$$)
! 16482: {
! 16483: my $tag = shift;
! 16484: my $texi = shift;
! 16485: my $number = shift;
! 16486: #$texi = main::trim_around_spaces($texi);
! 16487: return "$number $texi" if ($NUMBER_SECTIONS and defined($number) and ($number !~ /^\s*$/)) ;
! 16488: return $texi;
! 16489: }
! 16490:
! 16491: # return the heading texinfo text for split index sections
! 16492: sub t2h_default_index_element_heading_texi($$$)
! 16493: { # FIXME i18n
! 16494: my $heading_texi = shift;
! 16495: my $tag = shift;
! 16496: my $texi = shift;
! 16497: my $number = shift;
! 16498: my $first_letter = shift;
! 16499: my $last_letter = shift;
! 16500: return "$heading_texi: $first_letter -- $last_letter" if ($last_letter ne $first_letter);
! 16501: return "$heading_texi: $first_letter";
! 16502: }
! 16503:
! 16504: sub t2h_default_element_label($$$$)
! 16505: {
! 16506: my $id = shift;
! 16507: my $element = shift;
! 16508: my $command = shift;
! 16509: my $line = shift;
! 16510:
! 16511: return &$anchor($id);
! 16512: }
! 16513:
! 16514: sub t2h_default_misc_element_label($$)
! 16515: {
! 16516: my $id = shift;
! 16517: my $misc_page_name = shift;
! 16518: return &$anchor($id);
! 16519: }
! 16520:
! 16521: sub t2h_default_anchor_label($$$$)
! 16522: {
! 16523: my $id = shift;
! 16524: my $anchor_text = shift;
! 16525: my $anchor_reference = shift;
! 16526: my $in_special_region = shift;
! 16527: return &$anchor($id);
! 16528: }
! 16529:
! 16530: sub t2h_default_colon_command($)
! 16531: {
! 16532: my $punctuation_character = shift;
! 16533: return $colon_command_punctuation_characters{$punctuation_character} if defined($colon_command_punctuation_characters{$punctuation_character});
! 16534: return $punctuation_character;
! 16535: }
! 16536:
! 16537: # called each time a @tab or an @itemx is encountered.
! 16538: # To be noticed that there is another function better suited for
! 16539: # formatting of an @item line: $format_list_item_texi
! 16540: sub t2h_default_tab_item_texi($$$$$$)
! 16541: {
! 16542: my $command = shift;
! 16543: my $commands_stack = shift;
! 16544: my $stack = shift;
! 16545: my $state = shift;
! 16546: my $line = shift;
! 16547: my $line_nr = shift;
! 16548:
! 16549: return undef;
! 16550: }
! 16551:
! 16552: sub xml_default_line_command($$$$)
! 16553: {
! 16554: my $command = shift;
! 16555: my $arg_text = shift;
! 16556: my $arg_texi = shift;
! 16557: my $state = shift;
! 16558:
! 16559: my $style = $line_command_map{$command};
! 16560: return '' if ($arg_text eq '' and !defined($style) or $style eq '');
! 16561: if ($style)
! 16562: {
! 16563: my $attribute_text = '';
! 16564: if ($style =~ /^(\w+)(\s+.*)/)
! 16565: {
! 16566: $style = $1;
! 16567: $attribute_text = $2;
! 16568: }
! 16569: $arg_text = "<${style}$attribute_text>$arg_text</$style>";
! 16570: }
! 16571: $arg_text .= "\n";
! 16572: return $arg_text;
! 16573: }
! 16574:
! 16575: sub t2h_default_line_command($$$$)
! 16576: {
! 16577: my $command = shift;
! 16578: my $arg_text = shift;
! 16579: my $arg_texi = shift;
! 16580: my $state = shift;
! 16581:
! 16582: return $arg_text;
! 16583: }
! 16584:
! 16585: # info is special, since it doesn't use the basename but directly the
! 16586: # setfilename output, contrary to all the other formats
! 16587: sub t2h_default_element_file_name($$$)
! 16588: {
! 16589: my $element = shift;
! 16590: my $type = shift;
! 16591: my $prefix = shift;
! 16592:
! 16593: my $outname;
! 16594: return unless ($USE_SETFILENAME_EXTENSION and $PREFIX eq '');
! 16595: $outname = $OUT if (defined($OUT) and $OUT ne '' and $OUT !~ /\/$/ and $Texi2HTML::THISDOC{'input_file_number'} == 0);
! 16596: if ($type eq 'doc' or !get_conf('SPLIT'))
! 16597: {
! 16598: if (defined($Texi2HTML::THISDOC{'setfilename'}) and !defined($outname))
! 16599: {
! 16600: $Texi2HTML::THISDOC{'extension'} = '';
! 16601: return $Texi2HTML::THISDOC{'setfilename'};
! 16602: }
! 16603: }
! 16604:
! 16605: return undef;
! 16606: }
! 16607:
! 16608: sub t2h_default_misc_command_line($$$$$)
! 16609: {
! 16610: my $macro = shift;
! 16611: my $line = shift;
! 16612: my $args = shift;
! 16613: my $stack = shift;
! 16614: my $state = shift;
! 16615:
! 16616: my $result;
! 16617: return ($macro, $line, $result);
! 16618: }
! 16619:
! 16620: sub t2h_default_internal_links($$$)
! 16621: {
! 16622: my $fh = shift;
! 16623: my $elements_list = shift;
! 16624: my $indices = shift;
! 16625:
! 16626: foreach my $element (@$elements_list)
! 16627: {
! 16628: my $text = $element->{'no_texi'};
! 16629: #$text =~ s/^([\w.]+)\. /$1 /;
! 16630: #$text = "Annexe ".$text if ($element->{'tag'} =~ /appendix/);
! 16631: print $fh "$element->{'file'}#$element->{'id'}\ttoc\t$text\n";
! 16632: }
! 16633: foreach my $index_name (sort(keys(%$indices)))
! 16634: {
! 16635: my $entries = $indices->{$index_name};
! 16636:
! 16637: foreach my $letter_entries (@$entries)
! 16638: {
! 16639: foreach my $entry (@{$letter_entries->{'entries'}})
! 16640: {
! 16641: #print STDERR "($index_name) key $key, t $entry->{'texi'}: $entry->{'file'}#$entry->{'target'}\n";
! 16642: print $fh "$entry->{'file'}#$entry->{'target'}\t$index_name\t$entry->{'key'}\n" if ($entry->{'key'} =~ /\S/);
! 16643: }
! 16644: }
! 16645: }
! 16646: }
! 16647:
! 16648: 1;
! 16649:
! 16650: require "$T2H_HOME/texi2html.init"
! 16651: if ($0 =~ /\.pl$/ &&
! 16652: -e "$T2H_HOME/texi2html.init" && -r "$T2H_HOME/texi2html.init");
! 16653:
! 16654: # @INIT_HTML@
! 16655: # -*-perl-*-
! 16656: # vim: set filetype=perl:
! 16657: ######################################################################
! 16658: # File: html.init
! 16659: # html output formatting
! 16660: #
! 16661: # A copy of this file is pasted into the beginning of texi2html by
! 16662: # running './configure'.
! 16663: #
! 16664: # $Id: html.init,v 1.53 2010/06/26 09:54:23 pertusus Exp $
! 16665:
! 16666: use strict;
! 16667:
! 16668: use vars qw(@html_default_multitable_stack);
! 16669: # used in mediawiki.init
! 16670: #my @html_default_multitable_stack;
! 16671: # tracks menu entry index
! 16672: my $html_menu_entry_index;
! 16673: # the simple_formatted document title
! 16674: my $html_default_title;
! 16675:
! 16676: # initialise the html output
! 16677: sub html_default_load(;$)
! 16678: {
! 16679: my $from_command_line = shift;
! 16680:
! 16681: t2h_default_set_variables_xml();
! 16682:
! 16683: ###############################################################
! 16684: # defaults
! 16685:
! 16686: $HEADERS = 1;
! 16687:
! 16688: @T2H_FORMAT_EXPAND = ('html');
! 16689:
! 16690: # The value is the 'SystemLiteral' which identifies the canonical DTD
! 16691: # for the document.
! 16692: # Definition: The SystemLiteral is called the entity's system
! 16693: # identifier. It is a URI, which may be used to retrieve the entity.
! 16694: # See http://www.xml.com/axml/target.html#NT-ExternalID
! 16695: $DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
! 16696:
! 16697: # When frames are used, this SystemLiteral identifies the DTD used for
! 16698: # the file containing the frame description.
! 16699: $FRAMESET_DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';
! 16700:
! 16701: # if this value is true, ISO8859 characters are used for special symbols
! 16702: # (like copyright, etc).
! 16703: $USE_ISO = 1;
! 16704:
! 16705: # if the value is true the Texinfo menus are shown.
! 16706: $SHOW_MENU = 1;
! 16707:
! 16708: $SHOW_TITLE = 1;
! 16709:
! 16710: # default is to use nodes only as elements.
! 16711: $USE_SECTIONS = undef;
! 16712:
! 16713: $TOP_FILE = 'index.html';
! 16714:
! 16715: # file name used for Top node when NODE_FILES is true
! 16716: $TOP_NODE_FILE = 'index';
! 16717:
! 16718: ##############################################################################
! 16719: #
! 16720: # The following can only be set in the init file
! 16721: #
! 16722: ##############################################################################
! 16723:
! 16724: $INLINE_INSERTCOPYING = 0;
! 16725:
! 16726: # if this variable is true, numeric entities are used when there is no
! 16727: # corresponding textual entity.
! 16728: $USE_NUMERIC_ENTITY = 1;
! 16729:
! 16730: # if true, use the original command if the result is an entity
! 16731: $ENABLE_ENCODING_USE_ENTITY = 1;
! 16732:
! 16733: # used as identation for block enclosing command @example, etc
! 16734: # If not empty, must be enclosed in <td></td>
! 16735: $EXAMPLE_INDENT_CELL = '<td> </td>';
! 16736:
! 16737: # same as above, only for @small
! 16738: $SMALL_EXAMPLE_INDENT_CELL = '<td> </td>';
! 16739:
! 16740: # font size for @small
! 16741: $SMALL_FONT_SIZE = '-1';
! 16742:
! 16743: # horizontal rules
! 16744: # Not used
! 16745: $SMALL_RULE = '<hr size="1">';
! 16746: $MIDDLE_RULE = '<hr size="2">';
! 16747: # used almost everywhere
! 16748: $DEFAULT_RULE = '<hr>';
! 16749: # used for top element and before misc elements
! 16750: $BIG_RULE = '<hr size="6">';
! 16751:
! 16752: # symbol put at the beginning of nodes entry in menu (and optionnaly of
! 16753: # unnumbered in menus, see next variable)
! 16754: $MENU_SYMBOL = '•';
! 16755: #$MENU_SYMBOL = '*';
! 16756:
! 16757: $SIMPLE_MENU = 0;
! 16758:
! 16759: # extension for nodes files when NODE_FILES is true
! 16760: $NODE_FILE_EXTENSION = 'html';
! 16761:
! 16762: # extension
! 16763: $EXTENSION = 'html';
! 16764:
! 16765: # default is to split the html output
! 16766: $SPLIT = 'node';
! 16767:
! 16768: # this resets all the variables to the texi2html specific values if
! 16769: # called as texi2html
! 16770:
! 16771: t2h_default_set_variables_texi2html() if ($COMMAND_NAME eq 'texi2html');
! 16772:
! 16773: # this controls the pre style for menus
! 16774: $MENU_PRE_STYLE = 'font-family: serif';
! 16775:
! 16776: # on bug-texinfo is has been said the the style is not code_style
! 16777: # for menus (except for the node name).
! 16778: # this controls the menu preformatted format
! 16779: # FIXME this is not dynamic, so change in MENU_PRE_STYLE is not taken
! 16780: # into account.
! 16781: # This is used if the menu appears within a preformatted format (which
! 16782: # is certainly an invalid construct), and SIMPLE_MENU is not set.
! 16783: $MENU_PRE_COMPLEX_FORMAT = {
! 16784: 'pre_style' => $MENU_PRE_STYLE,
! 16785: 'class' => 'menu-preformatted',
! 16786: # 'style' => 'code'
! 16787: };
! 16788:
! 16789: # This controls the ul style for toc
! 16790: $NO_BULLET_LIST_STYLE = 'list-style: none';
! 16791: $NO_BULLET_LIST_CLASS = 'no-bullet';
! 16792: $NO_BULLET_LIST_ATTRIBUTE = ' class="'.$NO_BULLET_LIST_CLASS.'"';
! 16793:
! 16794: # These lines are inserted before and after the shortcontents
! 16795: $BEFORE_OVERVIEW = "<div class=\"shortcontents\">\n";
! 16796: $AFTER_OVERVIEW = "</div>\n";
! 16797:
! 16798: # These lines are inserted before and after the contents
! 16799: $BEFORE_TOC_LINES = "<div class=\"contents\">\n";
! 16800: $AFTER_TOC_LINES = "</div>\n";
! 16801:
! 16802: # text inserted after <body ...>
! 16803: $AFTER_BODY_OPEN = '';
! 16804:
! 16805: # text inserted before </body>, this will be automatically inside <p></p>
! 16806: $PRE_BODY_CLOSE = '';
! 16807:
! 16808: # this is added inside <head></head> after <title> and some <meta name>
! 16809: # stuff, it can be used for eg. <style>, <script>, <meta> etc. tags.
! 16810: $EXTRA_HEAD = '';
! 16811:
! 16812: # Specifies the minimum page length required before a navigation panel
! 16813: # is placed at the bottom of a page
! 16814: $WORDS_IN_PAGE = 300;
! 16815:
! 16816: # html version for latex2html
! 16817: $L2H_HTML_VERSION = "4.0";
! 16818:
! 16819: # this is not set dynamically
! 16820: if (!$HEADER_IN_TABLE)
! 16821: {
! 16822: @SECTION_BUTTONS = ([ 'NodeNext', \&html_default_node_direction ],
! 16823: [ 'NodePrev', \&html_default_node_direction ],
! 16824: [ 'NodeUp', \&html_default_node_direction ], ' ',
! 16825: 'Contents', 'Index');
! 16826: @CHAPTER_BUTTONS = @SECTION_FOOTER_BUTTONS = @NODE_FOOTER_BUTTONS =
! 16827: @MISC_BUTTONS = @TOP_BUTTONS = @SECTION_BUTTONS;
! 16828: $BIG_RULE = $DEFAULT_RULE;
! 16829: }
! 16830:
! 16831: $ICONS = 0;
! 16832:
! 16833: %BUTTONS_ACCESSKEY =
! 16834: (
! 16835: 'Top', '',
! 16836: 'Contents', '',
! 16837: 'Overview', '',
! 16838: 'Index', '',
! 16839: 'This', '',
! 16840: 'Back', 'p',
! 16841: 'FastBack', '',
! 16842: 'Prev', 'p',
! 16843: 'Up', 'u',
! 16844: 'Next', 'n',
! 16845: 'NodeUp', 'u',
! 16846: 'NodeNext', 'n',
! 16847: 'NodePrev', 'p',
! 16848: 'Following', '',
! 16849: 'Forward', 'n',
! 16850: 'FastForward', '',
! 16851: 'About' , '',
! 16852: 'First', '',
! 16853: 'Last', '',
! 16854: 'NextFile', '',
! 16855: 'PrevFile', '',
! 16856: );
! 16857:
! 16858: # see http://www.w3.org/TR/REC-html40/types.html#type-links
! 16859: %BUTTONS_REL =
! 16860: (
! 16861: 'Top', 'start',
! 16862: 'Contents', 'contents',
! 16863: 'Overview', '',
! 16864: 'Index', 'index',
! 16865: 'This', '',
! 16866: 'Back', 'previous',
! 16867: 'FastBack', '',
! 16868: 'Prev', 'previous',
! 16869: 'Up', 'up',
! 16870: 'Next', 'next',
! 16871: 'NodeUp', 'up',
! 16872: 'NodeNext', 'next',
! 16873: 'NodePrev', 'previous',
! 16874: 'Following', '',
! 16875: 'Forward', 'next',
! 16876: 'FastForward', '',
! 16877: 'About' , 'help',
! 16878: 'First', '',
! 16879: 'Last', '',
! 16880: 'NextFile', 'next',
! 16881: 'PrevFile', 'previous',
! 16882: );
! 16883:
! 16884:
! 16885:
! 16886: # PRE_ABOUT can be a function reference or a scalar.
! 16887: # Note that if it is a scalar, T2H_InitGlobals has not been called,
! 16888: # and all global variables like $ADDRESS are not available.
! 16889: $PRE_ABOUT = sub
! 16890: {
! 16891: return ' ' . &$program_string() . "\n";
! 16892: };
! 16893:
! 16894: # If customizing $AFTER_ABOUT, be sure to put the content inside <p></p>.
! 16895: $AFTER_ABOUT = '';
! 16896:
! 16897: %BUTTONS_EXAMPLE =
! 16898: (
! 16899: 'Top', ' ',
! 16900: 'Contents', ' ',
! 16901: 'Overview', ' ',
! 16902: 'Index', ' ',
! 16903: 'This', '1.2.3',
! 16904: 'Back', '1.2.2',
! 16905: 'FastBack', '1',
! 16906: 'Prev', '1.2.2',
! 16907: 'Up', '1.2',
! 16908: 'Next', '1.2.4',
! 16909: 'NodeUp', '1.2',
! 16910: 'NodeNext', '1.2.4',
! 16911: 'NodePrev', '1.2.2',
! 16912: 'Following', '1.2.4',
! 16913: 'Forward', '1.2.4',
! 16914: 'FastForward', '2',
! 16915: 'About', ' ',
! 16916: 'First', '1.',
! 16917: 'Last', '1.2.4',
! 16918: 'NextFile', ' ',
! 16919: 'PrevFile', ' ',
! 16920: );
! 16921:
! 16922: @IMAGE_EXTENSIONS = ('png','jpg','jpeg','gif');
! 16923: #, 'txt');
! 16924:
! 16925: #######################################################################
! 16926: #
! 16927: # Values guessed if not set here. The value used is in
! 16928: # $Texi2HTML::THISDOC{'VARNAME'}
! 16929: #
! 16930: #######################################################################
! 16931:
! 16932: $BODYTEXT = undef;
! 16933:
! 16934: #$init_out = \&html_default_init_out;
! 16935: $translate_names = \&html_default_translate_names;
! 16936:
! 16937: t2h_default_push_handler(\&html_default_initialize, \@command_handler_init);
! 16938: # This must be done after language has been set
! 16939: t2h_default_push_handler(\&html_default_bodytext, \@command_handler_process);
! 16940: # This must be done after the fulltitle has been set
! 16941: t2h_default_push_handler(\&html_default_do_title, \@command_handler_output);
! 16942:
! 16943: ########################################################################
! 16944: # Control of Page layout:
! 16945: # You can make changes of the Page layout at two levels:
! 16946: # 1.) For small changes, it is often enough to change the value of
! 16947: # some global string/hash/array variables
! 16948: # 2.) For larger changes, reimplement one of the HTML_DEFAULT_<fnc>* routines,
! 16949: # give them another name, and assign them to the respective
! 16950: # $<fnc> variable.
! 16951:
! 16952: # As a general interface, the hashes Texi2HTML::HREF, Texi2HTML::NAME, Texi2HTML::NODE, Texi2HTML::NO_TEXI, Texi2HTML::SIMPLE_TEXT hold
! 16953: # href, html-name, node-name, name after removal of texi commands of
! 16954: # This -- current section (resp. html page)
! 16955: # Top -- top element
! 16956: # Contents -- Table of contents element
! 16957: # Overview -- Short table of contents element
! 16958: # Index -- Index page element
! 16959: # About -- page which explain "navigation buttons" element
! 16960: # First -- first node element
! 16961: # Last -- last node element
! 16962: #
! 16963: # Whether or not the following hash values are set, depends on the context
! 16964: # (all values are w.r.t. 'This' section)
! 16965: # Next -- next element of texinfo
! 16966: # Prev -- previous element of texinfo
! 16967: # NodeUp -- up node of texinfo
! 16968: # Following -- following node in node reading order, taking menu into account
! 16969: # Forward -- next node in reading order
! 16970: # Back -- previous node in reading order
! 16971: # Up -- parent given by sectioning commands
! 16972: # FastForward -- if leave node, up and next, else next node
! 16973: # FastBackward-- if leave node, up and prev, else prev node
! 16974: #
! 16975: # Furthermore, the following global variabels are set:
! 16976: # $Texi2HTML::THISDOC{title} -- title as set by @title...
! 16977: # $Texi2HTML::THISDOC{title_no_texi} -- title without texi (without html elements)
! 16978: # $Texi2HTML::THISDOC{title_texi} -- title with texinfo @-commands
! 16979: # $Texi2HTML::THISDOC{fulltitle} -- full title as set by @title...
! 16980: # $Texi2HTML::THISDOC{subtitle} -- subtitle as set by @subtitle
! 16981: # $Texi2HTML::THISDOC{author} -- author as set by @author
! 16982: # $Texi2HTML::THISDOC{copying_comment} -- text of @copying and @end copying in comment
! 16983: #
! 16984: # $Texi2HTML::THISDOC{program} -- name and version of texi2html
! 16985: # $Texi2HTML::THISDOC{program_homepage} -- homepage for texi2html
! 16986: # $Texi2HTML::THISDOC{program_authors} -- authors of texi2html
! 16987: # $Texi2HTML::THISDOC{today} -- date formatted with pretty_date
! 16988: # $Texi2HTML::THISDOC{toc_file} -- table of contents file
! 16989: # $Texi2HTML::THISDOC{file_base_name} -- base name of the texinfo manual file
! 16990: # $Texi2HTML::THISDOC{input_file_name} -- name of the texinfo manual file
! 16991: # $Texi2HTML::THISDOC{destination_directory}
! 16992: # -- directory for the resulting files
! 16993: # $Texi2HTML::THISDOC{user} -- user running the script
! 16994: # $Texi2HTML::THISDOC{css_import_lines} -- ref on @import lines in css files
! 16995: # $Texi2HTML::THISDOC{css_rule_lines} -- ref on css rules lines
! 16996: # other $Texi2HTML::THISDOC keys corresponds with texinfo commands, the value
! 16997: # being the command arg, for the following commands:
! 16998: # kbdinputstyle, paragraphindent, setchapternewpage, headings, footnotestyle,
! 16999: # exampleindent, firstparagraphindent, everyheading, everyfooting,
! 17000: # evenheading, evenfooting, oddheading, oddfooting
! 17001: #
! 17002: # and pointer to arrays of lines which need to be printed by main::print_lines
! 17003: # $Texi2HTML::THIS_SECTION -- lines of 'This' section
! 17004: # $Texi2HTML::OVERVIEW -- lines of short table of contents
! 17005: # $Texi2HTML::TOC_LINES -- lines of table of contents
! 17006: # $Texi2HTML::TITLEPAGE -- lines of title page
! 17007: #
! 17008: # $Texi2HTML::THIS_ELEMENT holds the element reference.
! 17009:
! 17010: #
! 17011: # There are the following subs which control the layout:
! 17012: #
! 17013: $print_section = \&HTML_DEFAULT_print_section;
! 17014: $end_section = \&HTML_DEFAULT_end_section;
! 17015: $one_section = \&HTML_DEFAULT_one_section;
! 17016: $print_Top_footer = \&HTML_DEFAULT_print_Top_footer;
! 17017: $print_Top = \&HTML_DEFAULT_print_Top;
! 17018: # changed in info format, but irrelevant for non-split formats
! 17019: $print_Footnotes = \&T2H_DEFAULT_print_Footnotes;
! 17020: $print_misc_header = \&HTML_DEFAULT_print_misc_header;
! 17021: $print_misc_footer = \&HTML_DEFAULT_print_misc_footer;
! 17022: $print_section_footer = \&HTML_DEFAULT_print_section_footer;
! 17023: $print_chapter_header = \&HTML_DEFAULT_print_chapter_header;
! 17024: $print_section_header = \&HTML_DEFAULT_print_section_header;
! 17025: $print_chapter_footer = \&HTML_DEFAULT_print_chapter_footer;
! 17026: $print_page_head = \&HTML_DEFAULT_print_page_head;
! 17027: $print_page_foot = \&HTML_DEFAULT_print_page_foot;
! 17028: $print_head_navigation = \&HTML_DEFAULT_print_head_navigation;
! 17029: $print_foot_navigation = \&HTML_DEFAULT_print_foot_navigation;
! 17030: $button_icon_img = \&HTML_DEFAULT_button_icon_img;
! 17031: $button_formatting = \&HTML_DEFAULT_button_formatting;
! 17032:
! 17033: $print_navigation = \&HTML_DEFAULT_print_navigation;
! 17034: $about_body = \&HTML_DEFAULT_about_body;
! 17035:
! 17036: $print_frame = \&HTML_DEFAULT_print_frame;
! 17037: $print_toc_frame = \&HTML_DEFAULT_print_toc_frame;
! 17038: $contents = \&HTML_DEFAULT_contents;
! 17039: $shortcontents = \&HTML_DEFAULT_shortcontents;
! 17040: $print_redirection_page = \&HTML_DEFAULT_print_redirection_page;
! 17041:
! 17042: ########################################################################
! 17043: # Control of formatting:
! 17044: # 1.) For some changes, it is often enough to change the value of
! 17045: # some global map. It might necessitate building a little
! 17046: # function along with the change in hash, if the change is the use
! 17047: # of another function (in style_map).
! 17048: # 2.) For other changes, reimplement one of the t2h_default_<fnc>* routines,
! 17049: # give them another name, and assign them to the respective
! 17050: # $<fnc> variable (below).
! 17051:
! 17052:
! 17053: #
! 17054: # texinfo "simple things" (@foo) to HTML ones
! 17055: #
! 17056: %simple_map = %default_simple_map;
! 17057: $simple_map{'*'} = '<br>'; # HTML+
! 17058: $simple_map{' '} = ' ';
! 17059: $simple_map{"\t"} = ' ';
! 17060: $simple_map{"\n"} = ' ';
! 17061: # "­" or "­" could also be possible for @-, but it seems
! 17062: # that some browser will consider this as an always visible hyphen mark
! 17063: # which is not what we want (see http://www.cs.tut.fi/~jkorpela/shy.html)
! 17064: #$simple_map{'-'} = ''; # hyphenation hint
! 17065:
! 17066: # this map is used in preformatted text
! 17067: %simple_map_pre = %simple_map;
! 17068: $simple_map_pre{'*'} = "\n";
! 17069:
! 17070: # use entities in the default case
! 17071: #$things_map{'dots'} = '<small class="dots">...</small>';
! 17072: $things_map{'enddots'} = '<small class="enddots">...</small>';
! 17073:
! 17074: %style_map = ();
! 17075: %style_map_pre = ();
! 17076: t2h_default_copy_style_map (\%default_style_map, \%style_map);
! 17077: t2h_default_copy_style_map (\%default_style_map_pre, \%style_map_pre);
! 17078: # default is {'args' => ['normal'], 'attribute' => ''},
! 17079: my %style_map_html = (
! 17080: 'b', {'inline_attribute' => 'b'},
! 17081: 'cite', {'inline_attribute' => 'cite'},
! 17082: 'code', {'inline_attribute' => 'code'},
! 17083: 'command', {'inline_attribute' => 'code'},
! 17084: 'dfn', {'inline_attribute' => 'em'},
! 17085: 'email', {'function' => \&html_default_email},
! 17086: 'emph', {'inline_attribute' => 'em'},
! 17087: 'env', {'inline_attribute' => 'code'},
! 17088: 'file', {'inline_attribute' => 'tt', 'quote' => '"'},
! 17089: 'headitemfont', {'inline_attribute' => 'b'}, # not really that, in fact it is
! 17090: # in <th> rather than <td>
! 17091: 'i', {'inline_attribute' => 'i'},
! 17092: 'slanted', {'inline_attribute' => 'i'},
! 17093: 'sansserif', {'inline_attribute' => 'span class="sansserif"'},
! 17094: 'kbd', {'inline_attribute' => 'kbd'},
! 17095: 'key', {'begin' => '<', 'end' => '>'},
! 17096: 'math', {'function' => \&html_default_math},
! 17097: 'option', {'inline_attribute' => 'samp', 'quote' => '"'},
! 17098: 'r', {'inline_attribute' => 'span class="roman"'},
! 17099: 'samp', {'inline_attribute' => 'samp', 'quote' => '"'},
! 17100: 'sc', {'inline_attribute' => 'small'},
! 17101: 'strong', {'inline_attribute' => 'strong'},
! 17102: 't', {'inline_attribute' => 'tt'},
! 17103: 'uref', {'function' => \&html_default_uref},
! 17104: 'url', {'function' => \&html_default_uref},
! 17105: 'indicateurl', {'begin' => '<<code>', 'end' => '</code>>'},
! 17106: 'var', {'inline_attribute' => 'var'},
! 17107: 'verb', {'inline_attribute' => 'tt'},
! 17108: );
! 17109:
! 17110: foreach my $style_command (keys(%style_map_html))
! 17111: {
! 17112: foreach my $key (keys(%{$style_map_html{$style_command}}))
! 17113: {
! 17114: $style_map_pre{$style_command}->{$key} = $style_map_html{$style_command}->{$key};
! 17115: $style_map{$style_command}->{$key} = $style_map_html{$style_command}->{$key};
! 17116: }
! 17117: }
! 17118:
! 17119: %line_command_map = (
! 17120: 'title' => 'h1',
! 17121: 'subtitle' => 'h3 align="right"',
! 17122: 'author' => 'strong',
! 17123: );
! 17124:
! 17125: foreach my $accent_command ('tieaccent', 'dotless', keys(%unicode_accents))
! 17126: {
! 17127: $style_map{$accent_command} = { 'function' => \&xml_default_accent };
! 17128: $style_map_pre{$accent_command} = { 'function' => \&xml_default_accent };
! 17129: }
! 17130:
! 17131: $style_map_pre{'sc'} = {};
! 17132: $style_map_pre{'titlefont'} = {};
! 17133: $style_map_pre{'click'}->{'function'} = \&t2h_default_click_pre;
! 17134:
! 17135: # uncomment to use the old interface
! 17136: #%style_map = %old_style_map;
! 17137: #%style_map_pre = %old_style_map_pre;
! 17138:
! 17139: %simple_format_simple_map_texi = %simple_map_pre;
! 17140:
! 17141: %format_map = (
! 17142: # 'quotation' => 'blockquote',
! 17143: # lists
! 17144: # 'itemize' => 'ul',
! 17145: 'enumerate' => 'ol',
! 17146: # 'multitable' => 'table',
! 17147: 'table' => 'dl compact="compact"',
! 17148: 'vtable' => 'dl compact="compact"',
! 17149: 'ftable' => 'dl compact="compact"',
! 17150: 'group' => '',
! 17151: 'raggedright' => '',
! 17152: # 'detailmenu' => '',
! 17153: );
! 17154:
! 17155: #%special_list_commands = (
! 17156: # 'table' => {},
! 17157: # 'vtable' => {},
! 17158: # 'ftable' => {},
! 17159: # 'itemize' => { 'bullet' => '' }
! 17160: # );
! 17161:
! 17162: $special_list_commands{'itemize'}->{ 'bullet'} = '';
! 17163:
! 17164: #
! 17165: # texinfo format to align attribute of paragraphs
! 17166: #
! 17167:
! 17168: %paragraph_style = (
! 17169: 'center' => 'center',
! 17170: 'flushleft' => 'left',
! 17171: 'flushright' => 'right',
! 17172: );
! 17173:
! 17174: # preformatted formats formatting
! 17175: if ($COMPLEX_FORMAT_IN_TABLE)
! 17176: {
! 17177: foreach my $indented_format ('example', 'display', 'lisp')
! 17178: {
! 17179: $complex_format_map{"small$indented_format"}->{'begin'} = "<table><tr>$SMALL_EXAMPLE_INDENT_CELL<td>";
! 17180: $complex_format_map{$indented_format}->{'begin'} = "<table><tr>$EXAMPLE_INDENT_CELL<td>";
! 17181: $complex_format_map{$indented_format}->{'end'} = "</td></tr></table>\n";
! 17182: $complex_format_map{"small$indented_format"}->{'end'} = "</td></tr></table>\n";
! 17183: }
! 17184:
! 17185: foreach my $non_indented_formats ('format', 'smallformat')
! 17186: {
! 17187: $complex_format_map{$non_indented_formats}->{'begin'} = '';
! 17188: $complex_format_map{$non_indented_formats}->{'end'} = "\n";
! 17189: }
! 17190: }
! 17191: else
! 17192: {
! 17193: foreach my $format ('example', 'display', 'lisp', 'format')
! 17194: {
! 17195: $complex_format_map{$format}->{'begin'} = html_default_attribute_class('div', $format).">\n";
! 17196: $complex_format_map{"small$format"}->{'begin'} = html_default_attribute_class('div', "small$format").">\n";
! 17197: $complex_format_map{$format}->{'end'} = '</div>'."\n";
! 17198: $complex_format_map{"small$format"}->{'end'} = '</div>'."\n";
! 17199: }
! 17200: }
! 17201:
! 17202: foreach my $format ('menu', 'detailmenu', 'direntry')
! 17203: {
! 17204: $complex_format_map{$format} = { 'begin' => '' , 'end' => '',
! 17205: 'class' => 'menu-preformatted',
! 17206: };
! 17207: }
! 17208:
! 17209: $complex_format_map{'menu_comment'} = {
! 17210: 'begin' => "<tr><th colspan=\"3\" align=\"left\" valign=\"top\">",
! 17211: 'end' => "</th></tr>", 'class' => 'menu-comment',
! 17212: };
! 17213:
! 17214:
! 17215: %format_in_paragraph = (
! 17216: 'html' => 1,
! 17217: );
! 17218: # map mapping css specification to style
! 17219:
! 17220: %css_map =
! 17221: (
! 17222: "ul.$NO_BULLET_LIST_CLASS" => "$NO_BULLET_LIST_STYLE",
! 17223: 'pre.menu-comment' => "$MENU_PRE_STYLE",
! 17224: 'pre.menu-preformatted' => "$MENU_PRE_STYLE",
! 17225: 'a.summary-letter' => 'text-decoration: none',
! 17226: 'blockquote.smallquotation' => 'font-size: smaller',
! 17227: # 'pre.display' => 'font-family: inherit',
! 17228: # 'pre.smalldisplay' => 'font-family: inherit; font-size: smaller',
! 17229: 'pre.display' => 'font-family: serif',
! 17230: 'pre.smalldisplay' => 'font-family: serif; font-size: smaller',
! 17231: 'pre.smallexample' => 'font-size: smaller',
! 17232: 'span.sansserif' => 'font-family:sans-serif; font-weight:normal',
! 17233: 'span.roman' => 'font-family:serif; font-weight:normal',
! 17234: 'span.nocodebreak' => 'white-space:pre',
! 17235: 'span.nolinebreak' => 'white-space:pre'
! 17236: );
! 17237:
! 17238: $css_map{'pre.format'} = $css_map{'pre.display'};
! 17239: $css_map{'pre.smallformat'} = $css_map{'pre.smalldisplay'};
! 17240: $css_map{'pre.smalllisp'} = $css_map{'pre.smallexample'};
! 17241:
! 17242: foreach my $indented_format ('example', 'display', 'lisp')
! 17243: {
! 17244: $css_map{"div.$indented_format"} = 'margin-left: 3.2em';
! 17245: $css_map{"div.small$indented_format"} = 'margin-left: 3.2em';
! 17246: }
! 17247:
! 17248: # formatting functions
! 17249:
! 17250: $acronym_like = \&html_default_acronym_like;
! 17251: $anchor = \&html_default_anchor;
! 17252: $anchor_label = \&html_default_anchor_label;
! 17253: $begin_format_texi = \&html_default_begin_format_texi;
! 17254: $caption_shortcaption = \&html_default_caption_shortcaption;
! 17255: $caption_shortcaption_command = \&html_default_caption_shortcaption_command;
! 17256: $cartouche = \&html_default_cartouche;
! 17257: $cell = \&html_default_cell;
! 17258: $def = \&html_default_def;
! 17259: $def_item = \&html_default_def_item;
! 17260: $def_line = \&html_default_def_line;
! 17261: $element_label = \&html_default_element_label;
! 17262: $float = \&html_default_float;
! 17263: $foot_line_and_ref = \&html_default_foot_line_and_ref;
! 17264: $foot_section = \&html_default_foot_section;
! 17265: $format_list_item_texi = \&html_default_format_list_item_texi;
! 17266: $heading = \&t2h_default_heading;
! 17267: $heading_text = \&html_default_heading_text;
! 17268: $heading_text_preformatted = \&html_default_heading_text_preformatted;
! 17269: $image = \&html_default_image;
! 17270: $image_files = \&html_default_image_files;
! 17271: $index_entry = \&html_default_index_entry;
! 17272: $index_entry_command = \&html_default_index_entry_command;
! 17273: $index_entry_label = \&html_default_index_entry_label;
! 17274: $index_letter = \&html_default_index_letter;
! 17275: $index_summary = \&html_default_index_summary;
! 17276: $insertcopying = \&html_default_insertcopying;
! 17277: $line_command = \&html_default_line_command;
! 17278: $list_item = \&html_default_list_item;
! 17279: $listoffloats = \&html_default_listoffloats;
! 17280: $listoffloats_entry = \&html_default_listoffloats_entry;
! 17281: $listoffloats_caption = \&html_default_listoffloats_caption;
! 17282: $listoffloats_float_style = \&html_default_listoffloats_float_style;
! 17283: $menu_command = \&html_default_menu_command;
! 17284: $menu_link = \&html_default_menu_link;
! 17285: $menu_description = \&html_default_menu_description;
! 17286: $misc_element_label = \&html_default_misc_element_label;
! 17287: $normal_text = \&html_default_normal_text;
! 17288: $paragraph = \&html_default_paragraph;
! 17289: $preformatted = \&html_default_preformatted;
! 17290: $print_index = \&html_default_print_index;
! 17291: $protect_text = \&xml_default_protect_text;
! 17292: $quotation = \&html_default_quotation;
! 17293: $sp = \&html_default_sp;
! 17294: $summary_letter = \&html_default_summary_letter;
! 17295: $tab_item_texi = \&html_default_tab_item_texi;
! 17296: $table_item = \&html_default_table_item;
! 17297: $table_line = \&html_default_table_line;
! 17298: $table_list = \&html_default_table_list;
! 17299: $raw = \&html_default_raw;
! 17300: $row = \&html_default_row;
! 17301:
! 17302: }
! 17303:
! 17304:
! 17305:
! 17306: # The functions
! 17307:
! 17308: sub html_default_initialize()
! 17309: {
! 17310: @html_default_multitable_stack = ();
! 17311: $html_default_title = undef;
! 17312: }
! 17313:
! 17314: # We have to do this dynamically because of internationalization and because
! 17315: # in body $DOCUMENTLANGUAGE could be used.
! 17316: sub html_default_bodytext()
! 17317: {
! 17318: # Set the default body text, inserted between <body ... >
! 17319: if (defined($BODYTEXT))
! 17320: {
! 17321: $Texi2HTML::THISDOC{'BODYTEXT'} = $BODYTEXT;
! 17322: }
! 17323: else
! 17324: {
! 17325: $Texi2HTML::THISDOC{'BODYTEXT'} = 'lang="' . get_conf('documentlanguage') . '" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"';
! 17326: }
! 17327: }
! 17328:
! 17329: sub html_default_translate_names()
! 17330: {
! 17331: t2h_default_translate_names();
! 17332:
! 17333: %NAVIGATION_TEXT =
! 17334: (
! 17335: 'Top', gdt('Top'),
! 17336: 'Contents', gdt('Contents'),
! 17337: 'Overview', gdt('Overview'),
! 17338: 'Index', gdt('Index'),
! 17339: ' ', ' ',
! 17340: 'This', gdt('current'),
! 17341: 'Back', ' < ',
! 17342: 'FastBack', ' << ',
! 17343: 'Prev', gdt('Prev'),
! 17344: 'Up', gdt(' Up '),
! 17345: 'Next', gdt('Next'),
! 17346: 'NodeUp', gdt('Node up'),
! 17347: 'NodeNext', gdt('Next node'),
! 17348: 'NodePrev', gdt('Previous node'),
! 17349: 'Following', gdt('Following node'),
! 17350: 'Forward', ' > ',
! 17351: 'FastForward', ' >> ',
! 17352: 'About', ' ? ',
! 17353: 'First', ' |< ',
! 17354: 'Last', ' >| ',
! 17355: 'NextFile', gdt('Next file'),
! 17356: 'PrevFile', gdt('Previous file'),
! 17357: );
! 17358:
! 17359: }
! 17360:
! 17361: sub html_default_do_title()
! 17362: {
! 17363: $html_default_title = "$Texi2HTML::THISDOC{'fulltitle_simple_format'}";
! 17364: if ($html_default_title !~ /\S/)
! 17365: {
! 17366: $html_default_title = gdt('Untitled Document',{},{'simple_format' => 1});
! 17367: main::document_warn("Must specify a title with a title command or \@top");
! 17368: }
! 17369: }
! 17370:
! 17371: ########################################################################
! 17372: # Page formatting functions
! 17373: #
! 17374:
! 17375: ########################################################################
! 17376: # Layout for html for every sections
! 17377: #
! 17378:
! 17379: sub HTML_DEFAULT_print_section
! 17380: {
! 17381: my $fh = shift;
! 17382: my $first_in_page = shift;
! 17383: my $previous_is_top = shift;
! 17384: my $element = shift;
! 17385: my $buttons = \@SECTION_BUTTONS;
! 17386:
! 17387: my $nw = main::print_lines($fh);
! 17388: if ((get_conf('SPLIT') eq 'node') && get_conf('headers'))
! 17389: {
! 17390: my $buttons = \@NODE_FOOTER_BUTTONS;
! 17391: &$print_foot_navigation($fh, $buttons, $DEFAULT_RULE,
! 17392: (!defined($WORDS_IN_PAGE) or (defined ($nw) and $nw >= $WORDS_IN_PAGE)),
! 17393: $element);
! 17394: }
! 17395: }
! 17396:
! 17397: sub HTML_DEFAULT_one_section($$)
! 17398: {
! 17399: my $fh = shift;
! 17400: my $element = shift;
! 17401: main::print_lines($fh);
! 17402: print $fh "$DEFAULT_RULE\n";
! 17403: &$print_page_foot($fh);
! 17404: }
! 17405:
! 17406: ###################################################################
! 17407: # Layout of top-page I recommend that you use @ifnothtml, @ifhtml,
! 17408: # @html within the Top texinfo node to specify content of top-level
! 17409: # page.
! 17410: #
! 17411: sub HTML_DEFAULT_print_Top_footer($$$)
! 17412: {
! 17413: my $fh = shift;
! 17414: my $end_page = shift;
! 17415: my $element = shift;
! 17416: my $buttons = \@TOP_BUTTONS;
! 17417: my $rule = $DEFAULT_RULE;
! 17418: $rule = $BIG_RULE if (!$end_page);
! 17419: #print STDERR "end_page: $end_page\n";
! 17420: &$print_foot_navigation($fh, $buttons, $rule,
! 17421: ($end_page and (get_conf('headers') or (get_conf('SPLIT') and get_conf('SPLIT') ne 'node'))), $element);
! 17422: if ($end_page)
! 17423: {
! 17424: &$print_page_foot($fh);
! 17425: }
! 17426: }
! 17427:
! 17428: sub HTML_DEFAULT_print_Top($$$)
! 17429: {
! 17430: my $fh = shift;
! 17431: my $has_top_heading = shift;
! 17432: my $element = shift;
! 17433:
! 17434: main::print_lines($fh, $Texi2HTML::THIS_SECTION);
! 17435: }
! 17436:
! 17437: ###################################################################
! 17438: # Layout of Toc, Overview, and Footnotes pages
! 17439: # By default, we use "normal" layout
! 17440: # Texi2HTML::HREF of Next, Prev, Up, Forward, Back, etc are not defined
! 17441: # use: my $buttons = [...] to redefine navigation buttons
! 17442: sub HTML_DEFAULT_print_Footnotes
! 17443: {
! 17444: return &$print_misc(@_);
! 17445: }
! 17446:
! 17447: sub HTML_DEFAULT_print_misc_header
! 17448: {
! 17449: my $fh = shift;
! 17450: my $buttons = shift;
! 17451: my $new_file = shift;
! 17452: my $misc_page = shift;
! 17453: &$print_page_head($fh) if ($new_file);
! 17454: print $fh "".&$misc_element_label($misc_pages_targets{$misc_page}, $misc_page);
! 17455: &$print_head_navigation($fh, $buttons) if ($new_file or get_conf('headers'));
! 17456: }
! 17457:
! 17458: sub HTML_DEFAULT_print_misc_footer
! 17459: {
! 17460: my $fh = shift;
! 17461: my $buttons = shift;
! 17462: my $new_file = shift;
! 17463: &$print_foot_navigation($fh, $buttons, $DEFAULT_RULE,
! 17464: ($new_file and (get_conf('headers') or (get_conf('SPLIT') and get_conf('SPLIT') ne 'node'))), undef);
! 17465: if ($new_file)
! 17466: {
! 17467: &$print_page_foot($fh);
! 17468: }
! 17469: }
! 17470:
! 17471: ##################################################################
! 17472: # section_footer is only called if SPLIT eq 'section'
! 17473: # section_footer: after print_section of last section, before print_page_foot
! 17474: #
! 17475:
! 17476: sub HTML_DEFAULT_print_section_footer
! 17477: {
! 17478: my $fh = shift;
! 17479: my $element = shift;
! 17480: my $buttons = \@SECTION_FOOTER_BUTTONS;
! 17481: &$print_foot_navigation($fh, $buttons, $DEFAULT_RULE, 1, $element);
! 17482: }
! 17483:
! 17484: ###################################################################
! 17485: # chapter_header and chapter_footer are only called if
! 17486: # SPLIT eq 'chapter'
! 17487: # chapter_header: after print_page_head, before print_section
! 17488: # chapter_footer: after print_section of last section, before print_page_foot
! 17489: #
! 17490: # If you want to get rid of navigation stuff after each section,
! 17491: # redefine print_section such that it does not call print_navigation,
! 17492: # and put print_navigation into print_chapter_header
! 17493: sub HTML_DEFAULT_print_chapter_header
! 17494: {
! 17495: my $fh = shift;
! 17496: my $element = shift;
! 17497: # nothing to do there, by default, the navigation panel
! 17498: # is the element navigation panel
! 17499: if (! get_conf('headers'))
! 17500: { # in this case print_navigation is called here.
! 17501: my $buttons = \@CHAPTER_BUTTONS;
! 17502: &$print_head_navigation($fh, $buttons);
! 17503: print $fh "\n$DEFAULT_RULE\n" unless ($VERTICAL_HEAD_NAVIGATION);
! 17504: }
! 17505: }
! 17506:
! 17507: sub HTML_DEFAULT_print_chapter_footer
! 17508: {
! 17509: my $fh = shift;
! 17510: my $element = shift;
! 17511: my $buttons = \@CHAPTER_BUTTONS;
! 17512: &$print_foot_navigation($fh, $buttons, $DEFAULT_RULE, 1, $element);
! 17513: }
! 17514:
! 17515: sub HTML_DEFAULT_print_section_header
! 17516: {
! 17517: # nothing to do there, by default
! 17518: if (! get_conf('headers'))
! 17519: { # in this case print_navigation is called here.
! 17520: my $fh = shift;
! 17521: my $buttons = \@SECTION_BUTTONS;
! 17522: &$print_head_navigation($fh, $buttons);
! 17523: }
! 17524: }
! 17525:
! 17526:
! 17527: ###################################################################
! 17528: # Layout of standard header and footer
! 17529: #
! 17530:
! 17531: sub HTML_DEFAULT_print_page_head($)
! 17532: {
! 17533: my $fh = shift;
! 17534: my $longtitle = $html_default_title;
! 17535: $longtitle .= ": $Texi2HTML::SIMPLE_TEXT{'This'}" if (defined ($Texi2HTML::SIMPLE_TEXT{'This'}) and ($Texi2HTML::SIMPLE_TEXT{'This'} !~ /^\s*$/) and get_conf('SPLIT') and ($html_default_title ne $Texi2HTML::SIMPLE_TEXT{'This'}));
! 17536: my $description = $Texi2HTML::THISDOC{'DOCUMENT_DESCRIPTION'};
! 17537: $description = $longtitle if (!defined($description));
! 17538: $description = "<meta name=\"description\" content=\"$description\">" if
! 17539: ($description ne '');
! 17540: my $encoding = '';
! 17541: $encoding = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$Texi2HTML::THISDOC{'ENCODING_NAME'}\">" if (defined($Texi2HTML::THISDOC{'ENCODING_NAME'}) and ($Texi2HTML::THISDOC{'ENCODING_NAME'} ne ''));
! 17542: my $date = '';
! 17543: my $today = $Texi2HTML::THISDOC{'today'};
! 17544: $today = '' if (!defined($today));
! 17545: $date = "\n<meta name=\"date\" content=\"$today\">" if ($DATE_IN_HEADER and $today ne '');
! 17546: my $links = '';
! 17547: if ($USE_LINKS)
! 17548: {
! 17549: foreach my $link (@LINKS_BUTTONS)
! 17550: {
! 17551: #print STDERR "$link!!$Texi2HTML::HREF{$link}\n";
! 17552: if (defined($Texi2HTML::HREF{$link}) and $Texi2HTML::HREF{$link} ne '')
! 17553: {
! 17554: my $title = '';
! 17555: $title = " title=\"$Texi2HTML::SIMPLE_TEXT{$link}\"" if (defined($Texi2HTML::SIMPLE_TEXT{$link}));
! 17556: my $rel = '';
! 17557: $rel = " rel=\"$BUTTONS_REL{$link}\"" if (defined($BUTTONS_REL{$link}));
! 17558: $links .= "<link href=\"$Texi2HTML::HREF{$link}\"${rel}${title}>\n";
! 17559: }
! 17560: }
! 17561: }
! 17562:
! 17563: my $css_text = '';
! 17564: $css_text = $Texi2HTML::THISDOC{'CSS_LINES'} if (defined($Texi2HTML::THISDOC{'CSS_LINES'}));
! 17565: my $doctype = get_conf('doctype');
! 17566: print $fh <<EOT;
! 17567: $doctype
! 17568: <html>
! 17569: $Texi2HTML::THISDOC{'copying_comment'}<!-- Created on $Texi2HTML::THISDOC{today} by $Texi2HTML::THISDOC{program}
! 17570: $Texi2HTML::THISDOC{program_authors}-->
! 17571: <head>
! 17572: <title>$longtitle</title>
! 17573:
! 17574: $description
! 17575: <meta name="keywords" content="$longtitle">
! 17576: <meta name="resource-type" content="document">
! 17577: <meta name="distribution" content="global">
! 17578: <meta name="Generator" content="$Texi2HTML::THISDOC{program}">$date
! 17579: $encoding
! 17580: ${links}$css_text
! 17581: $EXTRA_HEAD
! 17582: </head>
! 17583:
! 17584: <body $Texi2HTML::THISDOC{'BODYTEXT'}>
! 17585: $AFTER_BODY_OPEN
! 17586: EOT
! 17587: }
! 17588:
! 17589: sub HTML_DEFAULT_end_section($$$)
! 17590: {
! 17591: my $fh = shift;
! 17592: my $misc_or_top_and_section_separation = shift;
! 17593: my $element = shift;
! 17594: if ($misc_or_top_and_section_separation)
! 17595: {
! 17596: my $rule = $BIG_RULE;
! 17597: # in that case we are almost surely at the end of the document
! 17598: $rule = $DEFAULT_RULE if (! $MONOLITHIC);
! 17599: &$print_foot_navigation($fh, undef, $rule, 0, $element, 1);
! 17600: }
! 17601: else
! 17602: {
! 17603: print $fh "$DEFAULT_RULE\n";
! 17604: }
! 17605: }
! 17606:
! 17607: sub HTML_DEFAULT_print_page_foot($)
! 17608: {
! 17609: my $fh = shift;
! 17610: my $program_text = '';
! 17611: if ($PROGRAM_NAME_IN_FOOTER)
! 17612: {
! 17613: my $program_string = &$program_string();
! 17614: $program_text = " <font size=\"-1\">
! 17615: $program_string
! 17616: </font>
! 17617: <br>";
! 17618: }
! 17619: print $fh <<EOT;
! 17620: <p>
! 17621: $program_text
! 17622: $PRE_BODY_CLOSE
! 17623: </p>
! 17624: </body>
! 17625: </html>
! 17626: EOT
! 17627: }
! 17628:
! 17629: ###################################################################
! 17630: # Layout of navigation panel
! 17631:
! 17632: sub HTML_DEFAULT_print_head_navigation($$$$$)
! 17633: {
! 17634: my $fh = shift;
! 17635: my $buttons = shift;
! 17636: my $first_in_page = shift;
! 17637: my $previous_is_top = shift;
! 17638: my $element = shift;
! 17639:
! 17640: my $result = '';
! 17641: if ($VERTICAL_HEAD_NAVIGATION)
! 17642: {
! 17643: $result .= <<EOT;
! 17644: <table border="0" cellpadding="0" cellspacing="0">
! 17645: <tr valign="top">
! 17646: <td align="left">
! 17647: EOT
! 17648: }
! 17649: $result .= &$print_navigation($buttons, $VERTICAL_HEAD_NAVIGATION);
! 17650: if ($VERTICAL_HEAD_NAVIGATION)
! 17651: {
! 17652: $result .= <<EOT;
! 17653: </td>
! 17654: <td align="left">
! 17655: EOT
! 17656: }
! 17657: elsif (get_conf('SPLIT') eq 'node')
! 17658: {
! 17659: $result .= "$DEFAULT_RULE\n";
! 17660: }
! 17661:
! 17662: print $fh $result if (defined($fh));
! 17663: return $result;
! 17664: }
! 17665:
! 17666: sub HTML_DEFAULT_print_foot_navigation
! 17667: {
! 17668: my $fh = shift;
! 17669: my $buttons = shift;
! 17670: my $rule = shift;
! 17671: my $print_navigation_panel = shift;
! 17672: my $element = shift;
! 17673: # set if called between sections and top or between sections and misc.
! 17674: # could also be the last element
! 17675: my $maybe_in_page = shift;
! 17676:
! 17677: $rule = '' if (!defined($rule));
! 17678: $print_navigation_panel = 1 if (!defined($print_navigation_panel)
! 17679: and defined($buttons));
! 17680:
! 17681: # avoid the rule if at the end of a page and there is nothing below
! 17682: $rule = '' if (!$PROGRAM_NAME_IN_FOOTER and !$print_navigation_panel and !$maybe_in_page);
! 17683:
! 17684: if ($VERTICAL_HEAD_NAVIGATION)
! 17685: {
! 17686: print $fh <<EOT;
! 17687: </td>
! 17688: </tr>
! 17689: </table>
! 17690: EOT
! 17691: }
! 17692: print $fh "$rule\n" if ($rule ne '');
! 17693: print $fh "".&$print_navigation($buttons) if ($print_navigation_panel);
! 17694: }
! 17695:
! 17696: ######################################################################
! 17697: # navigation panel
! 17698: #
! 17699: # how to create IMG tag
! 17700: sub HTML_DEFAULT_button_icon_img
! 17701: {
! 17702: my $button = shift;
! 17703: my $icon = shift;
! 17704: my $name = shift;
! 17705: return '' if (!defined($icon));
! 17706: $button = "" if (!defined ($button));
! 17707: $name = '' if (!defined($name));
! 17708: my $alt = '';
! 17709: if ($name ne '')
! 17710: {
! 17711: if ($button ne '')
! 17712: {
! 17713: $alt = "$button: $name";
! 17714: }
! 17715: else
! 17716: {
! 17717: $alt = $name;
! 17718: }
! 17719: }
! 17720: else
! 17721: {
! 17722: $alt = $button;
! 17723: }
! 17724: return qq{<img src="$icon" border="0" alt="$alt" align="middle">};
! 17725: }
! 17726:
! 17727: sub HTML_DEFAULT_button_formatting($$)
! 17728: {
! 17729: my $button = shift;
! 17730: my $vertical = shift;
! 17731:
! 17732: my ($active, $passive);
! 17733: if (ref($button) eq 'CODE')
! 17734: {
! 17735: $active = &$button($vertical);
! 17736: }
! 17737: elsif (ref($button) eq 'SCALAR')
! 17738: {
! 17739: $active = "$$button" if defined($$button);
! 17740: }
! 17741: elsif (ref($button) eq 'ARRAY')
! 17742: {
! 17743: my $text = $button->[1];
! 17744: my $button_href = $button->[0];
! 17745: # verify that $button_href is simple text and text is a reference
! 17746: if (defined($button_href) and !ref($button_href)
! 17747: and defined($text) and (ref($text) eq 'SCALAR') and defined($$text))
! 17748: { # use given text
! 17749: if ($Texi2HTML::HREF{$button_href})
! 17750: {
! 17751: my $anchor_attributes = '';
! 17752: if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button_href})) and ($BUTTONS_ACCESSKEY{$button_href} ne ''))
! 17753: {
! 17754: $anchor_attributes = "accesskey=\"$BUTTONS_ACCESSKEY{$button_href}\"";
! 17755: }
! 17756: if ($USE_REL_REV and (defined($BUTTONS_REL{$button_href})) and ($BUTTONS_REL{$button_href} ne ''))
! 17757: {
! 17758: $anchor_attributes .= " rel=\"$BUTTONS_REL{$button_href}\"";
! 17759: }
! 17760: $active = "" .
! 17761: &$anchor('',
! 17762: $Texi2HTML::HREF{$button_href},
! 17763: $$text,
! 17764: $anchor_attributes
! 17765: );
! 17766: }
! 17767: else
! 17768: {
! 17769: $passive = $$text;
! 17770: }
! 17771: }
! 17772: elsif (defined($button_href) and !ref($button_href)
! 17773: and defined($text) and (ref($text) eq 'CODE'))
! 17774: {
! 17775: $active = &$text($button_href);
! 17776: }
! 17777: }
! 17778: elsif ($button eq ' ')
! 17779: { # handle space button
! 17780: $active =
! 17781: ($ICONS && $ACTIVE_ICONS{' '}) ?
! 17782: &$button_icon_img($BUTTONS_NAME{$button}, $ACTIVE_ICONS{' '}) :
! 17783: $NAVIGATION_TEXT{' '};
! 17784: #next;
! 17785: }
! 17786: elsif ($Texi2HTML::HREF{$button})
! 17787: { # button is active
! 17788: my $btitle = $BUTTONS_GOTO{$button} ?
! 17789: 'title="' . $BUTTONS_GOTO{$button} . '"' : '';
! 17790: if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button})) and ($BUTTONS_ACCESSKEY{$button} ne ''))
! 17791: {
! 17792: $btitle .= " accesskey=\"$BUTTONS_ACCESSKEY{$button}\"";
! 17793: }
! 17794: if ($USE_REL_REV and (defined($BUTTONS_REL{$button})) and ($BUTTONS_REL{$button} ne ''))
! 17795: {
! 17796: $btitle .= " rel=\"$BUTTONS_REL{$button}\"";
! 17797: }
! 17798: if ($ICONS && $ACTIVE_ICONS{$button})
! 17799: { # use icon
! 17800: $active = '' .
! 17801: &$anchor('',
! 17802: $Texi2HTML::HREF{$button},
! 17803: &$button_icon_img($BUTTONS_NAME{$button},
! 17804: $ACTIVE_ICONS{$button},
! 17805: $Texi2HTML::SIMPLE_TEXT{$button}),
! 17806: $btitle
! 17807: );
! 17808: }
! 17809: else
! 17810: { # use text
! 17811: $active =
! 17812: '[' .
! 17813: &$anchor('',
! 17814: $Texi2HTML::HREF{$button},
! 17815: $NAVIGATION_TEXT{$button},
! 17816: $btitle
! 17817: ) .
! 17818: ']';
! 17819: }
! 17820: }
! 17821: else
! 17822: { # button is passive
! 17823: $passive =
! 17824: $ICONS && $PASSIVE_ICONS{$button} ?
! 17825: &$button_icon_img($BUTTONS_NAME{$button},
! 17826: $PASSIVE_ICONS{$button},
! 17827: $Texi2HTML::SIMPLE_TEXT{$button}) :
! 17828: "[" . $NAVIGATION_TEXT{$button} . "]";
! 17829: }
! 17830: return ($active, $passive);
! 17831: }
! 17832:
! 17833: my %html_default_node_directions;
! 17834: foreach my $node_directions ('NodeNext', 'NodePrev', 'NodeUp')
! 17835: {
! 17836: $html_default_node_directions{$node_directions} = 1;
! 17837: }
! 17838:
! 17839: sub HTML_DEFAULT_print_navigation($;$)
! 17840: {
! 17841: my $buttons = shift;
! 17842: my $vertical = shift;
! 17843:
! 17844: my $first_button = 1;
! 17845: my $result = '';
! 17846: if ($HEADER_IN_TABLE)
! 17847: {
! 17848: $result .= html_default_attribute_class('table', 'header').' cellpadding="1" cellspacing="1" border="0">'."\n";
! 17849: $result .= "<tr>" unless $vertical;
! 17850: }
! 17851: else
! 17852: {
! 17853: $result .= html_default_attribute_class('div', 'header').">\n<p>\n";
! 17854: }
! 17855: for my $button (@$buttons)
! 17856: {
! 17857: if ($HEADER_IN_TABLE)
! 17858: {
! 17859: $result .= qq{<tr valign="top" align="left">\n} if $vertical;
! 17860: $result .= qq{<td valign="middle" align="left">};
! 17861: }
! 17862: my $direction;
! 17863: if (ref($button) eq 'ARRAY' and defined($button->[0]) and !ref($button->[0]))
! 17864: {
! 17865: $direction = $button->[0];
! 17866: }
! 17867: elsif (defined($button) and !ref($button))
! 17868: {
! 17869: $direction = $button;
! 17870: }
! 17871:
! 17872: my ($active, $passive) = &$button_formatting($button, $vertical);
! 17873: if ($HEADER_IN_TABLE)
! 17874: {
! 17875: if (defined($active))
! 17876: {
! 17877: $first_button = 0 if ($first_button);
! 17878: $result .= $active;
! 17879: }
! 17880: elsif (defined($passive))
! 17881: {
! 17882: $first_button = 0 if ($first_button);
! 17883: $result .= $passive;
! 17884: }
! 17885: $result .= "</td>\n";
! 17886: $result .= "</tr>\n" if $vertical;
! 17887: }
! 17888: elsif (defined($active))
! 17889: { # only active buttons are print out when not in table
! 17890: if (defined($direction) and $html_default_node_directions{$direction} and !$first_button)
! 17891: {
! 17892: $active = ', ' .$active;
! 17893: }
! 17894: $result .= $active;
! 17895: $first_button = 0 if ($first_button);
! 17896: }
! 17897: }
! 17898: if ($HEADER_IN_TABLE)
! 17899: {
! 17900: $result .= "</tr>" unless $vertical;
! 17901: $result .= "</table>\n";
! 17902: }
! 17903: else
! 17904: {
! 17905: $result .= "</p>\n</div>\n";
! 17906: }
! 17907: return $result;
! 17908: }
! 17909:
! 17910: sub html_default_node_direction($)
! 17911: {
! 17912: my $direction = shift;
! 17913: my $result = undef;
! 17914: if ($Texi2HTML::HREF{$direction} and $Texi2HTML::NODE{$direction})
! 17915: {
! 17916: my $anchor_attributes = '';
! 17917: if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$direction})) and ($BUTTONS_ACCESSKEY{$direction} ne ''))
! 17918: {
! 17919: $anchor_attributes = "accesskey=\"$BUTTONS_ACCESSKEY{$direction}\"";
! 17920: }
! 17921: if ($USE_REL_REV and (defined($BUTTONS_REL{$direction})) and ($BUTTONS_REL{$direction} ne ''))
! 17922: {
! 17923: $anchor_attributes .= " rel=\"$BUTTONS_REL{$direction}\"";
! 17924: }
! 17925: my $anchor = &$anchor('',
! 17926: $Texi2HTML::HREF{$direction},
! 17927: $Texi2HTML::NODE{$direction},
! 17928: $anchor_attributes
! 17929: )
! 17930: ;
! 17931: # i18n
! 17932: $result = "$BUTTONS_TEXT{$direction}: $anchor";
! 17933: }
! 17934: return $result;
! 17935: }
! 17936:
! 17937: ######################################################################
! 17938: # Frames: this is from "Richard Y. Kim" <ryk@coho.net>
! 17939: # Should be improved to be more conforming to other _print* functions
! 17940: # toc_file and main_file passed as args are relative to the texinfo manual
! 17941: # location, and therefore are not used.
! 17942:
! 17943: sub HTML_DEFAULT_print_frame
! 17944: {
! 17945: my $fh = shift;
! 17946: my $toc_file = shift;
! 17947: my $main_file = shift;
! 17948: $main_file = $Texi2HTML::THISDOC{'filename'}->{'top'};
! 17949: $toc_file = $Texi2HTML::THISDOC{'filename'}->{'toc_frame'};
! 17950: print $fh <<EOT;
! 17951: $FRAMESET_DOCTYPE
! 17952: <html>
! 17953: <head><title>$Texi2HTML::THISDOC{'fulltitle'}</title></head>
! 17954: <frameset cols="140,*">
! 17955: <frame name="toc" src="$toc_file">
! 17956: <frame name="main" src="$main_file">
! 17957: </frameset>
! 17958: </html>
! 17959: EOT
! 17960: }
! 17961:
! 17962: sub HTML_DEFAULT_print_toc_frame
! 17963: {
! 17964: my $fh = shift;
! 17965: my $stoc_lines = shift;
! 17966: &$print_page_head($fh);
! 17967: print $fh <<EOT;
! 17968: <h2>Content</h2>
! 17969: EOT
! 17970: print $fh map {s/\bhref=/target="main" href=/; $_;} @$stoc_lines;
! 17971: print $fh "</body></html>\n";
! 17972: }
! 17973:
! 17974: ######################################################################
! 17975: # About page
! 17976: #
! 17977:
! 17978: sub HTML_DEFAULT_about_body
! 17979: {
! 17980: return undef if (!$HEADER_IN_TABLE);
! 17981: my $about = "<p>\n";
! 17982: if (ref($PRE_ABOUT) eq 'CODE')
! 17983: {
! 17984: $about .= &$PRE_ABOUT();
! 17985: }
! 17986: else
! 17987: {
! 17988: $about .= $PRE_ABOUT;
! 17989: }
! 17990: $about .= <<EOT;
! 17991: </p>
! 17992: <p>
! 17993: EOT
! 17994: $about .= gdt(' The buttons in the navigation panels have the following meaning:') . "\n";
! 17995: $about .= <<EOT;
! 17996: </p>
! 17997: <table border="1">
! 17998: <tr>
! 17999: EOT
! 18000: $about .= ' <th> ' . gdt('Button') . " </th>\n" .
! 18001: ' <th> ' . gdt('Name') . " </th>\n" .
! 18002: ' <th> ' . gdt('Go to') . " </th>\n" .
! 18003: ' <th> ' . gdt('From 1.2.3 go to') . "</th>\n" . " </tr>\n";
! 18004:
! 18005: for my $button (@SECTION_BUTTONS)
! 18006: {
! 18007: next if $button eq ' ' || ref($button) eq 'CODE' || ref($button) eq 'SCALAR' || ref($button) eq 'ARRAY';
! 18008: $about .= " <tr>\n <td align=\"center\">";
! 18009: $about .=
! 18010: ($ICONS && $ACTIVE_ICONS{$button} ?
! 18011: &$button_icon_img($BUTTONS_NAME{$button}, $ACTIVE_ICONS{$button}) :
! 18012: ' [' . $NAVIGATION_TEXT{$button} . '] ');
! 18013: $about .= "</td>\n";
! 18014: $about .= <<EOT;
! 18015: <td align="center">$BUTTONS_NAME{$button}</td>
! 18016: <td>$BUTTONS_GOTO{$button}</td>
! 18017: <td>$BUTTONS_EXAMPLE{$button}</td>
! 18018: </tr>
! 18019: EOT
! 18020: }
! 18021:
! 18022: $about .= <<EOT;
! 18023: </table>
! 18024:
! 18025: <p>
! 18026: EOT
! 18027: $about .= gdt(' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:') . "\n";
! 18028:
! 18029: # where the <strong> Example </strong> assumes that the current position
! 18030: # is at <strong> Subsubsection One-Two-Three </strong> of a document of
! 18031: # the following structure:
! 18032: $about .= <<EOT;
! 18033: </p>
! 18034:
! 18035: <ul>
! 18036: EOT
! 18037: $about .= ' <li> 1. ' . gdt('Section One') . "\n" .
! 18038: " <ul>\n" .
! 18039: ' <li>1.1 ' . gdt('Subsection One-One') . "\n";
! 18040: $about .= <<EOT;
! 18041: <ul>
! 18042: <li>...</li>
! 18043: </ul>
! 18044: </li>
! 18045: EOT
! 18046: $about .= ' <li>1.2 ' . gdt('Subsection One-Two') . "\n" .
! 18047: " <ul>\n" .
! 18048: ' <li>1.2.1 ' . gdt('Subsubsection One-Two-One') . "</li>\n" .
! 18049: ' <li>1.2.2 ' . gdt('Subsubsection One-Two-Two') . "</li>\n" .
! 18050: ' <li>1.2.3 ' . gdt('Subsubsection One-Two-Three') . " \n"
! 18051: .
! 18052: ' <strong><== ' . gdt('Current Position') . " </strong></li>\n" .
! 18053: ' <li>1.2.4 ' . gdt('Subsubsection One-Two-Four') . "</li>\n" .
! 18054: " </ul>\n" .
! 18055: " </li>\n" .
! 18056: ' <li>1.3 ' . gdt('Subsection One-Three') . "\n";
! 18057: $about .= <<EOT;
! 18058: <ul>
! 18059: <li>...</li>
! 18060: </ul>
! 18061: </li>
! 18062: EOT
! 18063: $about .= ' <li>1.4 ' . gdt('Subsection One-Four') . "</li>\n";
! 18064: $about .= <<EOT;
! 18065: </ul>
! 18066: </li>
! 18067: </ul>
! 18068: $AFTER_ABOUT
! 18069: EOT
! 18070: return $about;
! 18071: }
! 18072:
! 18073: sub HTML_DEFAULT_print_redirection_page()
! 18074: {
! 18075: #my $fh = shift;
! 18076: my $longtitle = $html_default_title;
! 18077: $longtitle .= ": $Texi2HTML::SIMPLE_TEXT{'This'}" if (defined ($Texi2HTML::SIMPLE_TEXT{'This'}) and ($Texi2HTML::SIMPLE_TEXT{'This'} !~ /^\s*$/) and ($html_default_title ne $Texi2HTML::SIMPLE_TEXT{'This'}));
! 18078: my $description = $Texi2HTML::THISDOC{'DOCUMENT_DESCRIPTION'};
! 18079: $description = $longtitle if (!defined($description));
! 18080: my $encoding = '';
! 18081: $encoding = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$Texi2HTML::THISDOC{'ENCODING_NAME'}\">" if (defined($Texi2HTML::THISDOC{'ENCODING_NAME'}) and ($Texi2HTML::THISDOC{'ENCODING_NAME'} ne ''));
! 18082: my $href = &$anchor('', $Texi2HTML::HREF{'This'}, $Texi2HTML::NAME{'This'});
! 18083: my $string = gdt('The node you are looking for is at {href}.',
! 18084: { 'href' => $href });
! 18085: my $doctype = get_conf('doctype');
! 18086: my $css_text = '';
! 18087: $css_text = $Texi2HTML::THISDOC{'CSS_LINES'} if (defined($Texi2HTML::THISDOC{'CSS_LINES'}));
! 18088: #print $fh <<EOT;
! 18089: my $result = <<EOT;
! 18090: $doctype
! 18091: <html>
! 18092: <!-- Created on $Texi2HTML::THISDOC{'today'} by $Texi2HTML::THISDOC{'program'} -->
! 18093: <!--
! 18094: $Texi2HTML::THISDOC{'program_authors'}
! 18095: -->
! 18096: <head>
! 18097: <title>$longtitle</title>
! 18098:
! 18099: <meta name="description" content="$description">
! 18100: <meta name="keywords" content="$longtitle">
! 18101: <meta name="resource-type" content="document">
! 18102: <meta name="distribution" content="global">
! 18103: <meta name="Generator" content="$Texi2HTML::THISDOC{program}">
! 18104: $encoding
! 18105: $css_text
! 18106: <meta http-equiv="Refresh" content="2; url=$Texi2HTML::HREF{'This'}">
! 18107: $EXTRA_HEAD
! 18108: </head>
! 18109:
! 18110: <body $Texi2HTML::THISDOC{'BODYTEXT'}>
! 18111: $AFTER_BODY_OPEN
! 18112: <p>$string</p>
! 18113: </body>
! 18114: EOT
! 18115: return $result;
! 18116: }
! 18117:
! 18118: sub html_default_uref($$)
! 18119: {
! 18120: shift;
! 18121: my $args = shift;
! 18122: my $url = shift @$args;
! 18123: my $text = shift @$args;
! 18124: my $replacement = shift @$args;
! 18125: $url = main::normalise_space($url);
! 18126: $replacement = '' if (!defined($replacement));
! 18127: $replacement = main::normalise_space($replacement);
! 18128: $text = '' if (!defined($text));
! 18129: $text = main::normalise_space($text);
! 18130: $text = $replacement if ($replacement ne '');
! 18131: $text = $url unless ($text ne '');
! 18132: return $text if ($url eq '');
! 18133: return &$anchor('', $url, $text);
! 18134: }
! 18135:
! 18136: sub html_default_math($$)
! 18137: {
! 18138: shift;
! 18139: my $args = shift;
! 18140: my $text = shift @$args;
! 18141: return "<em>$text</em>";
! 18142: }
! 18143:
! 18144: sub html_default_email($$)
! 18145: {
! 18146: my $command = shift;
! 18147: my $args = shift;
! 18148: my $mail = shift @$args;
! 18149: my $text = shift @$args;
! 18150: $mail = main::normalise_space($mail);
! 18151: $text = $mail unless (defined($text) and ($text ne ''));
! 18152: $text = main::normalise_space($text);
! 18153: return $text if ($mail eq '');
! 18154: return &$anchor('', "mailto:$mail", $text);
! 18155: }
! 18156:
! 18157: sub html_default_attribute_class($$)
! 18158: {
! 18159: my $element = shift;
! 18160: my $class = shift;
! 18161: return "<$element" if (!defined($class) or $class eq '' or $NO_CSS);
! 18162: my $style = '';
! 18163: if ($INLINE_CSS_STYLE and defined($css_map{"$element.$class"}))
! 18164: {
! 18165: $style = ' style="'.$css_map{"$element.$class"}.'"';
! 18166: }
! 18167: return "<$element class=\"$class\"$style";
! 18168: }
! 18169:
! 18170: # this is called each time a format begins. Here it is used to keep a
! 18171: # record of the multitables to have a faithful count of the cell nr.
! 18172: sub html_default_begin_format_texi($$$)
! 18173: {
! 18174: my $command = shift;
! 18175: my $line = shift;
! 18176: my $state = shift;
! 18177:
! 18178: # first array element is the number of cell in a row
! 18179: # second is the number of paragraphs in a cell
! 18180: push (@html_default_multitable_stack, [-1,-1]) if ($command eq 'multitable');
! 18181:
! 18182: return $line;
! 18183: }
! 18184:
! 18185: sub html_default_caption_shortcaption($)
! 18186: {
! 18187: my $float = shift;
! 18188: my $caption_lines;
! 18189: my $shortcaption_lines;
! 18190: my $style = $float->{'style_texi'};
! 18191: if (defined($float->{'nr'}))
! 18192: {
! 18193: my $nr = $float->{'nr'};
! 18194: if ($style ne '')
! 18195: {
! 18196: $style = gdt('{style} {number}', { 'style' => $style, 'number' => $nr});
! 18197: }
! 18198: else
! 18199: {
! 18200: $style = $nr;
! 18201: }
! 18202: }
! 18203:
! 18204: if (defined($float->{'caption_texi'}))
! 18205: {
! 18206: @$caption_lines = @{$float->{'caption_texi'}};
! 18207: $caption_lines->[0] =~ s/^\s*//;
! 18208: if (defined($style))
! 18209: {
! 18210: $caption_lines->[0] = '@'.$CAPTION_STYLE.'{' . gdt('{style}: {caption_first_line}', { 'style' => $style, 'caption_first_line' => $caption_lines->[0] });
! 18211: }
! 18212: else
! 18213: {
! 18214: $caption_lines->[0] = '@'.$CAPTION_STYLE.'{' . $caption_lines->[0];
! 18215: }
! 18216: push @$caption_lines, "}\n";
! 18217: }
! 18218: elsif (defined($style))
! 18219: {
! 18220: $caption_lines->[0] = '@'.$CAPTION_STYLE.'{' . $style . '}' . "\n";
! 18221: }
! 18222: if (defined($float->{'shortcaption_texi'}))
! 18223: {
! 18224: @$shortcaption_lines = @{$float->{'shortcaption_texi'}};
! 18225: if (defined($style))
! 18226: {
! 18227: $shortcaption_lines->[0] = '@'.$CAPTION_STYLE.'{' . gdt('{style}: {shortcaption_first_line}', { 'style' => $style, 'shortcaption_first_line' => $shortcaption_lines->[0] });
! 18228: }
! 18229: else
! 18230: {
! 18231: $shortcaption_lines->[0] = '@'.$CAPTION_STYLE.'{' . $shortcaption_lines->[0];
! 18232: }
! 18233: push @$shortcaption_lines, "}\n";
! 18234: }
! 18235: elsif (defined($style))
! 18236: {
! 18237: $shortcaption_lines->[0] = '@'.$CAPTION_STYLE.'{' . $style . '}' . "\n";
! 18238: }
! 18239: return ($caption_lines, $shortcaption_lines);
! 18240: }
! 18241:
! 18242: # everything is done in &$float
! 18243: sub html_default_caption_shortcaption_command($$$$)
! 18244: {
! 18245: my $command = shift;
! 18246: my $text = shift;
! 18247: my $texi_lines = shift;
! 18248: my $float_element = shift;
! 18249: return '';
! 18250: }
! 18251:
! 18252: sub html_default_float($$$$$)
! 18253: {
! 18254: my $text = shift;
! 18255: my $float = shift;
! 18256: my $caption = shift;
! 18257: my $shortcaption = shift;
! 18258:
! 18259: my $label = '';
! 18260: if (exists($float->{'id'}))
! 18261: {
! 18262: $label = &$anchor($float->{'id'});
! 18263: }
! 18264: my $caption_text = '';
! 18265:
! 18266: if (defined($float->{'caption_texi'}))
! 18267: {
! 18268: $caption_text = $caption;
! 18269: }
! 18270: elsif (defined($float->{'shortcaption_texi'}))
! 18271: {
! 18272: $caption_text = $shortcaption;
! 18273: }
! 18274: elsif (defined($caption))
! 18275: {
! 18276: $caption_text = $caption;
! 18277: }
! 18278:
! 18279: return html_default_attribute_class('div','float'). '>' . "$label\n" . $text . '</div>' . $caption_text;
! 18280: }
! 18281:
! 18282: sub html_default_listoffloats_float_style($$)
! 18283: {
! 18284: my $style_texi = shift;
! 18285: my $float = shift;
! 18286:
! 18287: my $style = $float->{'style_texi'};
! 18288: #print STDERR "listoffloat/float style mismatch $style_texi $style\n" if ($style_texi ne $style);
! 18289: if (defined($float->{'nr'}))
! 18290: {
! 18291: my $nr = $float->{'nr'};
! 18292: if ($style ne '')
! 18293: {
! 18294: $style = gdt('{style} {number}', { 'style' => $style, 'number' => $nr});
! 18295: }
! 18296: else
! 18297: {
! 18298: $style = $nr;
! 18299: }
! 18300: }
! 18301: return $style;
! 18302: }
! 18303:
! 18304: sub html_default_listoffloats_caption($)
! 18305: {
! 18306: my $float = shift;
! 18307: if (defined($float->{'shortcaption_texi'}))
! 18308: {
! 18309: return ([ @{$float->{'shortcaption_texi'}} ], 'shortcaption');
! 18310: }
! 18311: elsif (defined($float->{'caption_texi'}))
! 18312: {
! 18313: return ([ @{$float->{'caption_texi'}} ], 'caption');
! 18314: }
! 18315: return ([ ], undef);
! 18316: }
! 18317:
! 18318: sub html_default_listoffloats_entry($$$$)
! 18319: {
! 18320: my $style_texi = shift;
! 18321: my $float = shift;
! 18322: my $float_style = shift;
! 18323: my $caption = shift;
! 18324: my $href = shift;
! 18325:
! 18326: return '<dt>' . &$anchor('', $href, $float_style) . '</dt><dd>' . $caption
! 18327: . '</dd>' . "\n";
! 18328: }
! 18329:
! 18330: sub html_default_listoffloats($$$)
! 18331: {
! 18332: my $style_texi = shift;
! 18333: my $style = shift;
! 18334: my $float_entries = shift;
! 18335:
! 18336: my $result = html_default_attribute_class('dl', 'listoffloats').">\n" ;
! 18337: foreach my $float_entry (@$float_entries)
! 18338: {
! 18339: $result .= $float_entry;
! 18340: }
! 18341: return $result . "</dl>\n";
! 18342: }
! 18343:
! 18344: sub html_default_insertcopying($$$)
! 18345: {
! 18346: my $text = shift;
! 18347: my $comment = shift;
! 18348: my $simple_text = shift;
! 18349: return $text;
! 18350: }
! 18351:
! 18352: sub html_default_protect_space_codebreak($$$$$)
! 18353: {
! 18354: my $text = shift;
! 18355: my $in_raw_text = shift; # remove_texi
! 18356: my $in_preformatted = shift;
! 18357: my $in_code = shift;
! 18358: my $style_stack = shift;
! 18359:
! 18360: return $text if ($in_preformatted or $in_raw_text);
! 18361:
! 18362: my $in_w = 1 if (in_cmd($style_stack, 'w'));
! 18363:
! 18364: if ($in_w or ($in_code and get_conf('allowcodebreaks') eq 'false'))
! 18365: {
! 18366: my $class = 'nolinebreak';
! 18367: $class = 'nocodebreak' if ($in_code and get_conf('allowcodebreaks') eq 'false');
! 18368: my $open = html_default_attribute_class('span', $class).'>';
! 18369: # protect spaces in the html leading attribute in case we are in 'w'
! 18370: $open =~ s/ /\x{1F}/g if ($in_w);
! 18371: $text =~ s/(\S*[_-]\S*)/${open}$1<\/span>/g;
! 18372: }
! 18373:
! 18374: if ($in_w)
! 18375: {
! 18376: $text .= ' ' if (chomp($text));
! 18377: # protect spaces within text
! 18378: $text =~ s/ / /g;
! 18379: # revert protected spaces in leading html attribute
! 18380: $text =~ s/\x{1F}/ /g;
! 18381: }
! 18382: return $text;
! 18383: }
! 18384:
! 18385: sub html_default_normal_text($$$$$$$;$)
! 18386: {
! 18387: my @initial_args = @_;
! 18388: my $text = shift;
! 18389: my $in_raw_text = shift; # remove_texi
! 18390: my $in_preformatted = shift;
! 18391: my $in_code = shift;
! 18392: my $in_math = shift;
! 18393: my $in_simple = shift;
! 18394: my $style_stack = shift;
! 18395: my $state = shift;
! 18396:
! 18397: # like utf8.init
! 18398: if ($ENABLE_ENCODING and !$ENABLE_ENCODING_USE_ENTITY and defined($Texi2HTML::THISDOC{'ENCODING_NAME'}) and $Texi2HTML::THISDOC{'ENCODING_NAME'} eq 'utf-8')
! 18399: {
! 18400: my $result = &t2h_utf8_normal_text(@initial_args);
! 18401: $result = html_default_protect_space_codebreak($result, $in_raw_text, $in_preformatted, $in_code, $style_stack);
! 18402: return $result;
! 18403: }
! 18404:
! 18405: $text = uc($text) if (in_cmd($style_stack, 'sc'));
! 18406: $text = &$protect_text($text) unless($in_raw_text);
! 18407: #$text =~ s/ / /g
! 18408: # if (!$in_raw_text and !$in_preformatted and in_cmd($style_stack, 'w'));
! 18409: if (! $in_code and !$in_preformatted)
! 18410: {
! 18411: if ($USE_ISO and !$in_raw_text)
! 18412: {
! 18413: $text =~ s/---/\&mdash\;/g;
! 18414: $text =~ s/--/\&ndash\;/g;
! 18415: $text =~ s/``/\&ldquo\;/g;
! 18416: $text =~ s/''/\&rdquo\;/g;
! 18417: }
! 18418: else
! 18419: {
! 18420: if ($in_raw_text) #FIXME really do that ? It is done by makeinfo
! 18421: {
! 18422: $text =~ s/``/"/g;
! 18423: $text =~ s/''/"/g;
! 18424: }
! 18425: else
! 18426: {
! 18427: $text =~ s/``/"/g;
! 18428: $text =~ s/''/"/g;
! 18429: # to be like texinfo
! 18430: #$text =~ s/'/\&rsquo\;/g;
! 18431: #$text =~ s/`/\&lsquo\;/g;
! 18432: }
! 18433: # FIXME really do that in raw text?
! 18434: $text =~ s/---/\x{1F}/g;
! 18435: $text =~ s/--/-/g;
! 18436: $text =~ s/\x{1F}/--/g;
! 18437: }
! 18438: }
! 18439: $text = html_default_protect_space_codebreak($text, $in_raw_text, $in_preformatted, $in_code, $style_stack);
! 18440: $text = t2h_text_substitutions($text, $in_raw_text, ($in_preformatted or $in_code), $in_simple);
! 18441: return $text;
! 18442: }
! 18443:
! 18444: # This function produces an anchor
! 18445: #
! 18446: # arguments:
! 18447: # $name : anchor name
! 18448: # $href : anchor href
! 18449: # text : text displayed
! 18450: # extra_attribs : added to anchor attributes list
! 18451: sub html_default_anchor($;$$$)
! 18452: {
! 18453: my $name = shift;
! 18454: my $href = shift;
! 18455: my $text = shift;
! 18456: my $attributes = shift;
! 18457: my $class = '';
! 18458: #print STDERR "!$name!$href!$text!$attributes!\n";
! 18459: if (!defined($attributes) or ($attributes !~ /\S/))
! 18460: {
! 18461: $attributes = '';
! 18462: }
! 18463: else
! 18464: {
! 18465: if ($attributes =~ s/^class=\"([^\"]+)\"//)
! 18466: {
! 18467: $class = $1;
! 18468: }
! 18469:
! 18470: $attributes = ' ' . $attributes if ($attributes ne '');
! 18471: }
! 18472: $name = '' if (!defined($name) or ($name !~ /\S/));
! 18473: $href = '' if (!defined($href) or ($href !~ /\S/));
! 18474: $text = '' if (!defined($text));
! 18475: return $text if (($name eq '') and ($href eq ''));
! 18476: $name = "name=\"$name\"" if ($name ne '');
! 18477: $href = "href=\"$href\"" if ($href ne '');
! 18478: $href = ' ' . $href if (($name ne '') and ($href ne ''));
! 18479: #print STDERR "!!!$name!$href!$text!$attributes!\n";
! 18480: return html_default_attribute_class('a', $class). " ${name}${href}${attributes}>$text</a>";
! 18481: }
! 18482:
! 18483: # This function is used to format the text associated with a @deff/@end deff
! 18484: #
! 18485: # argument:
! 18486: # text
! 18487: #
! 18488: # $DEF_TABLE should be used to distinguish between @def formatted as table
! 18489: # and as definition lists.
! 18490: sub html_default_def_item($$$)
! 18491: {
! 18492: my $text = shift;
! 18493: my $only_inter_item_commands = shift;
! 18494: my $command = shift;
! 18495: if ($text =~ /\S/)
! 18496: {
! 18497: if (! $DEF_TABLE)
! 18498: {
! 18499: return '<dd>' . $text . '</dd>';# unless $only_inter_item_commands;
! 18500: #return $text; # invalid without dd in ul
! 18501: }
! 18502: else
! 18503: {
! 18504: return '<tr><td colspan="2">' . $text . '</td></tr>';
! 18505: }
! 18506: }
! 18507: return '';
! 18508: }
! 18509:
! 18510: # format the container for the @deffn line and text
! 18511: #
! 18512: # argument
! 18513: # text of the whole @def, line and associated text.
! 18514: #
! 18515: # $DEF_TABLE should be used.
! 18516: sub html_default_def($$)
! 18517: {
! 18518: my $text = shift;
! 18519: my $command = shift;
! 18520: if ($text =~ /\S/)
! 18521: {
! 18522: if (! $DEF_TABLE)
! 18523: {
! 18524: return "<dl>\n" . $text . "</dl>\n";
! 18525: }
! 18526: else
! 18527: {
! 18528: return "<table width=\"100%\">\n" . $text . "</table>\n";
! 18529: }
! 18530: }
! 18531: return '';
! 18532:
! 18533: }
! 18534:
! 18535: # a whole menu
! 18536: #
! 18537: # argument:
! 18538: # the whole menu text (entries and menu comments)
! 18539: #
! 18540: # argument:
! 18541: # whole menu text.
! 18542: sub html_default_menu_command($$$)
! 18543: {
! 18544: my $format = shift;
! 18545: my $text = shift;
! 18546: my $in_preformatted = shift;
! 18547:
! 18548: $html_menu_entry_index=0;
! 18549:
! 18550: my $begin_row = '';
! 18551: my $end_row = '';
! 18552: if ($in_preformatted)
! 18553: {
! 18554: $begin_row = '<tr><td>';
! 18555: $end_row = '</td></tr>';
! 18556: }
! 18557: if ($text =~ /\S/)
! 18558: {
! 18559: return '' if ($format eq 'direntry');
! 18560: return $text if ($format eq 'detailmenu');
! 18561: return html_default_attribute_class('table', 'menu')." border=\"0\" cellspacing=\"0\">${begin_row}\n"
! 18562: . $text . "${end_row}</table>\n";
! 18563: }
! 18564: }
! 18565:
! 18566: # formats a menu entry link pointing to a node or section
! 18567: #
! 18568: # arguments:
! 18569: # the entry text
! 18570: # the state, a hash reference holding informations about the context, with a
! 18571: # usefull entry, 'preformatted', true if we are in a preformatted format
! 18572: # (a format keeping space between words). In that case a function
! 18573: # of the main program, main::do_preformatted($text, $state) might
! 18574: # be used to format the text with the current format style.
! 18575: # href is optionnal. It is the reference to the section or the node anchor
! 18576: # which should be used to make the link (typically it is the argument
! 18577: # of a href= attribute in a <a> element).
! 18578: sub html_default_menu_link($$$$$$$$)
! 18579: {
! 18580: my $element_name = shift;
! 18581: my $state = shift;
! 18582: my $href = shift;
! 18583: my $node = shift;
! 18584: my $title = shift;
! 18585: my $ending = shift;
! 18586: my $has_title = shift;
! 18587: my $command_stack = shift;
! 18588: my $preformatted = shift;
! 18589:
! 18590: my $in_commands = 0;
! 18591: $in_commands = 1 if ($command_stack->[-1] and $command_stack->[-1] ne 'menu' and $command_stack->[-1] ne 'detailmenu' and $command_stack->[-1] ne 'direntry');
! 18592:
! 18593: $title = '' unless ($has_title);
! 18594: #print STDERR "MENU_LINK($in_commands)($state->{'preformatted'})\n";
! 18595: my $entry;
! 18596: my $symbol = '';
! 18597: if ($preformatted)
! 18598: {
! 18599: $title .= ':' if ($title ne '');
! 18600: $entry = "$MENU_SYMBOL$title$node";
! 18601: }
! 18602: elsif ($element_name eq '' or $NODE_NAME_IN_MENU)
! 18603: {
! 18604: if ($has_title)
! 18605: {
! 18606: $entry = "$title";
! 18607: }
! 18608: else
! 18609: {
! 18610: $entry = "$node";
! 18611: }
! 18612: $entry =~ s/^\s*//;
! 18613: $symbol = "$MENU_SYMBOL ";
! 18614: }
! 18615: else
! 18616: {
! 18617: $entry = $element_name;
! 18618: }
! 18619: $html_menu_entry_index++;
! 18620: my $accesskey;
! 18621: $accesskey = "accesskey=\"$html_menu_entry_index\"" if ($USE_ACCESSKEY and ($html_menu_entry_index < 10));
! 18622: $entry = &$anchor ('', $href, $entry, $accesskey) if (defined($href));
! 18623:
! 18624: return $entry.$ending if ($preformatted);
! 18625: # FIXME conditionalise to not having a description
! 18626: return "$symbol$entry$MENU_ENTRY_COLON" .' ' if ($in_commands);
! 18627: return "<tr><td align=\"left\" valign=\"top\">$symbol$entry$MENU_ENTRY_COLON</td><td> </td>";
! 18628: }
! 18629:
! 18630: sub html_simplify_text($)
! 18631: {
! 18632: my $text = shift;
! 18633: $text =~ s/[^\w]//og;
! 18634: return $text;
! 18635: }
! 18636:
! 18637: # formats a menu entry description, ie the text appearing after the node
! 18638: # specification in a menu entry an spanning until there is another
! 18639: # menu entry, or empty line
! 18640: #
! 18641: # arguments:
! 18642: # the description text
! 18643: # the state. See menu_entry.
! 18644: # the heading of the element associated with the node.
! 18645: sub html_default_menu_description($$$$)
! 18646: {
! 18647: my $text = shift;
! 18648: my $state = shift;
! 18649: my $element_text = shift;
! 18650: my $command_stack = shift;
! 18651: my $preformatted = shift;
! 18652:
! 18653: my $in_commands = 0;
! 18654: $in_commands = 1 if ($command_stack->[-1] and $command_stack->[-1] ne 'menu' and $command_stack->[-1] ne 'detailmenu' and $command_stack->[-1] ne 'direntry');
! 18655: return $text if ($preformatted);
! 18656: return $text."<br>" if ($in_commands);
! 18657: if ($AVOID_MENU_REDUNDANCY)
! 18658: {
! 18659: $text = '' if (html_simplify_text($element_text) eq html_simplify_text($text));
! 18660: }
! 18661: return "<td align=\"left\" valign=\"top\">$text</td></tr>\n";
! 18662: }
! 18663:
! 18664: sub html_teletyped_in_stack($)
! 18665: {
! 18666: my $stack = shift;
! 18667: foreach my $element(reverse(@$stack))
! 18668: {
! 18669: return 1 if ($complex_format_map{$element} and
! 18670: $complex_format_map{$element}->{'style'} and
! 18671: $complex_format_map{$element}->{'style'} eq 'code');
! 18672: }
! 18673: return 0;
! 18674: }
! 18675:
! 18676: # text after @item in table, vtable and ftable
! 18677: sub html_default_table_item($$$$$$$)
! 18678: {
! 18679: my $text = shift;
! 18680: my $index_label = shift;
! 18681: my $format = shift;
! 18682: my $command = shift;
! 18683: # my $formatted_command = shift;
! 18684: my $style_stack = shift;
! 18685: # my $text_formatted = shift;
! 18686: # my $text_formatted_leading_spaces = shift;
! 18687: # my $text_formatted_trailing_spaces = shift;
! 18688: my $item_cmd = shift;
! 18689: my $formatted_index_entry = shift;
! 18690:
! 18691: # if (defined($text_formatted) and !exists $special_list_commands{$format}->{$command})
! 18692: # {
! 18693: # $text = $text_formatted_leading_spaces . $text_formatted .$text_formatted_trailing_spaces;
! 18694: # }
! 18695: # $formatted_command = '' if (!defined($formatted_command) or
! 18696: # exists($special_list_commands{$format}->{$command}));
! 18697: if (html_teletyped_in_stack($style_stack))
! 18698: {
! 18699: # $text .= '</tt>';
! 18700: # $formatted_command = '<tt>' . $formatted_command;
! 18701: $text = '<tt>' . $text . '</tt>';
! 18702: }
! 18703: $text .= "\n" . $index_label if (defined($index_label));
! 18704: # return '<dt>' . $formatted_command . $text . '</dt>' . "\n";
! 18705: return '<dt>' . $text . '</dt>' . "\n";
! 18706: }
! 18707:
! 18708: # format text on the line following the @item line (in table, vtable and ftable)
! 18709: sub html_default_table_line($$$)
! 18710: {
! 18711: my $text = shift;
! 18712: my $only_inter_item_commands = shift;
! 18713: my $before_items = shift;
! 18714:
! 18715: $only_inter_item_commands = '' if (!defined($only_inter_item_commands));
! 18716:
! 18717: if ($text =~ /\S/)
! 18718: {
! 18719: return '<dd>' . $text . '</dd>' . "\n";# unless ($only_inter_item_commands);
! 18720: #return $text; # invalid without dd in ul
! 18721: }
! 18722: return '';
! 18723: }
! 18724:
! 18725: #my $cell_nr = -1;
! 18726:
! 18727: # row in multitable
! 18728: sub html_default_row($$$$$$$$)
! 18729: {
! 18730: my $text = shift;
! 18731: my $macro = shift;
! 18732: my $columnfractions = shift;
! 18733: my $prototype_row = shift;
! 18734: my $prototype_lengths = shift;
! 18735: my $column_number = shift;
! 18736: my $only_inter_item_commands = shift;
! 18737: my $before_items = shift;
! 18738:
! 18739: $only_inter_item_commands = '' if (!defined($only_inter_item_commands));
! 18740:
! 18741: # this is used to keep the cell number
! 18742: $html_default_multitable_stack[-1]->[0] = -1;
! 18743:
! 18744: if ($text =~ /\S/)
! 18745: {
! 18746: if ($macro eq 'headitem')
! 18747: {
! 18748: return '<thead><tr>' . $text . '</tr></thead>' . "\n";
! 18749: }
! 18750: return '<tr>' . $text . '</tr>' . "\n";
! 18751: }
! 18752: return '';
! 18753: }
! 18754:
! 18755: # cell in multitable
! 18756: sub html_default_cell($$$$$$$$)
! 18757: {
! 18758: my $text = shift;
! 18759: my $row_macro = shift;
! 18760: my $columnfractions = shift;
! 18761: my $prototype_row = shift;
! 18762: my $prototype_lengths = shift;
! 18763: my $column_number = shift;
! 18764: my $only_inter_item_commands = shift;
! 18765: my $before_items = shift;
! 18766:
! 18767: $only_inter_item_commands = '' if (!defined($only_inter_item_commands));
! 18768:
! 18769: $html_default_multitable_stack[-1]->[0]++;
! 18770: my $cell_nr = $html_default_multitable_stack[-1]->[0];
! 18771: my $fractions = '';
! 18772:
! 18773: if (defined($columnfractions) and (ref($columnfractions) eq 'ARRAY')
! 18774: and exists($columnfractions->[$cell_nr]))
! 18775: {
! 18776: my $fraction = sprintf('%d', 100*$columnfractions->[$cell_nr]);
! 18777: $fractions = " width=\"$fraction%\"";
! 18778: }
! 18779:
! 18780: # in constructs like
! 18781: # @strong{
! 18782: # @multitable ....
! 18783: # }
! 18784: # the space won't be removed since the <strong> is put before the space.
! 18785: $text =~ s/^\s*//;
! 18786: $text =~ s/\s*$//;
! 18787:
! 18788: if ($row_macro eq 'headitem')
! 18789: {
! 18790: return "<th${fractions}>" . $text . '</th>';
! 18791: }
! 18792: return "<td${fractions}>" . $text . '</td>';
! 18793: }
! 18794:
! 18795: sub html_default_format_list_item_texi($$$$$)
! 18796: {
! 18797: my $format = shift;
! 18798: my $line = shift;
! 18799: my $prepended = shift;
! 18800: my $command = shift;
! 18801: my $number = shift;
! 18802:
! 18803: my $result_line;
! 18804: my $open_command = 0;
! 18805: if (defined($command) and $command ne '' and !exists $special_list_commands{$format}->{$command} and $format ne 'itemize')
! 18806: {
! 18807: #@*table
! 18808: $open_command = 1;
! 18809: $line =~ s/^\s*//;
! 18810: $line =~ s/\s*$//;
! 18811: if (exists ($style_map{$command}))
! 18812: {
! 18813: $result_line = "\@$command\{$line\}\n";
! 18814: }
! 18815: elsif (exists ($things_map{$command}))
! 18816: {
! 18817: $result_line = "\@$command\{\} $line\n";
! 18818: }
! 18819: else
! 18820: {
! 18821: $result_line = "\@$command $line\n";
! 18822: }
! 18823: }
! 18824: elsif (defined($prepended) and $prepended ne '')
! 18825: {
! 18826: $prepended =~ s/^\s*//;
! 18827: $prepended =~ s/\s*$//;
! 18828: $line =~ s/^\s*//;
! 18829: $result_line = $prepended . ' ' . $line;
! 18830: }
! 18831: return ($result_line, $open_command);
! 18832: }
! 18833:
! 18834:
! 18835: # format an item in a list
! 18836: #
! 18837: # argument:
! 18838: # text of the item
! 18839: # format of the list (itemize or enumerate)
! 18840: # command passed as argument to the format
! 18841: # formatted_command leading command formatted, if it is a thing command
! 18842: sub html_default_list_item($$$$$$$$$$$)
! 18843: {
! 18844: my $text = shift;
! 18845: my $format = shift;
! 18846: my $command = shift;
! 18847: my $formatted_command = shift;
! 18848: my $item_nr = shift;
! 18849: my $enumerate_style = shift;
! 18850: my $number = shift;
! 18851: my $prepended = shift;
! 18852: my $prepended_formatted = shift;
! 18853: my $only_inter_item_commands = shift;
! 18854: my $before_items = shift;
! 18855:
! 18856: $only_inter_item_commands = '' if (!defined($only_inter_item_commands));
! 18857:
! 18858: $formatted_command = '' if (!defined($formatted_command) or
! 18859: exists($special_list_commands{$format}->{$command}));
! 18860: my $prepend = '';
! 18861: # if (defined($prepended) and $prepended ne '')
! 18862: # {
! 18863: # $prepend = $prepended;
! 18864: # }
! 18865: # elsif ($formatted_command ne '')
! 18866: if ($formatted_command ne '')
! 18867: {
! 18868: $prepend = $formatted_command;
! 18869: }
! 18870: if ($text =~ /\S/)
! 18871: {
! 18872: return '<li>' . $prepend . $text . '</li>';
! 18873: }
! 18874: return '';
! 18875: }
! 18876:
! 18877: sub html_default_table_list($$$$$$$$$)
! 18878: {
! 18879: my $format_command = shift;
! 18880: my $text = shift;
! 18881: my $command = shift;
! 18882: my $formatted_command = shift;
! 18883: # enumerate
! 18884: my $item_nr = shift;
! 18885: my $enumerate_style = shift;
! 18886: # itemize
! 18887: my $prepended = shift;
! 18888: my $prepended_formatted = shift;
! 18889: # multitable
! 18890: my $columnfractions = shift;
! 18891: my $prototype_row = shift;
! 18892: my $prototype_lengths = shift;
! 18893: my $column_number = shift;
! 18894: # my $number = shift;
! 18895: $formatted_command = '' if (!defined($formatted_command) or
! 18896: exists($special_list_commands{$format}->{$command}));
! 18897: if ($format_command eq 'itemize')
! 18898: {
! 18899: return "<ul>\n" . $text . "</ul>\n" if (($command eq 'bullet') or (($command eq '') and ($prepended eq '')));
! 18900: return html_default_attribute_class('ul',$NO_BULLET_LIST_CLASS).">\n" . $text . "</ul>\n";
! 18901: }
! 18902: elsif ($format_command eq 'multitable')
! 18903: {
! 18904: pop @html_default_multitable_stack;
! 18905: return &$format('multitable', 'table', $text);
! 18906: }
! 18907: }
! 18908:
! 18909: # a paragraph
! 18910: # arguments:
! 18911: # $text of the paragraph
! 18912: # $align for the alignement
! 18913: # $indent for the indent style (indent or noindent)
! 18914: # The following is usefull if the paragraph is in an itemize.
! 18915: # $paragraph_command is the leading formatting command (like @minus)
! 18916: # $paragraph_command_formatted is the leading formatting command formatted
! 18917: # $paragraph_number is a reference on the number of paragraphs appearing
! 18918: # in the format. The value should be increased if a paragraph is done
! 18919: # $format is the format name (@itemize)
! 18920: sub html_default_paragraph($$$$$$$$$$$$)
! 18921: {
! 18922: my $text = shift;
! 18923: my $align = shift;
! 18924: my $indent = shift;
! 18925: my $paragraph_command = shift;
! 18926: my $paragraph_command_formatted = shift;
! 18927: my $paragraph_number = shift;
! 18928: my $format = shift;
! 18929: my $item_nr = shift;
! 18930: my $enumerate_style = shift;
! 18931: my $number = shift;
! 18932: my $command_stack_at_end = shift;
! 18933: my $command_stack_at_begin = shift;
! 18934: #print STDERR "format: $format\n" if (defined($format));
! 18935: #print STDERR "paragraph @$command_stack_at_end; @$command_stack_at_begin\n";
! 18936: # $paragraph_command_formatted = '' if (!defined($paragraph_command_formatted) or
! 18937: # exists($special_list_commands{$format}->{$paragraph_command}));
! 18938: return '' if ($text =~ /^\s*$/);
! 18939:
! 18940: if (defined($paragraph_number) and defined($$paragraph_number))
! 18941: {
! 18942: $$paragraph_number++;
! 18943: return $text if (($format eq 'itemize' or $format eq 'enumerate') and
! 18944: ($$paragraph_number == 1));
! 18945: }
! 18946:
! 18947: my $top_stack = '';
! 18948: $top_stack = $command_stack_at_begin->[-1] if (scalar (@$command_stack_at_begin));
! 18949: if ($top_stack eq 'multitable')
! 18950: {
! 18951: $html_default_multitable_stack[-1]->[1]++;
! 18952: if ($html_default_multitable_stack[-1]->[1] == 0)
! 18953: {
! 18954: return $text;
! 18955: }
! 18956: }
! 18957:
! 18958: my $open = '<p>';
! 18959: if ($align)
! 18960: {
! 18961: $open = "<p align=\"$paragraph_style{$align}\">";
! 18962: }
! 18963: return $open.$text.'</p>';
! 18964: }
! 18965:
! 18966: # a preformatted region
! 18967: # arguments:
! 18968: # $text of the preformatted region
! 18969: # $pre_style css style
! 18970: # $class identifier for the preformatted region (example, menu-comment)
! 18971: # The following is usefull if the preformatted is in an itemize.
! 18972: # $leading_command is the leading formatting command (like @minus)
! 18973: # $leading_command_formatted is the leading formatting command formatted
! 18974: # $preformatted_number is a reference on the number of preformatteds appearing
! 18975: # in the format. The value should be increased if a preformatted is done
! 18976: sub html_default_preformatted($$$$$$$$$$$$)
! 18977: {
! 18978: my $text = shift;
! 18979: my $pre_style = shift;
! 18980: my $class = shift;
! 18981: my $leading_command = shift;
! 18982: my $leading_command_formatted = shift;
! 18983: my $preformatted_number = shift;
! 18984: my $format = shift;
! 18985: my $item_nr = shift;
! 18986: my $enumerate_style = shift;
! 18987: my $number = shift;
! 18988: my $command_stack_at_end = shift;
! 18989: my $command_stack_at_begin = shift;
! 18990:
! 18991: #print STDERR "preformatted @$command_stack_at_end; @$command_stack_at_begin\n";
! 18992: return '' if ($text eq '');
! 18993: $leading_command_formatted = '' if (!defined($leading_command_formatted) or
! 18994: exists($special_list_commands{$format}->{$leading_command}));
! 18995: if (defined($preformatted_number) and defined($$preformatted_number))
! 18996: {
! 18997: $$preformatted_number++;
! 18998: }
! 18999: my $top_stack = '';
! 19000: $top_stack = $command_stack_at_begin->[-1] if (scalar (@$command_stack_at_begin));
! 19001: if ($top_stack eq 'multitable')
! 19002: {
! 19003: $text =~ s/^\s*//;
! 19004: $text =~ s/\s*$//;
! 19005: }
! 19006:
! 19007: return html_default_attribute_class('pre', $class).">".$text."</pre>";
! 19008: }
! 19009:
! 19010: sub html_default_heading_text($$$)
! 19011: {
! 19012: my $command = shift;
! 19013: my $text = shift;
! 19014: my $level = shift;
! 19015:
! 19016: return '' if ($text !~ /\S/);
! 19017: # FIXME use a class=*contents?
! 19018: my $class = '';
! 19019: if ($command =~ /^@/ and $command !~ /^@.*contents$/)
! 19020: {
! 19021: $class = $command;
! 19022: $class =~ s/^@//;
! 19023: $class = 'node-heading' if ($command eq '@node');
! 19024: }
! 19025: my $align = '';
! 19026: $align = ' align="center"' if ($command eq '@centerchap' or $command eq '@settitle');
! 19027: $level = 1 if ($level == 0);
! 19028: my $result = html_default_attribute_class ("h$level", $class) ."$align>$text</h$level>";
! 19029: # FIXME titlefont appears inline in text, so no end of line is
! 19030: # added. The end of line should be added by the user if needed.
! 19031: $result .= "\n" unless ($command eq '@titlefont');
! 19032: $result .= $DEFAULT_RULE . "\n" if ($command eq '@part' and defined($DEFAULT_RULE) and $DEFAULT_RULE ne '');
! 19033: return $result;
! 19034: }
! 19035:
! 19036: sub html_default_heading_text_preformatted($$$)
! 19037: {
! 19038: my $command = shift;
! 19039: my $text = shift;
! 19040: my $level = shift;
! 19041:
! 19042: return '' if ($text !~ /\S/);
! 19043: return '<strong>'.$text.'</strong>'."\n";
! 19044: }
! 19045:
! 19046: # formatting of raw regions
! 19047: # if L2H is true another mechanism is used for tex
! 19048: sub html_default_raw($$;$)
! 19049: {
! 19050: my $style = shift;
! 19051: my $text = shift;
! 19052: my $line_nr = shift;
! 19053: my $expanded = 1 if (grep {$style eq $_} @EXPAND);
! 19054: if ($style eq 'verbatim' or $style eq 'verbatiminclude' or ($style eq 'tex' and $expanded))
! 19055: {
! 19056: $style = 'verbatim' if ($style eq 'verbatiminclude');
! 19057: return html_default_attribute_class('pre', $style).">" . &$protect_text($text) . '</pre>';
! 19058: }
! 19059: elsif ($style eq 'html' and $expanded)
! 19060: {
! 19061: chomp ($text);
! 19062: return $text;
! 19063: }
! 19064: elsif ($expanded)
! 19065: {
! 19066: main::line_warn (sprintf(__("Raw format %s is not converted"), $style), $line_nr);
! 19067: return &$protect_text($text);
! 19068: }
! 19069: else
! 19070: {
! 19071: return '';
! 19072: }
! 19073: }
! 19074:
! 19075: # This function formats a footnote reference and the footnote text associated
! 19076: # with a given footnote.
! 19077: # The footnote reference is the text appearing in the main document pointing
! 19078: # to the footnote text.
! 19079: #
! 19080: # arguments:
! 19081: # absolute number of the footnote (in the document)
! 19082: # relative number of the footnote (in the page)
! 19083: # identifier for the footnote
! 19084: # identifier for the footnote reference in the main document
! 19085: # main document file
! 19086: # footnote text file
! 19087: # array with the footnote text lines
! 19088: # the state. See menu entry.
! 19089: #
! 19090: # returns:
! 19091: # reference on an array containing the footnote text lines which should
! 19092: # have been updated
! 19093: # the text for the reference pointing on the footnote text
! 19094: sub html_default_foot_line_and_ref($$$$$$$$$)
! 19095: {
! 19096: my $number_in_doc = shift;
! 19097: my $number_in_page = shift;
! 19098: my $footnote_id = shift;
! 19099: my $place_id = shift;
! 19100: my $document_file = shift;
! 19101: my $footnote_file = shift;
! 19102: my $lines = shift;
! 19103: my $document_state = shift;
! 19104:
! 19105: if ($document_file eq $footnote_file)
! 19106: {
! 19107: $document_file = $footnote_file = '';
! 19108: }
! 19109:
! 19110: $number_in_doc = $NO_NUMBER_FOOTNOTE_SYMBOL if (!$NUMBER_FOOTNOTES);
! 19111:
! 19112: unshift (@$lines, '<h3>' .
! 19113: &$anchor($footnote_id, $document_file . "#$place_id",
! 19114: "($number_in_doc)")
! 19115: . "</h3>\n");
! 19116: # this is a bit obscure, this allows to add an anchor only if formatted
! 19117: # as part of the document.
! 19118: #$place_id = '' if ($document_state->{'outside_document'} or $document_state->{'multiple_pass'} or $document_state->{'expansion'});
! 19119: $place_id = '' if ($document_state->{'outside_document'} or (defined($document_state->{'multiple_pass'}) and $document_state->{'multiple_pass'} > 0));
! 19120: return ($lines, &$anchor($place_id, $footnote_file . "#$footnote_id",
! 19121: "($number_in_doc)"));
! 19122: }
! 19123:
! 19124: # formats a group of footnotes.
! 19125: #
! 19126: # argument:
! 19127: # array reference on the footnotes texts lines
! 19128: #
! 19129: # returns an array reference on the group of footnotes lines
! 19130: sub html_default_foot_section($)
! 19131: {
! 19132: my $lines = shift;
! 19133: unshift (@$lines, html_default_attribute_class('div', 'footnote').">\n" ,"$DEFAULT_RULE\n",
! 19134: &$heading_text('footnotes', gdt('Footnotes'), 3)
! 19135: );
! 19136: push (@$lines, "</div>\n");
! 19137: return $lines;
! 19138: }
! 19139:
! 19140: sub html_default_image_files($$$$)
! 19141: {
! 19142: my $base = shift;
! 19143: my $extension = shift;
! 19144: my $texi_base = shift;
! 19145: my $texi_extension = shift;
! 19146: my @files = ();
! 19147: return @files if (!defined($base) or ($base eq ''));
! 19148: if (defined($extension) and ($extension ne ''))
! 19149: {
! 19150: push @files,["$base.$extension", "$texi_base.$texi_extension"];
! 19151: }
! 19152: foreach my $ext (@IMAGE_EXTENSIONS)
! 19153: {
! 19154: push @files,["$base.$ext", "$texi_base.$ext"];
! 19155: }
! 19156: return @files;
! 19157: }
! 19158:
! 19159: # format an image
! 19160: #
! 19161: # arguments:
! 19162: # image file name with path
! 19163: # image basename
! 19164: # a boolean true if we are in a preformatted format
! 19165: # image file name without path
! 19166: # alt text
! 19167: # width
! 19168: # height
! 19169: # raw alt
! 19170: # extension
! 19171: # path to working dir
! 19172: # path to file relative from working dir
! 19173: sub html_default_image($$$$$$$$$$$$$$$$$)
! 19174: {
! 19175: my $file = shift;
! 19176: my $base = shift;
! 19177: my $preformatted = shift;
! 19178: my $file_name = shift;
! 19179: my $alt = shift;
! 19180: my $width = shift;
! 19181: my $height = shift;
! 19182: my $raw_alt = shift;
! 19183: my $extension = shift;
! 19184: my $working_dir = shift;
! 19185: my $file_path = shift;
! 19186: my $in_paragraph = shift;
! 19187: my $file_locations = shift;
! 19188: my $base_simple_format = shift;
! 19189: my $extension_simple_format = shift;
! 19190: my $file_name_simple_format = shift;
! 19191: my $line_nr = shift;
! 19192:
! 19193: if (!defined($file_path) or $file_path eq '')
! 19194: {
! 19195: if (defined($extension) and $extension ne '')
! 19196: {
! 19197: $file = "$base.$extension";
! 19198: }
! 19199: else
! 19200: {
! 19201: $file = "$base.jpg";
! 19202: }
! 19203: main::line_warn (sprintf(__("\@image file `%s' (for HTML) not found, using `%s'"), $base, $file), $line_nr);
! 19204: }
! 19205: elsif (! $COMPLETE_IMAGE_PATHS)
! 19206: {
! 19207: $file = $file_name;
! 19208: }
! 19209: $alt = &$protect_text($base) if (!defined($alt) or ($alt eq ''));
! 19210: return "[ $alt ]" if ($preformatted);
! 19211: # it is possible that $file_name is more correct as it allows the user
! 19212: # to chose the relative path.
! 19213: $file = &$protect_text($file);
! 19214: return "<img src=\"$file\" alt=\"$alt\">";
! 19215: }
! 19216:
! 19217: # format a target in the main document for an index entry.
! 19218: #
! 19219: # arguments:
! 19220: # target identifier
! 19221: # boolean true if in preformatted format
! 19222: # FIXME document the remaining
! 19223: sub html_default_index_entry_label($$$$$$$$$)
! 19224: {
! 19225: my $identifier = shift;
! 19226: my $preformatted = shift;
! 19227: my $entry = shift;
! 19228: my $index_name = shift;
! 19229: my $index_command = shift;
! 19230: my $texi_entry = shift;
! 19231: my $formatted_entry = shift;
! 19232: my $in_region_not_in_output = shift;
! 19233: my $index_entry_ref = shift;
! 19234:
! 19235: return '' if (!defined($identifier) or ($identifier !~ /\S/));
! 19236: my $label = &$anchor($identifier);
! 19237: return $label . "\n" if (!$preformatted);
! 19238: return $label;
! 19239: }
! 19240:
! 19241: sub html_default_index_entry_command($$$$$$)
! 19242: {
! 19243: my $command = shift;
! 19244: my $index_name = shift;
! 19245: my $label = shift;
! 19246: my $entry_texi = shift;
! 19247: my $entry_formatted = shift;
! 19248: my $index_entry_ref = shift;
! 19249:
! 19250: return $label;
! 19251: }
! 19252:
! 19253: # process definition commands line @deffn for example
! 19254: sub html_default_def_line($$$$$$$$$$$$$$$$)
! 19255: {
! 19256: my $category_prepared = shift;
! 19257: my $name = shift;
! 19258: my $type = shift;
! 19259: my $arguments = shift;
! 19260: my $index_label = shift;
! 19261: my $arguments_array = shift;
! 19262: my $arguments_type_array = shift;
! 19263: my $unformatted_arguments_array = shift;
! 19264: my $command = shift;
! 19265: my $class_name = shift;
! 19266: my $category = shift;
! 19267: my $class = shift;
! 19268: my $style = shift;
! 19269: my $original_command = shift;
! 19270:
! 19271: $index_label = '' if (!defined($index_label));
! 19272: chomp($index_label);
! 19273: $category_prepared = '' if (!defined($category_prepared) or ($category_prepared =~ /^\s*$/));
! 19274: $name = '' if (!defined($name) or ($name =~ /^\s*$/));
! 19275: $type = '' if (!defined($type) or $type =~ /^\s*$/);
! 19276: if (!defined($arguments) or $arguments =~ /^\s*$/)
! 19277: {
! 19278: $arguments = '';
! 19279: }
! 19280: else
! 19281: {
! 19282: chomp ($arguments);
! 19283: $arguments = '<em>' . $arguments . '</em>';
! 19284: }
! 19285: my $type_name = '';
! 19286: $type_name = " <em>$type</em>" if ($type ne '');
! 19287: $type_name .= ' <strong>' . $name . '</strong>' if ($name ne '');
! 19288: $type_name .= $arguments;
! 19289: if (! $DEF_TABLE)
! 19290: {
! 19291: return '<dt>'. $index_label. $category_prepared . ':' . $type_name . "</dt>\n";
! 19292: }
! 19293: else
! 19294: {
! 19295: return "<tr><td align=\"left\">" . $type_name .
! 19296: "</td><td align=\"right\">" . $category_prepared . $index_label . "</td></tr>\n";
! 19297: }
! 19298: }
! 19299:
! 19300: # a cartouche
! 19301: sub html_default_cartouche($$)
! 19302: {
! 19303: my $text = shift;
! 19304:
! 19305: if ($text =~ /\S/)
! 19306: {
! 19307: return html_default_attribute_class('table', 'cartouche')." border=\"1\"><tr><td>\n" . $text . "</td></tr></table>\n";
! 19308: }
! 19309: return '';
! 19310: }
! 19311:
! 19312: sub html_default_sp($$)
! 19313: {
! 19314: my $number = shift;
! 19315: my $preformatted = shift;
! 19316: return "<br>\n" x $number if (!$preformatted);
! 19317: return "\n" x $number;
! 19318: }
! 19319:
! 19320: sub html_default_acronym_like($$$$$$)
! 19321: {
! 19322: my $command = shift;
! 19323: my $acronym_texi = shift;
! 19324: my $acronym_text = shift;
! 19325: my $with_explanation = shift;
! 19326: my $explanation_lines = shift;
! 19327: my $explanation_text = shift;
! 19328: my $explanation_simply_formatted = shift;
! 19329:
! 19330: my $attribute = $command;
! 19331: my $opening = "<$attribute>";
! 19332: if (defined($explanation_simply_formatted))
! 19333: {
! 19334: $opening = "<$attribute title=\"$explanation_simply_formatted\">";
! 19335: }
! 19336: if ($with_explanation)
! 19337: {
! 19338: return gdt('{acronym_like} ({explanation})', {'acronym_like' => $opening . $acronym_text . "</$attribute>", 'explanation' => $explanation_text},{'duplicate'=>1})
! 19339: }
! 19340: else
! 19341: {
! 19342: return $opening . $acronym_text . "</$attribute>";
! 19343: }
! 19344: }
! 19345:
! 19346: sub html_default_quotation($$$$$)
! 19347: {
! 19348: my $command = shift;
! 19349: my $text = shift;
! 19350: my $argument_text = shift;
! 19351: my $argument_text_texi = shift;
! 19352: my $authors = shift;
! 19353: my $class = '';
! 19354: $class = $command if ($command ne 'quotation');
! 19355: my $attribution = '';
! 19356: if ($authors)
! 19357: {
! 19358: foreach my $author (@$authors)
! 19359: {
! 19360: my $author_texi = $author->{'author_texi'};
! 19361: chomp($author_texi);
! 19362: $attribution .= gdt("\@center --- \@emph{{author}}\n", {'author' => $author_texi}, {'duplicate' => 1, 'allow_paragraph' => 1});
! 19363: }
! 19364: }
! 19365: return html_default_attribute_class('blockquote', $class).">\n" . $text ."</blockquote>\n" . $attribution;
! 19366: }
! 19367:
! 19368: # format a whole index
! 19369: #
! 19370: # argument:
! 19371: # index text
! 19372: # index name
! 19373: sub html_default_print_index($$)
! 19374: {
! 19375: my $text = shift;
! 19376: my $name = shift;
! 19377: return '' if (!defined($text));
! 19378: return html_default_attribute_class('table', "index-$name")." border=\"0\">\n" .
! 19379: "<tr><td></td><th align=\"left\">" . gdt('Index Entry') . "</th><td> </td><th align=\"left\"> " . gdt('Section') . "</th></tr>\n"
! 19380: . "<tr><td colspan=\"4\"> $DEFAULT_RULE</td></tr>\n" . $text .
! 19381: "</table>\n";
! 19382: }
! 19383:
! 19384: # format a letter entry in an index page. The letter entry contains
! 19385: # the index entries for the words beginning with that letter. It is
! 19386: # a target for links pointing from the summary of the index.
! 19387: #
! 19388: # arguments:
! 19389: # the letter
! 19390: # identifier for the letter entry. This should be used to make the target
! 19391: # identifier
! 19392: # text of the index entries
! 19393: sub html_default_index_letter($$$)
! 19394: {
! 19395: my $letter = shift;
! 19396: my $id = shift;
! 19397: my $text = shift;
! 19398: return $text if ($letter =~ /^\s*$/);
! 19399: return '<tr><th>' . &$anchor($id,'',&$normal_text($letter, 0, 0, 0, 0, 0, [])) .
! 19400: "</th><td></td><td></td></tr>\n" . $text .
! 19401: "<tr><td colspan=\"4\"> $DEFAULT_RULE</td></tr>\n";
! 19402: }
! 19403:
! 19404: # format an index entry (in a letter entry).
! 19405: #
! 19406: # arguments:
! 19407: # href to the main text, linking to the place where the index entry appears
! 19408: # entry text
! 19409: # href to the main text, linking to the section or node where the index
! 19410: # entry appears
! 19411: # section or node heading
! 19412: sub html_default_index_entry($$$$$$$$$$)
! 19413: {
! 19414: my $text_href = shift;
! 19415: my $entry = shift;
! 19416: my $element_href = shift;
! 19417: my $element_text = shift;
! 19418: my $entry_file = shift;
! 19419: my $current_element_file = shift;
! 19420: my $entry_target = shift;
! 19421: my $entry_element_target = shift;
! 19422: my $in_region_not_in_output = shift;
! 19423: my $index_entry_ref = shift;
! 19424:
! 19425: return '' if ($entry !~ /\S/);
! 19426: my $element = $index_entry_ref->{'real_element'};
! 19427: if (defined($element))
! 19428: {
! 19429: my $element_set = 0;
! 19430: if ($NODE_NAME_IN_INDEX)
! 19431: {
! 19432: if ($element->{'node'})
! 19433: {
! 19434: $element_set = 1;
! 19435: }
! 19436: elsif ($element->{'with_node'})
! 19437: {
! 19438: $element = $element->{'with_node'};
! 19439: $element_set = 1;
! 19440: }
! 19441: }
! 19442: elsif (defined($NODE_NAME_IN_INDEX))
! 19443: {
! 19444: if (!$element->{'node'})
! 19445: {
! 19446: $element_set = 1;
! 19447: }
! 19448: elsif ($element->{'with_section'})
! 19449: {
! 19450: $element = $element->{'with_section'};
! 19451: $element_set = 1;
! 19452: }
! 19453: }
! 19454: if ($element_set)
! 19455: {
! 19456: $element_href = main::href($element, $Texi2HTML::THIS_ELEMENT->{'file'},
! 19457: $Texi2HTML::THISDOC{'line_nr'});
! 19458: $element_text = $element->{'text'};
! 19459: }
! 19460: }
! 19461:
! 19462: return '<tr><td></td><td valign="top">' . &$anchor('', $text_href, $entry)
! 19463: . $INDEX_ENTRY_COLON . '</td><td> </td><td valign="top">' . &$anchor('', $element_href, $element_text)
! 19464: . "</td></tr>\n";
! 19465: }
! 19466:
! 19467:
! 19468: # format an index summary. This is a list of letters linking to the letter
! 19469: # entries.
! 19470: #
! 19471: # arguments:
! 19472: # array reference containing the formatted alphabetical letters
! 19473: # array reference containing the formatted non lphabetical letters
! 19474: sub html_default_index_summary($$)
! 19475: {
! 19476: my $alpha = shift;
! 19477: my $nonalpha = shift;
! 19478:
! 19479: my $join = '';
! 19480: my $nonalpha_text = '';
! 19481: my $alpha_text = '';
! 19482: $join = " \n<br>\n" if (@$nonalpha and @$alpha);
! 19483: if (@$nonalpha)
! 19484: {
! 19485: $nonalpha_text = join("\n \n", @$nonalpha) . "\n";
! 19486: }
! 19487: if (@$alpha)
! 19488: {
! 19489: $alpha_text = join("\n \n", @$alpha) . "\n \n";
! 19490: }
! 19491: return "<table><tr><th valign=\"top\">" . gdt('Jump to') .": </th><td>" .
! 19492: $nonalpha_text . $join . $alpha_text . "</td></tr></table>\n";
! 19493: }
! 19494:
! 19495: sub html_default_element_label($$$$)
! 19496: {
! 19497: my $id = shift;
! 19498: my $element = shift;
! 19499: my $command = shift;
! 19500: my $line = shift;
! 19501:
! 19502: return &$anchor($id) . "\n";
! 19503: }
! 19504:
! 19505: sub html_default_misc_element_label($$)
! 19506: {
! 19507: my $id = shift;
! 19508: my $misc_page_name = shift;
! 19509: return &$anchor($id) . "\n";
! 19510: }
! 19511:
! 19512: sub html_default_anchor_label($$$$)
! 19513: {
! 19514: my $id = shift;
! 19515: my $anchor_text = shift;
! 19516: my $anchor_reference = shift;
! 19517: my $in_special_region = shift;
! 19518: return &$anchor($id);
! 19519: }
! 19520:
! 19521: sub html_default_tab_item_texi($$$$$$)
! 19522: {
! 19523: my $command = shift;
! 19524: my $commands_stack = shift;
! 19525: my $stack = shift;
! 19526: my $state = shift;
! 19527: my $line = shift;
! 19528: my $line_nr = shift;
! 19529:
! 19530: if (defined($commands_stack) and @$commands_stack and $commands_stack->[-1] eq 'multitable' and @html_default_multitable_stack)
! 19531: {
! 19532: $html_default_multitable_stack[-1]->[1] = -1;
! 19533: }
! 19534: return undef;
! 19535: }
! 19536:
! 19537: sub html_default_line_command($$$$)
! 19538: {
! 19539: my $command = shift;
! 19540: my $arg_text = shift;
! 19541: my $arg_texi = shift;
! 19542: my $state = shift;
! 19543:
! 19544: return '' if ($arg_text eq '' or ($command eq 'author' and (!$state->{'region'} or $state->{'region'} ne 'titlepage')));
! 19545: my $style = $line_command_map{$command};
! 19546: if ($style)
! 19547: {
! 19548: my $attribute_text = '';
! 19549: if ($style =~ /^(\w+)(\s+.*)/)
! 19550: {
! 19551: $style = $1;
! 19552: $attribute_text = $2;
! 19553: }
! 19554: $arg_text = "<${style}$attribute_text>$arg_text</$style>";
! 19555: }
! 19556: $arg_text .= "<br>" if ($command eq 'author');
! 19557: $arg_text .= "\n";
! 19558: return $arg_text;
! 19559: }
! 19560:
! 19561: 1;
! 19562:
! 19563: require "$T2H_HOME/formats/html.init"
! 19564: if ($0 =~ /\.pl$/ &&
! 19565: -e "$T2H_HOME/formats/html.init" && -r "$T2H_HOME/formats/html.init");
! 19566:
! 19567: # @INIT_INFO@
! 19568: # vim: set filetype=perl:
! 19569: #
! 19570: #+##############################################################################
! 19571: #
! 19572: # info.init: convert to info
! 19573: #
! 19574: # Copyright (C) 2008, 2009 Patrice Dumas <pertusus@free.fr>
! 19575: #
! 19576: # This program is free software; you can redistribute it and/or modify
! 19577: # it under the terms of the GNU General Public License as published by
! 19578: # the Free Software Foundation; either version 2 of the License, or
! 19579: # (at your option) any later version.
! 19580: #
! 19581: # This program is distributed in the hope that it will be useful,
! 19582: # but WITHOUT ANY WARRANTY; without even the implied warranty of
! 19583: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 19584: # GNU General Public License for more details.
! 19585: #
! 19586: # You should have received a copy of the GNU General Public License
! 19587: # along with this program; if not, write to the Free Software
! 19588: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
! 19589: # 02110-1301 USA
! 19590: #
! 19591: # Some error messages come from texinfo (makeinfo), so copyright holder
! 19592: # is the FSF or the individual who wrote them. All come from before the
! 19593: # switch of texinfo to GPLv3+.
! 19594: #
! 19595: #-##############################################################################
! 19596:
! 19597: use Data::Dumper;
! 19598:
! 19599: use strict;
! 19600:
! 19601: $Data::Dumper::Maxdepth = 25;
! 19602:
! 19603: my %info_default_indented_commands;
! 19604: my %info_default_format;
! 19605: my %info_default_enable_encoding_accents;
! 19606: my @simple_quoted_commands;
! 19607: my @asis_commands;
! 19608: my @chevron_commands;
! 19609: my %info_default_accent_commands = ();
! 19610: my %info_default_leaf_command = ();
! 19611: my $info_default_end_sentence_character;
! 19612: my $info_default_after_punctuation_characters;
! 19613: my $info_default_indent_length;
! 19614: my %info_default_indent_format_length;
! 19615: my $info_default_index_length_to_node;
! 19616: my $info_default_listoffloat_caption_entry_length;
! 19617: my $info_default_listoffloat_append;
! 19618: my %info_default_index_entries_counts;
! 19619:
! 19620: sub info_default_load(;$)
! 19621: {
! 19622: my $from_command_line = shift;
! 19623:
! 19624: t2h_default_set_variables_default();
! 19625: $USE_SECTIONS = 0;
! 19626: $USE_NODES = 1;
! 19627: #set_conf('SPLIT', 0, 1);
! 19628: $SPLIT = '';
! 19629: @T2H_FORMAT_EXPAND = ('info', 'direntry');
! 19630: $EXTENSION = 'info';
! 19631: $SHOW_MENU = 1;
! 19632: $SHOW_TITLE = 0;
! 19633: $USE_SETFILENAME_EXTENSION = 1;
! 19634: $INLINE_INSERTCOPYING = 1;
! 19635: $SIMPLE_MENU = 1;
! 19636: $MENU_SYMBOL = '*';
! 19637: $USE_ISO = 0;
! 19638: $ENABLE_ENCODING_USE_ENTITY = 0;
! 19639: $ENABLE_ENCODING = 1;
! 19640: @IMAGE_EXTENSIONS = ('png', 'jpg', 'txt');
! 19641: $CAPTION_STYLE = 'asis';
! 19642: $DEFAULT_ENCODING = 'ascii';
! 19643: $HEADERS = 1;
! 19644: $INLINE_CONTENTS = 0;
! 19645:
! 19646:
! 19647: $no_paragraph_commands{'anchor'} = 1;
! 19648:
! 19649: %simple_map = %default_simple_map;
! 19650: %simple_map_pre = %simple_map;
! 19651: %simple_map_texi = %simple_map;
! 19652:
! 19653: %things_map = %default_things_map;
! 19654: %pre_map = %things_map;
! 19655:
! 19656: %line_command_map = (
! 19657: 'dircategory' => ''
! 19658: );
! 19659:
! 19660: # sc and var upcase.
! 19661: @simple_quoted_commands = ('cite', 'code', 'command', 'env', 'file', 'kbd',
! 19662: 'option', 'samp');
! 19663: @asis_commands = ('asis', 'w', 'b', 'ctrl', 'i', 'math', 'sc', 't', 'r',
! 19664: 'slanted', 'sansserif', 'var', 'titlefont', 'verb', 'clickstyle',
! 19665: 'headitemfont');
! 19666: @chevron_commands = ('key', 'indicateurl');
! 19667:
! 19668: %info_default_accent_commands = ();
! 19669: %info_default_leaf_command = ();
! 19670:
! 19671: %style_map = ();
! 19672: t2h_default_copy_style_map (\%default_style_map, \%style_map);
! 19673:
! 19674: foreach my $accent_command ('tieaccent', 'dotless', keys(%unicode_accents), keys(%accent_map))
! 19675: {
! 19676: $info_default_accent_commands{$accent_command} = 1;
! 19677: $style_map{$accent_command} = { 'function' => \&info_default_accent };
! 19678: }
! 19679:
! 19680: foreach my $command (keys(%style_map))
! 19681: {
! 19682: delete $style_map{$command}->{'quote'} if (exists($style_map{$command}->{'quote'}));
! 19683: if (grep {$_ eq $command} @simple_quoted_commands)
! 19684: {
! 19685: delete $style_map{$command}->{'function'} if (exists($style_map{$command}->{'function'}));
! 19686: $style_map{$command}->{'begin'} = '`';
! 19687: $style_map{$command}->{'end'} = "'";
! 19688: next;
! 19689: }
! 19690: elsif (grep {$_ eq $command} @asis_commands)
! 19691: {
! 19692: delete $style_map{$command}->{'function'} if (exists($style_map{$command}->{'function'}));
! 19693: delete $style_map{$command}->{'begin'} if (exists($style_map{$command}->{'begin'}));
! 19694: delete $style_map{$command}->{'end'} if (exists($style_map{$command}->{'end'}));
! 19695: }
! 19696: if (grep {$_ eq $command} @chevron_commands)
! 19697: {
! 19698: delete $style_map{$command}->{'function'} if (exists($style_map{$command}->{'function'}));
! 19699: $style_map{$command}->{'begin'} = '<';
! 19700: $style_map{$command}->{'end'} = '>';
! 19701: next;
! 19702: }
! 19703: $info_default_leaf_command{$command} = 1 if ($style_map{$command}->{'type'} and $style_map{$command}->{'type'} eq 'simple_style');
! 19704: }
! 19705:
! 19706: $style_map{'strong'}->{'begin'} = '*';
! 19707: $style_map{'strong'}->{'end'} = '*';
! 19708: $style_map{'dfn'}->{'begin'} = '"';
! 19709: $style_map{'dfn'}->{'end'} = '"';
! 19710: $style_map{'emph'}->{'begin'} = '_';
! 19711: $style_map{'emph'}->{'end'} = '_';
! 19712:
! 19713:
! 19714: foreach my $command (keys(%info_default_leaf_command))
! 19715: {
! 19716: if (defined ($style_map{$command}->{'args'}))
! 19717: {
! 19718: $style_map{$command}->{'orig_args'} = [ @{$style_map{$command}->{'args'}} ];
! 19719: }
! 19720: else
! 19721: {
! 19722: $style_map{$command}->{'orig_args'} = [ 'normal' ];
! 19723: }
! 19724: $style_map{$command}->{'args'} = [];
! 19725: foreach my $arg (@{$style_map{$command}->{'orig_args'}})
! 19726: {
! 19727: push @{$style_map{$command}->{'args'}}, 'keep';
! 19728: }
! 19729: }
! 19730:
! 19731: $style_map{'uref'}->{'function'} = \&info_default_uref;
! 19732: $style_map{'url'}->{'function'} = \&info_default_uref;
! 19733: $style_map{'email'}->{'function'} = \&info_default_email;
! 19734:
! 19735: %style_map_pre = ();
! 19736: %style_map_texi = ();
! 19737: t2h_default_copy_style_map (\%style_map, \%style_map_pre);
! 19738: t2h_default_copy_style_map (\%style_map, \%style_map_texi);
! 19739:
! 19740: $special_list_commands{'itemize'} = {};
! 19741:
! 19742: %info_default_indent_format_length = ('enumerate' => 2,
! 19743: 'itemize' => 3,
! 19744: 'table' => 0,
! 19745: 'vtable' => 0,
! 19746: 'ftable' => 0,
! 19747: );
! 19748:
! 19749:
! 19750: %format_map = ();
! 19751: foreach my $format ('group', 'raggedright', 'cartouche')
! 19752: {
! 19753: $format_map{$format} = '';
! 19754: }
! 19755:
! 19756: foreach my $menu_command('menu', 'detailmenu', 'direntry', 'menu_comment')
! 19757: {
! 19758: $complex_format_map{$menu_command} = {'begin' => '' , 'end' => ''};
! 19759: }
! 19760:
! 19761: foreach my $command (keys (%complex_format_map), keys(%info_default_indent_format_length), 'quotation', 'smallquotation', 'deff_item', 'deff_itemx')
! 19762: {
! 19763: $info_default_indented_commands{$command} = 1;
! 19764: }
! 19765:
! 19766: foreach my $command (keys(%info_default_indented_commands), 'multitable', 'float', 'flushright', 'flushleft', 'center')
! 19767: {
! 19768: $info_default_format{$command} = 1;
! 19769: }
! 19770:
! 19771: # it doesn't change anything for multitable
! 19772: foreach my $non_indented_command('format', 'smallformat', 'menu',
! 19773: 'detailmenu', 'direntry', 'multitable')
! 19774: {
! 19775: $info_default_indented_commands{$non_indented_command} = 0;
! 19776: }
! 19777:
! 19778: $info_default_end_sentence_character = quotemeta($punctuation_characters);
! 19779: $info_default_after_punctuation_characters = quotemeta($after_punctuation_characters);
! 19780: $info_default_indent_length = 5;
! 19781:
! 19782: $info_default_index_length_to_node = 41;
! 19783:
! 19784: $info_default_listoffloat_caption_entry_length = 41;
! 19785: #$info_default_listoffloat_append = '...: ';
! 19786: $info_default_listoffloat_append = '...';
! 19787:
! 19788: t2h_default_push_handler(\&info_default_init_accent_enable_encoding, \@command_handler_init);
! 19789: t2h_default_push_handler(\&info_default_init_variables, \@command_handler_init);
! 19790:
! 19791:
! 19792: $style = \&info_default_style;
! 19793: $print_page_head = \&info_default_print_page_head;
! 19794: $contents = \&info_default_noop;
! 19795: $shortcontents = \&info_default_noop;
! 19796: $about_body = \&info_default_noop;
! 19797: $print_Footnotes = \&info_default_noop;
! 19798: $copying_comment = \&info_default_copying_comment;
! 19799: $element_heading = \&info_default_element_heading;
! 19800: $heading = \&info_default_heading;
! 19801: $normal_text = \&info_default_normal_text;
! 19802: $paragraph = \&info_default_paragraph;
! 19803: $preformatted = \&info_default_preformatted;
! 19804: $empty_preformatted = \&info_default_preformatted;
! 19805: $empty_line = \&info_default_empty_line;
! 19806: # maybe should not be called from the main program?
! 19807: $print_page_foot = \&info_default_print_page_foot;
! 19808: $print_Top_footer = \&info_default_print_Top_footer;
! 19809: $print_Top = \&info_default_print_section;
! 19810: $print_section = \&info_default_print_section;
! 19811: $end_section = \&info_default_end_section;
! 19812: $one_section = \&info_default_one_section;
! 19813: $begin_format_texi = \&info_default_begin_format_texi;
! 19814: $begin_style_texi = \&info_default_begin_style_texi;
! 19815: $begin_paragraph_texi = \&info_default_begin_paragraph_texi;
! 19816: $simple_command = \&info_default_simple_command;
! 19817: $thing_command = \&info_default_thing_command;
! 19818: $begin_special_region = \&info_default_begin_special_region;
! 19819: $end_special_region = \&info_default_end_special_region;
! 19820: $anchor_label = \&info_default_anchor_label;
! 19821: $element_label = \&info_default_noop;
! 19822: $menu_link = \&info_default_menu_link;
! 19823: #$menu_command = \&info_default_menu_command;
! 19824: $complex_format = \&info_default_complex_format;
! 19825: $quotation = \&info_default_quotation;
! 19826: $misc_command_line = \&info_default_misc_commands;
! 19827: $external_ref = \&info_default_external_ref;
! 19828: $internal_ref = \&info_default_internal_ref;
! 19829: $image = \&info_default_image;
! 19830: $image_files = \&info_default_image_files;
! 19831: $index_summary = \&info_default_index_summary;
! 19832: $summary_letter = \&info_default_summary_letter;
! 19833: $index_entry = \&info_default_index_entry;
! 19834: $index_entry_command = \&t2h_default_index_entry_command;
! 19835: $index_letter = \&info_default_index_letter;
! 19836: $printindex = \&info_default_printindex;
! 19837: $print_index = \&info_default_print_index;
! 19838: $index_entry_label = \&info_default_index_entry_label;
! 19839: $foot_section = \&info_default_foot_lines;
! 19840: $foot_line_and_ref = \&info_default_foot_line_and_ref;
! 19841: $footnote_texi = \&info_default_footnote_texi;
! 19842: $list_item = \&info_default_list_item;
! 19843: $format_list_item_texi = \&info_default_format_list_item_texi;
! 19844: $format = \&info_default_format;
! 19845: $tab_item_texi = \&info_default_tab_item_texi;
! 19846: $acronym_like = \&info_default_acronym_like;
! 19847: $sp = \&info_default_sp;
! 19848: $paragraph_style_command = \&info_default_paragraph_style_command;
! 19849: $cell = \&info_default_cell;
! 19850: $row = \&info_default_row;
! 19851: $table_list = \&info_default_table_list;
! 19852: $def_item = \&info_default_def_item;
! 19853: $def = \&info_default_def;
! 19854: $def_line = \&info_default_def_line;
! 19855: $float = \&info_default_float;
! 19856: $listoffloats_entry = \&info_default_listoffloats_entry;
! 19857: $listoffloats = \&info_default_listoffloats;
! 19858: $colon_command = \&info_default_colon_command;
! 19859: $raw = \&info_default_raw;
! 19860: $line_command = \&info_default_line_command;
! 19861: $comment = \&t2h_default_comment;
! 19862: $unknown_style = \&info_default_unknown_style;
! 19863: $heading_text = \&t2h_default_heading_text;
! 19864:
! 19865: }
! 19866:
! 19867: my %info_default_state_map = ();
! 19868: my $info_default_out_file_nr = 1;
! 19869: my $info_default_dir_specification = '';
! 19870: my @info_default_pending_indirect = ();
! 19871: my @info_default_pending_footnotes = ();
! 19872: my $info_default_state_nr = 0;
! 19873:
! 19874: # maximal length of index entries line number information. Each entry is
! 19875: # an index name.
! 19876: my %info_default_index_line_string_length = ();
! 19877: my %info_default_index_entries = ();
! 19878: my $info_default_footnote_index = 0;
! 19879: my $info_default_current_node = undef;
! 19880:
! 19881: my %info_default_command_handler_expand;
! 19882:
! 19883: sub info_default_intercept_handler
! 19884: {
! 19885: my $command = $_[0];
! 19886: my $result = &{$info_default_command_handler_expand{$command}}(@_);
! 19887: return info_default_store_text (undef, $result, $command);
! 19888: }
! 19889:
! 19890: sub info_default_init_variables()
! 19891: {
! 19892: %info_default_state_map = ();
! 19893: $info_default_out_file_nr = 1;
! 19894: $info_default_dir_specification = '';
! 19895: @info_default_pending_indirect = ();
! 19896: @info_default_pending_footnotes = ();
! 19897: $info_default_state_nr = 0;
! 19898:
! 19899: %info_default_index_line_string_length = ();
! 19900: %info_default_index_entries = ();
! 19901: $info_default_footnote_index = 0;
! 19902: $info_default_current_node = undef;
! 19903: $Texi2HTML::THISDOC{'SPLIT'} = 0 if ($OUTPUT_FORMAT eq 'info');
! 19904: $FRAMES = 0 if ($OUTPUT_FORMAT eq 'info');
! 19905:
! 19906: foreach my $command (keys (%command_handler))
! 19907: {
! 19908: if ($command_handler{$command}->{'expand'})
! 19909: {
! 19910: $info_default_command_handler_expand{$command} = $command_handler{$command}->{'expand'};
! 19911: $command_handler{$command}->{'expand'} = \&info_default_intercept_handler;
! 19912: }
! 19913: }
! 19914: }
! 19915:
! 19916: # this is put in command_handler_init such that it sets things right
! 19917: # in case $ENABLE_ENCODING is set and has lead to modification of the
! 19918: # accent functions
! 19919: sub info_default_init_accent_enable_encoding()
! 19920: {
! 19921: return unless ($ENABLE_ENCODING and $USE_UNICODE);
! 19922: foreach my $key (keys(%unicode_accents), 'dotless')
! 19923: {
! 19924: $info_default_enable_encoding_accents{$key} = 1;
! 19925: $t2h_enable_encoding_default_accent{'normal'}->{$key} = \&t2h_default_accent;
! 19926: $t2h_enable_encoding_default_accent{'texi'}->{$key} = \&t2h_default_accent;
! 19927: $t2h_enable_encoding_default_accent{'pre'}->{$key} = \&t2h_default_accent;
! 19928: $style_map{$key}->{'function'} = \&info_default_accent;
! 19929: $style_map_texi{$key}->{'function'} = \&info_default_accent;
! 19930: $style_map_pre{$key}->{'function'} = \&info_default_accent;
! 19931: }
! 19932: }
! 19933:
! 19934: sub info_default_uref($$)
! 19935: {
! 19936: shift;
! 19937: my $args = shift;
! 19938: my $url = shift @$args;
! 19939: my $text = shift @$args;
! 19940: my $replacement = shift @$args;
! 19941: $url = main::normalise_space($url);
! 19942: $replacement = '' if (!defined($replacement));
! 19943: $replacement = main::normalise_space($replacement);
! 19944: return $replacement if ($replacement ne '');
! 19945: $text = '' if (!defined($text));
! 19946: $text = main::normalise_space($text);
! 19947: return "`$url'" if ($text eq '');
! 19948: return "$text ($url)";
! 19949: }
! 19950:
! 19951: sub info_default_email($$)
! 19952: {
! 19953: my $command = shift;
! 19954: my $args = shift;
! 19955: my $mail = shift @$args;
! 19956: my $text = shift @$args;
! 19957: $mail = main::normalise_space($mail);
! 19958: $text = '' if (!defined($text));
! 19959: $text = main::normalise_space($text);
! 19960: $mail = "<$mail>";
! 19961: return $mail unless ($text ne '');
! 19962: return "$text $mail";
! 19963: }
! 19964:
! 19965:
! 19966: sub info_default_accent($$$)
! 19967: {
! 19968: my @args = @_;
! 19969: my $command = shift;
! 19970: my $args = shift;
! 19971: my $text = $args->[0];
! 19972: my $style_stack = shift;
! 19973: my $state = shift;
! 19974:
! 19975: my $result;
! 19976: if ($ENABLE_ENCODING and $info_default_enable_encoding_accents{$command})
! 19977: {
! 19978: $result = &t2h_enable_encoding_normal_accent(@args);
! 19979: }
! 19980: else
! 19981: {
! 19982: $result = &t2h_default_accent(@args);
! 19983: }
! 19984: if (scalar(@$style_stack) and $info_default_accent_commands{$style_stack->[-1]})
! 19985: { # still more accents on the stack
! 19986: return $result;
! 19987: }
! 19988: return info_default_store_text($state,$result,'accents_commands');
! 19989: }
! 19990:
! 19991: sub info_default_noop
! 19992: {
! 19993: return '';
! 19994: }
! 19995:
! 19996: sub info_default_copying_comment($$$$)
! 19997: {
! 19998: my $copying_lines = shift;
! 19999: my $copying_text = shift;
! 20000: my $copying_no_texi = shift;
! 20001: my $copying_simple_text = shift;
! 20002: return '' if ($copying_text eq '');
! 20003: return $copying_text;
! 20004: }
! 20005:
! 20006: sub info_default_byte_count($)
! 20007: {
! 20008: my $string = shift;
! 20009: my $out_encoding = Texi2HTML::Config::get_conf('OUT_ENCODING');
! 20010: if ($out_encoding and lc($out_encoding) ne 'us-ascii' and $USE_UNICODE)
! 20011: {
! 20012: return length (Encode::encode($out_encoding, $string));
! 20013: }
! 20014: # There is no default encoding. We assume it is us-ascii. Not sure
! 20015: # about what perl thinks it is...
! 20016: #print STDERR "Unknown encoding for: $string\n" if (!$out_encoding);
! 20017: return length($string);
! 20018: }
! 20019:
! 20020: sub info_default_count_lines($;$$)
! 20021: {
! 20022: my $text = shift;
! 20023: my $indent_length = shift;
! 20024: my $indentation_done = shift;
! 20025:
! 20026: my $blank_line;
! 20027: my $no_indentation = 0;
! 20028:
! 20029: if (!defined($indentation_done) or $indentation_done)
! 20030: {
! 20031: $no_indentation = 1;
! 20032: $indent_length = 0;
! 20033: }
! 20034: my @lines = split /^/, $text;
! 20035: # don't accept empty text.
! 20036: @lines = ('') if (!@lines);
! 20037: my $line_passed = scalar(@lines);
! 20038: $line_passed-- if ($line_passed);
! 20039:
! 20040: my $end_of_line = 0;
! 20041: if (($#lines > 1) and !$end_of_line and ($lines[-1] !~ /\S/) and ($lines[-2] !~ /\S/))
! 20042: {
! 20043: $blank_line = 1;
! 20044: }
! 20045: my $last_line = $lines[-1];
! 20046:
! 20047: my $indented_text = shift (@lines);
! 20048: #print STDERR "COUNT info_default_count_lines(i_done $no_indentation, i_l $indent_length) i_t `$indented_text'\n";
! 20049: foreach my $line (@lines)
! 20050: {
! 20051: if ($indent_length and $line =~ /\S/)
! 20052: {
! 20053: $indented_text .= ' ' x $indent_length . $line;
! 20054: }
! 20055: else
! 20056: {
! 20057: $indented_text .= $line;
! 20058: }
! 20059: }
! 20060: if (chomp($text))
! 20061: {
! 20062: $line_passed++;
! 20063: $end_of_line = 1;
! 20064: }
! 20065: return ($line_passed, $end_of_line, $last_line, $indented_text, $blank_line);
! 20066: }
! 20067:
! 20068: sub info_default_get_state($)
! 20069: {
! 20070: my $state = shift;
! 20071: if (!exists $info_default_state_map{$state})
! 20072: {
! 20073: #print STDERR "NEW state $info_default_state_nr\n";
! 20074: my ($current_command, $top_stack);
! 20075: $info_default_state_map{$state} = {};
! 20076: info_default_reset_state($info_default_state_map{$state});
! 20077: # since the page head always leave a blank line, and the state may be
! 20078: # used for text right after the page head, we set it to 1 here.
! 20079: # it may be wrong in other contexts, to be seen.
! 20080: $info_default_state_map{$state}->{'blank_line'} = 1;
! 20081: $info_default_state_map{$state}->{'only_spaces'} = 1;
! 20082: # this is the first line, so set to 1. This is reset later in
! 20083: # most cases, when a node is seen, but may still be useful in
! 20084: # @footnote, for example
! 20085: $info_default_state_map{$state}->{'line_count'} = 1;
! 20086: $info_default_state_map{$state}->{'offset_in_file'} = 0;
! 20087: $info_default_state_map{$state}->{'nr'} = $info_default_state_nr;
! 20088: $info_default_state_map{$state}->{'state'} = $state;
! 20089: $info_default_state_map{$state}->{'multitable_stack'} = [];
! 20090: @{$info_default_state_map{$state}->{'align_stack'}} = ({'command'=>'normal'});
! 20091: $info_default_state_nr++;
! 20092: }
! 20093: #print STDERR "RETURN state $state $info_default_state_map{$state} $info_default_state_map{$state}->{'nr'}\n";
! 20094: return $info_default_state_map{$state};
! 20095: }
! 20096:
! 20097: sub info_default_reset_state($)
! 20098: {
! 20099: my $info_state = shift;
! 20100: $info_state->{'top'} = {};
! 20101: $info_state->{'current'} = $info_state->{'top'};
! 20102: }
! 20103:
! 20104: sub info_default_iterator_next($$$)
! 20105: {
! 20106: my $current_command = shift;
! 20107: my $command_index = shift;
! 20108: my $command_close = shift;
! 20109: #print STDERR "NNNNNNNNNNNNNN iterator_next current $current_command idx $command_index close $command_close\n";
! 20110:
! 20111: my $sub_command = $current_command->{'content'}->[$command_index];
! 20112:
! 20113: if ($sub_command->{'content'} and !$command_close)
! 20114: {
! 20115: return ($sub_command, 0, 0);
! 20116: }
! 20117:
! 20118: if ($current_command->{'content'}->[$command_index+1])
! 20119: {
! 20120: return ($current_command, $command_index+1, 0);
! 20121: }
! 20122: elsif (defined($current_command->{'parent'}))
! 20123: {
! 20124: return ($current_command->{'parent'}, $current_command->{'index_in_parent'}, 1);
! 20125: }
! 20126: else
! 20127: {
! 20128: return (undef, undef, undef);
! 20129: }
! 20130: }
! 20131:
! 20132: # return ($current_next, $index_next, $close_next, $text, $command);
! 20133: #
! 20134: # returns the next in tree, identified by the triplet
! 20135: # ($current_next, $index_next, $close_next) and also the command
! 20136: # and/or text if defined, in $text and $command.
! 20137: sub info_default_next($$$)
! 20138: {
! 20139: my $current = shift;
! 20140: my $index = shift;
! 20141: my $close = shift;
! 20142:
! 20143: my $text;
! 20144: my $command;
! 20145:
! 20146: my ($current_next, $index_next, $close_next) = info_default_iterator_next($current, $index, $close);
! 20147: return ($current_next, $index_next, $close_next, $text, $command) if (!defined($current_next));
! 20148:
! 20149: my $content = $current_next->{'content'}->[$index_next];
! 20150: $command = $content->{'command'} if (defined($content->{'command'}));
! 20151: if ($close_next)
! 20152: {
! 20153: return ($current_next, $index_next, $close_next, $content->{'end'}, $command);
! 20154: }
! 20155: if (defined($content->{'text'}))
! 20156: {
! 20157: return ($current_next, $index_next, $close_next, $content->{'text'}, $command);
! 20158: }
! 20159: if (defined($content->{'begin'}))
! 20160: {
! 20161: $text = $content->{'begin'};
! 20162: }
! 20163: if (defined($content->{'end'}) and !defined($content->{'content'}))
! 20164: {
! 20165: if (!defined($text))
! 20166: {
! 20167: $text = $content->{'end'};
! 20168: }
! 20169: else
! 20170: {
! 20171: $text .= $content->{'end'};
! 20172: }
! 20173: }
! 20174: return ($current_next, $index_next, $close_next, $text, $command);
! 20175: }
! 20176:
! 20177:
! 20178: sub info_default_process_line_text($$$)
! 20179: {
! 20180: my $text = shift;
! 20181: my $line_width_counter = shift;
! 20182: my $indent_length = shift;
! 20183: $indent_length = 0 if (!defined($indent_length));
! 20184:
! 20185: my $line_passed = 0;
! 20186: my $chomped_text = $text;
! 20187: my $end_of_line = chomp($chomped_text);
! 20188: if ($indent_length > $line_width_counter and $chomped_text ne '')
! 20189: {
! 20190: $text = ' ' x ($indent_length - $line_width_counter) . $text;
! 20191: }
! 20192: $line_width_counter += t2h_default_string_width($text);
! 20193: # it seems like it never happens in the tests.
! 20194: if ($end_of_line)
! 20195: {
! 20196: $line_passed = 1;
! 20197: $line_width_counter = 0;
! 20198: }
! 20199: return ($line_width_counter, $line_passed, $text);
! 20200: }
! 20201:
! 20202: # Beware that there is a pending word if the text doesn't end with
! 20203: # a space
! 20204: sub info_default_process_para_text($$$$$;$$)
! 20205: {
! 20206: my $text = shift;
! 20207: my $line_char_counter = shift;
! 20208: my $pending_spaces_word = shift;
! 20209: my $indent_length = shift;
! 20210: my $max_column = shift;
! 20211: my $keep_end_of_lines = shift;
! 20212: $keep_end_of_lines = 0 if (!$keep_end_of_lines);
! 20213: # indentation for the lines except for the first one
! 20214: my $indent_length_next = shift;
! 20215: $indent_length = 0 if (!defined($indent_length));
! 20216: $indent_length_next = $indent_length if (!defined($indent_length_next));
! 20217:
! 20218: my $line_passed = 0;
! 20219: my $result = '';
! 20220:
! 20221: #print STDERR "process_text(indent($indent_length,$indent_length_next),keep_eol $keep_end_of_lines) spaces `$pending_spaces_word->{'spaces'}') line_char_counter $line_char_counter |$text|\n";
! 20222:
! 20223: while ($text ne '')
! 20224: {
! 20225: #print STDERR "l_c_c $line_char_counter pending_word ".var_to_str($pending_spaces_word->{'word'}).", pending_spaces `$pending_spaces_word->{'spaces'}', result `$result'\n";
! 20226: if (!$keep_end_of_lines and $text =~ s/^(\s+)//)
! 20227: {
! 20228: my $new_spaces = $1;
! 20229: # in general there are no end of lines in the lines cut, since they
! 20230: # are replaced by spaces in the main loop. However, it may happen
! 20231: # with @* in @def* lines
! 20232: my @lines = split /^/, $new_spaces;
! 20233: my $eol_spaces;
! 20234: # last line is in $new_spaces, other lines are in $eol_spaces
! 20235: if (@lines > 1)
! 20236: {
! 20237: $new_spaces = pop @lines;
! 20238: $eol_spaces = join ("", @lines);
! 20239: #print STDERR "EOL_SPACES[$line_char_counter](+$pending_spaces_word->{'spaces'}) `$eol_spaces'\n";
! 20240: }
! 20241: if (defined($pending_spaces_word->{'word'}))
! 20242: {
! 20243: # add spaces in front if needed for the indentation
! 20244: if ($indent_length > $line_char_counter + t2h_default_string_width($pending_spaces_word->{'spaces'}))
! 20245: {
! 20246: $pending_spaces_word->{'spaces'} = ' ' x ($indent_length - $line_char_counter) . $pending_spaces_word->{'spaces'};
! 20247: }
! 20248: $result .= $pending_spaces_word->{'spaces'} . $pending_spaces_word->{'word'};
! 20249: $line_char_counter += t2h_default_string_width($pending_spaces_word->{'spaces'})+t2h_default_string_width($pending_spaces_word->{'word'});
! 20250: $pending_spaces_word->{'spaces'} = $new_spaces;
! 20251: $pending_spaces_word->{'word'} = undef;
! 20252: }
! 20253: elsif (!$eol_spaces)
! 20254: {
! 20255: $pending_spaces_word->{'spaces'} .= $new_spaces;
! 20256: }
! 20257: if ($eol_spaces)
! 20258: {
! 20259: $result .= $eol_spaces;
! 20260: $line_passed += scalar(@lines);
! 20261: $indent_length = $indent_length_next;
! 20262: $line_char_counter = 0;
! 20263: $pending_spaces_word->{'spaces'} = '';
! 20264: }
! 20265: if ((t2h_default_string_width($pending_spaces_word->{'spaces'}) + $line_char_counter > $max_column))
! 20266: {
! 20267: $pending_spaces_word->{'spaces'} = '';
! 20268: $result .= "\n";
! 20269: $line_passed++;
! 20270: $indent_length = $indent_length_next;
! 20271: $line_char_counter = 0;
! 20272: }
! 20273: }
! 20274: else
! 20275: {
! 20276: my $word;
! 20277: if ($keep_end_of_lines)
! 20278: {
! 20279: $word = $text;
! 20280: $text = '';
! 20281: }
! 20282: elsif ($text =~ s/^([^\s]+)//)
! 20283: {
! 20284: $word = $1;
! 20285: }
! 20286: #else
! 20287: #{
! 20288: # die "BUG: Impossible situation.\n";
! 20289: #}
! 20290: $pending_spaces_word->{'word'} = '' if (!defined($pending_spaces_word->{'word'}));
! 20291: $pending_spaces_word->{'word'} .= $word;
! 20292: # The $line_char_counter != 0 is here to cope with the case of a
! 20293: # word longer than $line_char_counter followed by more text:
! 20294: # a line would be passed each time some piece text is appended.
! 20295: if ((t2h_default_string_width($pending_spaces_word->{'spaces'})+t2h_default_string_width($pending_spaces_word->{'word'}) + $line_char_counter > $max_column) and $line_char_counter != 0)
! 20296: {
! 20297: $pending_spaces_word->{'spaces'} = '';
! 20298: $result .= "\n";
! 20299: $line_passed++;
! 20300: $indent_length = $indent_length_next;
! 20301: $line_char_counter = 0;
! 20302: }
! 20303: }
! 20304: }
! 20305: return ($line_char_counter, $pending_spaces_word, $line_passed, $result)
! 20306: }
! 20307:
! 20308: sub info_default_skip_spaces($$$)
! 20309: {
! 20310: my $current = shift;
! 20311: my $index = shift;
! 20312: my $close = shift;
! 20313:
! 20314: #print STDERR "SKIP_SPACES\n";
! 20315: while(1)
! 20316: {
! 20317: my ($current_next, $index_next, $close_next) = info_default_iterator_next($current, $index, $close);
! 20318: return if ($close_next or (!defined($current_next)));
! 20319: my $content = $current_next->{'content'}->[$index_next];
! 20320: if (defined($content->{'begin'}))
! 20321: {
! 20322: $content->{'begin'} =~ s/^\s*//;
! 20323: #print STDERR "SKIP_SPACES begin\n";
! 20324: return if ($content->{'begin'} ne '');
! 20325: }
! 20326: if (defined($content->{'content'}) or defined($content->{'format_name'})
! 20327: or $content->{'definition_line'})
! 20328: { # non empty commands stop space skipping, even if they contain
! 20329: # only spaces, like @asis{ }
! 20330: # also for item(x) that have format_name defined
! 20331: #print STDERR "SKIP_SPACES command?\n";
! 20332: return;
! 20333: }
! 20334: if (defined($content->{'text'}))
! 20335: {
! 20336: my $command = '';
! 20337: $command = $content->{'command'} if (defined($content->{'command'}));
! 20338: #print STDERR "SKIP_SPACES($command) text\n";
! 20339: $content->{'text'} =~ s/^\s*//;
! 20340: return if ($content->{'text'} ne '');
! 20341: }
! 20342: if (defined($content->{'end'}))
! 20343: {
! 20344: #print STDERR "SKIP_SPACES end\n";
! 20345: $content->{'end'} =~ s/^\s*//;
! 20346: return if ($content->{'end'} ne '');
! 20347: }
! 20348: ($current, $index, $close) = ($current_next, $index_next, $close_next);
! 20349: }
! 20350: }
! 20351:
! 20352: sub info_default_store_pending($$;$)
! 20353: {
! 20354: my $line_char_counter = shift;
! 20355: my $pending_spaces_word = shift;
! 20356: my $indent_length = shift;
! 20357:
! 20358: $indent_length = 0 if (!defined($indent_length));
! 20359: my $indent_text = '';
! 20360: $indent_text = ' ' x $indent_length;
! 20361:
! 20362: #print STDERR "store_pending(spaces `$pending_spaces_word->{'spaces'}', indent($indent_length) `$indent_text' word `".var_to_str($pending_spaces_word->{'word'})."'\n";
! 20363: my $result = $pending_spaces_word->{'spaces'};
! 20364: $pending_spaces_word->{'spaces'} = '';
! 20365: if (defined($pending_spaces_word->{'word'}))
! 20366: {
! 20367: $result .= $pending_spaces_word->{'word'};
! 20368: $pending_spaces_word->{'word'} = undef;
! 20369: }
! 20370:
! 20371: my $chomped_result = $result;
! 20372: chomp ($chomped_result);
! 20373: if ($line_char_counter == 0 and $chomped_result ne '')
! 20374: {
! 20375: $result = $indent_text . $result;
! 20376: }
! 20377:
! 20378: $line_char_counter += t2h_default_string_width($result);
! 20379: return ($line_char_counter, $pending_spaces_word, $result);
! 20380: }
! 20381:
! 20382: sub info_default_output($)
! 20383: {
! 20384: my $info_state = shift;
! 20385: my $result = '';
! 20386: #print STDERR "Storing the stack\n";
! 20387: print STDERR "" . Data::Dumper->Dump([$info_state->{'top'}]) if ($DEBUG);
! 20388: my ($bytes_count, $lines_count);
! 20389: ($bytes_count, $result, $lines_count) = info_default_process_content($info_state->{'top'}, $info_state);
! 20390: $info_state->{'offset_in_file'} += $bytes_count;
! 20391: $info_state->{'line_count'} += $lines_count;
! 20392: #print STDERR "HHHHHH($lines_count) $info_state->{'line_count'}: $result\n";
! 20393: info_default_reset_state($info_state)
! 20394: if (!defined($info_state->{'current'}->{'command'}));
! 20395: return $result;
! 20396: }
! 20397:
! 20398: sub info_default_process_content($$)
! 20399: {
! 20400: my $current_command = shift;
! 20401: my $info_state = shift;
! 20402:
! 20403: my $length = 0;
! 20404: my $result = '';
! 20405:
! 20406: my $line_char_counter = 0;
! 20407: my $all_line_passed = 0;
! 20408:
! 20409: my $pending_spaces_word;
! 20410: $pending_spaces_word->{'spaces'} = '';
! 20411: my $preformatted = 0;
! 20412: my $indent_level = 0;
! 20413: my $item_pending;
! 20414: my $in_exdent = 0;
! 20415: my $in_para = 0;
! 20416: my $in_w = 0;
! 20417: my $table_item_line = 0;
! 20418: my $in_table_item = 0;
! 20419: my $max_column = get_conf('fillcolumn');
! 20420: my $direntry = 0;
! 20421: my $preformatted_format = 0;
! 20422: my $indent_length = 0;
! 20423:
! 20424: # for formats that needs to process a full line (center and flushright)
! 20425: # to know the line length before outputing
! 20426: my $current_line = undef;
! 20427:
! 20428: my ($current, $index, $close) = ($current_command, 0, 0);
! 20429:
! 20430: #print STDERR "info_default_process_content: $current_command\n";
! 20431: while(1)
! 20432: {
! 20433: last if (!defined($current));
! 20434: my $content = $current->{'content'}->[$index];
! 20435: my $text_added = '';
! 20436: my $line_added_before_item = 0;
! 20437: my $indentation_done = 0;
! 20438: my $prepend_newline;
! 20439:
! 20440: if ($DEBUG)
! 20441: {
! 20442: my $text_item_pending = '';
! 20443: $text_item_pending = $item_pending if (defined($item_pending));
! 20444: my $text_length = '';
! 20445: $text_length = "$content->{'text'}" if defined($content->{'text'});
! 20446: my $text_command = '';
! 20447: $text_command = $content->{'command'} if defined($content->{'command'});
! 20448: my $in_node_count = 0;
! 20449: $in_node_count = $info_state->{'line_count'} if defined($info_state->{'line_count'});
! 20450: print STDERR "($text_command|$text_length|$close|${all_line_passed}+$in_node_count|l_c_cnt $line_char_counter) prfrmted $preformatted para $in_para indent_lvl $indent_level($indent_length) in_exdent $in_exdent in_w $in_w only_spaces $info_state->{'only_spaces'} blank_line $info_state->{'blank_line'} table_item_line $table_item_line in_table_item $in_table_item item_pending $text_item_pending spaces: `$pending_spaces_word->{'spaces'}' word: ".main::var_to_str($pending_spaces_word->{'word'})."\n";
! 20451: }
! 20452:
! 20453: if ($close)
! 20454: {
! 20455: if (defined($content->{'end'}))
! 20456: {
! 20457: $text_added .= $content->{'end'};
! 20458: }
! 20459: if ($complex_format_map{$content->{'command'}} and $content->{'content'})
! 20460: {
! 20461: $preformatted_format--;
! 20462: }
! 20463: # the format is always empty in the main program so the warning
! 20464: # has to be done here
! 20465: if (defined($content->{'total_item_nr'}) and !$content->{'total_item_nr'} and $content->{'content'})
! 20466: {
! 20467: main::line_warn (sprintf(__("\@%s has text but no \@item"), $content->{'command'}), $content->{'line_nr'});
! 20468: }
! 20469: # check whether there is a blank line following, to avoid adding
! 20470: # one when closing a format.
! 20471: # This is not a required check if not in preformatted since doubled
! 20472: # blank lines are discarded.
! 20473: my $followed_by_blank_line = 0;
! 20474: if ($preformatted_format)
! 20475: {
! 20476: my ($current_next, $index_next, $close_next, $text_next, $command_next) = info_default_next ($current, $index, $close);
! 20477: if (defined($command_next) and $command_next eq 'preformatted')
! 20478: {
! 20479: ($current_next, $index_next, $close_next, $text_next, $command_next) = info_default_next ($current_next, $index_next, $close_next);
! 20480: $followed_by_blank_line = 1 if (defined($text_next) and $text_next =~ /^\s*$/);
! 20481: }
! 20482: }
! 20483: if ($info_default_indented_commands{$content->{'command'}})
! 20484: {
! 20485: $indent_level--;
! 20486: $indent_length = $indent_level * $info_default_indent_length;
! 20487: # $preformatteed cannot be used here since preformatted
! 20488: # is closed before the end of a format
! 20489: #if ($indent_level > 0 and !$info_state->{'blank_line'} and $content->{'command'} !~ /^deff_item/ and !$preformatted_format)
! 20490: if ($indent_level > 0 and !$info_state->{'blank_line'} and $content->{'command'} !~ /^deff_item/ and !$followed_by_blank_line)
! 20491: {
! 20492: $text_added .= "\n";
! 20493: }
! 20494: # this nullify a potential noindent in a random format
! 20495: $info_state->{'indent_para'} = undef;
! 20496: }
! 20497: elsif (($complex_format_map{$content->{'command'}} and $content->{'command'} ne 'menu') or $content->{'command'} eq 'cartouche')
! 20498: {
! 20499: if (!$info_state->{'blank_line'} and $info_state->{'only_spaces'} and ($indent_level > 0) and !$followed_by_blank_line)
! 20500: {
! 20501: $text_added .= "\n";
! 20502: }
! 20503: }
! 20504: if ($content->{'command'} eq 'paragraph' and $info_state->{'align_stack'}->[-1]->{'command'} eq 'normal')
! 20505: {
! 20506: # if there is no space at the end of a paragraph, there may be
! 20507: # pending text, for example, if there is an ending line like
! 20508: # Some text@c a comment
! 20509: my $pending;
! 20510: ($line_char_counter, $pending_spaces_word, $pending) = info_default_store_pending($line_char_counter, $pending_spaces_word, $indent_length);
! 20511: $text_added .= $pending if (defined($pending));
! 20512: $text_added =~ s/\s*$//;
! 20513: $pending_spaces_word->{'spaces'} = '';
! 20514: $in_para = 0;
! 20515: $info_state->{'indent_para'} = undef;
! 20516: $text_added .= "\n" unless (($line_char_counter + t2h_default_string_width($text_added)) == 0);
! 20517: }
! 20518: elsif ($content->{'command'} eq 'preformatted')
! 20519: {
! 20520: # if preformatted doesn't end with a newline, it is added here
! 20521: $text_added .= "\n" unless ($line_char_counter == 0);
! 20522: $preformatted--;
! 20523: }
! 20524: elsif ($content->{'command'} eq 'menu')
! 20525: {
! 20526: $text_added .= "\n" unless ($info_state->{'blank_line'});
! 20527: }
! 20528: elsif ($content->{'command'} eq 'float')
! 20529: {
! 20530: #$text_added = "\n" . $text_added unless ($info_state->{'blank_line'});
! 20531: $prepend_newline = 1 unless ($info_state->{'blank_line'});
! 20532: }
! 20533: elsif ($content->{'command'} eq 'w')
! 20534: {
! 20535: $in_w--;
! 20536: }
! 20537: elsif ($paragraph_style{$content->{'command'}})
! 20538: {
! 20539: my $popped = pop @{$info_state->{'align_stack'}};
! 20540: print STDERR "BUG".main::format_line_number().": align_stack, popped $popped->{'command'} ne command $content->{'command'}\n" if ($popped->{'command'} ne $content->{'command'});
! 20541: }
! 20542: elsif ($content->{'command'} eq 'multitable')
! 20543: {
! 20544: my $multitable = pop @{$info_state->{'multitable_stack'}};
! 20545: if (!defined($multitable->{'cells'}) and ($result ne ''))
! 20546: {
! 20547: $multitable->{'result'} .= $result;
! 20548: $multitable->{'length'} += $length;
! 20549: $multitable->{'line_count'} += $all_line_passed;
! 20550: }
! 20551: $max_column = $multitable->{'max_column_kept'};
! 20552: $result = $multitable->{'result_kept'};
! 20553: $line_char_counter = $multitable->{'line_char_counter_kept'};
! 20554: $all_line_passed = $multitable->{'all_line_passed_kept'};
! 20555: $indent_level = $multitable->{'indent_level_kept'};
! 20556: $indent_length = $multitable->{'indent_length_kept'};
! 20557: #$indent_length_next_line = undef;
! 20558: $length = $multitable->{'length_kept'};
! 20559: $info_state->{'offset_in_file'} = $multitable->{'offset_in_file_kept'};
! 20560: $info_state->{'line_count'} = $multitable->{'line_count_kept'};
! 20561: #print STDERR "MULTITABLE close, lines: $multitable->{'line_count_kept'} + $all_line_passed\n";
! 20562: foreach my $anchor_and_index (@{$multitable->{'anchors'}}, @{$multitable->{'index_entries'}})
! 20563: {
! 20564: $anchor_and_index->{'line_nr'} += $multitable->{'line_count_kept'} + $all_line_passed;
! 20565: }
! 20566: if (! scalar(@{$info_state->{'multitable_stack'}}))
! 20567: {
! 20568: #print STDERR "MULTITABLE close, lengths: $multitable->{'offset_in_file_kept'} + $length\n";
! 20569: foreach my $anchor (@{$multitable->{'anchors'}})
! 20570: {
! 20571: $anchor->{'info_offset'} += $multitable->{'offset_in_file_kept'} + $length;
! 20572: }
! 20573: }
! 20574: else
! 20575: {
! 20576: push @{$info_state->{'multitable_stack'}->[-1]->{'anchors'}}, @{$multitable->{'anchors'}};
! 20577: push @{$info_state->{'multitable_stack'}->[-1]->{'index_entries'}}, @{$multitable->{'index_entries'}};
! 20578: }
! 20579: $text_added .= $multitable->{'result'};
! 20580: $indentation_done = 1;
! 20581:
! 20582: goto new_text;
! 20583: }
! 20584: elsif ($content->{'command'} eq 'multitable_cell')
! 20585: {
! 20586: my $cell = $info_state->{'multitable_stack'}->[-1]->{'cells'}->[-1];
! 20587: $cell->{'result'} = $result;
! 20588: $cell->{'length'} = $length;
! 20589: $cell->{'line_passed'} = $all_line_passed;
! 20590: }
! 20591: elsif ($content->{'command'} eq 'direntry')
! 20592: {
! 20593: $direntry--;
! 20594: # this has to be done here, otherwise, at the end, $direntry
! 20595: # would be 0
! 20596: $info_default_dir_specification .= $text_added;
! 20597: $text_added = '';
! 20598: }
! 20599: elsif ($content->{'command'} eq 'multitable_row')
! 20600: {
! 20601: my $multitable = $info_state->{'multitable_stack'}->[-1];
! 20602: my $indent_len = $multitable->{'indent_length_kept'};
! 20603: #print STDERR "INDENT: $indent_len\n";
! 20604: my $row_length = 0;
! 20605: my $row = '';
! 20606: my $max_lines = 0;
! 20607: my $cell_beginning = 0;
! 20608: my @anchor_lines_array;
! 20609: my $cell_idx = 0;
! 20610: my @anchors;
! 20611: my @indices;
! 20612: foreach my $cell (@{$multitable->{'cells'}})
! 20613: {
! 20614: $cell->{'beginning'} = $cell_beginning;
! 20615: $cell_beginning += $cell->{'cell_width'}+1;
! 20616: @{$cell->{'lines'}} = split /^/, $cell->{'result'};
! 20617: $max_lines = scalar(@{$cell->{'lines'}}) if (scalar(@{$cell->{'lines'}}) > $max_lines);
! 20618: foreach my $anchor (@{$cell->{'anchors'}})
! 20619: {
! 20620: push @{$anchor_lines_array[$anchor->{'line_nr'}]}, $anchor;
! 20621: $anchor->{'cell_idx'} = $cell_idx;
! 20622: push @anchors, $anchor;
! 20623: }
! 20624: push @indices, @{$cell->{'index_entries'}};
! 20625: $cell_idx++;
! 20626: }
! 20627: my $previous_last_cell = scalar(@{$multitable->{'cells'}});
! 20628: #print STDERR "ROW cell_beginning $cell_beginning, max_lines $max_lines, previous_last_cell $previous_last_cell\n";
! 20629: for (my $line_idx = 0; $line_idx < $max_lines; $line_idx++)
! 20630: {
! 20631: my $line_width = $indent_len;
! 20632: my $line_bytes = info_default_byte_count(' ' x$indent_len);
! 20633: my $line = '';
! 20634: # determine the last cell in the line, to fill spaces in
! 20635: # cells preceding that cell on the line
! 20636: my $last_cell = 0;
! 20637: for (my $cell_idx = 0; $cell_idx < $previous_last_cell; $cell_idx++)
! 20638: {
! 20639: $last_cell = $cell_idx+1 if (defined($multitable->{'cells'}->[$cell_idx]->{'lines'}->[$line_idx]));
! 20640: }
! 20641: #print STDERR " L(last_cell $last_cell): $line_idx\n";
! 20642: for (my $cell_idx = 0; $cell_idx < $last_cell; $cell_idx++)
! 20643: {
! 20644: my $cell_text = $multitable->{'cells'}->[$cell_idx]->{'lines'}->[$line_idx];
! 20645: #print STDERR " C($cell_idx) ";
! 20646: if (defined($cell_text))
! 20647: {
! 20648: chomp($cell_text);
! 20649: #print STDERR "$cell_text";
! 20650: if ($line eq '' and $cell_text ne '')
! 20651: {
! 20652: $line = ' ' x $indent_len;
! 20653: }
! 20654: $line .= $cell_text;
! 20655: $line_width += t2h_default_string_width($cell_text);
! 20656: $line_bytes += info_default_byte_count($cell_text);
! 20657: }
! 20658: if ($cell_idx+1 < $last_cell)
! 20659: {
! 20660: if ($line_width < $indent_len + $multitable->{'cells'}->[$cell_idx+1]->{'beginning'})
! 20661: {
! 20662: if ($line eq '')
! 20663: {
! 20664: $line = ' ' x $indent_len;
! 20665: }
! 20666: my $spaces = ' ' x ($indent_len + $multitable->{'cells'}->[$cell_idx+1]->{'beginning'} - $line_width);
! 20667: $line_width += t2h_default_string_width($spaces);
! 20668: $line_bytes += info_default_byte_count($spaces);
! 20669: $line .= $spaces;
! 20670: #print STDERR " Csp($line_width) `$spaces'";
! 20671: }
! 20672: }
! 20673: }
! 20674: if (defined($anchor_lines_array[$line_idx]))
! 20675: {
! 20676: foreach my $anchor (@{$anchor_lines_array[$line_idx]})
! 20677: {
! 20678: my $anchor_position = $indent_len + $anchor->{'line_char_counter'} + $multitable->{'cells'}->[$anchor->{'cell_idx'}]->{'beginning'};
! 20679: if ($anchor_position > $line_width)
! 20680: {
! 20681: my $spaces = ' ' x ($anchor_position - $line_width);
! 20682: $line .= $spaces;
! 20683: $line_width += t2h_default_string_width($spaces);
! 20684: $line_bytes += info_default_byte_count($spaces);
! 20685: }
! 20686: $anchor->{'info_offset'} = $line_bytes + $row_length + $multitable->{'length'};
! 20687: #print STDERR "ROW anchor close: anchor[$anchor->{'cell_idx'}]($multitable->{'cells'}->[$anchor->{'cell_idx'}]->{'beginning'}+$anchor->{'line_char_counter'}) $anchor_position $anchor->{'info_offset'}\n";
! 20688: $anchor->{'line_char_counter'} = $anchor_position;
! 20689: }
! 20690: }
! 20691: $line .= "\n";
! 20692: $row_length += info_default_byte_count($line);
! 20693: #print STDERR " ($line_width,".length($line).") $line";
! 20694: $row .= $line;
! 20695: $previous_last_cell = $last_cell;
! 20696: }
! 20697: foreach my $anchor_and_index (@anchors, @indices)
! 20698: {
! 20699: $anchor_and_index->{'line_nr'} += $multitable->{'line_count'};
! 20700: #print STDERR "ROW close: new line count: $anchor_and_index->{'line_nr'} + \n";
! 20701: }
! 20702: if ($content->{'item_command'} eq 'headitem')
! 20703: {
! 20704: # at this point cell_beginning is at the beginning of
! 20705: # the cell following the end of the table -> full width
! 20706: my $line = ' ' x $indent_len . '-' x $cell_beginning . "\n";
! 20707: $row .= $line;
! 20708: $row_length += info_default_byte_count($line);
! 20709: }
! 20710: #print STDERR "ROW_LENGTH $row_length\n";
! 20711: $multitable->{'result'} .= $row;
! 20712: $multitable->{'length'} += $row_length;
! 20713: $multitable->{'line_count'} += $max_lines;
! 20714: $multitable->{'cells'} = [];
! 20715: push @{$multitable->{'anchors'}}, @anchors;
! 20716: push @{$multitable->{'index_entries'}}, @indices;
! 20717: }
! 20718: }
! 20719: else
! 20720: {
! 20721: if ($content->{'command'})
! 20722: {
! 20723: # if processing a paragraph, there may be some pending text
! 20724: # and spaces, as the idea is to write them down only when
! 20725: # there is a space in case of pending text, or when there is some
! 20726: # text in case of pending space. So all the commands
! 20727: # that should write something within paragraph must flush the
! 20728: # pending text/spaces _before_ they output something, or the
! 20729: # text order will be reversed, with the pending things output
! 20730: # after the other commands text.
! 20731: my $pending_added_length = 0;
! 20732: my $pending_added_bytes = 0;
! 20733:
! 20734: if ($content->{'command'} eq 'anchor' or $content->{'command'} eq 'image' or $content->{'command'} eq 'index_command' or $content->{'command'} eq 'sp' or $content->{'raw_command'})
! 20735: {
! 20736: my $pending;
! 20737: ($line_char_counter, $pending_spaces_word, $pending) = info_default_store_pending($line_char_counter, $pending_spaces_word, $indent_length);
! 20738: # here spaces out of any environment are ignored.
! 20739: if ($in_para or $preformatted or $pending =~ /\S/)
! 20740: { # this has to be done before the anchor related code
! 20741: # to have the right count.
! 20742: # FIXME this is wrong if an end of line was passed.
! 20743: # in that case line_char_counter has been increased and
! 20744: # $pending ends with an end of line
! 20745: $pending_added_length += t2h_default_string_width($pending);
! 20746: $pending_added_bytes += info_default_byte_count($pending);
! 20747: $text_added .= $pending;
! 20748: }
! 20749: }
! 20750: if ($content->{'command'} eq 'strong')
! 20751: {
! 20752: my ($current_next, $index_next, $close_next, $text_next, $command_next) = info_default_next ($current, $index, $close);
! 20753: if (defined($text_next) and $text_next =~ /^Note\b/i)
! 20754: {
! 20755: main::line_warn(__("\@strong{Note...} produces a spurious cross-reference in Info; reword to avoid that"), $content->{'line_nr'});
! 20756: }
! 20757: }
! 20758: elsif ($content->{'command'} eq 'w')
! 20759: {
! 20760: $in_w++ if ($content->{'content'});
! 20761: }
! 20762: elsif ($content->{'command'} eq 'anchor' or ($content->{'command'} eq 'float' and $content->{'anchor_reference'}))
! 20763: {
! 20764: #print STDERR "anchor: offset_in_file $info_state->{'offset_in_file'}, line_count $info_state->{'line_count'}, line_char_counter $line_char_counter pending_added_length $pending_added_length\n";
! 20765: $content->{'anchor_reference'}->{'info_offset'} = $length + $info_state->{'offset_in_file'} + $pending_added_bytes;
! 20766: $content->{'anchor_reference'}->{'line_nr'} = $all_line_passed + $info_state->{'line_count'};
! 20767: $content->{'anchor_reference'}->{'line_char_counter'} = $line_char_counter + $pending_added_length;
! 20768: if (@{$info_state->{'multitable_stack'}})
! 20769: {
! 20770: if ($info_state->{'multitable_stack'}->[-1]->{'cells'})
! 20771: {
! 20772: push @{$info_state->{'multitable_stack'}->[-1]->{'cells'}->[-1]->{'anchors'}}, $content->{'anchor_reference'};
! 20773: }
! 20774: else
! 20775: {
! 20776: push @{$info_state->{'multitable_stack'}->[-1]->{'anchors'}}, $content->{'anchor_reference'};
! 20777: }
! 20778: }
! 20779: push @{$info_state->{'pending_tags'}}, $content->{'anchor_reference'};
! 20780: push @{$info_state->{'align_stack'}->[-1]->{'anchors'}}, $content->{'anchor_reference'} if ($info_state->{'align_stack'}->[-1]->{'command'} eq 'center' or $info_state->{'align_stack'}->[-1]->{'command'} eq 'flushright');
! 20781: }
! 20782: elsif ($content->{'command'} eq 'index_label')
! 20783: {
! 20784: #print STDERR "FFFFFFFFF($content->{'index_command'}) $all_line_passed + $info_state->{'line_count'} `$content->{'texi_entry'}'\n";
! 20785: my $index_line_nr = $all_line_passed + $info_state->{'line_count'};
! 20786: if ($info_state->{'blank_line'} and $content->{'index_command'} =~ /index$/)
! 20787: {
! 20788: my ($current_next, $index_next, $close_nex) = info_default_iterator_next($current, $index, $close);
! 20789: $index_line_nr-- if (!defined($current_next));
! 20790: }
! 20791: elsif ($content->{'index_command'} =~ /^[vf]table$/)
! 20792: {
! 20793: # if in a table, index label is systematically entered after
! 20794: # the line is processed, as the line is processed with the
! 20795: # item command, while the index entry is entered with the
! 20796: # index_label callback that is done much later.
! 20797: $index_line_nr--;
! 20798: }
! 20799: #print STDERR "index in a blank_line $content->{'index_command'} `$content->{'texi_entry'}'\n" if ($info_state->{'blank_line'});
! 20800: my $index_name = $content->{'index_entry_reference'}->{'index_name'};
! 20801: $info_default_index_line_string_length{$index_name} = t2h_default_string_width($index_line_nr)
! 20802: if (!defined($info_default_index_line_string_length{$index_name}) or $info_default_index_line_string_length{$index_name} < t2h_default_string_width($index_line_nr));
! 20803: #print STDERR "RRRRRRRRRRRRR($content->{'index_entry_reference'}) $content->{'index_entry_reference'}->{'texi'} name: $index_name line: $index_line_nr max: $info_default_index_line_string_length{$index_name}\n";
! 20804: my $index_ref = { 'index_entry_reference' => $content->{'index_entry_reference'}, 'line_nr' => $index_line_nr };
! 20805: #print STDERR "INDEX($index_name) line $index_line_nr\n";
! 20806: $info_default_index_entries{$content->{'index_entry_reference'}} = $index_ref;
! 20807: # there may be no cell in case of an empty multitable
! 20808: if (@{$info_state->{'multitable_stack'}})
! 20809: {
! 20810: if ($info_state->{'multitable_stack'}->[-1]->{'cells'})
! 20811: {
! 20812: push @{$info_state->{'multitable_stack'}->[-1]->{'cells'}->[-1]->{'index_entries'}}, $index_ref;
! 20813: }
! 20814: else
! 20815: {
! 20816: push @{$info_state->{'multitable_stack'}->[-1]->{'index_entries'}}, $index_ref;
! 20817: }
! 20818: }
! 20819: push @{$info_state->{'pending_index_entries'}}, $index_ref;
! 20820: }
! 20821: elsif ($content->{'command'} eq '*' and !$preformatted)
! 20822: {
! 20823: if (defined($pending_spaces_word->{'word'}))
! 20824: {
! 20825: $text_added .= $pending_spaces_word->{'spaces'} . $pending_spaces_word->{'word'};
! 20826: $pending_spaces_word->{'word'} = undef;
! 20827: }
! 20828: # spaces preceding @* are skipped
! 20829: $pending_spaces_word->{'spaces'} = '';
! 20830: $text_added .= $content->{'text'};
! 20831: # just like following spaces
! 20832: info_default_skip_spaces($current, $index, $close);
! 20833: # this isn't done otherwise, though, here it is not important
! 20834: # since this end the line
! 20835: $line_char_counter += t2h_default_string_width($content->{'text'});
! 20836: goto new_text;
! 20837: }
! 20838: elsif ($content->{'command'} eq 'paragraph' and $info_state->{'align_stack'}->[-1]->{'command'} eq 'normal')
! 20839: {
! 20840: # empty paragraph
! 20841: goto new_text if (!$content->{'content'});
! 20842: my $paragraphindent = get_conf('paragraphindent');
! 20843: $paragraphindent = 0 if ($paragraphindent eq 'none');
! 20844: if ($paragraphindent ne 'asis')
! 20845: {
! 20846: info_default_skip_spaces($current, $index, $close);
! 20847: }
! 20848: # if within a format $content->{'paragraph_in_element_nr'}
! 20849: # should not be defined so no indentation will take place
! 20850: if ($paragraphindent ne 'asis' and $paragraphindent and $line_char_counter == 0 and (defined($content->{'paragraph_in_element_nr'})) and ($info_state->{'indent_para'} or (!defined($info_state->{'indent_para'}) and ($content->{'paragraph_in_element_nr'} or (get_conf('firstparagraphindent') eq 'insert')))))
! 20851: {
! 20852: $text_added .= ' ' x $paragraphindent;
! 20853: }
! 20854: $in_para = 1;
! 20855: }
! 20856: elsif ($content->{'command'} eq 'preformatted')
! 20857: {
! 20858: $preformatted++ if ($content->{'content'});
! 20859: }
! 20860: elsif ($content->{'command'} eq 'exdent')
! 20861: {
! 20862: # if an end of line is added, in_exdent is set to 2 and
! 20863: # set to one when processing the end of line that was just
! 20864: # added, and set to 0 at the end of the line.
! 20865: # if there is no end of line added, it is only set to 1.
! 20866: if ($line_char_counter != 0)
! 20867: {
! 20868: $text_added .= "\n";
! 20869: $in_exdent = 2;
! 20870: }
! 20871: else
! 20872: {
! 20873: $in_exdent = 1;
! 20874: }
! 20875: $indent_length = ($indent_level -1) * $info_default_indent_length if ($indent_level > 0);
! 20876: #goto new_text;
! 20877: }
! 20878: elsif ($content->{'command'} eq 'indent')
! 20879: {
! 20880: $info_state->{'indent_para'} = 1;
! 20881: }
! 20882: elsif ($content->{'command'} eq 'noindent')
! 20883: {
! 20884: $info_state->{'indent_para'} = 0;
! 20885: }
! 20886: elsif ($content->{'command'} eq 'sp')
! 20887: {
! 20888: $text_added .= $content->{'text'};
! 20889: goto new_text;
! 20890: }
! 20891: elsif ($content->{'command'} eq 'image')
! 20892: {
! 20893: # @image result count isn't counted in line_char_counter
! 20894: # since it is not displayed in info
! 20895: my $indent_added = 0;
! 20896: $indent_added = ($indent_length - $line_char_counter) if ($indent_length - $line_char_counter > 0);
! 20897: $text_added .= ' ' x $indent_added . $content->{'text'};
! 20898: $line_char_counter += $indent_added;
! 20899: goto new_text;
! 20900: }
! 20901: elsif ($content->{'command'} eq 'ref')
! 20902: { # adds a . if needed.
! 20903: if ($content->{'text'} !~ /[\.,]$/ and $content->{'text'} !~ /::$/)
! 20904: {
! 20905: my ($current_next, $index_next, $close_next, $text_next, $command_next) = info_default_next ($current, $index, $close);
! 20906: if (!defined($text_next) or $text_next !~ /^[\.,]/)
! 20907: {
! 20908: $content->{'text'} .= '.';
! 20909: }
! 20910: }
! 20911: }
! 20912: elsif ($content->{'command'} eq 'xref')
! 20913: { # warn if there is no punctuation following
! 20914: my ($current_next, $index_next, $close_next, $text_next, $command_next) = info_default_next ($current, $index, $close);
! 20915: if (!defined($text_next) or $text_next !~ /^./)
! 20916: { # in makeinfo it is
! 20917: # "End of file reached while looking for `.' or `,'"
! 20918: # but maybe it may not be true.
! 20919: main::line_warn(__("`.' or `,' must follow \@xref."), $Texi2HTML::THISDOC{'line_nr'});
! 20920: }
! 20921: elsif ($text_next !~ /^[\.,]/)
! 20922: {
! 20923: my $char = substr($text_next, 0, 1);
! 20924: main::line_warn(sprintf(__("`.' or `,' must follow \@xref, not %s"), $char), $Texi2HTML::THISDOC{'line_nr'});
! 20925: }
! 20926: }
! 20927: elsif ($content->{'definition_line'})
! 20928: {
! 20929:
! 20930: my $dummy_line_passed;
! 20931: print STDERR "BUG: defined pending_word before DEFINITION_LINE\n" if defined($pending_spaces_word->{'word'});
! 20932: #print STDERR "DEFINITION_LINE($line_char_counter,$pending_spaces_word->{'spaces'},$indent_length,$in_para,$max_column): $content->{'text'}";
! 20933: ($line_char_counter, $pending_spaces_word, $dummy_line_passed, $text_added) = info_default_process_para_text($content->{'text'}, $line_char_counter, $pending_spaces_word, $indent_length, $max_column, 0, $indent_length+2*$info_default_indent_length);
! 20934: $text_added .= $pending_spaces_word->{'spaces'};
! 20935: $pending_spaces_word->{'spaces'} = '';
! 20936: #print STDERR "DEFINITION_LINE($line_char_counter,$pending_spaces_word->{'spaces'}) -> $text_added";
! 20937: print STDERR "BUG: defined pending_word after DEFINITION_LINE\n" if defined($pending_spaces_word->{'word'});
! 20938: $indentation_done = 1;
! 20939:
! 20940: goto new_text;
! 20941: }
! 20942: elsif (($content->{'command'} eq 'item' or $content->{'command'} eq 'itemx') and exists $info_default_indent_format_length{$content->{'format_name'}})
! 20943: {
! 20944: $item_pending = $content->{'format_name'};
! 20945: #if (!$info_state->{'blank_line'} and $content->{'command'} eq 'item')
! 20946: my $first_item = 0;
! 20947:
! 20948: if ($content->{'command'} eq 'item')
! 20949: {
! 20950: if (!defined($content->{'parent'}->{'item_nr'}))
! 20951: {
! 20952: $content->{'parent'}->{'item_nr'} = 1;
! 20953: $first_item = 1;
! 20954: }
! 20955: else
! 20956: {
! 20957: $content->{'parent'}->{'item_nr'}++;
! 20958: }
! 20959: }
! 20960:
! 20961: if ($item_pending =~ /table$/)
! 20962: {
! 20963: $table_item_line = 1;
! 20964: $indent_length = ($indent_level -1) * $info_default_indent_length if ($indent_level > 0);
! 20965: $in_table_item = 0;
! 20966: }
! 20967: else
! 20968: {
! 20969: $indent_length = ($info_default_indent_format_length{$item_pending}
! 20970: +($indent_level -1)* $info_default_indent_length);
! 20971: }
! 20972: if (!$info_state->{'blank_line'} and ($content->{'command'} ne 'itemx') and (!$first_item or $indent_level > 1))
! 20973: {
! 20974: my $dummy_line_passed;
! 20975: ($line_char_counter, $dummy_line_passed, $text_added) = info_default_process_line_text($text_added, $line_char_counter, $indent_length);
! 20976: $indentation_done = 1;
! 20977: $line_added_before_item = 1;
! 20978: $prepend_newline = 1;
! 20979: #$text_added = "\n" . $text_added;
! 20980: }
! 20981:
! 20982: if ($item_pending =~ /table$/)
! 20983: {
! 20984: # one less indentation level and no line break
! 20985: # adding line_added_before_item allows the table_item_line to
! 20986: # still be active after the additional blank line
! 20987: $table_item_line = 1+$line_added_before_item;
! 20988: }
! 20989: else
! 20990: {
! 20991: info_default_skip_spaces($current, $index, $close);
! 20992: }
! 20993: }
! 20994: elsif ($content->{'command'} eq 'menu' or $content->{'command'} eq 'listoffloats' or $content->{'heading_command'})
! 20995: {
! 20996: $text_added .= "\n" unless ($info_state->{'blank_line'});
! 20997: }
! 20998: elsif ($content->{'command'} eq 'direntry')
! 20999: {
! 21000: if ($content->{'content'})
! 21001: {
! 21002: $direntry++;
! 21003: }
! 21004: }
! 21005: elsif ($paragraph_style{$content->{'command'}})
! 21006: {
! 21007: goto new_text if (!$content->{'content'});
! 21008: push @{$info_state->{'align_stack'}}, {'command' => $content->{'command'}};
! 21009: }
! 21010: elsif ($content->{'command'} eq 'verbatim' or $content->{'command'} eq 'verbatiminclude')
! 21011: {
! 21012: # $preformatted cannot be used here since preformatted
! 21013: # is closed before a verbatim, $preformatted_format is used
! 21014: if (!$preformatted_format and $indent_level != 0)
! 21015: {
! 21016: if (!$info_state->{'blank_line'} and $info_state->{'only_spaces'})
! 21017: {
! 21018: $text_added .= "\n";
! 21019: }
! 21020: my $verb_text = $content->{'text'};
! 21021: my ($line_passed, $end_of_line, $last_line, $text_indented, $blank_line) = info_default_count_lines($verb_text);
! 21022: $content->{'text'} .= "\n" unless ($blank_line or ($last_line =~ /^\s*$/));
! 21023: }
! 21024: }
! 21025: # other raw commands
! 21026: elsif ($content->{'raw_command'})
! 21027: {
! 21028: # not considered as in a paragraph even if in a paragraph
! 21029: $text_added .= $content->{'text'};
! 21030: goto new_text;
! 21031: }
! 21032: elsif ($content->{'command'} eq 'multitable' and $content->{'content'})
! 21033: {
! 21034: my $indent_length_kept = $indent_level * $info_default_indent_length;
! 21035: my $multitable = {
! 21036: 'offset_in_file_kept' => $info_state->{'offset_in_file'},
! 21037: 'line_count_kept' => $info_state->{'line_count'},
! 21038: 'columns_size' => [ @{$content->{'columns_size'}} ],
! 21039: 'result' => '',
! 21040: 'length' => 0,
! 21041: 'line_count' => 0,
! 21042: 'result_kept' => $result,
! 21043: 'length_kept' => $length,
! 21044: 'all_line_passed_kept' => $all_line_passed,
! 21045: 'line_char_counter_kept' => $line_char_counter,
! 21046: 'max_column_kept' => $max_column,
! 21047: 'indent_level_kept' => $indent_level,
! 21048: 'indent_length_kept' => $indent_length_kept,
! 21049: };
! 21050: push @{$info_state->{'multitable_stack'}}, $multitable;
! 21051: $info_state->{'offset_in_file'} = 0;
! 21052: $info_state->{'line_count'} = 0;
! 21053: $result = '';
! 21054: $length = 0;
! 21055: $all_line_passed = 0;
! 21056: $line_char_counter = 0;
! 21057: $indent_level = 0;
! 21058: $indent_length = 0;
! 21059: }
! 21060: elsif ($content->{'command'} eq 'multitable_row')
! 21061: {
! 21062: my $multitable = $info_state->{'multitable_stack'}->[-1];
! 21063: if (!defined($multitable->{'cells'}) and ($result ne ''))
! 21064: {
! 21065: $multitable->{'result'} .= $result;
! 21066: $multitable->{'length'} += $length;
! 21067: $multitable->{'line_count'} += $all_line_passed;
! 21068: $multitable->{'cells'} = [];
! 21069: }
! 21070: $multitable->{'cell_index'} = -1;
! 21071: }
! 21072: elsif ($content->{'command'} eq 'multitable_cell')
! 21073: {
! 21074: my $multitable = $info_state->{'multitable_stack'}->[-1];
! 21075: $multitable->{'cell_index'}++;
! 21076: my $cell_width = $content->{'parent'}->{'parent'}->{'columns_size'}->[$multitable->{'cell_index'}];
! 21077: #$max_column = $cell_width-1;
! 21078: $max_column = $cell_width -2;
! 21079: my $cell = {'cell_width' => $cell_width, 'index_entries' => [], 'anchors' => []};
! 21080: push @{$multitable->{'cells'}}, $cell;
! 21081: $result = '';
! 21082: $length = 0;
! 21083: $all_line_passed = 0;
! 21084: $line_char_counter = 0;
! 21085: $indent_level = 0;
! 21086: $indent_length = 0;
! 21087: if (!$content->{'content'})
! 21088: {# empty cell
! 21089: $cell->{'result'} = $result;
! 21090: $cell->{'length'} = $length;
! 21091: $cell->{'line_passed'} = $all_line_passed;
! 21092: }
! 21093: #info_default_skip_spaces($current, $index, $close);
! 21094: }
! 21095: if ($info_default_indented_commands{$content->{'command'}})
! 21096: {
! 21097: if ($content->{'command'} =~ /^deff_item/)
! 21098: {
! 21099: info_default_skip_spaces($current, $index, $close);
! 21100: }
! 21101: #elsif (!$info_state->{'blank_line'} and $info_state->{'only_spaces'} and ($indent_level != 0) and !$preformatted)
! 21102: elsif (!$info_state->{'blank_line'} and $info_state->{'only_spaces'} and ($indent_level != 0))
! 21103: {
! 21104: $text_added .= "\n";
! 21105: }
! 21106: # there is no close if !$content->{'content'}
! 21107: $indent_level++ if ($content->{'content'});
! 21108: $indent_length = $indent_level * $info_default_indent_length;
! 21109: }
! 21110: elsif (($complex_format_map{$content->{'command'}} and $content->{'command'} ne 'menu') or $content->{'command'} eq 'cartouche')
! 21111: {
! 21112: #if (!$info_state->{'blank_line'} and $info_state->{'only_spaces'} and ($indent_level != 0) and !$preformatted_format)
! 21113: if (!$info_state->{'blank_line'} and $info_state->{'only_spaces'} and ($indent_level != 0))
! 21114: {
! 21115: $text_added .= "\n";
! 21116: }
! 21117: }
! 21118: if ($complex_format_map{$content->{'command'}} and $content->{'content'})
! 21119: {
! 21120: $preformatted_format++;
! 21121: }
! 21122: }
! 21123:
! 21124: if (defined($content->{'text'}))
! 21125: {
! 21126: if ($in_para and !$in_exdent)
! 21127: {
! 21128: #print STDERR "IN_PARA text\n";
! 21129: my $new_text = $content->{'text'};
! 21130: # first find if in a context of no puncutation related
! 21131: # modification: code style command or @var, @cite, @math
! 21132: # acceptable for punctuation related modifications:
! 21133: # asis b dfn emph i slanted sansserif r sc strong t w
! 21134: my $current_tested = $content;
! 21135: my $no_punctation_munging_command;
! 21136: while ($current_tested)
! 21137: {
! 21138: if (defined($current_tested->{'command'}) and (($style_map{$current_tested->{'command'}} and $style_map{$current_tested->{'command'}}->{'args'} and $style_map{$current_tested->{'command'}}->{'args'}->[0] and $style_map{$current_tested->{'command'}}->{'args'}->[0] eq 'code') or $current_tested->{'command'} eq 'var' or $current_tested->{'command'} eq 'cite' or $current_tested->{'command'} eq 'math'))
! 21139: {
! 21140: $no_punctation_munging_command = 1;
! 21141: last;
! 21142: }
! 21143: $current_tested = $current_tested->{'parent'};
! 21144: }
! 21145: # a punctuation at the end of line in a command is treated
! 21146: # like a punctuation in plain text, except for @:,
! 21147: # accent commands, @dots, 'simple_style' command, and if in
! 21148: # a command as found out just above.
! 21149:
! 21150: if (!$no_punctation_munging_command and (!defined($content->{'command'}) or ($content->{'command'} ne ':' and $content->{'command'} ne 'accents_commands' and $content->{'command'} ne 'dots') and !$info_default_leaf_command{$content->{'command'}}) and get_conf('frenchspacing') ne 'on' and $new_text =~ /([$info_default_end_sentence_character])([$info_default_after_punctuation_characters]*)(\s*)$/)
! 21151: {
! 21152: my $spaces = $3;
! 21153: if (chomp($new_text))
! 21154: {
! 21155: $new_text =~ s/(\s*)$/ /;
! 21156: }
! 21157: else
! 21158: {
! 21159: # these variables hold the place where the end
! 21160: # of line characters are normalized.
! 21161: my ($current_start_from, $index_start_from, $close_start_from) = ($current, $index, $close);
! 21162: my $only_after_punctuation_characters = 1;
! 21163: my $spaces_to_normalize = 0;
! 21164:
! 21165: # first find whether there are only
! 21166: # after_punctuation_characters followed by spaces
! 21167: # and find the place where the
! 21168: # after_punctuation_characters end
! 21169: my ($current_next, $index_next, $close_next, $text_next, $command_next) = info_default_next ($current, $index, $close);
! 21170: # go through the text as long as there are after_punctuation_characters
! 21171: if (!$spaces)
! 21172: {
! 21173: while (1)
! 21174: {
! 21175: # !defined($text_next) catches many special
! 21176: # commands, like anchor, index. Not sure if
! 21177: # it is right or wrong.
! 21178: # Also a style_map command never stops
! 21179: # the search, so that @emph{ or @strong{
! 21180: # begin and end are not taken into account
! 21181: if (!defined($current_next) or (!defined($text_next)) or (defined($command_next) and $command_next eq '*') or ($text_next !~ /^[$info_default_after_punctuation_characters]*(\s*)$/ and (!defined($command_next) or !$style_map{$command_next})))
! 21182: {
! 21183: $only_after_punctuation_characters = 0;
! 21184: last;
! 21185: }
! 21186: my $text_next_kept = $text_next;
! 21187: # begin normalizing spaces at the last place
! 21188: # where there are after_punctuation_characters
! 21189: $current_start_from = $current_next;
! 21190: $index_start_from = $index_next;
! 21191: $index_start_from = $index_next;
! 21192: ($current_next, $index_next, $close_next, $text_next, $command_next) = info_default_next ($current_next, $index_next, $close_next);
! 21193: if ($text_next_kept =~ /^[$info_default_after_punctuation_characters]*\s+$/)
! 21194: {
! 21195: if (chomp($text_next_kept))
! 21196: {
! 21197: $spaces_to_normalize = 1;
! 21198: }
! 21199: last;
! 21200: }
! 21201: }
! 21202: }
! 21203: # check if there are only spaces until end of line
! 21204: if ($only_after_punctuation_characters and !$spaces_to_normalize)
! 21205: {
! 21206: while (1)
! 21207: {
! 21208: # !defined($text_next) catches many special
! 21209: # commands, like anchor, index. Not sure if
! 21210: # it is right or wrong.
! 21211: last if (!defined($current_next) or (!defined($text_next)) or (defined($command_next) and $command_next eq '*'));
! 21212: if ($text_next =~ /\S/ and (!defined($command_next) or !$style_map{$command_next}))
! 21213: {
! 21214: last;
! 21215: }
! 21216: else
! 21217: {
! 21218: if (chomp($text_next))
! 21219: {
! 21220: $spaces_to_normalize = 1;
! 21221: last;
! 21222: }
! 21223: }
! 21224: ($current_next, $index_next, $close_next, $text_next, $command_next) = info_default_next ($current_next, $index_next, $close_next);
! 21225: }
! 21226:
! 21227: }
! 21228: if ($spaces_to_normalize)
! 21229: {
! 21230: # now do the spaces normalization
! 21231: info_default_skip_spaces($current_start_from, $index_start_from, $close_start_from);
! 21232: my $content = $current_start_from->{'content'}->[$index_start_from];
! 21233: $content->{'text'} =~ s/(\s*)$/ /;
! 21234: }
! 21235: }
! 21236: }
! 21237: elsif (chomp($new_text))
! 21238: {
! 21239: $new_text =~ s/(\s*)$/ /;
! 21240: }
! 21241: $text_added .= $new_text;
! 21242: } # ignore spaces outside of paragraphs and preformatted
! 21243: elsif ($preformatted or $info_state->{'align_stack'}->[-1]->{'command'} ne 'normal')
! 21244: {
! 21245: #print STDERR "IN_PREFORMATTED or ALIGN text\n";
! 21246: $text_added .= $content->{'text'};
! 21247: }
! 21248: else
! 21249: {
! 21250: my $chomped_text = $content->{'text'};
! 21251: if ($chomped_text !~ /\S/ and chomp($chomped_text) and !$item_pending)
! 21252: {
! 21253: if ($in_table_item and $info_state->{'only_spaces'})
! 21254: {
! 21255: # in a blank_line
! 21256: #print STDERR "IN_ITEM ignored: `$content->{'text'}'\n";
! 21257: }
! 21258: elsif (!$info_state->{'blank_line'} or !$info_state->{'only_spaces'})
! 21259: {
! 21260: #print STDERR "IN_ADDING_BLANK_LINE because no line before or text before\n";
! 21261: $text_added .= "\n";
! 21262: }
! 21263: else
! 21264: {
! 21265: #print STDERR "IN_NOT_ADDING_BLANK_LINE\n";
! 21266: }
! 21267: }
! 21268: else
! 21269: { # exdent, item not in paragraph nor in preformatted
! 21270: #print STDERR "NOWHERE and not end of line (or item_pending) `$content->{'text'}'\n";
! 21271: $text_added .= $content->{'text'};
! 21272: }
! 21273: }
! 21274: }
! 21275: else
! 21276: {
! 21277: if (defined($content->{'begin'}))
! 21278: {
! 21279: $text_added .= $content->{'begin'};
! 21280: }
! 21281: # command that won't be closed, so the end has to be added
! 21282: # here. It should mostly happen for empty style @-commands.
! 21283: if (defined($content->{'end'}) and !defined($content->{'content'}))
! 21284: {
! 21285: $text_added .= $content->{'end'};
! 21286: }
! 21287: }
! 21288: }
! 21289: if (!$preformatted and !$in_exdent and $info_state->{'align_stack'}->[-1]->{'command'} eq 'normal' and $in_para)
! 21290: {
! 21291: # the line_passed returned here are not used, since they are computed
! 21292: # below.
! 21293: $indentation_done = 1;
! 21294: my $dummy_line_passed;
! 21295: ($line_char_counter, $pending_spaces_word, $dummy_line_passed, $text_added) = info_default_process_para_text($text_added, $line_char_counter, $pending_spaces_word, $indent_length, $max_column, $in_w, $indent_level * $info_default_indent_length) if ($text_added ne '');
! 21296: }
! 21297: elsif ($info_state->{'align_stack'}->[-1]->{'command'} ne 'center' and $info_state->{'align_stack'}->[-1]->{'command'} ne 'flushright')
! 21298: {
! 21299: my $dummy_line_passed;
! 21300: ($line_char_counter, $dummy_line_passed, $text_added) = info_default_process_line_text($text_added, $line_char_counter, $indent_length);
! 21301: #$indentation_done = 1;
! 21302: }
! 21303: else
! 21304: {
! 21305: $line_char_counter += t2h_default_string_width($text_added);
! 21306: }
! 21307: new_text:
! 21308: if ($text_added ne '')
! 21309: {
! 21310: if ($item_pending and !$line_added_before_item)
! 21311: {
! 21312: #info_default_skip_spaces($current, $index, $close);
! 21313: $item_pending = undef;
! 21314: }
! 21315: }
! 21316: if ($text_added =~ /\S/)
! 21317: {
! 21318: $in_table_item = 0 if ($in_table_item);
! 21319: $info_state->{'blank_line'} = 0;
! 21320: }
! 21321: $text_added = "\n" . $text_added if ($prepend_newline);
! 21322: print STDERR "TEXT_ADDED($indent_length) `$text_added'\n" if ($text_added ne '' and $DEBUG);
! 21323: #print STDERR "TEXT_ADDED($indent_length) `$text_added'\n";
! 21324: # from here, the next cmmand is available
! 21325: ($current, $index, $close) = info_default_iterator_next($current, $index, $close);
! 21326:
! 21327: my ($line_passed, $end_of_line, $last_line, $text_indented, $blank_line) = info_default_count_lines($text_added, $indent_length, ($indentation_done
! 21328: or $info_state->{'align_stack'}->[-1]->{'command'} eq 'center'
! 21329: or $info_state->{'align_stack'}->[-1]->{'command'} eq 'flushright'));
! 21330: $info_state->{'blank_line'} = 1 if ($blank_line);
! 21331: print STDERR "ADDING `$text_indented'\n" if ($text_indented ne '' and $DEBUG);
! 21332: # only_space is set in all the conditionals
! 21333: if ($end_of_line)
! 21334: {
! 21335: $line_char_counter = 0;
! 21336: if ($in_exdent)
! 21337: {
! 21338: $in_exdent--;
! 21339: }
! 21340: if ($table_item_line)
! 21341: {
! 21342: $table_item_line--;
! 21343: $in_table_item = 1;
! 21344: }
! 21345: if (!$table_item_line and !$in_exdent and !$item_pending)
! 21346: {
! 21347: $indent_length = $indent_level * $info_default_indent_length;
! 21348: }
! 21349: $info_state->{'blank_line'} = 1 if ($info_state->{'only_spaces'} and ($last_line !~ /\S/));
! 21350: $info_state->{'only_spaces'} = 1;
! 21351: }
! 21352: else
! 21353: {
! 21354: if ($line_passed)
! 21355: {# in that case we added more than one line, the $line_char_counter
! 21356: # is reset to the last line length.
! 21357: $line_char_counter = t2h_default_string_width($last_line);
! 21358: $in_exdent = 0;
! 21359: $indent_length = $indent_level * $info_default_indent_length;
! 21360: if ($last_line !~ /\S/)
! 21361: {
! 21362: $info_state->{'only_spaces'} = 1;
! 21363: }
! 21364: else
! 21365: {
! 21366: $info_state->{'only_spaces'} = 0;
! 21367: }
! 21368: }
! 21369: else
! 21370: {
! 21371: $info_state->{'only_spaces'} = 0 if ($last_line =~ /\S/);
! 21372: }
! 21373: }
! 21374: if ($info_state->{'align_stack'}->[-1]->{'command'} eq 'center'
! 21375: or $info_state->{'align_stack'}->[-1]->{'command'} eq 'flushright')
! 21376: {
! 21377: if (defined($current_line))
! 21378: {
! 21379: $text_added = $current_line . $text_added;
! 21380: }
! 21381: $text_indented = '';
! 21382: $current_line = undef;
! 21383: my $spaces_prepended = undef;
! 21384: foreach my $line (split /^/, $text_added)
! 21385: {
! 21386: my $chomped_line = $line;
! 21387: if (chomp($chomped_line))
! 21388: {
! 21389: $line =~ s/^\s*//;
! 21390: $line =~ s/\s*$//;
! 21391:
! 21392: if (t2h_default_string_width($line) eq 0)
! 21393: {
! 21394: $spaces_prepended = 0;
! 21395: $text_indented .= "\n";
! 21396: }
! 21397: else
! 21398: {
! 21399: my $line_width = t2h_default_string_width($line);
! 21400: if ($line_width > $max_column)
! 21401: {
! 21402: $spaces_prepended = 0;
! 21403: }
! 21404: elsif ($info_state->{'align_stack'}->[-1]->{'command'} eq 'center')
! 21405: {
! 21406: $spaces_prepended = (($max_column -1 - $line_width) /2);
! 21407: }
! 21408: else
! 21409: {
! 21410: $spaces_prepended = ($max_column -1 - $line_width);
! 21411: }
! 21412: $text_indented .= ' ' x$spaces_prepended . $line ."\n";
! 21413: }
! 21414: }
! 21415: else
! 21416: {
! 21417: $current_line = $line;
! 21418: }
! 21419: }
! 21420: if (defined ($spaces_prepended) and defined($info_state->{'align_stack'}->[-1]->{'anchors'}))
! 21421: {
! 21422: while (@{$info_state->{'align_stack'}->[-1]->{'anchors'}})
! 21423: {
! 21424: my $anchor = shift @{$info_state->{'align_stack'}->[-1]->{'anchors'}};
! 21425: $anchor->{'info_offset'} += info_default_byte_count(' ' x$spaces_prepended);
! 21426: }
! 21427: }
! 21428: }
! 21429:
! 21430: if ($direntry)
! 21431: {
! 21432: $info_default_dir_specification .= $text_indented;
! 21433: }
! 21434: else
! 21435: {
! 21436: $result .= $text_indented;
! 21437: $length += info_default_byte_count($text_indented);
! 21438: $all_line_passed += $line_passed;
! 21439: }
! 21440: }
! 21441: return ($length, $result, $all_line_passed);
! 21442: }
! 21443:
! 21444: sub info_default_open_command($$;$)
! 21445: {
! 21446: my $state = shift;
! 21447: my $command = shift;
! 21448: my $additional_entries = shift;
! 21449:
! 21450: my $index = 0;
! 21451:
! 21452: my $info_state = info_default_get_state($state);
! 21453: # index in the parent content list
! 21454: $index = scalar(@{$info_state->{'current'}->{'content'}})
! 21455: if (defined($info_state->{'current'}->{'content'}));
! 21456: my $new_command = {'command' => $command, 'parent' => $info_state->{'current'}, 'index_in_parent' => $index };
! 21457: if (defined($additional_entries))
! 21458: {
! 21459: foreach my $key (keys(%$additional_entries))
! 21460: {
! 21461: $new_command->{$key} = $additional_entries->{$key};
! 21462: }
! 21463: }
! 21464:
! 21465: push @{$info_state->{'current'}->{'content'}}, $new_command;
! 21466: $info_state->{'current'} = $new_command;
! 21467: print STDERR "TREE($info_state->{'nr'}): Opened $command\n" if ($DEBUG);
! 21468: }
! 21469:
! 21470: sub info_default_close_command($$;$$$)
! 21471: {
! 21472: my $state = shift;
! 21473: my $command = shift;
! 21474: my $begin = shift;
! 21475: my $end = shift;
! 21476: my $command_entries = shift;
! 21477:
! 21478: $state = $Texi2HTML::THISDOC{'state'} if (!defined($state));
! 21479: my $info_state = info_default_get_state($state);
! 21480: print STDERR "TREE($info_state->{'nr'}): Closing $command\n" if ($DEBUG);
! 21481: if (!defined($info_state->{'current'}))
! 21482: {
! 21483: print STDERR "info_state->{'current'} not defined (closing $command)\n";
! 21484: }
! 21485: elsif (!defined($info_state->{'current'}->{'command'}))
! 21486: {
! 21487: print STDERR "info_state->{'current'}->{'command'} not defined (closing $command)\n";
! 21488: }
! 21489: elsif ($command ne $info_state->{'current'}->{'command'})
! 21490: {
! 21491: print STDERR "Was waiting for $info_state->{'current'}->{'command'} (closing $command)\n";
! 21492: }
! 21493: #return if $no_close;
! 21494: $command_entries->{'begin'} = $begin;
! 21495: $command_entries->{'end'} = $end;
! 21496: $command_entries->{'line_nr'} = $Texi2HTML::THISDOC{'line_nr'};
! 21497: foreach my $key (keys(%$command_entries))
! 21498: {
! 21499: $info_state->{'current'}->{$key} = $command_entries->{$key}
! 21500: if (defined($command_entries->{$key}));
! 21501: }
! 21502:
! 21503: $info_state->{'current'} = $info_state->{'current'}->{'parent'};
! 21504:
! 21505: return info_default_output($info_state)
! 21506: if (!defined($info_state->{'current'}->{'command'}));
! 21507: return '';
! 21508: }
! 21509:
! 21510: sub info_default_store_text($$;$$)
! 21511: {
! 21512: my $state = shift;
! 21513: my $text = shift;
! 21514: my $command = shift;
! 21515: my $text_entries = shift;
! 21516:
! 21517: $state = $Texi2HTML::THISDOC{'state'} if (!defined($state));
! 21518: my $info_state = info_default_get_state($state);
! 21519: return '' if ((!defined($text) or $text eq '') and !defined($command));
! 21520:
! 21521: ################################## debug
! 21522: my $command_text = '';
! 21523: $command_text = "\[$command\]" if (defined($command));
! 21524: $command_text .= $text if (defined($text));
! 21525: print STDERR "TREE($info_state->{'nr'}) Storing: ${command_text}\n" if ($DEBUG);
! 21526: ################################## end debug
! 21527:
! 21528: $text_entries->{'text'} = $text if (defined($text));
! 21529: $text_entries->{'command'} = $command if (defined($command));
! 21530: $text_entries->{'parent'} = $info_state->{'current'};
! 21531: $text_entries->{'line_nr'} = $Texi2HTML::THISDOC{'line_nr'};
! 21532: push @{$info_state->{'current'}->{'content'}}, $text_entries;
! 21533: return info_default_output($info_state)
! 21534: if (!defined($info_state->{'current'}->{'command'}));
! 21535: return '';
! 21536: }
! 21537:
! 21538: sub info_default_increment_paragraph ($$$;$)
! 21539: {
! 21540: my $in_format = shift;
! 21541: my $parent_format = shift;
! 21542: my $info_state = shift;
! 21543: my $command = shift;
! 21544:
! 21545: if ($in_format)
! 21546: {
! 21547: $parent_format->{'paragraph_in_format_nr'} = 0 if (!defined($parent_format->{'paragraph_in_format_nr'}));
! 21548: $parent_format->{'paragraph_in_format_nr'}++;
! 21549: }
! 21550: else
! 21551: {
! 21552: $info_state->{'paragraph_in_element_nr'}++;
! 21553: }
! 21554: ####################### debug
! 21555: $command = 'PARA' if (!defined($command));
! 21556: if (0)
! 21557: #if (1)
! 21558: {
! 21559: my $format_info = '';
! 21560: if ($in_format)
! 21561: {
! 21562: $format_info = "format: [$parent_format->{'command'}],$parent_format->{'paragraph_in_format_nr'}"
! 21563: }
! 21564: print STDERR "INCREMENT_PARA($command) $info_state->{'paragraph_in_element_nr'} $format_info\n";
! 21565: }
! 21566: ####################### end debug
! 21567: }
! 21568:
! 21569: sub info_default_begin_format_texi($$$)
! 21570: {
! 21571: my $command = shift;
! 21572: my $line = shift;
! 21573: my $state = shift;
! 21574:
! 21575: my $info_state = info_default_get_state ($state);
! 21576: my ($parent_format, $in_format);
! 21577: ($parent_format, $in_format) = info_default_parent_format($info_state->{'current'});
! 21578: info_default_increment_paragraph ($in_format, $parent_format, $info_state, $command);
! 21579: # remove space in front of center, unless it removes the end of line!
! 21580: $line =~ s/^\s*// if ($command eq 'center' and $line =~ /\S/);
! 21581: # don't open a format if it is a @def*x command and we are already in the
! 21582: # corresponding @def* command
! 21583: info_default_open_command($state,$command) unless ($def_map{$command} and $command =~ /x$/ and defined($info_state->{'current'}->{'command'}) and "$info_state->{'current'}->{'command'}x" eq $command);
! 21584: return $line;
! 21585: }
! 21586:
! 21587: sub info_default_begin_style_texi($$$$$)
! 21588: {
! 21589: my $command = shift;
! 21590: my $state = shift;
! 21591: my $stack = shift;
! 21592: my $real_style_command = shift;
! 21593: my $remove_texi = shift;
! 21594:
! 21595: info_default_open_command($state,$command)
! 21596: unless ($info_default_accent_commands{$command} or exists $things_map{$command}
! 21597: or $command =~ /^special_(\w+)_(\d+)$/);
! 21598: # if ($real_style_command);
! 21599: }
! 21600:
! 21601: sub info_default_begin_paragraph_texi($$$)
! 21602: {
! 21603: my $command = shift;
! 21604: my $paragraph_macros = shift;
! 21605: my $paragraph_command = shift;
! 21606: #print STDERR "begin_paragraph $command\n";
! 21607: my $state = shift;
! 21608: my $stack = shift;
! 21609: info_default_open_command($state,$command);
! 21610: foreach my $style_command (@$paragraph_macros)
! 21611: {
! 21612: #print STDERR "para stack: $style_command->{'style'}\n";
! 21613: info_default_open_command($state,$style_command->{'style'});
! 21614: }
! 21615: }
! 21616:
! 21617: sub info_default_simple_command($$$$$)
! 21618: {
! 21619: my $command = shift;
! 21620: my $in_preformatted = shift;
! 21621: my $in_math = shift;
! 21622: my $line_nr = shift;
! 21623: my $state = shift;
! 21624:
! 21625: my $result = $simple_map{$command};
! 21626: $result = $simple_map_math{$command} if ($in_math and defined($simple_map_math{$command}));
! 21627: # discards '-' '|' '/' and ':'. If ':' is associated with a punctuation
! 21628: # character it is added to the tree in info_default_colon_command
! 21629: return info_default_store_text($state,$result,$command) if ($result ne '');
! 21630: return '';
! 21631: }
! 21632:
! 21633: sub info_default_colon_command($)
! 21634: {
! 21635: my $punctuation_character = shift;
! 21636: if (defined($colon_command_punctuation_characters{$punctuation_character})
! 21637: and $punctuation_character =~ /^[$punctuation_characters]$/)
! 21638: {
! 21639: return info_default_store_text(undef,$colon_command_punctuation_characters{$punctuation_character}, ':');
! 21640: }
! 21641: else
! 21642: {
! 21643: return info_default_store_text(undef,$punctuation_character);
! 21644: }
! 21645: }
! 21646:
! 21647: sub info_default_thing_command($$$$$$)
! 21648: {
! 21649: my $command = shift;
! 21650: my $text = shift;
! 21651: my $in_preformatted = shift;
! 21652: my $in_math = shift;
! 21653: my $line_nr = shift;
! 21654: my $state = shift;
! 21655:
! 21656: my $result = $things_map{$command};
! 21657: #return info_default_close_command($state, $command, $result, $text, '');
! 21658: return info_default_store_text($state, $result, $command);
! 21659: # return $result . $text;
! 21660: }
! 21661:
! 21662:
! 21663: sub info_default_style($$$$$$$$$$)
! 21664: {
! 21665: my $style = shift;
! 21666: my $command = shift;
! 21667: my $text = shift;
! 21668: my $args = shift;
! 21669: my $no_close = shift;
! 21670: my $no_open = shift;
! 21671: my $line_nr = shift;
! 21672: my $state = shift;
! 21673: my $command_stack = shift;
! 21674: my $kept_line_nrs = shift;
! 21675:
! 21676: my $begin = '';
! 21677: my $end = '';
! 21678:
! 21679: # note that the $text is always discarded for closed commands
! 21680:
! 21681: # the formatting is done right here, and the result is entered as text below.
! 21682: if ($info_default_leaf_command{$command})
! 21683: {
! 21684: my $style_index = 0;
! 21685: my @formatted_args = ();
! 21686: foreach my $arg (@$args)
! 21687: {
! 21688: # we don't use style, since we only set 'orig_args' in style_map
! 21689: # and not in style_map_pre.
! 21690: my $arg_style = $style_map{$command}->{'orig_args'}->[$style_index];
! 21691: my $new_state = main::duplicate_formatting_state($state);
! 21692: if ($arg_style eq 'normal')
! 21693: {
! 21694: push @formatted_args, main::substitute_line($arg, "\@$command", $new_state);
! 21695: }
! 21696: elsif ($arg_style eq 'code')
! 21697: {
! 21698: $new_state->{'code_style'} = 1;
! 21699: push @formatted_args, main::substitute_line($arg, "\@$command", $new_state);
! 21700: }
! 21701: else
! 21702: {
! 21703: print STDERR "Unknown arg style($style_index) $arg_style for $command, $state->{'remove_texi'}\n";
! 21704: }
! 21705: $style_index++;
! 21706: }
! 21707: $args = \@formatted_args;
! 21708: }
! 21709: if (defined($style->{'function'}))
! 21710: { # in case of an accent, some text is returned here if there are still
! 21711: # more accents on the command_stack, otherwise it is put in the tree.
! 21712: # Other commands text results are put in the tree below.
! 21713: $text = &{$style->{'function'}}($command, $args, $command_stack, $state, $line_nr, $kept_line_nrs);
! 21714: }
! 21715: elsif ($info_default_leaf_command{$command})
! 21716: { # no formatting function but a leaf command, it is just replaced
! 21717: # by the formatted argument, and put in the tree below.
! 21718: $text = $args->[0];
! 21719: }
! 21720: if (defined($style->{'begin'}) and !$no_open)
! 21721: {
! 21722: $begin = $style->{'begin'};
! 21723: }
! 21724: if (defined($style->{'end'}) and !$no_close)
! 21725: {
! 21726: $end = $style->{'end'};
! 21727: }
! 21728: # normal style commands
! 21729: unless($special_style{$command} or $info_default_accent_commands{$command} or ($command eq 'hyphenation') or $info_default_leaf_command{$command})
! 21730: {
! 21731: return info_default_close_command($state, $command, $begin, $end);
! 21732: }
! 21733: # this is for *ref, images and footnotes text registering and putting
! 21734: # in the tree.
! 21735: # anchor is already in the tree, from anchor_label.
! 21736: if (($special_style{$command} or $info_default_leaf_command{$command}) and $command ne 'anchor')
! 21737: {
! 21738: return info_default_store_text ($state, $begin.$text.$end, $command);
! 21739: }
! 21740: # for accents, hyphenation and anchor
! 21741: # (though the result for anchor is always an empty string).
! 21742: return $begin.$text.$end;
! 21743: }
! 21744:
! 21745: sub info_default_header ()
! 21746: {
! 21747: return $Texi2HTML::THISDOC{'info_header'} if (defined($Texi2HTML::THISDOC{'info_header'}));
! 21748: # $Texi2HTML::THISDOC{'program'}
! 21749: my $input_basename = $Texi2HTML::THISDOC{'input_file_name'};
! 21750: $input_basename =~ s/^.*\///; # if ($TEST);
! 21751: $input_basename = $STDIN_DOCU_NAME if ($input_basename eq '-');
! 21752: my $output_basename = $Texi2HTML::THISDOC{'filename'}->{'top'};
! 21753: $output_basename =~ s/^.*\///;
! 21754: my $result = "This is $output_basename, produced by makeinfo version 4.13 from $input_basename. ";
! 21755: my $dummy;
! 21756: ($dummy, $dummy, $dummy, $result) = info_default_process_para_text($result, 0, {'spaces' => ''}, undef, get_conf('fillcolumn'));
! 21757: $result .= "\n\n";
! 21758: $result .= "$Texi2HTML::THISDOC{'copying_comment'}";
! 21759: if ($info_default_dir_specification)
! 21760: {
! 21761: $result .= "$info_default_dir_specification\n";
! 21762: }
! 21763: $Texi2HTML::THISDOC{'info_header'} = $result;
! 21764: return $result;
! 21765: }
! 21766:
! 21767: sub info_default_print_page_head($)
! 21768: {
! 21769: my $fh = shift;
! 21770: my $header = info_default_header();
! 21771: print $fh "".$header;
! 21772:
! 21773: my $state = $Texi2HTML::THISDOC{'state'};
! 21774: my $info_state = info_default_get_state ($state);
! 21775: $info_state->{'offset_in_file'} += info_default_byte_count($header);
! 21776: $info_state->{'blank_line'} = 1 if ($Texi2HTML::THISDOC{'copying_comment'} eq '');
! 21777: }
! 21778:
! 21779: sub info_default_parent_format($)
! 21780: {
! 21781: my $parent_format = shift;
! 21782: my $in_format = 0;
! 21783: while (1)
! 21784: {
! 21785: if (defined($parent_format->{'command'}) and $info_default_format{$parent_format->{'command'}})
! 21786: {
! 21787: $in_format = 1;
! 21788: last;
! 21789: }
! 21790: last if (!defined($parent_format->{'parent'}));
! 21791:
! 21792: $parent_format = $parent_format->{'parent'};
! 21793: }
! 21794: return ($parent_format, $in_format);
! 21795: }
! 21796:
! 21797: sub info_default_paragraph($$$$$$$$$$$$)
! 21798: {
! 21799: my $text = shift;
! 21800: my $align = shift;
! 21801: my $indent = shift;
! 21802: my $paragraph_command = shift;
! 21803: my $paragraph_command_formatted = shift;
! 21804: my $paragraph_number = shift;
! 21805: my $format = shift;
! 21806: my $item_nr = shift;
! 21807: my $enumerate_style = shift;
! 21808: my $number = shift;
! 21809: my $command_stack_at_end = shift;
! 21810: my $command_stack_at_begin = shift;
! 21811:
! 21812: my $top_stack = '';
! 21813: $top_stack = $command_stack_at_begin->[-1] if (scalar (@$command_stack_at_begin));
! 21814:
! 21815: my $state = $Texi2HTML::THISDOC{'state'};
! 21816: my $info_state = info_default_get_state ($state);
! 21817: my ($parent_format, $in_format);
! 21818: ($parent_format, $in_format) = info_default_parent_format($info_state->{'current'}->{'parent'});
! 21819: info_default_increment_paragraph ($in_format, $parent_format, $info_state);
! 21820: my $additional_args = {'top_stack' => $top_stack, 'parent_format' => $parent_format};
! 21821: $additional_args->{'paragraph_in_element_nr'} = ($info_state->{'paragraph_in_element_nr'} - 1) if (!$in_format);
! 21822:
! 21823: return info_default_close_command(undef, 'paragraph', undef, undef, $additional_args);
! 21824: }
! 21825:
! 21826: # currently not used, but could be used if info_default_preformatted
! 21827: # return something that is not 'false', for example spaces, though we
! 21828: # want the preformatted to be ignored. Though it is not sure that if there
! 21829: # are spaces we want to ignore the preformatted.
! 21830: sub info_default_empty_preformatted($)
! 21831: {
! 21832: my $text = shift;
! 21833: my $result = info_default_preformatted($text, undef, undef, undef, undef,
! 21834: undef, undef, undef, undef, undef, undef, undef);
! 21835: return 0;
! 21836: }
! 21837:
! 21838: sub info_default_preformatted($$$$$$$$$$$$)
! 21839: {
! 21840: my $text = shift;
! 21841: my $pre_style = shift;
! 21842: my $class = shift;
! 21843: my $leading_command = shift;
! 21844: my $leading_command_formatted = shift;
! 21845: my $preformatted_number = shift;
! 21846: my $format = shift;
! 21847: my $item_nr = shift;
! 21848: my $enumerate_style = shift;
! 21849: my $number = shift;
! 21850: my $command_stack_at_end = shift;
! 21851: my $command_stack_at_begin = shift;
! 21852:
! 21853: return info_default_close_command(undef, 'preformatted');
! 21854: }
! 21855:
! 21856:
! 21857: sub info_default_node_line($$)
! 21858: {
! 21859: my $element = shift;
! 21860: my $info_state = shift;
! 21861: my $outfile = $Texi2HTML::THISDOC{'filename'}->{'top'};
! 21862: $outfile = $STDOUT_DOCU_NAME if ($outfile eq '-');
! 21863: my $result = "\x{1F}\nFile: $outfile, Node: $element->{'text'}";
! 21864: if (defined($element->{'NodeNext'}))
! 21865: { # This is not translatable
! 21866: $result .= ", Next: $element->{'NodeNext'}->{'text'}";
! 21867: }
! 21868: if (defined($element->{'NodePrev'}))
! 21869: {
! 21870: $result .= ", Prev: $element->{'NodePrev'}->{'text'}";
! 21871: }
! 21872: if (defined($element->{'NodeUp'}))
! 21873: {
! 21874: $result .= ", Up: $element->{'NodeUp'}->{'text'}";
! 21875: }
! 21876: $result .= "\n\n";
! 21877: # the line_count is ahead from the number of lines by one.
! 21878: $info_state->{'line_count'} = 3;
! 21879: $info_state->{'offset_in_file'} += info_default_byte_count($result);
! 21880: $info_state->{'blank_line'} = 1;
! 21881: return $result;
! 21882: }
! 21883:
! 21884: sub info_default_element_heading($$$$$$$$$$$$)
! 21885: {
! 21886: my $element = shift;
! 21887: my $command = shift;
! 21888: my $texi_line = shift;
! 21889: my $line = shift;
! 21890: my $in_preformatted = shift;
! 21891: my $one_section = shift;
! 21892: my $element_heading = shift;
! 21893: my $first_in_page = shift;
! 21894: my $is_top = shift;
! 21895: my $previous_is_top = shift;
! 21896: my $command_line = shift;
! 21897: my $element_id = shift;
! 21898: my $new_element = shift;
! 21899:
! 21900: my $state = $Texi2HTML::THISDOC{'state'};
! 21901: my $info_state = info_default_get_state ($state);
! 21902:
! 21903: # FIXME use $element or $Texi2HTML::THIS_ELEMENT? Main program should
! 21904: # ensure they are the same.
! 21905: if ($new_element and ($element ne $new_element and $element->{'node'}))
! 21906: {
! 21907: die "There is a new element, but element `$element->{'texi'}' is not the new element\n";
! 21908: }
! 21909: # FIXME
! 21910: # non node element may appear if the element appears before the first
! 21911: # node/section element. For example `element not associated with a node'
! 21912: # won't be associated with a node.
! 21913: # @unnumbered element not associated with a node
! 21914: # @node Top
! 21915: # @top Top element
! 21916: if (!$element->{'node'})
! 21917: {
! 21918: return &$heading($element, $command, $texi_line, $line, $in_preformatted, $one_section, $element_heading);
! 21919: }
! 21920:
! 21921: my $before = '';
! 21922: $element->{'info_offset'} = $info_state->{'offset_in_file'};
! 21923: push @{$info_state->{'pending_tags'}}, $element;
! 21924:
! 21925: my $result = info_default_node_line($element, $info_state);
! 21926:
! 21927: $info_default_footnote_index = 0;
! 21928: $info_default_current_node = $element;
! 21929:
! 21930: return $before.$result;
! 21931: }
! 21932:
! 21933: sub info_default_heading($$$$$;$$)
! 21934: {
! 21935: my $element = shift;
! 21936: my $command = shift;
! 21937: my $texi_line = shift;
! 21938: my $line = shift;
! 21939: my $in_preformatted = shift;
! 21940: my $one_section = shift;
! 21941: my $element_heading = shift;
! 21942:
! 21943: die "Heading called for a node\n" if ($element->{'node'});
! 21944: my $state = $Texi2HTML::THISDOC{'state'};
! 21945: my $info_state = info_default_get_state ($state);
! 21946: $info_state->{'paragraph_in_element_nr'} = 0;
! 21947: if (!defined($element->{'texi'}))
! 21948: {
! 21949: main::msg_debug("for $element, element->{'texi'} not defined, texi_line: $texi_line");
! 21950: }
! 21951: elsif (!defined($element->{'text'}))
! 21952: {
! 21953: main::msg_debug("for $element, $element->{'texi'}, element->{'text'} not defined");
! 21954: }
! 21955: return '' if ($element->{'tag'} eq 'part');
! 21956:
! 21957: my $text = "$element->{'text'}";
! 21958: # when @top is empty, use settitle
! 21959: $text = $Texi2HTML::THISDOC{'settitle'} if (!length($text) and $element->{'tag'} eq 'top' and defined ($Texi2HTML::THISDOC{'settitle'}) and length($Texi2HTML::THISDOC{'settitle'}));
! 21960: my $result = &$heading_text ("\@$command", $text, $element->{'level'});
! 21961:
! 21962: $result .= "\n";
! 21963:
! 21964: return info_default_store_text($state, $result, $command, {'heading_command' => 1});
! 21965: }
! 21966:
! 21967: sub info_default_normal_text($$$$$$$;$)
! 21968: {
! 21969: my @initial_args = @_;
! 21970: my $text = shift;
! 21971: my $in_raw_text = shift; # remove_texi
! 21972: my $in_preformatted = shift;
! 21973: my $in_code = shift;
! 21974: my $in_math = shift;
! 21975: my $in_simple = shift;
! 21976: my $style_stack = shift;
! 21977: my $state = shift;
! 21978:
! 21979: # $Texi2HTML::THISDOC{'ENCODING_NAME'}) should be defined, but maybe
! 21980: # not when parsing commands in first or second pass, and removeing texi
! 21981: # like what is done for @setfilename.
! 21982: if ($ENABLE_ENCODING and defined($Texi2HTML::THISDOC{'ENCODING_NAME'}) and ($Texi2HTML::THISDOC{'ENCODING_NAME'} eq 'utf-8') and $USE_UNICODE)
! 21983: {
! 21984: $text = &t2h_utf8_normal_text(@initial_args);
! 21985: }
! 21986: else
! 21987: {
! 21988: #print STDERR "info_default_normal_text $text $in_preformatted $in_code \n";
! 21989: $text = uc($text) if (in_cmd($style_stack, 'sc'));
! 21990: $text = uc($text) if (in_cmd($style_stack, 'var'));
! 21991: if (! $in_code and !$in_preformatted)
! 21992: {
! 21993: $text =~ s/---/\x{1F}/g;
! 21994: $text =~ s/--/-/g;
! 21995: $text =~ s/\x{1F}/--/g;
! 21996: $text =~ s/``/"/g;
! 21997: $text =~ s/\'\'/"/g;
! 21998: }
! 21999: }
! 22000: # accented characters are not handled as normal text, but when the last
! 22001: # accent command on the stack is closed.
! 22002: if ($style_stack and @$style_stack and $info_default_accent_commands{$style_stack->[-1]})
! 22003: {
! 22004: return $text;
! 22005: }
! 22006: #print STDERR "NORMAL\n";
! 22007: return info_default_store_text($state,$text);
! 22008: }
! 22009:
! 22010: # this is not called in preformatted
! 22011: sub info_default_empty_line($$)
! 22012: {
! 22013: my $text = shift;
! 22014: my $state = shift;
! 22015: #ignore the line if it just follows a deff
! 22016: #return '' if ($state->{'deff_line'});
! 22017: return info_default_store_text($state,$text);
! 22018: # return '';
! 22019: }
! 22020:
! 22021: # change interface?
! 22022: sub info_default_anchor_label($$$$)
! 22023: {
! 22024: my $id = shift;
! 22025: my $anchor_text = shift;
! 22026: my $anchor_reference = shift;
! 22027: my $in_special_region = shift;
! 22028: return '' if ($in_special_region);
! 22029: #print STDERR "Storing anchor $anchor_reference->{'text'}\n";
! 22030: main::line_warn(__("anchor outside of any node, it won't be registered"), $Texi2HTML::THISDOC{'line_nr'}) if (!defined($info_default_current_node));
! 22031: return info_default_store_text(undef,undef,'anchor',{'anchor_reference' => $anchor_reference});
! 22032: }
! 22033:
! 22034: sub info_default_acronym_like($$$$$$)
! 22035: {
! 22036: my $command = shift;
! 22037: my $acronym_texi = shift;
! 22038: my $acronym_text = shift;
! 22039: my $with_explanation = shift;
! 22040: my $explanation_lines = shift;
! 22041: my $explanation_text = shift;
! 22042: my $explanation_simply_formatted = shift;
! 22043:
! 22044: if ($with_explanation)
! 22045: {
! 22046: return "$acronym_text ($explanation_text)";
! 22047: }
! 22048: else
! 22049: {
! 22050: return "$acronym_text";
! 22051: }
! 22052: }
! 22053:
! 22054:
! 22055: sub info_default_print_page_foot($)
! 22056: {
! 22057: my $fh = shift;
! 22058: my $state = $Texi2HTML::THISDOC{'state'};
! 22059: my $info_state = info_default_get_state ($state);
! 22060: my $indirect = 0;
! 22061: if (!defined ($info_state->{'pending_tags'}))
! 22062: { # i18n
! 22063: main::document_warn ("Document without nodes.");
! 22064: }
! 22065: else
! 22066: {
! 22067: $indirect = 1 if ($info_default_out_file_nr > 1);
! 22068: if ($indirect)
! 22069: {
! 22070: close ($Texi2HTML::THISDOC{'FH'});
! 22071: unless (rename ("$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'filename'}->{'top'}", "$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'filename'}->{'top'}-1"))
! 22072: {
! 22073: main::document_warn ("Rename $Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'filename'}->{'top'} failed: $!");
! 22074: }
! 22075:
! 22076: my $INDIRECT = main::open_out("$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'filename'}->{'top'}");
! 22077: print $INDIRECT "".info_default_header();
! 22078: print $INDIRECT "\x{1F}\nIndirect:";
! 22079: foreach my $indirect (@info_default_pending_indirect)
! 22080: {
! 22081: print $INDIRECT "\n$indirect->{'file'}: $indirect->{'offset'}";
! 22082: }
! 22083: $fh = $INDIRECT;
! 22084: }
! 22085: # makeinfo seems to add systematically an additional \n, done just below
! 22086: print $fh "\n\x{1F}\nTag Table:\n";
! 22087:
! 22088: if ($indirect)
! 22089: {
! 22090: print $fh "(Indirect)\n";
! 22091: }
! 22092: my $Top_seen;
! 22093: foreach my $element (@{$info_state->{'pending_tags'}})
! 22094: {
! 22095: my $prefix;
! 22096: $prefix = 'Node' if ($element->{'node'});
! 22097: $prefix = 'Ref' if ($element->{'anchor'} or $element->{'float'});
! 22098: print $fh "$prefix: $element->{'text'}\x{7F}$element->{'info_offset'}\n";
! 22099: $Top_seen = 1 if ($element->{'text'} =~ /^top$/i);
! 22100: }
! 22101: if (!$Top_seen)
! 22102: {# i18n
! 22103: main::document_warn ("Document without Top node.");
! 22104: }
! 22105: print $fh "\x{1F}\nEnd Tag Table\n";
! 22106: }
! 22107:
! 22108: # IN_ENCODING is the documentencoding transformed to the encoding names
! 22109: # usually seen in html. This is what the info readers should understand.
! 22110: my $coding = get_conf('IN_ENCODING');
! 22111: $coding = get_conf('DOCUMENT_ENCODING') if (!defined($coding));
! 22112: if (defined($coding))
! 22113: {
! 22114: print $fh "\n\x{1F}\nLocal Variables:\ncoding: $coding\nEnd:\n";
! 22115: }
! 22116: }
! 22117:
! 22118: sub info_default_print_Top_footer($$$)
! 22119: {
! 22120: my $fh = shift;
! 22121: my $end_page = shift;
! 22122: my $element = shift;
! 22123: if ($end_page)
! 22124: {
! 22125: &$print_page_foot($fh);
! 22126: }
! 22127: info_default_end_section($fh, $end_page, $element);
! 22128: }
! 22129:
! 22130: sub info_default_footnote_texi($$$)
! 22131: {
! 22132: my $text = shift;
! 22133: my $state = shift;
! 22134: my $style_stack = shift;
! 22135:
! 22136: unless ($state->{'outside_document'} or (defined($state->{'multiple_pass'}) and $state->{'multiple_pass'} > 0))
! 22137: {
! 22138: $info_default_footnote_index++;
! 22139: }
! 22140: my $footnote_number = $info_default_footnote_index;
! 22141: $footnote_number = $NO_NUMBER_FOOTNOTE_SYMBOL if (!$NUMBER_FOOTNOTES);
! 22142: return "($footnote_number) $text";
! 22143: #return undef;
! 22144: }
! 22145:
! 22146: sub info_default_print_section
! 22147: {
! 22148: my $fh = shift;
! 22149: my $first_in_page = shift;
! 22150: my $previous_is_top = shift;
! 22151: my $element = shift;
! 22152: my $nw = main::print_lines($fh);
! 22153: my $state = $Texi2HTML::THISDOC{'state'};
! 22154: my $info_state = info_default_get_state ($state);
! 22155: if (!$info_state->{'blank_line'})
! 22156: {
! 22157: my $end = "\n";
! 22158: $info_state->{'offset_in_file'} += info_default_byte_count($end);
! 22159: $info_state->{'line_count'}++;
! 22160: print $fh "$end";
! 22161: }
! 22162: if (@info_default_pending_footnotes)
! 22163: {
! 22164: my $footnote_text;
! 22165: my $footnote_element;
! 22166: if (get_conf('footnotestyle') eq 'separate')
! 22167: {
! 22168: my $node_ref = $info_default_current_node;
! 22169: # thee is a warning when processing the footnote, like
! 22170: # "Footnote defined without parent node"
! 22171: $node_ref = {'text' => 'no node', 'file' => ''} if (!defined($node_ref));
! 22172: $footnote_element = { 'NodeUp' => $node_ref,
! 22173: 'text' => $node_ref->{'text'} . "-Footnotes",
! 22174: 'file' => $node_ref->{'file'},
! 22175: 'info_offset' => $info_state->{'offset_in_file'},
! 22176: 'node' => 1,
! 22177: };
! 22178: $footnote_element->{'element_ref'} = $footnote_element;
! 22179: push @{$info_state->{'pending_tags'}}, $footnote_element;
! 22180: $footnote_text = info_default_node_line($footnote_element, $info_state);
! 22181: }
! 22182: else
! 22183: { # FIXME i18n?
! 22184: $footnote_text = " ---------- Footnotes ----------\n\n";
! 22185: $info_state->{'offset_in_file'} += info_default_byte_count($footnote_text);
! 22186: $info_state->{'line_count'} += 2;
! 22187: #print STDERR "MMMMMMMMMMMMMMMMMM $info_state->{'line_count'}\n";
! 22188: }
! 22189: while (@info_default_pending_footnotes)
! 22190: {
! 22191: #push @info_default_pending_footnotes, [$lines, $footnote_text, ${info_default_footnote_index}, $node_name, $footnote_info_state];
! 22192: my $footnote = shift @info_default_pending_footnotes;
! 22193: my $foot_nr = $footnote->{'footnote_index'};
! 22194: my $node_name = $footnote->{'node_name'};
! 22195: my $lines = $footnote->{'lines'};
! 22196: push @{$info_state->{'pending_tags'}}, {'anchor' => 1, 'text' => "${node_name}-Footnote-${foot_nr}", 'info_offset' => $info_state->{'offset_in_file'} };
! 22197: my $footnote_info_state = $footnote->{'footnote_info_state'};
! 22198: my $footnote_result = shift @{$lines};
! 22199: # this is used to keep track of the size when there were
! 22200: # leading spaces that will be removed below. This is only used
! 22201: # to get the difference, the value itself is not of use.
! 22202: my $initial_length = info_default_byte_count($footnote_result);
! 22203:
! 22204: $footnote_result =~ s/^\s*//;
! 22205: #$footnote_result = " ($foot_nr) " . $footnote_result;
! 22206: $footnote_result = ' ' x get_conf('paragraphindent') . $footnote_result;
! 22207: foreach my $footnote_pending_tags(@{$footnote_info_state->{'pending_tags'}})
! 22208: {
! 22209: $footnote_pending_tags->{'info_offset'} += $info_state->{'offset_in_file'} + info_default_byte_count($footnote_result) - $initial_length;
! 22210: push @{$info_state->{'pending_tags'}}, $footnote_pending_tags;
! 22211: }
! 22212: foreach my $footnote_pending_index_entry(@{$footnote_info_state->{'pending_index_entries'}})
! 22213: {
! 22214: #print STDERR "TTTTTTTTTTT($footnote_pending_index_entry->{'index_entry_reference'}->{'entry'}) $footnote_pending_index_entry->{'line_nr'} $info_state->{'line_count'}\n";
! 22215: $footnote_pending_index_entry->{'line_nr'} += $info_state->{'line_count'};
! 22216: $footnote_pending_index_entry->{'index_entry_reference'}->{'real_element'} = $footnote_element if (get_conf('footnotestyle') eq 'separate');
! 22217: }
! 22218: my $line;
! 22219: while (@$lines)
! 22220: {
! 22221: $line = shift @$lines;
! 22222: $footnote_result .= $line;
! 22223: }
! 22224: my ($line_passed, $end_of_line, $last_line, $text_indented, $blank_line) = info_default_count_lines($footnote_result);
! 22225: if ($line_passed == 0)
! 22226: {# certainly out of paragraph commands
! 22227: $footnote_result =~ s/\s*$//;
! 22228: $footnote_result .= "\n";
! 22229: $line_passed = 1;
! 22230: }
! 22231: unless (($last_line !~ /\S/ and $end_of_line) or ($blank_line))
! 22232: {
! 22233: $footnote_result .= "\n";
! 22234: $line_passed += 1;
! 22235: }
! 22236:
! 22237: $info_state->{'offset_in_file'} += info_default_byte_count($footnote_result);
! 22238: $info_state->{'line_count'} += $line_passed;
! 22239: $footnote_text .= $footnote_result;
! 22240: }
! 22241: print $fh "$footnote_text";
! 22242: }
! 22243: }
! 22244:
! 22245: sub info_default_end_section($$$)
! 22246: {
! 22247: my $fh = shift;
! 22248: my $end_foot_navigation = shift;
! 22249: my $element = shift;
! 22250: my $state = $Texi2HTML::THISDOC{'state'};
! 22251: my $info_state = info_default_get_state ($state);
! 22252:
! 22253: if (defined($Texi2HTML::THISDOC{'SPLIT_SIZE'}) and
! 22254: $info_state->{'offset_in_file'} > ($info_default_out_file_nr) * $Texi2HTML::THISDOC{'SPLIT_SIZE'})
! 22255: {
! 22256: if ($info_default_out_file_nr == 1)
! 22257: { # push also the first node, which is always the first pending_tags
! 22258: push @info_default_pending_indirect, {'file'=>"$Texi2HTML::THISDOC{'filename'}->{'top'}-$info_default_out_file_nr", 'offset' => $info_state->{'pending_tags'}->[0]->{'info_offset'} };
! 22259: }
! 22260: $info_default_out_file_nr++;
! 22261: # these file descriptors leak, but this allows the user to write a
! 22262: # foot navigation himself, otherwise he would write on a closed file
! 22263: # descriptor
! 22264: #close($Texi2HTML::THISDOC{'FH'});
! 22265: if (!$end_foot_navigation)
! 22266: {
! 22267: main::open_out_file("$Texi2HTML::THISDOC{'filename'}->{'top'}-$info_default_out_file_nr");
! 22268: #print STDERR "X-$info_default_out_file_nr: $info_state->{'offset_in_file'}\n";
! 22269: &$print_page_head($Texi2HTML::THISDOC{'FH'});
! 22270: push @info_default_pending_indirect, {'file'=>"$Texi2HTML::THISDOC{'filename'}->{'top'}-$info_default_out_file_nr", 'offset' => $info_state->{'offset_in_file'}};
! 22271: }
! 22272: }
! 22273: }
! 22274:
! 22275: sub info_default_one_section($$)
! 22276: {
! 22277: my $fh = shift;
! 22278: my $element = shift;
! 22279: &$print_section($fh, 1, 0, $element);
! 22280: &$print_page_foot($fh);
! 22281: }
! 22282:
! 22283: sub info_default_begin_special_region($$$)
! 22284: {
! 22285: my $region = shift;
! 22286: my $state = shift;
! 22287: my $lines = shift;
! 22288: my $info_state = info_default_get_state ($state);
! 22289: # reset paragraph_in_element_nr if out ofdocument formatting
! 22290: if ($state->{'outside_document'})
! 22291: {
! 22292: $info_state->{'paragraph_in_element_nr'} = 0;
! 22293: }
! 22294: }
! 22295:
! 22296: sub info_default_end_special_region($$$)
! 22297: {
! 22298: my $region = shift;
! 22299: my $state = shift;
! 22300: my $text = shift;
! 22301: my $info_state = info_default_get_state ($state);
! 22302: my $end = '';
! 22303: if (!$info_state->{'blank_line'})
! 22304: {
! 22305: $end = "\n";
! 22306: $info_state->{'offset_in_file'} += info_default_byte_count($end);
! 22307: }
! 22308: return $text.$end;
! 22309: }
! 22310:
! 22311: sub info_default_menu_link($$$$$$$$)
! 22312: {
! 22313: my $entry = shift;
! 22314: my $state = shift;
! 22315: my $href = shift;
! 22316: my $node = shift;
! 22317: my $title = shift;
! 22318: my $ending = shift;
! 22319: my $has_title = shift;
! 22320: my $command_stack = shift;
! 22321: my $preformatted = shift;
! 22322:
! 22323: $title = '' unless ($has_title);
! 22324: $title .= ':' if ($title ne '');
! 22325: my $result = "$MENU_SYMBOL$title$node$ending";
! 22326: return info_default_store_text($state,$result,'menu_entry');
! 22327: }
! 22328:
! 22329: # not used, menu is a normal preformatted command
! 22330: #sub info_default_menu_command($$$)
! 22331: #{
! 22332: # my $format = shift;
! 22333: # my $text = shift;
! 22334: # my $in_preformatted = shift;
! 22335: # return info_default_close_command(undef, $format, "* Menu:\n", undef, "\n");
! 22336: #}
! 22337:
! 22338: sub info_default_complex_format($$)
! 22339: {
! 22340: my $name = shift;
! 22341: my $text = shift;
! 22342: my ($begin, $end);
! 22343: if ($name eq 'menu')
! 22344: {
! 22345: main::line_warn(__("\@menu before first node"), $Texi2HTML::THISDOC{'line_nr'}) if (!defined($info_default_current_node));
! 22346: $begin = "* Menu:\n\n";
! 22347: }
! 22348: elsif ($name eq 'direntry')
! 22349: {
! 22350: main::line_warn(__("\@direntry after first node"), $Texi2HTML::THISDOC{'line_nr'}) if (defined($info_default_current_node));
! 22351: $begin = "START-INFO-DIR-ENTRY\n";
! 22352: $end = "END-INFO-DIR-ENTRY\n";
! 22353: }
! 22354: return info_default_close_command(undef, $name, $begin, $end);
! 22355: }
! 22356:
! 22357: sub info_default_quotation($$$$$)
! 22358: {
! 22359: my $command = shift;
! 22360: my $text = shift;
! 22361: my $argument_text = shift;
! 22362: my $argument_text_texi = shift;
! 22363: my $authors = shift;
! 22364:
! 22365: my $attribution;
! 22366: if ($authors)
! 22367: {
! 22368: $attribution = '';
! 22369: foreach my $author (@$authors)
! 22370: {
! 22371: my $author_texi = $author->{'author_texi'};
! 22372: chomp($author_texi);
! 22373: $attribution .= gdt("\@center --- \@emph{{author}}\n", {'author' => $author_texi}, {'duplicate' => 1, 'allow_paragraph' => 1});
! 22374: }
! 22375: }
! 22376:
! 22377: return info_default_close_command(undef, $command, undef, $attribution);
! 22378: }
! 22379:
! 22380: sub info_default_misc_commands($$$$$)
! 22381: {
! 22382: my $command = shift;
! 22383: my $line = shift;
! 22384: my $args = shift;
! 22385: my $stack = shift;
! 22386: my $state = shift;
! 22387:
! 22388: info_default_store_text($state,undef,$command) if ($command eq 'exdent' or $command eq 'noindent' or $command eq 'indent');
! 22389: return ($command, $line, undef);
! 22390: }
! 22391:
! 22392: sub info_default_external_ref($$$$$$$$$)
! 22393: {
! 22394: my $type = shift;
! 22395: my $section = shift;
! 22396: my $book = shift;
! 22397: my $file = shift;
! 22398: my $href = shift;
! 22399: my $cross_ref = shift;
! 22400: my $args_texi = shift;
! 22401: my $formatted_args = shift;
! 22402: my $node = shift;
! 22403:
! 22404: return info_default_inforef($formatted_args) if ($type eq 'inforef');
! 22405: return info_default_normal_reference($type, $formatted_args);
! 22406: }
! 22407:
! 22408: sub info_default_internal_ref($$$$$$$$)
! 22409: {
! 22410: my $type = shift;
! 22411: my $href = shift;
! 22412: my $short_name = shift;
! 22413: my $name = shift;
! 22414: my $is_section = shift;
! 22415: my $args_texi = shift;
! 22416: my $formatted_args = shift;
! 22417: my $element = shift;
! 22418:
! 22419: $formatted_args->[1] = $name if ($element->{'float'} and (!defined($formatted_args->[1]) or $formatted_args->[1] eq ''));
! 22420: return info_default_inforef($formatted_args) if ($type eq 'inforef');
! 22421: return info_default_normal_reference($type, $formatted_args);
! 22422: }
! 22423:
! 22424: sub info_default_normal_reference($$)
! 22425: {
! 22426: my $command = shift;
! 22427: my $formatted_args = shift;
! 22428: for (my $i = 0; $i < scalar(@$formatted_args); $i++)
! 22429: {
! 22430: $formatted_args->[$i] = undef if (defined($formatted_args->[$i]) and
! 22431: $formatted_args->[$i] =~ /^\s*$/);
! 22432: }
! 22433: my $node = $formatted_args->[0];
! 22434: # an error, should trigger the message: Undefined node `' in @ref.
! 22435: # avoid undef value and use an empty string instead.
! 22436: $node = '' if (!defined($node));
! 22437: my $name = $formatted_args->[1];
! 22438: $name = $formatted_args->[2] if (!defined($name));
! 22439: my $file = $formatted_args->[3];
! 22440: $file = '' if (!defined($file) and defined($formatted_args->[4]));
! 22441: $name = $node if (!defined($name) and defined($file));
! 22442: my $result = '*note ';
! 22443: $result = '*Note ' if ($command eq 'xref');
! 22444: if (defined($name))
! 22445: {
! 22446: $result .= "${name}: ";
! 22447: $result .= "($file)" if (defined($file));
! 22448: $result .= "$node";
! 22449: $result .= '.' if ($command eq 'pxref');
! 22450: }
! 22451: else
! 22452: {
! 22453: $result .= "${node}::";
! 22454: }
! 22455: return $result;
! 22456: }
! 22457:
! 22458: sub info_default_inforef($)
! 22459: {
! 22460: my $formatted_args = shift;
! 22461: return info_default_normal_reference('ref', [$formatted_args->[0], $formatted_args->[1], undef, $formatted_args->[2], 'dumb manual name']);
! 22462: }
! 22463:
! 22464: sub info_default_image_files($$$$)
! 22465: {
! 22466: my $base = shift;
! 22467: my $extension = shift;
! 22468: my $texi_base = shift;
! 22469: my $texi_extension = shift;
! 22470: my @files = ();
! 22471: return @files if (!defined($base) or ($base eq ''));
! 22472:
! 22473: if (defined($extension) and ($extension ne ''))
! 22474: {
! 22475: push @files, ["${base}$extension", "${texi_base}$extension"];
! 22476: push @files, ["$base.$extension", "$texi_base.$extension"];
! 22477: }
! 22478: foreach my $ext (@IMAGE_EXTENSIONS)
! 22479: {
! 22480: push @files, ["$base.$ext", "$texi_base.$ext"];
! 22481: }
! 22482: return @files;
! 22483: }
! 22484:
! 22485: sub info_default_image($$$$$$$$$$$$$$$$$)
! 22486: {
! 22487: my $file = shift;
! 22488: my $base = shift;
! 22489: my $preformatted = shift;
! 22490: my $file_name = shift;
! 22491: my $alt = shift;
! 22492: my $width = shift;
! 22493: my $height = shift;
! 22494: my $raw_alt = shift;
! 22495: my $extension = shift;
! 22496: my $working_dir = shift;
! 22497: my $file_path = shift;
! 22498: my $in_paragraph = shift;
! 22499: my $file_locations = shift;
! 22500: my $base_simple_format = shift;
! 22501: my $extension_simple_format = shift;
! 22502: my $file_name_simple_format = shift;
! 22503: my $line_nr = shift;
! 22504:
! 22505: my $txt_path;
! 22506: my $found_file;
! 22507:
! 22508: my @extensions = @IMAGE_EXTENSIONS;
! 22509: if (defined($extension) and ($extension ne ''))
! 22510: {
! 22511: unshift @extensions, ".$extension";
! 22512: unshift @extensions, "$extension";
! 22513: }
! 22514: else
! 22515: {
! 22516: $extension = undef;
! 22517: }
! 22518: my $file_found_index = undef;
! 22519: my $file_index = 0;
! 22520: foreach my $file_location (@$file_locations)
! 22521: {
! 22522: my ($file_located, $path, $file_simple_format) = @$file_location;
! 22523: my $extension = shift @extensions;
! 22524: if (defined($path))
! 22525: {
! 22526: if ($extension eq 'txt' and !defined($txt_path))
! 22527: {
! 22528: $txt_path = $path;
! 22529: }
! 22530: elsif (!defined($found_file))
! 22531: {
! 22532: $found_file = [$file_located, $extension, $file_simple_format];
! 22533: $file_found_index = $file_index;
! 22534: }
! 22535: }
! 22536: $file_index++;
! 22537: }
! 22538:
! 22539: my $text;
! 22540: if (defined($txt_path))
! 22541: {
! 22542: if (open(TXT, "<$txt_path"))
! 22543: {
! 22544: if (defined($Texi2HTML::THISDOC{'IN_ENCODING'}) and $USE_UNICODE)
! 22545: {
! 22546: binmode(TXT, ":encoding($Texi2HTML::THISDOC{'IN_ENCODING'})");
! 22547: }
! 22548: $text='[' if ($in_paragraph or $preformatted);
! 22549: while (my $img_txt = <TXT>)
! 22550: {
! 22551: $text .= $img_txt;
! 22552: }
! 22553: # remove last end of line
! 22554: chomp ($text);
! 22555: $text .= ']' if ($in_paragraph or $preformatted);
! 22556: close(TXT);
! 22557: }
! 22558: else
! 22559: {
! 22560: main::line_warn (sprintf(__("\@image file `%s' unreadable: %s"), $txt_path, $!), $line_nr);
! 22561: }
! 22562: }
! 22563: elsif (!defined($found_file))
! 22564: {
! 22565: main::line_warn (sprintf(__("Cannot find \@image file `%s.txt'"), $base), $line_nr);
! 22566: }
! 22567: if (defined($found_file) and (!defined($extension) or $file_found_index <= 1))
! 22568: {
! 22569: my $filename = $found_file->[2];
! 22570: $filename =~ s/\\/\\\\/g;
! 22571: $filename =~ s/\"/\\\"/g;
! 22572: my $result = "\x{00}\x{08}[image src=\"$filename\"";
! 22573: if (defined($alt))
! 22574: {
! 22575: $alt =~ s/\\/\\\\/g;
! 22576: $alt =~ s/\"/\\\"/g;
! 22577: $result .= " alt=\"$alt\"";
! 22578: }
! 22579: if (defined($text))
! 22580: {
! 22581: $text =~ s/\\/\\\\/g;
! 22582: $text =~ s/\"/\\\"/g;
! 22583: $result .= " text=\"$text\"";
! 22584: }
! 22585: $result .= "\x{00}\x{08}]";
! 22586: return $result;
! 22587: }
! 22588: return $text if (defined($text));
! 22589: return '';
! 22590: }
! 22591:
! 22592: sub info_default_printindex($$)
! 22593: {
! 22594: my $index_name = shift;
! 22595: my $printindex = shift;
! 22596: %info_default_index_entries_counts = ();
! 22597: return info_default_store_text(undef,t2h_GPL_default_printindex($index_name,$printindex),'printindex');
! 22598: }
! 22599:
! 22600: sub info_default_print_index($$)
! 22601: {
! 22602: my $text = shift;
! 22603: my $name = shift;
! 22604: my $state = $Texi2HTML::THISDOC{'state'};
! 22605: my $info_state = info_default_get_state ($state);
! 22606: my $before = '';
! 22607: if (!$info_state->{'blank_line'})
! 22608: {
! 22609: $before = "\n";
! 22610: }
! 22611: return $before if (!defined($text));
! 22612: my $result = "\x{00}\x{08}[index\x{00}\x{08}]\n* Menu:\n\n" .$text."\n";
! 22613: return $before.$result;
! 22614: }
! 22615:
! 22616: sub info_default_index_letter($$$)
! 22617: {
! 22618: my $letter = shift;
! 22619: my $id = shift;
! 22620: my $text = shift;
! 22621: return $text;
! 22622: }
! 22623:
! 22624: sub info_default_index_entry_label($$$$$$$$$)
! 22625: {
! 22626: my $identifier = shift;
! 22627: my $preformatted = shift;
! 22628: my $entry = shift;
! 22629: my $index_name = shift;
! 22630: my $index_command = shift;
! 22631: my $texi_entry = shift;
! 22632: my $formatted_entry = shift;
! 22633: my $in_region_not_in_output = shift;
! 22634: my $index_entry_ref = shift;
! 22635:
! 22636: #return '' if ($index_entry_ref->{'hidden'});
! 22637: #return '' if (!$index_entry_ref->{'seen_in_output'} and defined($index_entry_ref->{'region'}));
! 22638: return '' if ($in_region_not_in_output or !defined($index_entry_ref->{'index_name'}));
! 22639: main::line_warn(sprintf(__("Entry for index `%s' outside of any node"), $index_entry_ref->{'index_name'}), $Texi2HTML::THISDOC{'line_nr'}) if (!defined($info_default_current_node) and !$Texi2HTML::THISDOC{'state'}->{'outside_document'});
! 22640: my $index_entry_stored = {'index_entry_reference' => $index_entry_ref, 'index_command' => $index_command, 'texi_entry' => $texi_entry};
! 22641: return info_default_store_text(undef, undef, 'index_label', $index_entry_stored);
! 22642: }
! 22643:
! 22644: sub info_default_index_entry($$$$$$$$$$)
! 22645: {
! 22646: my $text_href = shift;
! 22647: my $entry = shift;
! 22648: my $element_href = shift;
! 22649: my $element_text = shift;
! 22650: my $entry_file = shift;
! 22651: my $current_element_file = shift;
! 22652: my $entry_target = shift;
! 22653: my $entry_element_target = shift;
! 22654: my $in_region_not_in_output = shift;
! 22655: my $index_entry_ref = shift;
! 22656:
! 22657: #return '' if ($index_entry_ref->{'hidden'});
! 22658: #return '' if (!$index_entry_ref->{'seen_in_output'} and defined($index_entry_ref->{'region'}));
! 22659: return '' if ($in_region_not_in_output);
! 22660: $entry = main::substitute_line($index_entry_ref->{'texi'}, "index entry in \@printindex");
! 22661: return '' if ($entry =~ /^\s*$/);
! 22662:
! 22663: my $entry_nr = '';
! 22664: if (!defined($info_default_index_entries_counts{$entry}))
! 22665: {
! 22666: $info_default_index_entries_counts{$entry} = 0;
! 22667: }
! 22668: else
! 22669: {
! 22670: $info_default_index_entries_counts{$entry} ++;
! 22671: $entry_nr = ' <'.$info_default_index_entries_counts{$entry}.'>';
! 22672: }
! 22673:
! 22674: my $result = "* $entry${entry_nr}: ";
! 22675: if (t2h_default_string_width($result) < $info_default_index_length_to_node)
! 22676: {
! 22677: $result .= ' ' x($info_default_index_length_to_node - t2h_default_string_width($result));
! 22678: }
! 22679:
! 22680: #print STDERR "DDDDDDDDDDD $index_entry_ref `$index_entry_ref->{'texi'}'\n";
! 22681: my $info_index_entry_ref = $info_default_index_entries{$index_entry_ref};
! 22682: my $line_nr = $info_index_entry_ref->{'line_nr'};
! 22683:
! 22684: my $real_element_text;
! 22685: my $element = $index_entry_ref->{'real_element'};
! 22686: # in case $element->{'text'} is not defined, it certainly means that we
! 22687: # are n a special elemet, most likely the virtual element appearing
! 22688: # before anything else
! 22689: if (!defined($element->{'text'}))
! 22690: {
! 22691: $real_element_text = gdt('(outside of any node)');
! 22692: $line_nr = 0;
! 22693: }
! 22694: else
! 22695: {
! 22696: $element = $element->{'element_ref'} if ($element->{'element_ref'});
! 22697: $real_element_text = $element->{'text'};
! 22698: # this happens for index entries appearing after @printindex. In that case
! 22699: # it is considered that they are at the beginning of the node.
! 22700: $line_nr = 3 if (defined($line_nr) and $line_nr < 3);
! 22701: $line_nr = 4 if (!defined($line_nr));
! 22702: }
! 22703: $result .= $real_element_text . '.';
! 22704: my $max_len = $info_default_index_line_string_length{$index_entry_ref->{'index_name'}};
! 22705: $max_len = t2h_default_string_width($line_nr) if (!defined($max_len));
! 22706: my $line_nr_spaces = sprintf("%${max_len}d", $line_nr);
! 22707: my $line_part = "(line ${line_nr_spaces})";
! 22708: #print STDERR "GGGGGGGGGG name: $index_entry_ref->{'index_name'} max: ${max_len} line_nr: `$line_nr' line_nr_spaces `$line_nr_spaces' $line_part \n";
! 22709: if (t2h_default_string_width($result)+t2h_default_string_width($line_part) +1 > get_conf('fillcolumn'))
! 22710: {
! 22711: $result .= "\n" . ' ' x (get_conf('fillcolumn') - t2h_default_string_width($line_part)) ;
! 22712: }
! 22713: else
! 22714: {
! 22715: $result .= ' ' x (get_conf('fillcolumn') - t2h_default_string_width($line_part) - t2h_default_string_width($result));
! 22716: }
! 22717: $result .= "$line_part\n";
! 22718:
! 22719: return $result;
! 22720: }
! 22721:
! 22722: sub info_default_index_summary($$)
! 22723: {
! 22724: my $alpha = shift;
! 22725: my $nonalpha = shift;
! 22726:
! 22727: return '';
! 22728: }
! 22729:
! 22730: sub info_default_summary_letter
! 22731: {
! 22732: return '';
! 22733: }
! 22734:
! 22735: sub info_default_foot_line_and_ref($$$$$$$$)
! 22736: {
! 22737: my $foot_num = shift;
! 22738: my $relative_num = shift;
! 22739: my $footid = shift;
! 22740: my $docid = shift;
! 22741: my $from_file = shift;
! 22742: my $footnote_file = shift;
! 22743: my $lines = shift;
! 22744: my $state = shift;
! 22745:
! 22746: my $footnote_state = $Texi2HTML::THISDOC{'state'};
! 22747: my $footnote_info_state = info_default_get_state ($footnote_state);
! 22748:
! 22749: my $footnote_text = "($info_default_footnote_index)";
! 22750: $footnote_text = "($NO_NUMBER_FOOTNOTE_SYMBOL)" if (!$NUMBER_FOOTNOTES);
! 22751: my $node_name;
! 22752: $node_name = '';
! 22753: if (defined($info_default_current_node))
! 22754: {
! 22755: $node_name = $info_default_current_node->{'text'};
! 22756: }
! 22757: else
! 22758: { # i18n
! 22759: # no warning when outside of document, for footnotes in
! 22760: # titlepage and copying
! 22761: main::line_error(__("Footnote defined without parent node"), $Texi2HTML::THISDOC{'line_nr'}) unless ($footnote_state->{'outside_document'});
! 22762: #print STDERR "".main::context_string()."\n";
! 22763: }
! 22764: if (get_conf('footnotestyle') eq 'separate')
! 22765: {
! 22766: $footnote_text .= ' (' . info_default_normal_reference('pxref', ["${node_name}-Footnote-${info_default_footnote_index}"]) . ')';
! 22767: }
! 22768: push @info_default_pending_footnotes, {'lines' => $lines,
! 22769: 'footnote_text' => $footnote_text,
! 22770: 'footnote_index' => ${info_default_footnote_index},
! 22771: 'node_name' => $node_name,
! 22772: 'footnote_info_state' => $footnote_info_state}
! 22773: unless ($state->{'outside_document'} or (defined($state->{'multiple_pass'}) and $state->{'multiple_pass'} > 0));
! 22774: return ([], $footnote_text);
! 22775: }
! 22776:
! 22777: sub info_default_foot_lines($)
! 22778: {
! 22779: my $lines = shift;
! 22780: #my $state = $Texi2HTML::THISDOC{'state'};
! 22781: #my $info_state = info_default_get_state ($state);
! 22782: @$lines = ();
! 22783: }
! 22784:
! 22785: # remark: table_item is the html one, but it gets added to the table text
! 22786: # on the stack, and is ignored there (in info_default_format).
! 22787: sub info_default_format_list_item_texi($$$$)
! 22788: {
! 22789: my $format = shift;
! 22790: my $line = shift;
! 22791: my $prepended = shift;
! 22792: my $command = shift;
! 22793: my $number = shift;
! 22794:
! 22795: my $open_command = 0;
! 22796: my $result_line;
! 22797: $command = 'bullet' if ((!defined($command) or $command eq '') and (!defined($prepended) or $prepended eq '') and $format eq 'itemize');
! 22798: $prepended = "\@$command\{\}" if (defined($command) and $command ne '');
! 22799: $prepended = "$number." if (defined($number) and $number ne '');
! 22800:
! 22801: $line =~ s/^\s*//;
! 22802:
! 22803: if (defined($command) and $command ne '' and $format ne 'itemize')
! 22804: {
! 22805: #@*table
! 22806: $line =~ s/\s*$//;
! 22807: if (exists ($style_map{$command}))
! 22808: {
! 22809: $result_line = "\@$command\{$line\}\n";
! 22810: }
! 22811: elsif (exists ($things_map{$command}))
! 22812: {
! 22813: $result_line = "\@$command\{\} $line\n";
! 22814: }
! 22815: else
! 22816: {
! 22817: $result_line = "\@$command $line\n";
! 22818: }
! 22819: }
! 22820: # elsif (defined($prepended) and $prepended ne '')
! 22821: # { # @enumerate and @itemize
! 22822: # $prepended =~ s/^\s*//;
! 22823: # $prepended =~ s/\s*$//;
! 22824: # $result_line = $prepended . ' ' . $line;
! 22825: # }
! 22826:
! 22827: return ($result_line, $open_command);
! 22828: }
! 22829:
! 22830: sub info_default_list_item($$$$$$$$$$$$)
! 22831: {
! 22832: my $text = shift;
! 22833: my $format = shift;
! 22834: my $command = shift;
! 22835: my $formatted_command = shift;
! 22836: my $item_nr = shift;
! 22837: my $enumerate_style = shift;
! 22838: my $number = shift;
! 22839: my $prepended = shift;
! 22840: my $prepended_formatted = shift;
! 22841: my $only_inter_item_commands = shift;
! 22842: my $before_items = shift;
! 22843: my $item_command = shift;
! 22844:
! 22845: # my $prepend = '';
! 22846: # if (defined($formatted_command) and $formatted_command ne '')
! 22847: # {
! 22848: # $prepend = $formatted_command;
! 22849: # }
! 22850: # return $prepend . $text;
! 22851: # $command = 'bullet' if ((!defined($command) or $command eq '') and (!defined($prepended) or $prepended eq '') and $format eq 'itemize');
! 22852: $formatted_command = $things_map{'bullet'} if ((!defined($command) or $command eq '') and (!defined($prepended) or $prepended eq '') and $format eq 'itemize');
! 22853:
! 22854: if ($format !~ /table$/)
! 22855: {
! 22856: my $result = '';
! 22857: if ($format eq 'enumerate')
! 22858: {
! 22859: $result = $number.'.';
! 22860: }
! 22861: elsif ($format eq 'itemize')
! 22862: {
! 22863: if (defined($formatted_command) and $formatted_command ne '')
! 22864: {
! 22865: $result = $formatted_command;
! 22866: }
! 22867: elsif (defined ($prepended_formatted) and $prepended_formatted ne '')
! 22868: {
! 22869: $prepended_formatted =~ s/^\s*//;
! 22870: $prepended_formatted =~ s/\s*$//;
! 22871: $result = $prepended_formatted;
! 22872: }
! 22873: }
! 22874: else
! 22875: {
! 22876: $result = '';
! 22877: }
! 22878: $result .= ' ' if ($result ne '');
! 22879: return info_default_close_command (undef, $item_command, $result);
! 22880: }
! 22881: return $text;
! 22882: }
! 22883:
! 22884: sub info_default_format($$$)
! 22885: {
! 22886: my $tag = shift;
! 22887: my $element = shift;
! 22888: my $text = shift;
! 22889:
! 22890: # currently no command has something else than '' as $element.
! 22891: # notice that any text is discarded
! 22892: $element = undef if ($element eq '');
! 22893: my $element_end = $element;
! 22894: if (defined($element) and $element =~ /^(\w+)(\s+)(.+)/)
! 22895: {
! 22896: $element = $1;
! 22897: $element_end = $2;
! 22898: }
! 22899: return info_default_close_command(undef, $tag, $element, $element_end);
! 22900: }
! 22901:
! 22902: sub info_default_tab_item_texi($$$$$$)
! 22903: {
! 22904: my $command = shift;
! 22905: my $commands_stack = shift;
! 22906: my $stack = shift;
! 22907: my $state = shift;
! 22908: my $line = shift;
! 22909: my $line_nr = shift;
! 22910:
! 22911: $line =~ s/^\s*//;
! 22912: my $format;
! 22913: my $info_state = info_default_get_state ($state);
! 22914: #$format = $commands_stack->[-1] if (defined($commands_stack) and @$commands_stack and $commands_stack->[-1]);
! 22915: my ($parent_format, $in_format) = info_default_parent_format($info_state->{'current'});
! 22916: print STDERR "Not in_format in info_default_tab_item_texi\n" if (!$in_format);
! 22917: $format = $parent_format->{'command'};
! 22918: # in case of an @item or @tab outside of any format $format will be
! 22919: # undefined, or not multitable for a @tab.
! 22920: # however the main program still do as if something was opened, plus
! 22921: # it is checked there that the nesting is correct
! 22922: #return $line if (!defined($format) or $command eq 'tab' and $format ne 'multitable');
! 22923: #print STDERR "tab_item_texi $format $command $commands_stack, $stack, $state, $line, ".main::format_line_number($line_nr)."\n";
! 22924: if ($format eq 'multitable')
! 22925: { # even if it is a tab, if it is not already in a multitable_row, one
! 22926: # should be started
! 22927: if ($command ne 'tab' or $info_state->{'current'}->{'command'} ne 'multitable_row')
! 22928: {
! 22929: info_default_open_command($state, 'multitable_row');
! 22930: }
! 22931: info_default_open_command($state, 'multitable_cell');
! 22932: }
! 22933: elsif ($format =~ /table$/)
! 22934: {
! 22935: info_default_store_text ($state, undef, $command, {'format_name' => $format});
! 22936: }
! 22937: else
! 22938: {
! 22939: info_default_open_command ($state, $command, {'format_name' => $format});
! 22940: }
! 22941: # this should have already been done for @item when the line
! 22942: # is modified by the @-command and so on.
! 22943: return $line;
! 22944: }
! 22945:
! 22946: sub info_default_sp($$)
! 22947: {
! 22948: my $number = shift;
! 22949: my $preformatted = shift;
! 22950: my $result = "\n" x $number;
! 22951: return info_default_store_text(undef,$result,'sp');
! 22952: }
! 22953:
! 22954: sub info_default_paragraph_style_command($$)
! 22955: {
! 22956: my $format = shift;
! 22957: my $text = shift;
! 22958: return info_default_close_command(undef, $format);
! 22959: }
! 22960:
! 22961: sub info_default_row($$$$$$$$)
! 22962: {
! 22963: my $text = shift;
! 22964: my $macro = shift;
! 22965: my $columnfractions = shift;
! 22966: my $prototype_row = shift;
! 22967: my $prototype_lengths = shift;
! 22968: my $column_number = shift;
! 22969: my $only_inter_item_commands = shift;
! 22970: my $before_items = shift;
! 22971: #print STDERR "info_default_row: $text\n";
! 22972:
! 22973: return info_default_close_command(undef, 'multitable_row', undef, undef, {'item_command' => $macro});
! 22974: }
! 22975:
! 22976: sub info_default_cell($$$$$$$$)
! 22977: {
! 22978: my $text = shift;
! 22979: my $row_macro = shift;
! 22980: my $columnfractions = shift;
! 22981: my $prototype_row = shift;
! 22982: my $prototype_lengths = shift;
! 22983: my $column_number = shift;
! 22984: my $only_inter_item_commands = shift;
! 22985: my $before_items = shift;
! 22986:
! 22987: # in general, when before_items, there will be no call to the function
! 22988: # since there should never be a text sent back, so that this
! 22989: # function will not be called for the first row (the multitable title).
! 22990: # However, if there is a @tab before the first @item, the main program
! 22991: # is less careful and closes the cell in any case, so before_items
! 22992: # has to be checked for that case.
! 22993: return info_default_close_command(undef, 'multitable_cell') unless ($before_items);
! 22994: }
! 22995:
! 22996: sub info_default_table_list($$$$$$$$$)
! 22997: {
! 22998: my $format_command = shift;
! 22999: my $text = shift;
! 23000: my $command = shift;
! 23001: my $formatted_command = shift;
! 23002: # enumerate
! 23003: my $item_nr = shift;
! 23004: my $enumerate_style = shift;
! 23005: # itemize
! 23006: my $prepended = shift;
! 23007: my $prepended_formatted = shift;
! 23008: # multitable
! 23009: my $columnfractions = shift;
! 23010: my $prototype_row = shift;
! 23011: my $prototype_lengths = shift;
! 23012: my $column_number = shift;
! 23013:
! 23014: die "BUG: $format_command item_nr undef\n" if (!defined($item_nr));
! 23015:
! 23016: return info_default_close_command(undef, $format_command, undef, undef, {'total_item_nr' => $item_nr}) if ($format_command ne 'multitable');
! 23017:
! 23018: my $columnsize = [];
! 23019: if (defined($prototype_lengths) and @$prototype_lengths)
! 23020: {
! 23021: $columnsize = [ @$prototype_lengths ];
! 23022: }
! 23023: elsif (defined($columnfractions) and @$columnfractions)
! 23024: {
! 23025: foreach my $fraction (@$columnfractions)
! 23026: {
! 23027: push @$columnsize, int($fraction * get_conf('fillcolumn') +0.5);
! 23028: }
! 23029: }
! 23030: else
! 23031: { # empty multitable
! 23032: #print STDERR "Empty multitable?\n";
! 23033: }
! 23034:
! 23035: return info_default_close_command(undef, $format_command, undef, undef, {'columns_size' => $columnsize, 'total_item_nr' => $item_nr});
! 23036: }
! 23037:
! 23038: sub info_default_def_item($$$)
! 23039: {
! 23040: my $text = shift;
! 23041: my $only_inter_item_commands = shift;
! 23042: my $command = shift;
! 23043:
! 23044: my $format = 'deff_item';
! 23045: $format = 'deff_itemx' if ($command =~ /x$/);
! 23046: return info_default_close_command(undef, $format);
! 23047: }
! 23048:
! 23049: sub info_default_def_line($$$$$$$$$$$$$$$$)
! 23050: {
! 23051: my $category_prepared = shift;
! 23052: my $name = shift;
! 23053: my $type = shift;
! 23054: my $arguments = shift;
! 23055: my $index_label = shift;
! 23056: my $arguments_array = shift;
! 23057: my $arguments_type_array = shift;
! 23058: my $unformatted_arguments_array = shift;
! 23059: my $command = shift;
! 23060: my $class_name = shift;
! 23061: my $category = shift;
! 23062: my $class = shift;
! 23063: my $style = shift;
! 23064: my $original_command = shift;
! 23065:
! 23066: $name = '' if (!defined($name) or ($name =~ /^\s*$/));
! 23067: $type = '' if (!defined($type) or $type =~ /^\s*$/);
! 23068: $arguments = '' if (!defined($arguments) or $arguments =~ /^\s*$/);
! 23069:
! 23070: my $type_name = '';
! 23071: $type_name .= "$type " if ($type ne '');
! 23072: $type_name .= $name if ($name ne '');
! 23073:
! 23074: my $result = " -- $category_prepared: ${type_name}$arguments";
! 23075: $result =~ s/\s*$//;
! 23076: $result .= "\n";
! 23077: my $state = $Texi2HTML::THISDOC{'state'};
! 23078: info_default_store_text(undef,$result,"${command}_line",{'definition_line' => 1});
! 23079: my $format = 'deff_item';
! 23080: $format = 'deff_itemx' if ($original_command =~ /x$/);
! 23081: return info_default_open_command($state, $format);
! 23082: }
! 23083:
! 23084: sub info_default_def($$)
! 23085: {
! 23086: my $text = shift;
! 23087: my $command = shift;
! 23088: return info_default_close_command(undef, $command);
! 23089: }
! 23090:
! 23091: sub info_default_float($$$$$)
! 23092: {
! 23093: my $text = shift;
! 23094: my $float = shift;
! 23095: my $caption = shift;
! 23096: my $shortcaption = shift;
! 23097:
! 23098: my $additional_arguments;
! 23099: if (exists($float->{'id'}))
! 23100: {
! 23101: $additional_arguments->{'anchor_reference'} = $float;
! 23102: main::line_warn(__("float reference outside of any node, it won't be registered"), $Texi2HTML::THISDOC{'line_nr'}) if (!defined($info_default_current_node) and !$Texi2HTML::THISDOC{'state'}->{'outside_document'});
! 23103: }
! 23104: my $caption_text = '';
! 23105:
! 23106: if (defined($float->{'caption_texi'}))
! 23107: {
! 23108: $caption_text = $caption;
! 23109: }
! 23110: elsif (defined($float->{'shortcaption_texi'}))
! 23111: {
! 23112: $caption_text = $shortcaption;
! 23113: }
! 23114: elsif (defined($caption))
! 23115: {
! 23116: $caption_text = $caption;
! 23117: }
! 23118:
! 23119: #return $caption_text;
! 23120: return info_default_close_command(undef, 'float', undef, $caption_text, $additional_arguments);
! 23121: }
! 23122:
! 23123: sub info_default_listoffloats_entry($$$$)
! 23124: {
! 23125: my $style_texi = shift;
! 23126: my $float = shift;
! 23127: my $float_style = shift;
! 23128: my $caption = shift;
! 23129: my $href = shift;
! 23130:
! 23131: my @lines = split /^/, $caption;
! 23132: $caption = $lines[0];
! 23133: $caption = '' if (!defined($caption));
! 23134: chomp ($caption);
! 23135:
! 23136: my $result = '';
! 23137: #$caption .= ':' if ($caption ne '');
! 23138: my $caption_entry = "* $float_style: $float->{'text'}.";
! 23139: if (t2h_default_string_width($caption_entry) > $info_default_listoffloat_caption_entry_length)
! 23140: {
! 23141: $caption_entry .= "\n" . ' ' x $info_default_listoffloat_caption_entry_length;
! 23142: }
! 23143: else
! 23144: {
! 23145: $caption_entry .= ' ' x ($info_default_listoffloat_caption_entry_length - length($caption_entry));
! 23146: }
! 23147: my $width = $info_default_listoffloat_caption_entry_length;
! 23148: while ($caption =~ s/^(\S+\s*)//)
! 23149: {
! 23150: my $new_word = $1;
! 23151: if ((t2h_default_string_width($new_word) + $width) > get_conf('fillcolumn') - 3)
! 23152: {
! 23153: $caption_entry .= $info_default_listoffloat_append;
! 23154: last;
! 23155: }
! 23156: else
! 23157: {
! 23158: $caption_entry .= $new_word;
! 23159: $width += t2h_default_string_width($new_word);
! 23160: }
! 23161: }
! 23162: return $caption_entry. "\n";
! 23163: }
! 23164:
! 23165: sub info_default_listoffloats($$$)
! 23166: {
! 23167: my $style_texi = shift;
! 23168: my $style = shift;
! 23169: my $float_entries = shift;
! 23170:
! 23171: my $state = $Texi2HTML::THISDOC{'state'};
! 23172: my $info_state = info_default_get_state ($state);
! 23173: my $result = "* Menu:\n\n";
! 23174: foreach my $float_entry (@$float_entries)
! 23175: {
! 23176: $result .= $float_entry;
! 23177: }
! 23178: my ($parent_format, $in_format);
! 23179: ($parent_format, $in_format) = info_default_parent_format($info_state->{'current'});
! 23180: #print STDERR "\@listoffloats not at top level\n" if ($in_format);
! 23181: info_default_increment_paragraph ($in_format, $parent_format, $info_state, 'listoffloats');
! 23182: return info_default_store_text($state,$result,'listoffloats');
! 23183: }
! 23184:
! 23185: sub info_default_raw($$)
! 23186: {
! 23187: my $style = shift;
! 23188: my $text = shift;
! 23189: my $expanded = 1 if (grep {$style eq $_} @EXPAND);
! 23190: # no warning for unknown raw formats
! 23191: if ($style eq 'verbatim' or $style eq 'verbatiminclude' or $expanded)
! 23192: {
! 23193: return info_default_store_text(undef, $text, $style, {'raw_command' => 1});
! 23194: }
! 23195: return '';
! 23196: }
! 23197:
! 23198: sub info_default_line_command($$$$)
! 23199: {
! 23200: my $command = shift;
! 23201: my $arg_text = shift;
! 23202: my $arg_texi = shift;
! 23203: my $state = shift;
! 23204:
! 23205: main::line_warn(__("\@dircategory after first node"), $Texi2HTML::THISDOC{'line_nr'}) if (defined($info_default_current_node));
! 23206: return '' if ($arg_text eq '');
! 23207: $info_default_dir_specification .= "INFO-DIR-SECTION $arg_text\n";
! 23208: return '';
! 23209: }
! 23210:
! 23211: sub info_default_unknown_style($$$$$)
! 23212: {
! 23213: my $command = shift;
! 23214: my $text = shift;
! 23215: my $state = shift;
! 23216: my $no_close = shift;
! 23217: my $no_open = shift;
! 23218:
! 23219: my ($result, $result_text, $message);
! 23220: $result_text = info_default_close_command(undef, $command, undef, undef, undef);
! 23221: $message = "Unknown command with braces `\@$command'" if (!$no_open);
! 23222: return (1, $result_text, $message);
! 23223: }
! 23224:
! 23225: 1;
! 23226:
! 23227: require "$T2H_HOME/formats/info.init"
! 23228: if ($0 =~ /\.pl$/ &&
! 23229: -e "$T2H_HOME/formats/info.init" && -r "$T2H_HOME/formats/info.init");
! 23230:
! 23231: # @INIT_DOCBOOK@
! 23232: #+##############################################################################
! 23233: #
! 23234: # docbook.init: convert to docbook
! 23235: #
! 23236: # Copyright (C) 2008, 2009 Patrice Dumas <pertusus@free.fr>
! 23237: #
! 23238: # This program is free software; you can redistribute it and/or modify
! 23239: # it under the terms of the GNU General Public License as published by
! 23240: # the Free Software Foundation; either version 2 of the License, or
! 23241: # (at your option) any later version.
! 23242: #
! 23243: # This program is distributed in the hope that it will be useful,
! 23244: # but WITHOUT ANY WARRANTY; without even the implied warranty of
! 23245: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 23246: # GNU General Public License for more details.
! 23247: #
! 23248: # You should have received a copy of the GNU General Public License
! 23249: # along with this program; if not, write to the Free Software
! 23250: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
! 23251: # 02110-1301 USA
! 23252: #
! 23253: #-##############################################################################
! 23254:
! 23255:
! 23256: # regarding sections and nodes, in docbook we don't care at all about the
! 23257: # splitting done in the main program. When there is a node, it is recorded as
! 23258: # being pending. When there is a section it is opened, and closed when
! 23259: # there is the next section or end of file.
! 23260:
! 23261: use strict;
! 23262:
! 23263: my %docbook_complex_format;
! 23264: my $kept_footnote_function;
! 23265: my $docbook_in_footnote;
! 23266: my %docbook_sections;
! 23267: my %def_format_docbook;
! 23268: my %def_argument_types_docbook;
! 23269:
! 23270: my $docbook_pending_node_id;
! 23271: my $docbook_current_section;
! 23272: my @docbook_multitable_stack = ();
! 23273: my @docbook_table_stack = ();
! 23274: my @docbook_special_quotation;
! 23275:
! 23276:
! 23277: sub docbook_default_load(;$)
! 23278: {
! 23279: my $from_command_line = shift;
! 23280:
! 23281: t2h_default_set_variables_xml();
! 23282: $DOCTYPE = '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
! 23283: <!ENTITY tex "TeX">
! 23284: <!ENTITY latex "LaTeX">
! 23285: ]>';
! 23286: @T2H_FORMAT_EXPAND = ('docbook');
! 23287: @IMAGE_EXTENSIONS = ('eps', 'gif', 'jpg', 'jpeg', 'pdf', 'png', 'svg', 'txt');
! 23288: $INLINE_INSERTCOPYING = 1;
! 23289: # this should lead to end_section being only called at the end of sectioning
! 23290: $USE_NODES = 0;
! 23291: $USE_SECTIONS = 1;
! 23292:
! 23293: $SHOW_MENU = 0;
! 23294: $SHOW_TITLE = 0;
! 23295: $HEADERS = 0;
! 23296: # certainly irrelevant
! 23297: $SIMPLE_MENU = 0;
! 23298:
! 23299: t2h_default_push_handler(\&docbook_initialize_variables, \@command_handler_init);
! 23300:
! 23301: %style_map = ();
! 23302: t2h_default_copy_style_map (\%default_style_map, \%style_map);
! 23303: foreach my $accent_command ('tieaccent', 'dotless', keys(%unicode_accents))
! 23304: {
! 23305: $style_map{$accent_command} = { 'function' => \&xml_default_accent };
! 23306: }
! 23307:
! 23308: delete $style_map{'sc'}->{'inline_attribute'};
! 23309: # FIXME there is a code element in v4.3
! 23310: $style_map{'code'}->{'inline_attribute'} = 'literal';
! 23311: $style_map{'strong'}->{'inline_attribute'} = 'emphasis role="bold"';
! 23312: $style_map{'kbd'}->{'inline_attribute'} = 'userinput';
! 23313: $style_map{'w'}->{'end'} = '<!-- /@w -->';
! 23314: $style_map{'='}->{'function'} = \&docbook_macron;
! 23315: $style_map{'b'}->{'inline_attribute'} = 'emphasis role="bold"';
! 23316: $style_map{'cite'}->{'inline_attribute'} = 'citetitle';
! 23317: $style_map{'command'}->{'inline_attribute'} = 'command';
! 23318: $style_map{'dfn'}->{'inline_attribute'} = 'firstterm';
! 23319: $style_map{'emph'}->{'inline_attribute'} = 'emphasis';
! 23320: $style_map{'env'}->{'inline_attribute'} = 'envar';
! 23321: $style_map{'file'}->{'inline_attribute'} = 'filename';
! 23322: $style_map{'i'}->{'inline_attribute'} = 'wordasword';
! 23323: $style_map{'key'}->{'inline_attribute'} = 'keycap';
! 23324: delete $style_map{'key'}->{'begin'};
! 23325: delete $style_map{'key'}->{'end'};
! 23326: $style_map{'option'}->{'inline_attribute'} = 'option';
! 23327: $style_map{'t'}->{'inline_attribute'} = 'literal';
! 23328: delete $style_map{'sansserif'}->{'inline_attribute'};
! 23329: delete $style_map{'r'}->{'inline_attribute'};
! 23330: $style_map{'indicateurl'}->{'inline_attribute'} = 'wordasword';
! 23331: delete $style_map{'indicateurl'}->{'begin'};
! 23332: delete $style_map{'indicateurl'}->{'end'};
! 23333: $style_map{'var'}->{'inline_attribute'} = 'replaceable';
! 23334: delete $style_map{'verb'}->{'inline_attribute'};
! 23335: $style_map{'email'}->{'function'} = \&docbook_email;
! 23336: $style_map{'math'}->{'function'} = \&docbook_math;
! 23337: $style_map{'uref'}->{'function'} = \&docbook_uref;
! 23338: $style_map{'url'}->{'function'} = \&docbook_uref;
! 23339: $style_map{'titlefont'}->{'function'} = \&docbook_titlefont;
! 23340: #$style_map{'samp'}->{'function'} = \&docbook_samp;
! 23341: #delete $style_map{'samp'}->{'inline_attribute'};
! 23342: $style_map{'samp'}->{'inline_attribute'} = 'literal';
! 23343: $style_map{'samp'}->{'begin'} = '‘';
! 23344: $style_map{'samp'}->{'end'} = '’';
! 23345:
! 23346: $kept_footnote_function = $style_map{'footnote'}->{'function'};
! 23347: $style_map{'footnote'}->{'function'} = \&docbook_footnote;
! 23348:
! 23349: foreach my $style (keys(%style_map))
! 23350: {
! 23351: delete ($style_map{$style}->{'quote'});
! 23352: }
! 23353:
! 23354: #use Data::Dumper;
! 23355: %style_map_pre = ();
! 23356: t2h_default_copy_style_map (\%style_map, \%style_map_pre);
! 23357:
! 23358: $style_map_pre{'r'}->{'inline_attribute'} = 'lineannotation';
! 23359:
! 23360: $colon_command_punctuation_characters{'.'} = '.';
! 23361: $colon_command_punctuation_characters{':'} = ':';
! 23362: $colon_command_punctuation_characters{'?'} = '?';
! 23363: $colon_command_punctuation_characters{'!'} = '!';
! 23364:
! 23365: $stop_paragraph_command{'titlefont'} = 0;
! 23366:
! 23367: # FIXME
! 23368: #$no_paragraph_commands{'anchor'} = 0;
! 23369:
! 23370: # FIXME
! 23371: delete $special_accents{'ringaccent'};
! 23372: $special_accents{'ogonek'} = 'aeiuAEIU';
! 23373:
! 23374: %simple_map = %default_simple_map;
! 23375: %simple_map_pre = %simple_map;
! 23376:
! 23377: # FIXME right? ł Ł
! 23378: $things_map{'l'} = '/l';
! 23379: $things_map{'L'} = '/L';
! 23380: $things_map{'TeX'} = '&tex;';
! 23381: $things_map{'LaTeX'} = '&latex;';
! 23382: $things_map{'enddots'} = '….';
! 23383: $things_map{'minus'} = '−';
! 23384: # FIXME ∗
! 23385: $things_map{'point'} = '-!-';
! 23386: # FIXME ≡
! 23387: $things_map{'equiv'} = '==';
! 23388: # FIXME no ‹ nor ›
! 23389: $things_map{'guilsinglright'} = '>';
! 23390: $things_map{'guilsinglleft'} = '<';
! 23391: # The following is unneeded because normal_text is redefined.
! 23392: # FIXME it should certainly be better to leave those substitutions,
! 23393: # or even hardcodes them in normal_text.
! 23394: # t2h_remove_text_substitutions("'", 1, 0, 0, 1);
! 23395: # t2h_remove_text_substitutions('`', 1, 0, 0, 1);
! 23396:
! 23397: $things_map{'quotedblbase'} = '„';
! 23398: $things_map{'quotesinglbase'} = '‚';
! 23399:
! 23400: %pre_map = %things_map;
! 23401:
! 23402: #delete $inter_item_commands{'cindex'};
! 23403:
! 23404: #$no_paragraph_commands{'cindex'} = 0;
! 23405: $no_paragraph_commands{'float'} = 0;
! 23406:
! 23407: %docbook_complex_format = (
! 23408: 'example' => 'screen',
! 23409: 'smallexample' => 'screen',
! 23410: 'display' => 'literallayout',
! 23411: 'smalldisplay' => 'literallayout',
! 23412: 'lisp' => 'programlisting',
! 23413: 'smalllisp' => 'programlisting',
! 23414: 'format' => 'abstract',
! 23415: 'smallformat' => 'screen'
! 23416: );
! 23417:
! 23418: %docbook_sections = (
! 23419: 'top' => 'chapter',
! 23420: 'part' => 'part',
! 23421: 'chapter' => 'chapter',
! 23422: 'unnumbered' => 'chapter',
! 23423: 'centerchap' => 'chapter',
! 23424: 'appendix' => 'appendix',
! 23425: 'majorheading' => 'other',
! 23426: 'chapheading' => 'other',
! 23427: 'heading' => 'sect1',
! 23428: 'subheading' => 'sect2',
! 23429: 'subsubheading' => 'sect3',
! 23430: 2 => 'sect1',
! 23431: 3 => 'sect2',
! 23432: 4 => 'sect3'
! 23433: );
! 23434:
! 23435: %def_format_docbook = (
! 23436: 'deffn' => [ ['function', 'name'] ],
! 23437: 'defvr' => [ ['varname', 'name'] ],
! 23438: 'deftypefn' => [ [ 'returnvalue', 'type' ], ['function', 'name'] ],
! 23439: 'deftypeop' => [ ['returnvalue', 'type'], ['methodname', 'name'] ],
! 23440: 'deftypevr' => [ ['returnvalue', 'type'], ['varname', 'name'] ],
! 23441: 'defcv' => [ ['classname', 'class'], ['property', 'name'] ],
! 23442: 'deftypecv' => [ ['returnvalue', 'type'], ['property', 'name'] ],
! 23443: 'defop' => [ ['classname', 'class'], ['methodname', 'name'] ],
! 23444: 'deftp' => [ ['structname', 'name'] ]
! 23445: );
! 23446:
! 23447: %def_argument_types_docbook = (
! 23448: 'param' => 'replaceable',
! 23449: 'paramtype' => 'type',
! 23450: 'delimiter' => ''
! 23451: );
! 23452:
! 23453: @docbook_special_quotation = ('note', 'caution', 'important', 'tip', 'warning');
! 23454:
! 23455: $region_formats_kept{'copying'} = 1;
! 23456:
! 23457: %format_map = (
! 23458: 'group' => '',
! 23459: 'raggedright' => '',
! 23460: 'copying' => 'copying',
! 23461: );
! 23462:
! 23463: $print_Top = \&docbook_print_Top;
! 23464: $print_Top_footer = \&docbook_print_Top_footer;
! 23465: $print_page_head = \&docbook_print_page_head;
! 23466: $print_foot_navigation = \&docbook_noop;
! 23467: $contents = \&docbook_noop;
! 23468: $shortcontents = \&docbook_noop;
! 23469: $about_body = \&docbook_noop;
! 23470: $print_page_foot = \&docbook_print_page_foot;
! 23471: $end_section = \&docbook_end_section;
! 23472: $one_section = \&docbook_one_section;
! 23473:
! 23474: $acronym_like = \&docbook_acronym_like;
! 23475: $anchor_label = \&docbook_anchor_label;
! 23476: $begin_format_texi = \&docbook_begin_format_texi;
! 23477: $cartouche = \&docbook_cartouche;
! 23478: $cell = \&docbook_cell;
! 23479: $complex_format = \&docbook_complex_format;
! 23480: $def = \&docbook_def;
! 23481: $def_line = \&docbook_def_line;
! 23482: $def_item = \&docbook_def_item;
! 23483: $element_label = \&docbook_element_label;
! 23484: $external_ref = \&docbook_external_ref;
! 23485: $float = \&docbook_float;
! 23486: $foot_line_and_ref = \&docbook_foot_line_and_ref;
! 23487: $format = \&docbook_format;
! 23488: $format_list_item_texi = \&docbook_format_list_item_texi;
! 23489: $heading = \&docbook_heading;
! 23490: $image = \&docbook_image;
! 23491: $image_files = \&docbook_image_files;
! 23492: $index_entry_command = \&docbook_index_entry_command;
! 23493: $index_entry_label = \&docbook_index_entry_label;
! 23494: $index_summary = \&docbook_index_summary;
! 23495: $internal_ref = \&docbook_internal_ref;
! 23496: $insertcopying = \&docbook_insertcopying;
! 23497: $list_item = \&docbook_list_item;
! 23498: $misc_element_label = \&docbook_noop;
! 23499: $normal_text = \&docbook_normal_text;
! 23500: $paragraph = \&docbook_paragraph;
! 23501: $preformatted = \&docbook_preformatted;
! 23502: $printindex = \&docbook_printindex;
! 23503: $protect_text = \&xml_default_protect_text;
! 23504: $quotation = \&docbook_quotation;
! 23505: $quotation_prepend_text = \&docbook_quotation_prepend_text;
! 23506: $listoffloats = \&docbook_noop;
! 23507: $raw = \&docbook_raw;
! 23508: $row = \&docbook_row;
! 23509: $sp = \&docbook_sp;
! 23510: $style = \&docbook_style;
! 23511: $table_item = \&docbook_table_item;
! 23512: $table_line = \&docbook_table_line;
! 23513: $table_list = \&docbook_table_list;
! 23514: $misc_command_line = \&docbook_misc_commands;
! 23515:
! 23516:
! 23517: }
! 23518:
! 23519: sub docbook_footnote
! 23520: {
! 23521: $docbook_in_footnote = 1;
! 23522: my $result = &$kept_footnote_function(@_);
! 23523: $docbook_in_footnote = 0;
! 23524: return $result;
! 23525: }
! 23526:
! 23527: sub docbook_macron($$)
! 23528: {
! 23529: my $accent = shift;
! 23530: my $args = shift;
! 23531: return $args->[0] . "¯";
! 23532: }
! 23533:
! 23534: sub docbook_samp($$)
! 23535: {
! 23536: shift;
! 23537: my $args = shift;
! 23538: return "‘<literal>$args->[0]</literal>’";
! 23539: }
! 23540:
! 23541: sub docbook_email($$)
! 23542: {
! 23543: my $command = shift;
! 23544: my $args = shift;
! 23545: my $mail = shift @$args;
! 23546: my $text = shift @$args;
! 23547: $mail = main::normalise_space($mail);
! 23548: if (defined($text) and $text =~ /\S/)
! 23549: {
! 23550: # FIXME normalise_space would be more legible.
! 23551: #return docbook_add_id('ulink').' url="mailto:'.$mail.'">'.main::normalise_space($text).'</ulink>';
! 23552: return docbook_add_id('ulink').' url="mailto:'.$mail.'">'.$text.'</ulink>';
! 23553: }
! 23554: return docbook_add_id('email').">$mail</email>";
! 23555: }
! 23556:
! 23557: sub docbook_uref($$)
! 23558: {
! 23559: shift;
! 23560: my $args = shift;
! 23561: my $url = shift @$args;
! 23562: my $text = shift @$args;
! 23563: my $replacement = shift @$args;
! 23564: $url = main::normalise_space($url);
! 23565: $text = '' if (!defined($text));
! 23566: $replacement = '' if (!defined($replacement));
! 23567: $replacement = $text if ($replacement eq '');
! 23568: $replacement = $url if ($replacement eq '');
! 23569: $replacement = main::normalise_space($replacement);
! 23570:
! 23571: return docbook_add_id('ulink')." url=\"$url\">$replacement</ulink>";
! 23572: }
! 23573:
! 23574: # FIXME
! 23575: sub docbook_titlefont($$)
! 23576: {
! 23577: shift;
! 23578: my $args = shift;
! 23579: return "$args->[0]";
! 23580: }
! 23581:
! 23582: # FIXME there ought to be something better... Like use tex4ht mathml
! 23583: # output or something like that
! 23584: sub docbook_math($$)
! 23585: {
! 23586: shift;
! 23587: my $args = shift;
! 23588: my $text = shift @$args;
! 23589: return $text;
! 23590: }
! 23591:
! 23592:
! 23593: sub docbook_print_page_head($)
! 23594: {
! 23595: my $fh = shift;
! 23596: my $language = get_conf('documentlanguage');
! 23597: my $doctype = get_conf('doctype');
! 23598: print $fh <<EOT;
! 23599: <?xml version="1.0"?>
! 23600: $doctype
! 23601: <book id="$Texi2HTML::THISDOC{file_base_name}.$EXTENSION" lang="$language">
! 23602: EOT
! 23603: }
! 23604:
! 23605: sub docbook_print_page_foot($)
! 23606: {
! 23607: my $fh = shift;
! 23608: print $fh "". docbook_close_section();
! 23609: print $fh <<EOT;
! 23610: </book>
! 23611: EOT
! 23612: }
! 23613:
! 23614: sub docbook_print_Top($$$)
! 23615: {
! 23616: my $fh = shift;
! 23617: my $has_top_heading = shift;
! 23618: my $element = shift;
! 23619: main::print_lines($fh, $Texi2HTML::THIS_SECTION);
! 23620: }
! 23621:
! 23622: sub docbook_element_tag($)
! 23623: {
! 23624: my $element = shift;
! 23625: #print STDERR "$element->{'texi'}, $element->{'tag_level'}, $element->{'level'}\n";
! 23626: return $docbook_sections{$element->{'tag_level'}} if (exists($docbook_sections{$element->{'tag_level'}}));
! 23627: return $docbook_sections{$element->{'level'}} if (exists($docbook_sections{$element->{'level'}}));
! 23628: }
! 23629:
! 23630: sub docbook_node_id($)
! 23631: {
! 23632: my $node_texi = shift;
! 23633: my $node = main::substitute_line($node_texi, 'docbook node id', {'code_style' => 1, 'remove_texi' => 1});
! 23634: $node =~ s/[\s\"]/-/g;
! 23635: return &$protect_text($node);
! 23636: }
! 23637:
! 23638: sub docbook_initialize_variables()
! 23639: {
! 23640: $docbook_pending_node_id = undef;
! 23641: $docbook_current_section = undef;
! 23642: @docbook_multitable_stack = ();
! 23643: @docbook_table_stack = ();
! 23644: $Texi2HTML::THISDOC{'SPLIT'} = 0 if ($OUTPUT_FORMAT eq 'docbook');
! 23645: }
! 23646:
! 23647: sub docbook_add_id($)
! 23648: {
! 23649: my $element = shift;
! 23650: my $result = "<$element";
! 23651: if (defined($docbook_pending_node_id) and (!$docbook_in_footnote or $element eq 'footnote'))
! 23652: {
! 23653: $result .= " id=\"$docbook_pending_node_id\"";
! 23654: $docbook_pending_node_id = undef;
! 23655: }
! 23656: return $result;
! 23657: }
! 23658:
! 23659: sub docbook_heading($$$$$)
! 23660: {
! 23661: my $element = shift;
! 23662: my $command = shift;
! 23663: my $texi_line = shift;
! 23664: my $line = shift;
! 23665: my $in_preformatted = shift;
! 23666:
! 23667: if (defined($command) and $command =~ /heading/)
! 23668: {
! 23669: my $text = '';
! 23670: if (defined($line))
! 23671: {
! 23672: $text = $line;
! 23673: # this isn't done in main program in that case...
! 23674: chomp ($text);
! 23675: $text =~ s/^\s*//;
! 23676: }
! 23677: return docbook_add_id('bridgehead')." renderas=\"$docbook_sections{$command}\">$text</bridgehead>\n";
! 23678: }
! 23679:
! 23680: my $result = '';
! 23681:
! 23682: # FIXME verify xreflabel
! 23683: if ($command ne 'node')
! 23684: {
! 23685: # close previous section
! 23686: $result .= docbook_close_section();
! 23687: my $title = $element->{'text_nonumber'};
! 23688: my $label = '';
! 23689: my $xreflabel = '';
! 23690: if ($element->{'number'})
! 23691: {
! 23692: my $label_nr = $element->{'number'};
! 23693: #$label_nr =~ s/\.$//;
! 23694: $label = $label_nr;
! 23695: }
! 23696: else
! 23697: {
! 23698: my $xreftitle = $title;
! 23699: $xreflabel = " xreflabel=\"$xreftitle\"";
! 23700: }
! 23701: $result .= docbook_add_id(docbook_element_tag($element) . " label=\"${label}\"${xreflabel}");
! 23702: $result .= ">\n<title>$title</title>\n";
! 23703: $docbook_current_section = $element;
! 23704: }
! 23705: return $result;
! 23706: }
! 23707:
! 23708: sub docbook_element_label($$$$)
! 23709: {
! 23710: my $id = shift;
! 23711: my $element = shift;
! 23712: my $command = shift;
! 23713: my $line = shift;
! 23714:
! 23715: if ($command eq 'node')
! 23716: {
! 23717: $docbook_pending_node_id = docbook_node_id($element->{'texi'});
! 23718: }
! 23719: return '';
! 23720: }
! 23721:
! 23722: sub docbook_paragraph($$$$$$$$$$$$)
! 23723: {
! 23724: my $text = shift;
! 23725: my $align = shift;
! 23726: my $indent = shift;
! 23727: my $paragraph_command = shift;
! 23728: my $paragraph_command_formatted = shift;
! 23729: my $paragraph_number = shift;
! 23730: my $format = shift;
! 23731: my $item_nr = shift;
! 23732: my $enumerate_style = shift;
! 23733: my $number = shift;
! 23734: my $command_stack_at_end = shift;
! 23735: my $command_stack_at_begin = shift;
! 23736:
! 23737: if (defined($paragraph_number) and defined($$paragraph_number))
! 23738: {
! 23739: $$paragraph_number++;
! 23740: }
! 23741:
! 23742: # no para in multitables, caption and shortcaptions.
! 23743: my $top_stack = '';
! 23744: $top_stack = $command_stack_at_begin->[-1] if (scalar (@$command_stack_at_begin));
! 23745: return $text if ($top_stack eq 'multitable' or $top_stack eq 'shortcaption' or $top_stack eq 'caption' or $top_stack eq 'documentdescription');
! 23746:
! 23747: if ($text =~ /\S/)
! 23748: {
! 23749: #return docbook_add_id('para').">$text</para>";
! 23750: return "<para>$text</para>";
! 23751: }
! 23752: return $text;
! 23753: }
! 23754:
! 23755:
! 23756: sub docbook_def_line($$$$$$$$$$$$$$$)
! 23757: {
! 23758: my $category_prepared = shift;
! 23759: my $name = shift;
! 23760: my $type = shift;
! 23761: my $arguments = shift;
! 23762: my $index_label = shift;
! 23763: my $arguments_array = shift;
! 23764: my $arguments_type_array = shift;
! 23765: my $unformatted_arguments_array = shift;
! 23766: my $command = shift;
! 23767: my $class_name = shift;
! 23768: my $category = shift;
! 23769: my $class = shift;
! 23770: my $style = shift;
! 23771: my $original_command = shift;
! 23772:
! 23773: my %unformatted_arguments = ();
! 23774:
! 23775: my @unformatted_args = @$unformatted_arguments_array;
! 23776: foreach my $type (@$arguments_type_array)
! 23777: {
! 23778: my $unformatted_arg = shift @unformatted_args;
! 23779: $unformatted_arguments{$type} = $unformatted_arg;
! 23780: }
! 23781: # FIXME unformatted!
! 23782: my $result = "<synopsis role=\"$unformatted_arguments{'category'}\"><indexterm role=\""
! 23783: .$main::index_prefix_to_name{$style}."\"><primary>$class_name</primary></indexterm>";
! 23784:
! 23785: my %arguments = ( 'prepared_category' => $category_prepared,
! 23786: 'category' => $category,
! 23787: 'name' => $name,
! 23788: 'type' => $type,
! 23789: 'class' => $class
! 23790: );
! 23791: foreach my $type (keys(%arguments))
! 23792: {
! 23793: $arguments{$type} = '' if (!defined($arguments{$type}));
! 23794: }
! 23795:
! 23796: foreach my $mandatory_arg (@{$def_format_docbook{$command}})
! 23797: {
! 23798: my $elem = $mandatory_arg->[0];
! 23799: #if ($elem eq 'returnvalue' and $unformatted_arguments{$mandatory_arg->[1]} =~ /^\s*\@code\{/)
! 23800: if ($elem eq 'returnvalue' and $unformatted_arguments{$mandatory_arg->[1]} =~ /\@code\{/)
! 23801: {
! 23802: # FIXME unformatted
! 23803: my $arg_without_at_command = $unformatted_arguments{$mandatory_arg->[1]};
! 23804: #$arg_without_at_command =~ s/\s*\@code\{//;
! 23805: #$arg_without_at_command =~ s/\}\s*$//;
! 23806: while ($arg_without_at_command =~ /\@code\{([^\{\}]*)\}/)
! 23807: {
! 23808: $arg_without_at_command =~ s/\@code\{([^\{\}]*)\}/$1/;
! 23809: }
! 23810: $result .= "<$elem>$arg_without_at_command</$elem>";
! 23811: }
! 23812: else
! 23813: {
! 23814: $result .= "<$elem>$arguments{$mandatory_arg->[1]}</$elem>";
! 23815: }
! 23816: }
! 23817:
! 23818: my @types = @$arguments_type_array;
! 23819: @unformatted_args = @$unformatted_arguments_array;
! 23820: foreach my $arg (@$arguments_array)
! 23821: {
! 23822: my $type = shift @types;
! 23823: my $unformatted = shift @unformatted_args;
! 23824: if (exists ($def_argument_types_docbook{$type}))
! 23825: {
! 23826: if ($def_argument_types_docbook{$type} and
! 23827: ($type eq 'paramtype' or ($unformatted !~ /^\s*\@var\{/)))
! 23828: {
! 23829: $result .= "<$def_argument_types_docbook{$type}>$arg</$def_argument_types_docbook{$type}>";
! 23830: }
! 23831: else
! 23832: {
! 23833: $result .= $arg;
! 23834: }
! 23835: }
! 23836: }
! 23837:
! 23838: $result .= "</synopsis>\n";
! 23839: return $result;
! 23840: }
! 23841:
! 23842: # FIXME
! 23843: # @deffn
! 23844: # @c comment
! 23845: # @end deffn
! 23846: # leads to the creation of a <definitionitem> with a comment within,
! 23847: # while there should be no definitionitem
! 23848: sub docbook_def_item($)
! 23849: {
! 23850: my $text = shift;
! 23851: my $only_inter_item_commands = shift;
! 23852:
! 23853: if ($text =~ /\S/)
! 23854: {
! 23855: return '<blockquote>' . $text . '</blockquote>' unless $only_inter_item_commands;
! 23856: return $text;
! 23857: }
! 23858: return '';
! 23859: }
! 23860:
! 23861: sub docbook_def($)
! 23862: {
! 23863: my $text = shift;
! 23864: return docbook_add_id('informalfigure').'>'.$text.'</informalfigure>';
! 23865: }
! 23866:
! 23867: sub docbook_preformatted($$$$$$$$$$$$)
! 23868: {
! 23869: my $text = shift;
! 23870: my $pre_style = shift;
! 23871: my $class = shift;
! 23872: my $leading_command = shift;
! 23873: my $leading_command_formatted = shift;
! 23874: my $preformatted_number = shift;
! 23875: my $format = shift;
! 23876: my $item_nr = shift;
! 23877: my $enumerate_style = shift;
! 23878: my $number = shift;
! 23879: my $command_stack_at_end = shift;
! 23880: my $command_stack_at_begin = shift;
! 23881:
! 23882: return $text;
! 23883: }
! 23884:
! 23885: sub docbook_misc_commands($$$$$)
! 23886: {
! 23887: my $macro = shift;
! 23888: my $line = shift;
! 23889: my $args = shift;
! 23890: my $stack = shift;
! 23891: my $state = shift;
! 23892: #print STDERR "$macro $line";
! 23893: #print STDERR "ARGS @$args\n" if defined ($args);
! 23894: my $result_text = undef;
! 23895: if ($macro eq 'c' or $macro eq 'comment' and scalar(@$args))
! 23896: {
! 23897: my $comment_line = $args->[0];
! 23898: chomp ($comment_line);
! 23899: # makeinfo remove all the leading spaces
! 23900: $comment_line =~ s/^\s//;
! 23901: $result_text = &$comment ($comment_line);
! 23902: }
! 23903: elsif ($macro eq 'settitle')
! 23904: {
! 23905: # FIXME to be formatted? Also maybe in line_command. And in html, it
! 23906: # is handled by heading _text
! 23907: my $arg = $args->[0];
! 23908: $arg =~ s/^\s*//;
! 23909: chomp($arg);
! 23910: $result_text = "<title>$arg</title>\n";
! 23911: }
! 23912: return ($macro, $line, $result_text);
! 23913: }
! 23914:
! 23915: sub docbook_foot_line_and_ref($$$$$$$)
! 23916: {
! 23917: my $number_in_doc = shift;
! 23918: my $number_in_page = shift;
! 23919: my $footnote_id = shift;
! 23920: my $place_id = shift;
! 23921: my $document_file = shift;
! 23922: my $footnote_file = shift;
! 23923: my $lines = shift;
! 23924: my $state = shift;
! 23925:
! 23926: my $result = docbook_add_id('footnote').'>';
! 23927: foreach my $line (@$lines)
! 23928: {
! 23929: $result .= $line;
! 23930: }
! 23931: return ([], $result . '</footnote>');
! 23932: }
! 23933:
! 23934: sub docbook_any_ref($$$)
! 23935: {
! 23936: my $type = shift;
! 23937: my $args = shift;
! 23938: my $unformatted_args = shift;
! 23939:
! 23940: # FIXME?
! 23941: if ($type eq 'inforef')
! 23942: {
! 23943: my $node_file = "($args->[2])$args->[0]";
! 23944: if ($args->[1] ne '')
! 23945: {
! 23946: return "*note $args->[1]: $node_file";
! 23947: }
! 23948: else
! 23949: {
! 23950: return "*note ${node_file}::";
! 23951: }
! 23952: }
! 23953: else
! 23954: {
! 23955: if (($args->[3] ne '') or ($args->[4] ne ''))
! 23956: {
! 23957: return '' if ($args->[4] eq '');
! 23958: my $section_name = $args->[2];
! 23959: $section_name = $args->[0] if ($section_name eq '');
! 23960: if ($type eq 'ref')
! 23961: {
! 23962: return gdt('section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}', { 'section_name' => $section_name, 'book' => $args->[4] },{'duplicate'=>1});
! 23963: }
! 23964: elsif ($type eq 'xref')
! 23965: {
! 23966: return gdt('See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}', { 'section_name' => $section_name, 'book' => $args->[4] },{'duplicate'=>1});
! 23967: }
! 23968: elsif ($type eq 'pxref')
! 23969: {
! 23970: return gdt('see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}', { 'section_name' => $section_name, 'book' => $args->[4] },{'duplicate'=>1});
! 23971: }
! 23972: }
! 23973: my $link = docbook_node_id($unformatted_args->[0]);
! 23974: my $title = $args->[2];
! 23975: $title = $args->[1] if ($title eq '');
! 23976: if ($title eq '')
! 23977: {
! 23978: if ($type eq 'ref')
! 23979: {
! 23980: return gdt('{ref}', {'ref' => docbook_add_id('xref')." linkend=\"$link\"></xref>"});
! 23981: }
! 23982: elsif ($type eq 'pxref')
! 23983: {
! 23984: return gdt('see {ref}', {'ref' => docbook_add_id('xref')." linkend=\"$link\"></xref>"});
! 23985: }
! 23986: elsif ($type eq 'xref')
! 23987: {
! 23988: return gdt('See {ref}', {'ref' => docbook_add_id('xref')." linkend=\"$link\"></xref>"});
! 23989: }
! 23990: }
! 23991: else
! 23992: {
! 23993: if ($type eq 'ref')
! 23994: {
! 23995: return gdt('{title_ref}', {'title_ref' => docbook_add_id('link')." linkend=\"$link\">$title</link>"});
! 23996: }
! 23997: elsif ($type eq 'pxref')
! 23998: {
! 23999: return gdt('see {title_ref}', {'title_ref' => docbook_add_id('link')." linkend=\"$link\">$title</link>"},{'duplicate'=>1});
! 24000: }
! 24001: elsif ($type eq 'xref')
! 24002: {
! 24003: return gdt('See {title_ref}', {'title_ref' => docbook_add_id('link')." linkend=\"$link\">$title</link>"},{'duplicate'=>1});
! 24004: }
! 24005: }
! 24006: }
! 24007: }
! 24008:
! 24009: sub docbook_external_ref($$$$$$$$$)
! 24010: {
! 24011: my $type = shift;
! 24012: my $section = shift;
! 24013: my $book = shift;
! 24014: my $file = shift;
! 24015: my $href = shift;
! 24016: my $cross_ref = shift;
! 24017: my $args_texi = shift;
! 24018: my $formatted_args = shift;
! 24019: my $node = shift;
! 24020:
! 24021: return docbook_any_ref ($type, $formatted_args, $args_texi);
! 24022: }
! 24023:
! 24024: sub docbook_internal_ref($$$$$)
! 24025: {
! 24026: my $type = shift;
! 24027: my $href = shift;
! 24028: my $short_name = shift;
! 24029: my $name = shift;
! 24030: my $is_section = shift;
! 24031: my $args_texi = shift;
! 24032: my $formatted_args = shift;
! 24033:
! 24034: return docbook_any_ref ($type, $formatted_args, $args_texi );
! 24035: }
! 24036:
! 24037: sub docbook_index_entry_command($$$$$)
! 24038: {
! 24039: my $command = shift;
! 24040: my $index_name = shift;
! 24041: my $label = shift;
! 24042: my $entry_texi = shift;
! 24043: my $entry_formatted = shift;
! 24044:
! 24045: return $label if (defined($label) and $label ne '');
! 24046: return docbook_index_entry_label('','','',$main::index_prefix_to_name{$index_name}, '', '', $entry_formatted, {});
! 24047: }
! 24048:
! 24049: sub docbook_index_entry_label($$$$$$$$$)
! 24050: {
! 24051: my $identifier = shift;
! 24052: my $preformatted = shift;
! 24053: my $entry = shift;
! 24054: my $index_name = shift;
! 24055: my $index_command = shift;
! 24056: my $texi_entry = shift;
! 24057: my $formatted_entry = shift;
! 24058: my $in_region_not_in_output = shift;
! 24059: my $index_entry = shift;
! 24060:
! 24061: return "<indexterm role=\"${index_name}\"><primary>${formatted_entry}</primary></indexterm>";
! 24062: }
! 24063:
! 24064: sub docbook_close_section()
! 24065: {
! 24066: my $element = $docbook_current_section;
! 24067:
! 24068: if (!defined($element))
! 24069: {
! 24070: return '';
! 24071: }
! 24072:
! 24073: my $result = '';
! 24074:
! 24075: # there is a special case for a @chapter that is a child of @top
! 24076: # but should not be considered as is, since it is also toplevel.
! 24077: # @part, however may have other toplevel elements as children.
! 24078: return '' if ($element->{'child'} and (!$element->{'child'}->{'toplevel'} or $element->{'tag'} ne 'top'));
! 24079: $result .= '</'.docbook_element_tag($element).">\n";
! 24080:
! 24081: my $current = $element;
! 24082: # the second condition is such that top is closed only if it has
! 24083: # sub-elements below chapter.
! 24084: # the third condition is such that elements with a next element are
! 24085: # only closed for the last element, except when the next element is
! 24086: # toplevel and below top, such that @top is closed before the first
! 24087: # @chapter if there are @section or the like below @top
! 24088: while ($current->{'sectionup'} and !($current->{'sectionup'}->{'tag'} eq 'top' and $current->{'toplevel'}) and (!$current->{'childnext'} or ($current->{'childnext'}->{'toplevel'} and $current->{'sectionup'}->{'tag'} eq 'top')))
! 24089: {
! 24090: $current = $current->{'sectionup'};
! 24091: $result .= '</'.docbook_element_tag($current).">\n";
! 24092: }
! 24093: return $result;
! 24094: }
! 24095:
! 24096: sub docbook_end_section($$$)
! 24097: {
! 24098: my $fh = shift;
! 24099: my $end_foot_navigation = shift;
! 24100: my $element = shift;
! 24101: }
! 24102:
! 24103: sub docbook_print_Top_footer($$)
! 24104: {
! 24105: my $fh = shift;
! 24106: my $end_page = shift;
! 24107: my $element = shift;
! 24108: }
! 24109:
! 24110: sub docbook_one_section($$)
! 24111: {
! 24112: my $fh = shift;
! 24113: my $element = shift;
! 24114: main::print_lines($fh);
! 24115: &$print_page_foot($fh);
! 24116: }
! 24117:
! 24118: sub docbook_insertcopying($)
! 24119: {
! 24120: my $text = shift;
! 24121: my $comment = shift;
! 24122: my $simple_text = shift;
! 24123:
! 24124: return $text;
! 24125: }
! 24126:
! 24127: sub docbook_acronym_like($$$$$$)
! 24128: {
! 24129: my $command = shift;
! 24130: my $acronym_texi = shift;
! 24131: my $acronym_text = shift;
! 24132: my $with_explanation = shift;
! 24133: my $explanation_lines = shift;
! 24134: my $explanation_text = shift;
! 24135: my $explanation_simply_formatted = shift;
! 24136:
! 24137: $command = 'abbrev' if ($command eq 'abbr');
! 24138: my $result = docbook_add_id($command).">$acronym_text</${command}>";
! 24139: if ($with_explanation)
! 24140: {
! 24141: $result .= " ($explanation_text)";
! 24142: }
! 24143: return $result;
! 24144: }
! 24145:
! 24146:
! 24147: sub docbook_image_files($$$$)
! 24148: {
! 24149: my $base = shift;
! 24150: my $extension = shift;
! 24151: my $texi_base = shift;
! 24152: my $texi_extension = shift;
! 24153: my @files = ();
! 24154: return @files if (!defined($base) or ($base eq ''));
! 24155: # FIXME should look at extension argument? makeinfo doesn't
! 24156: # push @files,"$base.$extension" if (defined($extension) and ($extension ne ''));
! 24157: foreach my $ext (@IMAGE_EXTENSIONS)
! 24158: {
! 24159: push @files, ["$base.$ext", "$texi_base.$ext"];
! 24160: }
! 24161: return @files;
! 24162: }
! 24163:
! 24164:
! 24165: sub docbook_image($$$$$$$$$$$$$$$$;$)
! 24166: {
! 24167: my $file = shift;
! 24168: my $base = shift;
! 24169: my $preformatted = shift;
! 24170: my $file_name = shift;
! 24171: my $alt = shift;
! 24172: my $width = shift;
! 24173: my $height = shift;
! 24174: my $raw_alt = shift;
! 24175: my $extension = shift;
! 24176: my $working_dir = shift;
! 24177: my $file_path = shift;
! 24178: my $in_paragraph = shift;
! 24179: my $file_locations = shift;
! 24180: my $base_simple_format = shift;
! 24181: my $extension_simple_format = shift;
! 24182: my $file_name_simple_format = shift;
! 24183: my $line_nr = shift;
! 24184:
! 24185: # if (!defined($file_path) or $file_path eq '' or $file_path =~ /\.txt$/)
! 24186: # {
! 24187: # if (defined($extension) and $extension ne '')
! 24188: # {
! 24189: # $file = "$base.$extension";
! 24190: # }
! 24191: # else
! 24192: # {
! 24193: # $file = "$base.jpg";
! 24194: # $extension = 'jpg';
! 24195: # }
! 24196: # main::line_warn ("no image file for $base, (using $file)");
! 24197: # }
! 24198: my $txt_path;
! 24199: my @files = ();
! 24200: my @extensions = @IMAGE_EXTENSIONS;
! 24201: foreach my $file_location (@$file_locations)
! 24202: {
! 24203: my ($file_located, $path, $file_simple_format) = @$file_location;
! 24204: my $extension = shift @extensions;
! 24205: if (defined($path))
! 24206: {
! 24207: if ($extension eq 'txt' and !defined($txt_path))
! 24208: {
! 24209: $txt_path = $path;
! 24210: }
! 24211: else
! 24212: {
! 24213: push @files, [$file_located, uc($extension), $file_simple_format];
! 24214: }
! 24215: }
! 24216: }
! 24217: push @files, ["$base.jpg", 'JPG', "$base_simple_format.jpg" ] unless (@files);
! 24218:
! 24219: my $begin = docbook_add_id('inlinemediaobject').'>';
! 24220: my $end = '</inlinemediaobject>';
! 24221: if ($preformatted or !$in_paragraph)
! 24222: {
! 24223: $begin = docbook_add_id('informalfigure').'><mediaobject>';
! 24224: $end = '</mediaobject></informalfigure>';
! 24225: }
! 24226: my $result = $begin;
! 24227: foreach my $file_spec (@files)
! 24228: {
! 24229: $result .= "<imageobject><imagedata fileref=\"$file_spec->[2]\" format=\"$file_spec->[1]\"></imagedata></imageobject>";
! 24230: }
! 24231: if (defined($txt_path))
! 24232: {
! 24233: if (open(TXT, "<$txt_path"))
! 24234: {
! 24235: if (defined($Texi2HTML::THISDOC{'IN_ENCODING'}) and $USE_UNICODE)
! 24236: {
! 24237: binmode(TXT, ":encoding($Texi2HTML::THISDOC{'IN_ENCODING'})");
! 24238: }
! 24239: $result.="<textobject><literallayout>";
! 24240: while (my $img_txt = <TXT>)
! 24241: {
! 24242: $result .= $img_txt;
! 24243: }
! 24244: $result .= '</literallayout></textobject>';
! 24245: close(TXT);
! 24246: }
! 24247: else
! 24248: {
! 24249: main::line_warn (sprintf(__("\@image file `%s' unreadable: %s"), $txt_path, $!), $line_nr);
! 24250: }
! 24251: }
! 24252: else
! 24253: {
! 24254: main::line_warn (sprintf(__("Cannot find \@image file `%s.txt'"), $base), $line_nr);
! 24255: }
! 24256:
! 24257: return "$result$end";
! 24258: }
! 24259:
! 24260: sub docbook_format_list_item_texi($$$$)
! 24261: {
! 24262: my $format = shift;
! 24263: my $line = shift;
! 24264: my $prepended = shift;
! 24265: my $command = shift;
! 24266:
! 24267: my $result_line = undef;
! 24268:
! 24269: if (defined($command) and $command ne '' and !exists $special_list_commands{$format}->{$command} and $format ne 'itemize')
! 24270: {
! 24271: #@*table
! 24272: $line =~ s/^\s*//;
! 24273: $line =~ s/\s*$//;
! 24274: if (exists ($style_map{$command}))
! 24275: {
! 24276: $result_line = "\@$command\{$line\}\n";
! 24277: }
! 24278: elsif (exists ($things_map{$command}))
! 24279: {
! 24280: $result_line = "\@$command\{\} $line\n";
! 24281: }
! 24282: else
! 24283: {
! 24284: $result_line = "\@$command $line\n";
! 24285: }
! 24286: }
! 24287:
! 24288: return ($result_line, 0);
! 24289: }
! 24290:
! 24291:
! 24292: # row in multitable
! 24293: sub docbook_row($$;$$)
! 24294: {
! 24295: my $text = shift;
! 24296: my $macro = shift;
! 24297: my $columnfractions = shift;
! 24298: my $prototype_row = shift;
! 24299: my $prototype_lengths = shift;
! 24300: my $column_number = shift;
! 24301:
! 24302: my $result = '';
! 24303: if ($macro eq 'headitem')
! 24304: {
! 24305: if ($docbook_multitable_stack[-1] != 0)
! 24306: {
! 24307: $result .= "<thead>";
! 24308: $result = "</tbody>" . $result if ($docbook_multitable_stack[-1] == 1);
! 24309: $docbook_multitable_stack[-1] = 0;
! 24310: }
! 24311: }
! 24312: elsif ($docbook_multitable_stack[-1] != 1)
! 24313: {
! 24314: $result .= "<tbody>";
! 24315: $result = "</thead>" . $result if ($docbook_multitable_stack[-1] == 0);
! 24316: $docbook_multitable_stack[-1] = 1;
! 24317: }
! 24318: $result .= "<row>$text</row>";
! 24319:
! 24320: return $result;
! 24321: }
! 24322:
! 24323: # cell in multitable
! 24324: sub docbook_cell($$;$$)
! 24325: {
! 24326: my $text = shift;
! 24327: my $row_macro = shift;
! 24328: my $columnfractions = shift;
! 24329: my $prototype_row = shift;
! 24330: my $prototype_lengths = shift;
! 24331: my $column_number = shift;
! 24332:
! 24333: return "<entry>" . $text . '</entry>';
! 24334: }
! 24335:
! 24336: # if varlistentry_state is > 0 it means that a varlistentry is opened.
! 24337: # if varlistentry_state is == 2 it means that we are in a succession
! 24338: # of term
! 24339: # if varlistentry_state is == 1 it means that we are in the line
! 24340: # Having a listitem in a varlistentry is a must, so an empty
! 24341: # listitem is added if a varlistentry is closed and varlistentry_state == 2
! 24342: #
! 24343: # varlistentry acceps only term and listitem, so inter_item_commands
! 24344: # are put in the next term, or, if at the end of the table in a last
! 24345: # listitem
! 24346: sub docbook_table_item($$$$$$)
! 24347: {
! 24348: my $text = shift;
! 24349: my $index_label = shift;
! 24350: my $format = shift;
! 24351: my $command = shift;
! 24352: # my $formatted_command = shift;
! 24353: my $style_stack = shift;
! 24354: # my $text_formatted = shift;
! 24355: # my $text_formatted_leading_spaces = shift;
! 24356: # my $text_formatted_trailing_spaces = shift;
! 24357: my $item_cmd = shift;
! 24358:
! 24359: # $formatted_command = '' if (!defined($formatted_command));
! 24360:
! 24361: # if (defined($text_formatted))
! 24362: # {
! 24363: # $text_item = $text_formatted_leading_spaces . $text_formatted .$text_formatted_trailing_spaces;
! 24364: # }
! 24365: # else
! 24366: # {
! 24367: # $text_item = $text;
! 24368: # }
! 24369:
! 24370: my $result = '';
! 24371: my $prepended = '';
! 24372: if (defined($docbook_table_stack[-1]->{'inter_item'}))
! 24373: {
! 24374: #$formatted_command = $docbook_table_stack[-1]->{'inter_item'} . $formatted_command;
! 24375: $prepended = $docbook_table_stack[-1]->{'inter_item'};
! 24376: delete $docbook_table_stack[-1]->{'inter_item'};
! 24377: }
! 24378: if ($item_cmd eq 'item')
! 24379: {
! 24380: if ($docbook_table_stack[-1]->{'varlistentry_state'} == 2)
! 24381: {
! 24382: $result .= "<listitem><para><!-- empty table line --></para></listitem>";
! 24383: }
! 24384: if ($docbook_table_stack[-1]->{'varlistentry_state'} >= 1)
! 24385: {
! 24386: $result .= '</varlistentry>';
! 24387: }
! 24388: $docbook_table_stack[-1]->{'varlistentry_state'} = 2;
! 24389: $result .= '<varlistentry>';
! 24390: }
! 24391: $result .= '<term>';
! 24392: $result .= $prepended . $text ."</term>\n";
! 24393: return $result;
! 24394: }
! 24395:
! 24396: sub docbook_table_line($$$)
! 24397: {
! 24398: my $text = shift;
! 24399: my $only_inter_item_commands = shift;
! 24400: my $before_items = shift;
! 24401:
! 24402: $only_inter_item_commands = '' if (!defined($only_inter_item_commands));
! 24403:
! 24404: #print STDERR
! 24405:
! 24406: if ($text =~ /\S/)
! 24407: {
! 24408: if ($before_items)
! 24409: {
! 24410: return $text;
! 24411: }
! 24412:
! 24413: if ($only_inter_item_commands)
! 24414: {
! 24415: $docbook_table_stack[-1]->{'inter_item'} = $text;
! 24416: return '';
! 24417: }
! 24418: else
! 24419: {
! 24420: $docbook_table_stack[-1]->{'varlistentry_state'} = 1;
! 24421: return "<listitem>$text</listitem>";
! 24422: }
! 24423: #return $text;
! 24424: }
! 24425: else
! 24426: {
! 24427: return '';
! 24428: }
! 24429: }
! 24430:
! 24431: sub docbook_list_item($$$$$$$$$)
! 24432: {
! 24433: my $text = shift;
! 24434: my $format = shift;
! 24435: my $command = shift;
! 24436: my $formatted_command = shift;
! 24437: my $item_nr = shift;
! 24438: my $enumerate_style = shift;
! 24439: my $number = shift;
! 24440: my $prepended = shift;
! 24441: my $prepended_formatted = shift;
! 24442: my $only_inter_item_commands = shift;
! 24443: my $before_items = shift;
! 24444:
! 24445: $only_inter_item_commands = '' if (!defined($only_inter_item_commands));
! 24446:
! 24447: #my $prep_t = 'UNDEF'; $prep_t = $prepended if (defined($prepended));
! 24448: #$item_nr = 0 if (!defined($item_nr));
! 24449: #print STDERR " $item_nr --> $prep_t|${text}!!!!!\n";
! 24450: #return $text if ($only_inter_item_commands and $before_items);
! 24451: return $text if ($before_items);
! 24452: return '<listitem>' . $text . "</listitem>\n";
! 24453: }
! 24454:
! 24455: sub docbook_table_list($$$$$$$$$)
! 24456: {
! 24457: my $format_command = shift;
! 24458: my $text = shift;
! 24459: my $command = shift;
! 24460: my $formatted_command = shift;
! 24461: # enumerate
! 24462: my $item_nr = shift;
! 24463: my $enumerate_style = shift;
! 24464: # itemize
! 24465: my $prepended = shift;
! 24466: my $prepended_formatted = shift;
! 24467: # multitable
! 24468: my $columnfractions = shift;
! 24469: my $prototype_row = shift;
! 24470: my $prototype_lengths = shift;
! 24471: my $number = shift;
! 24472:
! 24473: my $result = "<$format_command>";
! 24474: if ($format_command eq 'itemize')
! 24475: {
! 24476: my $itemfunction;
! 24477: #$prepended_formatted =~ s/^\s*// if (defined($prepended_formatted));
! 24478: $prepended =~ s/^\s*// if (defined($prepended));
! 24479: #if (defined($formatted_command) and $formatted_command ne '')
! 24480: if (defined($command) and $command ne '')
! 24481: {
! 24482: #$itemfunction = $formatted_command;
! 24483: $itemfunction = $command;
! 24484: #$itemfunction .= " $prepended_formatted" if (defined($prepended_formatted) and $prepended_formatted ne '');
! 24485: $itemfunction .= " $prepended" if (defined($prepended) and $prepended ne '');
! 24486: }
! 24487: #elsif (defined($prepended_formatted))
! 24488: elsif (defined($prepended))
! 24489: {
! 24490: #$itemfunction = $prepended_formatted;
! 24491: $itemfunction = $prepended;
! 24492: }
! 24493: my $mark = '';
! 24494: $mark = " mark=\"$itemfunction\"" if (defined($itemfunction) and $itemfunction ne '');
! 24495: return docbook_add_id('itemizedlist')."${mark}>$text</itemizedlist>";
! 24496: }
! 24497: elsif ($format_command eq 'enumerate')
! 24498: {
! 24499: my $numeration='arabic';
! 24500: if (defined($enumerate_style) and $enumerate_style ne '')
! 24501: {
! 24502: if ($enumerate_style =~ /^[A-Z]/)
! 24503: {
! 24504: $numeration = 'upperalpha';
! 24505: }
! 24506: elsif ($enumerate_style =~ /^[a-z]/)
! 24507: {
! 24508: $numeration = 'loweralpha';
! 24509: }
! 24510: }
! 24511: return docbook_add_id('orderedlist') ." numeration=\"$numeration\">$text</orderedlist>";
! 24512: }
! 24513: elsif ($format_command eq 'multitable')
! 24514: {
! 24515: my $result = docbook_add_id('informaltable').'><tgroup cols="'.$number.'">';
! 24516: my $fractions;
! 24517: my $multiply = 1;
! 24518: if (defined($columnfractions) and (ref($columnfractions) eq 'ARRAY')
! 24519: and scalar(@$columnfractions))
! 24520: {
! 24521: $fractions = [ @$columnfractions ];
! 24522: $multiply = 100;
! 24523: }
! 24524: elsif (defined($prototype_lengths) and (ref($prototype_lengths) eq 'ARRAY')
! 24525: and scalar(@$prototype_lengths))
! 24526: {
! 24527: $fractions = [ @$prototype_lengths ];
! 24528: }
! 24529:
! 24530: if (defined ($fractions))
! 24531: {
! 24532: foreach my $fraction (@$fractions)
! 24533: {
! 24534: $result .= '<colspec colwidth="'.($fraction*$multiply).'*"></colspec>';
! 24535: }
! 24536: }
! 24537: $text .= "</tbody>" if ($docbook_multitable_stack[-1] == 1);
! 24538: $text .= "</thead>" if ($docbook_multitable_stack[-1] == 0);
! 24539: pop @docbook_multitable_stack;
! 24540: return $result . "$text</tgroup></informaltable>";
! 24541: }
! 24542: elsif ($format_command =~ /^(v|f)?table$/)
! 24543: {
! 24544: $result = docbook_add_id('variablelist').'>';
! 24545: if (defined($docbook_table_stack[-1]->{'inter_item'}))
! 24546: { # there is a para in case there is only a comment, to avoid
! 24547: # an empty listitem
! 24548: $text .= "<listitem><para>$docbook_table_stack[-1]->{'inter_item'}</para></listitem>";
! 24549: }
! 24550: elsif ($docbook_table_stack[-1]->{'varlistentry_state'} == 2)
! 24551: {
! 24552: $text .= "<listitem><para><!-- empty table line --></para></listitem>";
! 24553: }
! 24554: $text .= '</varlistentry>' if ($docbook_table_stack[-1]->{'varlistentry_state'} >= 1);
! 24555: pop @docbook_table_stack;
! 24556: return $result . "$text</variablelist>\n";
! 24557: }
! 24558: }
! 24559:
! 24560: sub docbook_begin_format_texi($$$)
! 24561: {
! 24562: my $command = shift;
! 24563: my $line = shift;
! 24564: my $state = shift;
! 24565:
! 24566: push (@docbook_multitable_stack, -1) if ($command eq 'multitable');
! 24567: push (@docbook_table_stack, {'varlistentry_state' => 0}) if ($command =~ /^(v|f)?table/);
! 24568: return $line;
! 24569: }
! 24570:
! 24571: # FIXME
! 24572: sub docbook_sp($$)
! 24573: {
! 24574: my $number = shift;
! 24575: my $preformatted = shift;
! 24576: return "";
! 24577: }
! 24578:
! 24579: sub docbook_index_summary($$)
! 24580: {
! 24581: my $alpha = shift;
! 24582: my $nonalpha = shift;
! 24583: return '';
! 24584: }
! 24585:
! 24586: sub docbook_printindex($$)
! 24587: {
! 24588: my $name = shift;
! 24589: my $printindex = shift;
! 24590: return docbook_add_id('index')."></index>\n";
! 24591: }
! 24592:
! 24593: sub docbook_complex_format($$)
! 24594: {
! 24595: my $name = shift;
! 24596: my $text = shift;
! 24597: return '' if ($text eq '');
! 24598: my $result = docbook_add_id($docbook_complex_format{$name}).'>' .$text."</$docbook_complex_format{$name}>";
! 24599: return $result;
! 24600: }
! 24601:
! 24602: sub docbook_format($$)
! 24603: {
! 24604: my $name = shift;
! 24605: my $element = shift;
! 24606: my $text = shift;
! 24607: return '' if ($text eq '');
! 24608: return $text if ($format_map{$name} eq '');
! 24609: if ($name eq 'copying')
! 24610: {
! 24611: # FIXME is info in docbook 5.0
! 24612: return "<bookinfo>\n<legalnotice>\n$text</legalnotice>\n</bookinfo>\n";
! 24613: }
! 24614: return docbook_add_id($format_map{$name}).'>' .$text."</$format_map{$name}>";
! 24615: }
! 24616:
! 24617: sub docbook_quotation_prepend_text($$)
! 24618: {
! 24619: my $command = shift;
! 24620: my $argument_text = shift;
! 24621:
! 24622: return undef if (!defined($argument_text) or $argument_text =~ /^$/);
! 24623:
! 24624: chomp($argument_text);
! 24625:
! 24626: return undef if (grep {lc($argument_text) eq $_} @docbook_special_quotation);
! 24627: return gdt('@b{{quotation_arg}:} ', {'quotation_arg' => $argument_text}, {'keep_texi' => 1});
! 24628: }
! 24629:
! 24630:
! 24631: sub docbook_quotation($$$$$)
! 24632: {
! 24633: my $command = shift;
! 24634: my $text = shift;
! 24635: my $argument_text = shift;
! 24636: my $argument_text_texi = shift;
! 24637: my $authors = shift;
! 24638:
! 24639: $argument_text_texi = '' if (!defined($argument_text_texi));
! 24640: chomp($argument_text_texi);
! 24641: my $docbook_command = 'blockquote';
! 24642: if (grep {lc($argument_text_texi) eq $_} @docbook_special_quotation)
! 24643: {
! 24644: $docbook_command = lc($argument_text_texi);
! 24645: }
! 24646: my $attribution = '';
! 24647: if ($authors)
! 24648: {
! 24649: foreach my $author (@$authors)
! 24650: {
! 24651: $attribution .= $author->{'author_text'};
! 24652: }
! 24653: $attribution = '<attribution>' .$attribution. '</attribution>' . "\n";
! 24654: }
! 24655: return docbook_add_id($docbook_command).'>' .$attribution . $text . "</$docbook_command>\n";
! 24656: }
! 24657:
! 24658: sub docbook_style($$$$$$$$$)
! 24659: {
! 24660: my $style = shift;
! 24661: my $command = shift;
! 24662: my $text = shift;
! 24663: my $args = shift;
! 24664: my $no_close =shift;
! 24665: my $no_open = shift;
! 24666: my $line_nr = shift;
! 24667: my $state = shift;
! 24668: my $command_stack = shift;
! 24669: my $kept_line_nrs = shift;
! 24670:
! 24671: my $result = $text;
! 24672: if (exists($style->{'function'}))
! 24673: {
! 24674: my $function = $style->{'function'};
! 24675: $result = &$function($command, $args, $command_stack, $state, $line_nr, $kept_line_nrs);
! 24676: }
! 24677: elsif (exists($style->{'inline_attribute'}))
! 24678: {
! 24679: my $element = $style->{'inline_attribute'};
! 24680: my $attribute_text = '';
! 24681: if ($element =~ /^(\w+)(\s+.*)/)
! 24682: {
! 24683: $element = $1;
! 24684: $attribute_text = $2;
! 24685: }
! 24686:
! 24687: if ($no_open)
! 24688: {
! 24689: $result = "<$element";
! 24690: }
! 24691: else
! 24692: {
! 24693: $result = docbook_add_id($element);
! 24694: }
! 24695: $result .= "$attribute_text>$text</$element>";
! 24696: }
! 24697: if (exists($style->{'begin'}) and !$no_open)
! 24698: {
! 24699: $result = $style->{'begin'} . $result;
! 24700: }
! 24701: if (exists($style->{'end'}) and !$no_close)
! 24702: {
! 24703: $result .= $style->{'end'};
! 24704: }
! 24705: return $result;
! 24706: }
! 24707:
! 24708: sub docbook_raw($$$)
! 24709: {
! 24710: my $style = shift;
! 24711: my $text = shift;
! 24712: my $line_nr = shift;
! 24713:
! 24714: if ($style eq 'verbatim' or $style eq 'verbatiminclude')
! 24715: {
! 24716: return docbook_add_id('screen').'>' . &$protect_text($text) . '</screen>';
! 24717: }
! 24718: return '' unless (grep {$style eq $_} @EXPAND);
! 24719: if ($style eq 'docbook')
! 24720: {
! 24721: chomp ($text);
! 24722: return $text;
! 24723: }
! 24724: else
! 24725: {
! 24726: main::line_warn (sprintf(__("Raw format %s is not converted"), $style), $line_nr);
! 24727: return &$protect_text($text);
! 24728: }
! 24729: }
! 24730:
! 24731: sub docbook_cartouche($$)
! 24732: {
! 24733: my $text = shift;
! 24734:
! 24735: return $text;
! 24736: }
! 24737:
! 24738: sub docbook_anchor_label($$)
! 24739: {
! 24740: my $id = shift;
! 24741: my $anchor_text = shift;
! 24742: # FIXME use docbook_node_id
! 24743: return '<anchor id="'. &$protect_text($anchor_text) . '"></anchor>';
! 24744: }
! 24745:
! 24746: sub docbook_float($$$$$)
! 24747: {
! 24748: my $text = shift;
! 24749: my $float = shift;
! 24750: my $caption = shift;
! 24751: my $shortcaption = shift;
! 24752:
! 24753: my $label_texi = $float->{'texi'};
! 24754: return $text if (!defined($label_texi) or $label_texi eq '');
! 24755:
! 24756: return docbook_anchor_label('',$label_texi) . $text;
! 24757: }
! 24758:
! 24759: sub docbook_normal_text($$$$$$$;$)
! 24760: {
! 24761: my $text = shift;
! 24762: my $in_raw_text = shift; # remove_texi
! 24763: my $in_preformatted = shift;
! 24764: my $in_code = shift;
! 24765: my $in_math = shift;
! 24766: my $in_simple = shift;
! 24767: #print STDERR "Bug: in_raw_text in_simple $text\n" if ($in_raw_text and $in_simple);
! 24768: my $style_stack = shift;
! 24769: my $state = shift;
! 24770:
! 24771: #$text = uc($text) if (in_cmd($style_stack, 'sc'));
! 24772: $text = &$protect_text($text) unless($in_raw_text);
! 24773: if (! $in_code and !$in_preformatted)
! 24774: {
! 24775: if (!$in_raw_text)
! 24776: {
! 24777: $text =~ s/---/\&mdash\;/g;
! 24778: $text =~ s/--/\&ndash\;/g;
! 24779: $text =~ s/``/\&ldquo\;/g;
! 24780: $text =~ s/''/\&rdquo\;/g;
! 24781: }
! 24782: else
! 24783: {
! 24784: #FIXME really do that ? It is done by makeinfo in html
! 24785: $text =~ s/``/"/g;
! 24786: $text =~ s/''/"/g;
! 24787: # FIXME really do that in raw text?
! 24788: $text =~ s/---/\x{1F}/g;
! 24789: $text =~ s/--/-/g;
! 24790: $text =~ s/\x{1F}/--/g;
! 24791: }
! 24792: }
! 24793: return $text;
! 24794: }
! 24795:
! 24796: sub docbook_noop
! 24797: {
! 24798: return '';
! 24799: }
! 24800:
! 24801: 1;
! 24802:
! 24803: require "$T2H_HOME/formats/docbook.init"
! 24804: if ($0 =~ /\.pl$/ &&
! 24805: -e "$T2H_HOME/formats/docbook.init" && -r "$T2H_HOME/formats/docbook.init");
! 24806:
! 24807: # @INIT_XML@
! 24808: # vim: set filetype=perl:
! 24809:
! 24810: use strict;
! 24811:
! 24812: my @xml_multitable_stack = ();
! 24813: my @xml_table_stack = ();
! 24814:
! 24815: my @xml_ignored_misc_commands;
! 24816: my %xml_misc_command_output;
! 24817: my %xml_misc_elements_with_arg_map;
! 24818: my @xml_misc_elements_with_arg;
! 24819: my %def_format_xml;
! 24820: my $xml_current_section;
! 24821:
! 24822: sub xml_default_load(;$)
! 24823: {
! 24824: my $from_command_line = shift;
! 24825:
! 24826: t2h_default_set_variables_xml();
! 24827: $DOCTYPE = '<!DOCTYPE texinfo PUBLIC "-//GNU//DTD TexinfoML V4.12//EN" "http://www.gnu.org/software/texinfo/dtd/4.12/texinfo.dtd">';
! 24828: $SIMPLE_MENU = 0;
! 24829: $SEPARATE_DESCRIPTION = 1;
! 24830: @T2H_FORMAT_EXPAND = ('xml', 'direntry');
! 24831: $USE_ISO = 0;
! 24832: $HEADERS = 0;
! 24833: $INLINE_INSERTCOPYING = 0;
! 24834: $SHOW_MENU = 1;
! 24835: $SHOW_TITLE = 0;
! 24836: $NUMBER_SECTIONS = 0;
! 24837: $USE_NODES = 1;
! 24838: $USE_SECTIONS = 1;
! 24839:
! 24840: t2h_default_push_handler(\&xml_init_variables, \@command_handler_init);
! 24841:
! 24842: $colon_command_punctuation_characters{'.'} = '.';
! 24843: $colon_command_punctuation_characters{':'} = ':';
! 24844: $colon_command_punctuation_characters{'?'} = '?';
! 24845: $colon_command_punctuation_characters{'!'} = '!';
! 24846:
! 24847: $simple_map{'*'} = '&linebreak;';
! 24848: $simple_map{' '} = '&space;';
! 24849: $simple_map{"\t"} = '&space;';
! 24850: $simple_map{"\n"} = '&space;';
! 24851: $simple_map{'.'} = '&eosperiod;';
! 24852: $simple_map{'!'} = '&eosexcl;';
! 24853: $simple_map{'?'} = '&eosquest;';
! 24854:
! 24855: %simple_map_pre = %simple_map;
! 24856:
! 24857: # FIXME right?
! 24858: $things_map{'l'} = '/l';
! 24859: $things_map{'L'} = '/L';
! 24860: $things_map{'enddots'} = '&enddots;';
! 24861: $things_map{'dots'} = '&dots;';
! 24862: # FIXME equiv, point, expansion could be ameliorated
! 24863: $things_map{'equiv'} = '==';
! 24864: $things_map{'point'} = '-!-';
! 24865: $things_map{'expansion'} = '==>'; # →?
! 24866:
! 24867: $things_map{'minus'} = '−';
! 24868: $things_map{'result'} = '⇒';
! 24869: $things_map{'bullet'} = '•';
! 24870: $things_map{'copyright'} = '©right;';
! 24871: $things_map{'registeredsymbol'} = '®istered;';
! 24872: $things_map{'arrow'} = '→';
! 24873: $things_map{'TeX'} = '&tex;';
! 24874: $things_map{'LaTeX'} = '&latex;';
! 24875:
! 24876: %pre_map = %things_map;
! 24877:
! 24878: $stop_paragraph_command{'caption'} = 1;
! 24879: $stop_paragraph_command{'shortcaption'} = 1;
! 24880:
! 24881: %line_command_map = ();
! 24882: foreach my $command ('contents', 'shortcontents', 'summarycontents')
! 24883: {
! 24884: $line_command_map{$command} = $command;
! 24885: }
! 24886:
! 24887: %format_map = ();
! 24888:
! 24889: $format_map{'copying'} = '';
! 24890: $format_map{'titlepage'} = 'titlepage';
! 24891: $format_map{'documentdescription'} = 'documentdescription';
! 24892: $format_map{'group'} = 'group';
! 24893: $format_map{'raggedright'} = 'raggedright';
! 24894:
! 24895: foreach my $region ('titlepage', 'documentdescription', 'copying')
! 24896: {
! 24897: $region_formats_kept{$region} = 1;
! 24898: }
! 24899:
! 24900: %style_map = ();
! 24901: t2h_default_copy_style_map (\%default_style_map, \%style_map);
! 24902:
! 24903: foreach my $style (keys(%style_map))
! 24904: {
! 24905: next if grep {$style eq $_} ('asis', 'ctrl', 'w');
! 24906: if (grep {$style eq $_} ('tieaccent', 'dotless', keys(%unicode_accents)))
! 24907: {
! 24908: $style_map{$style} = { 'function' => \&xml_default_accent };
! 24909: }
! 24910: elsif (!exists($style_map{$style}->{'args'}) or (scalar(@{$style_map{$style}->{'args'}}) eq 1 and ($style_map{$style}->{'args'}->[0] eq 'code' or $style_map{$style}->{'args'}->[0] eq 'normal')))
! 24911: {
! 24912: $style_map{$style}->{'inline_attribute'} = $style;
! 24913: delete ($style_map{$style}->{'quote'});
! 24914: delete ($style_map{$style}->{'begin'});
! 24915: delete ($style_map{$style}->{'end'});
! 24916: delete ($style_map{$style}->{'function'});
! 24917: }
! 24918: }
! 24919:
! 24920: foreach my $complex_format (keys(%complex_format_map))
! 24921: {
! 24922: my $style = $complex_format_map{$complex_format}->{'style'};
! 24923: delete $complex_format_map{$complex_format};
! 24924: $complex_format_map{$complex_format}->{'begin'} = "<$complex_format xml:space=\"preserve\">";
! 24925: $complex_format_map{$complex_format}->{'end'} = "</$complex_format>";
! 24926: $complex_format_map{$complex_format}->{'style'} = $style if (defined($style));
! 24927: }
! 24928: foreach my $menu_command('menu', 'detailmenu', 'direntry', 'menu_comment')
! 24929: {
! 24930: $complex_format_map{$menu_command} = undef;
! 24931: delete $complex_format_map{$menu_command};
! 24932: }
! 24933:
! 24934: # this is not needed because normal_text isn't the same than in html
! 24935: #t2h_remove_text_substitutions("'", 1, 0, 0, 1);
! 24936: #t2h_remove_text_substitutions('`', 1, 0, 0, 1);
! 24937:
! 24938: $style_map{'w'}->{'end'} = '<!-- /@w -->';
! 24939: $style_map{'='}->{'function'} = \&xml_macron;
! 24940: $style_map{'email'}->{'function'} = \&xml_email;
! 24941: $style_map{'titlefont'}->{'function'} = \&xml_titlefont;
! 24942: $style_map{'math'}->{'function'} = \&xml_math;
! 24943: $style_map{'uref'}->{'function'} = \&xml_uref;
! 24944: $style_map{'url'}->{'function'} = \&xml_uref;
! 24945: $style_map{'t'}->{'inline_attribute'} = 'tt';
! 24946: # FIXME
! 24947: delete $special_accents{'ringaccent'};
! 24948: $special_accents{'ogonek'} = 'aeiuAEIU';
! 24949:
! 24950: %style_map_pre = %style_map;
! 24951:
! 24952: $no_paragraph_commands{'cindex'} = 0;
! 24953:
! 24954: #my @xml_ignored_misc_commands = ('bye', 'sp', 'verbatiminclude');
! 24955:
! 24956: @xml_ignored_misc_commands = ('bye', 'sp', 'verbatiminclude', 'clickstyle',
! 24957: 'defcodeindex',
! 24958: 'syncodeindex', 'paragraphindent', 'shorttitlepage', 'refill', 'noindent');
! 24959:
! 24960: # we want to proceed all the misc commands
! 24961: # makeinfo ignores clickstyle, changes setfilename. Not sure it is right.
! 24962: foreach my $misc_command (keys(%misc_command))
! 24963: {
! 24964: next if (grep {$misc_command eq $_} @xml_ignored_misc_commands);
! 24965: $xml_misc_command_output{$misc_command} = 1;
! 24966: }
! 24967:
! 24968: $format_map{'menu'} = 'menu';
! 24969: # checked on bug-texinfo, only node is in code_style, as with makeinfo --xml
! 24970: #$format_code_style{'menu'} = 1;
! 24971: #$format_code_style{'menu_name'} = 1;
! 24972: #$format_code_style{'menu_description'} = 1;
! 24973: $format_map{'detailmenu'} = 'detailmenu';
! 24974: $format_map{'direntry'} = 'direntry';
! 24975: $format_map{'menu_comment'} = '';
! 24976:
! 24977: $menu_description = \&xml_menu_description;
! 24978: $menu_link = \&xml_menu_link;
! 24979: $element_heading = \&xml_heading;
! 24980: $heading = \&xml_heading;
! 24981: $paragraph = \&xml_paragraph;
! 24982: $preformatted = \&xml_preformatted;
! 24983: $misc_element_label = \&xml_noop;
! 24984: $element_label = \&xml_noop;
! 24985: $anchor_label = \&xml_anchor_label;
! 24986: $index_entry_label = \&xml_index_entry_label;
! 24987: $index_entry_command = \&xml_index_entry_command;
! 24988: $listoffloats = \&xml_listoffloats;
! 24989: $acronym_like = \&xml_acronym_like;
! 24990: $foot_line_and_ref = \&xml_foot_line_and_ref;
! 24991: $image = \&xml_image;
! 24992: $sp = \&xml_sp;
! 24993: $quotation = \&xml_quotation;
! 24994: $table_list = \&xml_table_list;
! 24995: $row = \&xml_row;
! 24996: $cell = \&xml_cell;
! 24997: $list_item = \&xml_list_item;
! 24998: $format_list_item_texi = \&xml_format_list_item_texi;
! 24999: $misc_command_line = \&xml_misc_commands;
! 25000: $begin_format_texi = \&xml_begin_format_texi;
! 25001: $def_line = \&xml_def_line;
! 25002: $def = \&xml_def;
! 25003: $def_item = \&xml_def_item;
! 25004: $printindex = \&xml_printindex;
! 25005: $index_summary = \&xml_index_summary;
! 25006: $external_ref = \&xml_external_ref;
! 25007: $internal_ref = \&xml_internal_ref;
! 25008: $table_item = \&xml_table_item;
! 25009: $table_line = \&xml_table_line;
! 25010: $float = \&xml_float;
! 25011: $caption_shortcaption = \&xml_caption_shortcaption;
! 25012: $caption_shortcaption_command = \&xml_caption_shortcaption_command;
! 25013: $normal_text = \&xml_normal_text;
! 25014: $protect_text = \&xml_default_protect_text;
! 25015: $paragraph_style_command = \&xml_paragraph_style_command;
! 25016: $raw = \&xml_raw;
! 25017: $cartouche = \&xml_cartouche;
! 25018:
! 25019: $print_Top = \&xml_print_Top;
! 25020: $print_Top_footer = \&xml_print_Top_footer;
! 25021: $print_page_head = \&xml_print_page_head;
! 25022: $print_foot_navigation = \&xml_noop;
! 25023: $toc_body = \&xml_noop;
! 25024: $about_body = \&xml_noop;
! 25025: $print_page_foot = \&xml_print_page_foot;
! 25026: $end_section = \&xml_end_section;
! 25027: $one_section = \&xml_one_section;
! 25028:
! 25029: %xml_misc_elements_with_arg_map = (
! 25030: 'title' => 'booktitle',
! 25031: 'subtitle' => 'booksubtitle'
! 25032: );
! 25033:
! 25034: @xml_misc_elements_with_arg = ('author',
! 25035: 'dircategory', 'settitle');
! 25036: #my @xml_misc_elements_with_arg = ('author', 'shorttitlepage',
! 25037: # 'vskip', 'dircategory', 'settitle');
! 25038:
! 25039: %def_format_xml = (
! 25040: 'deffn' => [ ['category', 'category'], ['function', 'name'] ],
! 25041: 'defvr' => [ ['category', 'category'], ['variable', 'name'] ],
! 25042: 'deftypefn' => [ ['category', 'category'], ['type', 'type'], ['function', 'name'] ],
! 25043: 'deftypeop' => [ ['category', 'category'], ['type', 'type'], ['operation', 'name'] ],
! 25044: 'deftypevr' => [ ['category', 'category'], ['type', 'type'], ['variable', 'name'] ],
! 25045: 'defcv' => [ ['category' , 'category'], ['class', 'class'], ['classvar', 'name'] ],
! 25046: 'deftypecv' => [ ['category', 'category'], ['type', 'type'], ['classvar', 'name'] ],
! 25047: 'defop' => [ ['category', 'category'], ['class', 'class'], ['operation', 'name'] ],
! 25048: 'deftp' => [ ['category', 'category'], ['datatype', 'name'] ]
! 25049: );
! 25050:
! 25051:
! 25052: }
! 25053:
! 25054: sub xml_macron($$)
! 25055: {
! 25056: my $accent = shift;
! 25057: my $args = shift;
! 25058: return $args->[0] . "¯";
! 25059: }
! 25060:
! 25061: sub xml_email($$)
! 25062: {
! 25063: my $command = shift;
! 25064: my $args = shift;
! 25065: my $mail = shift @$args;
! 25066: my $text = shift @$args;
! 25067: $mail = main::normalise_space($mail);
! 25068: my $result = "<email><emailaddress>$mail</emailaddress>";
! 25069: if (defined($text) and $text =~ /\S/)
! 25070: {
! 25071: $result .= "<emailname>".main::normalise_space($text)."</emailname>";
! 25072: }
! 25073: return $result . '</email>';
! 25074: }
! 25075:
! 25076: sub xml_uref($$)
! 25077: {
! 25078: shift;
! 25079: my $args = shift;
! 25080: my $url = shift @$args;
! 25081: my $text = shift @$args;
! 25082: my $replacement = shift @$args;
! 25083: $url = main::normalise_space($url);
! 25084: $replacement = '' if (!defined($replacement));
! 25085: $replacement = main::normalise_space($replacement);
! 25086: $text = '' if (!defined($text));
! 25087: $text = main::normalise_space($text);
! 25088: my $result = "<uref><urefurl>$url</urefurl>";
! 25089: $result .= "<urefdesc>$text</urefdesc>" if ($text ne '');
! 25090: $result .= "<urefreplacement>$replacement</urefreplacement>" if ($replacement ne '');
! 25091: return $result.'</uref>';
! 25092: }
! 25093:
! 25094:
! 25095: sub xml_titlefont($$)
! 25096: {
! 25097: shift;
! 25098: my $args = shift;
! 25099: return "<titlefont>$args->[0]</titlefont>";
! 25100: }
! 25101:
! 25102: sub xml_math($$)
! 25103: {
! 25104: shift;
! 25105: my $args = shift;
! 25106: my $text = shift @$args;
! 25107: return "<math>$text</math>";
! 25108: }
! 25109:
! 25110:
! 25111: sub xml_menu_description($$$)
! 25112: {
! 25113: my $text = shift;
! 25114: my $state = shift;
! 25115: my $element_text = shift;
! 25116: return "<menucomment>$text</menucomment>\n</menuentry>";
! 25117: }
! 25118:
! 25119: sub xml_menu_link($$$$$$$$$$)
! 25120: {
! 25121: my $entry = shift;
! 25122: my $state = shift;
! 25123: my $href = shift;
! 25124: my $menunode = shift;
! 25125: my $menutitle = shift;
! 25126: my $ending = shift;
! 25127: my $has_title = shift;
! 25128: my $command_stack = shift;
! 25129: my $in_preformatted = shift;
! 25130: my $menunode_normalized = shift;
! 25131:
! 25132: return "<menuentry>\n<menunode>$menunode_normalized</menunode>\n<menutitle>$menutitle</menutitle>\n";
! 25133: }
! 25134:
! 25135: sub xml_print_page_head($)
! 25136: {
! 25137: my $fh = shift;
! 25138: my $setfilename = '';
! 25139: $setfilename = "<setfilename>$Texi2HTML::THISDOC{file_base_name}.$EXTENSION</setfilename>"
! 25140: unless (defined($Texi2HTML::THISDOC{'setfilename'}) and $Texi2HTML::THISDOC{'setfilename'} ne '');
! 25141: my $language = get_conf('documentlanguage');
! 25142: my $doctype = get_conf('doctype');
! 25143: print $fh <<EOT;
! 25144: <?xml version="1.0"?>
! 25145: $doctype
! 25146: <texinfo xml:lang="$language">
! 25147: $setfilename
! 25148: EOT
! 25149: }
! 25150:
! 25151: sub xml_print_page_foot($)
! 25152: {
! 25153: my $fh = shift;
! 25154: print $fh "". xml_close_section();
! 25155: print $fh <<EOT;
! 25156: </texinfo>
! 25157: EOT
! 25158: }
! 25159:
! 25160: sub xml_one_section($$)
! 25161: {
! 25162: my $fh = shift;
! 25163: my $element = shift;
! 25164: main::print_lines($fh);
! 25165: #print $fh "". xml_footing($element);
! 25166: &$print_foot_navigation($fh);
! 25167: &$print_page_foot($fh);
! 25168: }
! 25169:
! 25170: sub xml_heading($$$$$)
! 25171: {
! 25172: my $element = shift;
! 25173: my $command = shift;
! 25174: my $texi_line = shift;
! 25175: my $line = shift;
! 25176: my $in_preformatted = shift;
! 25177:
! 25178: #print STDERR "'$command' $line";
! 25179: if (defined($command) and $command =~ /heading/)
! 25180: {
! 25181: my $text = '';
! 25182: if (defined($line))
! 25183: {
! 25184: $text = $line;
! 25185: # this isn't done in main program in that case...
! 25186: chomp ($text);
! 25187: $text =~ s/^\s*//;
! 25188: }
! 25189: return "<${command}>$text</${command}>\n";
! 25190: }
! 25191: elsif (defined($command) and $command eq 'node')
! 25192: {
! 25193: #print STDERR "node $command $node_element->{'texi'}\n";
! 25194: my $result = '';
! 25195: $result .= xml_close_section();
! 25196: $result .= "<node>\n";
! 25197: $result .= "<nodename>$element->{'text'}</nodename>\n";
! 25198: foreach my $direction('nodenext', 'nodeprev', 'nodeup')
! 25199: {
! 25200: if ($element->{$direction})
! 25201: {
! 25202: $result .= "<${direction}>$element->{$direction}->{'text'}</${direction}>\n";
! 25203: }
! 25204: }
! 25205: $result .= "</node>\n";
! 25206: return $result;
! 25207:
! 25208: }
! 25209: else
! 25210: {
! 25211: my $result = '';
! 25212: $result .= xml_close_section();
! 25213: $result .= "<".xml_element_tag($element).">\n<title>$element->{'text'}</title>\n";
! 25214: $xml_current_section = $element;
! 25215: return $result;
! 25216: }
! 25217: }
! 25218:
! 25219: sub xml_element_tag($)
! 25220: {
! 25221: my $element = shift;
! 25222: my $class = $element->{'tag_level'};
! 25223: return $class;
! 25224: }
! 25225:
! 25226: sub xml_close_section()
! 25227: {
! 25228: my $element = $xml_current_section;
! 25229:
! 25230: if (!defined($element))
! 25231: {
! 25232: return '';
! 25233: }
! 25234: my $result = '';
! 25235:
! 25236: $xml_current_section = undef;
! 25237:
! 25238: # there is a special case for a @chapter that is a child of @top
! 25239: # but should not be considered as is, since it is also toplevel.
! 25240: # @part, however may have other toplevel elements as children.
! 25241: return '' if ($element->{'child'} and (!$element->{'child'}->{'toplevel'} or $element->{'tag'} ne 'top'));
! 25242: $result .= '</'.xml_element_tag($element).">\n";
! 25243:
! 25244: my $current = $element;
! 25245: # the second condition is such that top is closed only if it has
! 25246: # sub-elements below chapter.
! 25247: # the third condition is such that elements with a next element are
! 25248: # only closed for the last element, except when the next element is
! 25249: # toplevel and below top, such that @top is closed before the first
! 25250: # @chapter if there are @section or the like below @top
! 25251: while ($current->{'sectionup'} and !($current->{'sectionup'}->{'tag'} eq 'top' and $current->{'toplevel'}) and (!$current->{'childnext'} or ($current->{'childnext'}->{'toplevel'} and $current->{'sectionup'}->{'tag'} eq 'top')))
! 25252: {
! 25253: $current = $current->{'sectionup'};
! 25254: $result .= '</'.xml_element_tag($current).">\n";
! 25255: }
! 25256: return $result;
! 25257:
! 25258: ## there is a special case for a @chapter that is a child of @top
! 25259: ## but should not be considered as is, since it is also toplevel.
! 25260: #return '' if ($element->{'child'} and !$element->{'child'}->{'toplevel'});
! 25261: #$result .= '</'.xml_element_tag($element).">\n";
! 25262:
! 25263: #return $result if ($element->{'sectionnext'} or $element->{'level'} <= 1);
! 25264: #my $current = $element;
! 25265: #while ($current->{'level'} != 1 and $current->{'sectionup'} and !$current->{'sectionnext'})
! 25266: #{
! 25267: # $current = $current->{'sectionup'};
! 25268: # $result .= '</'.xml_element_tag($current).">\n";
! 25269: #}
! 25270: #return $result;
! 25271: }
! 25272:
! 25273: sub xml_end_section($$$)
! 25274: {
! 25275: my $fh = shift;
! 25276: my $end_foot_navigation = shift;
! 25277: my $element = shift;
! 25278: }
! 25279:
! 25280: sub xml_print_Top($$$)
! 25281: {
! 25282: my $fh = shift;
! 25283: my $has_top_heading = shift;
! 25284: my $element = shift;
! 25285: main::print_lines($fh, $Texi2HTML::THIS_SECTION);
! 25286: }
! 25287:
! 25288: sub xml_print_Top_footer($$)
! 25289: {
! 25290: my $fh = shift;
! 25291: my $end_page = shift;
! 25292: my $element = shift;
! 25293: }
! 25294:
! 25295: # FIXME warning:
! 25296: #
! 25297: # @samp{first para
! 25298: #
! 25299: # second para}.
! 25300: #
! 25301: # maybe should lead to:
! 25302: # <para><samp>first para second para</samp>.</para>
! 25303: #
! 25304: # But it leads to
! 25305: # <para><samp>first para
! 25306: # </samp></para>
! 25307: # <para><samp>second para</samp>.
! 25308: # </para>
! 25309: sub xml_paragraph($$$$$$$$$$$$)
! 25310: {
! 25311: my $text = shift;
! 25312: my $align = shift;
! 25313: my $indent = shift;
! 25314: my $paragraph_command = shift;
! 25315: my $paragraph_command_formatted = shift;
! 25316: my $paragraph_number = shift;
! 25317: my $format = shift;
! 25318: my $item_nr = shift;
! 25319: my $enumerate_style = shift;
! 25320: my $number = shift;
! 25321: my $command_stack_at_end = shift;
! 25322: my $command_stack_at_begin = shift;
! 25323:
! 25324: # no para in multitables, caption and shortcaptions.
! 25325: my $top_stack = '';
! 25326: $top_stack = $command_stack_at_begin->[-1] if (scalar (@$command_stack_at_begin));
! 25327: return $text if ($top_stack eq 'multitable' or $top_stack eq 'shortcaption' or $top_stack eq 'caption' or $top_stack eq 'documentdescription');
! 25328:
! 25329: if ($text =~ /\S/)
! 25330: {
! 25331: return "<para>$text</para>";
! 25332: }
! 25333: return $text;
! 25334: }
! 25335:
! 25336: sub xml_preformatted($$$$$$$$$$$$)
! 25337: {
! 25338: my $text = shift;
! 25339: my $pre_style = shift;
! 25340: my $class = shift;
! 25341: my $leading_command = shift;
! 25342: my $leading_command_formatted = shift;
! 25343: my $preformatted_number = shift;
! 25344: my $format = shift;
! 25345: my $item_nr = shift;
! 25346: my $enumerate_style = shift;
! 25347: my $number = shift;
! 25348: my $command_stack_at_end = shift;
! 25349: my $command_stack_at_begin = shift;
! 25350:
! 25351: return $text;
! 25352: }
! 25353:
! 25354: sub xml_misc_commands($$$$$)
! 25355: {
! 25356: my $macro = shift;
! 25357: my $line = shift;
! 25358: my $args = shift;
! 25359: my $stack = shift;
! 25360: my $state = shift;
! 25361:
! 25362: #print STDERR "$macro $line";
! 25363: #print STDERR "ARGS @$args\n" if defined ($args);
! 25364: return ($macro, $line, undef) unless($xml_misc_command_output{$macro});
! 25365:
! 25366: my $value_name = '';
! 25367: my $value = '';
! 25368: if ($macro eq 'set' or $macro eq 'clear')
! 25369: {
! 25370: my $value_line = $line;
! 25371: if ($value_line =~ s/^\s+([\w\-]+)//)
! 25372: {
! 25373: $value_name = $1;
! 25374: if ($macro eq 'set')
! 25375: {
! 25376: $value = $value_line;
! 25377: chomp ($value);
! 25378: $value =~ s/^\s*//;
! 25379: }
! 25380: }
! 25381: }
! 25382: my $result_text = "<${macro}></${macro}>";
! 25383: if ($macro eq 'set' or $macro eq 'clear')
! 25384: {
! 25385: $result_text = "<${macro}value name=\"$value_name\">$value</${macro}value>\n";
! 25386: }
! 25387: if ($macro eq 'c' or $macro eq 'comment' and scalar(@$args))
! 25388: {
! 25389: my $comment_line = $args->[0];
! 25390: chomp ($comment_line);
! 25391: # makeinfo remove all the leading spaces
! 25392: $comment_line =~ s/^\s//;
! 25393: $result_text = &$comment ($comment_line);
! 25394: }
! 25395: if ($macro eq 'frenchspacing')
! 25396: {
! 25397: my $value = $args->[0];
! 25398: $value =~ s/\s*//g;
! 25399: $result_text = "<${macro} var=\"$value\"></${macro}>";
! 25400: }
! 25401: if (grep {$macro eq $_} @xml_misc_elements_with_arg)
! 25402: {
! 25403: my $arg = $args->[0];
! 25404: $arg =~ s/^\s*//;
! 25405: chomp($arg);
! 25406: $result_text = "<${macro}>".main::substitute_line($arg, "\@$macro")."</${macro}>\n";
! 25407: }
! 25408: if (exists($xml_misc_elements_with_arg_map{$macro}))
! 25409: {
! 25410: my $arg = $args->[0];
! 25411: $arg =~ s/^\s*//;
! 25412: chomp($arg);
! 25413: $result_text = "<$xml_misc_elements_with_arg_map{$macro}>".main::substitute_line($arg, "\@$macro")."</$xml_misc_elements_with_arg_map{$macro}>\n";
! 25414: }
! 25415: if ($macro eq 'setfilename')
! 25416: {
! 25417: my $arg = $args->[0];
! 25418: #$arg =~ s/^\s*//;
! 25419: #$arg =~ s/\s*$//;
! 25420: #$arg = main::substitute_line($arg, "\@$macro");
! 25421: if ($arg =~ /\S/)
! 25422: {
! 25423: $arg = get_conf('setfilename');
! 25424: $arg =~ s/\.[^\.]*$//;
! 25425: $result_text = "<${macro}>${arg}.xml</${macro}>\n";
! 25426: }
! 25427: }
! 25428: return ($macro, $line, $result_text);
! 25429: }
! 25430:
! 25431:
! 25432: sub xml_anchor_label($$)
! 25433: {
! 25434: my $id = shift;
! 25435: my $anchor_text = shift;
! 25436: return '<anchor name="'. &$protect_text($anchor_text) . '"></anchor>';
! 25437: }
! 25438:
! 25439: sub xml_index_entry_command($$$$$)
! 25440: {
! 25441: my $command = shift;
! 25442: my $index_name = shift;
! 25443: my $label = shift;
! 25444: my $entry_texi = shift;
! 25445: my $entry_formatted = shift;
! 25446:
! 25447: return $label if (defined($label) and $label ne '');
! 25448: return xml_index_entry_label('','','',$main::index_prefix_to_name{$index_name}, '', '', $entry_formatted, {});
! 25449: }
! 25450:
! 25451: sub xml_index_entry_label($$$$$$$$$)
! 25452: {
! 25453: my $identifier = shift;
! 25454: my $preformatted = shift;
! 25455: my $formatted_entry = shift;
! 25456: my $index_name = shift;
! 25457: my $index_command = shift;
! 25458: my $texi_entry = shift;
! 25459: my $formatted_entry_reference = shift;
! 25460: my $in_region_not_in_output = shift;
! 25461: my $index_entry_ref = shift;
! 25462:
! 25463:
! 25464: return "<indexterm index=\"${index_name}\">${formatted_entry_reference}</indexterm>";
! 25465: }
! 25466:
! 25467: sub xml_listoffloats($$$)
! 25468: {
! 25469: my $style_texi = shift;
! 25470: my $style = shift;
! 25471: my $float_entries = shift;
! 25472: # FIXME style, style_texi? Protected?
! 25473: return "<listoffloats type=\"$style\"></listoffloats>";
! 25474: }
! 25475:
! 25476: sub xml_acronym_like($$$$$$)
! 25477: {
! 25478: my $command = shift;
! 25479: my $acronym_texi = shift;
! 25480: my $acronym_text = shift;
! 25481: my $with_explanation = shift;
! 25482: my $explanation_lines = shift;
! 25483: my $explanation_text = shift;
! 25484: my $explanation_simply_formatted = shift;
! 25485:
! 25486: $command = 'abbrev' if ($command eq 'abbr');
! 25487: my $opening = "<${command}><${command}word>$acronym_text</${command}word>";
! 25488: if ($with_explanation)
! 25489: {
! 25490: $opening .= "<${command}desc>$explanation_text</${command}desc>";
! 25491: }
! 25492: return $opening . "</${command}>";
! 25493: }
! 25494:
! 25495: sub xml_foot_line_and_ref($$$$$$$)
! 25496: {
! 25497: my $number_in_doc = shift;
! 25498: my $number_in_page = shift;
! 25499: my $footnote_id = shift;
! 25500: my $place_id = shift;
! 25501: my $document_file = shift;
! 25502: my $footnote_file = shift;
! 25503: my $lines = shift;
! 25504: my $state = shift;
! 25505:
! 25506: my $result = '<footnote>';
! 25507: foreach my $line (@$lines)
! 25508: {
! 25509: $result .= $line;
! 25510: }
! 25511: return ([], $result . '</footnote>');
! 25512: }
! 25513:
! 25514: sub xml_image($$$$$$$$$$$$$)
! 25515: {
! 25516: my $file = shift;
! 25517: my $base = shift;
! 25518: my $preformatted = shift;
! 25519: my $file_name = shift;
! 25520: my $alt = shift;
! 25521: my $width = shift;
! 25522: my $height = shift;
! 25523: my $raw_alt = shift;
! 25524: my $extension = shift;
! 25525: my $working_dir = shift;
! 25526: my $file_path = shift;
! 25527: my $in_paragraph = shift;
! 25528: my $file_locations = shift;
! 25529:
! 25530: $alt = '' if (!defined($alt));
! 25531: # dirty hack to avoid " that can be here because of a @verb
! 25532: $alt =~ s/"/"/g;
! 25533:
! 25534: $width = '' if (!defined($width));
! 25535: $height = '' if (!defined($height));
! 25536:
! 25537: my $tag = 'inlineimage';
! 25538: $tag = 'image' if ($preformatted or !$in_paragraph);
! 25539:
! 25540: return "<$tag width=\"$width\" height=\"$height\" name=\"". &$protect_text($base)."\" extension=\"$extension\"><alttext>$alt</alttext></$tag>";
! 25541: }
! 25542:
! 25543: sub xml_sp($$)
! 25544: {
! 25545: my $number = shift;
! 25546: my $preformatted = shift;
! 25547: return "<sp lines=\"$number\"></sp>\n";
! 25548: }
! 25549:
! 25550: sub xml_quotation($$$$$)
! 25551: {
! 25552: my $command = shift;
! 25553: my $text = shift;
! 25554: my $argument_text = shift;
! 25555: my $argument_text_texi = shift;
! 25556: my $authors = shift;
! 25557: return "<$command>\n" . $text . "</$command>\n";
! 25558: }
! 25559:
! 25560: sub xml_format_list_item_texi($$$$)
! 25561: {
! 25562: my $format = shift;
! 25563: my $line = shift;
! 25564: my $prepended = shift;
! 25565: my $command = shift;
! 25566:
! 25567: my $result_line = undef;
! 25568:
! 25569: if (defined($command) and $command ne '' and !exists $special_list_commands{$format}->{$command} and $format ne 'itemize')
! 25570: {
! 25571: #@*table
! 25572: $line =~ s/^\s*//;
! 25573: $line =~ s/\s*$//;
! 25574: if (exists ($style_map{$command}))
! 25575: {
! 25576: $result_line = "\@$command\{$line\}\n";
! 25577: }
! 25578: elsif (exists ($things_map{$command}))
! 25579: {
! 25580: $result_line = "\@$command\{\} $line\n";
! 25581: }
! 25582: else
! 25583: {
! 25584: $result_line = "\@$command $line\n";
! 25585: }
! 25586: }
! 25587:
! 25588: return ($result_line, 0);
! 25589: }
! 25590:
! 25591: sub xml_list_item($$$$$$$$$)
! 25592: {
! 25593: my $text = shift;
! 25594: my $format = shift;
! 25595: my $command = shift;
! 25596: my $formatted_command = shift;
! 25597: my $item_nr = shift;
! 25598: my $enumerate_style = shift;
! 25599: my $number = shift;
! 25600: my $prepended = shift;
! 25601: my $prepended_formatted = shift;
! 25602:
! 25603: return '<item>' . $text . "</item>\n";
! 25604: }
! 25605:
! 25606: sub xml_init_variables()
! 25607: {
! 25608: @xml_multitable_stack = ();
! 25609: @xml_table_stack = ();
! 25610: $xml_current_section = undef;
! 25611: $Texi2HTML::THISDOC{'SPLIT'} = 0 if ($OUTPUT_FORMAT eq 'xml');
! 25612: }
! 25613:
! 25614: # row in multitable
! 25615: sub xml_row($$;$$)
! 25616: {
! 25617: my $text = shift;
! 25618: my $macro = shift;
! 25619: my $columnfractions = shift;
! 25620: my $prototype_row = shift;
! 25621: my $prototype_lengths = shift;
! 25622: my $column_number = shift;
! 25623:
! 25624: my $result = '';
! 25625: if ($macro eq 'headitem')
! 25626: {
! 25627: if ($xml_multitable_stack[-1] != 0)
! 25628: {
! 25629: $result .= "<thead>";
! 25630: $result = "</tbody>" . $result if ($xml_multitable_stack[-1] == 1);
! 25631: $xml_multitable_stack[-1] = 0;
! 25632: }
! 25633: }
! 25634: elsif ($xml_multitable_stack[-1] != 1)
! 25635: {
! 25636: $result .= "<tbody>";
! 25637: $result = "</thead>" . $result if ($xml_multitable_stack[-1] == 0);
! 25638: $xml_multitable_stack[-1] = 1;
! 25639: }
! 25640: $result .= "<row>$text</row>";
! 25641:
! 25642: return $result;
! 25643: }
! 25644:
! 25645: # cell in multitable
! 25646: sub xml_cell($$;$$)
! 25647: {
! 25648: my $text = shift;
! 25649: my $row_macro = shift;
! 25650: my $columnfractions = shift;
! 25651: my $prototype_row = shift;
! 25652: my $prototype_lengths = shift;
! 25653: my $column_number = shift;
! 25654:
! 25655: return "<entry>" . $text . '</entry>';
! 25656: }
! 25657:
! 25658: sub xml_table_list($$$$$$$$$)
! 25659: {
! 25660: my $format_command = shift;
! 25661: my $text = shift;
! 25662: my $command = shift;
! 25663: my $formatted_command = shift;
! 25664: # enumerate
! 25665: my $item_nr = shift;
! 25666: my $enumerate_style = shift;
! 25667: # itemize
! 25668: my $prepended = shift;
! 25669: my $prepended_formatted = shift;
! 25670: # multitable
! 25671: my $columnfractions = shift;
! 25672: my $prototype_row = shift;
! 25673: my $prototype_lengths = shift;
! 25674: my $number = shift;
! 25675:
! 25676: my $result = "<$format_command>";
! 25677: if ($format_command eq 'itemize')
! 25678: {
! 25679: my $itemfunction;
! 25680: $prepended_formatted =~ s/^\s*// if (defined($prepended_formatted));
! 25681: if (defined($formatted_command) and $formatted_command ne '')
! 25682: {
! 25683: $itemfunction = $formatted_command;
! 25684: $itemfunction .= " $prepended_formatted" if (defined($prepended_formatted) and $prepended_formatted ne '');
! 25685: }
! 25686: elsif (defined($prepended_formatted))
! 25687: {
! 25688: $itemfunction = $prepended_formatted;
! 25689: }
! 25690: $itemfunction = "•" if (!defined($itemfunction) or
! 25691: $itemfunction eq '');
! 25692: $result .= "<itemfunction>$itemfunction</itemfunction>";
! 25693: }
! 25694: elsif ($format_command eq 'enumerate')
! 25695: {
! 25696: $result = "<$format_command first=\"$enumerate_style\">";
! 25697: }
! 25698: elsif ($format_command eq 'multitable')
! 25699: {
! 25700: my $fractions;
! 25701: my $multiply = 1;
! 25702: if (defined($columnfractions) and (ref($columnfractions) eq 'ARRAY')
! 25703: and scalar(@$columnfractions))
! 25704: {
! 25705: $fractions = [ @$columnfractions ];
! 25706: $multiply = 100;
! 25707: }
! 25708: elsif (defined($prototype_lengths) and (ref($prototype_lengths) eq 'ARRAY')
! 25709: and scalar(@$prototype_lengths))
! 25710: {
! 25711: $fractions = [ @$prototype_lengths ];
! 25712: }
! 25713:
! 25714: if (defined ($fractions))
! 25715: {
! 25716: foreach my $fraction (@$fractions)
! 25717: {
! 25718: $result .= "<columnfraction>".($fraction*$multiply)."</columnfraction>\n";
! 25719: }
! 25720: }
! 25721: $text .= "</tbody>" if ($xml_multitable_stack[-1] == 1);
! 25722: $text .= "</thead>" if ($xml_multitable_stack[-1] == 0);
! 25723: pop @xml_multitable_stack;
! 25724: }
! 25725: elsif ($format_command =~ /^(v|f)?table$/)
! 25726: {
! 25727: $result = '<table>';
! 25728: $text .= '</tableitem>' if ($xml_table_stack[-1] == 1);
! 25729: pop @xml_table_stack;
! 25730: return $result . "$text</table>\n";
! 25731: }
! 25732: return $result . "$text</$format_command>\n";
! 25733: }
! 25734:
! 25735: sub xml_begin_format_texi($$$)
! 25736: {
! 25737: my $command = shift;
! 25738: my $line = shift;
! 25739: my $state = shift;
! 25740:
! 25741: push (@xml_multitable_stack, -1) if ($command eq 'multitable');
! 25742: push (@xml_table_stack, 0) if ($command =~ /^(v|f)?table/);
! 25743: return $line;
! 25744: }
! 25745:
! 25746: sub xml_def_line($$$$$$$$$$$$$$$)
! 25747: {
! 25748: my $category_prepared = shift;
! 25749: my $name = shift;
! 25750: my $type = shift;
! 25751: my $arguments = shift;
! 25752: my $index_label = shift;
! 25753: my $arguments_array = shift;
! 25754: my $arguments_type_array = shift;
! 25755: my $unformatted_arguments_array = shift;
! 25756: my $command = shift;
! 25757: my $class_name = shift;
! 25758: my $category = shift;
! 25759: my $class = shift;
! 25760: my $style = shift;
! 25761: my $original_command = shift;
! 25762:
! 25763: my $result = "<definitionterm><indexterm index=\""
! 25764: .$main::index_prefix_to_name{$style}."\">$class_name</indexterm>";
! 25765:
! 25766: my %arguments = ( 'prepared_category' => $category_prepared,
! 25767: 'category' => $category,
! 25768: 'name' => $name,
! 25769: 'type' => $type,
! 25770: 'class' => $class
! 25771: );
! 25772: foreach my $type (keys(%arguments))
! 25773: {
! 25774: $arguments{$type} = '' if (!defined($arguments{$type}));
! 25775: }
! 25776:
! 25777: foreach my $mandatory_arg (@{$def_format_xml{$command}})
! 25778: {
! 25779: my $elem = $mandatory_arg->[0];
! 25780: $result .= "<def$elem>$arguments{$mandatory_arg->[1]}</def$elem>";
! 25781: }
! 25782:
! 25783: my $params = '';
! 25784: my @types = @$arguments_type_array;
! 25785: foreach my $arg (@$arguments_array)
! 25786: {
! 25787: my $type = shift @types;
! 25788: if (grep {$_ eq $type} ('param', 'paramtype', 'delimiter'))
! 25789: {
! 25790: $result .= "<def$type>$arg</def$type>";
! 25791: }
! 25792: }
! 25793:
! 25794: $result .= "</definitionterm>\n";
! 25795: return $result;
! 25796: }
! 25797:
! 25798: # FIXME
! 25799: # @deffn
! 25800: # @c comment
! 25801: # @end deffn
! 25802: # leads to the creation of a <definitionitem> with a comment within,
! 25803: # while there should be no definitionitem
! 25804: sub xml_def_item($$)
! 25805: {
! 25806: my $text = shift;
! 25807: my $only_inter_item_commands = shift;
! 25808:
! 25809: if ($text =~ /\S/)
! 25810: {
! 25811: return '<definitionitem>' . $text . '</definitionitem>' unless $only_inter_item_commands;
! 25812: return $text;
! 25813: }
! 25814: return '';
! 25815: }
! 25816:
! 25817: sub xml_def($)
! 25818: {
! 25819: my $text = shift;
! 25820: return '<definition>'.$text.'</definition>';
! 25821: }
! 25822:
! 25823: sub xml_index_summary($$)
! 25824: {
! 25825: my $alpha = shift;
! 25826: my $nonalpha = shift;
! 25827: return '';
! 25828: }
! 25829:
! 25830: sub xml_printindex($$)
! 25831: {
! 25832: my $name = shift;
! 25833: my $printindex = shift;
! 25834: return "<printindex>$name</printindex>\n";
! 25835: }
! 25836:
! 25837: sub xml_any_ref($$)
! 25838: {
! 25839: my $type = shift;
! 25840: my $args = shift;
! 25841: my $result = '';
! 25842: if ($type eq 'pxref')
! 25843: {
! 25844: $result = gdt('see ',{'duplicate'=>1});
! 25845: }
! 25846: elsif ($type eq 'xref' or $type eq 'inforef')
! 25847: {
! 25848: $result = gdt('See ',{'duplicate'=>1});
! 25849: }
! 25850: if ($type eq 'inforef')
! 25851: {
! 25852: $result .= "<inforef><inforefnodename>$args->[0]</inforefnodename>";
! 25853: $result .= "<inforefrefname>$args->[1]</inforefrefname>" if ($args->[1] ne '');
! 25854: $result .= "<inforefinfoname>$args->[2]</inforefinfoname></inforef>"
! 25855: }
! 25856: else
! 25857: {
! 25858: $result .= "<xref><xrefnodename>$args->[0]</xrefnodename>";
! 25859: $result .= "<xrefinfoname>$args->[1]</xrefinfoname>" if ($args->[1] ne '');
! 25860: $result .= "<xrefprinteddesc>$args->[2]</xrefprinteddesc>" if ($args->[2] ne '');
! 25861: $result .= "<xrefinfofile>$args->[3]</xrefinfofile>" if ($args->[3] ne '');
! 25862: $result .= "<xrefprintedname>$args->[4]</xrefprintedname>" if ($args->[4] ne '');
! 25863: $result .= '</xref>';
! 25864: }
! 25865: return $result;
! 25866: }
! 25867:
! 25868: sub xml_external_ref($$$$$$$$$)
! 25869: {
! 25870: my $type = shift;
! 25871: my $section = shift;
! 25872: my $book = shift;
! 25873: my $file = shift;
! 25874: my $href = shift;
! 25875: my $cross_ref = shift;
! 25876: my $args_texi = shift;
! 25877: my $formatted_args = shift;
! 25878: my $node = shift;
! 25879:
! 25880: return xml_any_ref ($type, $formatted_args);
! 25881: }
! 25882:
! 25883: sub xml_internal_ref($$$$$)
! 25884: {
! 25885: my $type = shift;
! 25886: my $href = shift;
! 25887: my $short_name = shift;
! 25888: my $name = shift;
! 25889: my $is_section = shift;
! 25890: my $args_texi = shift;
! 25891: my $formatted_args = shift;
! 25892:
! 25893: return xml_any_ref ($type, $formatted_args);
! 25894: }
! 25895:
! 25896: sub xml_table_item($$$$$$$)
! 25897: {
! 25898: my $text = shift;
! 25899: my $index_label = shift;
! 25900: my $format = shift;
! 25901: my $command = shift;
! 25902: # my $formatted_command = shift;
! 25903: my $style_stack = shift;
! 25904: # my $text_formatted = shift;
! 25905: # my $text_formatted_leading_spaces = shift;
! 25906: # my $text_formatted_trailing_spaces = shift;
! 25907: my $item_cmd = shift;
! 25908: my $formatted_index_entry = shift;
! 25909:
! 25910:
! 25911: # $formatted_command = '' if (!defined($formatted_command));
! 25912: #
! 25913: # if (defined($text_formatted))
! 25914: # {
! 25915: # $text_item = $text_formatted_leading_spaces . $text_formatted .$text_formatted_trailing_spaces;
! 25916: # }
! 25917: # else
! 25918: # {
! 25919: # $text_item = $text;
! 25920: # }
! 25921:
! 25922: my $result = '';
! 25923: if ($item_cmd eq 'item')
! 25924: {
! 25925: $result .= '</tableitem>' if ($xml_table_stack[-1] == 1);
! 25926: $xml_table_stack[-1] = 1;
! 25927: $result .= '<tableitem>';
! 25928: }
! 25929: $result .= '<tableterm>';
! 25930: #print STDERR "$text | $format | $command | $formatted_command | $text_formatted | $item_cmd \n";
! 25931: my $indexterm = '';
! 25932: #print STDERR "FFFFFFFFFFFFFFFFf `$index_label' `$text'\n";
! 25933: if ($format =~ /^(v|f)/)
! 25934: {
! 25935: # my $index_prefix = $1;
! 25936: # $indexterm = $text;
! 25937: # $indexterm =~ s/^\s*//;
! 25938: # $result .= "<indexterm index=\"$main::index_prefix_to_name{$index_prefix}\">$formatted_index_entry</indexterm>";
! 25939: $result .= "$index_label";
! 25940: }
! 25941: $result .= $text ."</tableterm>\n";
! 25942: return $result;
! 25943: }
! 25944:
! 25945: sub xml_table_line($)
! 25946: {
! 25947: my $text = shift;
! 25948: my $only_inter_item_commands = shift;
! 25949: my $before_items = shift;
! 25950:
! 25951: if ($text =~ /\S/)
! 25952: {
! 25953: return "<item>$text</item>" unless $only_inter_item_commands;
! 25954: return $text;
! 25955: }
! 25956: else
! 25957: {
! 25958: return '';
! 25959: }
! 25960: }
! 25961:
! 25962: sub xml_caption_shortcaption($)
! 25963: {
! 25964: my $float = shift;
! 25965: my $caption_lines;
! 25966: my $shortcaption_lines;
! 25967: if (defined($float->{'caption_texi'}))
! 25968: {
! 25969: @$caption_lines = @{$float->{'caption_texi'}};
! 25970: }
! 25971: if (defined($float->{'shortcaption_texi'}))
! 25972: {
! 25973: @$shortcaption_lines = @{$float->{'shortcaption_texi'}};
! 25974: }
! 25975: return ($caption_lines, $shortcaption_lines);
! 25976: }
! 25977:
! 25978: sub xml_caption_shortcaption_command($$$)
! 25979: {
! 25980: my $command = shift;
! 25981: my $text = shift;
! 25982: my $texi_lines = shift;
! 25983: my $float_element = shift;
! 25984:
! 25985: if ($text =~ /\S/)
! 25986: {
! 25987: return "<$command>$text</$command>";
! 25988: }
! 25989: return '';
! 25990: }
! 25991:
! 25992: sub xml_float($$$$$)
! 25993: {
! 25994: my $text = shift;
! 25995: my $float = shift;
! 25996: my $caption = shift;
! 25997: my $shortcaption = shift;
! 25998:
! 25999: # FIXME don't use the texi, but a normalized node name
! 26000: my $label_texi = $float->{'texi'};
! 26001: $label_texi = '' if (!defined($label_texi));
! 26002: my $result = "<float name=\"$label_texi\">\n";
! 26003: my $style = $float->{'style'};
! 26004: $style = '' if (!defined($style));
! 26005: $result .= "<floattype>$style</floattype>\n";
! 26006: $result .= "<floatpos></floatpos>\n";
! 26007: $result .= $text;
! 26008: return $result."</float>\n";
! 26009: }
! 26010:
! 26011: sub xml_normal_text($$$$$$$;$)
! 26012: {
! 26013: my $text = shift;
! 26014: my $in_raw_text = shift;
! 26015: my $in_preformatted = shift;
! 26016: my $in_code = shift;
! 26017: my $in_math = shift;
! 26018: my $in_simple = shift;
! 26019: #print STDERR "Bug: in_raw_text in_simple $text\n" if ($in_raw_text and $in_simple);
! 26020: my $style_stack = shift;
! 26021: my $state = shift;
! 26022:
! 26023: $text = &$protect_text($text) unless($in_raw_text);
! 26024:
! 26025: if (! $in_code and !$in_preformatted and !$in_raw_text)
! 26026: {
! 26027: $text =~ s/---/\&mdash\;/g;
! 26028: $text =~ s/--/\&ndash\;/g;
! 26029: $text =~ s/``/\&ldquo\;/g;
! 26030: $text =~ s/''/\&rdquo\;/g;
! 26031: }
! 26032: return $text;
! 26033: }
! 26034:
! 26035: sub xml_paragraph_style_command($$)
! 26036: {
! 26037: my $format = shift;
! 26038: my $text = shift;
! 26039: return "<$format>$text</$format>" if ($format eq 'center');
! 26040: return $text;
! 26041: }
! 26042:
! 26043: sub xml_raw($$)
! 26044: {
! 26045: my $style = shift;
! 26046: my $text = shift;
! 26047:
! 26048: if ($style eq 'verbatim' or $style eq 'verbatiminclude')
! 26049: {
! 26050: return '<verbatim xml:space="preserve">' . &$protect_text($text) . '</verbatim>';
! 26051: }
! 26052: return '' unless (grep {$style eq $_} @EXPAND);
! 26053: if ($style eq 'xml')
! 26054: {
! 26055: chomp ($text);
! 26056: return $text;
! 26057: }
! 26058: else
! 26059: {
! 26060: main::msg_warn ("Raw style $style not handled", $Texi2HTML::THISDOC{'line_nr'});
! 26061: return &$protect_text($text);
! 26062: }
! 26063: }
! 26064:
! 26065: sub xml_cartouche($$)
! 26066: {
! 26067: my $text = shift;
! 26068:
! 26069: return "<cartouche>$text</cartouche>";
! 26070: }
! 26071:
! 26072: sub xml_noop
! 26073: {
! 26074: return '';
! 26075: }
! 26076:
! 26077: 1;
! 26078:
! 26079: require "$T2H_HOME/formats/xml.init"
! 26080: if ($0 =~ /\.pl$/ &&
! 26081: -e "$T2H_HOME/formats/xml.init" && -r "$T2H_HOME/formats/xml.init");
! 26082:
! 26083: # @INIT_PLAINTEXT@
! 26084: #+##############################################################################
! 26085: #
! 26086: # plaintext.init: convert to plaintext
! 26087: #
! 26088: # Copyright (C) 2009 Patrice Dumas <pertusus@free.fr>
! 26089: #
! 26090: # This program is free software; you can redistribute it and/or modify
! 26091: # it under the terms of the GNU General Public License as published by
! 26092: # the Free Software Foundation; either version 2 of the License, or
! 26093: # (at your option) any later version.
! 26094: #
! 26095: # This program is distributed in the hope that it will be useful,
! 26096: # but WITHOUT ANY WARRANTY; without even the implied warranty of
! 26097: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 26098: # GNU General Public License for more details.
! 26099: #
! 26100: # You should have received a copy of the GNU General Public License
! 26101: # along with this program; if not, write to the Free Software
! 26102: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
! 26103: # 02110-1301 USA
! 26104: #
! 26105: #-##############################################################################
! 26106:
! 26107: use strict;
! 26108:
! 26109: sub plaintext_default_load(;$)
! 26110: {
! 26111: my $from_command_line = shift;
! 26112: info_default_load();
! 26113:
! 26114: $SHOW_MENU = 0;
! 26115: $OUT = '-' unless(defined($OUT) and $OUT !~ m:/$:);
! 26116: $HEADERS = 0;
! 26117: @T2H_FORMAT_EXPAND = ('plaintext');
! 26118:
! 26119: $print_page_head = \&plaintext_default_print_page_head;
! 26120: $print_page_foot = \&plaintest_default_print_page_foot;
! 26121: $element_heading = \&plaintext_default_element_heading;
! 26122: $image = \&plaintext_default_image;
! 26123: $print_index = \&plaintext_default_print_index;
! 26124:
! 26125: }
! 26126:
! 26127: sub plaintext_default_print_page_head($)
! 26128: {
! 26129: my $fh = shift;
! 26130: }
! 26131:
! 26132: sub plaintest_default_print_page_foot($)
! 26133: {
! 26134: my $fh = shift;
! 26135: }
! 26136:
! 26137: sub plaintext_default_element_heading($$$$$$$$$$$$)
! 26138: {
! 26139: my $info_result = &Texi2HTML::Config::info_default_element_heading(@_);
! 26140: my $element = shift;
! 26141: my $command = shift;
! 26142: my $texi_line = shift;
! 26143: my $line = shift;
! 26144: my $in_preformatted = shift;
! 26145: my $one_section = shift;
! 26146: my $element_heading = shift;
! 26147: my $first_in_page = shift;
! 26148: my $is_top = shift;
! 26149: my $previous_is_top = shift;
! 26150: my $command_line = shift;
! 26151: my $element_id = shift;
! 26152: my $new_element = shift;
! 26153:
! 26154: return $info_result if (!$element->{'node'});
! 26155: return '';
! 26156: }
! 26157:
! 26158: sub plaintext_default_image($$$$$$$$$$$$$$$$$)
! 26159: {
! 26160: my $file = shift;
! 26161: my $base = shift;
! 26162: my $preformatted = shift;
! 26163: my $file_name = shift;
! 26164: my $alt = shift;
! 26165: my $width = shift;
! 26166: my $height = shift;
! 26167: my $raw_alt = shift;
! 26168: my $extension = shift;
! 26169: my $working_dir = shift;
! 26170: my $file_path = shift;
! 26171: my $in_paragraph = shift;
! 26172: my $file_locations = shift;
! 26173: my $base_simple_format = shift;
! 26174: my $extension_simple_format = shift;
! 26175: my $file_name_simple_format = shift;
! 26176: my $line_nr = shift;
! 26177:
! 26178: my $txt_path;
! 26179: my $found_file;
! 26180:
! 26181: my @extensions = @IMAGE_EXTENSIONS;
! 26182: if (defined($extension) and ($extension ne ''))
! 26183: {
! 26184: unshift @extensions, ".$extension";
! 26185: unshift @extensions, "$extension";
! 26186: }
! 26187: else
! 26188: {
! 26189: $extension = undef;
! 26190: }
! 26191: my $file_found_index = undef;
! 26192: my $file_index = 0;
! 26193:
! 26194: foreach my $file_location (@$file_locations)
! 26195: {
! 26196: my ($file_located, $path, $file_simple_format) = @$file_location;
! 26197: my $extension = shift @extensions;
! 26198: if (defined($path))
! 26199: {
! 26200: if ($extension eq 'txt' and !defined($txt_path))
! 26201: {
! 26202: $txt_path = $path;
! 26203: }
! 26204: elsif (!defined($found_file))
! 26205: {
! 26206: $found_file = [$file_located, $extension, $file_simple_format];
! 26207: $file_found_index = $file_index;
! 26208: }
! 26209: }
! 26210: $file_index++;
! 26211: }
! 26212:
! 26213: my $text = '';
! 26214: if (defined($txt_path))
! 26215: {
! 26216: if (open(TXT, "<$txt_path"))
! 26217: {
! 26218: if (defined($Texi2HTML::THISDOC{'IN_ENCODING'}) and $USE_UNICODE)
! 26219: {
! 26220: binmode(TXT, ":encoding($Texi2HTML::THISDOC{'IN_ENCODING'})");
! 26221: }
! 26222: $text='[' if ($in_paragraph or $preformatted);
! 26223: while (my $img_txt = <TXT>)
! 26224: {
! 26225: $text .= $img_txt;
! 26226: }
! 26227: $text .= ']' if ($in_paragraph or $preformatted);
! 26228: close(TXT);
! 26229: }
! 26230: else
! 26231: {
! 26232: main::line_warn (sprintf(__("\@image file `%s' unreadable: %s"), $txt_path, $!), $line_nr);
! 26233: }
! 26234: }
! 26235: elsif (!defined($found_file))
! 26236: {
! 26237: main::line_warn (sprintf(__("Cannot find \@image file `%s.txt'"), $base), $line_nr);
! 26238: }
! 26239: return $text;
! 26240: }
! 26241:
! 26242: sub plaintext_default_print_index($$)
! 26243: {
! 26244: my $text = shift;
! 26245: my $name = shift;
! 26246: return '';
! 26247: }
! 26248:
! 26249: 1;
! 26250:
! 26251: require "$T2H_HOME/formats/plaintext.init"
! 26252: if ($0 =~ /\.pl$/ &&
! 26253: -e "$T2H_HOME/formats/plaintext.init" && -r "$T2H_HOME/formats/plaintext.init");
! 26254:
! 26255: my $translation_file = 'translations.pl'; # file containing all the translations
! 26256: my $T2H_OBSOLETE_STRINGS;
! 26257:
! 26258: # leave this within comments, and keep the require statement
! 26259: # This way, you can directly run texi2html.pl,
! 26260: # if $T2H_HOME/translations.pl exists.
! 26261: #
! 26262: # @T2H_TRANSLATIONS_FILE@
! 26263: # Automatically generated file. Edit the .po file instead.
! 26264: $LANGUAGES->{'nl'} = {
! 26265: ' The buttons in the navigation panels have the following meaning:' => '',
! 26266: ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => '',
! 26267: ' Up ' => '',
! 26268: '(outside of any element)' => '',
! 26269: '(outside of any node)' => '',
! 26270: '@b{{quotation_arg}:} ' => '',
! 26271: '@center --- @emph{{author}}
! 26272: ' => '',
! 26273: '@cite{{book}}' => '',
! 26274: '@{No value for `{value}\'@}' => '',
! 26275: 'About' => '',
! 26276: 'About (help)' => '',
! 26277: 'About This Document' => 'No translation available!',
! 26278: 'April' => 'April',
! 26279: 'August' => 'Augustus',
! 26280: 'Back' => '',
! 26281: 'Back section in previous file' => '',
! 26282: 'Beginning of this chapter or previous chapter' => '',
! 26283: 'Button' => '',
! 26284: 'Contents' => '',
! 26285: 'Cover (top) of document' => '',
! 26286: 'Current' => '',
! 26287: 'Current Position' => '',
! 26288: 'Current section' => '',
! 26289: 'December' => 'December',
! 26290: 'FastBack' => '',
! 26291: 'FastForward' => '',
! 26292: 'February' => 'Februari',
! 26293: 'First' => '',
! 26294: 'First section in reading order' => '',
! 26295: 'Following' => '',
! 26296: 'Following node' => '',
! 26297: 'Footnotes' => 'No translation available!',
! 26298: 'Forward' => '',
! 26299: 'Forward section in next file' => '',
! 26300: 'From 1.2.3 go to' => '',
! 26301: 'Go to' => '',
! 26302: 'Index' => 'Index',
! 26303: 'Index Entry' => '',
! 26304: 'January' => 'Januari',
! 26305: 'July' => 'Juli',
! 26306: 'Jump to' => '',
! 26307: 'June' => 'Juni',
! 26308: 'Last' => '',
! 26309: 'Last section in reading order' => '',
! 26310: 'March' => 'Maart',
! 26311: 'May' => 'Mei',
! 26312: 'Menu:' => '',
! 26313: 'Name' => '',
! 26314: 'Next' => '',
! 26315: 'Next chapter' => '',
! 26316: 'Next file' => '',
! 26317: 'Next node' => '',
! 26318: 'Next section in reading order' => '',
! 26319: 'Next section on same level' => '',
! 26320: 'NextFile' => '',
! 26321: 'Node following in node reading order' => '',
! 26322: 'Node up' => '',
! 26323: 'NodeNext' => '',
! 26324: 'NodePrev' => '',
! 26325: 'NodeUp' => '',
! 26326: 'November' => 'November',
! 26327: 'October' => 'Oktober',
! 26328: 'Overview' => '',
! 26329: 'Prev' => '',
! 26330: 'PrevFile' => '',
! 26331: 'Previous' => '',
! 26332: 'Previous file' => '',
! 26333: 'Previous node' => '',
! 26334: 'Previous section in reading order' => '',
! 26335: 'Previous section on same level' => '',
! 26336: 'Section' => '',
! 26337: 'Section One' => '',
! 26338: 'See ' => '',
! 26339: 'See @cite{{book}}' => '',
! 26340: 'See `{section}\'' => '',
! 26341: 'See `{section}\' in @cite{{book}}' => '',
! 26342: 'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26343: 'See section {reference_name}' => '',
! 26344: 'See {reference_name}' => '',
! 26345: 'See {reference}' => '',
! 26346: 'See {reference} in @cite{{book}}' => '',
! 26347: 'See {ref}' => '',
! 26348: 'See {title_ref}' => '',
! 26349: 'September' => 'September',
! 26350: 'Short Table of Contents' => 'Korte inhoudsopgave',
! 26351: 'Short table of contents' => '',
! 26352: 'Subsection One-Four' => '',
! 26353: 'Subsection One-One' => '',
! 26354: 'Subsection One-Three' => '',
! 26355: 'Subsection One-Two' => '',
! 26356: 'Subsubsection One-Two-Four' => '',
! 26357: 'Subsubsection One-Two-One' => '',
! 26358: 'Subsubsection One-Two-Three' => '',
! 26359: 'Subsubsection One-Two-Two' => '',
! 26360: 'Table of Contents' => 'Inhoudsopgave',
! 26361: 'Table of contents' => '',
! 26362: 'The node you are looking for is at {href}.' => '',
! 26363: 'This' => '',
! 26364: 'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => '',
! 26365: 'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => '',
! 26366: 'Top' => '',
! 26367: 'Untitled Document' => '',
! 26368: 'Up' => '',
! 26369: 'Up node' => '',
! 26370: 'Up section' => '',
! 26371: '`{section}\'' => '',
! 26372: '`{section}\' in @cite{{book}}' => '',
! 26373: 'current' => '',
! 26374: 'on @emph{{date}}' => '',
! 26375: 'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26376: 'see ' => '',
! 26377: 'see @cite{{book}}' => '',
! 26378: 'see `{section}\'' => '',
! 26379: 'see `{section}\' in @cite{{book}}' => '',
! 26380: 'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26381: 'see section {reference_name}' => '',
! 26382: 'see {reference_name}' => '',
! 26383: 'see {reference}' => '',
! 26384: 'see {reference} in @cite{{book}}' => '',
! 26385: 'see {ref}' => '',
! 26386: 'see {title_ref}' => '',
! 26387: '{acronym_like} ({explanation})' => '',
! 26388: '{month} {day}, {year}' => '',
! 26389: '{name} of {class}' => '',
! 26390: '{name} on {class}' => '',
! 26391: '{reference_name}' => '',
! 26392: '{reference}' => '',
! 26393: '{reference} in @cite{{book}}' => '',
! 26394: '{ref}' => '',
! 26395: '{style} {number}' => '',
! 26396: '{style}: {caption_first_line}' => '',
! 26397: '{style}: {shortcaption_first_line}' => '',
! 26398: '{title_ref}' => ''
! 26399: };
! 26400: # Automatically generated file. Edit the .po file instead.
! 26401: $LANGUAGES->{'ja'} = {
! 26402: ' The buttons in the navigation panels have the following meaning:' => 'ナビゲーションパネル中のボタンには以下の意味があります。',
! 26403: ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => '@strong{例}では、以下に示す構造を持つ文書の@strong{1.2.3項}を現在位置に仮定しています。',
! 26404: ' Up ' => '上',
! 26405: '(outside of any element)' => '',
! 26406: '(outside of any node)' => '',
! 26407: '@b{{quotation_arg}:} ' => '',
! 26408: '@center --- @emph{{author}}
! 26409: ' => '',
! 26410: '@cite{{book}}' => '',
! 26411: '@{No value for `{value}\'@}' => '',
! 26412: 'About' => '',
! 26413: 'About (help)' => '',
! 26414: 'About This Document' => 'この文書について',
! 26415: 'April' => '4月',
! 26416: 'August' => '8月',
! 26417: 'Back' => '',
! 26418: 'Back section in previous file' => '',
! 26419: 'Beginning of this chapter or previous chapter' => '',
! 26420: 'Button' => 'ボタン',
! 26421: 'Contents' => '目次',
! 26422: 'Cover (top) of document' => '',
! 26423: 'Current' => '',
! 26424: 'Current Position' => '現在位置',
! 26425: 'Current section' => '',
! 26426: 'December' => '12月',
! 26427: 'FastBack' => '',
! 26428: 'FastForward' => '',
! 26429: 'February' => '2月',
! 26430: 'First' => '',
! 26431: 'First section in reading order' => '',
! 26432: 'Following' => '',
! 26433: 'Following node' => '',
! 26434: 'Footnotes' => '脚注',
! 26435: 'Forward' => '',
! 26436: 'Forward section in next file' => '',
! 26437: 'From 1.2.3 go to' => '1.2.3項からの移動先',
! 26438: 'Go to' => '移動先',
! 26439: 'Index' => '見出し',
! 26440: 'Index Entry' => '見出し一覧',
! 26441: 'January' => '1月',
! 26442: 'July' => '7月',
! 26443: 'Jump to' => '移動',
! 26444: 'June' => '6月',
! 26445: 'Last' => '',
! 26446: 'Last section in reading order' => '',
! 26447: 'March' => '3月',
! 26448: 'May' => '5月',
! 26449: 'Menu:' => 'メニュー',
! 26450: 'Name' => '名称',
! 26451: 'Next' => '次',
! 26452: 'Next chapter' => '',
! 26453: 'Next file' => '',
! 26454: 'Next node' => '',
! 26455: 'Next section in reading order' => '',
! 26456: 'Next section on same level' => '',
! 26457: 'NextFile' => '',
! 26458: 'Node following in node reading order' => '',
! 26459: 'Node up' => '',
! 26460: 'NodeNext' => '',
! 26461: 'NodePrev' => '',
! 26462: 'NodeUp' => '',
! 26463: 'November' => '11月',
! 26464: 'October' => '10月',
! 26465: 'Overview' => '概要',
! 26466: 'Prev' => '前',
! 26467: 'PrevFile' => '',
! 26468: 'Previous' => '',
! 26469: 'Previous file' => '',
! 26470: 'Previous node' => '',
! 26471: 'Previous section in reading order' => '',
! 26472: 'Previous section on same level' => '',
! 26473: 'Section' => '項',
! 26474: 'Section One' => '第1項',
! 26475: 'See ' => '',
! 26476: 'See @cite{{book}}' => '',
! 26477: 'See `{section}\'' => '項',
! 26478: 'See `{section}\' in @cite{{book}}' => '@cite{{book}}の `{section}\' ',
! 26479: 'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26480: 'See section {reference_name}' => '',
! 26481: 'See {reference_name}' => '',
! 26482: 'See {reference}' => '',
! 26483: 'See {reference} in @cite{{book}}' => '{node_file_href} @cite{{book}}参照',
! 26484: 'See {ref}' => '',
! 26485: 'See {title_ref}' => '',
! 26486: 'September' => '9月',
! 26487: 'Short Table of Contents' => '簡略化した目次',
! 26488: 'Short table of contents' => '',
! 26489: 'Subsection One-Four' => '第1.4項',
! 26490: 'Subsection One-One' => '第1.1項',
! 26491: 'Subsection One-Three' => '第1.3項',
! 26492: 'Subsection One-Two' => '第1.2項',
! 26493: 'Subsubsection One-Two-Four' => '第1.2.4項',
! 26494: 'Subsubsection One-Two-One' => '第1.2.1項',
! 26495: 'Subsubsection One-Two-Three' => '第1.2.3項',
! 26496: 'Subsubsection One-Two-Two' => '第1.2.2項',
! 26497: 'Table of Contents' => '目次',
! 26498: 'Table of contents' => '',
! 26499: 'The node you are looking for is at {href}.' => '',
! 26500: 'This' => '',
! 26501: 'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'この文書は@emph{{date}}に@uref{{program_homepage}, @emph{{program}}}を用いて生成されました。',
! 26502: 'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'この文書は@uref{{program_homepage}, @emph{{program}}}を用いて生成されました。',
! 26503: 'Top' => '冒頭',
! 26504: 'Untitled Document' => '無題の文書',
! 26505: 'Up' => '',
! 26506: 'Up node' => '',
! 26507: 'Up section' => '',
! 26508: '`{section}\'' => '項',
! 26509: '`{section}\' in @cite{{book}}' => '@cite{{book}}の `{section}\' ',
! 26510: 'current' => '現在位置',
! 26511: 'on @emph{{date}}' => '@emph{{date}}',
! 26512: 'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26513: 'see ' => '',
! 26514: 'see @cite{{book}}' => '',
! 26515: 'see `{section}\'' => '',
! 26516: 'see `{section}\' in @cite{{book}}' => '@cite{{book}}の `{section}\' ',
! 26517: 'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26518: 'see section {reference_name}' => '',
! 26519: 'see {reference_name}' => '',
! 26520: 'see {reference}' => '{node_file_href}参照',
! 26521: 'see {reference} in @cite{{book}}' => '{node_file_href} @cite{{book}}参照',
! 26522: 'see {ref}' => '',
! 26523: 'see {title_ref}' => '',
! 26524: '{acronym_like} ({explanation})' => '',
! 26525: '{month} {day}, {year}' => '',
! 26526: '{name} of {class}' => '',
! 26527: '{name} on {class}' => '',
! 26528: '{reference_name}' => '',
! 26529: '{reference}' => '',
! 26530: '{reference} in @cite{{book}}' => '{node_file_href} @cite{{book}}参照',
! 26531: '{ref}' => '',
! 26532: '{style} {number}' => '',
! 26533: '{style}: {caption_first_line}' => '',
! 26534: '{style}: {shortcaption_first_line}' => '',
! 26535: '{title_ref}' => ''
! 26536: };
! 26537: # Automatically generated file. Edit the .po file instead.
! 26538: $LANGUAGES->{'fr'} = {
! 26539: ' The buttons in the navigation panels have the following meaning:' => ' Les boutons de navigation ont la signification suivante :',
! 26540: ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => ' Dans cet exemple on est @`a @strong{ Sous sous section un-deux-trois } dans un document dont la structure est :',
! 26541: ' Up ' => 'Plus haut',
! 26542: '(outside of any element)' => '',
! 26543: '(outside of any node)' => '',
! 26544: '@b{{quotation_arg}:} ' => '',
! 26545: '@center --- @emph{{author}}
! 26546: ' => '',
! 26547: '@cite{{book}}' => '',
! 26548: '@{No value for `{value}\'@}' => '',
! 26549: 'About' => 'A propos',
! 26550: 'About (help)' => 'A propos (page d\'aide)',
! 26551: 'About This Document' => 'A propos de ce document',
! 26552: 'April' => 'avril',
! 26553: 'August' => 'ao@^ut',
! 26554: 'Back' => 'Retour',
! 26555: 'Back section in previous file' => '',
! 26556: 'Beginning of this chapter or previous chapter' => 'D@\'ebut de ce chapitre ou chapitre pr@\'ec@\'edent',
! 26557: 'Button' => 'Bouton',
! 26558: 'Contents' => 'Table des mati@`eres',
! 26559: 'Cover (top) of document' => 'Couverture (top) du document',
! 26560: 'Current' => '',
! 26561: 'Current Position' => 'Position',
! 26562: 'Current section' => 'Section actuelle',
! 26563: 'December' => 'd@\'ecembre',
! 26564: 'FastBack' => 'RetourRapide',
! 26565: 'FastForward' => 'AvanceRapide',
! 26566: 'February' => 'f@\'evrier',
! 26567: 'First' => 'Premier',
! 26568: 'First section in reading order' => 'Premi@`e section dans l\'ordre de lecture',
! 26569: 'Following' => 'Suivant',
! 26570: 'Following node' => 'N@oe{}ud suivant',
! 26571: 'Footnotes' => 'Notes de bas de page',
! 26572: 'Forward' => 'Avant',
! 26573: 'Forward section in next file' => '',
! 26574: 'From 1.2.3 go to' => 'Depuis 1.2.3 aller @`a',
! 26575: 'Go to' => 'Aller @`a',
! 26576: 'Index' => 'Index',
! 26577: 'Index Entry' => 'Entr@\'ee d\'index',
! 26578: 'January' => 'janvier',
! 26579: 'July' => 'juillet',
! 26580: 'Jump to' => 'Aller @`a',
! 26581: 'June' => 'juin',
! 26582: 'Last' => 'Dernier',
! 26583: 'Last section in reading order' => 'Derni@`ere section dans l\'ordre de lecture',
! 26584: 'March' => 'mars',
! 26585: 'May' => 'mai',
! 26586: 'Menu:' => 'Menu@ :',
! 26587: 'Name' => 'Nom',
! 26588: 'Next' => 'Suivant',
! 26589: 'Next chapter' => 'Chapitre suivant',
! 26590: 'Next file' => 'Fichier suivant',
! 26591: 'Next node' => 'N@oe{}ud suivant',
! 26592: 'Next section in reading order' => 'Section suivante dans l\'ordre de lecture',
! 26593: 'Next section on same level' => 'Section suivante au m@^eme niveau',
! 26594: 'NextFile' => 'FichierSuivant',
! 26595: 'Node following in node reading order' => 'N@oe{}ud suivant dans l\'ordre de lecture',
! 26596: 'Node up' => 'N@oe{}ud au dessus',
! 26597: 'NodeNext' => 'N@oe{}udSuivant',
! 26598: 'NodePrev' => 'N@oe{}udPr@\'ec@\'edent',
! 26599: 'NodeUp' => 'N@oe{}udMonter',
! 26600: 'November' => 'novembre',
! 26601: 'October' => 'octobre',
! 26602: 'Overview' => 'Vue d\'ensemble',
! 26603: 'Prev' => 'Pr@\'ec@\'edent',
! 26604: 'PrevFile' => '',
! 26605: 'Previous' => '',
! 26606: 'Previous file' => 'Fichier pr@\'ec@\'edent',
! 26607: 'Previous node' => 'N@oe{}ud pr@\'ec@\'edent',
! 26608: 'Previous section in reading order' => 'Section pr@\'ec@\'edente dans l\'ordre de lecture',
! 26609: 'Previous section on same level' => 'Section pr@\'ec@\'edente au m@^eme niveau',
! 26610: 'Section' => '',
! 26611: 'Section One' => 'Section un',
! 26612: 'See ' => '',
! 26613: 'See @cite{{book}}' => 'Voir @cite{{book}}',
! 26614: 'See `{section}\'' => 'Section sup@\'erieure',
! 26615: 'See `{section}\' in @cite{{book}}' => 'Voir la section `{section}\' dans @cite{{book}}',
! 26616: 'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26617: 'See section {reference_name}' => 'Voir la section {reference_name}',
! 26618: 'See {node_file_href}' => 'Voir {node_file_href}',
! 26619: 'See {node_file_href} section `{section}\' in @cite{{book}}' => 'Voir {node_file_href} section `{section}\' dans @cite{{book}}',
! 26620: 'See {reference_name}' => 'Voir {reference_name}',
! 26621: 'See {reference}' => 'Voir {reference_name}',
! 26622: 'See {reference} in @cite{{book}}' => 'Voir {node_file_href} @cite{{book}}',
! 26623: 'See {ref}' => '',
! 26624: 'See {title_ref}' => '',
! 26625: 'September' => 'septembre',
! 26626: 'Short Table of Contents' => 'R@\'esum@\'e du contenu',
! 26627: 'Short table of contents' => 'R@\'esum@\'e du contenu',
! 26628: 'Subsection One-Four' => 'Sous section un-quatre',
! 26629: 'Subsection One-One' => 'Sous section un-un',
! 26630: 'Subsection One-Three' => 'Sous section un-trois',
! 26631: 'Subsection One-Two' => 'Sous section un-deux',
! 26632: 'Subsubsection One-Two-Four' => 'Sous sous section un-deux-quatre',
! 26633: 'Subsubsection One-Two-One' => 'Sous sous section un-deux-un',
! 26634: 'Subsubsection One-Two-Three' => 'Sous sous section un-deux-trois',
! 26635: 'Subsubsection One-Two-Two' => 'Sous sous section un-deux-deux',
! 26636: 'Table of Contents' => 'Table des mati@`eres',
! 26637: 'Table of contents' => 'Table des mati@`eres',
! 26638: 'The node you are looking for is at {href}.' => 'Le n@oe{}ud que vous recherchez est ici@ : {href}.',
! 26639: 'This' => 'Ici',
! 26640: 'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'Ce document a @\'et@\'e g@\'en@\'er@\'e le @emph{{date}} en utilisant @uref{{program_homepage}, @emph{{program}}}',
! 26641: 'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'Ce document a @\'et@\'e g@\'en@\'er@\'e en utilisant @uref{{program_homepage}, @emph{{program}}}.',
! 26642: 'Top' => 'Racine',
! 26643: 'Untitled Document' => 'Document sans titre',
! 26644: 'Up' => 'Monter',
! 26645: 'Up node' => 'N@oe{}ud au dessus',
! 26646: 'Up section' => 'Section sup@\'erieure',
! 26647: '`{section}\'' => 'Section sup@\'erieure',
! 26648: '`{section}\' in @cite{{book}}' => 'section `{section}\' dans @cite{{book}}',
! 26649: 'current' => 'courante',
! 26650: 'on @emph{{date}}' => 'le @emph{{date}}',
! 26651: 'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26652: 'see ' => '',
! 26653: 'see @cite{{book}}' => 'voir @cite{{book}}',
! 26654: 'see `{section}\'' => 'Section sup@\'erieure',
! 26655: 'see `{section}\' in @cite{{book}}' => 'section `{section}\' dans @cite{{book}}',
! 26656: 'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26657: 'see section `{section}\' in @cite{{book}}' => 'voir la section `{section}\' dans @cite{{book}}',
! 26658: 'see section {reference_name}' => 'voir la section {reference_name}',
! 26659: 'see {node_file_href}' => 'voir {node_file_href}',
! 26660: 'see {node_file_href} section `{section}\' in @cite{{book}}' => 'voir {node_file_href} section `{section}\' dans @cite{{book}}',
! 26661: 'see {reference_name}' => 'voir {reference_name}',
! 26662: 'see {reference}' => 'voir {reference_name}',
! 26663: 'see {reference} in @cite{{book}}' => 'voir {node_file_href} @cite{{book}}',
! 26664: 'see {ref}' => '',
! 26665: 'see {title_ref}' => '',
! 26666: '{acronym_like} ({explanation})' => '',
! 26667: '{month} {day}, {year}' => 'le {day} {month} {year}',
! 26668: '{name} of {class}' => '{name} de {class}',
! 26669: '{name} on {class}' => '{name} de {class}',
! 26670: '{node_file_href} section `{section}\' in @cite{{book}}' => '{node_file_href} section `{section}\' dans @cite{{book}}',
! 26671: '{reference_name}' => '',
! 26672: '{reference}' => 'voir {reference_name}',
! 26673: '{reference} in @cite{{book}}' => 'voir @cite{{book}}',
! 26674: '{ref}' => '',
! 26675: '{style} {number}' => '',
! 26676: '{style}: {caption_first_line}' => '',
! 26677: '{style}: {shortcaption_first_line}' => '',
! 26678: '{title_ref}' => ''
! 26679: };
! 26680: # Automatically generated file. Edit the .po file instead.
! 26681: $LANGUAGES->{'de'} = {
! 26682: ' The buttons in the navigation panels have the following meaning:' => ' Die Links in der Navigationsleiste haben die folgende Bedeutung: ',
! 26683: ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => ' wobei das @strong{ Beispiel } annimmt, dass die aktuelle Position bei @strong{ Unterabschnitt 1-2-3 } in einem Dokument mit folgender Struktur liegt:',
! 26684: ' Up ' => ' Nach oben ',
! 26685: '(outside of any element)' => '',
! 26686: '(outside of any node)' => '',
! 26687: '@b{{quotation_arg}:} ' => '@b{{quotation_arg}:} ',
! 26688: '@center --- @emph{{author}}
! 26689: ' => '',
! 26690: '@cite{{book}}' => '@cite{{book}}',
! 26691: '@{No value for `{value}\'@}' => '',
! 26692: 'About' => '@"Uber',
! 26693: 'About (help)' => '@"Uber (Hilfe)',
! 26694: 'About This Document' => '@"Uber dieses Dokument',
! 26695: 'April' => 'April',
! 26696: 'August' => 'August',
! 26697: 'Back' => 'Zur@"uck',
! 26698: 'Back section in previous file' => '',
! 26699: 'Beginning of this chapter or previous chapter' => 'Anfang dieses oder des letzten Kapitels',
! 26700: 'Button' => '',
! 26701: 'Contents' => 'Inhalt',
! 26702: 'Cover (top) of document' => 'Titelseite des Dokuments',
! 26703: 'Current' => '',
! 26704: 'Current Position' => 'Aktuelle Position',
! 26705: 'Current section' => 'Aktueller Abschnitt',
! 26706: 'December' => 'Dezember',
! 26707: 'FastBack' => '',
! 26708: 'FastForward' => '',
! 26709: 'February' => 'Februar',
! 26710: 'First' => '',
! 26711: 'First section in reading order' => 'Erster Abschnitt in Lesereihenfolge',
! 26712: 'Following' => '',
! 26713: 'Following node' => 'N@"achster Knoten',
! 26714: 'Footnotes' => 'Fu@ss{}noten',
! 26715: 'Forward' => 'Nach vorne',
! 26716: 'Forward section in next file' => '',
! 26717: 'From 1.2.3 go to' => 'Von 1.2.3 gehe zu',
! 26718: 'Go to' => 'Gehe zu',
! 26719: 'Index' => 'Index',
! 26720: 'Index Entry' => 'Indexeintrag',
! 26721: 'January' => 'Januar',
! 26722: 'July' => 'Juli',
! 26723: 'Jump to' => 'Springe zu',
! 26724: 'June' => 'Juni',
! 26725: 'Last' => '',
! 26726: 'Last section in reading order' => 'Letzter Abschnitt in Lesereihenfolge',
! 26727: 'March' => 'M@"arz',
! 26728: 'May' => 'Mai',
! 26729: 'Menu:' => 'Auswahl:',
! 26730: 'Name' => 'Name',
! 26731: 'Next' => '',
! 26732: 'Next chapter' => 'N@"achstes Kapitel',
! 26733: 'Next file' => '',
! 26734: 'Next node' => 'N@"achster Knoten',
! 26735: 'Next section in reading order' => 'N@"achster Abschnitt in Lesereihenfolge',
! 26736: 'Next section on same level' => 'N@"achster Abschitt derselben Ebene',
! 26737: 'NextFile' => '',
! 26738: 'Node following in node reading order' => 'N@"achster Abschnitt in Lesereihenfolge',
! 26739: 'Node up' => 'Knoten nach oben',
! 26740: 'NodeNext' => '',
! 26741: 'NodePrev' => '',
! 26742: 'NodeUp' => '',
! 26743: 'November' => 'November',
! 26744: 'October' => 'Oktober',
! 26745: 'Overview' => '@"Ubersicht',
! 26746: 'Prev' => '',
! 26747: 'PrevFile' => '',
! 26748: 'Previous' => '',
! 26749: 'Previous file' => '',
! 26750: 'Previous node' => 'Voriger Knoten',
! 26751: 'Previous section in reading order' => 'Voriger Abschnitt in Lesereihenfolge',
! 26752: 'Previous section on same level' => 'Voriger Abschnitt derselben Ebene',
! 26753: 'Section' => 'Abschnitt',
! 26754: 'Section One' => 'Abschnitt 1',
! 26755: 'See ' => '',
! 26756: 'See @cite{{book}}' => '',
! 26757: 'See `{section}\'' => 'Abschnitt nach oben',
! 26758: 'See `{section}\' in @cite{{book}}' => 'Siehe Abschnitt `{section}\' in @cite{{book}}',
! 26759: 'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26760: 'See section {reference_name}' => '',
! 26761: 'See {node_file_href}' => 'Siehe {node_file_href}',
! 26762: 'See {node_file_href} section `{section}\' in @cite{{book}}' => 'Siehe {node_file_href} in Abschnitt `{section}\' in @cite{{book}}',
! 26763: 'See {reference_name}' => '',
! 26764: 'See {reference}' => 'siehe {reference_name}',
! 26765: 'See {reference} in @cite{{book}}' => 'Siehe {node_file_href} @cite{{book}}',
! 26766: 'See {ref}' => '',
! 26767: 'See {title_ref}' => '',
! 26768: 'September' => 'September',
! 26769: 'Short Table of Contents' => 'Kurzes Inhaltsverzeichnis',
! 26770: 'Short table of contents' => 'Kurzes Inhaltsverzeichnis',
! 26771: 'Subsection One-Four' => 'Unterabschnitt 1-4',
! 26772: 'Subsection One-One' => 'Unterabschnitt 1-1',
! 26773: 'Subsection One-Three' => 'Unterabschnitt 1-3',
! 26774: 'Subsection One-Two' => 'Unterabschnitt 1-2',
! 26775: 'Subsubsection One-Two-Four' => 'Unterabschnitt 1-2-4',
! 26776: 'Subsubsection One-Two-One' => 'Unterabschnitt 1-2-1',
! 26777: 'Subsubsection One-Two-Three' => 'Unterabschnitt 1-2-3',
! 26778: 'Subsubsection One-Two-Two' => 'Unterabschnitt 1-2-2',
! 26779: 'Table of Contents' => 'Inhaltsverzeichnis',
! 26780: 'Table of contents' => 'Inhaltsverzeichnis',
! 26781: 'The node you are looking for is at {href}.' => 'Der Knoten, den Sie sehen, befindet sich bei {href}',
! 26782: 'This' => '',
! 26783: 'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'Dieses Dokument wurde erzeugt am @i{{date}} durch @uref{{program_homepage}, @i{{program}}}.',
! 26784: 'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'Dieses Dokument wurde erzeugt durch @uref{{program_homepage}, @emph{{program}}}.',
! 26785: 'Top' => 'Anfang',
! 26786: 'Untitled Document' => 'Unbenanntes Dokumen',
! 26787: 'Up' => 'Nach oben',
! 26788: 'Up node' => 'Knoten nach oben',
! 26789: 'Up section' => 'Abschnitt nach oben',
! 26790: '`{section}\'' => 'Abschnitt nach oben',
! 26791: '`{section}\' in @cite{{book}}' => 'Abschnitt `{section}\' in @cite{{book}}',
! 26792: 'current' => '',
! 26793: 'on @emph{{date}}' => 'am @emph{{date}}',
! 26794: 'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26795: 'see ' => '',
! 26796: 'see @cite{{book}}' => 'siehe @cite{{book}}',
! 26797: 'see `{section}\'' => 'Abschnitt nach oben',
! 26798: 'see `{section}\' in @cite{{book}}' => 'Abschnitt `{section}\' in @cite{{book}}',
! 26799: 'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26800: 'see section `{section}\' in @cite{{book}}' => 'siehe Abschnitt `{section}\' in @cite{{book}}',
! 26801: 'see section {reference_name}' => 'siehe Abschnitt {reference_name}',
! 26802: 'see {node_file_href}' => 'siehe {node_file_href}',
! 26803: 'see {node_file_href} section `{section}\' in @cite{{book}}' => 'siehe {node_file_href} im Abschnitt `{section}\' in @cite{{book}}',
! 26804: 'see {reference_name}' => 'siehe {reference_name}',
! 26805: 'see {reference}' => 'siehe {reference_name}',
! 26806: 'see {reference} in @cite{{book}}' => 'siehe {node_file_href} @cite{{book}}',
! 26807: 'see {ref}' => '',
! 26808: 'see {title_ref}' => '',
! 26809: '{acronym_like} ({explanation})' => '{acronym_like} ({explanation})',
! 26810: '{month} {day}, {year}' => '{day}. {month} {year}',
! 26811: '{name} of {class}' => '',
! 26812: '{name} on {class}' => '',
! 26813: '{node_file_href} section `{section}\' in @cite{{book}}' => '{node_file_href} in Abschnitt `{section}\' in @cite{{book}}',
! 26814: '{reference_name}' => '{reference_name}',
! 26815: '{reference}' => '{reference_name}',
! 26816: '{reference} in @cite{{book}}' => 'siehe @cite{{book}}',
! 26817: '{ref}' => '',
! 26818: '{style} {number}' => '{style} {number}',
! 26819: '{style}: {caption_first_line}' => '{style}: {caption_first_line}',
! 26820: '{style}: {shortcaption_first_line}' => '{style}: {shortcaption_first_line}',
! 26821: '{title_ref}' => ''
! 26822: };
! 26823: # Automatically generated file. Edit the .po file instead.
! 26824: $LANGUAGES->{'pt'} = {
! 26825: ' The buttons in the navigation panels have the following meaning:' => ' Os bot@~oes nos pain@\'eis de navega@,{c}@~ao possuem os seguintes significados:',
! 26826: ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => ' onde o @strong{ Exemplo } assume que a posi@,{c}@~ao atual localiza-se em @strong{ Subsub@,{c}@~ao Um-Dois-Tr@^es } de um documento com a seguinte estrutura:',
! 26827: ' Up ' => ' Acima ',
! 26828: '(outside of any element)' => '',
! 26829: '(outside of any node)' => '',
! 26830: '@b{{quotation_arg}:} ' => '',
! 26831: '@center --- @emph{{author}}
! 26832: ' => '',
! 26833: '@cite{{book}}' => '',
! 26834: '@{No value for `{value}\'@}' => '',
! 26835: 'About' => 'Sobre',
! 26836: 'About (help)' => 'Sobre (ajuda)',
! 26837: 'About This Document' => 'Sobre Esse Documento',
! 26838: 'April' => 'Abril',
! 26839: 'August' => 'Agosto',
! 26840: 'Back' => 'Volta',
! 26841: 'Back section in previous file' => '',
! 26842: 'Beginning of this chapter or previous chapter' => 'Come@,{c}o desse cap@\'itulo ou cap@\'itulo anterior',
! 26843: 'Button' => 'Bot@~ao',
! 26844: 'Contents' => 'Conte@\'udo',
! 26845: 'Cover (top) of document' => 'In@\'icio (topo) do documento',
! 26846: 'Current' => '',
! 26847: 'Current Position' => 'Posi@,{c}@~ao Atual',
! 26848: 'Current section' => 'Se@,{c}@~ao atual',
! 26849: 'December' => 'Dezembro',
! 26850: 'FastBack' => 'Voltar R@\'apido',
! 26851: 'FastForward' => 'Avan@,{c}ar R@\'apido',
! 26852: 'February' => 'Fevereiro',
! 26853: 'First' => 'Primeiro',
! 26854: 'First section in reading order' => 'Primeira se@,{c}@~ao na ordem de leitura',
! 26855: 'Following' => 'Seguinte',
! 26856: 'Following node' => 'Nodo seguinte',
! 26857: 'Footnotes' => 'Notas de Rodap@\'e',
! 26858: 'Forward' => 'Avan@,{c}ar',
! 26859: 'Forward section in next file' => '',
! 26860: 'From 1.2.3 go to' => 'De 1.2.3 v@\'a para',
! 26861: 'Go to' => 'V@\'a para',
! 26862: 'Index' => '@\'Indice',
! 26863: 'Index Entry' => 'Entrada de @\'Indice',
! 26864: 'January' => 'Janeiro',
! 26865: 'July' => 'Julho',
! 26866: 'Jump to' => 'Pular para',
! 26867: 'June' => 'Junho',
! 26868: 'Last' => '@\'Ultimo',
! 26869: 'Last section in reading order' => '@\'Ultima se@,{c}@~ao na ordem de leitura',
! 26870: 'March' => 'Mar@,{c}o',
! 26871: 'May' => 'Maio',
! 26872: 'Menu:' => '',
! 26873: 'Name' => 'Nome',
! 26874: 'Next' => 'Pr@\'oximo',
! 26875: 'Next chapter' => 'Pr@\'oximo cap@\'itulo',
! 26876: 'Next file' => '',
! 26877: 'Next node' => 'Pr@\'oximo nodo',
! 26878: 'Next section in reading order' => 'Pr@\'oxima se@,{c}@~ao na ordem de leitura',
! 26879: 'Next section on same level' => 'Pr@\'oxima se@,{c}@~ao no mesmo n@\'ivel',
! 26880: 'NextFile' => '',
! 26881: 'Node following in node reading order' => 'Nodo seguinte na ordem de leitura de nodos',
! 26882: 'Node up' => 'Nodo acima',
! 26883: 'NodeNext' => 'Pr@\'oximo Nodo',
! 26884: 'NodePrev' => 'Nodo Anterior',
! 26885: 'NodeUp' => 'Nodo Acima',
! 26886: 'November' => 'Novembro',
! 26887: 'October' => 'Outubro',
! 26888: 'Overview' => 'Vis@~ao geral',
! 26889: 'Prev' => 'Pr@\'evio',
! 26890: 'PrevFile' => '',
! 26891: 'Previous' => '',
! 26892: 'Previous file' => '',
! 26893: 'Previous node' => 'Nodo anterior',
! 26894: 'Previous section in reading order' => 'Se@,{c}@~ao anterior na ordem de leitura',
! 26895: 'Previous section on same level' => 'Se@,{c}@~ao anterior no mesmo n@\'ivel',
! 26896: 'Section' => 'Se@,{c}@~ao',
! 26897: 'Section One' => 'Se@,{c}@~ao Um',
! 26898: 'See ' => '',
! 26899: 'See @cite{{book}}' => 'Veja @cite{{book}}',
! 26900: 'See `{section}\'' => 'Se@,{c}@~ao acima',
! 26901: 'See `{section}\' in @cite{{book}}' => 'Veja se@,{c}@~ao `{section}\' em @cite{{book}}',
! 26902: 'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26903: 'See section {reference_name}' => 'Veja se@,{c}@~ao {reference_name}',
! 26904: 'See {node_file_href}' => 'Veja {node_file_href}',
! 26905: 'See {node_file_href} section `{section}\' in @cite{{book}}' => 'Veja {node_file_href} se@,{c}@~ao `{section}\' em @cite{{book}}',
! 26906: 'See {reference_name}' => 'Veja {reference_name}',
! 26907: 'See {reference}' => 'Veja {reference_name}',
! 26908: 'See {reference} in @cite{{book}}' => 'Veja {node_file_href} @cite{{book}}',
! 26909: 'See {ref}' => '',
! 26910: 'See {title_ref}' => '',
! 26911: 'September' => 'Setembro',
! 26912: 'Short Table of Contents' => 'Breve Sum@\'ario',
! 26913: 'Short table of contents' => 'Breve sum@\'ario',
! 26914: 'Subsection One-Four' => 'Subse@,{c}@~ao Um-Quatro',
! 26915: 'Subsection One-One' => 'Subse@,{c}@~ao Um-Um',
! 26916: 'Subsection One-Three' => 'Subse@,{c}@~ao Um-Tr@^es',
! 26917: 'Subsection One-Two' => 'Subse@,{c}@~ao Um-Dois',
! 26918: 'Subsubsection One-Two-Four' => 'Subse@,{c}@~ao Um-Dois-Quatro',
! 26919: 'Subsubsection One-Two-One' => 'Subse@,{c}@~ao Um-Dois-Um',
! 26920: 'Subsubsection One-Two-Three' => 'Subse@,{c}@~ao Um-Dois-Tr@^es',
! 26921: 'Subsubsection One-Two-Two' => 'Subse@,{c}@~ao Um-Dois-Dois',
! 26922: 'Table of Contents' => 'Sum@\'ario',
! 26923: 'Table of contents' => 'Sum@\'ario',
! 26924: 'The node you are looking for is at {href}.' => 'O nodo que vo@^e est@\'a olhando est@\'a em {href}.',
! 26925: 'This' => 'Esse',
! 26926: 'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'Esse documento foi gerado em @i{{date}} usando @uref{{program_homepage}, @i{{program}}}.',
! 26927: 'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'Esse documento foi gerado usando @uref{{program_homepage}, @emph{{program}}}.',
! 26928: 'Top' => 'Topo',
! 26929: 'Untitled Document' => 'Documento Sem Nome',
! 26930: 'Up' => 'Acima',
! 26931: 'Up node' => 'Nodo acima',
! 26932: 'Up section' => 'Se@,{c}@~ao acima',
! 26933: '`{section}\'' => 'Se@,{c}@~ao acima',
! 26934: '`{section}\' in @cite{{book}}' => 'se@,{c}@~ao `{section}\' em @cite{{book}}',
! 26935: 'current' => 'atual',
! 26936: 'on @emph{{date}}' => 'em @emph{{date}}',
! 26937: 'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26938: 'see ' => '',
! 26939: 'see @cite{{book}}' => 'veja @cite{{book}}',
! 26940: 'see `{section}\'' => 'Se@,{c}@~ao acima',
! 26941: 'see `{section}\' in @cite{{book}}' => 'se@,{c}@~ao `{section}\' em @cite{{book}}',
! 26942: 'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 26943: 'see section `{section}\' in @cite{{book}}' => 'veja se@,{c}@~ao `{section}\' em @cite{{book}}',
! 26944: 'see section {reference_name}' => 'veja se@,{c}@~ao {reference_name}',
! 26945: 'see {node_file_href}' => 'veja {node_file_href}',
! 26946: 'see {node_file_href} section `{section}\' in @cite{{book}}' => 'veja {node_file_href} se@,{c}@~ao `{section}\' em @cite{{book}}',
! 26947: 'see {reference_name}' => 'veja {reference_name}',
! 26948: 'see {reference}' => 'veja {reference_name}',
! 26949: 'see {reference} in @cite{{book}}' => 'veja {node_file_href} @cite{{book}}',
! 26950: 'see {ref}' => '',
! 26951: 'see {title_ref}' => '',
! 26952: '{acronym_like} ({explanation})' => '',
! 26953: '{month} {day}, {year}' => '{day} de {month} de {year}',
! 26954: '{name} of {class}' => '{name} da {class}',
! 26955: '{name} on {class}' => '{name} na {class}',
! 26956: '{node_file_href} section `{section}\' in @cite{{book}}' => '{node_file_href} se@,{c}@~ao `{section}\' em @cite{{book}}',
! 26957: '{reference_name}' => '',
! 26958: '{reference}' => 'veja {reference_name}',
! 26959: '{reference} in @cite{{book}}' => 'veja @cite{{book}}',
! 26960: '{ref}' => '',
! 26961: '{style} {number}' => '',
! 26962: '{style}: {caption_first_line}' => '',
! 26963: '{style}: {shortcaption_first_line}' => '',
! 26964: '{title_ref}' => ''
! 26965: };
! 26966: # Automatically generated file. Edit the .po file instead.
! 26967: $LANGUAGES->{'hu'} = {
! 26968: ' The buttons in the navigation panels have the following meaning:' => ' A navigációs panelen levő gombok jelentése a következő:',
! 26969: ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => ' @strong{ Példánkban } az aktuális pozíció az @strong{ 1.2.3 alalszakasz } egy olyan dokumentumban, melynek szerkezete a következő:',
! 26970: ' Up ' => 'Fel',
! 26971: '(outside of any element)' => '(bármelyik elemen kívül)',
! 26972: '(outside of any node)' => '(bármelyik csomóponton kívül)',
! 26973: '@b{{quotation_arg}:} ' => '@b{{quotation_arg}:} ',
! 26974: '@center --- @emph{{author}}
! 26975: ' => '',
! 26976: '@cite{{book}}' => '@cite{{book}}',
! 26977: '@{No value for `{value}\'@}' => '@{Nincs értéke ennek: `{value}\'@}',
! 26978: 'About' => 'Súgó',
! 26979: 'About (help)' => 'Segítség a navigációhoz',
! 26980: 'About This Document' => 'A navigációs panel használata',
! 26981: 'April' => 'április',
! 26982: 'August' => 'augusztus',
! 26983: 'Back' => 'Vissza',
! 26984: 'Back section in previous file' => 'Előző fájl hátsó szakasza',
! 26985: 'Beginning of this chapter or previous chapter' => 'Fejezet eleje vagy előző fejezet',
! 26986: 'Button' => 'Gomb',
! 26987: 'Contents' => 'Tartalom',
! 26988: 'Cover (top) of document' => 'Dokumentum címoldala',
! 26989: 'Current' => 'Aktuális',
! 26990: 'Current Position' => 'Aktuális pozíció',
! 26991: 'Current section' => 'Aktuális szakasz',
! 26992: 'December' => 'december',
! 26993: 'FastBack' => 'Visszaugrás',
! 26994: 'FastForward' => 'Előreugrás',
! 26995: 'February' => 'február',
! 26996: 'First' => 'Első',
! 26997: 'First section in reading order' => 'Első szakasz az olvasási sorrendben',
! 26998: 'Following' => 'Következő',
! 26999: 'Following node' => 'Következő csomópont',
! 27000: 'Footnotes' => 'Lábjegyzet',
! 27001: 'Forward' => 'Előre',
! 27002: 'Forward section in next file' => 'Következő fájl elülső szakasza',
! 27003: 'From 1.2.3 go to' => '1.2.3-ból ide jutunk',
! 27004: 'Go to' => 'Cél',
! 27005: 'Index' => 'Tárgymutató',
! 27006: 'Index Entry' => 'Tárgymutató-bejegyzés',
! 27007: 'January' => 'január',
! 27008: 'July' => 'július',
! 27009: 'Jump to' => 'Ugorj ide',
! 27010: 'June' => 'június',
! 27011: 'Last' => 'Utolsó',
! 27012: 'Last section in reading order' => 'Utolsó szakasz az olvasási sorrendben',
! 27013: 'March' => 'március',
! 27014: 'May' => 'május',
! 27015: 'Menu:' => 'Menü:',
! 27016: 'Name' => 'Név',
! 27017: 'Next' => 'Következő',
! 27018: 'Next chapter' => 'Következő fejezet',
! 27019: 'Next file' => 'Következő fájl',
! 27020: 'Next node' => 'Következő csomópont',
! 27021: 'Next section in reading order' => 'Következő szakasz az olvasási sorrendben',
! 27022: 'Next section on same level' => 'Következő szakasz ugyanazon a szinten',
! 27023: 'NextFile' => 'KövetkezőFájl',
! 27024: 'Node following in node reading order' => 'Következő csomópont az olvasási sorrendben',
! 27025: 'Node up' => 'Szülő csomópont',
! 27026: 'NodeNext' => 'KövetkezőCsomópont',
! 27027: 'NodePrev' => 'ElőzőCsomópont',
! 27028: 'NodeUp' => 'SzülőCsomópont',
! 27029: 'November' => 'november',
! 27030: 'October' => 'október',
! 27031: 'Overview' => 'Áttekintés',
! 27032: 'Prev' => 'Előző',
! 27033: 'PrevFile' => 'ElőzőFájl',
! 27034: 'Previous' => 'Előző',
! 27035: 'Previous file' => 'Előző fájl',
! 27036: 'Previous node' => 'Előző csomópont',
! 27037: 'Previous section in reading order' => 'Előző szakasz az olvasási sorrendben',
! 27038: 'Previous section on same level' => 'Előző szakasz ugyanazon a szinten',
! 27039: 'Section' => 'Szakasz',
! 27040: 'Section One' => 'szakasz',
! 27041: 'See ' => 'Ld. ',
! 27042: 'See @cite{{book}}' => 'Ld. @cite{{book}}',
! 27043: 'See `{section}\'' => 'Szülő szakasz',
! 27044: 'See `{section}\' in @cite{{book}}' => 'Ld. ezt a szakaszt: `{section}\' itt: @cite{{book}}',
! 27045: 'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'Ld. ezt a szakaszt: `@asis{}`{section_name}\'@asis{}\' itt: @cite{{book}}',
! 27046: 'See section {reference_name}' => 'Ld. ezt a szakaszt: {reference_name}',
! 27047: 'See {node_file_href}' => 'Ld. {node_file_href}',
! 27048: 'See {node_file_href} section `{section}\' in @cite{{book}}' => 'Ld. {node_file_href} ezt a szakaszt: `{section}\' itt: @cite{{book}}',
! 27049: 'See {reference_name}' => 'Ld. {reference_name}',
! 27050: 'See {reference}' => 'Ld. {reference_name}',
! 27051: 'See {reference} in @cite{{book}}' => 'See {node_file_href} @cite{{book}}',
! 27052: 'See {ref}' => 'Ld. {ref}',
! 27053: 'See {title_ref}' => 'Ld. {title_ref}',
! 27054: 'September' => 'szeptember',
! 27055: 'Short Table of Contents' => 'Rövid tartalomjegyzék',
! 27056: 'Short table of contents' => 'Rövid tartalomjegyzék',
! 27057: 'Subsection One-Four' => 'alszakasz',
! 27058: 'Subsection One-One' => 'alszakasz',
! 27059: 'Subsection One-Three' => 'alszakasz',
! 27060: 'Subsection One-Two' => 'alszakasz',
! 27061: 'Subsubsection One-Two-Four' => 'alalszakasz',
! 27062: 'Subsubsection One-Two-One' => 'alalszakasz',
! 27063: 'Subsubsection One-Two-Three' => 'alalszakasz',
! 27064: 'Subsubsection One-Two-Two' => 'alalszakasz',
! 27065: 'Table of Contents' => 'Tartalomjegyzék',
! 27066: 'Table of contents' => 'Tartalomjegyzék',
! 27067: 'The node you are looking for is at {href}.' => 'A keresett csomópont itt található: {href}.',
! 27068: 'This' => 'Ez a(z)',
! 27069: 'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'Ezt a dokumentumot @i{{date}} napon generálta a(z) @uref{{program_homepage}, @i{{program}}}.',
! 27070: 'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'Ezt a dokumentumot a(z) @uref{{program_homepage}, @emph{{program}}} generálta.',
! 27071: 'Top' => 'Címoldal',
! 27072: 'Untitled Document' => 'Névtelen dokumentum',
! 27073: 'Up' => 'Fel',
! 27074: 'Up node' => 'Szülő csomópont',
! 27075: 'Up section' => 'Szülő szakasz',
! 27076: '`{section}\'' => 'Szülő szakasz',
! 27077: '`{section}\' in @cite{{book}}' => 'szakasz: `{section}\' itt: @cite{{book}}',
! 27078: 'current' => 'aktuális',
! 27079: 'on @emph{{date}}' => 'ekkor: @emph{{date}}',
! 27080: 'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'szakasz: `@asis{}`{section_name}\'@asis{}\' itt: @cite{{book}}',
! 27081: 'see ' => 'ld. ',
! 27082: 'see @cite{{book}}' => 'ld. @cite{{book}}',
! 27083: 'see `{section}\'' => 'Szülő szakasz',
! 27084: 'see `{section}\' in @cite{{book}}' => 'szakasz: `{section}\' itt: @cite{{book}}',
! 27085: 'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'ld. ezt a szakaszt: `@asis{}`{section_name}\'@asis{}\' itt: @cite{{book}}',
! 27086: 'see section `{section}\' in @cite{{book}}' => 'ld. ezt a szakaszt: `{section}\' itt: @cite{{book}}',
! 27087: 'see section {reference_name}' => 'ld. ezt a szakaszt: {reference_name}',
! 27088: 'see {node_file_href}' => 'ld. {node_file_href}',
! 27089: 'see {node_file_href} section `{section}\' in @cite{{book}}' => 'ld. {node_file_href} ezt a szakaszt: `{section}\' itt: @cite{{book}}',
! 27090: 'see {reference_name}' => 'ld. {reference_name}',
! 27091: 'see {reference}' => 'ld. {reference_name}',
! 27092: 'see {reference} in @cite{{book}}' => 'ld. {node_file_href} @cite{{book}}',
! 27093: 'see {ref}' => 'ld. {ref}',
! 27094: 'see {title_ref}' => 'ld. {title_ref}',
! 27095: '{acronym_like} ({explanation})' => '{acronym_like} ({explanation})',
! 27096: '{month} {day}, {year}' => '',
! 27097: '{name} of {class}' => '{name} típusa: {class}',
! 27098: '{name} on {class}' => '{name} ezen: {class}',
! 27099: '{node_file_href}' => '{node_file_href}',
! 27100: '{node_file_href} section `{section}\' in @cite{{book}}' => '{node_file_href} szakasz: `{section}\' itt: @cite{{book}}',
! 27101: '{reference_name}' => '{reference_name}',
! 27102: '{reference}' => '{reference_name}',
! 27103: '{reference} in @cite{{book}}' => '{node_file_href} @cite{{book}}',
! 27104: '{ref}' => '{ref}',
! 27105: '{style} {number}' => '{style} {number}',
! 27106: '{style}: {caption_first_line}' => '{style}: {caption_first_line}',
! 27107: '{style}: {shortcaption_first_line}' => '{style}: {shortcaption_first_line}',
! 27108: '{title_ref}' => '{title_ref}'
! 27109: };
! 27110: # Automatically generated file. Edit the .po file instead.
! 27111: $LANGUAGES->{'pt_BR'} = {
! 27112: ' The buttons in the navigation panels have the following meaning:' => ' Os bot@~oes nos pain@\'eis de navega@,{c}@~ao possuem os seguintes significados:',
! 27113: ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => ' onde o @strong{ Exemplo } assume que a posi@,{c}@~ao atual localiza-se em @strong{ Subsub@,{c}@~ao Um-Dois-Tr@^es } de um documento com a seguinte estrutura:',
! 27114: ' Up ' => ' Acima ',
! 27115: '(outside of any element)' => '',
! 27116: '(outside of any node)' => '',
! 27117: '@b{{quotation_arg}:} ' => '',
! 27118: '@center --- @emph{{author}}
! 27119: ' => '',
! 27120: '@cite{{book}}' => '',
! 27121: '@{No value for `{value}\'@}' => '',
! 27122: 'About' => 'Sobre',
! 27123: 'About (help)' => 'Sobre (ajuda)',
! 27124: 'About This Document' => 'Sobre Esse Documento',
! 27125: 'April' => 'Abril',
! 27126: 'August' => 'Agosto',
! 27127: 'Back' => 'Volta',
! 27128: 'Back section in previous file' => '',
! 27129: 'Beginning of this chapter or previous chapter' => 'Come@,{c}o desse cap@\'itulo ou cap@\'itulo anterior',
! 27130: 'Button' => 'Bot@~ao',
! 27131: 'Contents' => 'Conte@\'udo',
! 27132: 'Cover (top) of document' => 'In@\'icio (topo) do documento',
! 27133: 'Current' => '',
! 27134: 'Current Position' => 'Posi@,{c}@~ao Atual',
! 27135: 'Current section' => 'Se@,{c}@~ao atual',
! 27136: 'December' => 'Dezembro',
! 27137: 'FastBack' => 'Voltar R@\'apido',
! 27138: 'FastForward' => 'Avan@,{c}ar R@\'apido',
! 27139: 'February' => 'Fevereiro',
! 27140: 'First' => 'Primeiro',
! 27141: 'First section in reading order' => 'Primeira se@,{c}@~ao na ordem de leitura',
! 27142: 'Following' => 'Seguinte',
! 27143: 'Following node' => 'Nodo seguinte',
! 27144: 'Footnotes' => 'Notas de Rodap@\'e',
! 27145: 'Forward' => 'Avan@,{c}ar',
! 27146: 'Forward section in next file' => '',
! 27147: 'From 1.2.3 go to' => 'De 1.2.3 v@\'a para',
! 27148: 'Go to' => 'V@\'a para',
! 27149: 'Index' => '@\'Indice',
! 27150: 'Index Entry' => 'Entrada de @\'Indice',
! 27151: 'January' => 'Janeiro',
! 27152: 'July' => 'Julho',
! 27153: 'Jump to' => 'Pular para',
! 27154: 'June' => 'Junho',
! 27155: 'Last' => '@\'Ultimo',
! 27156: 'Last section in reading order' => '@\'Ultima se@,{c}@~ao na ordem de leitura',
! 27157: 'March' => 'Mar@,{c}o',
! 27158: 'May' => 'Maio',
! 27159: 'Menu:' => '',
! 27160: 'Name' => 'Nome',
! 27161: 'Next' => 'Pr@\'oximo',
! 27162: 'Next chapter' => 'Pr@\'oximo cap@\'itulo',
! 27163: 'Next file' => '',
! 27164: 'Next node' => 'Pr@\'oximo nodo',
! 27165: 'Next section in reading order' => 'Pr@\'oxima se@,{c}@~ao na ordem de leitura',
! 27166: 'Next section on same level' => 'Pr@\'oxima se@,{c}@~ao no mesmo n@\'ivel',
! 27167: 'NextFile' => '',
! 27168: 'Node following in node reading order' => 'Nodo seguinte na ordem de leitura de nodos',
! 27169: 'Node up' => 'Nodo acima',
! 27170: 'NodeNext' => 'Pr@\'oximo Nodo',
! 27171: 'NodePrev' => 'Nodo Anterior',
! 27172: 'NodeUp' => 'Nodo Acima',
! 27173: 'November' => 'Novembro',
! 27174: 'October' => 'Outubro',
! 27175: 'Overview' => 'Vis@~ao geral',
! 27176: 'Prev' => 'Pr@\'evio',
! 27177: 'PrevFile' => '',
! 27178: 'Previous' => '',
! 27179: 'Previous file' => '',
! 27180: 'Previous node' => 'Nodo anterior',
! 27181: 'Previous section in reading order' => 'Se@,{c}@~ao anterior na ordem de leitura',
! 27182: 'Previous section on same level' => 'Se@,{c}@~ao anterior no mesmo n@\'ivel',
! 27183: 'Section' => 'Se@,{c}@~ao',
! 27184: 'Section One' => 'Se@,{c}@~ao Um',
! 27185: 'See ' => '',
! 27186: 'See @cite{{book}}' => 'Veja @cite{{book}}',
! 27187: 'See `{section}\'' => 'Se@,{c}@~ao acima',
! 27188: 'See `{section}\' in @cite{{book}}' => 'Veja se@,{c}@~ao `{section}\' em @cite{{book}}',
! 27189: 'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 27190: 'See section {reference_name}' => 'Veja se@,{c}@~ao {reference_name}',
! 27191: 'See {node_file_href}' => 'Veja {node_file_href}',
! 27192: 'See {node_file_href} section `{section}\' in @cite{{book}}' => 'Veja {node_file_href} se@,{c}@~ao `{section}\' em @cite{{book}}',
! 27193: 'See {reference_name}' => 'Veja {reference_name}',
! 27194: 'See {reference}' => 'Veja {reference_name}',
! 27195: 'See {reference} in @cite{{book}}' => 'Veja {node_file_href} @cite{{book}}',
! 27196: 'See {ref}' => '',
! 27197: 'See {title_ref}' => '',
! 27198: 'September' => 'Setembro',
! 27199: 'Short Table of Contents' => 'Breve Sum@\'ario',
! 27200: 'Short table of contents' => 'Breve sum@\'ario',
! 27201: 'Subsection One-Four' => 'Subse@,{c}@~ao Um-Quatro',
! 27202: 'Subsection One-One' => 'Subse@,{c}@~ao Um-Um',
! 27203: 'Subsection One-Three' => 'Subse@,{c}@~ao Um-Tr@^es',
! 27204: 'Subsection One-Two' => 'Subse@,{c}@~ao Um-Dois',
! 27205: 'Subsubsection One-Two-Four' => 'Subse@,{c}@~ao Um-Dois-Quatro',
! 27206: 'Subsubsection One-Two-One' => 'Subse@,{c}@~ao Um-Dois-Um',
! 27207: 'Subsubsection One-Two-Three' => 'Subse@,{c}@~ao Um-Dois-Tr@^es',
! 27208: 'Subsubsection One-Two-Two' => 'Subse@,{c}@~ao Um-Dois-Dois',
! 27209: 'Table of Contents' => 'Sum@\'ario',
! 27210: 'Table of contents' => 'Sum@\'ario',
! 27211: 'The node you are looking for is at {href}.' => 'O nodo que vo@^e est@\'a olhando est@\'a em {href}.',
! 27212: 'This' => 'Esse',
! 27213: 'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'Esse documento foi gerado em @i{{date}} usando @uref{{program_homepage}, @i{{program}}}.',
! 27214: 'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'Esse documento foi gerado usando @uref{{program_homepage}, @emph{{program}}}.',
! 27215: 'Top' => 'Topo',
! 27216: 'Untitled Document' => 'Documento Sem Nome',
! 27217: 'Up' => 'Acima',
! 27218: 'Up node' => 'Nodo acima',
! 27219: 'Up section' => 'Se@,{c}@~ao acima',
! 27220: '`{section}\'' => 'Se@,{c}@~ao acima',
! 27221: '`{section}\' in @cite{{book}}' => 'se@,{c}@~ao `{section}\' em @cite{{book}}',
! 27222: 'current' => 'atual',
! 27223: 'on @emph{{date}}' => 'em @emph{{date}}',
! 27224: 'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 27225: 'see ' => '',
! 27226: 'see @cite{{book}}' => 'veja @cite{{book}}',
! 27227: 'see `{section}\'' => 'Se@,{c}@~ao acima',
! 27228: 'see `{section}\' in @cite{{book}}' => 'se@,{c}@~ao `{section}\' em @cite{{book}}',
! 27229: 'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 27230: 'see section `{section}\' in @cite{{book}}' => 'veja se@,{c}@~ao `{section}\' em @cite{{book}}',
! 27231: 'see section {reference_name}' => 'veja se@,{c}@~ao {reference_name}',
! 27232: 'see {node_file_href}' => 'veja {node_file_href}',
! 27233: 'see {node_file_href} section `{section}\' in @cite{{book}}' => 'veja {node_file_href} se@,{c}@~ao `{section}\' em @cite{{book}}',
! 27234: 'see {reference_name}' => 'veja {reference_name}',
! 27235: 'see {reference}' => 'veja {reference_name}',
! 27236: 'see {reference} in @cite{{book}}' => 'veja {node_file_href} @cite{{book}}',
! 27237: 'see {ref}' => '',
! 27238: 'see {title_ref}' => '',
! 27239: '{acronym_like} ({explanation})' => '',
! 27240: '{month} {day}, {year}' => '{day} de {month} de {year}',
! 27241: '{name} of {class}' => '{name} da {class}',
! 27242: '{name} on {class}' => '{name} na {class}',
! 27243: '{node_file_href} section `{section}\' in @cite{{book}}' => '{node_file_href} se@,{c}@~ao `{section}\' em @cite{{book}}',
! 27244: '{reference_name}' => '',
! 27245: '{reference}' => 'veja {reference_name}',
! 27246: '{reference} in @cite{{book}}' => 'veja @cite{{book}}',
! 27247: '{ref}' => '',
! 27248: '{style} {number}' => '',
! 27249: '{style}: {caption_first_line}' => '',
! 27250: '{style}: {shortcaption_first_line}' => '',
! 27251: '{title_ref}' => ''
! 27252: };
! 27253: # Automatically generated file. Edit the .po file instead.
! 27254: $LANGUAGES->{'es'} = {
! 27255: ' The buttons in the navigation panels have the following meaning:' => ' Los botones de los paneles de navegaci@\'on tienen el significado siguiente:',
! 27256: ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => ' donde el @strong{ Ejemplo } supone que la posici@\'on actual est@\'a en la @strong{ Sub-subsecci@\'on uno-dos-tres } de un documento de la estructura siguiente:',
! 27257: ' Up ' => ' Subir ',
! 27258: '(outside of any element)' => '',
! 27259: '(outside of any node)' => '',
! 27260: '@b{{quotation_arg}:} ' => '',
! 27261: '@center --- @emph{{author}}
! 27262: ' => '',
! 27263: '@cite{{book}}' => '',
! 27264: '@{No value for `{value}\'@}' => '',
! 27265: 'About' => 'Acerca de',
! 27266: 'About (help)' => 'Acerca de (p@\'agina de ayuda)',
! 27267: 'About This Document' => 'Acerca de este documento',
! 27268: 'April' => 'abril',
! 27269: 'August' => 'agosto',
! 27270: 'Back' => 'Atr@\'as',
! 27271: 'Back section in previous file' => 'Retroceder secci@\'on en el archivo anterior',
! 27272: 'Beginning of this chapter or previous chapter' => 'Inicio de este cap@\'itulo o cap@\'itulo anterior',
! 27273: 'Button' => 'Bot@\'on',
! 27274: 'Contents' => '@\'Indice general',
! 27275: 'Cover (top) of document' => 'Portada del documento',
! 27276: 'Current' => '',
! 27277: 'Current Position' => 'Posici@\'on actual',
! 27278: 'Current section' => 'Secci@\'on actual',
! 27279: 'December' => 'diciembre',
! 27280: 'FastBack' => 'Retroceso r@\'apido',
! 27281: 'FastForward' => 'Avance r@\'apido',
! 27282: 'February' => 'febrero',
! 27283: 'First' => 'Primero',
! 27284: 'First section in reading order' => 'Primera secci@\'on en orden de lectura',
! 27285: 'Following' => 'Siguiente',
! 27286: 'Following node' => 'Nodo siguiente',
! 27287: 'Footnotes' => 'Notas al pie',
! 27288: 'Forward' => 'Adelante',
! 27289: 'Forward section in next file' => 'Avanzar secci@\'on en el pr@\'oximo archivo',
! 27290: 'From 1.2.3 go to' => 'Desde 1.2.3 ir a',
! 27291: 'Go to' => 'Ir a',
! 27292: 'Index' => '@\'Indice',
! 27293: 'Index Entry' => 'Entrada de @\'indice',
! 27294: 'January' => 'enero',
! 27295: 'July' => 'julio',
! 27296: 'Jump to' => 'Saltar a',
! 27297: 'June' => 'junio',
! 27298: 'Last' => '@\'Ultimo',
! 27299: 'Last section in reading order' => '@\'Ultima secci@\'on en orden de lectura',
! 27300: 'March' => 'marzo',
! 27301: 'May' => 'mayo',
! 27302: 'Menu:' => 'Men@\'u:',
! 27303: 'Name' => 'Nombre',
! 27304: 'Next' => 'Siguiente',
! 27305: 'Next chapter' => 'Cap@\'itulo siguiente',
! 27306: 'Next file' => 'Archivo siguiente',
! 27307: 'Next node' => 'Nodo siguiente',
! 27308: 'Next section in reading order' => 'Secci@\'on siguiente en orden de lectura',
! 27309: 'Next section on same level' => 'Secci@\'on siguiente en el mismo nivel',
! 27310: 'NextFile' => 'ArchivoSiguiente',
! 27311: 'Node following in node reading order' => 'Nodo siguiente en orden de lectura de nodos',
! 27312: 'Node up' => 'Subir nodo',
! 27313: 'NodeNext' => 'NodoSiguiente',
! 27314: 'NodePrev' => 'NodoAnterior',
! 27315: 'NodeUp' => 'SubirNodo',
! 27316: 'November' => 'noviembre',
! 27317: 'October' => 'octubre',
! 27318: 'Overview' => 'Panor@\'amica',
! 27319: 'Prev' => 'Ant',
! 27320: 'PrevFile' => 'ArchivoAnt',
! 27321: 'Previous' => '',
! 27322: 'Previous file' => 'Archivo anterior',
! 27323: 'Previous node' => 'Nodo anterior',
! 27324: 'Previous section in reading order' => 'Secci@\'on anterior en orden de lectura',
! 27325: 'Previous section on same level' => 'Secci@\'on anterior en el mismo nivel',
! 27326: 'Section' => 'Secci@\'on',
! 27327: 'Section One' => 'Secci@\'on Uno',
! 27328: 'See ' => '',
! 27329: 'See @cite{{book}}' => 'V@\'ease @cite{{book}}',
! 27330: 'See `{section}\'' => 'Subir secci@\'on',
! 27331: 'See `{section}\' in @cite{{book}}' => 'V@\'ease la secci@\'on `{section}\' en @cite{{book}}',
! 27332: 'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 27333: 'See section {reference_name}' => 'V@\'ease la secci@\'on {reference_name}',
! 27334: 'See {node_file_href}' => 'V@\'ease {node_file_href}',
! 27335: 'See {node_file_href} section `{section}\' in @cite{{book}}' => 'V@\'ease {node_file_href} secci@\'on `{section}\' en @cite{{book}}',
! 27336: 'See {reference_name}' => 'V@\'ease {reference_name}',
! 27337: 'See {reference}' => 'V@\'ease {reference_name}',
! 27338: 'See {reference} in @cite{{book}}' => 'V@\'ease {node_file_href} @cite{{book}}',
! 27339: 'See {ref}' => '',
! 27340: 'See {title_ref}' => '',
! 27341: 'September' => 'septiembre',
! 27342: 'Short Table of Contents' => 'Resumen del Contenido',
! 27343: 'Short table of contents' => 'Resumen del contenido',
! 27344: 'Subsection One-Four' => 'Subsecci@\'on uno-cuatro',
! 27345: 'Subsection One-One' => 'Subsecci@\'on uno-uno',
! 27346: 'Subsection One-Three' => 'Subsecci@\'on uno-tres',
! 27347: 'Subsection One-Two' => 'Subsecci@\'on uno-dos',
! 27348: 'Subsubsection One-Two-Four' => 'Sub-subsecci@\'on uno-dos-cuatro',
! 27349: 'Subsubsection One-Two-One' => 'Sub-subsecci@\'on uno-dos-uno',
! 27350: 'Subsubsection One-Two-Three' => 'Sub-subsecci@\'on uno-dos-tres',
! 27351: 'Subsubsection One-Two-Two' => 'Sub-subsecci@\'on uno-dos-dos',
! 27352: 'Table of Contents' => '@\'{@dotless{I}}ndice General',
! 27353: 'Table of contents' => '@\'{@dotless{I}}ndice general',
! 27354: 'The node you are looking for is at {href}.' => 'El nodo que busca se encuentra en {href}.',
! 27355: 'This' => 'Este',
! 27356: 'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'Este documento se gener@\'o el @i{{date}} utilizando @uref{{program_homepage}, @i{{program}}}.',
! 27357: 'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'Este documento se gener@\'o utilizando @uref{{program_homepage}, @emph{{program}}}.',
! 27358: 'Top' => 'Arriba',
! 27359: 'Untitled Document' => 'Documento sin t@\'itulo',
! 27360: 'Up' => 'Subir',
! 27361: 'Up node' => 'Subir nodo',
! 27362: 'Up section' => 'Subir secci@\'on',
! 27363: '`{section}\'' => 'Subir secci@\'on',
! 27364: '`{section}\' in @cite{{book}}' => 'secci@\'on `{section}\' en @cite{{book}}',
! 27365: 'current' => 'actual',
! 27366: 'on @emph{{date}}' => 'el @emph{{date}}',
! 27367: 'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 27368: 'see ' => '',
! 27369: 'see @cite{{book}}' => 'v@\'ease @cite{{book}}',
! 27370: 'see `{section}\'' => 'Subir secci@\'on',
! 27371: 'see `{section}\' in @cite{{book}}' => 'secci@\'on `{section}\' en @cite{{book}}',
! 27372: 'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 27373: 'see section `{section}\' in @cite{{book}}' => 'v@\'ease la secci@\'on `{section}\' en @cite{{book}}',
! 27374: 'see section {reference_name}' => 'v@\'ease la secci@\'on {reference_name}',
! 27375: 'see {node_file_href}' => 'v@\'ease {node_file_href}',
! 27376: 'see {node_file_href} section `{section}\' in @cite{{book}}' => 'v@\'ease {node_file_href} secci@\'on `{section}\' en @cite{{book}}',
! 27377: 'see {reference_name}' => 'v@\'ease {reference_name}',
! 27378: 'see {reference}' => 'v@\'ease {reference_name}',
! 27379: 'see {reference} in @cite{{book}}' => 'v@\'ease {node_file_href} @cite{{book}}',
! 27380: 'see {ref}' => '',
! 27381: 'see {title_ref}' => '',
! 27382: '{acronym_like} ({explanation})' => '',
! 27383: '{month} {day}, {year}' => 'el {day} {month} {year}',
! 27384: '{name} of {class}' => '{name} de {class}',
! 27385: '{name} on {class}' => '{name} en {class}',
! 27386: '{node_file_href} section `{section}\' in @cite{{book}}' => '{node_file_href} secci@\'on `{section}\' en @cite{{book}}',
! 27387: '{reference_name}' => '',
! 27388: '{reference}' => 'v@\'ease {reference_name}',
! 27389: '{reference} in @cite{{book}}' => 'v@\'ease @cite{{book}}',
! 27390: '{ref}' => '',
! 27391: '{style} {number}' => '',
! 27392: '{style}: {caption_first_line}' => '',
! 27393: '{style}: {shortcaption_first_line}' => '',
! 27394: '{title_ref}' => ''
! 27395: };
! 27396: # Automatically generated file. Edit the .po file instead.
! 27397: $LANGUAGES->{'it'} = {
! 27398: ' The buttons in the navigation panels have the following meaning:' => ' I bottoni nei pannelli di navigazione hanno il seguente significato:',
! 27399: ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => ' dove @strong{ Esempio } assume che l\'attuale posizione è alla @strong{ Sottosottosezione Uno-Due-Tre } di un documento che ha la seguente struttura:',
! 27400: ' Up ' => ' Su ',
! 27401: '(outside of any element)' => '(fuori da qualsiasi elemento)',
! 27402: '(outside of any node)' => '(fuori da qualsiasi nodo)',
! 27403: '@b{{quotation_arg}:} ' => '@b{{quotation_arg}:} ',
! 27404: '@center --- @emph{{author}}
! 27405: ' => '',
! 27406: '@cite{{book}}' => '@cite{{book}}',
! 27407: '@{No value for `{value}\'@}' => '@{Nessun valore per `{value}\'@}',
! 27408: 'About' => 'Informazioni',
! 27409: 'About (help)' => 'Informazioni (aiuto)',
! 27410: 'About This Document' => 'Informazioni su questo documento',
! 27411: 'April' => 'Aprile',
! 27412: 'August' => 'Agosto',
! 27413: 'Back' => 'Indietro',
! 27414: 'Back section in previous file' => '',
! 27415: 'Beginning of this chapter or previous chapter' => 'Inizio di questo capitolo o capitolo precedente',
! 27416: 'Button' => 'Bottone',
! 27417: 'Contents' => 'Contenuti',
! 27418: 'Cover (top) of document' => 'Copertina (inizio) del documento',
! 27419: 'Current' => 'Attuale',
! 27420: 'Current Position' => 'Posizione Attuale',
! 27421: 'Current section' => 'Sezione attuale',
! 27422: 'December' => 'Dicembre',
! 27423: 'FastBack' => 'Indietro veloce',
! 27424: 'FastForward' => 'Avanti veloce',
! 27425: 'February' => 'Febbraio',
! 27426: 'First' => 'Primo',
! 27427: 'First section in reading order' => 'Prima sezione in ordine di lettura',
! 27428: 'Following' => 'Seguente',
! 27429: 'Following node' => 'Nodo seguente',
! 27430: 'Footnotes' => 'Note a piè di pagina',
! 27431: 'Forward' => 'Avanti',
! 27432: 'Forward section in next file' => 'Sezione successiva nel prossimo file',
! 27433: 'From 1.2.3 go to' => 'Da 1.2.3 vai a',
! 27434: 'Go to' => 'Vai a',
! 27435: 'Index' => 'Indice',
! 27436: 'Index Entry' => 'Voce dell\'indice',
! 27437: 'January' => 'Gennaio',
! 27438: 'July' => 'Luglio',
! 27439: 'Jump to' => 'Salta a',
! 27440: 'June' => 'Giugno',
! 27441: 'Last' => 'Ultimo',
! 27442: 'Last section in reading order' => 'Ultima sezione in ordine di lettura',
! 27443: 'March' => 'Marzo',
! 27444: 'May' => 'Maggio',
! 27445: 'Menu:' => 'Menu',
! 27446: 'Name' => 'Nome',
! 27447: 'Next' => 'Successivo',
! 27448: 'Next chapter' => 'Capitolo successivo',
! 27449: 'Next file' => 'File successivo',
! 27450: 'Next node' => 'Nodo successivo',
! 27451: 'Next section in reading order' => 'Sezione successiva in ordine di lettura',
! 27452: 'Next section on same level' => 'Sezione successiva sullo stesso livello',
! 27453: 'NextFile' => 'File successivo',
! 27454: 'Node following in node reading order' => 'Nodo seguente in ordine di lettura',
! 27455: 'Node up' => 'Nodo superiore',
! 27456: 'NodeNext' => 'Nodo successivo',
! 27457: 'NodePrev' => 'Nodo precedente',
! 27458: 'NodeUp' => 'Nodo superiore',
! 27459: 'November' => 'Novembre',
! 27460: 'October' => 'Ottobre',
! 27461: 'Overview' => 'Panoramica',
! 27462: 'Prev' => 'Prec.',
! 27463: 'PrevFile' => 'File precedente',
! 27464: 'Previous' => 'Precedente',
! 27465: 'Previous file' => 'File precedente',
! 27466: 'Previous node' => 'Nodo precedente',
! 27467: 'Previous section in reading order' => 'Sezione precedente in ordine di lettura',
! 27468: 'Previous section on same level' => 'Sezione precedente sullo stesso livello',
! 27469: 'Section' => 'Sezione',
! 27470: 'Section One' => 'Sezione uno',
! 27471: 'See ' => 'Vedi',
! 27472: 'See @cite{{book}}' => 'Vedi @cite{{book}}',
! 27473: 'See `{section}\'' => 'Sezione superiore',
! 27474: 'See `{section}\' in @cite{{book}}' => 'Vedi la sezione `{section}\' in @cite{{book}}',
! 27475: 'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'Vedi la sezione `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}',
! 27476: 'See section {reference_name}' => 'Vedi la sezione {reference_name}',
! 27477: 'See {node_file_href}' => 'Vedi {node_file_href}',
! 27478: 'See {node_file_href} section `{section}\' in @cite{{book}}' => 'Vedi {node_file_href} nella sezione `{section}\' in @cite{{book}}',
! 27479: 'See {reference_name}' => 'Vedi {reference_name}',
! 27480: 'See {reference}' => 'Vedi {reference_name}',
! 27481: 'See {reference} in @cite{{book}}' => 'Vedi {node_file_href} @cite{{book}}',
! 27482: 'See {ref}' => 'Vedi {ref}',
! 27483: 'See {title_ref}' => 'Vedi {title_ref}',
! 27484: 'September' => 'Settembre',
! 27485: 'Short Table of Contents' => 'Indice breve',
! 27486: 'Short table of contents' => 'Indice breve',
! 27487: 'Subsection One-Four' => 'Sottosezione Uno-Quattro',
! 27488: 'Subsection One-One' => 'Sottosezione Uno-Uno',
! 27489: 'Subsection One-Three' => 'Sottosezione Uno-Tre',
! 27490: 'Subsection One-Two' => 'Sottosezione Uno-Due',
! 27491: 'Subsubsection One-Two-Four' => 'Sottosottosezione Uno-Due-Quattro',
! 27492: 'Subsubsection One-Two-One' => 'Sottosottosezione Uno-Due-Uno',
! 27493: 'Subsubsection One-Two-Three' => 'Sottosottosezione Uno-Due-Tre',
! 27494: 'Subsubsection One-Two-Two' => 'Sottosottosezione Uno-Due-Due',
! 27495: 'Table of Contents' => 'Indice',
! 27496: 'Table of contents' => 'Indice',
! 27497: 'The node you are looking for is at {href}.' => 'Il nodo che stai cercando è {href}',
! 27498: 'This' => 'Questo',
! 27499: 'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'Questo documento è stato generato il @i{{date}} con @uref{{program_homepage}, @i{{program}}}.',
! 27500: 'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'Questo documento è stato generato con @uref{{program_homepage}, @emph{{program}}}.',
! 27501: 'Top' => 'Inizio',
! 27502: 'Untitled Document' => 'Documento senza titolo',
! 27503: 'Up' => 'Su',
! 27504: 'Up node' => 'Nodo superiore',
! 27505: 'Up section' => 'Sezione superiore',
! 27506: '`{section}\'' => 'Sezione superiore',
! 27507: '`{section}\' in @cite{{book}}' => 'sezione `{section}\' in @cite{{book}}',
! 27508: 'current' => 'attuale',
! 27509: 'on @emph{{date}}' => 'il @emph{{date}}',
! 27510: 'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'sezione `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}',
! 27511: 'see ' => 'vedi ',
! 27512: 'see @cite{{book}}' => 'vedi @cite{{book}}',
! 27513: 'see `{section}\'' => 'Sezione superiore',
! 27514: 'see `{section}\' in @cite{{book}}' => 'sezione `{section}\' in @cite{{book}}',
! 27515: 'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'vedi la sezione `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}',
! 27516: 'see section `{section}\' in @cite{{book}}' => 'vedi la sezione `{section}\' in @cite{{book}}',
! 27517: 'see section {reference_name}' => 'vedi la sezione {reference_name}',
! 27518: 'see {node_file_href}' => 'vedi {node_file_href}',
! 27519: 'see {node_file_href} section `{section}\' in @cite{{book}}' => 'vedi {node_file_href} nella sezione `{section}\' in @cite{{book}}',
! 27520: 'see {reference_name}' => 'vedi {reference_name}',
! 27521: 'see {reference}' => 'vedi {reference_name}',
! 27522: 'see {reference} in @cite{{book}}' => 'vedi {node_file_href} @cite{{book}}',
! 27523: 'see {ref}' => 'vedi {ref}',
! 27524: 'see {title_ref}' => 'vedi {title_ref}',
! 27525: '{acronym_like} ({explanation})' => '{acronym_like} ({explanation})',
! 27526: '{month} {day}, {year}' => '',
! 27527: '{name} of {class}' => '{name} di {class}',
! 27528: '{name} on {class}' => '{name} in {class}',
! 27529: '{node_file_href}' => '{node_file_href}',
! 27530: '{node_file_href} section `{section}\' in @cite{{book}}' => '{node_file_href} nella sezione `{section}\' in @cite{{book}}',
! 27531: '{reference_name}' => '{reference_name}',
! 27532: '{reference}' => '{reference_name}',
! 27533: '{reference} in @cite{{book}}' => '{node_file_href} @cite{{book}}',
! 27534: '{ref}' => '{ref}',
! 27535: '{style} {number}' => '{style} {number}',
! 27536: '{style}: {caption_first_line}' => '{style}: {caption_first_line}',
! 27537: '{style}: {shortcaption_first_line}' => '{style}: {shortcaption_first_line}',
! 27538: '{title_ref}' => '{title_ref}'
! 27539: };
! 27540: # Automatically generated file. Edit the .po file instead.
! 27541: $LANGUAGES->{'no'} = {
! 27542: ' The buttons in the navigation panels have the following meaning:' => '',
! 27543: ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => '',
! 27544: ' Up ' => '',
! 27545: '(outside of any element)' => '',
! 27546: '(outside of any node)' => '',
! 27547: '@b{{quotation_arg}:} ' => '',
! 27548: '@center --- @emph{{author}}
! 27549: ' => '',
! 27550: '@cite{{book}}' => '',
! 27551: '@{No value for `{value}\'@}' => '',
! 27552: 'About' => '',
! 27553: 'About (help)' => '',
! 27554: 'About This Document' => 'No translation available!',
! 27555: 'April' => 'april',
! 27556: 'August' => 'august',
! 27557: 'Back' => '',
! 27558: 'Back section in previous file' => '',
! 27559: 'Beginning of this chapter or previous chapter' => '',
! 27560: 'Button' => '',
! 27561: 'Contents' => '',
! 27562: 'Cover (top) of document' => '',
! 27563: 'Current' => '',
! 27564: 'Current Position' => '',
! 27565: 'Current section' => '',
! 27566: 'December' => 'desember',
! 27567: 'FastBack' => '',
! 27568: 'FastForward' => '',
! 27569: 'February' => 'februar',
! 27570: 'First' => '',
! 27571: 'First section in reading order' => '',
! 27572: 'Following' => '',
! 27573: 'Following node' => '',
! 27574: 'Footnotes' => 'No translation available!',
! 27575: 'Forward' => '',
! 27576: 'Forward section in next file' => '',
! 27577: 'From 1.2.3 go to' => '',
! 27578: 'Go to' => '',
! 27579: 'Index' => 'Indeks',
! 27580: 'Index Entry' => '',
! 27581: 'January' => 'januar',
! 27582: 'July' => 'juli',
! 27583: 'Jump to' => '',
! 27584: 'June' => 'juni',
! 27585: 'Last' => '',
! 27586: 'Last section in reading order' => '',
! 27587: 'March' => 'mars',
! 27588: 'May' => 'mai',
! 27589: 'Menu:' => '',
! 27590: 'Name' => '',
! 27591: 'Next' => '',
! 27592: 'Next chapter' => '',
! 27593: 'Next file' => '',
! 27594: 'Next node' => '',
! 27595: 'Next section in reading order' => '',
! 27596: 'Next section on same level' => '',
! 27597: 'NextFile' => '',
! 27598: 'Node following in node reading order' => '',
! 27599: 'Node up' => '',
! 27600: 'NodeNext' => '',
! 27601: 'NodePrev' => '',
! 27602: 'NodeUp' => '',
! 27603: 'November' => 'november',
! 27604: 'October' => 'oktober',
! 27605: 'Overview' => '',
! 27606: 'Prev' => '',
! 27607: 'PrevFile' => '',
! 27608: 'Previous' => '',
! 27609: 'Previous file' => '',
! 27610: 'Previous node' => '',
! 27611: 'Previous section in reading order' => '',
! 27612: 'Previous section on same level' => '',
! 27613: 'Section' => '',
! 27614: 'Section One' => '',
! 27615: 'See ' => '',
! 27616: 'See @cite{{book}}' => '',
! 27617: 'See `{section}\'' => '',
! 27618: 'See `{section}\' in @cite{{book}}' => '',
! 27619: 'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 27620: 'See section {reference_name}' => '',
! 27621: 'See {reference_name}' => '',
! 27622: 'See {reference}' => '',
! 27623: 'See {reference} in @cite{{book}}' => '',
! 27624: 'See {ref}' => '',
! 27625: 'See {title_ref}' => '',
! 27626: 'September' => 'september',
! 27627: 'Short Table of Contents' => 'Kort innholdsfortegnelse',
! 27628: 'Short table of contents' => '',
! 27629: 'Subsection One-Four' => '',
! 27630: 'Subsection One-One' => '',
! 27631: 'Subsection One-Three' => '',
! 27632: 'Subsection One-Two' => '',
! 27633: 'Subsubsection One-Two-Four' => '',
! 27634: 'Subsubsection One-Two-One' => '',
! 27635: 'Subsubsection One-Two-Three' => '',
! 27636: 'Subsubsection One-Two-Two' => '',
! 27637: 'Table of Contents' => 'Innholdsfortegnelse',
! 27638: 'Table of contents' => '',
! 27639: 'The node you are looking for is at {href}.' => '',
! 27640: 'This' => '',
! 27641: 'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => '',
! 27642: 'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => '',
! 27643: 'Top' => '',
! 27644: 'Untitled Document' => '',
! 27645: 'Up' => '',
! 27646: 'Up node' => '',
! 27647: 'Up section' => '',
! 27648: '`{section}\'' => '',
! 27649: '`{section}\' in @cite{{book}}' => '',
! 27650: 'current' => '',
! 27651: 'on @emph{{date}}' => '',
! 27652: 'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 27653: 'see ' => '',
! 27654: 'see @cite{{book}}' => '',
! 27655: 'see `{section}\'' => '',
! 27656: 'see `{section}\' in @cite{{book}}' => '',
! 27657: 'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 27658: 'see section {reference_name}' => '',
! 27659: 'see {reference_name}' => '',
! 27660: 'see {reference}' => '',
! 27661: 'see {reference} in @cite{{book}}' => '',
! 27662: 'see {ref}' => '',
! 27663: 'see {title_ref}' => '',
! 27664: '{acronym_like} ({explanation})' => '',
! 27665: '{month} {day}, {year}' => '',
! 27666: '{name} of {class}' => '',
! 27667: '{name} on {class}' => '',
! 27668: '{reference_name}' => '',
! 27669: '{reference}' => '',
! 27670: '{reference} in @cite{{book}}' => '',
! 27671: '{ref}' => '',
! 27672: '{style} {number}' => '',
! 27673: '{style}: {caption_first_line}' => '',
! 27674: '{style}: {shortcaption_first_line}' => '',
! 27675: '{title_ref}' => ''
! 27676: };
! 27677: # Automatically generated file. Edit the .po file instead.
! 27678: $LANGUAGES->{'en'} = {
! 27679: ' The buttons in the navigation panels have the following meaning:' => '',
! 27680: ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => '',
! 27681: ' Up ' => '',
! 27682: '(outside of any element)' => '',
! 27683: '(outside of any node)' => '',
! 27684: '@b{{quotation_arg}:} ' => '',
! 27685: '@center --- @emph{{author}}
! 27686: ' => '',
! 27687: '@cite{{book}}' => '',
! 27688: '@{No value for `{value}\'@}' => '',
! 27689: 'About' => '',
! 27690: 'About (help)' => '',
! 27691: 'About This Document' => '',
! 27692: 'April' => '',
! 27693: 'August' => '',
! 27694: 'Back' => '',
! 27695: 'Back section in previous file' => '',
! 27696: 'Beginning of this chapter or previous chapter' => '',
! 27697: 'Button' => '',
! 27698: 'Contents' => '',
! 27699: 'Cover (top) of document' => '',
! 27700: 'Current' => '',
! 27701: 'Current Position' => '',
! 27702: 'Current section' => '',
! 27703: 'December' => '',
! 27704: 'FastBack' => '',
! 27705: 'FastForward' => '',
! 27706: 'February' => '',
! 27707: 'First' => '',
! 27708: 'First section in reading order' => '',
! 27709: 'Following' => '',
! 27710: 'Following node' => '',
! 27711: 'Footnotes' => '',
! 27712: 'Forward' => '',
! 27713: 'Forward section in next file' => '',
! 27714: 'From 1.2.3 go to' => '',
! 27715: 'Go to' => '',
! 27716: 'Index' => '',
! 27717: 'Index Entry' => '',
! 27718: 'January' => '',
! 27719: 'July' => '',
! 27720: 'Jump to' => '',
! 27721: 'June' => '',
! 27722: 'Last' => '',
! 27723: 'Last section in reading order' => '',
! 27724: 'March' => '',
! 27725: 'May' => '',
! 27726: 'Menu:' => '',
! 27727: 'Name' => '',
! 27728: 'Next' => '',
! 27729: 'Next chapter' => '',
! 27730: 'Next file' => '',
! 27731: 'Next node' => '',
! 27732: 'Next section in reading order' => '',
! 27733: 'Next section on same level' => '',
! 27734: 'NextFile' => '',
! 27735: 'Node following in node reading order' => '',
! 27736: 'Node up' => '',
! 27737: 'NodeNext' => '',
! 27738: 'NodePrev' => '',
! 27739: 'NodeUp' => '',
! 27740: 'November' => '',
! 27741: 'October' => '',
! 27742: 'Overview' => '',
! 27743: 'Prev' => '',
! 27744: 'PrevFile' => '',
! 27745: 'Previous' => '',
! 27746: 'Previous file' => '',
! 27747: 'Previous node' => '',
! 27748: 'Previous section in reading order' => '',
! 27749: 'Previous section on same level' => '',
! 27750: 'Section' => '',
! 27751: 'Section One' => '',
! 27752: 'See ' => '',
! 27753: 'See @cite{{book}}' => '',
! 27754: 'See `{section}\'' => '',
! 27755: 'See `{section}\' in @cite{{book}}' => '',
! 27756: 'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 27757: 'See section {reference_name}' => '',
! 27758: 'See {reference_name}' => '',
! 27759: 'See {reference}' => '',
! 27760: 'See {reference} in @cite{{book}}' => '',
! 27761: 'See {ref}' => '',
! 27762: 'See {title_ref}' => '',
! 27763: 'September' => '',
! 27764: 'Short Table of Contents' => '',
! 27765: 'Short table of contents' => '',
! 27766: 'Subsection One-Four' => '',
! 27767: 'Subsection One-One' => '',
! 27768: 'Subsection One-Three' => '',
! 27769: 'Subsection One-Two' => '',
! 27770: 'Subsubsection One-Two-Four' => '',
! 27771: 'Subsubsection One-Two-One' => '',
! 27772: 'Subsubsection One-Two-Three' => '',
! 27773: 'Subsubsection One-Two-Two' => '',
! 27774: 'Table of Contents' => '',
! 27775: 'Table of contents' => '',
! 27776: 'The node you are looking for is at {href}.' => '',
! 27777: 'This' => '',
! 27778: 'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => '',
! 27779: 'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => '',
! 27780: 'Top' => '',
! 27781: 'Untitled Document' => '',
! 27782: 'Up' => '',
! 27783: 'Up node' => '',
! 27784: 'Up section' => '',
! 27785: '`{section}\'' => '',
! 27786: '`{section}\' in @cite{{book}}' => '',
! 27787: 'current' => '',
! 27788: 'on @emph{{date}}' => '',
! 27789: 'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 27790: 'see ' => '',
! 27791: 'see @cite{{book}}' => '',
! 27792: 'see `{section}\'' => '',
! 27793: 'see `{section}\' in @cite{{book}}' => '',
! 27794: 'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
! 27795: 'see section {reference_name}' => '',
! 27796: 'see {reference_name}' => '',
! 27797: 'see {reference}' => '',
! 27798: 'see {reference} in @cite{{book}}' => '',
! 27799: 'see {ref}' => '',
! 27800: 'see {title_ref}' => '',
! 27801: '{acronym_like} ({explanation})' => '',
! 27802: '{month} {day}, {year}' => '',
! 27803: '{name} of {class}' => '',
! 27804: '{name} on {class}' => '',
! 27805: '{reference_name}' => '',
! 27806: '{reference}' => '',
! 27807: '{reference} in @cite{{book}}' => '',
! 27808: '{ref}' => '',
! 27809: '{style} {number}' => '',
! 27810: '{style}: {caption_first_line}' => '',
! 27811: '{style}: {shortcaption_first_line}' => '',
! 27812: '{title_ref}' => ''
! 27813: };
! 27814:
! 27815: require "$T2H_HOME/$translation_file"
! 27816: if ($0 =~ /\.pl$/ &&
! 27817: -e "$T2H_HOME/$translation_file" && -r "$T2H_HOME/$translation_file");
! 27818:
! 27819:
! 27820: # these are unlikely to be used by users, as they are essentially
! 27821: # used to follow the html external refs specification in texinfo
! 27822: sub t2h_cross_manual_normal_text($$$$$$$;$)
! 27823: {
! 27824: my $text = shift;
! 27825: my $in_raw_text = shift;
! 27826: my $in_preformatted = shift;
! 27827: my $in_code =shift;
! 27828: my $in_math = shift;
! 27829: my $in_simple =shift;
! 27830: my $style_stack = shift;
! 27831: my $state = shift;
! 27832:
! 27833: $text = uc($text) if (in_small_caps($style_stack));
! 27834: return $text if ($USE_UNICODE);
! 27835: return t2h_no_unicode_cross_manual_normal_text($text, 0);
! 27836: }
! 27837:
! 27838: sub t2h_cross_manual_normal_text_transliterate($$$$$$$;$)
! 27839: {
! 27840: my $text = shift;
! 27841: my $in_raw_text = shift;
! 27842: my $in_preformatted = shift;
! 27843: my $in_code =shift;
! 27844: my $in_math = shift;
! 27845: my $in_simple =shift;
! 27846: my $style_stack = shift;
! 27847: my $state = shift;
! 27848:
! 27849: $text = uc($text) if (in_small_caps($style_stack));
! 27850: return $text if ($USE_UNICODE);
! 27851: return t2h_no_unicode_cross_manual_normal_text($text, 1);
! 27852: }
! 27853:
! 27854: sub t2h_no_unicode_cross_manual_normal_text($$)
! 27855: {
! 27856: # if there is no unicode support, we do all the transformations here
! 27857: my $text = shift;
! 27858: my $transliterate = shift;
! 27859: my $result = '';
! 27860:
! 27861: my $encoding = get_conf('DOCUMENT_ENCODING');
! 27862: if (defined($encoding) and exists($t2h_encoding_aliases{$encoding}))
! 27863: {
! 27864: $encoding = $t2h_encoding_aliases{$encoding};
! 27865: }
! 27866:
! 27867: while ($text ne '')
! 27868: {
! 27869: if ($text =~ s/^([A-Za-z0-9]+)//o)
! 27870: {
! 27871: $result .= $1;
! 27872: }
! 27873: elsif ($text =~ s/^ //o)
! 27874: {
! 27875: $result .= '-';
! 27876: }
! 27877: elsif ($text =~ s/^(.)//o)
! 27878: {
! 27879: if (exists($ascii_character_map{$1}))
! 27880: {
! 27881: $result .= '_' . lc($ascii_character_map{$1});
! 27882: }
! 27883: else
! 27884: {
! 27885: my $character = $1;
! 27886: my $charcode = uc(sprintf("%02x",ord($1)));
! 27887: my $done = 0;
! 27888: if (defined($encoding) and exists($eight_bit_to_unicode{$encoding})
! 27889: and exists($eight_bit_to_unicode{$encoding}->{$charcode}))
! 27890: {
! 27891: $done = 1;
! 27892: my $unicode_point = $eight_bit_to_unicode{$encoding}->{$charcode};
! 27893: if (!$transliterate)
! 27894: {
! 27895: $result .= '_' . lc($unicode_point);
! 27896: }
! 27897: elsif (exists($transliterate_map{$unicode_point}))
! 27898: {
! 27899: $result .= $transliterate_map{$unicode_point};
! 27900: }
! 27901: elsif (exists($unicode_diacritical{$unicode_point}))
! 27902: {
! 27903: $result .= '';
! 27904: }
! 27905: else
! 27906: {
! 27907: $done = 0;
! 27908: }
! 27909: }
! 27910:
! 27911: if (!$done)
! 27912: { # wild guess that work for latin1, and thus, should fail
! 27913: $result .= '_' . '00' . lc($charcode);
! 27914: }
! 27915: }
! 27916: }
! 27917: else
! 27918: {
! 27919: msg_debug("Bug: unknown character in cross ref (likely in infinite loop)");
! 27920: msg_debug("Text: !!$text!!");
! 27921: sleep 1;
! 27922: }
! 27923: }
! 27924:
! 27925: return $result;
! 27926: }
! 27927:
! 27928: sub t2h_nounicode_cross_manual_accent($$$)
! 27929: {
! 27930: my $accent = shift;
! 27931: my $args = shift;
! 27932: my $style_stack = shift;
! 27933:
! 27934: my $text = $args->[0];
! 27935:
! 27936: if ($accent eq 'dotless')
! 27937: {
! 27938: if (($text eq 'i') and (!defined($style_stack->[-1]) or (!defined($unicode_accents{$style_stack->[-1]})) or ($style_stack->[-1] eq 'tieaccent')))
! 27939: {
! 27940: return "_0131";
! 27941: }
! 27942: #return "\x{}" if ($text eq 'j'); # not found !
! 27943: return $text;
! 27944: }
! 27945: return '_' . lc($unicode_accents{$accent}->{$text})
! 27946: if (defined($unicode_accents{$accent}->{$text}));
! 27947: return ($text . '_' . lc($unicode_diacritical{$accent}))
! 27948: if (defined($unicode_diacritical{$accent}));
! 27949: return ascii_accents($text, $accent);
! 27950: }
! 27951:
! 27952: sub t2h_transliterate_cross_manual_accent($$)
! 27953: {
! 27954: my $accent = shift;
! 27955: my $args = shift;
! 27956:
! 27957: my $text = $args->[0];
! 27958:
! 27959: if (exists($unicode_accents{$accent}->{$text}) and
! 27960: exists ($transliterate_map{$unicode_accents{$accent}->{$text}}))
! 27961: {
! 27962: return $transliterate_map{$unicode_accents{$accent}->{$text}};
! 27963: }
! 27964: return $text;
! 27965: }
! 27966:
! 27967:
! 27968: } # end package Texi2HTML::Config
! 27969:
! 27970: # set the defaults based on real command name
! 27971: set_config_init_dirs_output($real_command_name);
! 27972:
! 27973: use vars qw(
! 27974: %value
! 27975: %alias
! 27976: );
! 27977:
! 27978: # variables which might be redefined by the user but aren't likely to be
! 27979: # they seem to be in the main namespace
! 27980: use vars qw(
! 27981: %index_names
! 27982: %index_prefix_to_name
! 27983: %predefined_index
! 27984: %valid_index
! 27985: %reference_sec2level
! 27986: %code_style_map
! 27987: %forbidden_index_name
! 27988: );
! 27989:
! 27990: # Some global variables are set in the script, and used in the subroutines
! 27991: # they are in the Texi2HTML namespace, thus prefixed with Texi2HTML::.
! 27992: # see texi2html.init for details.
! 27993:
! 27994: #+++############################################################################
! 27995: # #
! 27996: # Pasted content of File $(srcdir)/MySimple.pm: Command-line processing #
! 27997: # #
! 27998: #---############################################################################
! 27999:
! 28000: # leave this within comments, and keep the require statement
! 28001: # This way, you can directly run texi2html.pl, if $T2H_HOME/MySimple.pm
! 28002: # exists.
! 28003:
! 28004: # @MYSIMPLE@
! 28005: package Getopt::MySimple;
! 28006:
! 28007: # Name:
! 28008: # Getopt::MySimple.
! 28009: #
! 28010: # Documentation:
! 28011: # POD-style (incomplete) documentation is in file MySimple.pod
! 28012: #
! 28013: # Tabs:
! 28014: # 4 spaces || die.
! 28015: #
! 28016: # Author:
! 28017: # Ron Savage rpsavage@ozemail.com.au.
! 28018: # 1.00 19-Aug-97 Initial version.
! 28019: # 1.10 13-Oct-97 Add arrays of switches (eg '=s@').
! 28020: # 1.20 3-Dec-97 Add 'Help' on a per-switch basis.
! 28021: # 1.30 11-Dec-97 Change 'Help' to 'verbose'. Make all hash keys lowercase.
! 28022: # 1.40 10-Nov-98 Change width of help report. Restructure tests.
! 28023: # 1-Jul-00 Modifications for Texi2html
! 28024:
! 28025: # --------------------------------------------------------------------------
! 28026: # Locally modified by obachman (Display type instead of env, order by cmp)
! 28027: # $Id: MySimple.pm,v 1.8 2009/08/23 21:50:15 pertusus Exp $
! 28028:
! 28029: # use strict;
! 28030: # no strict 'refs';
! 28031:
! 28032: use vars qw(@EXPORT @EXPORT_OK @ISA);
! 28033: use vars qw($fieldWidth $opt $VERSION);
! 28034:
! 28035: use Exporter();
! 28036: use Getopt::Long;
! 28037:
! 28038: @ISA = qw(Exporter);
! 28039: @EXPORT = qw();
! 28040: @EXPORT_OK = qw($opt); # An alias for $self -> {'opt'}.
! 28041:
! 28042: # --------------------------------------------------------------------------
! 28043:
! 28044: $fieldWidth = 20;
! 28045: $VERSION = '1.41';
! 28046:
! 28047: # --------------------------------------------------------------------------
! 28048:
! 28049: sub byOrder
! 28050: {
! 28051: my($self) = @_;
! 28052:
! 28053: return uc($a) cmp (uc($b));
! 28054: }
! 28055:
! 28056: # --------------------------------------------------------------------------
! 28057:
! 28058: sub dumpOptions
! 28059: {
! 28060: my($self) = @_;
! 28061:
! 28062: print 'Option', ' ' x ($fieldWidth - length('Option') ), "Value\n";
! 28063:
! 28064: for (sort byOrder keys(%{$self -> {'opt'} }) )
! 28065: {
! 28066: print "-$_", ' ' x ($fieldWidth - (1 + length) ), "${$self->{'opt'} }{$_}\n";
! 28067: }
! 28068:
! 28069: print "\n";
! 28070:
! 28071: } # End of dumpOptions.
! 28072:
! 28073: # --------------------------------------------------------------------------
! 28074: # Return:
! 28075: # 0 -> Error.
! 28076: # 1 -> Ok.
! 28077:
! 28078: sub getOptions
! 28079: {
! 28080: push(@_, 0) if ($#_ == 2); # Default for $ignoreCase is 0.
! 28081: push(@_, 1) if ($#_ == 3); # Default for $helpThenExit is 1.
! 28082:
! 28083: my($self, $default, $helpText, $versionText,
! 28084: $helpThenExit, $versionThenExit, $ignoreCase) = @_;
! 28085:
! 28086: $helpThenExit = 1 unless (defined($helpThenExit));
! 28087: $versionThenExit = 1 unless (defined($versionThenExit));
! 28088: $ignoreCase = 0 unless (defined($ignoreCase));
! 28089:
! 28090: $self -> {'default'} = $default;
! 28091: $self -> {'helpText'} = $helpText;
! 28092: $self -> {'versionText'} = $versionText;
! 28093: $Getopt::Long::ignorecase = $ignoreCase;
! 28094:
! 28095: unless (defined($self -> {'default'}{'help'}))
! 28096: {
! 28097: $self -> {'default'}{'help'} =
! 28098: {
! 28099: type => ':i',
! 28100: default => '',
! 28101: linkage => sub {$self->helpOptions($_[1]); sleep 5;exit (0) if $helpThenExit;},
! 28102: verbose => "print help and exit"
! 28103: };
! 28104: }
! 28105:
! 28106: unless (defined($self -> {'default'}{'version'}))
! 28107: {
! 28108: $self -> {'default'}{'version'} =
! 28109: {
! 28110: type => '',
! 28111: default => '',
! 28112: linkage => sub {print $self->{'versionText'}; exit (0) if $versionThenExit;},
! 28113: verbose => "print version and exit"
! 28114: };
! 28115: }
! 28116:
! 28117: for (keys(%{$self -> {'default'} }) )
! 28118: {
! 28119: next unless (ref(${$self -> {'default'} }{$_}) eq 'HASH');
! 28120: my $type = ${$self -> {'default'} }{$_}{'type'};
! 28121: push(@{$self -> {'type'} }, "$_$type");
! 28122: my $key = $_;
! 28123: # get rid of aliases, if any
! 28124: $key =~ s/\|.*//;
! 28125: $self->{'opt'}->{$key} = ${$self -> {'default'} }{$_}{'linkage'}
! 28126: if ${$self -> {'default'} }{$_}{'linkage'};
! 28127: }
! 28128:
! 28129: my($result) = &GetOptions($self -> {'opt'}, @{$self -> {'type'} });
! 28130:
! 28131: return $result unless $result;
! 28132:
! 28133: for (keys(%{$self -> {'default'} }) )
! 28134: {
! 28135: if (! defined(${$self -> {'opt'} }{$_})) #{
! 28136: {
! 28137: ${$self -> {'opt'} }{$_} = ${$self -> {'default'} }{$_}{'default'};
! 28138: }
! 28139: }
! 28140:
! 28141: $result;
! 28142: } # End of getOptions.
! 28143:
! 28144: # --------------------------------------------------------------------------
! 28145:
! 28146: sub helpOptions
! 28147: {
! 28148: my($self) = shift;
! 28149: my($noHelp) = shift;
! 28150: $noHelp = 0 unless $noHelp;
! 28151: my($optwidth, $typewidth, $defaultwidth, $maxlinewidth, $valind, $valwidth)
! 28152: = (10, 5, 9, 78, 4, 11);
! 28153:
! 28154: print "$self->{'helpText'}" if ($self -> {'helpText'});
! 28155:
! 28156: print ' Option', ' ' x ($optwidth - length('Option') -1 ),
! 28157: 'Type', ' ' x ($typewidth - length('Type') + 1),
! 28158: 'Default', ' ' x ($defaultwidth - length('Default') ),
! 28159: "Description\n";
! 28160:
! 28161: for (sort byOrder keys(%{$self -> {'default'} }) )
! 28162: {
! 28163: my($line, $help, $option, $val);
! 28164: $option = $_;
! 28165: next if (ref(${$self -> {'default'} }{$_}) ne 'HASH' or (${$self->{'default'} }{$_}{'noHelp'} && ${$self->{'default'} }{$_}{'noHelp'} > $noHelp));
! 28166: #$line = " -$_" . ' ' x ($optwidth - (2 + length) ) .
! 28167: # "${$self->{'default'} }{$_}{'type'} ".
! 28168: # ' ' x ($typewidth - (1+length(${$self -> {'default'} }{$_}{'type'}) ));
! 28169: $line = " --$_" . "${$self->{'default'} }{$_}{'type'}".
! 28170: ' ' x ($typewidth - (1+length(${$self -> {'default'} }{$_}{'type'}) ));
! 28171:
! 28172: $val = ${$self->{'default'} }{$_}{'linkage'};
! 28173: if ($val)
! 28174: {
! 28175: if ((ref($val) eq 'SCALAR') and (defined($$val)))
! 28176: {
! 28177: $val = $$val;
! 28178: }
! 28179: else
! 28180: {
! 28181: $val = '';
! 28182: }
! 28183: }
! 28184: elsif (defined(${$self->{'default'} }{$_}{'default'}))
! 28185: {
! 28186: $val = ${$self->{'default'} }{$_}{'default'};
! 28187: }
! 28188: else
! 28189: {
! 28190: $val = '';
! 28191: }
! 28192: $line .= "$val ";
! 28193: $line .= ' ' x ($optwidth + $typewidth + $defaultwidth + 1 - length($line));
! 28194:
! 28195: if (defined(${$self -> {'default'} }{$_}{'verbose'}) &&
! 28196: ${$self -> {'default'} }{$_}{'verbose'} ne '')
! 28197: {
! 28198: $help = "${$self->{'default'} }{$_}{'verbose'}";
! 28199: }
! 28200: else
! 28201: {
! 28202: $help = ' ';
! 28203: }
! 28204: if ((length("$line") + length($help)) < $maxlinewidth)
! 28205: {
! 28206: print $line , $help, "\n";
! 28207: }
! 28208: else
! 28209: {
! 28210: print $line, "\n", ' ' x $valind, $help, "\n";
! 28211: }
! 28212: for $val (sort byOrder keys(%{${$self->{'default'}}{$option}{'values'}}))
! 28213: {
! 28214: print ' ' x ($valind + 2);
! 28215: print $val, ' ', ' ' x ($valwidth - length($val) - 2);
! 28216: print ${$self->{'default'}}{$option}{'values'}{$val}, "\n";
! 28217: }
! 28218: }
! 28219:
! 28220: print <<EOT;
! 28221: Note: 'Options' may be abbreviated. -- prefix may be replaced by a single -.
! 28222: 'Type' specifications mean:
! 28223: <none>| ! no argument: variable is set to 1 on -foo (or, to 0 on -nofoo)
! 28224: =s | :s mandatory (or, optional) string argument
! 28225: =i | :i mandatory (or, optional) integer argument
! 28226: EOT
! 28227: } # End of helpOptions.
! 28228:
! 28229: #-------------------------------------------------------------------
! 28230:
! 28231: sub new
! 28232: {
! 28233: my($class) = @_;
! 28234: my($self) = {};
! 28235: $self -> {'default'} = {};
! 28236: $self -> {'helpText'} = '';
! 28237: $self -> {'opt'} = {};
! 28238: $opt = $self -> {'opt'}; # An alias for $self -> {'opt'}.
! 28239: $self -> {'type'} = ();
! 28240:
! 28241: return bless $self, $class;
! 28242:
! 28243: } # End of new.
! 28244:
! 28245: # --------------------------------------------------------------------------
! 28246:
! 28247: 1;
! 28248:
! 28249: # End MySimple.pm
! 28250:
! 28251: require "$T2H_HOME/MySimple.pm"
! 28252: if ($0 =~ /\.pl$/ &&
! 28253: -e "$T2H_HOME/MySimple.pm" && -r "$T2H_HOME/MySimple.pm");
! 28254:
! 28255: #+++########################################################################
! 28256: # #
! 28257: # Pasted content of File $(srcdir)/T2h_i18n.pm: Internationalisation #
! 28258: # #
! 28259: #---########################################################################
! 28260:
! 28261: # leave this within comments, and keep the require statement
! 28262: # This way, you can directly run texi2html.pl, if $T2H_HOME/T2h_i18n.pm
! 28263: # exists.
! 28264:
! 28265: {
! 28266: # @T2H_I18N@
! 28267: #+##############################################################################
! 28268: #
! 28269: # T2h_i18n.pm: Internationalization for texi2html
! 28270: #
! 28271: # Copyright (C) 1999-2005 Patrice Dumas <pertusus@free.fr>,
! 28272: # Derek Price <derek@ximbiot.com>,
! 28273: # Adrian Aichner <adrian@xemacs.org>,
! 28274: # & others.
! 28275: #
! 28276: # This program is free software; you can redistribute it and/or modify
! 28277: # it under the terms of the GNU General Public License as published by
! 28278: # the Free Software Foundation; either version 2 of the License, or
! 28279: # (at your option) any later version.
! 28280: #
! 28281: # This program is distributed in the hope that it will be useful,
! 28282: # but WITHOUT ANY WARRANTY; without even the implied warranty of
! 28283: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 28284: # GNU General Public License for more details.
! 28285: #
! 28286: # You should have received a copy of the GNU General Public License
! 28287: # along with this program; if not, write to the Free Software
! 28288: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
! 28289: #
! 28290: #-##############################################################################
! 28291:
! 28292: # This requires perl version 5 or higher
! 28293: require 5.0;
! 28294:
! 28295: package Texi2HTML::I18n;
! 28296:
! 28297: use strict;
! 28298:
! 28299: use vars qw(
! 28300: @ISA
! 28301: @EXPORT
! 28302: );
! 28303:
! 28304: use Exporter;
! 28305: @ISA = qw(Exporter);
! 28306: @EXPORT = qw(pretty_date);
! 28307:
! 28308: my $language;
! 28309: my $i18n_dir = 'i18n'; # name of the directory containing the per language files
! 28310: #my $translation_file = 'translations.pl'; # file containing all the translations
! 28311: #my @known_languages = ('de', 'nl', 'es', 'no', 'pt', 'fr'); # The supported
! 28312: # languages
! 28313:
! 28314: ########################################################################
! 28315: # Language dependencies:
! 28316: # To add a new language extend the WORDS hash and create $T2H_<...>_WORDS hash
! 28317: # To redefine one word, simply do:
! 28318: # $T2h_i18n::T2H_LANGUAGES->{<language>}->{<word>} = 'whatever' in your personal init file.
! 28319: #
! 28320:
! 28321: # Those hashes are obsolete but retained here for reference
! 28322:
! 28323: my $T2H_WORDS_EN =
! 28324: {
! 28325: # titles of pages
! 28326: #'Table of Contents' => 'Table of Contents',
! 28327: #'Short Table of Contents' => 'Short Table of Contents',
! 28328: #'Index' => 'Index',
! 28329: #'About This Document' => 'About This Document',
! 28330: #'Footnotes' => 'Footnotes',
! 28331: #'See' => 'See',
! 28332: #'see' => 'see',
! 28333: #'section' => 'section',
! 28334: 'About This Document' => '',
! 28335: 'Table of Contents' => '',
! 28336: 'Short Table of Contents', => '',
! 28337: 'Index' => '',
! 28338: 'Footnotes' => '',
! 28339: 'See' => '',
! 28340: 'see' => '',
! 28341: 'section' => '',
! 28342: 'Top' => '',
! 28343: 'Untitled Document' => '',
! 28344: # If necessary, we could extend this as follows:
! 28345: # # text for buttons
! 28346: # 'Top_Button' => 'Top',
! 28347: # 'ToC_Button' => 'Contents',
! 28348: # 'Overview_Button' => 'Overview',
! 28349: # 'Index_button' => 'Index',
! 28350: # 'Back_Button' => 'Back',
! 28351: # 'FastBack_Button' => 'FastBack',
! 28352: # 'Prev_Button' => 'Prev',
! 28353: # 'Up_Button' => 'Up',
! 28354: # 'Next_Button' => 'Next',
! 28355: # 'Forward_Button' =>'Forward',
! 28356: # 'FastWorward_Button' => 'FastForward',
! 28357: # 'First_Button' => 'First',
! 28358: # 'Last_Button' => 'Last',
! 28359: # 'About_Button' => 'About'
! 28360: 'January' => '',
! 28361: 'February' => '',
! 28362: 'March' => '',
! 28363: 'April' => '',
! 28364: 'May' => '',
! 28365: 'June' => '',
! 28366: 'July' => '',
! 28367: 'August' => '',
! 28368: 'September' => '',
! 28369: 'October' => '',
! 28370: 'November' => '',
! 28371: 'December' => '',
! 28372: 'T2H_today' => '%s, %d %d',
! 28373: };
! 28374:
! 28375: my $T2H_WORDS_DE =
! 28376: {
! 28377: 'Table of Contents' => 'Inhaltsverzeichniss',
! 28378: 'Short Table of Contents' => 'Kurzes Inhaltsverzeichniss',
! 28379: 'Index' => 'Index',
! 28380: 'About This Document' => 'Über dieses Dokument',
! 28381: 'Footnotes' => 'Fußnoten',
! 28382: 'See' => 'Siehe',
! 28383: 'see' => 'siehe',
! 28384: 'section' => 'Abschnitt',
! 28385: 'January' => 'Januar',
! 28386: 'February' => 'Februar',
! 28387: 'March' => 'März',
! 28388: 'April' => 'April',
! 28389: 'May' => 'Mai',
! 28390: 'June' => 'Juni',
! 28391: 'July' => 'Juli',
! 28392: 'August' => 'August',
! 28393: 'September' => 'September',
! 28394: 'October' => 'Oktober',
! 28395: 'November' => 'November',
! 28396: 'December' => 'Dezember',
! 28397: };
! 28398:
! 28399: my $T2H_WORDS_NL =
! 28400: {
! 28401: 'Table of Contents' => 'Inhoudsopgave',
! 28402: 'Short Table of Contents' => 'Korte inhoudsopgave',
! 28403: 'Index' => 'Index', #Not sure ;-)
! 28404: 'About This Document' => 'No translation available!', #No translation available!
! 28405: 'Footnotes' => 'No translation available!', #No translation available!
! 28406: 'See' => 'Zie',
! 28407: 'see' => 'zie',
! 28408: 'section' => 'sectie',
! 28409: 'January' => 'Januari',
! 28410: 'February' => 'Februari',
! 28411: 'March' => 'Maart',
! 28412: 'April' => 'April',
! 28413: 'May' => 'Mei',
! 28414: 'June' => 'Juni',
! 28415: 'July' => 'Juli',
! 28416: 'August' => 'Augustus',
! 28417: 'September' => 'September',
! 28418: 'October' => 'Oktober',
! 28419: 'November' => 'November',
! 28420: 'December' => 'December',
! 28421: };
! 28422:
! 28423: my $T2H_WORDS_ES =
! 28424: {
! 28425: 'Table of Contents' => 'índice General',
! 28426: 'Short Table of Contents' => 'Resumen del Contenido',
! 28427: 'Index' => 'Index', #Not sure ;-)
! 28428: 'About This Document' => 'No translation available!', #No translation available!
! 28429: 'Footnotes' => 'Fußnoten',
! 28430: 'See' => 'Véase',
! 28431: 'see' => 'véase',
! 28432: 'section' => 'sección',
! 28433: 'January' => 'enero',
! 28434: 'February' => 'febrero',
! 28435: 'March' => 'marzo',
! 28436: 'April' => 'abril',
! 28437: 'May' => 'mayo',
! 28438: 'June' => 'junio',
! 28439: 'July' => 'julio',
! 28440: 'August' => 'agosto',
! 28441: 'September' => 'septiembre',
! 28442: 'October' => 'octubre',
! 28443: 'November' => 'noviembre',
! 28444: 'December' => 'diciembre',
! 28445: };
! 28446:
! 28447: my $T2H_WORDS_NO =
! 28448: {
! 28449: 'Table of Contents' => 'Innholdsfortegnelse',
! 28450: 'Short Table of Contents' => 'Kort innholdsfortegnelse',
! 28451: 'Index' => 'Indeks', #Not sure ;-)
! 28452: 'About This Document' => 'No translation available!', #No translation available!
! 28453: 'Footnotes' => 'No translation available!',
! 28454: 'See' => 'Se',
! 28455: 'see' => 'se',
! 28456: 'section' => 'avsnitt',
! 28457: 'January' => 'januar',
! 28458: 'February' => 'februar',
! 28459: 'March' => 'mars',
! 28460: 'April' => 'april',
! 28461: 'May' => 'mai',
! 28462: 'June' => 'juni',
! 28463: 'July' => 'juli',
! 28464: 'August' => 'august',
! 28465: 'September' => 'september',
! 28466: 'October' => 'oktober',
! 28467: 'November' => 'november',
! 28468: 'December' => 'desember',
! 28469: };
! 28470:
! 28471: my $T2H_WORDS_PT =
! 28472: {
! 28473: 'Table of Contents' => 'Sumário',
! 28474: 'Short Table of Contents' => 'Breve Sumário',
! 28475: 'Index' => 'Índice', #Not sure ;-)
! 28476: 'About This Document' => 'No translation available!', #No translation available!
! 28477: 'Footnotes' => 'No translation available!',
! 28478: 'See' => 'Veja',
! 28479: 'see' => 'veja',
! 28480: 'section' => 'Seção',
! 28481: 'January' => 'Janeiro',
! 28482: 'February' => 'Fevereiro',
! 28483: 'March' => 'Março',
! 28484: 'April' => 'Abril',
! 28485: 'May' => 'Maio',
! 28486: 'June' => 'Junho',
! 28487: 'July' => 'Julho',
! 28488: 'August' => 'Agosto',
! 28489: 'September' => 'Setembro',
! 28490: 'October' => 'Outubro',
! 28491: 'November' => 'Novembro',
! 28492: 'December' => 'Dezembro',
! 28493: };
! 28494:
! 28495: my $T2H_WORDS_FR =
! 28496: {
! 28497: 'Table of Contents' => 'Table des matières',
! 28498: 'Short Table of Contents' => 'Résumée du contenu',
! 28499: 'Index' => 'Index',
! 28500: 'About This Document' => 'A propos de ce document',
! 28501: 'Footnotes' => 'Notes de bas de page',
! 28502: 'See' => 'Voir',
! 28503: 'see' => 'voir',
! 28504: 'section' => 'section',
! 28505: 'January' => 'Janvier',
! 28506: 'February' => 'Février',
! 28507: 'March' => 'Mars',
! 28508: 'April' => 'Avril',
! 28509: 'May' => 'Mai',
! 28510: 'June' => 'Juin',
! 28511: 'July' => 'Juillet',
! 28512: 'August' => 'Août',
! 28513: 'September' => 'Septembre',
! 28514: 'October' => 'Octobre',
! 28515: 'November' => 'Novembre',
! 28516: 'December' => 'Décembre',
! 28517: 'T2H_today' => 'le %2$d %1$s %3$d'
! 28518: };
! 28519:
! 28520: #$T2H_LANGUAGES =
! 28521: #{
! 28522: # 'en' => $T2H_WORDS_EN,
! 28523: # 'de' => $T2H_WORDS_DE,
! 28524: # 'nl' => $T2H_WORDS_NL,
! 28525: # 'es' => $T2H_WORDS_ES,
! 28526: # 'no' => $T2H_WORDS_NO,
! 28527: # 'pt' => $T2H_WORDS_PT,
! 28528: # 'fr' => $T2H_WORDS_FR,
! 28529: #};
! 28530:
! 28531: sub set_language($)
! 28532: {
! 28533: my $lang = shift;
! 28534: if (defined($lang) && exists($Texi2HTML::Config::LANGUAGES->{$lang}) && defined($Texi2HTML::Config::LANGUAGES->{$lang}))
! 28535: {
! 28536: $language = $lang;
! 28537: return 1;
! 28538: }
! 28539: else
! 28540: {
! 28541: return 0;
! 28542: }
! 28543: }
! 28544:
! 28545: sub get_language()
! 28546: {
! 28547: return $language;
! 28548: }
! 28549:
! 28550: my @MONTH_NAMES =
! 28551: (
! 28552: 'January', 'February', 'March', 'April', 'May',
! 28553: 'June', 'July', 'August', 'September', 'October',
! 28554: 'November', 'December'
! 28555: );
! 28556:
! 28557: # This is not used as code, but used to mark months as strings to be
! 28558: # translated
! 28559: if (0)
! 28560: {
! 28561: my @mark_month_for_translation = (
! 28562: gdt('January'),
! 28563: gdt('February'),
! 28564: gdt('March'),
! 28565: gdt('April'),
! 28566: gdt('May'),
! 28567: gdt('June'),
! 28568: gdt('July'),
! 28569: gdt('August'),
! 28570: gdt('September'),
! 28571: gdt('October'),
! 28572: gdt('November'),
! 28573: gdt('December')
! 28574: );
! 28575: }
! 28576:
! 28577: my $I = \&get_string;
! 28578:
! 28579: sub pretty_date($)
! 28580: {
! 28581: my $lang = shift;
! 28582: my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
! 28583:
! 28584: ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
! 28585: $year += ($year < 70) ? 2000 : 1900;
! 28586: return main::gdt('{month} {day}, {year}', { 'month' => main::gdt($MONTH_NAMES[$mon]),
! 28587: 'day' => $mday, 'year' => $year });
! 28588: }
! 28589:
! 28590: my $error_no_en = 0;
! 28591:
! 28592: my %missing_strings;
! 28593:
! 28594: # arguments should already be converted
! 28595: sub get_string($;$$)
! 28596: {
! 28597: my $string = shift;
! 28598: my $arguments = shift;
! 28599: $arguments = undef if (!ref($arguments));
! 28600: my $state = shift;
! 28601: # if duplicate is passed, it means that we are in the text and so should
! 28602: # use the main state
! 28603: if (defined($state) and $state->{'duplicate'} and defined($Texi2HTML::THISDOC{'state'}))
! 28604: {
! 28605: $state = main::duplicate_formatting_state($Texi2HTML::THISDOC{'state'});
! 28606: }
! 28607:
! 28608: my $translated_string;
! 28609: my $T2H_LANGUAGES = $Texi2HTML::Config::LANGUAGES;
! 28610: if (! exists($T2H_LANGUAGES->{'en'}))
! 28611: {
! 28612: unless($error_no_en)
! 28613: {
! 28614: print STDERR "i18n: no LANGUAGES->{'en'} hash\n";
! 28615: $error_no_en = 1;
! 28616: }
! 28617: }
! 28618: else
! 28619: {
! 28620: unless (exists ($T2H_LANGUAGES->{'en'}->{$string}))
! 28621: {
! 28622: unless (exists($missing_strings{$string}))
! 28623: {
! 28624: #print STDERR "i18n: missing string $string\n";
! 28625: $missing_strings{$string} = 1;
! 28626: }
! 28627: }
! 28628: if (defined ($T2H_LANGUAGES->{$language}->{$string}) and
! 28629: ($T2H_LANGUAGES->{$language}->{$string} ne ''))
! 28630: {
! 28631: $translated_string = $T2H_LANGUAGES->{$language}->{$string};
! 28632: }
! 28633: elsif (defined ($T2H_LANGUAGES->{'en'}->{$string}) and
! 28634: ($T2H_LANGUAGES->{'en'}->{$string} ne ''))
! 28635: {
! 28636: $translated_string = $T2H_LANGUAGES->{'en'}->{$string};
! 28637: }
! 28638: else
! 28639: {
! 28640: $translated_string = $string;
! 28641: }
! 28642: }
! 28643: return main::substitute_line($translated_string, "translation", $state) unless (defined($arguments) or !keys(%$arguments));
! 28644:
! 28645: # taken from libintl perl, copyright Guido. sub __expand
! 28646: my %args = %$arguments;
! 28647: my $re = join '|', map { quotemeta $_ } keys %args;
! 28648:
! 28649: if ($state->{'keep_texi'})
! 28650: {
! 28651: $translated_string =~ s/\{($re)\}/defined $args{$1} ? $args{$1} : "{$1}"/ge;
! 28652: return $translated_string;
! 28653: }
! 28654:
! 28655: # if there are arguments, we must protect the {arg} constructs before
! 28656: # doing substitute_line. So there is a first pass here to change {arg}
! 28657: # to %@internal_translation_open_brace{}arg@internal_translation_close_brace{}
! 28658: $translated_string =~ s/\{($re)\}/\@internal_translation_open_brace\{\}$1\@internal_translation_close_brace\{\}/g;
! 28659: foreach my $map (\%Texi2HTML::Config::things_map, \%Texi2HTML::Config::pre_map, \%Texi2HTML::Config::texi_map, \%Texi2HTML::Config::simple_format_texi_map)
! 28660: {
! 28661: $map->{'internal_translation_open_brace'} = '{';
! 28662: $map->{'internal_translation_close_brace'} = '}';
! 28663: }
! 28664: $translated_string = main::substitute_line($translated_string, "translation", $state);
! 28665: $translated_string =~ s/\{($re)\}/defined $args{$1} ? $args{$1} : "{$1}"/ge;
! 28666: foreach my $map (\%Texi2HTML::Config::things_map, \%Texi2HTML::Config::pre_map, \%Texi2HTML::Config::texi_map, \%Texi2HTML::Config::simple_format_texi_map)
! 28667: {
! 28668: delete $map->{'internal_translation_open_brace'};
! 28669: delete $map->{'internal_translation_close_brace'};
! 28670: }
! 28671: return $translated_string;
! 28672:
! 28673: }
! 28674:
! 28675: 1;
! 28676: require "$T2H_HOME/T2h_i18n.pm"
! 28677: if ($0 =~ /\.pl$/ &&
! 28678: -e "$T2H_HOME/T2h_i18n.pm" && -r "$T2H_HOME/T2h_i18n.pm");
! 28679: }
! 28680:
! 28681:
! 28682: #########################################################################
! 28683: #
! 28684: # latex2html code
! 28685: #
! 28686: #---######################################################################
! 28687:
! 28688: {
! 28689: # leave this within comments, and keep the require statement
! 28690: # This way, you can directly run texi2html.pl, if $ENV{T2H_HOME}/T2h_l2h.pm
! 28691: # exists.
! 28692:
! 28693: # @T2H_L2H@
! 28694: #+##############################################################################
! 28695: #
! 28696: # T2h_l2h.pm: interface to LaTeX2HTML
! 28697: #
! 28698: # Copyright (C) 1999-2005 Patrice Dumas <pertusus@free.fr>,
! 28699: # Derek Price <derek@ximbiot.com>,
! 28700: # Adrian Aichner <adrian@xemacs.org>,
! 28701: # & others.
! 28702: #
! 28703: # This program is free software; you can redistribute it and/or modify
! 28704: # it under the terms of the GNU General Public License as published by
! 28705: # the Free Software Foundation; either version 2 of the License, or
! 28706: # (at your option) any later version.
! 28707: #
! 28708: # This program is distributed in the hope that it will be useful,
! 28709: # but WITHOUT ANY WARRANTY; without even the implied warranty of
! 28710: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 28711: # GNU General Public License for more details.
! 28712: #
! 28713: # You should have received a copy of the GNU General Public License
! 28714: # along with this program; if not, write to the Free Software
! 28715: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
! 28716: # 02110-1301 USA
! 28717: #
! 28718: #-##############################################################################
! 28719:
! 28720: require 5.0;
! 28721: use strict;
! 28722:
! 28723: package Texi2HTML::LaTeX2HTML;
! 28724: use Cwd;
! 28725:
! 28726:
! 28727: # latex2html conversions consist of three stages:
! 28728: # 1) to latex: Put "latex" code into a latex file
! 28729: # (init, to_latex, finish_to_latex)
! 28730: # 2) to html: Use latex2html to generate corresponding html code and images
! 28731: # (to_html)
! 28732: # 3) from html: Extract generated code and images from latex2html run
! 28733: # (init_from_html, do_tex)
! 28734:
! 28735: # init l2h defaults for files and names
! 28736:
! 28737: # global variable used for caching
! 28738: # FIXME there is no reason for this variable to be global
! 28739: use vars qw(
! 28740: %l2h_cache
! 28741: );
! 28742:
! 28743: my ($l2h_name, $l2h_latex_file, $l2h_cache_file, $l2h_html_file, $l2h_prefix);
! 28744:
! 28745: # holds the status of latex2html operations. If 0 it means that there was
! 28746: # an error
! 28747: my $status = 0;
! 28748:
! 28749: my $debug;
! 28750: my $verbose;
! 28751: my $docu_rdir;
! 28752: my $docu_name;
! 28753:
! 28754: # init_from_html
! 28755: my $extract_error_count;
! 28756: my $invalid_counter_count;
! 28757:
! 28758: # change_image_file_names
! 28759: my %l2h_img; # associate src file to destination file
! 28760: # such that files are not copied twice
! 28761: my $image_count;
! 28762:
! 28763: # do_tex
! 28764: my $html_output_count = 0; # html text outputed in html result file
! 28765:
! 28766: ##########################
! 28767: #
! 28768: # First stage: Generation of Latex file
! 28769: # Initialize with: init
! 28770: # Add content with: to_latex ($text) --> HTML placeholder comment
! 28771: # Finish with: finish_to_latex
! 28772: #
! 28773:
! 28774: my $l2h_latex_preamble = <<EOT;
! 28775: % This document was automatically generated by the l2h extenstion of texi2html
! 28776: % DO NOT EDIT !!!
! 28777: \\documentclass{article}
! 28778: \\usepackage{html}
! 28779: \\begin{document}
! 28780: EOT
! 28781:
! 28782: my $l2h_latex_closing = <<EOT;
! 28783: \\end{document}
! 28784: EOT
! 28785:
! 28786: my %l2h_to_latex = (); # associate a latex text with the index in the
! 28787: # html result array.
! 28788: my @l2h_to_latex = (); # array used to associate the index with
! 28789: # the original latex text.
! 28790: my $latex_count = 0; # number of latex texts really stored
! 28791: my $latex_converted_count = 0; # number of latex texts passed through latex2html
! 28792: my $to_latex_count = 0; # total number of latex texts processed
! 28793: my $cached_count = 0; # number of cached latex texts
! 28794: %l2h_cache = (); # the cache hash. Associate latex text with
! 28795: # html from the previous run
! 28796: my @l2h_from_html; # array of resulting html
! 28797:
! 28798: my %global_count = (); # associate a command name and the
! 28799: # corresponding counter to the index in the
! 28800: # html result array
! 28801:
! 28802: # set $status to 1, if l2h could be initalized properly, to 0 otherwise
! 28803: sub init()
! 28804: {
! 28805:
! 28806: %l2h_to_latex = (); # associate a latex text with the index in the
! 28807: # html result array.
! 28808: @l2h_to_latex = (); # array used to associate the index with
! 28809: # the original latex text.
! 28810: $latex_count = 0; # number of latex texts really stored
! 28811: $latex_converted_count = 0; # number of latex texts passed through latex2html
! 28812: $to_latex_count = 0; # total number of latex texts processed
! 28813: $cached_count = 0; # number of cached latex texts
! 28814: %l2h_cache = (); # the cache hash. Associate latex text with
! 28815: # html from the previous run
! 28816: @l2h_from_html = (); # array of resulting html
! 28817:
! 28818: %global_count = (); # associate a command name and the
! 28819: # corresponding counter to the index in the
! 28820: # html result array
! 28821: $extract_error_count = 0;
! 28822: $invalid_counter_count = 0;
! 28823: %l2h_img = (); # associate src file to destination file
! 28824: # such that files are not copied twice
! 28825: $image_count = 1;
! 28826:
! 28827: $html_output_count = 0; # html text outputed in html result file
! 28828: $status = 0;
! 28829: return if ($Texi2HTML::Config::null_device_file{$Texi2HTML::THISDOC{'filename'}->{'top'}});
! 28830:
! 28831: $docu_name = $Texi2HTML::THISDOC{'file_base_name'};
! 28832: $docu_rdir = $Texi2HTML::THISDOC{'destination_directory'};
! 28833: $docu_rdir = '' if (!defined($docu_rdir));
! 28834: $l2h_name = "${docu_name}_l2h";
! 28835: $l2h_latex_file = "$docu_rdir${l2h_name}.tex";
! 28836: $l2h_cache_file = "${docu_rdir}${docu_name}-l2h_cache.pm";
! 28837: # destination dir -- generated images are put there, should be the same
! 28838: # as dir of enclosing html document --
! 28839: $l2h_html_file = "$docu_rdir${l2h_name}.html";
! 28840: $l2h_prefix = "${l2h_name}_";
! 28841: $debug = $Texi2HTML::THISDOC{'debug_l2h'};
! 28842: $verbose = $Texi2HTML::Config::VERBOSE;
! 28843:
! 28844: unless ($Texi2HTML::Config::L2H_SKIP)
! 28845: {
! 28846: unless (open(L2H_LATEX, ">$l2h_latex_file"))
! 28847: {
! 28848: main::document_error ("l2h: Can't open latex file '$l2h_latex_file' for writing: $!");
! 28849: $status = 0;
! 28850: return;
! 28851: }
! 28852: warn "# l2h: use ${l2h_latex_file} as latex file\n" if ($verbose);
! 28853: print L2H_LATEX $l2h_latex_preamble;
! 28854: }
! 28855: # open the database that holds cached text
! 28856: init_cache() if (!defined($Texi2HTML::Config::L2H_SKIP) or $Texi2HTML::Config::L2H_SKIP);
! 28857: $status = 1;
! 28858: }
! 28859:
! 28860:
! 28861: # print text (2nd arg) into latex file (if not already there nor in cache)
! 28862: # which can be later on replaced by the latex2html generated text.
! 28863: #
! 28864: sub to_latex($$$)
! 28865: {
! 28866: my $command = shift;
! 28867: my $text = shift;
! 28868: my $counter = shift;
! 28869: return unless ($status);
! 28870: if ($command eq 'tex')
! 28871: {
! 28872: $text .= ' ';
! 28873: }
! 28874: elsif ($command eq 'math')
! 28875: {
! 28876: $text = "\$".$text."\$";
! 28877: }
! 28878: $to_latex_count++;
! 28879: $text =~ s/(\s*)$//;
! 28880: # try whether we have text already on things to do
! 28881: my $count = $l2h_to_latex{$text};
! 28882: unless ($count)
! 28883: {
! 28884: $latex_count++;
! 28885: $count = $latex_count;
! 28886: # try whether we can get it from cache
! 28887: my $cached_text = from_cache($text);
! 28888: if (defined($cached_text))
! 28889: {
! 28890: $cached_count++;
! 28891: # put the cached result in the html result array
! 28892: $l2h_from_html[$count] = $cached_text;
! 28893: }
! 28894: else
! 28895: {
! 28896: $latex_converted_count++;
! 28897: unless ($Texi2HTML::Config::L2H_SKIP)
! 28898: {
! 28899: print L2H_LATEX "\\begin{rawhtml}\n\n";
! 28900: print L2H_LATEX "<!-- l2h_begin $l2h_name $count -->\n";
! 28901: print L2H_LATEX "\\end{rawhtml}\n";
! 28902:
! 28903: print L2H_LATEX "$text\n";
! 28904:
! 28905: print L2H_LATEX "\\begin{rawhtml}\n";
! 28906: print L2H_LATEX "<!-- l2h_end $l2h_name $count -->\n\n";
! 28907: print L2H_LATEX "\\end{rawhtml}\n";
! 28908: }
! 28909: }
! 28910: $l2h_to_latex[$count] = $text;
! 28911: $l2h_to_latex{$text} = $count;
! 28912: }
! 28913: $global_count{"${command}_$counter"} = $count;
! 28914: return 1;
! 28915: }
! 28916:
! 28917: # print closing into latex file and close it
! 28918: sub finish_to_latex()
! 28919: {
! 28920: my $reused = $to_latex_count - $latex_converted_count - $cached_count;
! 28921: unless ($Texi2HTML::Config::L2H_SKIP)
! 28922: {
! 28923: print L2H_LATEX $l2h_latex_closing;
! 28924: close (L2H_LATEX);
! 28925: }
! 28926: warn "# l2h: finished to latex ($cached_count cached, $reused reused, $latex_converted_count to process)\n" if ($verbose);
! 28927: unless ($latex_count)
! 28928: {
! 28929: # no @tex nor @math
! 28930: finish();
! 28931: return 0;
! 28932: }
! 28933: return 1;
! 28934: }
! 28935:
! 28936: ###################################
! 28937: # Second stage: Use latex2html to generate corresponding html code and images
! 28938: #
! 28939: # to_html([$l2h_latex_file, [$l2h_html_dir]]):
! 28940: # Call latex2html on $l2h_latex_file
! 28941: # Put images (prefixed with $l2h_name."_") and html file(s) in $l2h_html_dir
! 28942: # Return 1, on success
! 28943: # 0, otherwise
! 28944: #
! 28945: sub to_html()
! 28946: {
! 28947: my ($call, $dotbug);
! 28948: # when there are no tex constructs to convert (happens in case everything
! 28949: # comes from the cache), there is no latex2html run
! 28950: if ($Texi2HTML::Config::L2H_SKIP or ($latex_converted_count == 0))
! 28951: {
! 28952: warn "# l2h: skipping latex2html run\n" if ($verbose);
! 28953: return 1;
! 28954: }
! 28955: # Check for dot in directory where dvips will work
! 28956: if ($Texi2HTML::Config::L2H_TMP)
! 28957: {
! 28958: if ($Texi2HTML::Config::L2H_TMP =~ /\./)
! 28959: {
! 28960: main::document_warn ("l2h: l2h_tmp dir contains a dot.");
! 28961: $dotbug = 1;
! 28962: }
! 28963: }
! 28964: else
! 28965: {
! 28966: if (cwd() =~ /\./)
! 28967: {
! 28968: main::document_warn ("l2h: current dir contains a dot.");
! 28969: $dotbug = 1;
! 28970: }
! 28971: }
! 28972: # fix it, if necessary and hope that it works
! 28973: #$Texi2HTML::Config::L2H_TMP = "/tmp" if ($dotbug);
! 28974: return 0 if ($dotbug);
! 28975:
! 28976: $call = $Texi2HTML::Config::L2H_L2H;
! 28977: # use init file, if specified
! 28978: my $init_file = main::locate_init_file($Texi2HTML::Config::L2H_FILE);
! 28979: $call = $call . " -init_file " . $init_file if ($init_file);
! 28980: # set output dir
! 28981: $call .= (($docu_rdir ne '') ? " -dir $docu_rdir" : " -no_subdir");
! 28982: # use l2h_tmp, if specified
! 28983: $call .= " -tmp $Texi2HTML::Config::L2H_TMP"
! 28984: if (defined($Texi2HTML::Config::L2H_TMP) and $Texi2HTML::Config::L2H_TMP ne '');
! 28985: # use a given html version if specified
! 28986: $call .= " -html_version $Texi2HTML::Config::L2H_HTML_VERSION"
! 28987: if (defined($Texi2HTML::Config::L2H_HTML_VERSION) and $Texi2HTML::Config::L2H_HTML_VERSION ne '');
! 28988: # options we want to be sure of
! 28989: $call .= " -address 0 -info 0 -split 0 -no_navigation -no_auto_link";
! 28990: $call .= " -prefix $l2h_prefix $l2h_latex_file";
! 28991:
! 28992: warn "# l2h: executing '$call'\n" if ($verbose);
! 28993: if (system($call))
! 28994: {
! 28995: main::document_error ("l2h: '${call}' did not succeed");
! 28996: return 0;
! 28997: }
! 28998: else
! 28999: {
! 29000: warn "# l2h: latex2html finished successfully\n" if ($verbose);
! 29001: return 1;
! 29002: }
! 29003: }
! 29004:
! 29005: ##########################
! 29006: # Third stage: Extract generated contents from latex2html run
! 29007: # Initialize with: init_from_html
! 29008: # open $l2h_html_file for reading
! 29009: # reads in contents into array indexed by numbers
! 29010: # return 1, on success -- 0, otherwise
! 29011: # Finish with: finish
! 29012: # closes $l2h_html_dir/$l2h_name.".$docu_ext"
! 29013:
! 29014:
! 29015: # the images generated by latex2html have names like ${docu_name}_l2h_img?.png
! 29016: # they are copied to ${docu_name}_?.png, and html is changed accordingly.
! 29017:
! 29018: # FIXME is it really necessary to bother doing that? Looks like an unneeded
! 29019: # complication to me (pertusus, 2009), and it could go bad if there is some
! 29020: # SRC="(.*?)" in the text (though the regexp could be made more specific).
! 29021:
! 29022: # %l2h_img; # associate src file to destination file
! 29023: # such that files are not copied twice
! 29024: sub change_image_file_names($)
! 29025: {
! 29026: my $content = shift;
! 29027: my @images = ($content =~ /SRC="(.*?)"/g);
! 29028: my ($src, $dest);
! 29029:
! 29030: for $src (@images)
! 29031: {
! 29032: $dest = $l2h_img{$src};
! 29033: unless ($dest)
! 29034: {
! 29035: my $ext = '';
! 29036: if ($src =~ /.*\.(.*)$/ and (!defined($Texi2HTML::THISDOC{'extension'}) or $1 ne $Texi2HTML::THISDOC{'extension'}))
! 29037: {
! 29038: $ext = ".$1";
! 29039: }
! 29040: else
! 29041: { # A warning when the image extension is the same than the
! 29042: # document extension. copying the file could result in
! 29043: # overwriting an output file (almost surely if the default
! 29044: # texi2html file names are used).
! 29045: main::document_warn ("L2h image $src has invalid extension");
! 29046: next;
! 29047: }
! 29048: while (-e "$docu_rdir${docu_name}_${image_count}$ext")
! 29049: {
! 29050: $image_count++;
! 29051: }
! 29052: $dest = "${docu_name}_${image_count}$ext";
! 29053: if ($debug)
! 29054: {
! 29055: # not portable, but only used with debug.
! 29056: system("cp -f $docu_rdir$src $docu_rdir$dest");
! 29057: }
! 29058: else
! 29059: {
! 29060: # FIXME error condition not checked.
! 29061: rename ("$docu_rdir$src", "$docu_rdir$dest");
! 29062: }
! 29063: $l2h_img{$src} = $dest;
! 29064: #unlink "$docu_rdir$src" unless ($debug);
! 29065: }
! 29066: $content =~ s/SRC="$src"/SRC="$dest"/g;
! 29067: }
! 29068: return $content;
! 29069: }
! 29070:
! 29071: sub init_from_html()
! 29072: {
! 29073: # when there are no tex constructs to convert (happens in case everything
! 29074: # comes from the cache), the html file that was generated by previous
! 29075: # latex2html runs isn't reused.
! 29076: if ($latex_converted_count == 0)
! 29077: {
! 29078: return 1;
! 29079: }
! 29080:
! 29081: if (! open(L2H_HTML, "<$l2h_html_file"))
! 29082: {
! 29083: main::document_warn ("l2h: Can't open $l2h_html_file for reading");
! 29084: return 0;
! 29085: }
! 29086: warn "# l2h: use $l2h_html_file as html file\n" if ($verbose);
! 29087:
! 29088: my $html_converted_count = 0; # number of html resulting texts
! 29089: # retrieved in the file
! 29090:
! 29091: my ($count, $h_line);
! 29092: while ($h_line = <L2H_HTML>)
! 29093: {
! 29094: if ($h_line =~ /!-- l2h_begin $l2h_name ([0-9]+) --/)
! 29095: {
! 29096: $count = $1;
! 29097: my $h_content = '';
! 29098: my $h_end_found = 0;
! 29099: while ($h_line = <L2H_HTML>)
! 29100: {
! 29101: if ($h_line =~ /!-- l2h_end $l2h_name $count --/)
! 29102: {
! 29103: $h_end_found = 1;
! 29104: chomp $h_content;
! 29105: chomp $h_content;
! 29106: $html_converted_count++;
! 29107: # transform image file names and copy image files
! 29108: $h_content = change_image_file_names($h_content);
! 29109: # store result in the html result array
! 29110: $l2h_from_html[$count] = $h_content;
! 29111: # also add the result in cache hash
! 29112: $l2h_cache{$l2h_to_latex[$count]} = $h_content;
! 29113: last;
! 29114: }
! 29115: $h_content = $h_content.$h_line;
! 29116: }
! 29117: unless ($h_end_found)
! 29118: { # couldn't found the closing comment. Certainly a bug.
! 29119: main::msg_debug ("l2h: l2h_end $l2h_name $count not found");
! 29120: close(L2H_HTML);
! 29121: return 0;
! 29122: }
! 29123: }
! 29124: }
! 29125:
! 29126: # Not the same number of converted elements and retrieved elements
! 29127: if ($latex_converted_count != $html_converted_count)
! 29128: {
! 29129: main::msg_debug ("l2h: waiting for $latex_converted_count elements found $html_converted_count");
! 29130: }
! 29131:
! 29132: warn "# l2h: Got $html_converted_count of $latex_count html contents\n"
! 29133: if ($verbose);
! 29134:
! 29135: close(L2H_HTML);
! 29136: return 1;
! 29137: }
! 29138:
! 29139: # $html_output_count = 0; # html text outputed in html result file
! 29140:
! 29141: # called each time a construct handled by latex2html is encountered, should
! 29142: # output the corresponding html
! 29143: sub do_tex($$$$)
! 29144: {
! 29145: my $style = shift;
! 29146: my $counter = shift;
! 29147: my $state = shift;
! 29148: return unless ($status);
! 29149: my $count = $global_count{"${style}_$counter"};
! 29150: ################################## begin debug section (incorrect counts)
! 29151: if (!defined($count))
! 29152: {
! 29153: # counter is undefined
! 29154: $invalid_counter_count++;
! 29155: main::msg_debug ("l2h: undefined count for ${style}_$counter");
! 29156: return ("<!-- l2h: ". __LINE__ . " undef count for ${style}_$counter -->")
! 29157: if ($debug);
! 29158: return '';
! 29159: }
! 29160: elsif(($count <= 0) or ($count > $latex_count))
! 29161: {
! 29162: # counter out of range
! 29163: $invalid_counter_count++;
! 29164: main::msg_debug ("l2h: Request of $count content which is out of valide range [0,$latex_count)");
! 29165: return ("<!-- l2h: ". __LINE__ . " out of range count $count -->")
! 29166: if ($debug);
! 29167: return '';
! 29168: }
! 29169: ################################## end debug section (incorrect counts)
! 29170:
! 29171: # this seems to be a valid counter
! 29172: my $result = '';
! 29173: $result = "<!-- l2h_begin $l2h_name $count -->" if ($debug);
! 29174: if (defined($l2h_from_html[$count]))
! 29175: {
! 29176: $html_output_count++;
! 29177: # maybe we could also have something if simple_format
! 29178: # with Texi2HTML::Config::protect_text in case there
! 29179: # was some @math on a line passed through simple_format.
! 29180: # This would certainly be illegal texinfo, however.
! 29181: if ($state->{'remove_texi'})
! 29182: {# don't protect anything
! 29183: $result .= $l2h_to_latex[$count];
! 29184: }
! 29185: else
! 29186: {
! 29187: $result .= $l2h_from_html[$count];
! 29188: }
! 29189: }
! 29190: else
! 29191: {
! 29192: # if the result is not in @l2h_from_html, there is an error somewhere.
! 29193: $extract_error_count++;
! 29194: main::msg_debug ("l2h: can't extract content $count from html");
! 29195: # try simple (ordinary) substitution (without l2h)
! 29196: $result .= "<!-- l2h: ". __LINE__ . " use texi2html -->" if ($debug);
! 29197: $result .= main::substitute_text({}, undef, 'error in l2h', $l2h_to_latex[$count]);
! 29198: }
! 29199: $result .= "<!-- l2h_end $l2h_name $count -->" if ($debug);
! 29200: return $result;
! 29201: }
! 29202:
! 29203: # store results in the cache and remove temporary files.
! 29204: sub finish()
! 29205: {
! 29206: return unless($status);
! 29207: if ($verbose)
! 29208: {
! 29209: if ($extract_error_count + $invalid_counter_count)
! 29210: {
! 29211: warn "# l2h: finished from html ($extract_error_count extract and $invalid_counter_count invalid counter errors)\n";
! 29212: }
! 29213: else
! 29214: {
! 29215: warn "# l2h: finished from html (no error)\n";
! 29216: }
! 29217: if ($html_output_count != $latex_converted_count)
! 29218: { # this may happen if @-commands are collected at some places
! 29219: # but @-command at those places are not expanded later. For
! 29220: # example @math on @multitable lines.
! 29221: warn "# l2h: $html_output_count html outputed for $latex_converted_count converted\n";
! 29222: }
! 29223: }
! 29224: store_cache();
! 29225: if ($Texi2HTML::Config::L2H_CLEAN)
! 29226: {
! 29227: local ($_);
! 29228: warn "# l2h: removing temporary files generated by l2h extension\n"
! 29229: if $verbose;
! 29230: while (<"$docu_rdir$l2h_name"*>)
! 29231: {
! 29232: # FIXME error condition not checked
! 29233: unlink $_;
! 29234: }
! 29235: }
! 29236: warn "# l2h: Finished\n" if $verbose;
! 29237: return 1;
! 29238: }
! 29239:
! 29240: # the driver of end of first pass and second pass
! 29241: #
! 29242: sub latex2html()
! 29243: {
! 29244: return unless($status);
! 29245: return unless ($status = finish_to_latex());
! 29246: return unless ($status = to_html());
! 29247: }
! 29248:
! 29249:
! 29250: ##############################
! 29251: # stuff for l2h caching
! 29252: #
! 29253: # FIXME it is clear that l2h stuff takes very long compared with texi2html
! 29254: # which is already quite long. However this also adds some complexity
! 29255:
! 29256: # I tried doing this with a dbm data base, but it did not store all
! 29257: # keys/values. Hence, I did as latex2html does it
! 29258: sub init_cache
! 29259: {
! 29260: if (-r "$l2h_cache_file")
! 29261: {
! 29262: my $rdo = do "$l2h_cache_file";
! 29263: main::document_error ("l2h: could not load $docu_rdir$l2h_cache_file: $@")
! 29264: unless ($rdo);
! 29265: }
! 29266: }
! 29267:
! 29268: # store all the text obtained through latex2html
! 29269: sub store_cache
! 29270: {
! 29271: return unless $latex_count;
! 29272: my ($key, $value);
! 29273: unless (open(FH, ">$l2h_cache_file"))
! 29274: {
! 29275: main::document_error ("l2h: could not open $docu_rdir$l2h_cache_file for writing: $!");
! 29276: return;
! 29277: }
! 29278: while (($key, $value) = each %l2h_cache)
! 29279: {
! 29280: # escape stuff
! 29281: $key =~ s|/|\\/|g;
! 29282: $key =~ s|\\\\/|\\/|g;
! 29283: # weird, a \ at the end of the key results in an error
! 29284: # maybe this also broke the dbm database stuff
! 29285: $key =~ s|\\$|\\\\|;
! 29286: $value =~ s/\|/\\\|/go;
! 29287: $value =~ s/\\\\\|/\\\|/go;
! 29288: $value =~ s|\\\\|\\\\\\\\|g;
! 29289: print FH "\n\$l2h_cache_key = q/$key/;\n";
! 29290: print FH "\$l2h_cache{\$l2h_cache_key} = q|$value|;\n";
! 29291: }
! 29292: print FH "1;";
! 29293: close (FH);
! 29294: }
! 29295:
! 29296: # return cached html, if it exists for text, and if all pictures
! 29297: # are there, as well
! 29298: sub from_cache($)
! 29299: {
! 29300: my $text = shift;
! 29301: my $cached = $l2h_cache{$text};
! 29302: if (defined($cached))
! 29303: {
! 29304: while ($cached =~ m/SRC="(.*?)"/g)
! 29305: {
! 29306: unless (-e "$docu_rdir$1")
! 29307: {
! 29308: return undef;
! 29309: }
! 29310: }
! 29311: return $cached;
! 29312: }
! 29313: return undef;
! 29314: }
! 29315:
! 29316: 1;
! 29317:
! 29318: require "$T2H_HOME/T2h_l2h.pm"
! 29319: if ($0 =~ /\.pl$/ &&
! 29320: -e "$T2H_HOME/T2h_l2h.pm" && -r "$T2H_HOME/T2h_l2h.pm");
! 29321:
! 29322: }
! 29323:
! 29324: {
! 29325: package Texi2HTML::LaTeX2HTML::Config;
! 29326:
! 29327: # latex2html variables
! 29328: # These variables are not used. They are here for information only, and
! 29329: # an example of config file for latex2html file is included.
! 29330: my $ADDRESS;
! 29331: my $ANTI_ALIAS;
! 29332: my $ANTI_ALIAS_TEXT;
! 29333: my $ASCII_MODE;
! 29334: my $AUTO_LINK;
! 29335: my $AUTO_PREFIX;
! 29336: my $CHILDLINE;
! 29337: my $DEBUG;
! 29338: my $DESTDIR;
! 29339: my $DVIPS = 'dvips';
! 29340: my $ERROR;
! 29341: my $EXTERNAL_FILE;
! 29342: my $EXTERNAL_IMAGES;
! 29343: my $EXTERNAL_UP_LINK;
! 29344: my $EXTERNAL_UP_TITLE;
! 29345: my $FIGURE_SCALE_FACTOR;
! 29346: my $HTML_VERSION;
! 29347: my $IMAGES_ONLY;
! 29348: my $INFO;
! 29349: my $LINE_WIDTH;
! 29350: my $LOCAL_ICONS;
! 29351: my $LONG_TITLES;
! 29352: my $MATH_SCALE_FACTOR;
! 29353: my $MAX_LINK_DEPTH;
! 29354: my $MAX_SPLIT_DEPTH;
! 29355: my $NETSCAPE_HTML;
! 29356: my $NOLATEX;
! 29357: my $NO_FOOTNODE;
! 29358: my $NO_IMAGES;
! 29359: my $NO_NAVIGATION;
! 29360: my $NO_SIMPLE_MATH;
! 29361: my $NO_SUBDIR;
! 29362: my $PAPERSIZE;
! 29363: my $PREFIX;
! 29364: my $PS_IMAGES;
! 29365: my $REUSE;
! 29366: my $SCALABLE_FONTS;
! 29367: my $SHORTEXTN;
! 29368: my $SHORT_INDEX;
! 29369: my $SHOW_SECTION_NUMBERS;
! 29370: my $SPLIT;
! 29371: my $TEXDEFS;
! 29372: my $TITLE;
! 29373: my $TITLES_LANGUAGE;
! 29374: my $TMP;
! 29375: my $VERBOSE;
! 29376: my $WORDS_IN_NAVIGATION_PANEL_TITLES;
! 29377: my $WORDS_IN_PAGE;
! 29378:
! 29379: # @T2H_L2H_INIT@
! 29380:
! 29381: ######################################################################
! 29382: # from here on, its l2h init stuff
! 29383: #
! 29384:
! 29385: ## initialization for latex2html as for Singular manual generation
! 29386: ## obachman 3/99
! 29387:
! 29388: #
! 29389: # Options controlling Titles, File-Names, Tracing and Sectioning
! 29390: #
! 29391: $TITLE = '';
! 29392:
! 29393: $SHORTEXTN = 0;
! 29394:
! 29395: $LONG_TITLES = 0;
! 29396:
! 29397: #$DESTDIR = '';
! 29398:
! 29399: $NO_SUBDIR = 1;
! 29400:
! 29401: #$PREFIX = '';
! 29402:
! 29403: $AUTO_PREFIX = 0;
! 29404:
! 29405: $AUTO_LINK = 0;
! 29406:
! 29407: $SPLIT = 0;
! 29408:
! 29409: $MAX_LINK_DEPTH = 0;
! 29410:
! 29411: #$TMP = '';
! 29412:
! 29413: $DEBUG = 0;
! 29414:
! 29415: $VERBOSE = 1;
! 29416:
! 29417: #
! 29418: # Options controlling Extensions and Special Features
! 29419: #
! 29420: #$HTML_VERSION = "3.2"; # set by command line
! 29421:
! 29422: $TEXDEFS = 1; # we absolutely need that
! 29423:
! 29424: $EXTERNAL_FILE = '';
! 29425:
! 29426: $SCALABLE_FONTS = 1;
! 29427:
! 29428: $NO_SIMPLE_MATH = 1;
! 29429:
! 29430: $LOCAL_ICONS = 1;
! 29431:
! 29432: $SHORT_INDEX = 0;
! 29433:
! 29434: $NO_FOOTNODE = 1;
! 29435:
! 29436: $ADDRESS = '';
! 29437:
! 29438: $INFO = '';
! 29439:
! 29440: #
! 29441: # Switches controlling Image Generation
! 29442: #
! 29443: $ASCII_MODE = 0;
! 29444:
! 29445: $NOLATEX = 0;
! 29446:
! 29447: $EXTERNAL_IMAGES = 0;
! 29448:
! 29449: $PS_IMAGES = 0;
! 29450:
! 29451: $NO_IMAGES = 0;
! 29452:
! 29453: $IMAGES_ONLY = 0;
! 29454:
! 29455: $REUSE = 2;
! 29456:
! 29457: $ANTI_ALIAS = 1;
! 29458:
! 29459: $ANTI_ALIAS_TEXT = 1;
! 29460:
! 29461: #
! 29462: #Switches controlling Navigation Panels
! 29463: #
! 29464: $NO_NAVIGATION = 1;
! 29465: $ADDRESS = '';
! 29466: $INFO = 0; # 0 = do not make a "About this document..." section
! 29467:
! 29468: #
! 29469: #Switches for Linking to other documents
! 29470: #
! 29471: # currently -- we don't care
! 29472:
! 29473: $MAX_SPLIT_DEPTH = 0; # Stop making separate files at this depth
! 29474:
! 29475: $MAX_LINK_DEPTH = 0; # Stop showing child nodes at this depth
! 29476:
! 29477: $NOLATEX = 0; # 1 = do not pass unknown environments to Latex
! 29478:
! 29479: $EXTERNAL_IMAGES = 0; # 1 = leave the images outside the document
! 29480:
! 29481: $ASCII_MODE = 0; # 1 = do not use any icons or internal images
! 29482:
! 29483: # 1 = use links to external postscript images rather than inlined bitmap
! 29484: # images.
! 29485: $PS_IMAGES = 0;
! 29486: $SHOW_SECTION_NUMBERS = 0;
! 29487:
! 29488: ### Other global variables ###############################################
! 29489:
! 29490: # put dvips stderr on stdout since latex2html is alread very verbose
! 29491: $DVIPS = "$DVIPS ".' 2>&1';
! 29492:
! 29493: $CHILDLINE = "";
! 29494:
! 29495: # This is the line width measured in pixels and it is used to right justify
! 29496: # equations and equation arrays;
! 29497: $LINE_WIDTH = 500;
! 29498:
! 29499: # Used in conjunction with AUTO_NAVIGATION
! 29500: $WORDS_IN_PAGE = 300;
! 29501:
! 29502: # The value of this variable determines how many words to use in each
! 29503: # title that is added to the navigation panel (see below)
! 29504: #
! 29505: $WORDS_IN_NAVIGATION_PANEL_TITLES = 0;
! 29506:
! 29507: # This number will determine the size of the equations, special characters,
! 29508: # and anything which will be converted into an inlined image
! 29509: # *except* "image generating environments" such as "figure", "table"
! 29510: # or "minipage".
! 29511: # Effective values are those greater than 0.
! 29512: # Sensible values are between 0.1 - 4.
! 29513: $MATH_SCALE_FACTOR = 1.5;
! 29514:
! 29515: # This number will determine the size of
! 29516: # image generating environments such as "figure", "table" or "minipage".
! 29517: # Effective values are those greater than 0.
! 29518: # Sensible values are between 0.1 - 4.
! 29519: $FIGURE_SCALE_FACTOR = 1.6;
! 29520:
! 29521:
! 29522: # If both of the following two variables are set then the "Up" button
! 29523: # of the navigation panel in the first node/page of a converted document
! 29524: # will point to $EXTERNAL_UP_LINK. $EXTERNAL_UP_TITLE should be set
! 29525: # to some text which describes this external link.
! 29526: $EXTERNAL_UP_LINK = "";
! 29527: $EXTERNAL_UP_TITLE = "";
! 29528:
! 29529: # If this is set then the resulting HTML will look marginally better if viewed
! 29530: # with Netscape.
! 29531: $NETSCAPE_HTML = 1;
! 29532:
! 29533: # Valid paper sizes are "letter", "legal", "a4","a3","a2" and "a0"
! 29534: # Paper sizes has no effect other than in the time it takes to create inlined
! 29535: # images and in whether large images can be created at all ie
! 29536: # - larger paper sizes *MAY* help with large image problems
! 29537: # - smaller paper sizes are quicker to handle
! 29538: $PAPERSIZE = "a4";
! 29539:
! 29540: # Replace "english" with another language in order to tell LaTeX2HTML that you
! 29541: # want some generated section titles (eg "Table of Contents" or "References")
! 29542: # to appear in a different language. Currently only "english" and "french"
! 29543: # is supported but it is very easy to add your own. See the example in the
! 29544: # file "latex2html.config"
! 29545: $TITLES_LANGUAGE = "english";
! 29546:
! 29547: 1; # This must be the last non-comment line
! 29548:
! 29549: # End File l2h.init
! 29550: ######################################################################
! 29551:
! 29552: }
! 29553:
! 29554: package main;
! 29555:
! 29556: if (!defined(Texi2HTML::Config::get_conf('use_nls')))
! 29557: {
! 29558: my $use_nls = ('yes' eq 'yes' or $0 =~ /\.pl$/);
! 29559: Texi2HTML::Config::set_conf('use_nls', $use_nls);
! 29560: }
! 29561:
! 29562: # prepare the gettext-like framework. To be noted that Locales::TextDomain
! 29563: # canot be used, since it cannot be used dynamically through a reuires.
! 29564: # Fortunately, Locales::TextDomain is a thin layer above Locales::Messages.
! 29565:
! 29566: my $strings_textdomain = 'texi2html' . '_document';
! 29567: $strings_textdomain = 'texi2html_document' if ($strings_textdomain eq '@'.'PACKAGE@' . '_document');
! 29568: my $messages_textdomain = 'texi2html';
! 29569: $messages_textdomain = 'texi2html' if ($messages_textdomain eq '@'.'PACKAGE@');
! 29570:
! 29571: #my $messages_textdomain = 'texinfo';
! 29572:
! 29573: if (Texi2HTML::Config::get_conf('use_nls'))
! 29574: {
! 29575: if ($0 =~ /\.pl$/)
! 29576: { # use in-source libintl when testing
! 29577: unshift @INC, "$T2H_HOME/lib/libintl-perl/lib";
! 29578: }
! 29579: elsif ($ENV{T2H_SOURCE_LIBINTL})
! 29580: {
! 29581: unshift @INC, $ENV{T2H_SOURCE_LIBINTL};
! 29582: }
! 29583: elsif ('no' ne 'yes')
! 29584: {
! 29585: unshift @INC, "$pkgdatadir/lib/libintl-perl/lib";
! 29586: }
! 29587: else
! 29588: {
! 29589: eval {
! 29590: require Locale::Messages;
! 29591: };
! 29592: if ($@)
! 29593: {
! 29594: unshift @INC, "$pkgdatadir/lib/libintl-perl/lib";
! 29595: }
! 29596: }
! 29597: # gettext-like translations
! 29598: #require Locale::TextDomain;
! 29599: require Locale::Messages;
! 29600: # we want a reliable way to switch locale, so we don't use the system
! 29601: # gettext.
! 29602: Locale::Messages->select_package ('gettext_pp');
! 29603: if ($0 =~ /\.pl$/)
! 29604: {
! 29605: # in case of out of source build, the locales directory should
! 29606: # be two levels below. $T2H_HOME is in srcdir.
! 29607: foreach my $locales_dir ("$T2H_HOME/locales", "../../locales")
! 29608: {
! 29609: if (-d $locales_dir)
! 29610: {
! 29611: Locale::Messages::bindtextdomain ($strings_textdomain, $locales_dir);
! 29612: last;
! 29613: }
! 29614: }
! 29615: }
! 29616: else
! 29617: { # match where gettext installs
! 29618: Locale::Messages::bindtextdomain ($strings_textdomain, "$datadir/locale");
! 29619: }
! 29620: # simply bind error messages to the installation directory.
! 29621: # Messages should be untranslated for tests.
! 29622: Locale::Messages::bindtextdomain ($messages_textdomain, "$datadir/locale");
! 29623: }
! 29624: else
! 29625: {
! 29626: unshift @INC, "$pkgdatadir/lib/libintl-perl/lib";
! 29627: require Locale::Messages;
! 29628: }
! 29629:
! 29630: sub __($)
! 29631: {
! 29632: my $msgid = shift;
! 29633: return Locale::Messages::dgettext($messages_textdomain, $msgid);
! 29634: }
! 29635:
! 29636: sub __p($$)
! 29637: {
! 29638: my $context = shift;
! 29639: my $msgid = shift;
! 29640: return Locale::Messages::dpgettext($messages_textdomain, $context, $msgid);
! 29641: }
! 29642:
! 29643: sub N__($)
! 29644: {
! 29645: return $_[0];
! 29646: }
! 29647:
! 29648: #
! 29649: # flush stdout and stderr after every write
! 29650: #
! 29651: select(STDERR);
! 29652: $| = 1;
! 29653: select(STDOUT);
! 29654: $| = 1;
! 29655:
! 29656: my $I = \&Texi2HTML::I18n::get_string;
! 29657:
! 29658: ########################################################################
! 29659: #
! 29660: # Global variable initialization
! 29661: #
! 29662: ########################################################################
! 29663: #
! 29664: # pre-defined indices
! 29665: #
! 29666:
! 29667: %index_prefix_to_name = ();
! 29668:
! 29669: %index_names =
! 29670: (
! 29671: 'cp' => { 'prefixes' => {'cp' => 0,'c' => 0}},
! 29672: 'fn' => { 'prefixes' => {'fn' => 1, 'f' => 1}},
! 29673: 'vr' => { 'prefixes' => {'vr' => 1, 'v' => 1}},
! 29674: 'ky' => { 'prefixes' => {'ky' => 1, 'k' => 1}},
! 29675: 'pg' => { 'prefixes' => {'pg' => 1, 'p' => 1}},
! 29676: 'tp' => { 'prefixes' => {'tp' => 1, 't' => 1}}
! 29677: );
! 29678:
! 29679: foreach my $name(keys(%index_names))
! 29680: {
! 29681: foreach my $prefix (keys %{$index_names{$name}->{'prefixes'}})
! 29682: {
! 29683: $forbidden_index_name{$prefix} = 1;
! 29684: $index_prefix_to_name{$prefix} = $name;
! 29685: }
! 29686: }
! 29687:
! 29688: foreach my $other_forbidden_index_name ('info','ps','pdf','htm',
! 29689: 'log','aux','dvi','texi','txi','texinfo','tex','bib')
! 29690: {
! 29691: $forbidden_index_name{$other_forbidden_index_name} = 1;
! 29692: }
! 29693:
! 29694: # commands with ---, -- '' and `` preserved
! 29695: # usefull with the old interface
! 29696:
! 29697: %code_style_map = (
! 29698: 'code' => 1,
! 29699: 'command' => 1,
! 29700: 'env' => 1,
! 29701: 'file' => 1,
! 29702: 'kbd' => 1,
! 29703: 'option' => 1,
! 29704: 'samp' => 1,
! 29705: 'verb' => 1,
! 29706: );
! 29707:
! 29708: my @element_directions = ('Up', 'Forward', 'Back', 'Next', 'Prev',
! 29709: 'SectionNext', 'SectionPrev', 'SectionUp', 'FastForward', 'FastBack',
! 29710: 'This', 'NodeUp', 'NodePrev', 'NodeNext', 'Following', 'NextFile', 'PrevFile',
! 29711: 'ToplevelNext', 'ToplevelPrev');
! 29712: $::simple_map_ref = \%Texi2HTML::Config::simple_map;
! 29713: $::simple_map_math_ref = \%Texi2HTML::Config::simple_map_math;
! 29714: #$::simple_map_pre_ref = \%Texi2HTML::Config::simple_map_pre;
! 29715: $::simple_map_texi_ref = \%Texi2HTML::Config::simple_map_texi;
! 29716: $::style_map_ref = \%Texi2HTML::Config::style_map;
! 29717: $::style_map_pre_ref = \%Texi2HTML::Config::style_map_pre;
! 29718: $::style_map_math_ref = \%Texi2HTML::Config::style_map_math;
! 29719: $::style_map_texi_ref = \%Texi2HTML::Config::style_map_texi;
! 29720: $::things_map_ref = \%Texi2HTML::Config::things_map;
! 29721: $::pre_map_ref = \%Texi2HTML::Config::pre_map;
! 29722: $::texi_map_ref = \%Texi2HTML::Config::texi_map;
! 29723:
! 29724: #print STDERR "MAPS: $::simple_map_ref $::simple_map_pre_ref $::simple_map_texi_ref $::style_map_ref $::style_map_pre_ref $::style_map_texi_ref $::things_map_ref $::pre_map_ref $::texi_map_ref\n";
! 29725:
! 29726: # delete from hash if we are using the new interface
! 29727: foreach my $code (keys(%code_style_map))
! 29728: {
! 29729: delete ($code_style_map{$code})
! 29730: if (ref($::style_map_ref->{$code}) eq 'HASH');
! 29731: }
! 29732:
! 29733: # no paragraph in these commands
! 29734: my %no_paragraph_macro = (
! 29735: 'xref' => 1,
! 29736: 'ref' => 1,
! 29737: 'pxref' => 1,
! 29738: 'inforef' => 1,
! 29739: 'anchor' => 1,
! 29740: );
! 29741:
! 29742:
! 29743: #
! 29744: # texinfo section names to level
! 29745: #
! 29746: my %reference_sec2level = (
! 29747: 'top', 0,
! 29748: 'chapter', 1,
! 29749: 'unnumbered', 1,
! 29750: 'chapheading', 1,
! 29751: 'appendix', 1,
! 29752: 'section', 2,
! 29753: 'unnumberedsec', 2,
! 29754: 'heading', 2,
! 29755: 'appendixsec', 2,
! 29756: 'subsection', 3,
! 29757: 'unnumberedsubsec', 3,
! 29758: 'subheading', 3,
! 29759: 'appendixsubsec', 3,
! 29760: 'subsubsection', 4,
! 29761: 'unnumberedsubsubsec', 4,
! 29762: 'subsubheading', 4,
! 29763: 'appendixsubsubsec', 4,
! 29764: );
! 29765:
! 29766: # the reverse mapping. There is an entry for each sectioning command.
! 29767: # The value is a ref on an array containing at each index the corresponding
! 29768: # sectioning command name.
! 29769: my %level2sec;
! 29770: {
! 29771: my $sections = [ ];
! 29772: my $appendices = [ ];
! 29773: my $unnumbered = [ ];
! 29774: my $headings = [ ];
! 29775: foreach my $command (keys (%reference_sec2level))
! 29776: {
! 29777: if ($command =~ /^appendix/)
! 29778: {
! 29779: $level2sec{$command} = $appendices;
! 29780: }
! 29781: elsif ($command =~ /^unnumbered/ or $command eq 'top')
! 29782: {
! 29783: $level2sec{$command} = $unnumbered;
! 29784: }
! 29785: elsif ($command =~ /section$/ or $command eq 'chapter')
! 29786: {
! 29787: $level2sec{$command} = $sections;
! 29788: }
! 29789: else
! 29790: {
! 29791: $level2sec{$command} = $headings;
! 29792: }
! 29793: $level2sec{$command}->[$reference_sec2level{$command}] = $command;
! 29794: }
! 29795: }
! 29796:
! 29797: # out of the main hierarchy
! 29798: $reference_sec2level{'part'} = 0;
! 29799: # this are synonyms
! 29800: $reference_sec2level{'appendixsection'} = 2;
! 29801: # sec2level{'majorheading'} is also 1 and not 0
! 29802: $reference_sec2level{'majorheading'} = 1;
! 29803: $reference_sec2level{'chapheading'} = 1;
! 29804: $reference_sec2level{'centerchap'} = 1;
! 29805:
! 29806: sub stop_paragraph_command($)
! 29807: {
! 29808: my $command = shift;
! 29809: return 1 if ($Texi2HTML::Config::stop_paragraph_command{$command} or defined($reference_sec2level{$command}));
! 29810: }
! 29811:
! 29812: sub set_no_line_macro($$)
! 29813: {
! 29814: my $macro = shift;
! 29815: my $value = shift;
! 29816: $Texi2HTML::Config::no_paragraph_commands{$macro} = $value
! 29817: unless defined($Texi2HTML::Config::no_paragraph_commands{$macro});
! 29818: }
! 29819:
! 29820: # those macros aren't considered as beginning a paragraph
! 29821: foreach my $no_line_macro ('alias', 'macro', 'unmacro', 'rmacro',
! 29822: 'titlefont', 'include', 'copying', 'end copying', 'tab', 'item',
! 29823: 'itemx', '*', 'float', 'end float', 'caption', 'shortcaption', 'cindex',
! 29824: 'image')
! 29825: {
! 29826: set_no_line_macro($no_line_macro, 1);
! 29827: }
! 29828:
! 29829: foreach my $key (keys(%Texi2HTML::Config::misc_command), keys(%reference_sec2level))
! 29830: {
! 29831: set_no_line_macro($key, 1);
! 29832: }
! 29833:
! 29834: # a hash associating a format @thing / @end thing with the type of the format
! 29835: # 'complex_format' 'simple_format' 'deff' 'list' 'menu' 'paragraph_format'
! 29836: my %format_type = ();
! 29837:
! 29838: foreach my $simple_format (keys(%Texi2HTML::Config::format_map))
! 29839: {
! 29840: $format_type{$simple_format} = 'simple_format';
! 29841: }
! 29842: foreach my $paragraph_style (keys(%Texi2HTML::Config::paragraph_style))
! 29843: {
! 29844: $format_type{$paragraph_style} = 'paragraph_format';
! 29845: }
! 29846: # FIXME $complex_format_map obsoleted in nov 2009
! 29847: foreach my $complex_format (keys(%$Texi2HTML::Config::complex_format_map),
! 29848: keys(%Texi2HTML::Config::complex_format_map))
! 29849: {
! 29850: $format_type{$complex_format} = 'complex_format';
! 29851: }
! 29852: foreach my $table (('table', 'ftable', 'vtable'))
! 29853: {
! 29854: $format_type{$table} = 'table';
! 29855: }
! 29856: $format_type{'multitable'} = 'multitable';
! 29857: foreach my $def_format (keys(%Texi2HTML::Config::def_map))
! 29858: {
! 29859: $format_type{$def_format} = 'deff';
! 29860: }
! 29861: $format_type{'itemize'} = 'list';
! 29862: $format_type{'enumerate'} = 'list';
! 29863:
! 29864: $format_type{'menu'} = 'menu';
! 29865: $format_type{'detailmenu'} = 'menu';
! 29866: $format_type{'direntry'} = 'menu';
! 29867:
! 29868: $format_type{'cartouche'} = 'cartouche';
! 29869:
! 29870: $format_type{'float'} = 'float';
! 29871:
! 29872: $format_type{'quotation'} = 'quotation';
! 29873: $format_type{'smallquotation'} = 'quotation';
! 29874:
! 29875: $format_type{'group'} = 'group';
! 29876:
! 29877: my @special_regions = ('titlepage', 'copying', 'documentdescription');
! 29878: foreach my $region (@special_regions)
! 29879: {
! 29880: $format_type{$region} = 'region';
! 29881: }
! 29882:
! 29883: foreach my $key (keys(%format_type))
! 29884: {
! 29885: set_no_line_macro($key, 1);
! 29886: set_no_line_macro("end $key", 1);
! 29887: }
! 29888:
! 29889: foreach my $macro (keys(%Texi2HTML::Config::format_in_paragraph))
! 29890: {
! 29891: set_no_line_macro($macro, 1);
! 29892: set_no_line_macro("end $macro", 1);
! 29893: }
! 29894:
! 29895: # fake format at the bottom of the stack
! 29896: $format_type{'noformat'} = '';
! 29897:
! 29898: # fake formats are formats used internally within other formats
! 29899: # we associate them with a real format, for the error messages
! 29900: my %fake_format = (
! 29901: 'line' => 'table',
! 29902: 'term' => 'table',
! 29903: 'item' => 'list or table',
! 29904: 'row' => 'multitable row',
! 29905: 'cell' => 'multitable cell',
! 29906: 'deff_item' => 'definition command',
! 29907: 'menu_comment' => 'menu',
! 29908: 'menu_description' => 'menu',
! 29909: );
! 29910:
! 29911: foreach my $key (keys(%fake_format))
! 29912: {
! 29913: $format_type{$key} = 'fake';
! 29914: }
! 29915:
! 29916: # raw formats which are expanded especially
! 29917: my @raw_regions = ('html', 'tex', 'xml', 'docbook');
! 29918: foreach my $format (keys(%Texi2HTML::Config::texi_formats_map))
! 29919: {
! 29920: push @raw_regions, $format if ($Texi2HTML::Config::texi_formats_map{$format} eq 'raw');
! 29921: }
! 29922:
! 29923: # The css formats are associated with complex format commands, and associated
! 29924: # with the 'pre_style' key
! 29925: # FIXME $complex_format_map obsoleted in nov 2009
! 29926: foreach my $complex_format (keys(%$Texi2HTML::Config::complex_format_map))
! 29927: {
! 29928: next if (defined($Texi2HTML::Config::complex_format_map->{$complex_format}->{'pre_style'}));
! 29929: $Texi2HTML::Config::complex_format_map->{$complex_format}->{'pre_style'} = '';
! 29930: $Texi2HTML::Config::complex_format_map->{$complex_format}->{'pre_style'} = $Texi2HTML::Config::css_map{"pre.$complex_format"} if (exists($Texi2HTML::Config::css_map{"pre.$complex_format"}));
! 29931: }
! 29932:
! 29933: # The css formats are associated with complex format commands, and associated
! 29934: # with the 'pre_style' key
! 29935: foreach my $complex_format (keys(%Texi2HTML::Config::complex_format_map))
! 29936: {
! 29937: next if (defined($Texi2HTML::Config::complex_format_map{$complex_format}->{'pre_style'}));
! 29938: $Texi2HTML::Config::complex_format_map{$complex_format}->{'pre_style'} = '';
! 29939: $Texi2HTML::Config::complex_format_map{$complex_format}->{'pre_style'} = $Texi2HTML::Config::css_map{"pre.$complex_format"} if (exists($Texi2HTML::Config::css_map{"pre.$complex_format"}));
! 29940: }
! 29941:
! 29942:
! 29943:
! 29944: #+++############################################################################
! 29945: # #
! 29946: # Argument parsing, initialisation #
! 29947: # #
! 29948: #---############################################################################
! 29949:
! 29950: # shorthand for Texi2HTML::Config::VERBOSE
! 29951: my $T2H_VERBOSE;
! 29952: my $T2H_DEBUG;
! 29953:
! 29954: sub line_warn($$);
! 29955: sub document_warn($);
! 29956: sub file_line_warn($$;$);
! 29957: sub cmdline_warn ($);
! 29958:
! 29959: my $T2H_FAILURE_TEXT = sprintf(__("Try `%s --help' for more information.\n"), $real_command_name);
! 29960:
! 29961: #print STDERR "" . gdt('test i18n: \' , \a \\ %% %{unknown}a %known % %{known} \\', { 'known' => 'a known string', 'no' => 'nope'}); exit 0;
! 29962:
! 29963: # file: file name to locate. It can be a file path.
! 29964: # all_files: if true collect all the files with that name, otherwise stop
! 29965: # at first match.
! 29966: # directories: a reference on a array containing a list of directories to
! 29967: # search the file in. default is
! 29968: # @Texi2HTML::Config::CONF_DIRS, @program_config_dirs.
! 29969: sub locate_init_file($;$$)
! 29970: {
! 29971: my $file = shift;
! 29972: my $all_files = shift;
! 29973: my $directories = shift;
! 29974:
! 29975: if (!defined($directories))
! 29976: {
! 29977: if ($all_files)
! 29978: {
! 29979: $directories = [ @program_config_dirs ];
! 29980: }
! 29981: else
! 29982: {
! 29983: $directories = [ @Texi2HTML::Config::CONF_DIRS, @program_init_dirs ];
! 29984: }
! 29985: }
! 29986:
! 29987: if ($file =~ /^\//)
! 29988: {
! 29989: return $file if (-e $file and -r $file);
! 29990: }
! 29991: else
! 29992: {
! 29993: my @files;
! 29994: foreach my $dir (@$directories)
! 29995: {
! 29996: next unless (-d "$dir");
! 29997: if ($all_files)
! 29998: {
! 29999: push (@files, "$dir/$file") if (-e "$dir/$file" and -r "$dir/$file");
! 30000: }
! 30001: else
! 30002: {
! 30003: return "$dir/$file" if (-e "$dir/$file" and -r "$dir/$file");
! 30004: }
! 30005: }
! 30006: return @files if ($all_files);
! 30007: }
! 30008: return undef;
! 30009: }
! 30010:
! 30011: # called on -init-file
! 30012: sub load_init_file
! 30013: {
! 30014: # First argument is option
! 30015: shift;
! 30016: # second argument is value of options
! 30017: my $init_file = shift;
! 30018: my $file;
! 30019: if ($file = locate_init_file($init_file))
! 30020: {
! 30021: print STDERR "# reading initialization file from $file\n"
! 30022: if ($T2H_VERBOSE);
! 30023: # require the file in the Texi2HTML::Config namespace
! 30024: return (Texi2HTML::Config::load($file));
! 30025: }
! 30026: else
! 30027: {
! 30028: document_error ("Can't read init file $init_file");
! 30029: return 0;
! 30030: }
! 30031: }
! 30032:
! 30033: sub set_date($)
! 30034: {
! 30035: my $language = shift;
! 30036: if (!$Texi2HTML::Config::TEST)
! 30037: {
! 30038: print STDERR "# Setting date in $language\n" if ($T2H_DEBUG);
! 30039: $Texi2HTML::THISDOC{'today'} = Texi2HTML::I18n::pretty_date($language); # like "20 September 1993";
! 30040: }
! 30041: else
! 30042: {
! 30043: $Texi2HTML::THISDOC{'today'} = 'a sunny day';
! 30044: }
! 30045: $Texi2HTML::THISDOC{'today'} = $Texi2HTML::Config::DATE
! 30046: if (defined($Texi2HTML::Config::DATE));
! 30047: $::things_map_ref->{'today'} = $Texi2HTML::THISDOC{'today'};
! 30048: $::pre_map_ref->{'today'} = $Texi2HTML::THISDOC{'today'};
! 30049: $::texi_map_ref->{'today'} = $Texi2HTML::THISDOC{'today'};
! 30050: }
! 30051:
! 30052: sub warn_unknown_language($;$)
! 30053: {
! 30054: my $lang = shift;
! 30055: my $line_nr = shift;
! 30056:
! 30057: my $lang_code = $lang;
! 30058: my $region_code;
! 30059:
! 30060: if ($lang =~ /^([a-z]+)_([A-Z]+)/)
! 30061: {
! 30062: $lang_code = $1;
! 30063: $region_code = $2;
! 30064: }
! 30065:
! 30066: if (! $Texi2HTML::Config::language_codes{$lang_code})
! 30067: {
! 30068: msg_warn(sprintf(__("%s is not a valid language code"), $lang_code), $line_nr);
! 30069: }
! 30070: if (defined($region_code) and ! $Texi2HTML::Config::region_codes{$region_code})
! 30071: {
! 30072: msg_warn(sprintf(__("%s is not a valid region code"), $region_code), $line_nr);
! 30073: }
! 30074: }
! 30075:
! 30076: # Called on --document-language, at the beginning of each pass and
! 30077: # when a @documentlanguage appears
! 30078: sub set_document_language ($$;$)
! 30079: {
! 30080: my $lang = shift;
! 30081: my $silent = shift;
! 30082: my $line_nr = shift;
! 30083:
! 30084: my @langs = ($lang);
! 30085:
! 30086: # my $lang_code = $lang;
! 30087: # my $region_code;
! 30088:
! 30089: my $main_lang;
! 30090:
! 30091: if ($lang =~ /^([a-z]+)_([A-Z]+)/)
! 30092: {
! 30093: $main_lang = $1;
! 30094: # $region_code = $2;
! 30095: # $lang_code = $main_lang;
! 30096: push @langs, $main_lang;
! 30097: }
! 30098:
! 30099: # if (!$silent)
! 30100: # {
! 30101: # if (! $Texi2HTML::Config::language_codes{$lang_code})
! 30102: # { # i18n
! 30103: # msg_warn("$lang_code is not a valid language code.", $line_nr);
! 30104: # }
! 30105: # if (defined($region_code) and ! $Texi2HTML::Config::region_codes{$region_code})
! 30106: # { # i18n
! 30107: # msg_warn("$region_code is not a valid region code.", $line_nr);
! 30108: # }
! 30109: # }
! 30110: # Always succeed if using a gettext-like environment
! 30111: if (!$Texi2HTML::Config::I18N_PERL_HASH)
! 30112: {
! 30113: set_date($lang);
! 30114: return 1;
! 30115: }
! 30116:
! 30117: my @files = locate_init_file("$i18n_dir/$lang.thl", 1);
! 30118: if (! scalar(@files) and defined($main_lang))
! 30119: {
! 30120: @files = locate_init_file("$i18n_dir/$main_lang.thl", 1);
! 30121: }
! 30122:
! 30123: foreach my $file (@files)
! 30124: {
! 30125: Texi2HTML::Config::load($file);
! 30126: }
! 30127: foreach my $language (@langs)
! 30128: {
! 30129: if (Texi2HTML::I18n::set_language($language))
! 30130: {
! 30131: print STDERR "# using '$language' as document language\n" if ($T2H_VERBOSE);
! 30132: # since it may be different from get_conf('documentlanguage'),
! 30133: # we record it.
! 30134: # Currently this is not used anywhere, not sure what the value
! 30135: # really corresponds with.
! 30136: $Texi2HTML::THISDOC{'current_language'} = $language;
! 30137: set_date($language);
! 30138: return 1;
! 30139: }
! 30140: }
! 30141: return 0;
! 30142: }
! 30143:
! 30144:
! 30145: # manage footnote style
! 30146: sub set_footnote_style($$;$)
! 30147: {
! 30148: my $value = shift;
! 30149: my $from_command_line = shift;
! 30150: my $line_nr = shift;
! 30151: my $command = 'footnotestyle';
! 30152: if ($value eq 'end' or $value eq 'separate')
! 30153: {
! 30154: Texi2HTML::Config::set_conf($command, $value, !$from_command_line);
! 30155: }
! 30156: elsif ($from_command_line)
! 30157: {
! 30158: die sprintf(__("%s: --footnote-style arg must be `separate' or `end', not `%s'.\n"), $real_command_name, $value);
! 30159: # the T2H_FAILURE_TEXT is output by getOption, seems to catch die
! 30160: }
! 30161: else
! 30162: {
! 30163: line_error (sprintf(__("\@%s arg must be `separate' or `end', not `%s'"), $command, $value), $line_nr);
! 30164: }
! 30165: }
! 30166:
! 30167:
! 30168: # find the encoding alias.
! 30169: # with encoding support (USE_UNICODE), may return undef if no alias was found
! 30170: sub encoding_alias($;$$)
! 30171: {
! 30172: my $encoding = shift;
! 30173: my $line_nr = shift;
! 30174: my $context_string = shift;
! 30175: return undef if (!defined($encoding) or $encoding eq '');
! 30176: if ($Texi2HTML::Config::USE_UNICODE)
! 30177: {
! 30178: my $result_encoding = Encode::resolve_alias($encoding);
! 30179: if (! $result_encoding)
! 30180: {
! 30181: msg_warn(sprintf(__("unrecognized encoding name `%s'"), $encoding), $line_nr, $context_string);
! 30182: return undef;
! 30183: }
! 30184: if (defined($Texi2HTML::Config::t2h_encoding_aliases{$result_encoding}))
! 30185: {
! 30186: $result_encoding = $Texi2HTML::Config::t2h_encoding_aliases{$result_encoding};
! 30187: }
! 30188: print STDERR "# Using encoding $result_encoding\n" if ($T2H_VERBOSE);
! 30189: return $result_encoding;
! 30190: }
! 30191: else
! 30192: {
! 30193: if (exists($Texi2HTML::Config::t2h_encoding_aliases{$encoding}))
! 30194: {
! 30195: $encoding = $Texi2HTML::Config::t2h_encoding_aliases{$encoding};
! 30196: document_warn (__("Document encoding is utf8, but there is no unicode support")) if ($encoding eq 'utf-8');
! 30197: return $encoding;
! 30198: }
! 30199: msg_warn(sprintf(__("Encoding %s certainly poorly supported"), $encoding), $line_nr);
! 30200: return $encoding;
! 30201: }
! 30202: }
! 30203:
! 30204: # libintl converts between encodings but doesn't decode them into the
! 30205: # perl internal format.
! 30206: sub encode_i18n_string($$)
! 30207: {
! 30208: my $string = shift;
! 30209: my $encoding = shift;
! 30210: if ($encoding ne 'us-ascii' and $Texi2HTML::Config::USE_UNICODE
! 30211: and Encode::resolve_alias($encoding))
! 30212: {
! 30213: return Encode::decode($encoding, $string);
! 30214: }
! 30215: return $string;
! 30216: }
! 30217:
! 30218: sub gdt($;$$)
! 30219: {
! 30220: my $message = shift;
! 30221: my $context = shift;
! 30222: my $state = shift;
! 30223:
! 30224: # FIXME this should be done only once, for @documentencoding
! 30225: my $encoding = lc(Texi2HTML::Config::get_conf('DOCUMENT_ENCODING'));
! 30226: if (defined($encoding) and $encoding ne '' and exists($Texi2HTML::Config::t2h_encoding_aliases{$encoding}))
! 30227: {
! 30228: $encoding = $Texi2HTML::Config::t2h_encoding_aliases{$encoding};
! 30229: }
! 30230: $encoding = 'us-ascii' if (!defined($encoding) or $encoding eq '');
! 30231:
! 30232: return &$I($message, $context, $state) if ($Texi2HTML::Config::I18N_PERL_HASH);
! 30233: # if set, use substitute_text instead of substitute_line
! 30234: my $allow_paragraph = $state->{'allow_paragraph'};
! 30235: # if duplicate is passed, it means that we are in the text and so should
! 30236: # use the main state
! 30237: if (defined($state) and $state->{'duplicate'} and defined($Texi2HTML::THISDOC{'state'}))
! 30238: {
! 30239: $state = main::duplicate_formatting_state($Texi2HTML::THISDOC{'state'});
! 30240: }
! 30241:
! 30242: my $result;
! 30243: # taken from libintl perl, copyright Guido. sub __expand. Overall not
! 30244: # enough code taken form Guido right now to be copyrightable.
! 30245: my $re = join '|', map { quotemeta $_ } keys %$context if (defined($context) and ref($context));
! 30246:
! 30247: if (Texi2HTML::Config::get_conf('use_nls'))
! 30248: {
! 30249: my $saved_LANGUAGE = $ENV{'LANGUAGE'};
! 30250:
! 30251: Locale::Messages::textdomain($strings_textdomain);
! 30252:
! 30253:
! 30254: Locale::Messages::bind_textdomain_codeset($strings_textdomain, $encoding) if ($encoding ne 'us-ascii');
! 30255: Locale::Messages::bind_textdomain_filter($strings_textdomain, \&encode_i18n_string, $encoding);
! 30256:
! 30257: my $lang = Texi2HTML::Config::get_conf('documentlanguage');
! 30258: my @langs = ($lang);
! 30259: if ($lang =~ /^([a-z]+)_([A-Z]+)/)
! 30260: {
! 30261: my $main_lang = $1;
! 30262: my $region_code = $2;
! 30263: push @langs, $main_lang;
! 30264: }
! 30265:
! 30266: my $locales = '';
! 30267: foreach my $language (@langs)
! 30268: {
! 30269: $locales .= "$language.$encoding:";
! 30270: #$locales .= "$language:";
! 30271: # always try us-ascii, the charset should always be a subset of
! 30272: # all charset, and should resort to @-commands if needed for non
! 30273: # ascii characters
! 30274: if ($encoding ne 'us-ascii')
! 30275: {
! 30276: $locales .= "$language.us-ascii:";
! 30277: }
! 30278: }
! 30279: $locales =~ s/:$//;
! 30280: #print STDERR "$locales\n";
! 30281: Locale::Messages::nl_putenv("LANGUAGE=$locales");
! 30282:
! 30283: if (!defined($context) or ref($context))
! 30284: {
! 30285: $result = Locale::Messages::gettext($message);
! 30286: }
! 30287: else
! 30288: {
! 30289: $result = Locale::Messages::pgettext($context, $message);
! 30290: }
! 30291: Locale::Messages::textdomain($messages_textdomain);
! 30292: # old perl complains 'Use of uninitialized value in scalar assignment'
! 30293: if (!defined($saved_LANGUAGE))
! 30294: {
! 30295: delete ($ENV{'LANGUAGE'});
! 30296: }
! 30297: else
! 30298: {
! 30299: $ENV{'LANGUAGE'} = $saved_LANGUAGE;
! 30300: }
! 30301: }
! 30302:
! 30303: # now perform the argument substitutions
! 30304: if ($state->{'keep_texi'})
! 30305: {
! 30306: # next line taken from libintl perl, copyright Guido. sub __expand
! 30307: $result =~ s/\{($re)\}/defined $context->{$1} ? $context->{$1} : "{$1}"/ge if (defined($re));
! 30308: return $result;
! 30309: }
! 30310: if (defined($re))
! 30311: {
! 30312: # next line taken from libintl perl, copyright Guido. sub __expand
! 30313: $result =~ s/\{($re)\}/\@internal_translation_open_brace\{\}$1\@internal_translation_close_brace\{\}/g;
! 30314: foreach my $map (\%Texi2HTML::Config::things_map, \%Texi2HTML::Config::pre_map, \%Texi2HTML::Config::texi_map, \%Texi2HTML::Config::simple_format_texi_map)
! 30315: {
! 30316: $map->{'internal_translation_open_brace'} = '{';
! 30317: $map->{'internal_translation_close_brace'} = '}';
! 30318: }
! 30319: }
! 30320: if ($allow_paragraph)
! 30321: {
! 30322: delete $state->{'allow_paragraph'};
! 30323: $result = substitute_text ($state, undef, __("translation"), ($result));
! 30324: }
! 30325: else
! 30326: {
! 30327: $result = substitute_line ($result, __("translation"), $state);
! 30328: }
! 30329: if (defined($re))
! 30330: {
! 30331: $result =~ s/\{($re)\}/defined $context->{$1} ? $context->{$1} : "{$1}"/ge;
! 30332: foreach my $map (\%Texi2HTML::Config::things_map, \%Texi2HTML::Config::pre_map, \%Texi2HTML::Config::texi_map, \%Texi2HTML::Config::simple_format_texi_map)
! 30333: {
! 30334: delete $map->{'internal_translation_open_brace'};
! 30335: delete $map->{'internal_translation_close_brace'};
! 30336: }
! 30337: }
! 30338: return $result;
! 30339: }
! 30340:
! 30341: my %nodes; # nodes hash. The key is the texi node name
! 30342: my %cross_reference_nodes; # normalized node names arrays
! 30343:
! 30344: #
! 30345: # %value hold texinfo variables, see also -D, -U, @set and @clear.
! 30346: # we predefine html (the output format) and texi2html (the translator)
! 30347: # it is initialized with %value_initial at the beginning of the
! 30348: # document parsing and filled and emptied as @set and @clear are
! 30349: # encountered
! 30350: my %value_initial =
! 30351: (
! 30352: 'html' => 1,
! 30353: 'texi2html' => $THISVERSION,
! 30354: );
! 30355:
! 30356: #
! 30357: # _foo: internal variables to track @foo
! 30358: #
! 30359: foreach my $key ('_author', '_title', '_subtitle', '_shorttitlepage',
! 30360: '_settitle', '_titlefont')
! 30361: {
! 30362: $value_initial{$key} = ''; # prevent -w warnings
! 30363: }
! 30364:
! 30365:
! 30366: sub unicode_to_protected($)
! 30367: {
! 30368: my $text = shift;
! 30369: my $result = '';
! 30370: while ($text ne '')
! 30371: {
! 30372: if ($text =~ s/^([A-Za-z0-9]+)//o)
! 30373: {
! 30374: $result .= $1;
! 30375: }
! 30376: elsif ($text =~ s/^ //o)
! 30377: {
! 30378: $result .= '-';
! 30379: }
! 30380: elsif ($text =~ s/^(.)//o)
! 30381: {
! 30382: my $char = $1;
! 30383: if (exists($Texi2HTML::Config::ascii_character_map{$char}))
! 30384: {
! 30385: $result .= '_' . lc($Texi2HTML::Config::ascii_character_map{$char});
! 30386: }
! 30387: else
! 30388: {
! 30389: if (ord($char) <= hex(0xFFFF))
! 30390: {
! 30391: $result .= '_' . lc(sprintf("%04x",ord($char)));
! 30392: }
! 30393: else
! 30394: {
! 30395: $result .= '__' . lc(sprintf("%06x",ord($char)));
! 30396: }
! 30397: }
! 30398: }
! 30399: else
! 30400: {
! 30401: print STDERR "Bug: unknown character in a cross ref (likely in infinite loop)\n";
! 30402: print STDERR "Text: !!$text!!\n";
! 30403: sleep 1;
! 30404: }
! 30405: }
! 30406: return $result;
! 30407: }
! 30408:
! 30409: sub unicode_to_transliterate($)
! 30410: {
! 30411: my $text = shift;
! 30412: if (chomp($text))
! 30413: {
! 30414: print STDERR "Strange: end of line to transliterate: $text\n";
! 30415: }
! 30416: my $result = '';
! 30417: while ($text ne '')
! 30418: {
! 30419: if ($text =~ s/^([A-Za-z0-9 ]+)//o)
! 30420: {
! 30421: $result .= $1;
! 30422: }
! 30423: elsif ($text =~ s/^(.)//o)
! 30424: {
! 30425: my $char = $1;
! 30426: if (exists($Texi2HTML::Config::ascii_character_map{$char}))
! 30427: {
! 30428: $result .= $char;
! 30429: }
! 30430: elsif (ord($char) <= hex(0xFFFF) and exists($Texi2HTML::Config::transliterate_map{uc(sprintf("%04x",ord($char)))}))
! 30431: {
! 30432: $result .= $Texi2HTML::Config::transliterate_map{uc(sprintf("%04x",ord($char)))};
! 30433: }
! 30434: elsif (ord($char) <= hex(0xFFFF) and exists($Texi2HTML::Config::unicode_diacritical{uc(sprintf("%04x",ord($char)))}))
! 30435: {
! 30436: $result .= '';
! 30437: }
! 30438: # in this case, we want to avoid calling unidecode, as we are sure
! 30439: # that there is no useful transliteration of the unicode character
! 30440: # instead we want to keep it as is.
! 30441: # This is the case, for example, for @exclamdown, is corresponds
! 30442: # with x00a1, but unidecode transliterates it to a !, we want
! 30443: # to avoid that and keep x00a1.
! 30444: elsif (ord($char) <= hex(0xFFFF) and exists($Texi2HTML::Config::no_transliterate_map{uc(sprintf("%04x",ord($char)))}))
! 30445: {
! 30446: $result .= $char;
! 30447: }
! 30448: else
! 30449: {
! 30450: if ($Texi2HTML::Config::USE_UNIDECODE)
! 30451: {
! 30452: $result .= unidecode($char);
! 30453: }
! 30454: else
! 30455: {
! 30456: $result .= $char;
! 30457: }
! 30458: }
! 30459: }
! 30460: else
! 30461: {
! 30462: print STDERR "Bug: unknown character in cross ref transliteration (likely in infinite loop)\n";
! 30463: print STDERR "Text: !!$text!!\n";
! 30464: sleep 1;
! 30465: }
! 30466: }
! 30467: return $result;
! 30468: }
! 30469:
! 30470: # used both for command line and @-command argument checking
! 30471: sub set_paragraphindent($$;$$)
! 30472: {
! 30473: my $value = shift;
! 30474: my $from_command_line = shift;
! 30475: my $line_nr = shift;
! 30476: my $pass = shift;
! 30477: my $command = 'paragraphindent';
! 30478:
! 30479: if ($value =~ /^([0-9]+)$/ or $value eq 'none' or $value eq 'asis')
! 30480: {
! 30481: Texi2HTML::Config::set_conf($command, $value, !$from_command_line);
! 30482: }
! 30483: elsif ($from_command_line)
! 30484: {
! 30485: die sprintf(__("%s: --paragraph-indent arg must be numeric/`none'/`asis', not `%s'.\n"), $real_command_name, $value);
! 30486: }
! 30487: elsif ($pass == 1)
! 30488: {
! 30489: line_error (sprintf(__("\@paragraphindent arg must be numeric/`none'/`asis', not `%s'"), $value), $line_nr);
! 30490: }
! 30491: }
! 30492:
! 30493: # T2H_OPTIONS is a hash whose keys are the (long) names of valid
! 30494: # command-line options and whose values are a hash with the following keys:
! 30495: # type ==> one of !|=i|:i|=s|:s (see Getopt::Long for more info)
! 30496: # linkage ==> ref to scalar, array, or subroutine (see Getopt::Long for more info)
! 30497: # verbose ==> short description of option (displayed by -h)
! 30498: # noHelp ==> if 1 -> for "not so important options": only print description on -h 1
! 30499: # 2 -> for obsolete options: only print description on -h 2
! 30500: my $T2H_OPTIONS;
! 30501: $T2H_OPTIONS -> {'debug'} =
! 30502: {
! 30503: type => '=i',
! 30504: linkage => \$Texi2HTML::Config::DEBUG,
! 30505: verbose => 'output HTML with debuging information',
! 30506: };
! 30507:
! 30508: $T2H_OPTIONS -> {'doctype'} =
! 30509: {
! 30510: type => '=s',
! 30511: linkage => sub {Texi2HTML::Config::set_conf('doctype', $_[1]);},
! 30512: verbose => 'document type which is output in header of HTML files',
! 30513: noHelp => 1
! 30514: };
! 30515:
! 30516: $T2H_OPTIONS -> {'frameset-doctype'} =
! 30517: {
! 30518: type => '=s',
! 30519: linkage => \$Texi2HTML::Config::FRAMESET_DOCTYPE,
! 30520: verbose => 'document type for HTML frameset documents',
! 30521: noHelp => 1
! 30522: };
! 30523:
! 30524: $T2H_OPTIONS -> {'test'} =
! 30525: {
! 30526: type => '!',
! 30527: linkage => \$Texi2HTML::Config::TEST,
! 30528: verbose => 'use predefined information to avoid differences with reference files',
! 30529: noHelp => 1
! 30530: };
! 30531:
! 30532: $T2H_OPTIONS -> {'dump-texi'} =
! 30533: {
! 30534: type => '!',
! 30535: linkage => \$Texi2HTML::Config::DUMP_TEXI,
! 30536: verbose => 'dump the output of first pass into a file with extension passfirst and exit',
! 30537: noHelp => 1
! 30538: };
! 30539:
! 30540: $T2H_OPTIONS -> {'macro-expand|E'} =
! 30541: {
! 30542: type => '=s',
! 30543: linkage => \$Texi2HTML::Config::MACRO_EXPAND,
! 30544: verbose => 'output macro expanded source in <file>',
! 30545: };
! 30546:
! 30547: $T2H_OPTIONS -> {'ifhtml'} =
! 30548: {
! 30549: type => '!',
! 30550: linkage => sub { Texi2HTML::Config::set_expansion('html', $_[1]); },
! 30551: verbose => "expand ifhtml and html sections",
! 30552: };
! 30553:
! 30554: $T2H_OPTIONS -> {'ifinfo'} =
! 30555: {
! 30556: type => '!',
! 30557: linkage => sub { Texi2HTML::Config::set_expansion('info', $_[1]); },
! 30558: verbose => "expand ifinfo",
! 30559: };
! 30560:
! 30561: $T2H_OPTIONS -> {'ifxml'} =
! 30562: {
! 30563: type => '!',
! 30564: linkage => sub { Texi2HTML::Config::set_expansion('xml', $_[1]); },
! 30565: verbose => "expand ifxml and xml sections",
! 30566: };
! 30567:
! 30568: $T2H_OPTIONS -> {'ifdocbook'} =
! 30569: {
! 30570: type => '!',
! 30571: linkage => sub { Texi2HTML::Config::set_expansion('docbook', $_[1]); },
! 30572: verbose => "expand ifdocbook and docbook sections",
! 30573: };
! 30574:
! 30575: $T2H_OPTIONS -> {'iftex'} =
! 30576: {
! 30577: type => '!',
! 30578: linkage => sub { Texi2HTML::Config::set_expansion('tex', $_[1]); },
! 30579: verbose => "expand iftex and tex sections",
! 30580: };
! 30581:
! 30582: $T2H_OPTIONS -> {'ifplaintext'} =
! 30583: {
! 30584: type => '!',
! 30585: linkage => sub { Texi2HTML::Config::set_expansion('plaintext', $_[1]); },
! 30586: verbose => "expand ifplaintext sections",
! 30587: };
! 30588:
! 30589: $T2H_OPTIONS -> {'iso'} =
! 30590: {
! 30591: type => 'iso',
! 30592: linkage => sub {Texi2HTML::Config::t2h_default_set_iso_symbols ($_[1]);},
! 30593: verbose => 'if set, entities are used for special symbols (like copyright, etc...) and quotes',
! 30594: noHelp => 1,
! 30595: };
! 30596:
! 30597: $T2H_OPTIONS -> {'I'} =
! 30598: {
! 30599: type => '=s',
! 30600: linkage => \@Texi2HTML::Config::INCLUDE_DIRS,
! 30601: verbose => 'append $s to the @include search path',
! 30602: };
! 30603:
! 30604: $T2H_OPTIONS -> {'conf-dir'} =
! 30605: {
! 30606: type => '=s',
! 30607: linkage => \@Texi2HTML::Config::CONF_DIRS,
! 30608: verbose => 'append $s to the init file directories',
! 30609: };
! 30610:
! 30611: $T2H_OPTIONS -> {'P'} =
! 30612: {
! 30613: type => '=s',
! 30614: linkage => sub {unshift (@Texi2HTML::Config::PREPEND_DIRS, $_[1]);},
! 30615: verbose => 'prepend $s to the @include search path',
! 30616: };
! 30617:
! 30618: $T2H_OPTIONS -> {'top-file'} =
! 30619: {
! 30620: type => '=s',
! 30621: linkage => \$Texi2HTML::Config::TOP_FILE,
! 30622: verbose => 'use $s as top file, instead of <docname>.html',
! 30623: };
! 30624:
! 30625: $T2H_OPTIONS -> {'toc-file'} =
! 30626: {
! 30627: type => '=s',
! 30628: linkage => \$Texi2HTML::Config::TOC_FILE,
! 30629: verbose => 'use $s as ToC file, instead of <docname>_toc.html',
! 30630: };
! 30631:
! 30632: $T2H_OPTIONS -> {'frames'} =
! 30633: {
! 30634: type => '!',
! 30635: linkage => \$Texi2HTML::Config::FRAMES,
! 30636: verbose => 'output files which use HTML 4.0 frames (experimental)',
! 30637: noHelp => 1,
! 30638: };
! 30639:
! 30640: $T2H_OPTIONS -> {'menu'} =
! 30641: {
! 30642: type => '!',
! 30643: linkage => \$Texi2HTML::Config::SHOW_MENU,
! 30644: verbose => 'output Texinfo menus',
! 30645: };
! 30646:
! 30647: $T2H_OPTIONS -> {'number-sections'} =
! 30648: {
! 30649: type => '!',
! 30650: linkage => \$Texi2HTML::Config::NUMBER_SECTIONS,
! 30651: verbose => 'output chapter and sectioning numbers.',
! 30652: };
! 30653:
! 30654: $T2H_OPTIONS -> {'number-footnotes'} =
! 30655: {
! 30656: type => '!',
! 30657: linkage => \$Texi2HTML::Config::NUMBER_FOOTNOTES,
! 30658: verbose => 'output footnote numbers.',
! 30659: };
! 30660:
! 30661: $T2H_OPTIONS -> {'use-nodes'} =
! 30662: {
! 30663: type => '!',
! 30664: linkage => \$Texi2HTML::Config::USE_NODES,
! 30665: verbose => 'use nodes for sectioning',
! 30666: };
! 30667:
! 30668: $T2H_OPTIONS -> {'node-files'} =
! 30669: {
! 30670: type => '!',
! 30671: linkage => \$Texi2HTML::Config::NODE_FILES,
! 30672: verbose => 'produce one file per node for cross references'
! 30673: };
! 30674:
! 30675: $T2H_OPTIONS -> {'footnote-style|s'} =
! 30676: {
! 30677: type => '=s',
! 30678: linkage => sub {set_footnote_style ($_[1], 1);},
! 30679: verbose => 'output footnotes separate|end',
! 30680: };
! 30681:
! 30682: $T2H_OPTIONS -> {'toc-links'} =
! 30683: {
! 30684: type => '!',
! 30685: linkage => \$Texi2HTML::Config::TOC_LINKS,
! 30686: verbose => 'create links from headings to toc entries'
! 30687: };
! 30688:
! 30689: $T2H_OPTIONS -> {'split'} =
! 30690: {
! 30691: type => '=s',
! 30692: linkage => \$Texi2HTML::Config::SPLIT,
! 30693: verbose => 'split document on section|chapter|node else no splitting',
! 30694: };
! 30695:
! 30696: $T2H_OPTIONS -> {'no-split'} =
! 30697: {
! 30698: type => '!',
! 30699: linkage => sub {$Texi2HTML::Config::SPLIT = ''; $Texi2HTML::Config::SPLIT_SIZE = undef;},
! 30700: verbose => 'no splitting of document',
! 30701: noHelp => 1,
! 30702: };
! 30703:
! 30704: $T2H_OPTIONS -> {'headers'} =
! 30705: {
! 30706: type => '!',
! 30707: linkage => sub {
! 30708: Texi2HTML::Config::set_conf('headers', $_[1]);
! 30709: Texi2HTML::Config::t2h_default_load_format('plaintext', 1)
! 30710: if (!$_[1] and defined($Texi2HTML::Config::OUTPUT_FORMAT) and $Texi2HTML::Config::OUTPUT_FORMAT eq 'info');
! 30711: },
! 30712: verbose => 'output navigation headers for each section',
! 30713: };
! 30714:
! 30715: $T2H_OPTIONS -> {'subdir'} =
! 30716: {
! 30717: type => '=s',
! 30718: linkage => \$Texi2HTML::Config::SUBDIR,
! 30719: verbose => 'put files in directory $s, not $cwd',
! 30720: noHelp => 1,
! 30721: };
! 30722:
! 30723: $T2H_OPTIONS -> {'short-ext'} =
! 30724: {
! 30725: type => '!',
! 30726: linkage => \$Texi2HTML::Config::SHORTEXTN,
! 30727: verbose => 'use "htm" extension for output HTML files',
! 30728: };
! 30729:
! 30730: $T2H_OPTIONS -> {'prefix'} =
! 30731: {
! 30732: type => '=s',
! 30733: linkage => \$Texi2HTML::Config::PREFIX,
! 30734: verbose => 'use as prefix for output files, instead of <docname>',
! 30735: };
! 30736:
! 30737: $T2H_OPTIONS -> {'output|out|o'} =
! 30738: {
! 30739: type => '=s',
! 30740: linkage => \$Texi2HTML::Config::OUT,
! 30741: verbose => 'output goes to $s (directory if split)',
! 30742: };
! 30743:
! 30744: $T2H_OPTIONS -> {'no-validate|no-pointer-validate'} =
! 30745: {
! 30746: type => '',
! 30747: linkage => sub {Texi2HTML::Config::set_conf('novalidate',$_[1])},
! 30748: verbose => 'suppress node cross-reference validation',
! 30749: };
! 30750:
! 30751: $T2H_OPTIONS -> {'no-warn'} =
! 30752: {
! 30753: type => '',
! 30754: linkage => \$Texi2HTML::Config::NO_WARN,
! 30755: verbose => 'suppress warnings (but not errors).'
! 30756: };
! 30757:
! 30758: $T2H_OPTIONS -> {'short-ref'} =
! 30759: {
! 30760: type => '!',
! 30761: linkage => \$Texi2HTML::Config::SHORT_REF,
! 30762: verbose => 'if set, references are without section numbers',
! 30763: };
! 30764:
! 30765: $T2H_OPTIONS -> {'idx-sum'} =
! 30766: {
! 30767: type => '!',
! 30768: linkage => \$Texi2HTML::Config::IDX_SUMMARY,
! 30769: verbose => 'if set, also output index summary',
! 30770: noHelp => 1,
! 30771: };
! 30772:
! 30773: $T2H_OPTIONS -> {'def-table'} =
! 30774: {
! 30775: type => '!',
! 30776: linkage => \$Texi2HTML::Config::DEF_TABLE,
! 30777: verbose => 'if set, \@def.. are converted using tables.',
! 30778: noHelp => 1,
! 30779: };
! 30780:
! 30781: $T2H_OPTIONS -> {'verbose'} = 0;
! 30782: $T2H_OPTIONS -> {'verbose|v'} =
! 30783: {
! 30784: type => '!',
! 30785: linkage=> \$Texi2HTML::Config::VERBOSE,
! 30786: verbose => 'print progress info to stdout',
! 30787: };
! 30788:
! 30789: $T2H_OPTIONS -> {'document-language'} =
! 30790: {
! 30791: type => '=s',
! 30792: linkage => sub {
! 30793: warn_unknown_language ($_[1]);
! 30794: Texi2HTML::Config::set_conf('documentlanguage', $_[1])
! 30795: },
! 30796: verbose => 'use $s as document language',
! 30797: };
! 30798:
! 30799: $T2H_OPTIONS -> {'ignore-preamble-text'} =
! 30800: {
! 30801: type => '!',
! 30802: linkage => \$Texi2HTML::Config::IGNORE_PREAMBLE_TEXT,
! 30803: verbose => 'if set, ignore the text before @node and sectioning commands',
! 30804: noHelp => 1,
! 30805: };
! 30806:
! 30807: $T2H_OPTIONS -> {'html-xref-prefix'} =
! 30808: {
! 30809: type => '=s',
! 30810: linkage => \$Texi2HTML::Config::EXTERNAL_DIR,
! 30811: verbose => '$s is the base dir for external manual references',
! 30812: noHelp => 1,
! 30813: };
! 30814:
! 30815: $T2H_OPTIONS -> {'l2h'} =
! 30816: {
! 30817: type => '!',
! 30818: linkage => \$Texi2HTML::Config::L2H,
! 30819: verbose => 'if set, uses latex2html for @math and @tex',
! 30820: };
! 30821:
! 30822: $T2H_OPTIONS -> {'l2h-l2h'} =
! 30823: {
! 30824: type => '=s',
! 30825: linkage => \$Texi2HTML::Config::L2H_L2H,
! 30826: verbose => 'program to use for latex2html translation',
! 30827: noHelp => 1,
! 30828: };
! 30829:
! 30830: $T2H_OPTIONS -> {'l2h-skip'} =
! 30831: {
! 30832: type => '!',
! 30833: linkage => \$Texi2HTML::Config::L2H_SKIP,
! 30834: verbose => 'if set, tries to reuse previously latex2html output',
! 30835: noHelp => 1,
! 30836: };
! 30837:
! 30838: $T2H_OPTIONS -> {'l2h-tmp'} =
! 30839: {
! 30840: type => '=s',
! 30841: linkage => \$Texi2HTML::Config::L2H_TMP,
! 30842: verbose => 'if set, uses $s as temporary latex2html directory',
! 30843: noHelp => 1,
! 30844: };
! 30845:
! 30846: $T2H_OPTIONS -> {'l2h-file'} =
! 30847: {
! 30848: type => '=s',
! 30849: linkage => \$Texi2HTML::Config::L2H_FILE,
! 30850: verbose => 'if set, uses $s as latex2html init file',
! 30851: noHelp => 1,
! 30852: };
! 30853:
! 30854:
! 30855: $T2H_OPTIONS -> {'l2h-clean'} =
! 30856: {
! 30857: type => '!',
! 30858: linkage => \$Texi2HTML::Config::L2H_CLEAN,
! 30859: verbose => 'if set, do not keep intermediate latex2html files for later reuse',
! 30860: noHelp => 1,
! 30861: };
! 30862:
! 30863: $T2H_OPTIONS -> {'D'} =
! 30864: {
! 30865: type => '=s',
! 30866: linkage => sub {$value_initial{$_[1]} = 1;},
! 30867: verbose => 'equivalent to Texinfo "@set $s 1"',
! 30868: noHelp => 1,
! 30869: };
! 30870:
! 30871: $T2H_OPTIONS -> {'U'} =
! 30872: {
! 30873: type => '=s',
! 30874: linkage => sub {delete $value_initial{$_[1]};},
! 30875: verbose => 'equivalent to Texinfo "@clear $s"',
! 30876: noHelp => 1,
! 30877: };
! 30878:
! 30879: $T2H_OPTIONS -> {'init-file'} =
! 30880: {
! 30881: type => '=s',
! 30882: linkage => \&load_init_file,
! 30883: verbose => 'load init file $s'
! 30884: };
! 30885:
! 30886: $T2H_OPTIONS -> {'css-include'} =
! 30887: {
! 30888: type => '=s',
! 30889: linkage => \@Texi2HTML::Config::CSS_FILES,
! 30890: verbose => 'use css file $s'
! 30891: };
! 30892:
! 30893: $T2H_OPTIONS -> {'css-ref'} =
! 30894: {
! 30895: type => '=s',
! 30896: linkage => \@Texi2HTML::Config::CSS_REFS,
! 30897: verbose => 'generate reference to the CSS URL $s'
! 30898: };
! 30899:
! 30900: $T2H_OPTIONS -> {'transliterate-file-names'} =
! 30901: {
! 30902: type => '!',
! 30903: linkage=> \$Texi2HTML::Config::TRANSLITERATE_FILE_NAMES,
! 30904: verbose => 'produce file names in ASCII transliteration',
! 30905: };
! 30906:
! 30907: $T2H_OPTIONS -> {'error-limit|e'} =
! 30908: {
! 30909: type => '=i',
! 30910: linkage => \$Texi2HTML::Config::ERROR_LIMIT,
! 30911: verbose => 'quit after NUM errors (default 1000).',
! 30912: };
! 30913:
! 30914: $T2H_OPTIONS -> {'split-size'} =
! 30915: {
! 30916: type => '=s',
! 30917: linkage => \$Texi2HTML::Config::SPLIT_SIZE,
! 30918: verbose => 'split Info files at size s (default 300000).',
! 30919: };
! 30920:
! 30921: $T2H_OPTIONS -> {'paragraph-indent|p'} =
! 30922: {
! 30923: type => '=s',
! 30924: linkage => sub {set_paragraphindent($_[1], 1);},
! 30925: 'verbose' => "indent Info paragraphs by VAL spaces (default 3).
! 30926: If VAL is `none', do not indent; if VAL is
! 30927: `asis', preserve existing indentation.",
! 30928: };
! 30929:
! 30930: $T2H_OPTIONS -> {'fill-column|f'} =
! 30931: {
! 30932: type => '=i',
! 30933: linkage => sub {Texi2HTML::Config::set_conf('fillcolumn',$_[1]);},
! 30934: 'verbose' => "break Info lines at NUM characters (default 72).",
! 30935: };
! 30936:
! 30937: $T2H_OPTIONS -> {'enable-encoding'} =
! 30938: {
! 30939: type => '',
! 30940: linkage => \$Texi2HTML::Config::ENABLE_ENCODING,
! 30941: verbose => 'override --disable-encoding (default in Info).',
! 30942: };
! 30943:
! 30944: $T2H_OPTIONS -> {'disable-encoding'} =
! 30945: {
! 30946: type => '',
! 30947: linkage => sub {$Texi2HTML::Config::ENABLE_ENCODING = 0},
! 30948: verbose => 'do not output accented and special characters
! 30949: in Info output based on @documentencoding.',
! 30950: };
! 30951:
! 30952: $T2H_OPTIONS -> {'internal-links'} =
! 30953: {
! 30954: type => '=s',
! 30955: linkage => \$Texi2HTML::Config::INTERNAL_LINKS,
! 30956: verbose => 'produce list of internal links in FILE.'
! 30957: };
! 30958:
! 30959: $T2H_OPTIONS -> {'force|F'} =
! 30960: { type => '!',
! 30961: linkage => \$Texi2HTML::Config::FORCE,
! 30962: verbose => 'preserve output even if errors.'
! 30963: };
! 30964:
! 30965: $T2H_OPTIONS -> {'monolithic'} =
! 30966: {
! 30967: type => '!',
! 30968: linkage => \$Texi2HTML::Config::MONOLITHIC,
! 30969: verbose => 'output only one file including ToC, About...',
! 30970: noHelp => 1
! 30971: };
! 30972:
! 30973: $T2H_OPTIONS -> {'commands-in-node-names'} =
! 30974: {
! 30975: type => '!',
! 30976: verbose => 'Always set',
! 30977: noHelp => 1
! 30978: };
! 30979:
! 30980: $T2H_OPTIONS -> {'output-indent'} =
! 30981: {
! 30982: type => '=i',
! 30983: verbose => 'This option used to indent XML, it is ignored'
! 30984: };
! 30985:
! 30986: $T2H_OPTIONS -> {'program'} =
! 30987: {
! 30988: type => '=s',
! 30989: linkage => sub {set_config_init_dirs_output($_[1]);},
! 30990: 'verbose' => 'Call as $s, setting corresponding defaults'
! 30991: };
! 30992:
! 30993: #$T2H_OPTIONS -> {'command'} =
! 30994: #{
! 30995: # type => '=s',
! 30996: # linkage => \@Texi2HTML::Config::COMMANDS,
! 30997: # verbose => 'insert CMD in copy of input file'
! 30998: #};
! 30999:
! 31000:
! 31001: foreach my $output_format (keys(%Texi2HTML::Config::output_format_names))
! 31002: {
! 31003: next if (defined($Texi2HTML::Config::DEFAULT_OUTPUT_FORMAT) and $output_format eq $Texi2HTML::Config::DEFAULT_OUTPUT_FORMAT);
! 31004: $T2H_OPTIONS -> {$output_format} =
! 31005: {
! 31006: type => '',
! 31007: linkage => sub {Texi2HTML::Config::t2h_default_load_format($_[0], 1);},
! 31008: verbose => "output $Texi2HTML::Config::output_format_names{$output_format} rather than $Texi2HTML::Config::output_format_names{$Texi2HTML::Config::DEFAULT_OUTPUT_FORMAT}.",
! 31009: }
! 31010: }
! 31011:
! 31012: $T2H_OPTIONS -> {$Texi2HTML::Config::DEFAULT_OUTPUT_FORMAT} =
! 31013: {
! 31014: type => '',
! 31015: linkage => sub {Texi2HTML::Config::t2h_default_load_format($_[0], 1);},
! 31016: verbose => "output default format.",
! 31017: noHelp => 2
! 31018: };
! 31019:
! 31020: ##
! 31021: ## obsolete cmd line options
! 31022: ##
! 31023: my $T2H_OBSOLETE_OPTIONS;
! 31024:
! 31025: # actually a noop, since it is not used anywhere
! 31026: $T2H_OBSOLETE_OPTIONS -> {'invisible'} =
! 31027: {
! 31028: type => '=s',
! 31029: linkage => \$Texi2HTML::Config::INVISIBLE_MARK,
! 31030: verbose => 'use text in invisble anchor',
! 31031: noHelp => 2,
! 31032: };
! 31033:
! 31034: $T2H_OBSOLETE_OPTIONS -> {'expand'} =
! 31035: {
! 31036: type => '=s',
! 31037: linkage => sub {Texi2HTML::Config::set_expansion($_[1], 1);},
! 31038: verbose => 'Expand <s> section of texinfo source',
! 31039: noHelp => 1,
! 31040: };
! 31041:
! 31042: $T2H_OBSOLETE_OPTIONS -> {'no-expand'} =
! 31043: {
! 31044: type => '=s',
! 31045: linkage => sub {Texi2HTML::Config::set_expansion ($_[1], 0);},
! 31046: verbose => 'Don\'t expand the given section of texinfo source',
! 31047: };
! 31048:
! 31049: $T2H_OBSOLETE_OPTIONS -> {'noexpand'} =
! 31050: {
! 31051: type => '=s',
! 31052: linkage => $T2H_OBSOLETE_OPTIONS->{'no-expand'}->{'linkage'},
! 31053: verbose => $T2H_OBSOLETE_OPTIONS->{'no-expand'}->{'verbose'},
! 31054: noHelp => 1,
! 31055: };
! 31056:
! 31057: $T2H_OBSOLETE_OPTIONS -> {'out-file'} =
! 31058: {
! 31059: type => '=s',
! 31060: linkage => sub {$Texi2HTML::Config::OUT = $_[1]; $Texi2HTML::Config::SPLIT = '';},
! 31061: verbose => 'if set, all HTML output goes into file $s, obsoleted by "-output" with different semantics',
! 31062: noHelp => 2
! 31063: };
! 31064:
! 31065: $T2H_OBSOLETE_OPTIONS -> {'lang'} =
! 31066: {
! 31067: type => '=s',
! 31068: linkage => sub {Texi2HTML::Config::set_conf('documentlanguage', $_[1])},
! 31069: verbose => 'obsolete, use "--document-language" instead',
! 31070: noHelp => 2
! 31071: };
! 31072:
! 31073: $T2H_OBSOLETE_OPTIONS -> {'separated-footnotes'} =
! 31074: {
! 31075: type => '!',
! 31076: linkage => sub {my $style = 'separate'; $style = 'end' if !$_[1]; set_footnote_style ($style, 1);},
! 31077: verbose => 'obsolete, use "--footnote-style" instead',
! 31078: noHelp => 2
! 31079: };
! 31080:
! 31081: $T2H_OBSOLETE_OPTIONS -> {'Verbose'} =
! 31082: {
! 31083: type => '!',
! 31084: linkage=> \$Texi2HTML::Config::VERBOSE,
! 31085: verbose => 'obsolete, use "--verbose" instead',
! 31086: noHelp => 2
! 31087: };
! 31088:
! 31089:
! 31090: $T2H_OBSOLETE_OPTIONS -> {init_file} =
! 31091: {
! 31092: type => '=s',
! 31093: linkage => \&load_init_file,
! 31094: verbose => 'obsolete, use "-init-file" instead',
! 31095: noHelp => 2
! 31096: };
! 31097:
! 31098: $T2H_OBSOLETE_OPTIONS -> {l2h_clean} =
! 31099: {
! 31100: type => '!',
! 31101: linkage => \$Texi2HTML::Config::L2H_CLEAN,
! 31102: verbose => 'obsolete, use "-l2h-clean" instead',
! 31103: noHelp => 2,
! 31104: };
! 31105:
! 31106: $T2H_OBSOLETE_OPTIONS -> {l2h_l2h} =
! 31107: {
! 31108: type => '=s',
! 31109: linkage => \$Texi2HTML::Config::L2H_L2H,
! 31110: verbose => 'obsolete, use "-l2h-l2h" instead',
! 31111: noHelp => 2
! 31112: };
! 31113:
! 31114: $T2H_OBSOLETE_OPTIONS -> {l2h_skip} =
! 31115: {
! 31116: type => '!',
! 31117: linkage => \$Texi2HTML::Config::L2H_SKIP,
! 31118: verbose => 'obsolete, use "-l2h-skip" instead',
! 31119: noHelp => 2
! 31120: };
! 31121:
! 31122: $T2H_OBSOLETE_OPTIONS -> {l2h_tmp} =
! 31123: {
! 31124: type => '=s',
! 31125: linkage => \$Texi2HTML::Config::L2H_TMP,
! 31126: verbose => 'obsolete, use "-l2h-tmp" instead',
! 31127: noHelp => 2
! 31128: };
! 31129:
! 31130: $T2H_OBSOLETE_OPTIONS -> {out_file} =
! 31131: {
! 31132: type => '=s',
! 31133: linkage => sub {$Texi2HTML::Config::OUT = $_[1]; $Texi2HTML::Config::SPLIT = '';},
! 31134: verbose => 'obsolete, use "-out-file" instead',
! 31135: noHelp => 2
! 31136: };
! 31137:
! 31138: $T2H_OBSOLETE_OPTIONS -> {short_ref} =
! 31139: {
! 31140: type => '!',
! 31141: linkage => \$Texi2HTML::Config::SHORT_REF,
! 31142: verbose => 'obsolete, use "-short-ref" instead',
! 31143: noHelp => 2
! 31144: };
! 31145:
! 31146: $T2H_OBSOLETE_OPTIONS -> {idx_sum} =
! 31147: {
! 31148: type => '!',
! 31149: linkage => \$Texi2HTML::Config::IDX_SUMMARY,
! 31150: verbose => 'obsolete, use "-idx-sum" instead',
! 31151: noHelp => 2
! 31152: };
! 31153:
! 31154: $T2H_OBSOLETE_OPTIONS -> {def_table} =
! 31155: {
! 31156: type => '!',
! 31157: linkage => \$Texi2HTML::Config::DEF_TABLE,
! 31158: verbose => 'obsolete, use "-def-table" instead',
! 31159: noHelp => 2
! 31160: };
! 31161:
! 31162: $T2H_OBSOLETE_OPTIONS -> {short_ext} =
! 31163: {
! 31164: type => '!',
! 31165: linkage => \$Texi2HTML::Config::SHORTEXTN,
! 31166: verbose => 'obsolete, use "-short-ext" instead',
! 31167: noHelp => 2
! 31168: };
! 31169:
! 31170: $T2H_OBSOLETE_OPTIONS -> {sec_nav} =
! 31171: {
! 31172: type => '!',
! 31173: linkage => sub {Texi2HTML::Config::set_conf('headers', $_[1]);},
! 31174: verbose => 'obsolete, use "-headers" instead',
! 31175: noHelp => 2
! 31176: };
! 31177:
! 31178: $T2H_OBSOLETE_OPTIONS -> {'sec-nav'} =
! 31179: {
! 31180: type => '!',
! 31181: linkage => sub {Texi2HTML::Config::set_conf('headers', $_[1]);},
! 31182: verbose => 'obsolete, use "--header" instead',
! 31183: noHelp => 2
! 31184: };
! 31185:
! 31186: $T2H_OBSOLETE_OPTIONS -> {top_file} =
! 31187: {
! 31188: type => '=s',
! 31189: linkage => \$Texi2HTML::Config::TOP_FILE,
! 31190: verbose => 'obsolete, use "-top-file" instead',
! 31191: noHelp => 2
! 31192: };
! 31193:
! 31194: $T2H_OBSOLETE_OPTIONS -> {toc_file} =
! 31195: {
! 31196: type => '=s',
! 31197: linkage => \$Texi2HTML::Config::TOC_FILE,
! 31198: verbose => 'obsolete, use "-toc-file" instead',
! 31199: noHelp => 2
! 31200: };
! 31201:
! 31202: $T2H_OBSOLETE_OPTIONS -> {glossary} =
! 31203: {
! 31204: type => '!',
! 31205: linkage => \$Texi2HTML::Config::USE_GLOSSARY,
! 31206: verbose => "this does nothing",
! 31207: noHelp => 2,
! 31208: };
! 31209:
! 31210: $T2H_OBSOLETE_OPTIONS -> {check} =
! 31211: {
! 31212: type => '!',
! 31213: linkage => sub {exit 0;},
! 31214: verbose => "exit without doing anything",
! 31215: noHelp => 2,
! 31216: };
! 31217:
! 31218: $T2H_OBSOLETE_OPTIONS -> {dump_texi} =
! 31219: {
! 31220: type => '!',
! 31221: linkage => \$Texi2HTML::Config::DUMP_TEXI,
! 31222: verbose => 'obsolete, use "-dump-texi" instead',
! 31223: noHelp => 1
! 31224: };
! 31225:
! 31226: $T2H_OBSOLETE_OPTIONS -> {frameset_doctype} =
! 31227: {
! 31228: type => '=s',
! 31229: linkage => \$Texi2HTML::Config::FRAMESET_DOCTYPE,
! 31230: verbose => 'obsolete, use "-frameset-doctype" instead',
! 31231: noHelp => 2
! 31232: };
! 31233:
! 31234: $T2H_OBSOLETE_OPTIONS -> {'no-section_navigation'} =
! 31235: {
! 31236: type => '!',
! 31237: linkage => sub {Texi2HTML::Config::set_conf('headers', 0);},
! 31238: verbose => 'obsolete, use -nosec_nav',
! 31239: noHelp => 2,
! 31240: };
! 31241: my $use_acc; # not used
! 31242: $T2H_OBSOLETE_OPTIONS -> {use_acc} =
! 31243: {
! 31244: type => '!',
! 31245: linkage => \$use_acc,
! 31246: verbose => 'obsolete, set to true unconditionnaly',
! 31247: noHelp => 2
! 31248: };
! 31249: $T2H_OBSOLETE_OPTIONS -> {expandinfo} =
! 31250: {
! 31251: type => '!',
! 31252: linkage => sub {push @Texi2HTML::Config::EXPAND, 'info';},
! 31253: verbose => 'obsolete, use "--ifinfo" instead',
! 31254: noHelp => 2,
! 31255: };
! 31256: $T2H_OBSOLETE_OPTIONS -> {expandtex} =
! 31257: {
! 31258: type => '!',
! 31259: linkage => sub {push @Texi2HTML::Config::EXPAND, 'tex';},
! 31260: verbose => 'obsolete, use "--iftex" instead',
! 31261: noHelp => 2,
! 31262: };
! 31263: $T2H_OBSOLETE_OPTIONS -> {split_node} =
! 31264: {
! 31265: type => '!',
! 31266: linkage => sub{$Texi2HTML::Config::SPLIT = 'section';},
! 31267: verbose => 'obsolete, use "-split section" instead',
! 31268: noHelp => 2,
! 31269: };
! 31270: $T2H_OBSOLETE_OPTIONS -> {split_chapter} =
! 31271: {
! 31272: type => '!',
! 31273: linkage => sub{$Texi2HTML::Config::SPLIT = 'chapter';},
! 31274: verbose => 'obsolete, use "-split chapter" instead',
! 31275: noHelp => 2,
! 31276: };
! 31277: $T2H_OBSOLETE_OPTIONS -> {no_verbose} =
! 31278: {
! 31279: type => '!',
! 31280: linkage => sub {$Texi2HTML::Config::VERBOSE = 0;},
! 31281: verbose => 'obsolete, use -noverbose instead',
! 31282: noHelp => 2,
! 31283: };
! 31284: $T2H_OBSOLETE_OPTIONS -> {output_file} =
! 31285: {
! 31286: type => '=s',
! 31287: linkage => sub {$Texi2HTML::Config::OUT = $_[1]; $Texi2HTML::Config::SPLIT = '';},
! 31288: verbose => 'obsolete, use --out-file instead',
! 31289: noHelp => 2
! 31290: };
! 31291:
! 31292: $T2H_OBSOLETE_OPTIONS -> {section_navigation} =
! 31293: {
! 31294: type => '!',
! 31295: linkage => sub {Texi2HTML::Config::set_conf('headers', $_[1]);},
! 31296: verbose => 'obsolete, use --sec-nav instead',
! 31297: noHelp => 2,
! 31298: };
! 31299:
! 31300: # read initialzation from $sysconfdir/texi2htmlrc or $HOME/.texi2htmlrc
! 31301: # (this is obsolete). Obsoleted in 1.68 (March 20 2004).
! 31302: my @rc_files = ();
! 31303: push @rc_files, "$sysconfdir/texi2htmlrc" if defined($sysconfdir);
! 31304: push @rc_files, "$ENV{'HOME'}/.texi2htmlrc" if (defined($ENV{'HOME'}));
! 31305: foreach my $i (@rc_files)
! 31306: {
! 31307: if (-e $i and -r $i)
! 31308: {
! 31309: print STDERR "# reading initialization file from $i\n"
! 31310: if ($T2H_VERBOSE);
! 31311: print STDERR "Reading config from $i is obsolete, use texi2html/$conf_file_name instead\n";
! 31312: Texi2HTML::Config::load($i);
! 31313: }
! 31314: }
! 31315:
! 31316: # read initialization files
! 31317: foreach my $file (locate_init_file($conf_file_name, 1))
! 31318: {
! 31319: print STDERR "# reading initialization file from $file\n" if ($T2H_VERBOSE);
! 31320: Texi2HTML::Config::load($file);
! 31321: }
! 31322:
! 31323:
! 31324: #+++############################################################################
! 31325: # #
! 31326: # parse command-line options
! 31327: # #
! 31328: #---############################################################################
! 31329:
! 31330: # options known by makeinfo (+version, help and if*)
! 31331: my @makeinfo_options = ('error-limit', 'document-language',
! 31332: 'force', 'help', 'no-validate', 'no-warn', 'verbose', 'docbook', 'html',
! 31333: 'xml', 'plaintext', 'macro-expand', 'headers', 'no-split',
! 31334: 'number-sections', 'output', 'disable-encoding', 'enable-encoding',
! 31335: 'fill-column', 'footnote-style', 'paragraph-indent', 'split-size',
! 31336: 'css-include', 'css-ref', 'internal-links', 'transliterate-file-names',
! 31337: 'output-indent', 'number-footnotes', 'D', 'I', 'P', 'U');
! 31338:
! 31339: # always used, even though they are not in makeinfo in C.
! 31340: # dump-texi', 'debug', 'test' are for debugging.
! 31341: # split is in makeinfo in C, as --no-split.
! 31342: # 'conf-dir', 'init-file' options have to be taken into account for proper
! 31343: # functionning.
! 31344: my @basic_options = ('dump-texi', 'debug', 'test', 'conf-dir', 'init-file',
! 31345: 'split', 'program');
! 31346:
! 31347: # --command=CMD insert CMD in copy of input file
! 31348: my $makeinfo_help =
! 31349: sprintf(__("Usage: %s [OPTION]... TEXINFO-FILE...\n"), $real_command_name)
! 31350: ."\n".
! 31351: __("Translate Texinfo source documentation to various other formats, by default
! 31352: Info files suitable for reading online with Emacs or standalone GNU Info.\n")
! 31353: ."\n";
! 31354: $makeinfo_help .= sprintf(__("General options:
! 31355: --error-limit=NUM quit after NUM errors (default %d).
! 31356: --document-language=STR locale to use in translating Texinfo keywords
! 31357: for the output document (default C).
! 31358: --force preserve output even if errors.
! 31359: --help display this help and exit.
! 31360: --no-validate suppress node cross-reference validation.
! 31361: --no-warn suppress warnings (but not errors).
! 31362: -v, --verbose explain what is being done.
! 31363: --version display version information and exit.\n"), $Texi2HTML::Config::ERROR_LIMIT)
! 31364: ."\n";
! 31365: $makeinfo_help .= __("Output format selection (default is to produce Info):
! 31366: --docbook output Docbook XML rather than Info.
! 31367: --html output HTML rather than Info.
! 31368: --xml output Texinfo XML rather than Info.
! 31369: --plaintext output plain text rather than Info.\n")
! 31370: ."\n";
! 31371: $makeinfo_help .= __("General output options:
! 31372: -E, --macro-expand=FILE output macro-expanded source to FILE,
! 31373: ignoring any \@setfilename.
! 31374: --no-headers suppress node separators, Node: lines, and menus
! 31375: from Info output (thus producing plain text)
! 31376: or from HTML (thus producing shorter output);
! 31377: also, write to standard output by default.
! 31378: --no-split suppress the splitting of Info or HTML output,
! 31379: generate only one output file.
! 31380: --number-sections output chapter and sectioning numbers.
! 31381: -o, --output=FILE output to FILE (or directory if split HTML).\n")
! 31382: ."\n";
! 31383: $makeinfo_help .= sprintf(__("Options for Info and plain text:
! 31384: --disable-encoding do not output accented and special characters
! 31385: in Info output based on \@documentencoding.
! 31386: --enable-encoding override --disable-encoding (default).
! 31387: --fill-column=NUM break Info lines at NUM characters (default %d).
! 31388: --footnote-style=STYLE output footnotes in Info according to STYLE:
! 31389: `separate' to put them in their own node;
! 31390: `end' to put them at the end of the node, in
! 31391: which they are defined (this is the default).
! 31392: --paragraph-indent=VAL indent Info paragraphs by VAL spaces (default %d).
! 31393: If VAL is `none', do not indent; if VAL is
! 31394: `asis', preserve existing indentation.
! 31395: --split-size=NUM split Info files at size NUM (default %d).\n"),
! 31396: $Texi2HTML::Config::FILLCOLUMN, $Texi2HTML::Config::PARAGRAPHINDENT, $Texi2HTML::Config::SPLIT_SIZE)
! 31397: ."\n";
! 31398: $makeinfo_help .= __("Options for HTML:
! 31399: --css-include=FILE include FILE in HTML <style> output;
! 31400: read stdin if FILE is -.
! 31401: --css-ref=URL generate reference to a CSS file.
! 31402: --internal-links=FILE produce list of internal links in FILE.
! 31403: --transliterate-file-names
! 31404: produce file names in ASCII transliteration.\n")
! 31405: ."\n";
! 31406: # This is ignored, so remove it from help
! 31407: #Options for XML and Docbook:
! 31408: # --output-indent=VAL indent XML elements by VAL spaces (default 2).
! 31409: # If VAL is 0, ignorable whitespace is dropped.
! 31410: #
! 31411: $makeinfo_help .= __("Input file options:
! 31412: --commands-in-node-names allow \@ commands in node names.
! 31413: -D VAR define the variable VAR, as with \@set.
! 31414: -I DIR append DIR to the \@include search path.
! 31415: -P DIR prepend DIR to the \@include search path.
! 31416: -U VAR undefine the variable VAR, as with \@clear.\n")
! 31417: ."\n";
! 31418: $makeinfo_help .= __("Conditional processing in input:
! 31419: --ifdocbook process \@ifdocbook and \@docbook even if
! 31420: not generating Docbook.
! 31421: --ifhtml process \@ifhtml and \@html even if not generating HTML.
! 31422: --ifinfo process \@ifinfo even if not generating Info.
! 31423: --ifplaintext process \@ifplaintext even if not generating plain text.
! 31424: --iftex process \@iftex and \@tex; implies --no-split.
! 31425: --ifxml process \@ifxml and \@xml.
! 31426: --no-ifdocbook do not process \@ifdocbook and \@docbook text.
! 31427: --no-ifhtml do not process \@ifhtml and \@html text.
! 31428: --no-ifinfo do not process \@ifinfo text.
! 31429: --no-ifplaintext do not process \@ifplaintext text.
! 31430: --no-iftex do not process \@iftex and \@tex text.
! 31431: --no-ifxml do not process \@ifxml and \@xml text.
! 31432:
! 31433: Also, for the --no-ifFORMAT options, do process \@ifnotFORMAT text.\n")
! 31434: ."\n";
! 31435: $makeinfo_help .= __(" The defaults for the \@if... conditionals depend on the output format:
! 31436: if generating HTML, --ifhtml is on and the others are off;
! 31437: if generating Info, --ifinfo is on and the others are off;
! 31438: if generating plain text, --ifplaintext is on and the others are off;
! 31439: if generating XML, --ifxml is on and the others are off.\n")
! 31440: ."\n";
! 31441: $makeinfo_help .= __("Examples:
! 31442: makeinfo foo.texi write Info to foo's \@setfilename
! 31443: makeinfo --html foo.texi write HTML to \@setfilename
! 31444: makeinfo --xml foo.texi write Texinfo XML to \@setfilename
! 31445: makeinfo --docbook foo.texi write DocBook XML to \@setfilename
! 31446: makeinfo --no-headers foo.texi write plain text to standard output
! 31447:
! 31448: makeinfo --html --no-headers foo.texi write html without node lines, menus
! 31449: makeinfo --number-sections foo.texi write Info with numbered sections
! 31450: makeinfo --no-split foo.texi write one Info file however big\n")
! 31451: ."\n";
! 31452: $makeinfo_help .= __("Email bug reports to bug-texinfo\@gnu.org,
! 31453: general questions and discussion to help-texinfo\@gnu.org.
! 31454: Texinfo home page: http://www.gnu.org/software/texinfo/") ."\n";
! 31455:
! 31456: # parsing like texi2html:
! 31457:
! 31458:
! 31459: my $T2H_USAGE_TEXT = <<EOT;
! 31460: Usage: texi2html [OPTIONS] TEXINFO-FILE
! 31461: Translates Texinfo source documentation to HTML.
! 31462: EOT
! 31463:
! 31464:
! 31465: my $options = new Getopt::MySimple;
! 31466:
! 31467: $T2H_OPTIONS -> {'help'} = 0;
! 31468: $T2H_OPTIONS -> {'help|h'} =
! 31469: {
! 31470: type => ':i',
! 31471: default => '',
! 31472: linkage => sub {$options->helpOptions($_[1]);
! 31473: print "\nSend bugs and suggestions to <texi2html-bug\@nongnu.org>\n";
! 31474: exit (0);},
! 31475: verbose => "print help and exit"
! 31476: };
! 31477:
! 31478: # this avoids getOptions defining twice 'help' and 'version'.
! 31479: $T2H_OBSOLETE_OPTIONS->{'help'} = 0;
! 31480: $T2H_OBSOLETE_OPTIONS->{'version'} = 0;
! 31481: $T2H_OBSOLETE_OPTIONS->{'verbose'} = 0;
! 31482:
! 31483:
! 31484: if ($real_command_name eq 'texi2html')
! 31485: {
! 31486: # some older version of GetOpt::Long don't have
! 31487: # Getopt::Long::Configure("pass_through")
! 31488: eval {Getopt::Long::Configure("pass_through");};
! 31489: my $Configure_failed = $@ && <<EOT;
! 31490: **WARNING: Parsing of obsolete command-line options could have failed.
! 31491: Consider to use only documented command-line options (run
! 31492: 'texi2html --help 2' for a complete list) or upgrade to perl
! 31493: version 5.005 or higher.
! 31494: EOT
! 31495: if (! $options->getOptions($T2H_OPTIONS, $T2H_USAGE_TEXT, "$THISVERSION\n"))
! 31496: {
! 31497: print STDERR "$Configure_failed" if $Configure_failed;
! 31498: die $T2H_FAILURE_TEXT;
! 31499: }
! 31500: if (@ARGV > 1)
! 31501: {
! 31502: eval {Getopt::Long::Configure("no_pass_through");};
! 31503: if (! $options->getOptions($T2H_OBSOLETE_OPTIONS, $T2H_USAGE_TEXT, "$THISVERSION\n"))
! 31504: {
! 31505: print STDERR "$Configure_failed" if $Configure_failed;
! 31506: die $T2H_FAILURE_TEXT;
! 31507: }
! 31508: }
! 31509: }
! 31510: else
! 31511: {
! 31512: # changes how command lines are parsed, for example -init file.init
! 31513: # doesn't work anymore.
! 31514: Getopt::Long::Configure("gnu_getopt");
! 31515: my $opts;
! 31516: my @types;
! 31517: foreach my $key (keys(%$T2H_OPTIONS))
! 31518: {
! 31519: next unless ($T2H_OPTIONS->{$key});
! 31520: my $primary = $key;
! 31521: $primary =~ s/\|.*//;
! 31522: next if ($primary eq 'version' or $primary eq 'help');
! 31523: next if ($real_command_name eq 'makeinfo' and ! grep {$primary eq $_} (@makeinfo_options, @basic_options) and $primary !~ /^if/);
! 31524: $opts->{$primary} = $T2H_OPTIONS->{$key}->{'linkage'} if defined($T2H_OPTIONS->{$key}->{'linkage'});
! 31525: push @types, "$key$T2H_OPTIONS->{$key}->{'type'}";
! 31526: }
! 31527: $opts->{'version'} = sub {
! 31528: print "$real_command_name (GNU texinfo) $THISVERSION\n\n";
! 31529:
! 31530: printf __("Copyright (C) %s Free Software Foundation, Inc.
! 31531: License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
! 31532: This is free software: you are free to change and redistribute it.
! 31533: There is NO WARRANTY, to the extent permitted by law.\n"), '2008';
! 31534: exit 0;
! 31535: };
! 31536: $opts->{'help'} = sub {
! 31537: print "$makeinfo_help";
! 31538: exit 0;
! 31539: };
! 31540: push @types, ('version|V', 'help|h');
! 31541: #foreach my $key (sort(keys(%$opts)))
! 31542: #{
! 31543: # #print STDERR "$key, $opts->{$key}\n";
! 31544: # print "$key\n";
! 31545: #}
! 31546: #print STDERR "@types\n";
! 31547: my $result_options = Getopt::Long::GetOptions ($opts, @types);
! 31548: }
! 31549:
! 31550: if (! $Texi2HTML::THISDOC{'format_from_command_line'} and defined($ENV{'TEXINFO_OUTPUT_FORMAT'}) and $ENV{'TEXINFO_OUTPUT_FORMAT'} ne '')
! 31551: {
! 31552: if (! Texi2HTML::Config::t2h_default_load_format($ENV{'TEXINFO_OUTPUT_FORMAT'}, 0))
! 31553: {
! 31554: warn sprintf(__("%s: Ignoring unrecognized TEXINFO_OUTPUT_FORMAT value `%s'.\n"), $real_command_name, $ENV{'TEXINFO_OUTPUT_FORMAT'});
! 31555: }
! 31556: }
! 31557:
! 31558: # $T2H_DEBUG and $T2H_VERBOSE are shorthands
! 31559: $T2H_DEBUG = $Texi2HTML::Config::DEBUG;
! 31560: $T2H_VERBOSE = $Texi2HTML::Config::VERBOSE;
! 31561:
! 31562: #
! 31563: # read texi2html extensions (if any)
! 31564: # It is obsolete (obsoleted by -init-file). we keep it for backward
! 31565: # compatibility.
! 31566: my $extensions = 'texi2html.ext'; # extensions in working directory
! 31567: if (-f $extensions)
! 31568: {
! 31569: print STDERR "# reading extensions from $extensions\n" if $T2H_VERBOSE;
! 31570: require($extensions);
! 31571: }
! 31572: my $progdir;
! 31573: ($progdir = $0) =~ s/[^\/]+$//;
! 31574: if ($progdir && ($progdir ne './'))
! 31575: {
! 31576: $extensions = "${progdir}texi2html.ext"; # extensions in texi2html directory
! 31577: if (-f $extensions)
! 31578: {
! 31579: print STDERR "# reading extensions from $extensions\n" if $T2H_VERBOSE;
! 31580: require($extensions);
! 31581: }
! 31582: }
! 31583:
! 31584:
! 31585: #+++############################################################################
! 31586: # #
! 31587: # evaluation of cmd line options
! 31588: # #
! 31589: #---############################################################################
! 31590:
! 31591: # set the default 'args' entry to normal for each style hash (and each command
! 31592: # within)
! 31593: my $name_index = -1;
! 31594: my @hash_names = ('style_map', 'style_map_pre', 'style_map_texi', 'simple_format_style_map_texi');
! 31595: foreach my $hash (\%Texi2HTML::Config::style_map, \%Texi2HTML::Config::style_map_pre, \%Texi2HTML::Config::style_map_texi, \%Texi2HTML::Config::simple_format_style_map_texi)
! 31596: {
! 31597: $name_index++;
! 31598: my $name = $hash_names[$name_index]; # name associated with hash ref
! 31599: foreach my $style (keys(%{$hash}))
! 31600: {
! 31601: next unless (ref($hash->{$style}) eq 'HASH');
! 31602: $hash->{$style}->{'args'} = ['normal'] if (!exists($hash->{$style}->{'args'}));
! 31603: die "Bug: args not defined, but existing, for $style in $name" if (!defined($hash->{$style}->{'args'}));
! 31604: #print STDERR "DEFAULT($name, $hash) add normal as arg for $style ($hash->{$style}), $hash->{$style}->{'args'}\n";
! 31605: }
! 31606: }
! 31607:
! 31608: # setup hashes used for html manual cross references in texinfo
! 31609: my %cross_ref_texi_map = %Texi2HTML::Config::default_texi_map;
! 31610: my %cross_transliterate_texi_map = %cross_ref_texi_map;
! 31611:
! 31612: my %cross_ref_simple_map_texi = %Texi2HTML::Config::default_simple_map;
! 31613: $cross_ref_simple_map_texi{"*"} = ' ';
! 31614:
! 31615: my %cross_ref_style_map_texi = ();
! 31616: my %cross_transliterate_style_map_texi = ();
! 31617: Texi2HTML::Config::t2h_default_copy_style_map(\%Texi2HTML::Config::default_style_map_texi, \%cross_ref_style_map_texi);
! 31618: Texi2HTML::Config::t2h_default_copy_style_map(\%Texi2HTML::Config::default_style_map_texi, \%cross_transliterate_style_map_texi);
! 31619:
! 31620:
! 31621:
! 31622: # Fill in the %style_type hash, a hash associating style @-comand with
! 31623: # the type, 'accent', real 'style', 'simple_style', or 'special'.
! 31624: # 'simple_style' styles don't extend accross lines.
! 31625: my %style_type = ();
! 31626: my @simple_styles = ('ctrl', 'w', 'url','uref','indicateurl','email',
! 31627: 'titlefont');
! 31628: foreach my $style (keys(%Texi2HTML::Config::style_map))
! 31629: {
! 31630: if (exists $Texi2HTML::Config::command_type{$style})
! 31631: {
! 31632: $style_type{$style} = $Texi2HTML::Config::command_type{$style};
! 31633: next;
! 31634: }
! 31635: if (ref($Texi2HTML::Config::style_map{$style} eq 'HASH'))
! 31636: {
! 31637: $style_type{$style} = $Texi2HTML::Config::style_map{$style}->{'type'}
! 31638: if (exists($Texi2HTML::Config::style_map{$style}->{'type'}));
! 31639: }
! 31640: else
! 31641: {
! 31642: $style_type{$style} = 'simple_style' if (grep {$_ eq $style} @simple_styles);
! 31643: }
! 31644: $style_type{$style} = 'style' unless (defined($style_type{$style}));
! 31645: }
! 31646:
! 31647: foreach my $accent (keys(%Texi2HTML::Config::unicode_accents), 'tieaccent', 'dotless')
! 31648: {
! 31649: if (exists $Texi2HTML::Config::command_type{$accent})
! 31650: {
! 31651: $style_type{$accent} = $Texi2HTML::Config::command_type{$accent};
! 31652: next;
! 31653: }
! 31654: $style_type{$accent} = 'accent';
! 31655: }
! 31656:
! 31657:
! 31658:
! 31659:
! 31660: foreach my $special ('footnote', 'ref', 'xref', 'pxref', 'inforef', 'anchor', 'image', 'hyphenation')
! 31661: {
! 31662: if (exists $Texi2HTML::Config::command_type{$special})
! 31663: {
! 31664: $style_type{$special} = $Texi2HTML::Config::command_type{$special};
! 31665: next;
! 31666: }
! 31667: $style_type{$special} = 'special';
! 31668: }
! 31669:
! 31670: # retro compatibility for $Texi2HTML::Config::EXPAND
! 31671: push (@Texi2HTML::Config::EXPAND, $Texi2HTML::Config::EXPAND) if ($Texi2HTML::Config::EXPAND);
! 31672:
! 31673: push (@Texi2HTML::Config::EXPAND, @Texi2HTML::Config::T2H_FORMAT_EXPAND);
! 31674:
! 31675: # correct %Texi2HTML::Config::texi_formats_map based on command line and init
! 31676: # variables
! 31677: $Texi2HTML::Config::texi_formats_map{'menu'} = 'normal' if ($Texi2HTML::Config::SHOW_MENU);
! 31678:
! 31679: foreach my $expanded (@Texi2HTML::Config::EXPAND)
! 31680: {
! 31681: $Texi2HTML::Config::texi_formats_map{"if$expanded"} = 1 if (exists($Texi2HTML::Config::texi_formats_map{"if$expanded"}));
! 31682: next unless (exists($Texi2HTML::Config::texi_formats_map{$expanded}));
! 31683: if (grep {$_ eq $expanded} @raw_regions)
! 31684: {
! 31685: $Texi2HTML::Config::texi_formats_map{$expanded} = 'raw';
! 31686: }
! 31687: else
! 31688: {
! 31689: $Texi2HTML::Config::texi_formats_map{$expanded} = 'normal';
! 31690: }
! 31691: }
! 31692:
! 31693: # don't set set_no_line_macro for raw EXPAND formats
! 31694: foreach my $key (keys(%Texi2HTML::Config::texi_formats_map))
! 31695: {
! 31696: unless ($Texi2HTML::Config::texi_formats_map{$key} eq 'raw')
! 31697: {
! 31698: set_no_line_macro($key, 1);
! 31699: set_no_line_macro("end $key", 1);
! 31700: }
! 31701: }
! 31702:
! 31703: # the remaining (not in @EXPAND) raw formats are set as 'raw' such that
! 31704: # they are propagated to formatting functions, but
! 31705: # they don't start paragraphs or preformatted.
! 31706: foreach my $raw (@raw_regions)
! 31707: {
! 31708: if (!defined($Texi2HTML::Config::texi_formats_map{$raw}))
! 31709: {
! 31710: $Texi2HTML::Config::texi_formats_map{$raw} = 'raw';
! 31711: $Texi2HTML::Config::format_in_paragraph{$raw} = 1;
! 31712: set_no_line_macro($raw, 1);
! 31713: set_no_line_macro("end $raw", 1);
! 31714: }
! 31715: }
! 31716:
! 31717: # handle ifnot regions
! 31718: foreach my $region (keys (%Texi2HTML::Config::texi_formats_map))
! 31719: {
! 31720: next if ($region =~ /^ifnot/);
! 31721: if ($Texi2HTML::Config::texi_formats_map{$region} and $region =~ /^if(\w+)$/)
! 31722: {
! 31723: $Texi2HTML::Config::texi_formats_map{"ifnot$1"} = 0;
! 31724: }
! 31725: }
! 31726:
! 31727: if ($T2H_VERBOSE)
! 31728: {
! 31729: print STDERR "# Expanded: ";
! 31730: foreach my $text_macro (keys(%Texi2HTML::Config::texi_formats_map))
! 31731: {
! 31732: print STDERR "$text_macro " if ($Texi2HTML::Config::texi_formats_map{$text_macro});
! 31733: }
! 31734: print STDERR "\n";
! 31735: }
! 31736:
! 31737: # This is kept in that file although it is html formatting as it seems to
! 31738: # be rather obsolete
! 31739: $Texi2HTML::Config::INVISIBLE_MARK = '<img src="invisible.xbm" alt="">' if $Texi2HTML::Config::INVISIBLE_MARK eq 'xbm';
! 31740:
! 31741: $T2H_DEBUG |= $DEBUG_TEXI if ($Texi2HTML::Config::DUMP_TEXI);
! 31742:
! 31743: # no user provided USE_UNICODE, use configure provided
! 31744: if (!defined($Texi2HTML::Config::USE_UNICODE))
! 31745: {
! 31746: $Texi2HTML::Config::USE_UNICODE = 'unknown';
! 31747: }
! 31748:
! 31749: # no user provided nor configured, run time test
! 31750: if ($Texi2HTML::Config::USE_UNICODE eq 'unknown' or $Texi2HTML::Config::USE_UNICODE eq '@' .'USE_UNICODE@')
! 31751: {
! 31752: eval {
! 31753: require Encode;
! 31754: require Unicode::Normalize;
! 31755: Encode->import('encode');
! 31756: };
! 31757: if ($@)
! 31758: {
! 31759: $Texi2HTML::Config::USE_UNICODE = 0
! 31760: }
! 31761: else
! 31762: {
! 31763: $Texi2HTML::Config::USE_UNICODE = 1;
! 31764: }
! 31765: }
! 31766:
! 31767: if ($Texi2HTML::Config::USE_UNICODE)
! 31768: {
! 31769: require Encode;
! 31770: require Unicode::Normalize;
! 31771: Encode->import('encode');
! 31772:
! 31773: # use EastAsianWidth if USE_UNICODE is set
! 31774: if ($0 =~ /\.pl$/)
! 31775: { # use in-source EastAsianWidth when testing
! 31776: unshift @INC, "$T2H_HOME/lib/Unicode-EastAsianWidth/lib";
! 31777: }
! 31778: elsif ($ENV{T2H_SOURCE_EASTASIANWIDTH})
! 31779: {
! 31780: unshift @INC, $ENV{T2H_SOURCE_EASTASIANWIDTH};
! 31781: }
! 31782: elsif ('no' ne 'yes')
! 31783: {
! 31784: unshift @INC, "$pkgdatadir/lib/Unicode-EastAsianWidth/lib";
! 31785: }
! 31786: else
! 31787: {
! 31788: eval {
! 31789: require Unicode::EastAsianWidth;
! 31790: };
! 31791: if ($@)
! 31792: {
! 31793: unshift @INC, "$pkgdatadir/lib/Unicode-EastAsianWidth/lib";
! 31794: }
! 31795: }
! 31796: # unicode east asian character width tables.
! 31797: require Unicode::EastAsianWidth;
! 31798: }
! 31799:
! 31800: # no user provided USE_UNIDECODE, use configure provided
! 31801: if (!defined($Texi2HTML::Config::USE_UNIDECODE))
! 31802: {
! 31803: $Texi2HTML::Config::USE_UNIDECODE = 'unknown';
! 31804: }
! 31805:
! 31806: # no user provided nor configured, run time test
! 31807: if ($Texi2HTML::Config::USE_UNIDECODE eq 'unknown' or $Texi2HTML::Config::USE_UNIDECODE eq '@' .'USE_UNIDECODE@')
! 31808: {
! 31809: $Texi2HTML::Config::USE_UNIDECODE = 1;
! 31810: eval {
! 31811: require Text::Unidecode;
! 31812: Text::Unidecode->import('unidecode');
! 31813: };
! 31814: $Texi2HTML::Config::USE_UNIDECODE = 0 if ($@);
! 31815: }
! 31816:
! 31817: if ($Texi2HTML::Config::USE_UNIDECODE)
! 31818: {
! 31819: require Text::Unidecode;
! 31820: Text::Unidecode->import('unidecode');
! 31821: }
! 31822:
! 31823: print STDERR "# USE_UNICODE $Texi2HTML::Config::USE_UNICODE, USE_UNIDECODE $Texi2HTML::Config::USE_UNIDECODE \n"
! 31824: if ($T2H_VERBOSE);
! 31825:
! 31826: # Construct hashes used for cross references generation
! 31827: # Do it now as the user may have changed $USE_UNICODE
! 31828:
! 31829: foreach my $key (keys(%Texi2HTML::Config::unicode_map))
! 31830: {
! 31831: if ($Texi2HTML::Config::unicode_map{$key} ne '')
! 31832: {
! 31833: if ($Texi2HTML::Config::USE_UNICODE)
! 31834: {
! 31835: my $char_nr = hex($Texi2HTML::Config::unicode_map{$key});
! 31836: #$cross_ref_texi_map{$key} = chr(hex($Texi2HTML::Config::unicode_map{$key}));
! 31837: #$cross_ref_texi_map{$key} = pack("U0U*",hex($Texi2HTML::Config::unicode_map{$key}));
! 31838: if ($char_nr > 126 and $char_nr < 255)
! 31839: {
! 31840: $cross_ref_texi_map{$key} = Encode::decode("iso-8859-1", chr($char_nr));
! 31841: }
! 31842: else
! 31843: {
! 31844: $cross_ref_texi_map{$key} = chr($char_nr);
! 31845: }
! 31846: # cross_transliterate_texi_map is only used if
! 31847: # USE_UNIDECODE is unset and TRANSLITERATE_FILE_NAMES is set
! 31848: if (exists ($Texi2HTML::Config::transliterate_map{$Texi2HTML::Config::unicode_map{$key}}))
! 31849: {
! 31850: $cross_transliterate_texi_map{$key} = $Texi2HTML::Config::transliterate_map{$Texi2HTML::Config::unicode_map{$key}};
! 31851: }
! 31852: else
! 31853: {
! 31854: $cross_transliterate_texi_map{$key} = $cross_ref_texi_map{$key};
! 31855: }
! 31856: }
! 31857: else
! 31858: {
! 31859: $cross_ref_texi_map{$key} = '_' . lc($Texi2HTML::Config::unicode_map{$key});
! 31860: # cross_transliterate_texi_map is used if TRANSLITERATE_FILE_NAMES is set
! 31861: if (exists ($Texi2HTML::Config::transliterate_map{$Texi2HTML::Config::unicode_map{$key}}))
! 31862: {
! 31863: $cross_transliterate_texi_map{$key} = $Texi2HTML::Config::transliterate_map{$Texi2HTML::Config::unicode_map{$key}};
! 31864: }
! 31865: else
! 31866: {
! 31867: $cross_transliterate_texi_map{$key} = '_' . lc($Texi2HTML::Config::unicode_map{$key});
! 31868: }
! 31869: }
! 31870: }
! 31871: }
! 31872: #if ($Texi2HTML::Config::USE_UNICODE and $Texi2HTML::Config::TRANSLITERATE_FILE_NAMES
! 31873: if ($Texi2HTML::Config::TRANSLITERATE_FILE_NAMES and (
! 31874: ($Texi2HTML::Config::USE_UNICODE and ! $Texi2HTML::Config::USE_UNIDECODE)
! 31875: or !$Texi2HTML::Config::USE_UNICODE))
! 31876: {
! 31877: foreach my $key (keys (%Texi2HTML::Config::transliterate_accent_map))
! 31878: {
! 31879: $Texi2HTML::Config::transliterate_map{$key} = $Texi2HTML::Config::transliterate_accent_map{$key};
! 31880: }
! 31881: }
! 31882:
! 31883: foreach my $key (keys(%cross_ref_style_map_texi))
! 31884: {
! 31885: if ($style_type{$key} eq 'accent'
! 31886: and (ref($cross_ref_style_map_texi{$key}) eq 'HASH'))
! 31887: {
! 31888: if ($Texi2HTML::Config::USE_UNICODE)
! 31889: {
! 31890: $cross_ref_style_map_texi{$key}->{'function'} = \&Texi2HTML::Config::t2h_utf8_accent;
! 31891: }
! 31892: else
! 31893: {
! 31894: $cross_ref_style_map_texi{$key}->{'function'} = \&Texi2HTML::Config::t2h_nounicode_cross_manual_accent;
! 31895: }
! 31896: # this is only used if TRANSLITERATE_FILE_NAMES is set and USE_UNICODE
! 31897: # or USE_UNIDECODE is not set
! 31898: $cross_transliterate_style_map_texi{$key}->{'function'} = \&Texi2HTML::Config::t2h_transliterate_cross_manual_accent;
! 31899: }
! 31900: }
! 31901:
! 31902: if ($Texi2HTML::Config::L2H and defined($Texi2HTML::Config::OUTPUT_FORMAT) and $Texi2HTML::Config::OUTPUT_FORMAT eq 'html')
! 31903: {
! 31904: push @Texi2HTML::Config::command_handler_init, \&Texi2HTML::LaTeX2HTML::init;
! 31905: push @Texi2HTML::Config::command_handler_process, \&Texi2HTML::LaTeX2HTML::latex2html;
! 31906: # do it here once to have something ready for special regions
! 31907: push @Texi2HTML::Config::command_handler_process, \&Texi2HTML::LaTeX2HTML::init_from_html;
! 31908: # do it here once more in case the file was modified (see mediawiki.init)
! 31909: push @Texi2HTML::Config::command_handler_output, \&Texi2HTML::LaTeX2HTML::init_from_html;
! 31910: push @Texi2HTML::Config::command_handler_finish, \&Texi2HTML::LaTeX2HTML::finish;
! 31911: $Texi2HTML::Config::command_handler{'math'} =
! 31912: { 'init' => \&Texi2HTML::LaTeX2HTML::to_latex,
! 31913: 'expand' => \&Texi2HTML::LaTeX2HTML::do_tex
! 31914: };
! 31915: $Texi2HTML::Config::command_handler{'tex'} =
! 31916: { 'init' => \&Texi2HTML::LaTeX2HTML::to_latex,
! 31917: 'expand' => \&Texi2HTML::LaTeX2HTML::do_tex
! 31918: };
! 31919: }
! 31920:
! 31921: if ($Texi2HTML::Config::ENABLE_ENCODING)
! 31922: {
! 31923: if ($Texi2HTML::Config::USE_UNICODE)
! 31924: {
! 31925: Texi2HTML::Config::t2h_enable_encoding_load();
! 31926: }
! 31927: else
! 31928: { # FIXME: only warn if ENABLE_ENCODING is set on the command line
! 31929: #warn "** --enable-encoding requires utf-8 support\n";
! 31930: }
! 31931: }
! 31932:
! 31933: # for all files. This won't be overriden by @documentencoding, this is not
! 31934: # what is done in general.
! 31935: Texi2HTML::Config::set_conf('IN_ENCODING', $Texi2HTML::Config::IN_ENCODING);
! 31936: Texi2HTML::Config::set_conf('DOCUMENT_ENCODING', $Texi2HTML::Config::DOCUMENT_ENCODING);
! 31937:
! 31938: # Backward compatibility for deprecated $Texi2HTML::Config::ENCODING
! 31939: $Texi2HTML::Config::ENCODING_NAME = $Texi2HTML::Config::ENCODING
! 31940: if (!defined($Texi2HTML::Config::ENCODING_NAME) and defined($Texi2HTML::Config::ENCODING));
! 31941:
! 31942: # APA: There's got to be a better way:
! 31943: if ($Texi2HTML::Config::TEST)
! 31944: {
! 31945: # to generate files similar to reference ones to be able to check for
! 31946: # real changes we use these dummy values if -test is given
! 31947: $THISPROG = 'texi2html';
! 31948: setlocale( LC_ALL, "C" );
! 31949: }
! 31950:
! 31951: $Texi2HTML::GLOBAL{'debug_l2h'} = 1 if ($T2H_DEBUG & $DEBUG_L2H);
! 31952:
! 31953: # parse texinfo cnf file for external manual specifications. This was
! 31954: # discussed on texinfo list but not in makeinfo for now.
! 31955: my @texinfo_htmlxref_files = locate_init_file ($texinfo_htmlxref, 1, \@texinfo_config_dirs);
! 31956:
! 31957: foreach my $file (@texinfo_htmlxref_files)
! 31958: {
! 31959: print STDERR "html refs config file: $file\n" if ($T2H_DEBUG);
! 31960: unless (open (HTMLXREF, $file))
! 31961: {
! 31962: document_warn("Cannot open html refs config file ${file}: $!");
! 31963: next;
! 31964: }
! 31965: my $line_nr = 0;
! 31966: my %variables;
! 31967: while (my $hline = <HTMLXREF>)
! 31968: {
! 31969: my $line = $hline;
! 31970: $line_nr++;
! 31971: next if $hline =~ /^\s*#/;
! 31972: #$hline =~ s/[#]\s.*//;
! 31973: $hline =~ s/^\s*//;
! 31974: next if $hline =~ /^\s*$/;
! 31975: chomp ($hline);
! 31976: if ($hline =~ s/^(\w+)\s*=\s*//)
! 31977: {
! 31978: # handle variables
! 31979: my $var = $1;
! 31980: my $re = join '|', map { quotemeta $_ } keys %variables;
! 31981: $hline =~ s/\$\{($re)\}/defined $variables{$1} ? $variables{$1} : "\${$1}"/ge;
! 31982: $variables{$var} = $hline;
! 31983: next;
! 31984: }
! 31985: my @htmlxref = split /\s+/, $hline;
! 31986: my $manual = shift @htmlxref;
! 31987: my $split_or_mono = shift @htmlxref;
! 31988: #print STDERR "$split_or_mono $Texi2HTML::Config::htmlxref_entries{$split_or_mono} $line_nr\n";
! 31989: if (!defined($split_or_mono))
! 31990: {
! 31991: file_line_warn(__("Missing type"), $file, $line_nr);
! 31992: next;
! 31993: }
! 31994: elsif (!defined($Texi2HTML::Config::htmlxref_entries{$split_or_mono}))
! 31995: {
! 31996: file_line_warn(sprintf(__("Unrecognized type: %s"), $split_or_mono), $file, $line_nr);
! 31997: next;
! 31998: }
! 31999: my $href = shift @htmlxref;
! 32000: next if (exists($Texi2HTML::GLOBAL{'htmlxref'}->{$manual}->{$split_or_mono}) and exists($Texi2HTML::GLOBAL{'htmlxref'}->{$manual}->{$split_or_mono}->{'href'}));
! 32001:
! 32002: if (defined($href))
! 32003: {
! 32004: my $re = join '|', map { quotemeta $_ } keys %variables;
! 32005: $href =~ s/\$\{($re)\}/defined $variables{$1} ? $variables{$1} : "\${$1}"/ge;
! 32006: $href =~ s/\/*$// if ($split_or_mono ne 'mono');
! 32007: $Texi2HTML::GLOBAL{'htmlxref'}->{$manual}->{$split_or_mono}->{'href'} = $href;
! 32008: }
! 32009: else
! 32010: {
! 32011: $Texi2HTML::GLOBAL{'htmlxref'}->{$manual}->{$split_or_mono} = {};
! 32012: }
! 32013: }
! 32014: close (HTMLXREF);
! 32015: }
! 32016:
! 32017: if ($T2H_DEBUG)
! 32018: {
! 32019: foreach my $manual (keys(%{$Texi2HTML::GLOBAL{'htmlxref'}}))
! 32020: {
! 32021: foreach my $split (keys(%Texi2HTML::Config::htmlxref_entries))
! 32022: {
! 32023: my $href = 'NO';
! 32024: next unless (exists($Texi2HTML::GLOBAL{'htmlxref'}->{$manual}->{$split}));
! 32025: $href = $Texi2HTML::GLOBAL{'htmlxref'}->{$manual}->{$split}->{'href'} if
! 32026: exists($Texi2HTML::GLOBAL{'htmlxref'}->{$manual}->{$split}->{'href'});
! 32027: print STDERR "$manual: $split, href: $href\n";
! 32028: }
! 32029: }
! 32030: }
! 32031:
! 32032: # resulting files splitting
! 32033: if ($Texi2HTML::Config::SPLIT =~ /section/i)
! 32034: {
! 32035: $Texi2HTML::Config::SPLIT = 'section';
! 32036: }
! 32037: elsif ($Texi2HTML::Config::SPLIT =~ /node/i)
! 32038: {
! 32039: $Texi2HTML::Config::SPLIT = 'node';
! 32040: }
! 32041: elsif ($Texi2HTML::Config::SPLIT =~ /chapter/i)
! 32042: {
! 32043: $Texi2HTML::Config::SPLIT = 'chapter';
! 32044: }
! 32045: else
! 32046: {
! 32047: $Texi2HTML::Config::SPLIT = '';
! 32048: }
! 32049:
! 32050: $Texi2HTML::Config::SPLIT_INDEX = 0 unless $Texi2HTML::Config::SPLIT;
! 32051: $Texi2HTML::Config::NODE_FILENAMES = 1 if ((!defined($Texi2HTML::Config::NODE_FILENAMES) and $Texi2HTML::Config::SPLIT eq 'node') or $Texi2HTML::Config::NODE_FILES);
! 32052:
! 32053: # Something like backward compatibility. This would make sense to keep
! 32054: # it ad-infinitum since the meaning of --out and --subdir are different.
! 32055: if ($Texi2HTML::Config::SPLIT and defined($Texi2HTML::Config::SUBDIR)
! 32056: and ($Texi2HTML::Config::SUBDIR ne '') and
! 32057: (!defined($Texi2HTML::Config::OUT) or ($Texi2HTML::Config::OUT eq '')))
! 32058: {
! 32059: $Texi2HTML::Config::OUT = $Texi2HTML::Config::SUBDIR;
! 32060: }
! 32061:
! 32062: die "output to STDOUT and split or frames incompatible\n"
! 32063: if (($Texi2HTML::Config::SPLIT or $Texi2HTML::Config::FRAMES) and defined($Texi2HTML::Config::OUT) and $Texi2HTML::Config::OUT eq '-');
! 32064:
! 32065: if ($Texi2HTML::Config::SPLIT and defined($Texi2HTML::Config::OUT) and ($Texi2HTML::Config::OUT eq '.'))
! 32066: {# This is to avoid trouble with latex2html
! 32067: $Texi2HTML::Config::OUT = '';
! 32068: }
! 32069:
! 32070: @Texi2HTML::Config::INCLUDE_DIRS = split(/$quoted_path_separator/,join($path_separator,@Texi2HTML::Config::INCLUDE_DIRS));
! 32071: @Texi2HTML::Config::PREPEND_DIRS = split(/$quoted_path_separator/,join($path_separator,@Texi2HTML::Config::PREPEND_DIRS));
! 32072:
! 32073: my @include_dirs_orig = @Texi2HTML::Config::INCLUDE_DIRS;
! 32074:
! 32075: @Texi2HTML::Config::CONF_DIRS = split(/$quoted_path_separator/,join($path_separator,@Texi2HTML::Config::CONF_DIRS));
! 32076: # extension
! 32077: $Texi2HTML::GLOBAL{'extension'} = $Texi2HTML::Config::EXTENSION;
! 32078: if ($Texi2HTML::Config::SHORTEXTN)
! 32079: {
! 32080: $Texi2HTML::GLOBAL{'extension'} = "htm";
! 32081: }
! 32082:
! 32083: my $global_pass; # track the phases of processing for debugging output purposes
! 32084:
! 32085: #
! 32086: # file name business
! 32087: #
! 32088:
! 32089: my @created_directories = ();
! 32090:
! 32091: my $docu_dir; # directory of the document
! 32092: my $docu_name; # basename of the document
! 32093: my $docu_rdir; # directory for the output
! 32094: my $docu_toc; # document's table of contents
! 32095: my $docu_stoc; # document's short toc
! 32096: my $docu_foot; # document's footnotes
! 32097: my $docu_about; # about this document
! 32098: my $docu_top; # document top
! 32099: my $docu_doc; # document (or document top of split)
! 32100: my $docu_frame; # main frame file
! 32101: my $docu_toc_frame; # toc frame file
! 32102: my $path_to_working_dir; # relative path leading to the working
! 32103: # directory from the document directory
! 32104: my $docu_doc_file;
! 32105: my $docu_toc_file;
! 32106: my $docu_stoc_file;
! 32107: my $docu_foot_file;
! 32108: my $docu_about_file;
! 32109: my $docu_top_file;
! 32110: my $docu_frame_file;
! 32111: my $docu_toc_frame_file;
! 32112:
! 32113: sub set_docu_names($$)
! 32114: {
! 32115: my $docu_base_name = shift;
! 32116: my $file_nr = shift;
! 32117: if ($docu_base_name =~ /(.*\/)/)
! 32118: {
! 32119: $docu_dir = $1;
! 32120: chop($docu_dir);
! 32121: $docu_name = $docu_base_name;
! 32122: $docu_name =~ s/.*\///;
! 32123: }
! 32124: else
! 32125: {
! 32126: $docu_dir = '.';
! 32127: $docu_name = $docu_base_name;
! 32128: }
! 32129:
! 32130: @Texi2HTML::Config::INCLUDE_DIRS = @include_dirs_orig;
! 32131: my @prependended_include_directories = ('.');
! 32132: push @prependended_include_directories, $Texi2HTML::THISDOC{'input_directory'} if ($Texi2HTML::THISDOC{'input_directory'} ne '.');
! 32133: # as Karl said, adding the destination directory is confusing.
! 32134: #push @prependended_include_directories, $docu_dir if ($docu_dir ne '.' and $docu_dir ne $Texi2HTML::THISDOC{'input_directory'});
! 32135: unshift(@Texi2HTML::Config::INCLUDE_DIRS, @prependended_include_directories);
! 32136: unshift(@Texi2HTML::Config::INCLUDE_DIRS, @Texi2HTML::Config::PREPEND_DIRS);
! 32137: # AAAA
! 32138: if ($Texi2HTML::Config::PREFIX and ($file_nr == 0))
! 32139: {
! 32140: $docu_name = $Texi2HTML::Config::PREFIX;
! 32141: }
! 32142: elsif ($docu_name eq '-')
! 32143: {
! 32144: $docu_name = $Texi2HTML::Config::STDIN_DOCU_NAME;
! 32145: }
! 32146:
! 32147: # subdir
! 32148: $docu_rdir = '';
! 32149: my $null_output;
! 32150: if (defined($Texi2HTML::Config::OUT) and ($file_nr == 0) and $Texi2HTML::Config::null_device_file{$Texi2HTML::Config::OUT})
! 32151: { # this overrides the setting for this file.
! 32152: $Texi2HTML::THISDOC{'SPLIT'} = '';
! 32153: $Texi2HTML::THISDOC{'SPLIT_SIZE'} = undef;
! 32154: $null_output = 1;
! 32155: $path_to_working_dir = $docu_rdir;
! 32156: }
! 32157: if (!$null_output)
! 32158: {
! 32159: if (Texi2HTML::Config::get_conf('SPLIT'))
! 32160: {
! 32161: if (defined($Texi2HTML::Config::OUT) and ($file_nr == 0))
! 32162: {
! 32163: $docu_rdir = $Texi2HTML::Config::OUT;
! 32164: }
! 32165: else
! 32166: {
! 32167: $docu_rdir = $docu_name;
! 32168: }
! 32169: if ($docu_rdir ne '')
! 32170: {
! 32171: $docu_rdir =~ s|/*$||;
! 32172: $docu_rdir .= '/';
! 32173: }
! 32174: }
! 32175: else
! 32176: {
! 32177: my $out_file;
! 32178: # AAAA
! 32179: # even if the out file is not set by OUT, in case it is not the first
! 32180: # file, the out directory is still used. This is only used to determine
! 32181: # the directory, the out file itself is set below
! 32182: if (defined($Texi2HTML::Config::OUT) and $Texi2HTML::Config::OUT ne '')
! 32183: {
! 32184: $out_file = $Texi2HTML::Config::OUT;
! 32185: }
! 32186: else
! 32187: {
! 32188: $out_file = $docu_name;
! 32189: }
! 32190:
! 32191: if ($out_file =~ m|(.*)/|)
! 32192: {# there is a leading directories
! 32193: $docu_rdir = "$1/";
! 32194: }
! 32195: }
! 32196:
! 32197: if ($docu_rdir ne '')
! 32198: {
! 32199: unless (-d $docu_rdir)
! 32200: {
! 32201: if ( mkdir($docu_rdir, oct(755)))
! 32202: {
! 32203: print STDERR "# created directory $docu_rdir\n" if ($T2H_VERBOSE);
! 32204: push @created_directories, $docu_rdir;
! 32205: }
! 32206: else
! 32207: {
! 32208: document_error (sprintf(__("Can't create directory `%s': %s"), $docu_rdir, $!), 1);
! 32209: }
! 32210: }
! 32211: print STDERR "# putting result files into directory $docu_rdir\n" if ($T2H_VERBOSE);
! 32212: }
! 32213: else
! 32214: {
! 32215: print STDERR "# putting result files into current directory \n" if ($T2H_VERBOSE);
! 32216: }
! 32217: # We don't use "./" as $docu_rdir when $docu_rdir is the current directory
! 32218: # because it is problematic for latex2html. To test writability with -w,
! 32219: # however we need a real directory.
! 32220: my $result_rdir = $docu_rdir;
! 32221: $result_rdir = "." if ($docu_rdir eq '');
! 32222: unless (-w $result_rdir)
! 32223: {
! 32224: $docu_rdir = 'current directory' if ($docu_rdir eq '');
! 32225: document_error ("$docu_rdir not writable", 1);
! 32226: }
! 32227:
! 32228: # relative path leading to the working directory from the document directory
! 32229: $path_to_working_dir = $docu_rdir;
! 32230: if ($docu_rdir ne '')
! 32231: {
! 32232: my $cwd = cwd;
! 32233: my $docu_path = $docu_rdir;
! 32234: $docu_path = $cwd . '/' . $docu_path unless ($docu_path =~ /^\//);
! 32235: my @result = ();
! 32236: # this code simplify the paths. The cwd is absolute, while in the
! 32237: # document path there may be some .., a .. is removed with the
! 32238: # previous path element, such that something like
! 32239: # /cwd/directory/../somewhere/
! 32240: # leads to
! 32241: # /cwd/somewhere/
! 32242: # with directory/.. removed
! 32243: foreach my $element (split /\//, File::Spec->canonpath($docu_path))
! 32244: {
! 32245: if ($element eq '')
! 32246: {
! 32247: push @result, '';
! 32248: }
! 32249: elsif ($element eq '..')
! 32250: {
! 32251: if (@result and ($result[-1] eq ''))
! 32252: {
! 32253: print STDERR "Too much .. in absolute file name\n";
! 32254: }
! 32255: elsif (@result and ($result[-1] ne '..'))
! 32256: {
! 32257: pop @result;
! 32258: }
! 32259: else
! 32260: {
! 32261: push @result, $element;
! 32262: }
! 32263: }
! 32264: else
! 32265: {
! 32266: push @result, $element;
! 32267: }
! 32268: }
! 32269: $path_to_working_dir = File::Spec->abs2rel($cwd, join ('/', @result));
! 32270: # this should not be needed given what canonpath does
! 32271: $path_to_working_dir =~ s:/*$::;
! 32272: $path_to_working_dir .= '/' unless($path_to_working_dir eq '');
! 32273: }
! 32274: }
! 32275:
! 32276: my $docu_ext = $Texi2HTML::THISDOC{'extension'};
! 32277: # out_dir is undocummented, should never be used, use destination_directory
! 32278: $Texi2HTML::THISDOC{'out_dir'} = $docu_rdir;
! 32279:
! 32280: $Texi2HTML::THISDOC{'destination_directory'} = $docu_rdir;
! 32281: $Texi2HTML::THISDOC{'file_base_name'} = $docu_name;
! 32282:
! 32283: $docu_doc = $docu_name . (defined($docu_ext) ? ".$docu_ext" : ""); # document's contents
! 32284: if (Texi2HTML::Config::get_conf('SPLIT') and $Texi2HTML::Config::NODE_FILENAMES)
! 32285: {
! 32286: if (defined($Texi2HTML::Config::TOP_NODE_FILE))
! 32287: {
! 32288: $docu_doc = $Texi2HTML::Config::TOP_NODE_FILE;
! 32289: if (defined($Texi2HTML::Config::NODE_FILE_EXTENSION) and $Texi2HTML::Config::NODE_FILE_EXTENSION ne '')
! 32290: {
! 32291: $docu_doc .= ".$Texi2HTML::Config::NODE_FILE_EXTENSION";
! 32292: }
! 32293: }
! 32294: }
! 32295: if (Texi2HTML::Config::get_conf('SPLIT'))
! 32296: {
! 32297: # AAAA
! 32298: if (defined($Texi2HTML::Config::TOP_FILE) and ($Texi2HTML::Config::TOP_FILE ne '') and ($file_nr == 0))
! 32299: {
! 32300: $docu_top = $Texi2HTML::Config::TOP_FILE;
! 32301: }
! 32302: }
! 32303: else
! 32304: {
! 32305: # AAAA
! 32306: if (defined($Texi2HTML::Config::OUT) and ($file_nr == 0))
! 32307: {
! 32308: my $out_file = $Texi2HTML::Config::OUT;
! 32309: if ($out_file eq '-')
! 32310: {
! 32311: $Texi2HTML::THISDOC{'SPLIT'} = '';
! 32312: $Texi2HTML::THISDOC{'SPLIT_SIZE'} = undef;
! 32313: }
! 32314: $out_file =~ s|.*/|| unless ($null_output);
! 32315: $docu_doc = $out_file if ($out_file !~ /^\s*$/);
! 32316: }
! 32317: }
! 32318:
! 32319: if (defined $Texi2HTML::Config::element_file_name)
! 32320: {
! 32321: my $docu_doc_set = &$Texi2HTML::Config::element_file_name
! 32322: (undef, 'doc', $docu_name);
! 32323: $docu_doc = $docu_doc_set if (defined($docu_doc_set));
! 32324: }
! 32325: $docu_top = $docu_doc if (!defined($docu_top));
! 32326:
! 32327: if (Texi2HTML::Config::get_conf('SPLIT') or !$Texi2HTML::Config::MONOLITHIC)
! 32328: {
! 32329: if (defined $Texi2HTML::Config::element_file_name)
! 32330: {
! 32331: $docu_toc = &$Texi2HTML::Config::element_file_name
! 32332: (undef, 'toc', $docu_name);
! 32333: $docu_stoc = &$Texi2HTML::Config::element_file_name
! 32334: (undef, 'stoc', $docu_name);
! 32335: $docu_foot = &$Texi2HTML::Config::element_file_name
! 32336: (undef, 'foot', $docu_name);
! 32337: $docu_about = &$Texi2HTML::Config::element_file_name
! 32338: (undef, 'about', $docu_name);
! 32339: # $docu_top may be overwritten later.
! 32340: }
! 32341: if (!defined($docu_toc))
! 32342: {
! 32343: my $default_toc = "${docu_name}_toc";
! 32344: $default_toc .= ".$docu_ext" if (defined($docu_ext));
! 32345: # AAAA
! 32346: if (defined($Texi2HTML::Config::TOC_FILE) and ($Texi2HTML::Config::TOC_FILE ne '') and ($file_nr == 0))
! 32347: {
! 32348: $docu_toc = $Texi2HTML::Config::TOC_FILE;
! 32349: }
! 32350: else
! 32351: {
! 32352: $docu_toc = $default_toc;
! 32353: }
! 32354: }
! 32355: if (!defined($docu_stoc))
! 32356: {
! 32357: $docu_stoc = "${docu_name}_ovr";
! 32358: $docu_stoc .= ".$docu_ext" if (defined($docu_ext));
! 32359: }
! 32360: if (!defined($docu_foot))
! 32361: {
! 32362: $docu_foot = "${docu_name}_fot";
! 32363: $docu_foot .= ".$docu_ext" if (defined($docu_ext));
! 32364: }
! 32365: if (!defined($docu_about))
! 32366: {
! 32367: $docu_about = "${docu_name}_abt";
! 32368: $docu_about .= ".$docu_ext" if (defined($docu_ext));
! 32369: }
! 32370: }
! 32371: else
! 32372: {
! 32373: $docu_toc = $docu_foot = $docu_stoc = $docu_about = $docu_doc;
! 32374: }
! 32375:
! 32376: # Note that file extension has already been added here.
! 32377: if ($Texi2HTML::Config::FRAMES)
! 32378: {
! 32379: if (defined $Texi2HTML::Config::element_file_name)
! 32380: {
! 32381: $docu_frame = &$Texi2HTML::Config::element_file_name
! 32382: (undef, 'frame', $docu_name);
! 32383: $docu_toc_frame = &$Texi2HTML::Config::element_file_name
! 32384: (undef, 'toc_frame', $docu_name);
! 32385: }
! 32386: }
! 32387:
! 32388: if (!defined($docu_frame))
! 32389: {
! 32390: $docu_frame = "${docu_name}_frame";
! 32391: $docu_frame .= ".$docu_ext" if (defined($docu_ext));
! 32392: }
! 32393: if (!defined($docu_toc_frame))
! 32394: {
! 32395: $docu_toc_frame = "${docu_name}_toc_frame";
! 32396: $docu_toc_frame .= ".$docu_ext" if (defined($docu_ext));
! 32397: }
! 32398:
! 32399: if ($T2H_VERBOSE)
! 32400: {
! 32401: print STDERR "# Files and directories:\n";
! 32402: print STDERR "# rdir($docu_rdir) path_to_working_dir($path_to_working_dir)\n";
! 32403: print STDERR "# doc($docu_doc) top($docu_top) toc($docu_toc) stoc($docu_stoc)\n";
! 32404: print STDERR "# foot($docu_foot) about($docu_about) frame($docu_toc) toc_frame($docu_toc_frame)\n";
! 32405: }
! 32406:
! 32407: $docu_doc_file = "$docu_rdir$docu_doc";
! 32408: $docu_toc_file = "$docu_rdir$docu_toc";
! 32409: $docu_stoc_file = "$docu_rdir$docu_stoc";
! 32410: $docu_foot_file = "$docu_rdir$docu_foot";
! 32411: $docu_about_file = "$docu_rdir$docu_about";
! 32412: $docu_top_file = "$docu_rdir$docu_top";
! 32413: $docu_frame_file = "$docu_rdir$docu_frame";
! 32414: $docu_toc_frame_file = "$docu_rdir$docu_toc_frame";
! 32415:
! 32416: # For use in init files
! 32417: $Texi2HTML::THISDOC{'filename'}->{'top'} = $docu_top;
! 32418: $Texi2HTML::THISDOC{'filename'}->{'foot'} = $docu_foot;
! 32419: $Texi2HTML::THISDOC{'filename'}->{'stoc'} = $docu_stoc;
! 32420: $Texi2HTML::THISDOC{'filename'}->{'about'} = $docu_about;
! 32421: $Texi2HTML::THISDOC{'filename'}->{'toc'} = $docu_toc;
! 32422: $Texi2HTML::THISDOC{'filename'}->{'toc_frame'} = $docu_toc_frame;
! 32423: $Texi2HTML::THISDOC{'filename'}->{'frame'} = $docu_frame;
! 32424: }
! 32425:
! 32426: sub var_to_str($)
! 32427: {
! 32428: return 'UNDEF' if (!defined($_[0]));
! 32429: return $_[0];
! 32430: }
! 32431:
! 32432: #
! 32433: # Common initializations
! 32434: #
! 32435:
! 32436: sub texinfo_initialization($)
! 32437: {
! 32438: my $pass = shift;
! 32439:
! 32440: # set the translations now. This means at the beginning of each pass.
! 32441: # Do it silently, except during the last pass.
! 32442: my $lang = Texi2HTML::Config::get_conf('documentlanguage');
! 32443: my $silent_lang = 1 if ($pass != 2);
! 32444: if (!set_document_language($lang, $silent_lang))
! 32445: {
! 32446: document_warn ("Translations for '$lang' not found. Using 'en'.") unless ($silent_lang);
! 32447: set_document_language('en', $silent_lang);
! 32448: }
! 32449: # All the initialization used the informations still there at the
! 32450: # end of the previous pass.
! 32451: # Now we reset everything, such that things are used when they happen.
! 32452: # also reset the @set/@clear values.
! 32453: %value = %value_initial;
! 32454: foreach my $init_mac ('everyheading', 'everyfooting', 'evenheading',
! 32455: 'evenfooting', 'oddheading', 'oddfooting', 'headings',
! 32456: 'allowcodebreaks', 'frenchspacing', 'exampleindent',
! 32457: 'firstparagraphindent', 'paragraphindent', 'clickstyle',
! 32458: 'novalidate', 'documentlanguage')
! 32459: {
! 32460: Texi2HTML::Config::set_conf($init_mac, undef, 1);
! 32461: }
! 32462: }
! 32463:
! 32464: #+++###########################################################################
! 32465: # #
! 32466: # Pass texi: read source, handle variable, ignored text, #
! 32467: # #
! 32468: #---###########################################################################
! 32469:
! 32470: #my @lines = (); # whole document
! 32471: #my @lines_numbers = (); # line number, originating file associated with
! 32472: # whole document
! 32473: my $macros = undef; # macros. reference on a hash
! 32474: my %info_enclose = (); # macros defined with definfoenclose
! 32475: my @floats = (); # floats list
! 32476: my %floats = (); # floats by style
! 32477:
! 32478: sub initialise_state_texi($)
! 32479: {
! 32480: my $state = shift;
! 32481: $state->{'texi'} = 1; # for substitute_text and close_stack:
! 32482: # 1 if pass_texi/scan_texi is to be used
! 32483: $state->{'macro_inside'} = 0 unless(defined($state->{'macro_inside'}));
! 32484: $state->{'ifvalue_inside'} = 0 unless(defined($state->{'ifvalue_inside'}));
! 32485: $state->{'arg_expansion'} = 0 unless(defined($state->{'arg_expansion'}));
! 32486: $state->{'files_stack'} = [] unless(defined($state->{'files_stack'}));
! 32487: }
! 32488:
! 32489:
! 32490: sub pass_texi($)
! 32491: {
! 32492: my $input_file_name = shift;
! 32493: #my $texi_line_number = { 'file_name' => '', 'line_nr' => 0, 'macro' => '' };
! 32494:
! 32495: my @lines = (); # whole document
! 32496: my @lines_numbers = (); # line number, originating file associated with
! 32497: # whole document
! 32498: my @first_lines = ();
! 32499: my $first_lines = 1; # is it the first lines
! 32500: my $state = {};
! 32501: # holds the informations about the context
! 32502: # to pass it down to the functions
! 32503: my @command_line_lines = @Texi2HTML::Config::COMMANDS;
! 32504: initialise_state_texi($state);
! 32505: my $texi_line_number;
! 32506: ($texi_line_number, $state->{'input_spool'}) =
! 32507: open_file($input_file_name, '', $state->{'files_stack'});
! 32508: my @stack;
! 32509: my $text;
! 32510: my $cline;
! 32511: INPUT_LINE: while (1)
! 32512: {
! 32513: ($cline, $state->{'input_spool'}) = next_line($texi_line_number, $state->{'files_stack'});
! 32514: last if (!defined($cline));
! 32515: #
! 32516: # remove the lines preceding \input or an @-command
! 32517: #
! 32518: if ($first_lines)
! 32519: {
! 32520: if ($cline =~ /^\\input/)
! 32521: {
! 32522: push @first_lines, $cline;
! 32523: $first_lines = 0;
! 32524: next;
! 32525: }
! 32526: if ($cline =~ /^\s*\@/)
! 32527: {
! 32528: $first_lines = 0;
! 32529: }
! 32530: else
! 32531: {
! 32532: push @first_lines, $cline;
! 32533: next;
! 32534: }
! 32535: }
! 32536: #print STDERR "PASS_TEXI($texi_line_number->{'line_nr'})$cline";
! 32537: my $chomped_line = $cline;
! 32538: if (scan_texi ($cline, \$text, \@stack, $state, $texi_line_number) and chomp($chomped_line))
! 32539: {
! 32540: #print STDERR "==> new page (line_nr $texi_line_number->{'line_nr'},$texi_line_number->{'file_name'},$texi_line_number->{'macro'})\n";
! 32541: push (@lines_numbers, { 'file_name' => $texi_line_number->{'file_name'},
! 32542: 'line_nr' => $texi_line_number->{'line_nr'},
! 32543: 'macro' => $texi_line_number->{'macro'} });
! 32544: }
! 32545: #dump_stack (\$text, \@stack, $state);
! 32546: if ($state->{'bye'})
! 32547: {
! 32548: #dump_stack(\$text, \@stack, $state);
! 32549: # close stack after bye
! 32550: #print STDERR "close stack after bye\n";
! 32551: close_stack_texi(\$text, \@stack, $state, $texi_line_number);
! 32552: #dump_stack(\$text, \@stack, $state);
! 32553: }
! 32554: next if (@stack);
! 32555: $cline = $text;
! 32556: $text = '';
! 32557: if (!defined($cline))
! 32558: {
! 32559: msg_debug ("\$cline undefined after scan_texi", $texi_line_number);
! 32560: next unless ($state->{'bye'});
! 32561: }
! 32562: push @lines, split_lines($cline);
! 32563: last if ($state->{'bye'});
! 32564: }
! 32565: # close stack at the end of pass texi
! 32566: #print STDERR "close stack at the end of pass texi\n";
! 32567: close_stack_texi(\$text, \@stack, $state, $texi_line_number);
! 32568: push @lines, split_lines($text);
! 32569: print STDERR "# end of pass texi\n" if $T2H_VERBOSE;
! 32570: return (\@lines, \@first_lines, \@lines_numbers);
! 32571: }
! 32572:
! 32573: #+++###########################################################################
! 32574: # #
! 32575: # Pass structure: parse document structure #
! 32576: # #
! 32577: #---###########################################################################
! 32578:
! 32579: sub initialise_state_structure($)
! 32580: {
! 32581: my $state = shift;
! 32582: $state->{'structure'} = 1; # for substitute_text and close_stack:
! 32583: # 1 if pass_structure/scan_structure is
! 32584: # to be used
! 32585: $state->{'menu'} = 0; # number of opened menus
! 32586: $state->{'detailmenu'} = 0; # number of opened detailed menus
! 32587: $state->{'direntry'} = 0; # number of opened direntry
! 32588: $state->{'sectionning_base'} = 0; # current base sectioning level
! 32589: $state->{'table_stack'} = [ "no table" ]; # a stack of opened tables/lists
! 32590: # seems to be only debug
! 32591: if (exists($state->{'region_lines'}) and !defined($state->{'region_lines'}))
! 32592: {
! 32593: delete ($state->{'region_lines'});
! 32594: print STDERR "Bug: state->{'region_lines'} exists but undef.\n";
! 32595: }
! 32596: }
! 32597: # This is a virtual element for things appearing before @node and
! 32598: # sectioning commands
! 32599: my $element_before_anything;
! 32600:
! 32601: #
! 32602: # initial counters. Global variables for pass_structure.
! 32603: #
! 32604: my $document_idx_num;
! 32605: my $document_sec_num;
! 32606: my $document_head_num;
! 32607: my $document_anchor_num;
! 32608:
! 32609: # section to level hash taking into account raise and lower sections.
! 32610: # Reset at document beginning
! 32611: my %sec2level;
! 32612: # initial state for the special regions.
! 32613: my %region_initial_state;
! 32614: my %region_lines;
! 32615: my %region_line_nrs;
! 32616:
! 32617: # This is a place for index entries, anchors and so on appearing in
! 32618: # copying or documentdescription
! 32619: my $no_element_associated_place;
! 32620:
! 32621:
! 32622: my @nodes_list; # nodes in document reading order
! 32623: # each member is a reference on a hash
! 32624: my @sections_list; # sections in reading order
! 32625: # each member is a reference on a hash
! 32626: my @all_elements; # sectioning elements (nodes and sections)
! 32627: # in reading order. Each member is a reference
! 32628: # on a hash which also appears in %nodes,
! 32629: # @sections_list @nodes_list, @elements_list
! 32630: my @elements_list; # all the resulting elements in document order
! 32631: my %sections; # sections hash. The key is the section number
! 32632: my %headings; # headings hash. The key is the heading number
! 32633: my $section_top; # @top section
! 32634: my $element_top; # Top element
! 32635: my $node_top; # Top node
! 32636: my $node_first; # First node
! 32637: my $element_index; # element with first index
! 32638: my $element_chapter_index; # chapter with first index
! 32639: my $element_first; # first element
! 32640: my $element_last; # last element
! 32641: my %special_commands; # hash for the commands specially handled
! 32642: # by the user
! 32643:
! 32644: # element for content and shortcontent if on a separate page
! 32645: my %content_element;
! 32646: my %reference_content_element =
! 32647: (
! 32648: 'contents' => { 'id' => $Texi2HTML::Config::misc_pages_targets{'Contents'},
! 32649: 'target' => $Texi2HTML::Config::misc_pages_targets{'Contents'},
! 32650: 'contents' => 1, 'texi' => '_contents' },
! 32651: 'shortcontents' => {
! 32652: 'id' => $Texi2HTML::Config::misc_pages_targets{'Overview'},
! 32653: 'target' => $Texi2HTML::Config::misc_pages_targets{'Overview'},
! 32654: 'shortcontents' => 1, 'texi' => '_shortcontents' },
! 32655: );
! 32656:
! 32657: # holds content elements located with @*contents commands
! 32658: my %all_content_elements;
! 32659:
! 32660: # common code for headings and sections
! 32661: sub new_section_heading($$$$)
! 32662: {
! 32663: my $command = shift;
! 32664: my $name = shift;
! 32665: my $state = shift;
! 32666: my $line_nr = shift;
! 32667:
! 32668: $name = trim_comment_spaces ($name, "\@$command", $line_nr);
! 32669: $name = normalise_texi_space($name);
! 32670: $name = '' if (!defined($name));
! 32671: # no increase if in @copying and the like. Also no increase if it is top
! 32672: # since top has number 0.
! 32673: my $docid;
! 32674: my $num;
! 32675:
! 32676: my $section_ref = { 'texi' => $name,
! 32677: 'level' => $sec2level{$command},
! 32678: 'tag' => $command,
! 32679: };
! 32680: return $section_ref;
! 32681: }
! 32682:
! 32683: sub scan_line_separators($$$;$)
! 32684: {
! 32685: my $line = shift;
! 32686: my $separators = shift;
! 32687: my $context = shift;
! 32688: my $line_nr = shift;
! 32689:
! 32690: my @command_stack;
! 32691: my $result = '';
! 32692: while (1)
! 32693: {
! 32694: # macro_regexp
! 32695: if ($line =~ s/^([^{}\@$separators]*)\@(["'~\@\}\{,\.!\?\s\*\-\^`=:\|\/\\])// or $line =~ s/^([^{}\@$separators]*)\@([a-zA-Z][\w-]*)//)
! 32696: {
! 32697: $result .= $1;
! 32698: my $command = $2;
! 32699: $command = $alias{$command} if (exists($alias{$command}));
! 32700: if (defined($Texi2HTML::Config::misc_command{$command}))
! 32701: {
! 32702: if ($command ne 'c' and $command ne 'comment')
! 32703: { # misc commands other than comments are kept as-is, only
! 32704: # comments are removed.
! 32705: my ($text, $args);
! 32706: ($line, $text, $args) = &$Texi2HTML::Config::preserve_misc_command($line, $command);
! 32707: $result .= "\@$command".$text;
! 32708: next;
! 32709: }
! 32710: else
! 32711: {
! 32712: $line =~ s/.*//;
! 32713: return ($result, $line, undef);
! 32714: }
! 32715: }
! 32716: $result .= "\@$command";
! 32717: if ($line =~ s/^{//)
! 32718: {
! 32719: push @command_stack, $command;
! 32720: $result .= '{';
! 32721: }
! 32722: if ($command eq 'verb')
! 32723: {
! 32724: if ($line =~ s/^(.)//)
! 32725: {
! 32726: my $char = $1;
! 32727: my $verb_char = quotemeta($char);
! 32728: if ($line =~ s/^(.*?${verb_char}\})//)
! 32729: {
! 32730: $result .= $char.$1;
! 32731: }
! 32732: else
! 32733: {
! 32734: $line =~ s/^(.*)//;
! 32735: $result .= $char . $1;
! 32736: return ($result, $line, undef);
! 32737: }
! 32738: }
! 32739: else
! 32740: {
! 32741: return ($result, $line, undef);
! 32742: }
! 32743: pop @command_stack;
! 32744: }
! 32745: }
! 32746: elsif ($line =~ s/^([^\{\}$separators]*)([{}])//)
! 32747: {
! 32748: $result .= $1 . $2;
! 32749: my $brace = $2;
! 32750: if (@command_stack and $brace eq '}')
! 32751: {
! 32752: pop @command_stack;
! 32753: }
! 32754: }
! 32755: elsif ($separators ne '' and $line =~ s/^([^${separators}]*)([$separators])//)
! 32756: {
! 32757: $result .= $1;
! 32758: my $separator = $2;
! 32759: if (@command_stack)
! 32760: {
! 32761: $result .= $separator;
! 32762: }
! 32763: else
! 32764: {
! 32765: return ($result, $line, $separator);
! 32766: }
! 32767: }
! 32768: else
! 32769: {
! 32770: $result .= $line;
! 32771: $line = '';
! 32772: return ($result, $line, undef);
! 32773: }
! 32774: }
! 32775: }
! 32776:
! 32777: sub trim_comment_spaces($$;$)
! 32778: {
! 32779: my $line = shift;
! 32780: my $context = shift;
! 32781: my $line_nr = shift;
! 32782:
! 32783: if(!defined($line))
! 32784: {
! 32785: msg_debug("trim_comment_spaces: $context: line undef", $line_nr);
! 32786: return undef;
! 32787: }
! 32788: my ($arg, $remaining, $separator) = scan_line_separators ($line, '', $context, $line_nr);
! 32789: #msg_debug ("trim_comment_spaces: $context: arg undef. $line", $line_nr) if (!defined($arg));
! 32790: #msg_debug ("trim_comment_spaces: $context: $arg !!! $line", $line_nr);
! 32791: return $arg if (!defined($arg));
! 32792: return trim_around_spaces($arg);
! 32793: }
! 32794:
! 32795: # argument may be the number of arguments when the commas in the last
! 32796: # argument has no specific meaning. When it is undef it means that
! 32797: # all the arguments have to be parsed
! 32798: sub parse_line_arguments($$$;$)
! 32799: {
! 32800: my $line = shift;
! 32801: my $arg_total_nr = shift;
! 32802: my $context = shift;
! 32803: my $line_nr = shift;
! 32804:
! 32805: my @args;
! 32806: my $arg_nr = 0;
! 32807: my $remaining = $line;
! 32808:
! 32809: while (!defined($arg_total_nr) or $arg_nr < $arg_total_nr -1)
! 32810: {
! 32811: my ($arg, $separator);
! 32812: ($arg, $remaining, $separator) = scan_line_separators($remaining, ',', $context, $line_nr);
! 32813: push @args, trim_around_spaces($arg) if (defined($arg));
! 32814: return @args if (!defined($separator) or !defined($remaining) or !defined($arg));
! 32815: $arg_nr++;
! 32816: }
! 32817: if (defined($arg_total_nr))
! 32818: {
! 32819: my ($last_arg, $separator);
! 32820: ($last_arg, $remaining, $separator) = scan_line_separators($remaining, '', $context, $line_nr);
! 32821: push @args, trim_around_spaces($last_arg) if (defined($last_arg));
! 32822: }
! 32823: return @args;
! 32824: }
! 32825:
! 32826: sub pass_structure($$)
! 32827: {
! 32828: my $texi_lines = shift;
! 32829: my $lines_numbers = shift;
! 32830:
! 32831: my @doc_lines; # whole document
! 32832: my @doc_numbers; # whole document line numbers and file names
! 32833:
! 32834: my $state = {};
! 32835: # holds the informations about the context
! 32836: # to pass it down to the functions
! 32837: initialise_state_structure($state);
! 32838: $state->{'heading_element'} = $element_before_anything;
! 32839: $state->{'current_element'} = $element_before_anything;
! 32840: $state->{'place'} = $element_before_anything->{'place'};
! 32841: my @stack;
! 32842: my $text;
! 32843: my $line_nr;
! 32844:
! 32845: while (@$texi_lines or $state->{'in_deff_line'})
! 32846: {
! 32847: my $cline = shift @$texi_lines;
! 32848: my $chomped_line = $cline;
! 32849: if (@$texi_lines and !chomp($chomped_line))
! 32850: {
! 32851: $texi_lines->[0] = $cline . $texi_lines->[0];
! 32852: next;
! 32853: }
! 32854: # !defined($cline) may happen if $state->{'in_deff_line'} is true
! 32855: # but there is no more line, in case the last end of line is
! 32856: # protected
! 32857: $line_nr = shift (@$lines_numbers) unless (!defined($cline));
! 32858:
! 32859: if ($state->{'in_deff_line'})
! 32860: { # line stored in $state->{'in_deff_line'} was protected by @
! 32861: # and can be concatenated with the next line
! 32862: if (defined($cline))
! 32863: {
! 32864: $cline = $state->{'in_deff_line'} . $cline;
! 32865: }
! 32866: else
! 32867: {# end of line protected at the very end of the file
! 32868: # in that case there is also no line_nr anymore.
! 32869: $cline = $state->{'in_deff_line'};
! 32870: }
! 32871: delete $state->{'in_deff_line'};
! 32872: }
! 32873:
! 32874: #print STDERR "PASS_STRUCTURE($line_nr->{'line_nr'}. raw:".var_to_str($state->{'raw'}).", verb:".var_to_str($state->{'verb'})."): $cline";
! 32875: if (!$state->{'raw'} and !$state->{'verb'})
! 32876: {
! 32877: my $tag = '';
! 32878: if ($cline =~ /^\s*\@(\w+)\b/)
! 32879: {
! 32880: $tag = $1;
! 32881: }
! 32882:
! 32883: #
! 32884: # analyze the tag
! 32885: #
! 32886: if ($tag and $tag eq 'node' or (defined($sec2level{$tag}) and ($tag !~ /heading/)) or ($tag eq 'insertcopying' and $Texi2HTML::Config::INLINE_INSERTCOPYING))
! 32887: {
! 32888: my @added_lines = ($cline);
! 32889: my @added_numbers = ($line_nr);
! 32890: if ($tag eq 'node' or defined($sec2level{$tag}))
! 32891: {# in pass structure node shouldn't appear in formats
! 32892: close_stack_structure(\$text, \@stack, $state, $line_nr);
! 32893: if (exists($state->{'region_lines'}))
! 32894: {
! 32895: push @{$region_lines{$state->{'region_lines'}->{'format'}}}, split_lines($text);
! 32896: push @doc_lines, split_lines($text) if ($Texi2HTML::Config::region_formats_kept{$state->{'region_lines'}->{'format'}});
! 32897: $state->{'region_lines'}->{'number'} = 0;
! 32898: close_region($state);
! 32899: }
! 32900: else
! 32901: {
! 32902: push @doc_lines, split_lines($text);
! 32903: }
! 32904: $text = '';
! 32905: }
! 32906: if ($tag eq 'node')
! 32907: {
! 32908: my $node_ref;
! 32909: my $auto_directions;
! 32910: my $node_line = $cline;
! 32911: $node_line =~ s/^\@node\s*//;
! 32912: my @node_res = parse_line_arguments($node_line, undef, '@node', $line_nr);
! 32913: @node_res = normalise_node_array (\@node_res);
! 32914: # even for empty nodes, @nodes_res has one element.
! 32915: #line_error (sprintf(__("Error scanning %s"), $cline), $line_nr) if (@node_res < 1);
! 32916: $auto_directions = 1 if (scalar(@node_res) == 1);
! 32917: if (@node_res > 4)
! 32918: {
! 32919: line_warn(__("Superfluous arguments for node"), $line_nr);
! 32920: }
! 32921: my ($node, $node_next, $node_prev, $node_up) = @node_res;
! 32922: if (defined($node) and ($node ne ''))
! 32923: {
! 32924: if (exists($nodes{$node}) and defined($nodes{$node})
! 32925: and $nodes{$node}->{'seen'})
! 32926: {
! 32927: line_error (sprintf(__("Node `%s' previously defined %s"), $node, format_line_number($nodes{$node}->{'line_nr'})), $line_nr);
! 32928: next;
! 32929: }
! 32930: elsif ($node =~ /^\(.+\)/)
! 32931: {
! 32932: line_error (sprintf(__("Syntax for an external node used for `%s'"), $node), $line_nr);
! 32933: next;
! 32934: }
! 32935: else
! 32936: {
! 32937: if (exists($nodes{$node}) and defined($nodes{$node}))
! 32938: { # node appeared in a menu
! 32939: $node_ref = $nodes{$node};
! 32940: }
! 32941: else
! 32942: {
! 32943: $node_ref = {};
! 32944: $nodes{$node} = $node_ref;
! 32945: }
! 32946: $node_ref->{'node'} = 1;
! 32947: $node_ref->{'tag'} = 'node';
! 32948: $node_ref->{'tag_level'} = 'node';
! 32949: $node_ref->{'texi'} = $node;
! 32950: $node_ref->{'seen'} = 1;
! 32951: $node_ref->{'automatic_directions'} = $auto_directions;
! 32952: $node_ref->{'place'} = [];
! 32953: $node_ref->{'current_place'} = [];
! 32954: $node_ref->{'line_nr'} = $line_nr;
! 32955: merge_element_before_anything($node_ref);
! 32956: $node_ref->{'index_names'} = [];
! 32957: $state->{'place'} = $node_ref->{'current_place'};
! 32958: $state->{'heading_element'} = $node_ref;
! 32959: $state->{'current_element'} = $node_ref;
! 32960: $state->{'node_ref'} = $node_ref;
! 32961: $state->{'menu_in_node'} = 0;
! 32962: # makeinfo treats differently case variants of
! 32963: # top in nodes and anchors and in refs commands and
! 32964: # refs from nodes.
! 32965: if ($node =~ /^top$/i)
! 32966: {
! 32967: if (!defined($node_top))
! 32968: {
! 32969: $node_top = $node_ref;
! 32970: $node_top->{'texi'} = 'Top';
! 32971: delete $nodes{$node};
! 32972: $nodes{$node_top->{'texi'}} = $node_ref;
! 32973: }
! 32974: else
! 32975: { # All the refs are going to point to the first Top
! 32976: line_warn ("Top node already exists", $line_nr);
! 32977: }
! 32978: }
! 32979: unless (@nodes_list)
! 32980: {
! 32981: $node_first = $node_ref;
! 32982: }
! 32983: push (@nodes_list, $node_ref);
! 32984: push @all_elements, $node_ref;
! 32985: }
! 32986: }
! 32987: else
! 32988: {
! 32989: line_error ("Empty node", $line_nr);
! 32990: next;
! 32991: }
! 32992:
! 32993: if (defined($node_next) and ($node_next ne ''))
! 32994: {
! 32995: $node_ref->{'node_next'} = $node_next;
! 32996: }
! 32997: if (defined($node_prev) and ($node_prev ne ''))
! 32998: {
! 32999: $node_ref->{'node_prev'} = $node_prev;
! 33000: }
! 33001: if (defined($node_up) and ($node_up ne ''))
! 33002: {
! 33003: $node_ref->{'node_up'} = $node_up;
! 33004: }
! 33005: }
! 33006: elsif (defined($sec2level{$tag}))
! 33007: { # section
! 33008: if ($cline =~ /^\@$tag\s*(.*)$/)
! 33009: {
! 33010: my $name = $1;
! 33011: my $section_ref = new_section_heading($tag, $name, $state, $line_nr);
! 33012: $document_sec_num++ if ($tag ne 'top');
! 33013:
! 33014: $section_ref->{'sec_num'} = $document_sec_num;
! 33015: $section_ref->{'id'} = "SEC$document_sec_num";
! 33016: $section_ref->{'seen'} = 1;
! 33017: $section_ref->{'index_names'} = [];
! 33018: $section_ref->{'current_place'} = [];
! 33019: $section_ref->{'place'} = [];
! 33020: $section_ref->{'section'} = 1;
! 33021: $section_ref->{'line_nr'} = $line_nr;
! 33022:
! 33023: if ($tag eq 'top')
! 33024: {
! 33025: $section_ref->{'number'} = '';
! 33026: $section_ref->{'id'} = "SEC_Top";
! 33027: $section_ref->{'sec_num'} = 0;
! 33028: if (defined($section_top))
! 33029: {
! 33030: line_error ("\@top already exists", $line_nr);
! 33031: $sections{0} = $section_ref;
! 33032: }
! 33033: else
! 33034: {
! 33035: $sections{0.1} = $section_ref;
! 33036: }
! 33037: $section_top = $section_ref;
! 33038: }
! 33039: else
! 33040: {
! 33041: $sections{$section_ref->{'sec_num'}} = $section_ref;
! 33042: }
! 33043: merge_element_before_anything($section_ref);
! 33044: if ($state->{'node_ref'})
! 33045: {
! 33046: $section_ref->{'node_ref'} = $state->{'node_ref'};
! 33047: push @{$state->{'node_ref'}->{'sections'}}, $section_ref;
! 33048: }
! 33049: if ($state->{'node_ref'} and !exists($state->{'node_ref'}->{'with_section'}))
! 33050: {
! 33051: my $node_ref = $state->{'node_ref'};
! 33052: $section_ref->{'with_node'} = $node_ref;
! 33053: $section_ref->{'titlefont'} = $node_ref->{'titlefont'};
! 33054: $node_ref->{'with_section'} = $section_ref;
! 33055: }
! 33056: if (! $name and $section_ref->{'level'})
! 33057: {
! 33058: line_warn (sprintf(__("\@%s requires an argument"), $tag), $line_nr);
! 33059: }
! 33060: push @sections_list, $section_ref;
! 33061: push @all_elements, $section_ref;
! 33062: $state->{'heading_element'} = $section_ref;
! 33063: $state->{'current_element'} = $section_ref;
! 33064: $state->{'place'} = $section_ref->{'current_place'};
! 33065: ################# debug
! 33066: my $node_ref = "NO NODE";
! 33067: my $node_texi ='';
! 33068: if ($state->{'node_ref'})
! 33069: {
! 33070: $node_ref = $state->{'node_ref'};
! 33071: $node_texi = $state->{'node_ref'}->{'texi'};
! 33072: }
! 33073: print STDERR "# pass_structure node($node_ref)$node_texi, tag \@$tag($section_ref->{'level'}) ref $section_ref, num,id $section_ref->{'sec_num'},$section_ref->{'id'}\n $name\n"
! 33074: if $T2H_DEBUG & $DEBUG_ELEMENTS;
! 33075: ################# end debug
! 33076: }
! 33077: }
! 33078: elsif ($cline =~ /^\@insertcopying\s*/)
! 33079: {
! 33080: @added_lines = @{$region_lines{'copying'}};
! 33081: @added_numbers = @{$region_line_nrs{'copying'}};
! 33082: unshift (@$texi_lines, @added_lines);
! 33083: unshift (@$lines_numbers, @added_numbers);
! 33084: next;
! 33085: }
! 33086: if (exists($state->{'region_lines'}))
! 33087: {
! 33088: push @{$region_lines{$state->{'region_lines'}->{'format'}}}, @added_lines;
! 33089: if ($Texi2HTML::Config::region_formats_kept{$state->{'region_lines'}->{'format'}})
! 33090: { # the region is kept in the document in addition with
! 33091: # being put in the appropriate region_lines entry.
! 33092: push @doc_lines, @added_lines;
! 33093: push @doc_numbers, @added_numbers;
! 33094: }
! 33095: }
! 33096: else
! 33097: {
! 33098: push @doc_lines, @added_lines;
! 33099: push @doc_numbers, @added_numbers;
! 33100: }
! 33101: next;
! 33102: }
! 33103: }
! 33104: if (scan_structure ($cline, \$text, \@stack, $state, $line_nr))
! 33105: {
! 33106: if (!exists($state->{'region_lines'}) or $Texi2HTML::Config::region_formats_kept{$state->{'region_lines'}->{'format'}})
! 33107: {
! 33108: push (@doc_numbers, $line_nr);
! 33109: }
! 33110: if (exists($state->{'region_lines'}))
! 33111: {
! 33112: push @{$region_line_nrs{$state->{'region_lines'}->{'format'}}}, $line_nr unless ($state->{'region_lines'}->{'first_line'});
! 33113: }
! 33114: }
! 33115: next if (scalar(@stack) or $state->{'in_deff_line'});
! 33116: $cline = $text;
! 33117: $text = '';
! 33118: next if (!defined($cline));
! 33119: if ($state->{'region_lines'})
! 33120: {
! 33121: # the first line is like @copying, it is not put in the region
! 33122: # lines
! 33123: push @{$region_lines{$state->{'region_lines'}->{'format'}}}, split_lines($cline) unless ($state->{'region_lines'}->{'first_line'});
! 33124: delete $state->{'region_lines'}->{'first_line'};
! 33125: push @doc_lines, split_lines($cline) if ($Texi2HTML::Config::region_formats_kept{$state->{'region_lines'}->{'format'}});
! 33126: }
! 33127: else
! 33128: {
! 33129: push @doc_lines, split_lines($cline);
! 33130: }
! 33131: }
! 33132: if (@stack)
! 33133: {# close stack at the end of pass structure
! 33134: close_stack_structure(\$text, \@stack, $state, $line_nr);
! 33135: if ($text)
! 33136: {
! 33137: if (!exists($state->{'region_lines'}) or $Texi2HTML::Config::region_formats_kept{$state->{'region_lines'}->{'format'}})
! 33138: {
! 33139: push @doc_lines, split_lines($text);
! 33140: }
! 33141: if (exists($state->{'region_lines'}))
! 33142: {
! 33143: push @{$region_lines{$state->{'region_lines'}->{'format'}}},
! 33144: split_lines($text);
! 33145: }
! 33146: }
! 33147: }
! 33148: #line_warn ("Expected $state->{'region_lines'}->{'number'} \@end $state->{'region_lines'}->{'format'}", $line_nr) if (exists($state->{'region_lines'}));
! 33149: line_error (sprintf(__("Expected \@end %s"), $state->{'region_lines'}->{'format'}), $line_nr) if (exists($state->{'region_lines'}));
! 33150: print STDERR "# end of pass structure\n" if $T2H_VERBOSE;
! 33151: # To remove once they are handled
! 33152: #print STDERR "No node nor section, texi2html won't be able to place things rightly\n" if ($element_before_anything->{'place'} and @{$element_before_anything->{'place'}});
! 33153: return (\@doc_lines, \@doc_numbers);
! 33154: }
! 33155:
! 33156: # split line at end of line and put each resulting line in an array
! 33157: # FIXME there must be a more perlish way to do it... Not a big deal
! 33158: # as long as it work
! 33159: sub split_lines($)
! 33160: {
! 33161: my $line = shift;
! 33162: my @result = ();
! 33163: return @result if (!defined($line));
! 33164: my $i = 0;
! 33165: while ($line ne '')
! 33166: {
! 33167: $result[$i] = '';
! 33168: $line =~ s/^(.*)//;
! 33169: $result[$i] .= $1;
! 33170: $result[$i] .= "\n" if ($line =~ s/^\n//);
! 33171: #print STDERR "$i: $result[$i]";
! 33172: $i++;
! 33173: }
! 33174: return @result;
! 33175: }
! 33176:
! 33177: # handle @documentlanguage
! 33178: sub do_documentlanguage($$$$)
! 33179: {
! 33180: my $command = shift;
! 33181: my $line = shift;
! 33182: my $silent = shift;
! 33183: my $line_nr = shift;
! 33184: my $language_change_succes = 0;
! 33185: if ($line =~ s/\s+(\w+)\s*//)
! 33186: {
! 33187: my $lang = $1;
! 33188: my $prev_lang = Texi2HTML::Config::get_conf('documentlanguage');
! 33189: # This won't be done if the documentlanguage was set on the command line
! 33190: if (Texi2HTML::Config::set_conf('documentlanguage', $lang, 1))
! 33191: {
! 33192: warn_unknown_language ($lang, $line_nr) unless ($silent);
! 33193: $language_change_succes = set_document_language($lang, $silent, $line_nr);
! 33194: if (!$language_change_succes)
! 33195: { # reset previous documentlanguage
! 33196: Texi2HTML::Config::set_conf('documentlanguage', $prev_lang, 1);
! 33197: line_warn (sprintf(__("Translations for `%s' not found. Reverting to `%s'"),$lang, $prev_lang), $line_nr) unless ($silent);
! 33198: }
! 33199: }
! 33200: # FIXME warn about stuff remaining on the line?
! 33201: }
! 33202: return $language_change_succes;
! 33203: }
! 33204:
! 33205: # actions that should be done in more than one pass. In fact most are not
! 33206: # to be done in pass_texi. The $pass argument is the number of the pass,
! 33207: # 0 for pass_texi, 1 for pass_structure, 2 for pass_text
! 33208: sub common_misc_commands($$$$)
! 33209: {
! 33210: my $command = shift;
! 33211: my $line = shift;
! 33212: my $pass = shift;
! 33213: my $line_nr = shift;
! 33214:
! 33215: # for error messages
! 33216: my $cline = $line;
! 33217: chomp($cline);
! 33218: $cline =~ s/^\s*//;
! 33219:
! 33220: # track variables
! 33221: if ($command eq 'set')
! 33222: {
! 33223: if ($line =~ /^(\s+)($VARRE)(\s+)(.*)$/)
! 33224: {
! 33225: $value{$2} = $4;
! 33226: }
! 33227: else
! 33228: {
! 33229: line_error (sprintf(__("%c%s requires a name"), ord('@'), $command), $line_nr) if (!$pass);
! 33230: }
! 33231: }
! 33232: elsif ($command eq 'clear')
! 33233: {
! 33234: if ($line =~ /^(\s+)($VARRE)/)
! 33235: {
! 33236: delete $value{$2};
! 33237: }
! 33238: else
! 33239: {
! 33240: line_error (sprintf(__("%c%s requires a name"), ord('@'), $command), $line_nr) if (!$pass);
! 33241: }
! 33242: }
! 33243: elsif ($command eq 'clickstyle')
! 33244: {
! 33245: if ($line =~ s/^\s+@([^\s\{\}\@]+)({})?\s*//)
! 33246: {
! 33247: $Texi2HTML::THISDOC{$command} = $1;
! 33248: # FIXME warn about what remains on the line?
! 33249: }
! 33250: else
! 33251: {
! 33252: line_error (sprintf(__("\@%s should only accept a \@-command as argument, not `%s'"), $command, $cline), $line_nr) if ($pass == 1);
! 33253: }
! 33254: }
! 33255: elsif ($command eq 'novalidate')
! 33256: {
! 33257: Texi2HTML::Config::set_conf($command, 1, 1);
! 33258: }
! 33259: if ($pass)
! 33260: { # these commands are only taken into account here in pass_structure 1
! 33261: # and pass_text 2
! 33262: if ($command eq 'setfilename')
! 33263: {
! 33264: my $filename = trim_comment_spaces($line, "\@$command");
! 33265: $filename = substitute_line($filename, "\@$command",{'code_style' => 1, 'remove_texi' => 1});
! 33266: if ($filename ne '')
! 33267: {
! 33268: Texi2HTML::Config::set_conf($command, $filename, 1);
! 33269: }
! 33270: }
! 33271: elsif ($command eq 'paragraphindent')
! 33272: {
! 33273: if ($line =~ /\s+([\w\-]+)[^\w\-]/)
! 33274: {
! 33275: set_paragraphindent ($1, 0, $line_nr, $pass);
! 33276: }
! 33277: else
! 33278: {
! 33279: set_paragraphindent ($line, 0, $line_nr, $pass);
! 33280: }
! 33281: }
! 33282: elsif ($command eq 'firstparagraphindent')
! 33283: {
! 33284: if (($line =~ /^\s+(none)[^\w\-]/) or ($line =~ /^\s+(insert)[^\w\-]/))
! 33285: {
! 33286: Texi2HTML::Config::set_conf($command, $1, 1);
! 33287: }
! 33288: else
! 33289: {
! 33290: line_error (sprintf(__("\@firstparagraphindent arg must be `none' or `insert', not `%s'"), $cline), $line_nr) if ($pass == 1);
! 33291: }
! 33292: }
! 33293: elsif ($command eq 'exampleindent')
! 33294: {
! 33295: if ($line =~ /^\s+([0-9]+)/)
! 33296: {
! 33297: $Texi2HTML::THISDOC{$command} = $1;
! 33298: }
! 33299: elsif ($line =~ /^\s+(asis)[^\w\-]/)
! 33300: {
! 33301: $Texi2HTML::THISDOC{$command} = $1;
! 33302: }
! 33303: else
! 33304: {
! 33305: line_error (sprintf(__("\@exampleindent arg must be numeric/`asis', not `%s'"), $cline), $line_nr) if ($pass == 1);
! 33306: }
! 33307: }
! 33308: elsif ($command eq 'frenchspacing')
! 33309: {
! 33310: if (($line =~ /^\s+(on)[^\w\-]/) or ($line =~ /^\s+(off)[^\w\-]/))
! 33311: {
! 33312: Texi2HTML::Config::set_conf($command, $1, 1);
! 33313: }
! 33314: else
! 33315: {
! 33316: line_error (sprintf(__("Expected \@%s on or off, not `%s'"), $command, $cline), $line_nr) if ($pass == 1);
! 33317: }
! 33318: }
! 33319: elsif ($command eq 'kbdinputstyle')
! 33320: {
! 33321: if ($line =~ /\s+([a-z]+)/ and ($1 eq 'code' or $1 eq 'example' or $1 eq 'distinct'))
! 33322: {
! 33323: Texi2HTML::Config::set_conf($command, $1, 1);
! 33324: }
! 33325: else
! 33326: {
! 33327: line_error (sprintf(__("\@kbdinputstyle arg must be `code'/`example'/`distinct', not `%s'"), $cline), $line_nr) if ($pass == 1);
! 33328: }
! 33329: }
! 33330: elsif (grep {$command eq $_} ('everyheading', 'everyfooting',
! 33331: 'evenheading', 'evenfooting', 'oddheading', 'oddfooting'))
! 33332: { # FIXME have a _texi and without texi, and without texi,
! 33333: # and expand rightly @this*? And use @| to separate, and give
! 33334: # an array for user consumption? This should be done for each new
! 33335: # chapter, section, and page. What is a page is not necessarily
! 33336: # well defined in html, however...
! 33337: # @thisfile is the @include file. Should be in $line_nr.
! 33338:
! 33339: # Also if that command appears in the texi, the error message is
! 33340: # Unknown command `@evenheading'
! 33341: # It could be better.
! 33342: my $arg = $line;
! 33343: $arg =~ s/^\s+//;
! 33344: $Texi2HTML::THISDOC{$command} = $arg;
! 33345: }
! 33346: elsif ($command eq 'allowcodebreaks')
! 33347: {
! 33348: if (($line =~ /^\s+(true)[^\w\-]/) or ($line =~ /^\s+(false)[^\w\-]/))
! 33349: {
! 33350: Texi2HTML::Config::set_conf($command, $1, 1);
! 33351: }
! 33352: else
! 33353: {
! 33354: line_error (sprintf(__("\@allowcodebreaks arg must be `true' or `false', not `%s'"), $cline), $line_nr) if ($pass == 1);
! 33355: }
! 33356: }
! 33357: elsif ($command eq 'headings')
! 33358: {
! 33359: my $valid_arg = 0;
! 33360: foreach my $possible_arg (('off','on','single','double',
! 33361: 'singleafter','doubleafter'))
! 33362: {
! 33363: if ($line =~ /^\s+($possible_arg)[^\w\-]/)
! 33364: {
! 33365: $valid_arg = 1;
! 33366: $Texi2HTML::THISDOC{$command} = $possible_arg;
! 33367: last;
! 33368: }
! 33369: }
! 33370: unless ($valid_arg)
! 33371: {
! 33372: line_error (sprintf(__("Bad argument to \@%s: %s"), $command, $cline), $line_nr) if ($pass == 1);
! 33373: }
! 33374: }
! 33375: elsif ($command eq 'documentlanguage')
! 33376: {
! 33377: if (do_documentlanguage($command, $line, $pass -1, $line_nr))
! 33378: {
! 33379: &$Texi2HTML::Config::translate_names();
! 33380: set_special_names();
! 33381: }
! 33382: }
! 33383: }
! 33384: }
! 33385:
! 33386: sub misc_command_texi($$$$)
! 33387: {
! 33388: my $line = shift;
! 33389: my $command = shift;
! 33390: my $state = shift;
! 33391: my $line_nr = shift;
! 33392: my $text;
! 33393: my $args;
! 33394: my $cline = $line;
! 33395:
! 33396: if (!$state->{'ignored'} and !$state->{'arg_expansion'})
! 33397: {
! 33398: if ($command eq 'documentencoding')
! 33399: { # FIXME accept more characters, like @?
! 33400: if ($cline =~ s/^(\s+)([\w\-]+)//)
! 33401: {
! 33402: my $encoding = $2;
! 33403: $Texi2HTML::THISDOC{'documentencoding'} = $encoding;
! 33404: line_warn(sprintf(__("Encoding %s is not a canonical texinfo encoding"), $encoding), $line_nr)
! 33405: if (!$Texi2HTML::Config::canonical_texinfo_encodings{lc($encoding)});
! 33406: if (Texi2HTML::Config::set_conf('DOCUMENT_ENCODING', $Texi2HTML::THISDOC{'documentencoding'}, 1))
! 33407: {
! 33408: my $from_encoding;
! 33409: if (!defined($Texi2HTML::Config::IN_ENCODING))
! 33410: {
! 33411: $from_encoding = encoding_alias($encoding, $line_nr);
! 33412: Texi2HTML::Config::set_conf('IN_ENCODING', $from_encoding, 1)
! 33413: if (defined($from_encoding));
! 33414: }
! 33415: if (defined($from_encoding) and $Texi2HTML::Config::USE_UNICODE)
! 33416: {
! 33417: foreach my $file (@{$state->{'files_stack'}})
! 33418: {
! 33419: binmode($file->{'fh'}, ":encoding($from_encoding)");
! 33420: }
! 33421: }
! 33422: }
! 33423: #FIXME error if garbage remains on the line?
! 33424: }
! 33425: else
! 33426: {
! 33427: line_error(sprintf(__("\@%s arg must be an encoding"), $command), $line_nr);
! 33428: }
! 33429: }
! 33430: elsif ($command eq 'alias')
! 33431: {
! 33432: if ($line =~ /(\s+)([a-zA-Z][\w-]*)(\s*=\s*)([a-zA-Z][\w-]*)(\s*)/)
! 33433: {
! 33434: $alias{$2} = $4;
! 33435: }
! 33436: else
! 33437: {
! 33438: line_error (sprintf(__("Bad argument to \@%s"), $command), $line_nr);
! 33439: }
! 33440: }
! 33441: elsif ($command eq 'definfoenclose')
! 33442: {
! 33443: if ($cline =~ s/^\s+([a-z][\w\-]*)\s*,\s*([^\s]+)\s*,\s*([^\s]+)//)
! 33444: {
! 33445: $info_enclose{$1} = [ $2, $3 ];
! 33446: }
! 33447: else
! 33448: {
! 33449: line_error (sprintf(__("Bad argument to \@%s"), $command), $line_nr);
! 33450: } # FIXME warn about garbage remaining on the line?
! 33451: }
! 33452: else
! 33453: {
! 33454: if ($command eq 'setfilename' and $Texi2HTML::Config::USE_SETFILENAME)
! 33455: { # a double setfillename is removed before calling misc_command_texi
! 33456: my $filename = trim_comment_spaces($line, "\@$command");
! 33457: $filename = substitute_line($filename, "\@$command",{'code_style' => 1, 'remove_texi' => 1}, $line_nr);
! 33458: if ($filename ne '')
! 33459: {
! 33460: Texi2HTML::Config::set_conf($command, $filename, 1);
! 33461: # remove extension
! 33462: $filename =~ s/\.[^\.]*$//;
! 33463: init_with_file_name ($filename) if ($filename ne '');
! 33464: }
! 33465: }
! 33466: # in reality, do only set, clear and clickstyle.
! 33467: # though we should never go there for clickstyle...
! 33468: common_misc_commands($command, $line, 0, $line_nr);
! 33469: }
! 33470: }
! 33471:
! 33472: ($line, $text, $args) = &$Texi2HTML::Config::preserve_misc_command($line, $command);
! 33473: return ($line, $text);
! 33474: }
! 33475:
! 33476: sub new_content_element($)
! 33477: {
! 33478: my $command = shift;
! 33479: $command = 'shortcontents' if ($command ne 'contents');
! 33480: my $element;
! 33481: foreach my $key (keys(%{$reference_content_element{$command}}))
! 33482: {
! 33483: $element->{$key} = $reference_content_element{$command}->{$key};
! 33484: }
! 33485: return $element;
! 33486: }
! 33487:
! 33488: # handle misc commands and misc command args
! 33489: sub misc_command_structure($$$$)
! 33490: {
! 33491: my $line = shift;
! 33492: my $command = shift;
! 33493: my $state = shift;
! 33494: my $line_nr = shift;
! 33495: my $text;
! 33496: my $args;
! 33497: # for error messages
! 33498: my $cline = $line;
! 33499: chomp $cline;
! 33500: $cline =~ s/^\s*//;
! 33501:
! 33502: if ($command eq 'lowersections')
! 33503: {
! 33504: my ($sec, $level);
! 33505: while (($sec, $level) = each %sec2level)
! 33506: {
! 33507: $sec2level{$sec} = $level + 1 if ($reference_sec2level{$sec} > 0);
! 33508: }
! 33509: $state->{'sectionning_base'}--;
! 33510: }
! 33511: elsif ($command eq 'raisesections')
! 33512: {
! 33513: my ($sec, $level);
! 33514: while (($sec, $level) = each %sec2level)
! 33515: {
! 33516: $sec2level{$sec} = $level - 1 if ($reference_sec2level{$sec} > 0);
! 33517: }
! 33518: $state->{'sectionning_base'}++;
! 33519: }
! 33520: elsif (($command eq 'contents') or ($command eq 'summarycontents') or ($command eq 'shortcontents'))
! 33521: {
! 33522: if ($command ne 'contents')
! 33523: {
! 33524: $command = 'shortcontents';
! 33525: }
! 33526: Texi2HTML::Config::set_conf($command, 1, 1);
! 33527: my $new_content_element = new_content_element($command);
! 33528: push @{$state->{'place'}}, $new_content_element;
! 33529: push @{$all_content_elements{$command}}, $new_content_element;
! 33530: }
! 33531: elsif ($command eq 'dircategory')
! 33532: {
! 33533: my $arg = trim_comment_spaces ($line, "\@$command");
! 33534: $Texi2HTML::THISDOC{"${command}_texi"} = $arg;
! 33535: $Texi2HTML::THISDOC{$command} = substitute_line($arg, "\@$command");
! 33536: }
! 33537: elsif (grep {$_ eq $command} ('settitle','shorttitlepage','title'))
! 33538: {
! 33539: my $arg = trim_comment_spaces($line, "\@$command");
! 33540: $Texi2HTML::THISDOC{$command . '_texi'} = $arg;
! 33541: $Texi2HTML::THISDOC{$command . '_line_nr'} = $line_nr;
! 33542:
! 33543: # FIXME backward compatibility. Obsoleted in nov 2009.
! 33544: $value{"_$command"} = $arg;
! 33545: if ($command eq 'title')
! 33546: { # FIXME This was obsoleted in jun 2007
! 33547: $Texi2HTML::THISDOC{"${command}s_texi"} = [ $arg ];
! 33548: }
! 33549: }
! 33550: elsif (grep {$_ eq $command} ('author','subtitle'))
! 33551: {
! 33552: my $arg = trim_comment_spaces($line, "\@$command");
! 33553: $Texi2HTML::THISDOC{$command . '_texi'} .= $arg . "\n";
! 33554: if ($state->{'region'} and $state->{'region'} eq 'titlepage')
! 33555: {
! 33556: push @{$Texi2HTML::THISDOC{"${command}s_texi"}}, $arg;
! 33557: push @{$Texi2HTML::THISDOC{"${command}s_line_nr"}}, $line_nr;
! 33558: }
! 33559: #chomp($arg);
! 33560:
! 33561: # FIXME backward compatibility. Obsoleted in nov 2009.
! 33562: $value{"_$command"} .= $arg . "\n";
! 33563: }
! 33564: elsif ($command eq 'synindex' || $command eq 'syncodeindex')
! 33565: {
! 33566: if ($line =~ /^\s+(\w+)\s+(\w+)/)
! 33567: {
! 33568: my $index_from = $1;
! 33569: my $index_to = $2;
! 33570: line_error (sprintf(__("Unknown from index `%s' in \@%s"), $index_from, $command), $line_nr)
! 33571: unless $index_names{$index_from};
! 33572: line_error (sprintf(__("Unknown to index name `%s' in \@%s"), $index_to, $command), $line_nr)
! 33573: unless $index_names{$index_to};
! 33574: if ($index_names{$index_from} and $index_names{$index_to})
! 33575: {
! 33576: my $in_code = 0;
! 33577: $in_code = 1 if ($command eq 'syncodeindex');
! 33578: my $current_to = $index_to;
! 33579: while ($current_to ne $index_from and $Texi2HTML::THISDOC{'merged_index'}->{$current_to})
! 33580: {
! 33581: $current_to = $Texi2HTML::THISDOC{'merged_index'}->{$current_to};
! 33582: }
! 33583: if ($current_to ne $index_from)
! 33584: {
! 33585: foreach my $prefix (keys(%{$index_names{$index_from}->{'prefixes'}}))
! 33586: {
! 33587: $index_names{$current_to}->{'prefixes'}->{$prefix} = $in_code;
! 33588: $index_prefix_to_name{$prefix} = $current_to;
! 33589: }
! 33590: $Texi2HTML::THISDOC{'merged_index'}->{$index_from} = $current_to;
! 33591: }
! 33592: push @{$Texi2HTML::THISDOC{$command}}, [$index_from,$index_to];
! 33593: }
! 33594: }
! 33595: else
! 33596: {
! 33597: line_error (sprintf(__("Bad argument to \@%s: %s"), $command, $cline), $line_nr);
! 33598: }
! 33599: }
! 33600: elsif ($command eq 'defindex' || $command eq 'defcodeindex')
! 33601: {
! 33602: if ($line =~ /^\s+(\w+)\s*$/)
! 33603: {
! 33604: my $name = $1;
! 33605: if ($forbidden_index_name{$name})
! 33606: {
! 33607: line_error(sprintf(__("Reserved index name %s"),$name), $line_nr);
! 33608: }
! 33609: else
! 33610: {
! 33611: my $in_code = 0;
! 33612: $in_code = 1 if ($command eq 'defcodeindex');
! 33613: # FIXME this leads to spurious error message in hello_nodes
! 33614: #if (defined($index_names{$name}))
! 33615: #{
! 33616: # line_error(sprintf(__("Index `%s' already exists"),$name), $line_nr);
! 33617: #}
! 33618: $index_names{$name}->{'prefixes'}->{$name} = $in_code;
! 33619: $index_prefix_to_name{$name} = $name;
! 33620: push @{$Texi2HTML::THISDOC{$command}}, $name;
! 33621: }
! 33622: }
! 33623: else
! 33624: {
! 33625: line_error (sprintf(__("Bad argument to \@%s: %s"), $command, $cline), $line_nr);
! 33626: }
! 33627: }
! 33628: elsif (grep {$_ eq $command} ('everyheadingmarks','everyfootingmarks',
! 33629: 'evenheadingmarks','oddheadingmarks','evenfootingmarks','oddfootingmarks'))
! 33630: {
! 33631: if (($line =~ /^\s+(top)[^\w\-]/) or ($line =~ /^\s+(bottom)[^\w\-]/))
! 33632: {
! 33633: $Texi2HTML::THISDOC{$command} = $1;
! 33634: }
! 33635: else
! 33636: {
! 33637: line_error (sprintf(__("\@%s arg must be `top' or `bottom', not `%s'"), $command, $cline), $line_nr);
! 33638: }
! 33639: }
! 33640: elsif ($command eq 'fonttextsize')
! 33641: {
! 33642: if (($line =~ /^\s+(10)[^\w\-]/) or ($line =~ /^\s+(11)[^\w\-]/))
! 33643: {
! 33644: $Texi2HTML::THISDOC{$command} = $1;
! 33645: }
! 33646: else
! 33647: {
! 33648: line_error (sprintf(__("Only \@%s 10 or 11 is supported, not `%s'"),$command, $cline), $line_nr);
! 33649: }
! 33650: }
! 33651: elsif ($command eq 'pagesizes')
! 33652: {
! 33653: if ($line =~ /^\s+(.*)\s*$/)
! 33654: {
! 33655: $Texi2HTML::THISDOC{$command} = $1;
! 33656: }
! 33657: }
! 33658: elsif ($command eq 'footnotestyle')
! 33659: {
! 33660: if ($line =~ /^\s+([a-z]+)[^\w\-]/)
! 33661: {
! 33662: set_footnote_style ($1, 0, $line_nr);
! 33663: }
! 33664: else
! 33665: {
! 33666: set_footnote_style ($line, 0, $line_nr);
! 33667: }
! 33668: }
! 33669: elsif ($command eq 'setchapternewpage')
! 33670: {
! 33671: if (($line =~ /^\s+(on)[^\w\-]/) or ($line =~ /^\s+(off)[^\w\-]/)
! 33672: or ($line =~ /^\s+(odd)[^\w\-]/))
! 33673: {
! 33674: $Texi2HTML::THISDOC{$command} = $1;
! 33675: }
! 33676: else
! 33677: {
! 33678: line_error (sprintf(__("\@%s arg must be `on', `off' or `odd', not `%s'"), $command, $cline), $line_nr);
! 33679: }
! 33680: }
! 33681: elsif ($command eq 'setcontentsaftertitlepage' or $command eq 'setshortcontentsaftertitlepage')
! 33682: {
! 33683: Texi2HTML::Config::set_conf($command, 1, 1);
! 33684: }
! 33685: elsif ($command eq 'need')
! 33686: { # only a warning
! 33687: unless (($line =~ /^\s+([0-9]+(\.[0-9]*)?)[^\w\-]/) or
! 33688: ($line =~ /^\s+(\.[0-9]+)[^\w\-]/))
! 33689: {
! 33690: line_error (sprintf(__("Bad argument to \@%s: %s"), $command, $cline), $line_nr);
! 33691: }
! 33692: }
! 33693: else
! 33694: {
! 33695: common_misc_commands($command, $line, 1, $line_nr);
! 33696: }
! 33697:
! 33698: ($text, $line, $args) = &$Texi2HTML::Config::preserve_misc_command($line, $command);
! 33699: return ($text, $line);
! 33700: }
! 33701:
! 33702: sub set_special_names()
! 33703: {
! 33704: $Texi2HTML::NAME{'About'} = gdt('About This Document');
! 33705: $Texi2HTML::NAME{'Contents'} = gdt('Table of Contents');
! 33706: $Texi2HTML::NAME{'Overview'} = gdt('Short Table of Contents');
! 33707: $Texi2HTML::NAME{'Footnotes'} = gdt('Footnotes');
! 33708: $Texi2HTML::NO_TEXI{'About'} = gdt('About This Document', {}, {'remove_texi' => 1} );
! 33709: $Texi2HTML::NO_TEXI{'Contents'} = gdt('Table of Contents', {}, {'remove_texi' => 1} );
! 33710: $Texi2HTML::NO_TEXI{'Overview'} = gdt('Short Table of Contents', {}, {'remove_texi' => 1} );
! 33711: $Texi2HTML::NO_TEXI{'Footnotes'} = gdt('Footnotes', {}, {'remove_texi' => 1} );
! 33712: $Texi2HTML::SIMPLE_TEXT{'About'} = gdt('About This Document', {}, {'simple_format' => 1});
! 33713: $Texi2HTML::SIMPLE_TEXT{'Contents'} = gdt('Table of Contents',{}, {'simple_format' => 1});
! 33714: $Texi2HTML::SIMPLE_TEXT{'Overview'} = gdt('Short Table of Contents', {}, {'simple_format' => 1});
! 33715: $Texi2HTML::SIMPLE_TEXT{'Footnotes'} = gdt('Footnotes', {},{'simple_format' => 1});
! 33716: }
! 33717:
! 33718: sub enter_author_command($$$$$$)
! 33719: {
! 33720: my $command = shift;
! 33721: my $texi = shift;
! 33722: my $text = shift;
! 33723: my $stack = shift;
! 33724: my $state = shift;
! 33725: my $line_nr = shift;
! 33726: $texi = trim_comment_spaces($texi, "\@$command");
! 33727: if ($command eq 'author')
! 33728: {
! 33729: my $top_format = top_stack($stack, 2);
! 33730: if (defined($top_format) and $format_type{$top_format->{'format'}} eq 'quotation')
! 33731: {
! 33732: push @{$top_format->{'quote_authors'}}, {'author_texi' => $texi, 'author_text' => $text};
! 33733: }
! 33734: elsif (!$state->{'region'} or $state->{'region'} ne 'titlepage')
! 33735: {
! 33736: line_warn (sprintf(__("\@%s not meaningful outside `\@titlepage' and `\@quotation' environments"), $command), $line_nr);
! 33737: }
! 33738: }
! 33739: }
! 33740:
! 33741: # return the line after removing things according to misc_command map.
! 33742: # if the skipped command has an effect it is done here
! 33743: # this is used during pass_text
! 33744: sub misc_command_text($$$$$$)
! 33745: {
! 33746: my $line = shift;
! 33747: my $command = shift;
! 33748: my $stack = shift;
! 33749: my $state = shift;
! 33750: my $text = shift;
! 33751: my $line_nr = shift;
! 33752: my ($skipped, $remaining, $args, $result);
! 33753:
! 33754: # The strange condition associated with 'keep_texi' is
! 33755: # there because for an argument appearing on an @itemize
! 33756: # line (we're in 'check_item'), meant to be prepended to an
! 33757: # @item we don't want to keep @c or @comment as otherwise it
! 33758: # eats the @item line. Other commands could do that too but
! 33759: # then the user deserves what he gets.
! 33760: if ($state->{'keep_texi'} and
! 33761: (!$state->{'check_item'} or ($command ne 'c' and $command ne 'comment')))
! 33762: {
! 33763: ($remaining, $skipped, $args) = &$Texi2HTML::Config::preserve_misc_command($line, $command);
! 33764: add_prev($text, $stack, "\@$command". $skipped);
! 33765: return $remaining;
! 33766: }
! 33767:
! 33768: ($remaining, $skipped, $args) = &$Texi2HTML::Config::preserve_misc_command($line, $command);
! 33769:
! 33770: if ($state->{'remove_texi'})
! 33771: {
! 33772: ($command, $line, $result) = &$Texi2HTML::Config::misc_command_line_texi($command, $line, $args, $stack, $state);
! 33773: }
! 33774: else
! 33775: {
! 33776: ($command, $line, $result) = &$Texi2HTML::Config::misc_command_line($command, $line, $args, $stack, $state);
! 33777: }
! 33778:
! 33779: enter_author_command ($command, $line, $result, $stack, $state, $line_nr);
! 33780:
! 33781: # for error messages
! 33782: my $cline = $line;
! 33783: $cline =~ s/^\s*//;
! 33784: chomp $cline;
! 33785:
! 33786: # if it is true the command args are kept so the user can modify how
! 33787: # they are skipped and handle them as unknown @-commands. Nowadays, it is
! 33788: # not that interesting since using misc_command_line above should do
! 33789: # about the same more simply.
! 33790: my $keep = $Texi2HTML::Config::misc_command{$command}->{'keep'};
! 33791:
! 33792: if ($command eq 'sp')
! 33793: {
! 33794: my $sp_number;
! 33795: if ($line =~ /^\s+(\d+)\s/)
! 33796: {
! 33797: $sp_number = $1;
! 33798: }
! 33799: elsif ($line =~ /(\s*)$/)
! 33800: {
! 33801: $sp_number = '';
! 33802: }
! 33803: else
! 33804: {
! 33805: line_error (sprintf(__("\@sp requires a positive numeric argument, not `%s'"), $cline), $line_nr);
! 33806: }
! 33807: $sp_number = 1 if ($sp_number eq '');
! 33808: if (!$state->{'remove_texi'})
! 33809: {
! 33810: add_prev($text, $stack, &$Texi2HTML::Config::sp($sp_number, $state->{'preformatted'}));
! 33811: }
! 33812: }
! 33813: elsif($command eq 'verbatiminclude' and !$keep)
! 33814: {
! 33815: if ($line =~ /\s+(.+)/)
! 33816: {
! 33817: my $arg = $1;
! 33818: $arg = trim_around_spaces($arg);
! 33819: my $file_name = substitute_line($arg, "\@$command", {'code_style' => 1});
! 33820: my $file = locate_include_file($file_name);
! 33821: if (defined($file))
! 33822: {
! 33823: if (!open(VERBINCLUDE, $file))
! 33824: {
! 33825: line_error (sprintf(__("Cannot read %s: %s"), $file, $!), $line_nr);
! 33826: }
! 33827: else
! 33828: {
! 33829: my $verb_text = '';
! 33830: while (my $verb_line = <VERBINCLUDE>)
! 33831: {
! 33832: $verb_text .= $verb_line;
! 33833: }
! 33834:
! 33835: if ($state->{'remove_texi'})
! 33836: {
! 33837: add_prev ($text, $stack, &$Texi2HTML::Config::raw_no_texi('verbatiminclude', $verb_text));
! 33838: }
! 33839: else
! 33840: {
! 33841: add_prev($text, $stack, &$Texi2HTML::Config::raw('verbatiminclude', $verb_text, $line_nr));
! 33842: }
! 33843: close VERBINCLUDE;
! 33844: }
! 33845: }
! 33846: else
! 33847: {
! 33848: line_error (sprintf(__("\@%s: Cannot find %s"), $command, $file_name), $line_nr);
! 33849: }
! 33850: }
! 33851: else
! 33852: {
! 33853: line_error (sprintf(__("Bad argument to \@%s: %s"), $command, $cline), $line_nr);
! 33854: }
! 33855: }
! 33856: elsif ($command eq 'indent' or $command eq 'noindent')
! 33857: {
! 33858: $state->{'paragraph_indent'} = $command;
! 33859: }
! 33860: else
! 33861: {
! 33862: common_misc_commands($command, $line, 2, $line_nr);
! 33863: }
! 33864:
! 33865: return ($skipped.$remaining, $result) if ($keep);
! 33866: return ($remaining, $result);
! 33867: }
! 33868:
! 33869: # merge the things appearing before the first @node or sectioning command
! 33870: # (held by element_before_anything) with the current element
! 33871: # do that only once.
! 33872: sub merge_element_before_anything($)
! 33873: {
! 33874: my $element = shift;
! 33875: if (exists($element_before_anything->{'place'}))
! 33876: {
! 33877: $element->{'current_place'} = $element_before_anything->{'place'};
! 33878: delete $element_before_anything->{'place'};
! 33879: foreach my $placed_thing (@{$element->{'current_place'}})
! 33880: {
! 33881: $placed_thing->{'element'} = $element if (exists($placed_thing->{'element'}));
! 33882: }
! 33883: }
! 33884: # this is certainly redundant with the above condition, but cleaner
! 33885: # that way
! 33886: if (exists($element_before_anything->{'titlefont'}))
! 33887: {
! 33888: $element->{'titlefont'} = $element_before_anything->{'titlefont'};
! 33889: delete $element_before_anything->{'titlefont'};
! 33890: }
! 33891: }
! 33892:
! 33893: # find menu_prev, menu_up... for a node in menu
! 33894: sub menu_entry_texi($$$)
! 33895: {
! 33896: my $node = shift;
! 33897: my $state = shift;
! 33898: my $line_nr = shift;
! 33899: return if ($state->{'direntry'});
! 33900: my $node_menu_ref = {};
! 33901: if (exists($nodes{$node}))
! 33902: {
! 33903: $node_menu_ref = $nodes{$node};
! 33904: }
! 33905: else
! 33906: {
! 33907: $nodes{$node} = $node_menu_ref;
! 33908: $node_menu_ref->{'texi'} = $node;
! 33909: $node_menu_ref->{'external_node'} = 1 if ($node =~ /^\(.+\)/);
! 33910: }
! 33911: return if ($state->{'detailmenu'});
! 33912: if ($state->{'node_ref'})
! 33913: {
! 33914: if ($node_menu_ref->{'menu_up'} and !$node_menu_ref->{'external_node'})
! 33915: {
! 33916: # This is not an error. This is used a lot in real life manuals
! 33917: #line_warn ("Double entry in menu for `$node' (also below `$node_menu_ref->{'menu_up'}->{'texi'}')", $line_nr);
! 33918: }
! 33919: $node_menu_ref->{'menu_up'} = $state->{'node_ref'};
! 33920: $node_menu_ref->{'menu_up_hash'}->{$state->{'node_ref'}->{'texi'}} = 1;
! 33921: }
! 33922: if ($state->{'prev_menu_node'})
! 33923: {
! 33924: $node_menu_ref->{'menu_prev'} = $state->{'prev_menu_node'};
! 33925: $state->{'prev_menu_node'}->{'menu_next'} = $node_menu_ref;
! 33926: }
! 33927: elsif ($state->{'node_ref'} and !$state->{'node_ref'}->{'menu_child'})
! 33928: {
! 33929: $state->{'node_ref'}->{'menu_child'} = $node_menu_ref;
! 33930: }
! 33931: $state->{'prev_menu_node'} = $node_menu_ref;
! 33932: }
! 33933:
! 33934: my @index_labels; # array corresponding with @?index commands
! 33935: # constructed during pass_structure, used to
! 33936: # put labels in pass_text
! 33937: my @unknown_index_index_entries; # array of index entries not associated
! 33938: # with any index
! 33939:
! 33940: sub sorted_line($)
! 33941: {
! 33942: my $line = shift;
! 33943: $::texi_map_ref = \%Texi2HTML::Config::sorting_things_map;
! 33944: my $result = remove_texi($line);
! 33945: $::texi_map_ref = \%Texi2HTML::Config::texi_map;
! 33946: return $result;
! 33947: }
! 33948:
! 33949: sub prepare_indices()
! 33950: {
! 33951: #print STDERR "Do splitting of index letters, once.\n";
! 33952:
! 33953: foreach my $index_name(keys %{$Texi2HTML::THISDOC{'index_entries_array'}})
! 33954: {
! 33955: #print STDERR "$Texi2HTML::THISDOC{'index_entries_array'}->{$index_name}) letters\n";
! 33956: my %letters_hash;
! 33957: foreach my $index_entry (@{$Texi2HTML::THISDOC{'index_entries_array'}->{$index_name}})
! 33958: {
! 33959: my $key = sorted_line($index_entry->{'texi'});
! 33960: $index_entry->{'key'} = $key;
! 33961: my $letter = uc(substr($key, 0, 1));
! 33962: push @{$letters_hash{$letter}}, $index_entry;
! 33963: }
! 33964:
! 33965: # use cmp if only letters or only symbols, otherwise symbols before
! 33966: # letters
! 33967: foreach my $letter (sort {
! 33968: ((($a =~ /^[[:alpha:]]/ and $b =~ /^[[:alpha:]]/) or
! 33969: ($a !~ /^[[:alpha:]]/ and $b !~ /^[[:alpha:]]/)) && $a cmp $b)
! 33970: || ($a =~ /^[[:alpha:]]/ && 1) || -1 } (keys %letters_hash))
! 33971: {
! 33972: # FIXME sort without uc?
! 33973: # This sorts the entries for a given letter
! 33974: my @sorted_letter_entries = (sort {uc($a->{'key'}) cmp uc($b->{'key'})} (@{$letters_hash{$letter}}));
! 33975:
! 33976: push @{$Texi2HTML::THISDOC{'index_letters_array'}->{$index_name}}, { 'letter' => $letter, 'entries' => \@sorted_letter_entries };
! 33977: }
! 33978: }
! 33979:
! 33980: # generate the keys for index sorting also for the entries not
! 33981: # associated with an index.
! 33982: foreach my $index_entry_without_index (@unknown_index_index_entries)
! 33983: {
! 33984: my $key = sorted_line($index_entry_without_index->{'texi'});
! 33985: $index_entry_without_index->{'key'} = $key;
! 33986: }
! 33987: Texi2HTML::Config::t2h_default_init_split_indices();
! 33988: }
! 33989:
! 33990: # This function is used to construct link names from node names as
! 33991: # specified for texinfo
! 33992: sub cross_manual_links()
! 33993: {
! 33994: my @all_index_entries;
! 33995: foreach my $index_name (sort(keys(%{$Texi2HTML::THISDOC{'index_entries_array'}})))
! 33996: {
! 33997: push @all_index_entries, @{$Texi2HTML::THISDOC{'index_entries_array'}->{$index_name}};
! 33998: }
! 33999: print STDERR "# Doing ".scalar(keys(%nodes))." cross manual links ".
! 34000: scalar(@all_index_entries). " index entries\n"
! 34001: if ($T2H_DEBUG);
! 34002: $::simple_map_texi_ref = \%cross_ref_simple_map_texi;
! 34003: $::style_map_texi_ref = \%cross_ref_style_map_texi;
! 34004: $::texi_map_ref = \%cross_ref_texi_map;
! 34005: my $normal_text_kept = $Texi2HTML::Config::normal_text;
! 34006: $Texi2HTML::Config::normal_text = \&Texi2HTML::Config::t2h_cross_manual_normal_text;
! 34007: my $style_kept = $Texi2HTML::Config::style;
! 34008: $Texi2HTML::Config::style = \&Texi2HTML::Config::T2H_GPL_style;
! 34009:
! 34010: foreach my $key (keys(%nodes))
! 34011: {
! 34012: my $node = $nodes{$key};
! 34013: #print STDERR "CROSS_MANUAL:$key,$node\n";
! 34014: if (!defined($node->{'texi'}))
! 34015: {
! 34016: ###################### debug section
! 34017: foreach my $key (keys(%$node))
! 34018: {
! 34019: #print STDERR "$key:$node->{$key}!!!\n";
! 34020: }
! 34021: ###################### end debug section
! 34022: }
! 34023: else
! 34024: {
! 34025: $node->{'cross_manual_target'} = remove_texi($node->{'texi'});
! 34026: if ($node->{'cross_manual_target'} !~ /\S/)
! 34027: {
! 34028: line_error (sprintf(__("Empty node name after expansion `%s'"), $node->{'texi'}), $node->{'line_nr'});
! 34029: $node->{'cross_manual_target'} = 't_0';
! 34030: $node->{'cross_manual_file'} = 't_0';
! 34031: }
! 34032: elsif ($Texi2HTML::Config::USE_UNICODE)
! 34033: {
! 34034: $node->{'cross_manual_target'} = Unicode::Normalize::NFC($node->{'cross_manual_target'});
! 34035: if ($Texi2HTML::Config::TRANSLITERATE_FILE_NAMES and $Texi2HTML::Config::USE_UNIDECODE)
! 34036: {
! 34037: $node->{'cross_manual_file'} =
! 34038: unicode_to_protected(unicode_to_transliterate($node->{'cross_manual_target'}));
! 34039: }
! 34040: $node->{'cross_manual_target'} =
! 34041: unicode_to_protected($node->{'cross_manual_target'});
! 34042: }
! 34043: #print STDERR "CROSS_MANUAL_TARGET $node->{'cross_manual_target'}\n";
! 34044: unless ($node->{'external_node'})
! 34045: {
! 34046: if (exists($cross_reference_nodes{$node->{'cross_manual_target'}}))
! 34047: {
! 34048: my $other_node_array = $cross_reference_nodes{$node->{'cross_manual_target'}};
! 34049: my $node_seen;
! 34050: foreach my $other_node (@{$other_node_array})
! 34051: { # find the first node seen for the error message
! 34052: $node_seen = $other_node;
! 34053: last if ($nodes{$other_node}->{'seen'})
! 34054: }
! 34055: my $other_node_line_nr = $nodes{$node_seen}->{'line_nr'};
! 34056: if (defined($other_node_line_nr))
! 34057: {
! 34058: msg_error ("Node equivalent with `$node->{'texi'}' already used `$node_seen' ".format_line_number($other_node_line_nr), $node->{'line_nr'});
! 34059: }
! 34060: else
! 34061: {
! 34062: msg_error ("Node equivalent with `$node->{'texi'}' already used `$node_seen'", $node->{'line_nr'});
! 34063: }
! 34064: push @{$other_node_array}, $node->{'texi'};
! 34065: }
! 34066: else
! 34067: {
! 34068: push @{$cross_reference_nodes{$node->{'cross_manual_target'}}}, $node->{'texi'};
! 34069: }
! 34070: }
! 34071: }
! 34072: }
! 34073:
! 34074:
! 34075: if ($Texi2HTML::Config::TRANSLITERATE_FILE_NAMES and
! 34076: (!$Texi2HTML::Config::USE_UNICODE or !$Texi2HTML::Config::USE_UNIDECODE))
! 34077: {
! 34078: $::style_map_texi_ref = \%cross_transliterate_style_map_texi;
! 34079: $::texi_map_ref = \%cross_transliterate_texi_map;
! 34080: $Texi2HTML::Config::normal_text = \&Texi2HTML::Config::t2h_cross_manual_normal_text_transliterate if (!$Texi2HTML::Config::USE_UNICODE);
! 34081:
! 34082: foreach my $key (keys(%nodes))
! 34083: {
! 34084: my $node = $nodes{$key};
! 34085: #print STDERR "TRANSLITERATE:$key,$node\n";
! 34086: if (defined($node->{'texi'}))
! 34087: {
! 34088: $node->{'cross_manual_file'} = remove_texi($node->{'texi'});
! 34089: if ($node->{'cross_manual_file'} !~ /\S/)
! 34090: {
! 34091: $node->{'cross_manual_file'} = 't_0';
! 34092: }
! 34093: elsif ($Texi2HTML::Config::USE_UNICODE)
! 34094: {
! 34095: $node->{'cross_manual_file'} = unicode_to_protected(unicode_to_transliterate($node->{'cross_manual_file'}));
! 34096: }
! 34097: }
! 34098: }
! 34099:
! 34100: foreach my $entry (@all_index_entries, values(%sections), values(%headings))
! 34101: {
! 34102: #print STDERR "TRANSLITERATE($entry) $entry->{'texi'}\n";
! 34103: $entry->{'cross'} = remove_texi($entry->{'texi'});
! 34104: $entry->{'cross'} = unicode_to_protected(unicode_to_transliterate($entry->{'cross'})) if ($Texi2HTML::Config::USE_UNICODE);
! 34105: }
! 34106: }
! 34107: else
! 34108: {
! 34109: foreach my $entry (@all_index_entries, values(%sections), values(%headings))
! 34110: {
! 34111: $entry->{'cross'} = remove_texi($entry->{'texi'});
! 34112: if ($Texi2HTML::Config::USE_UNICODE)
! 34113: {
! 34114: $entry->{'cross'} = Unicode::Normalize::NFC($entry->{'cross'});
! 34115: if ($Texi2HTML::Config::TRANSLITERATE_FILE_NAMES and $Texi2HTML::Config::USE_UNIDECODE) # USE_UNIDECODE is redundant
! 34116: {
! 34117: $entry->{'cross'} =
! 34118: unicode_to_protected(unicode_to_transliterate($entry->{'cross'}));
! 34119: }
! 34120: else
! 34121: {
! 34122: $entry->{'cross'} =
! 34123: unicode_to_protected($entry->{'cross'});
! 34124: }
! 34125: }
! 34126: }
! 34127: }
! 34128:
! 34129: $Texi2HTML::Config::normal_text = $normal_text_kept;
! 34130: $Texi2HTML::Config::style = $style_kept;
! 34131: $::simple_map_texi_ref = \%Texi2HTML::Config::simple_map_texi;
! 34132: $::style_map_texi_ref = \%Texi2HTML::Config::style_map_texi;
! 34133: $::texi_map_ref = \%Texi2HTML::Config::texi_map;
! 34134: }
! 34135:
! 34136: # This function is used to construct a link name from a node name as
! 34137: # specified for texinfo
! 34138: sub cross_manual_line($;$)
! 34139: {
! 34140: my $text = shift;
! 34141: my $transliterate = shift;
! 34142: #print STDERR "cross_manual_line $text\n";
! 34143: #print STDERR "remove_texi text ". remove_texi($text)."\n\n\n";
! 34144: if ($text !~ /\S/)
! 34145: {
! 34146: # special case for empty node/ref
! 34147: return ('t_0', 't_0');
! 34148: }
! 34149: $::simple_map_texi_ref = \%cross_ref_simple_map_texi;
! 34150: $::style_map_texi_ref = \%cross_ref_style_map_texi;
! 34151: $::texi_map_ref = \%cross_ref_texi_map;
! 34152: my $normal_text_kept = $Texi2HTML::Config::normal_text;
! 34153: $Texi2HTML::Config::normal_text = \&Texi2HTML::Config::t2h_cross_manual_normal_text;
! 34154: my $style_kept = $Texi2HTML::Config::style;
! 34155: $Texi2HTML::Config::style = \&Texi2HTML::Config::T2H_GPL_style;
! 34156:
! 34157: my ($cross_ref_target, $cross_ref_file);
! 34158: if ($Texi2HTML::Config::USE_UNICODE)
! 34159: {
! 34160: $cross_ref_target = Unicode::Normalize::NFC(remove_texi($text));
! 34161: if ($transliterate and $Texi2HTML::Config::USE_UNIDECODE)
! 34162: {
! 34163: $cross_ref_file =
! 34164: unicode_to_protected(unicode_to_transliterate($cross_ref_target));
! 34165: }
! 34166: $cross_ref_target = unicode_to_protected($cross_ref_target);
! 34167: }
! 34168: else
! 34169: {
! 34170: $cross_ref_target = remove_texi($text);
! 34171: }
! 34172:
! 34173: if ($transliterate and
! 34174: (!$Texi2HTML::Config::USE_UNICODE or !$Texi2HTML::Config::USE_UNIDECODE))
! 34175: {
! 34176: $::style_map_texi_ref = \%cross_transliterate_style_map_texi;
! 34177: $::texi_map_ref = \%cross_transliterate_texi_map;
! 34178: $Texi2HTML::Config::normal_text = \&Texi2HTML::Config::t2h_cross_manual_normal_text_transliterate if (!$Texi2HTML::Config::USE_UNICODE);
! 34179: $cross_ref_file = remove_texi($text);
! 34180: $cross_ref_file = unicode_to_protected(unicode_to_transliterate($cross_ref_file))
! 34181: if ($Texi2HTML::Config::USE_UNICODE);
! 34182: }
! 34183:
! 34184: $Texi2HTML::Config::normal_text = $normal_text_kept;
! 34185: $Texi2HTML::Config::style = $style_kept;
! 34186: $::simple_map_texi_ref = \%Texi2HTML::Config::simple_map_texi;
! 34187: $::style_map_texi_ref = \%Texi2HTML::Config::style_map_texi;
! 34188: $::texi_map_ref = \%Texi2HTML::Config::texi_map;
! 34189: #print STDERR "\n\ncross_ref $cross_ref\n";
! 34190: unless ($transliterate)
! 34191: {
! 34192: return $cross_ref_target;
! 34193: }
! 34194: # print STDERR "$text|$cross_ref_target|$cross_ref_file\n";
! 34195: return ($cross_ref_target, $cross_ref_file);
! 34196: }
! 34197:
! 34198: sub equivalent_nodes($)
! 34199: {
! 34200: my $name = shift;
! 34201: #print STDERR "equivalent_nodes $name\n";
! 34202: my $node = normalise_node($name);
! 34203: $name = cross_manual_line($node);
! 34204: #print STDERR "equivalent_nodes `$node' `$name'\n";
! 34205: my @equivalent_nodes = ();
! 34206: if (exists($cross_reference_nodes{$name}))
! 34207: {
! 34208: @equivalent_nodes = grep {$_ ne $node} @{$cross_reference_nodes{$name}};
! 34209: }
! 34210: return @equivalent_nodes;
! 34211: }
! 34212:
! 34213: sub do_place_target_file($$$)
! 34214: {
! 34215: my $place = shift;
! 34216: my $element = shift;
! 34217: my $context = shift;
! 34218:
! 34219: $place->{'file'} = $element->{'file'} unless defined($place->{'file'});
! 34220: $place->{'target'} = $element->{'target'} unless defined($place->{'target'});
! 34221: if (defined($Texi2HTML::Config::placed_target_file_name))
! 34222: {
! 34223: my ($target, $id, $file) = &$Texi2HTML::Config::placed_target_file_name($place,$element,$place->{'target'}, $place->{'id'}, $place->{'file'},$context);
! 34224: $place->{'target'} = $target if (defined($target));
! 34225: $place->{'file'} = $file if (defined($file));
! 34226: $place->{'id'} = $id if (defined($id));
! 34227: }
! 34228: }
! 34229:
! 34230: sub do_node_target_file($$)
! 34231: {
! 34232: my $node = shift;
! 34233: my $type_of_node = shift;
! 34234: my $node_file = &$Texi2HTML::Config::node_file_name($node,$type_of_node);
! 34235: $node->{'node_file'} = $node_file if (defined($node_file));
! 34236: if (defined($Texi2HTML::Config::node_target_name))
! 34237: {
! 34238: my ($target,$id) = &$Texi2HTML::Config::node_target_name($node,$node->{'target'},$node->{'id'}, $type_of_node);
! 34239: $node->{'target'} = $target if (defined($target));
! 34240: $node->{'id'} = $id if (defined($id));
! 34241: }
! 34242: }
! 34243:
! 34244: sub do_element_targets($;$)
! 34245: {
! 34246: my $element = shift;
! 34247: my $use_node_file = shift;
! 34248: my $is_top = '';
! 34249:
! 34250: $is_top = 'top' if (defined($element_top) and ($element eq $element_top or (defined($element->{'with_node'}) and $element->{'with_node'} eq $element_top)));
! 34251:
! 34252: if ($Texi2HTML::Config::SPLIT_INDEX and Texi2HTML::Config::get_conf('SPLIT'))
! 34253: {
! 34254: Texi2HTML::Config::t2h_default_associate_index_element($element, $is_top, $docu_name, $use_node_file);
! 34255: }
! 34256:
! 34257: if (defined($Texi2HTML::Config::element_file_name))
! 34258: {
! 34259: my $previous_file_name = $element->{'file'};
! 34260: my $filename =
! 34261: &$Texi2HTML::Config::element_file_name ($element, $is_top, $docu_name);
! 34262: if (defined($filename))
! 34263: {
! 34264: foreach my $place (@{$element->{'place'}})
! 34265: {
! 34266: $place->{'file'} = $filename if (defined($place->{'file'}) and ($place->{'file'} eq $previous_file_name));
! 34267: }
! 34268: $element->{'file'} = $filename;
! 34269: if ($is_top)
! 34270: { # reset these variables, although they aren't used much, they may be
! 34271: # used in file name comparisons
! 34272: $docu_top = $filename;
! 34273: $docu_top_file = "$docu_rdir$docu_top";
! 34274: }
! 34275: }
! 34276: }
! 34277: print STDERR "file !defined for element $element->{'texi'}\n" if (!defined($element->{'file'}));
! 34278: if (defined($Texi2HTML::Config::element_target_name))
! 34279: {
! 34280: my ($target,$id) = &$Texi2HTML::Config::element_target_name($element, $element->{'target'}, $element->{'id'});
! 34281: $element->{'target'} = $target if (defined($target));
! 34282: $element->{'id'} = $id if (defined($id));
! 34283: }
! 34284: foreach my $place(@{$element->{'place'}})
! 34285: {
! 34286: do_place_target_file($place, $element, '');
! 34287: }
! 34288: }
! 34289:
! 34290: sub add_t2h_element($$$)
! 34291: {
! 34292: my $element = shift;
! 34293: my $elements_list = shift;
! 34294: my $prev_element = shift;
! 34295:
! 34296: push @$elements_list, $element;
! 34297: $element->{'element_ref'} = $element;
! 34298: $element->{'this'} = $element;
! 34299:
! 34300: if (defined($prev_element))
! 34301: {
! 34302: $element->{'back'} = $prev_element;
! 34303: $prev_element->{'forward'} = $element;
! 34304: }
! 34305: push @{$element->{'place'}}, $element;
! 34306: push @{$element->{'place'}}, @{$element->{'current_place'}};
! 34307: return $element;
! 34308: }
! 34309:
! 34310: sub add_t2h_dependent_element ($$)
! 34311: {
! 34312: my $element = shift;
! 34313: my $element_ref = shift;
! 34314: $element->{'element_ref'} = $element_ref;
! 34315: $element_index = $element_ref if ($element_index and ($element_index eq $element));
! 34316: push @{$element_ref->{'place'}}, $element;
! 34317: push @{$element_ref->{'place'}}, @{$element->{'current_place'}};
! 34318: }
! 34319:
! 34320: my %files = (); # keys are files. This is used to avoid reusing an already
! 34321: # used file name
! 34322: my @opened_files = (); # all the files opened by the program to remove
! 34323: # them if FORCE is not set and an error occured
! 34324: my %printed_indices = (); # value is true for an index name not empty and
! 34325: # printed
! 34326: # This is a virtual element used to have the right hrefs for index entries
! 34327: # and anchors in footnotes.
! 34328: my $footnote_element;
! 34329:
! 34330: # find next, prev, up, back, forward, fastback, fastforward
! 34331: # find element id and file
! 34332: # split index pages
! 34333: # associate placed items (items which have links to them) with the right
! 34334: # file and id
! 34335: # associate nodes with sections
! 34336: sub rearrange_elements()
! 34337: {
! 34338: print STDERR "# find sections levels and toplevel\n"
! 34339: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 34340:
! 34341: my $toplevel = 4;
! 34342:
! 34343: # correct level if raisesections or lowersections overflowed
! 34344: # and find toplevel level
! 34345: # use %sections and %headings to modify also the headings
! 34346: foreach my $section (values(%sections), values(%headings))
! 34347: {
! 34348: my $level = $section->{'level'};
! 34349: if ($level > $MAX_LEVEL)
! 34350: {
! 34351: $section->{'level'} = $MAX_LEVEL;
! 34352: }
! 34353: # second condition is for @top and @part
! 34354: elsif ($level < $MIN_LEVEL and ($reference_sec2level{$section->{'tag'}} >= $MIN_LEVEL))
! 34355: {
! 34356: $section->{'level'} = $MIN_LEVEL;
! 34357: }
! 34358: else
! 34359: {
! 34360: $section->{'level'} = $level;
! 34361: }
! 34362: $section->{'toc_level'} = $section->{'level'};
! 34363: # This is for top
! 34364: $section->{'toc_level'} = $MIN_LEVEL if ($section->{'level'} < $MIN_LEVEL);
! 34365: # find the new tag corresponding with the level of the section
! 34366: if ($section->{'tag'} !~ /heading/ and ($level ne $reference_sec2level{$section->{'tag'}}))
! 34367: {
! 34368: $section->{'tag_level'} = $level2sec{$section->{'tag'}}->[$section->{'level'}];
! 34369: }
! 34370: else
! 34371: {
! 34372: $section->{'tag_level'} = $section->{'tag'};
! 34373: }
! 34374: $toplevel = $section->{'level'} if (($section->{'level'} < $toplevel) and ($section->{'level'} > 0 and ($section->{'tag'} !~ /heading/)));
! 34375: print STDERR "# section level $level: $section->{'texi'}\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 34376: }
! 34377:
! 34378: print STDERR "# find sections structure, construct section numbers (toplevel=$toplevel)\n"
! 34379: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 34380: my $in_appendix = 0;
! 34381: # these arrays have an element per sectioning level.
! 34382: my @previous_numbers = (); # holds the number of the previous sections
! 34383: # at the same and upper levels
! 34384: my @previous_sections = (); # holds the ref of the previous sections
! 34385: my $previous_toplevel;
! 34386: my @pending_parts; # parts yet to be associated with the
! 34387: # following element
! 34388:
! 34389: foreach my $section (@sections_list)
! 34390: {
! 34391: ########################### debug
! 34392: print STDERR "BUG: node or section_ref defined for section $section->{'texi'}\n"
! 34393: if (exists($section->{'node'}) or exists($section->{'section_ref'}));
! 34394: print STDERR "Bug level undef for ($section) $section->{'texi'}\n" if (!defined($section->{'level'}));
! 34395: ########################### end debug
! 34396:
! 34397: # associate with first node if it is a section appearing before
! 34398: # the first node
! 34399: $section->{'node_ref'} = $nodes_list[0] if ($nodes_list[0] and !$section->{'node_ref'});
! 34400:
! 34401: # a part doesn't really make up an element, it is associated with the
! 34402: # next sectioning element instead.
! 34403: if ($section->{'tag'} eq 'part')
! 34404: {
! 34405: push @pending_parts, $section;
! 34406: }
! 34407: elsif (@pending_parts)
! 34408: {
! 34409: if ($section->{'tag'} ne 'top')
! 34410: {
! 34411: foreach my $part (@pending_parts)
! 34412: {
! 34413: $part->{'part_section_ref'} = $section;
! 34414: if (!$section->{'with_part'})
! 34415: {
! 34416: $section->{'with_part'} = $part;
! 34417: $part->{'part_with_section'} = $section;
! 34418: }
! 34419: # if a node is associated with the part, reassociate it with
! 34420: # the chapter
! 34421: if ($part->{'with_node'} and !$section->{'with_node'})
! 34422: {
! 34423: $section->{'with_node'} = $part->{'with_node'};
! 34424: delete $part->{'with_node'};
! 34425: $section->{'with_node'}->{'with_section'} = $section;
! 34426: }
! 34427: }
! 34428: }
! 34429: @pending_parts = ();
! 34430: }
! 34431:
! 34432: # we track the toplevel next and previous because there is no
! 34433: # strict child parent relationship between chapters and top. Indeed
! 34434: # a chapter may appear before @top, it may be better to consider them
! 34435: # on the same toplevel.
! 34436: if ($section->{'level'} <= $toplevel)
! 34437: {
! 34438: $section->{'toplevel'} = 1;
! 34439: if (defined($previous_toplevel))
! 34440: {
! 34441: $previous_toplevel->{'toplevelnext'} = $section;
! 34442: $section->{'toplevelprev'} = $previous_toplevel;
! 34443: }
! 34444: # part is not used as previous_toplevel since toplevel directions
! 34445: # are used to move between chapters (and top)
! 34446: $previous_toplevel = $section if ($section->{'tag'} ne 'part');
! 34447: # In fact this is only useful for toplevel elements appearing
! 34448: # before @top, the other have their sectionup reset up below
! 34449: # based on the sectioning commands hierarchy.
! 34450: if (defined($section_top) and $section ne $section_top)
! 34451: {
! 34452: $section->{'sectionup'} = $section_top;
! 34453: }
! 34454: }
! 34455: # undef things under that section level
! 34456: my $section_level = $section->{'level'};
! 34457: for (my $level = $section_level + 1; $level < $MAX_LEVEL + 1 ; $level++)
! 34458: {
! 34459: $previous_numbers[$level] = undef unless ($section->{'tag'} =~ /unnumbered/ or $section->{'tag'} eq 'centerchap');
! 34460: $previous_sections[$level] = undef;
! 34461: }
! 34462: my $number_set;
! 34463: # find number at the current level
! 34464: if ($section->{'tag'} =~ /appendix/ and !$in_appendix)
! 34465: {
! 34466: $previous_numbers[$toplevel] = 'A';
! 34467: $in_appendix = 1;
! 34468: $number_set = 1 if ($section->{'level'} <= $toplevel);
! 34469: $section->{'appendix_beginning'} = 1;
! 34470: }
! 34471: if (!defined($previous_numbers[$section->{'level'}]) and !$number_set)
! 34472: {
! 34473: if ($section->{'tag'} =~ /unnumbered/ or $section->{'tag'} eq 'centerchap')
! 34474: {
! 34475: $previous_numbers[$section->{'level'}] = undef;
! 34476: }
! 34477: else
! 34478: {
! 34479: $previous_numbers[$section->{'level'}] = 1;
! 34480: }
! 34481: }
! 34482: elsif ($section->{'tag'} !~ /unnumbered/ and $section->{'tag'} ne 'centerchap' and !$number_set)
! 34483: {
! 34484: $previous_numbers[$section->{'level'}]++;
! 34485: }
! 34486: # construct the section number
! 34487: $section->{'number'} = '';
! 34488:
! 34489: unless ($section->{'tag'} =~ /unnumbered/ or $section->{'tag'} eq 'centerchap' or $section->{'tag'} eq 'top' or $section->{'tag'} eq 'part')
! 34490: {
! 34491: my $level = $section->{'level'};
! 34492: while ($level > $toplevel)
! 34493: {
! 34494: my $number = $previous_numbers[$level];
! 34495: $number = 0 if (!defined($number));
! 34496: if ($section->{'number'})
! 34497: {
! 34498: $section->{'number'} = "$number.$section->{'number'}";
! 34499: }
! 34500: else
! 34501: {
! 34502: $section->{'number'} = $number;
! 34503: }
! 34504: $level--;
! 34505: }
! 34506: my $toplevel_number = $previous_numbers[$toplevel];
! 34507: $toplevel_number = 0 if (!defined($toplevel_number));
! 34508:
! 34509: if ($section->{'number'})
! 34510: { # not toplevel
! 34511: $section->{'number'} = "$toplevel_number.$section->{'number'}";
! 34512: }
! 34513: else
! 34514: { # toplevel
! 34515: $section->{'number'} = $toplevel_number;
! 34516: if ($section->{'tag'} =~ /appendix/)
! 34517: {# i18n
! 34518: $section->{'plain_number'} = $section->{'number'};
! 34519: $section->{'number'} = "Appendix $section->{'number'}";
! 34520: }
! 34521: }
! 34522: }
! 34523: $section->{'plain_number'} = $section->{'number'} if (!defined($section->{'plain_number'}));
! 34524: # find the previous section
! 34525: if (defined($previous_sections[$section->{'level'}]))
! 34526: {
! 34527: my $prev_section = $previous_sections[$section->{'level'}];
! 34528: $section->{'sectionprev'} = $prev_section;
! 34529: $prev_section->{'sectionnext'} = $section;
! 34530: }
! 34531: # find the up section
! 34532: my $level = $section->{'level'} - 1;
! 34533: while (!defined($previous_sections[$level]) and ($level >= 0))
! 34534: {
! 34535: $level--;
! 34536: }
! 34537: # The second conditions ensures that a @part is stopped by
! 34538: # the first @appendix command.
! 34539: if (defined($previous_sections[$level])
! 34540: and !($section->{'appendix_beginning'} and $previous_sections[$level]->{'tag'} eq 'part' and $previous_sections[$level]->{'part_section_ref'} ne $section))
! 34541: {
! 34542: # toplevel elements have already their up set to the top element,
! 34543: # it is overwriten here for most cases -- this leads to a different
! 34544: # sectionup if there are parts, for instance.
! 34545: # as a side note, it is not touched upon if the element appears
! 34546: # before @top.
! 34547: $section->{'sectionup'} = $previous_sections[$level];
! 34548: # 'child' is the first child.
! 34549: if (!$section->{'sectionup'}->{'child'})
! 34550: {
! 34551: $section->{'sectionup'}->{'child'} = $section;
! 34552: }
! 34553: else
! 34554: {
! 34555: # 'childnext' is the next child of a an element. it may
! 34556: # be different from 'sectionnext' when the elemnt are not
! 34557: # at the same level, for example
! 34558: # @chapter chapter
! 34559: # @subsection subsection (certainly wrong)
! 34560: # @section section (not next of subsection, but childnext)
! 34561: $section->{'sectionup'}->{'section_childs'}->[-1]->{'childnext'} = $section if (defined($section->{'sectionup'}->{'section_childs'}));
! 34562: }
! 34563: push @{$section->{'sectionup'}->{'section_childs'}}, $section;
! 34564: }
! 34565: $previous_sections[$section->{'level'}] = $section;
! 34566: # This is what is used in the .init file.
! 34567: $section->{'up'} = $section->{'sectionup'};
! 34568: # Not used but documented.
! 34569: $section->{'next'} = $section->{'sectionnext'};
! 34570: $section->{'prev'} = $section->{'sectionprev'};
! 34571:
! 34572: ############################# debug
! 34573: my $up = "NO_UP";
! 34574: $up = $section->{'sectionup'} if (defined($section->{'sectionup'}));
! 34575: print STDERR "# numbering section ($section->{'level'}): $section->{'number'}: (up: $up) $section->{'texi'}\n"
! 34576: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 34577: ############################# end debug
! 34578: }
! 34579:
! 34580: # at that point there are still some node structures that are not
! 34581: # in %nodes, (the external nodes, and unknown nodes in case
! 34582: # novalidate is true) so we cannot find the id. The consequence is that
! 34583: # some node equivalent with another node may not be catched during
! 34584: # that pass. We mark the nodes that have directions for unreferenced
! 34585: # nodes and make a second pass for these nodes afterwards.
! 34586: my @nodes_with_unknown_directions = ();
! 34587:
! 34588: my %node_directions = (
! 34589: 'node_prev' => 'nodeprev',
! 34590: 'node_next' => 'nodenext',
! 34591: 'node_up' => 'nodeup');
! 34592: # handle nodes
! 34593: # the node_prev... are texinfo strings, find the associated node references
! 34594: print STDERR "# Resolve nodes directions\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 34595: foreach my $node (@nodes_list)
! 34596: {
! 34597: foreach my $direction (keys(%node_directions))
! 34598: {
! 34599: if (defined($node->{$direction}))
! 34600: {
! 34601: if ($nodes{$node->{$direction}} and $nodes{$node->{$direction}}->{'seen'})
! 34602: {
! 34603: $node->{$node_directions{$direction}} = $nodes{$node->{$direction}};
! 34604: }
! 34605: elsif (($node->{$direction} =~ /^\(.*\)/) or Texi2HTML::Config::get_conf('novalidate'))
! 34606: { # ref to an external node
! 34607: if (exists($nodes{$node->{$direction}}))
! 34608: {
! 34609: $node->{$node_directions{$direction}} = $nodes{$node->{$direction}};
! 34610: }
! 34611: else
! 34612: {
! 34613: my $node_ref = { 'texi' => $node->{$direction} };
! 34614: $node_ref->{'external_node'} = 1 if ($node->{$direction} =~ /^\(.*\)/);
! 34615: $nodes{$node->{$direction}} = $node_ref;
! 34616: $node->{$node_directions{$direction}} = $node_ref;
! 34617: }
! 34618: }
! 34619: else
! 34620: {
! 34621: push @nodes_with_unknown_directions, $node;
! 34622: }
! 34623: }
! 34624: }
! 34625: }
! 34626:
! 34627: # Find cross manual links as explained on the texinfo mailing list
! 34628: # The specification is such that cross manual links formatting should
! 34629: # be insensitive to the manual split
! 34630: cross_manual_links();
! 34631:
! 34632: my %direction_texts = (
! 34633: 'node_prev' => 'Prev',,
! 34634: 'node_next' => 'Next',
! 34635: 'node_up' => 'Up'
! 34636: );
! 34637: # Now it is possible to find the unknown directions that are equivalent
! 34638: # (have same node id) than an existing node
! 34639: foreach my $node (@nodes_with_unknown_directions)
! 34640: {
! 34641: foreach my $direction (keys(%node_directions))
! 34642: {
! 34643: if (defined($node->{$direction}) and !$node->{$node_directions{$direction}})
! 34644: {
! 34645: line_error (sprintf(__("%s reference to nonexistent `%s'"),$direction_texts{$direction}, $node->{$direction}), $node->{'line_nr'}); # for `$node->{'texi'}'"
! 34646: my @equivalent_nodes = equivalent_nodes($node->{$direction});
! 34647: my $node_seen;
! 34648: foreach my $equivalent_node (@equivalent_nodes)
! 34649: {
! 34650: if ($nodes{$equivalent_node}->{'seen'})
! 34651: {
! 34652: $node_seen = $equivalent_node;
! 34653: last;
! 34654: }
! 34655: }
! 34656: if (defined($node_seen))
! 34657: {
! 34658: document_warn ("---> but equivalent node `$node_seen' found");
! 34659: $node->{$node_directions{$direction}} = $nodes{$node_seen};
! 34660: }
! 34661: }
! 34662: }
! 34663: }
! 34664:
! 34665: # nodes are attached to the section preceding them if not already
! 34666: # associated with a section.
! 34667: # a @part should never have nodes associated, if it is associated
! 34668: # with a chapter, instead the chapter pointed on by part_section_ref is
! 34669: # used.
! 34670: my $current_section = $sections_list[0];
! 34671: $current_section = $current_section->{'part_section_ref'} if ($current_section and $current_section->{'part_section_ref'});
! 34672: foreach my $element (@all_elements)
! 34673: {
! 34674: if ($element->{'node'})
! 34675: {
! 34676: if ($element->{'with_section'})
! 34677: { # the node is associated with a section
! 34678: $element->{'section_ref'} = $element->{'with_section'};
! 34679: }
! 34680: elsif (defined($current_section))
! 34681: {# node appearing after a section, but not before another section,
! 34682: # or appearing before any section
! 34683: $element->{'section_ref'} = $current_section;
! 34684: push @{$current_section->{'node_childs'}}, $element;
! 34685: }
! 34686: }
! 34687: else
! 34688: {
! 34689: $current_section = $element;
! 34690: $current_section = $element->{'part_section_ref'} if ($element->{'part_section_ref'});
! 34691: }
! 34692: }
! 34693:
! 34694: print STDERR "# Complete nodes next prev and up based on menus and sections\n"
! 34695: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 34696: # set the default id based on the node number
! 34697: my $node_nr = 1;
! 34698: # find the node* directions
! 34699: # find the directions corresponding with sections
! 34700: # and set 'up' for the node
! 34701: foreach my $node (@nodes_list)
! 34702: {
! 34703: # first a warning if the node and the equivalent nodes don't
! 34704: # appear in menus.
! 34705: # Don't warn for the top node, and the first node if there is no
! 34706: # top node.
! 34707: if ((($node_top and $node ne $node_top) or (!$node_top and $node ne $node_first)) and !$node->{'menu_up'} and $Texi2HTML::Config::SHOW_MENU)
! 34708: {
! 34709: my @equivalent_nodes = equivalent_nodes($node->{'texi'});
! 34710: my $found = 0;
! 34711: foreach my $equivalent_node (@equivalent_nodes)
! 34712: {
! 34713: if (($nodes{$equivalent_node} eq $node_first) or $nodes{$equivalent_node}->{'menu_up'})
! 34714: {
! 34715: $found = 1;
! 34716: last;
! 34717: }
! 34718: }
! 34719: unless ($found)
! 34720: { # makeinfo has also
! 34721: # "`%s' has no Up field (perhaps incorrect sectioning?)"
! 34722: # but it is not useful since the up will always be set if
! 34723: # the node appears in a menu so the following error message
! 34724: # is enough
! 34725: line_warn (sprintf(__("unreferenced node `%s'"), $node->{'texi'}), $node->{'line_nr'});
! 34726: }
! 34727: }
! 34728:
! 34729: # use values deduced from menus to complete missing up, next, prev
! 34730: # or from sectioning commands if automatic sectioning
! 34731: if (!$node->{'nodeup'})
! 34732: {
! 34733: if (defined($node_top) and ($node eq $node_top) and $node->{'automatic_directions'})
! 34734: { # Top node has a special up, which is (dir) by default
! 34735: my $top_nodeup = $Texi2HTML::Config::TOP_NODE_UP;
! 34736: if (exists($nodes{$top_nodeup}))
! 34737: {
! 34738: $node->{'nodeup'} = $nodes{$top_nodeup};
! 34739: }
! 34740: else
! 34741: {
! 34742: my $node_ref = { 'texi' => $top_nodeup };
! 34743: $node_ref->{'external_node'} = 1;
! 34744: $nodes{$top_nodeup} = $node_ref;
! 34745: $node->{'nodeup'} = $node_ref;
! 34746: }
! 34747: }
! 34748: elsif ($node->{'automatic_directions'})
! 34749: {
! 34750: if ($node->{'with_section'})
! 34751: {
! 34752: # ignore the up if it is a @part. If the sectioning is
! 34753: # correct, the element is toplevel and will be handled
! 34754: # by the next condition.
! 34755: if ($node->{'with_section'}->{'sectionup'} and !$node->{'with_section'}->{'sectionup'}->{'part_section_ref'})
! 34756: {
! 34757: $node->{'nodeup'} = get_node($node->{'with_section'}->{'sectionup'});
! 34758: }
! 34759: elsif ($node->{'with_section'}->{'toplevel'} and defined($section_top) and ($node->{'with_section'} ne $section_top))
! 34760: {
! 34761: $node->{'nodeup'} = get_node($section_top);
! 34762: }
! 34763: print STDERR "# Deducing from section node_up $node->{'nodeup'}->{'texi'} for $node->{'texi'}\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS and defined($node->{'nodeup'}));
! 34764: }
! 34765: elsif ($node->{'menu_up'})
! 34766: {
! 34767: $node->{'nodeup'} = $node->{'menu_up'};
! 34768: print STDERR "# Deducing from menu node_up $node->{'menu_up'}->{'texi'} for $node->{'texi'}\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 34769: }
! 34770: }
! 34771: }
! 34772:
! 34773: if ($node->{'nodeup'} and !$node->{'nodeup'}->{'external_node'})
! 34774: {
! 34775: # We detect when the up node has no menu entry for that node, as
! 34776: # there may be infinite loops when finding following node (see below)
! 34777: unless (defined($node->{'menu_up_hash'}) and ($node->{'menu_up_hash'}->{$node->{'nodeup'}->{'texi'}}))
! 34778: {
! 34779: line_error(sprintf(__("Node `%s' lacks menu item for `%s' despite being its Up target"), $node->{'nodeup'}->{'texi'}, $node->{'texi'}), $node->{'nodeup'}->{'line_nr'}) if ($Texi2HTML::Config::SHOW_MENU);
! 34780: push @{$node->{'up_not_in_menu'}}, $node->{'nodeup'}->{'texi'};
! 34781: }
! 34782: }
! 34783: # check that the up is in one of the menus
! 34784: if ($Texi2HTML::Config::SHOW_MENU and $node->{'nodeup'} and $node->{'menu_up'})
! 34785: {
! 34786: my @equivalent_nodes = equivalent_nodes($node->{'nodeup'}->{'texi'});
! 34787: my $found = 0;
! 34788: foreach my $equivalent_node ($node->{'nodeup'}->{'texi'}, @equivalent_nodes)
! 34789: {
! 34790: if ($node->{'menu_up_hash'}->{$equivalent_node})
! 34791: {
! 34792: $found = 1;
! 34793: last;
! 34794: }
! 34795: }
! 34796: unless ($found)
! 34797: {
! 34798: line_warn (sprintf(__("For `%s', up in menu `%s' and up `%s' don't match"), $node->{'texi'}, $node->{'menu_up'}->{'texi'}, $node->{'nodeup'}->{'texi'}), $node->{'line_nr'});
! 34799: }
! 34800:
! 34801: }
! 34802:
! 34803: # Find next node if not already found
! 34804: if ($node->{'nodenext'})
! 34805: {
! 34806: # doing the following would be wrong:
! 34807: #$node->{'nodenext'}->{'nodeprev'} = $node if (!defined($node->{'nodenext'}->{'nodeprev'}));
! 34808: }
! 34809: elsif ($node->{'texi'} eq 'Top' and $node->{'automatic_directions'})
! 34810: { # special case as said in the texinfo manual
! 34811: if ($node->{'menu_child'})
! 34812: {
! 34813: $node->{'nodenext'} = $node->{'menu_child'};
! 34814: $node->{'menu_child'}->{'nodeprev'} = $node;
! 34815: }
! 34816: }
! 34817: elsif ($node->{'automatic_directions'})
! 34818: {
! 34819: if (defined($node->{'with_section'}))
! 34820: {
! 34821: my $next;
! 34822: my $warn_for_next_not_in_menu = 1;
! 34823: my $section = $node->{'with_section'};
! 34824: if ($section->{'sectionnext'})
! 34825: {
! 34826: $next = get_node($section->{'sectionnext'});
! 34827: }
! 34828: # we use toplevelnext, mostly for chapters associated with
! 34829: # @part. But we don't want to have the @top as prev for
! 34830: # a @chapter or the like
! 34831: elsif ($section->{'toplevelnext'} and $section->{'toplevelnext'} ne $section_top)
! 34832: {
! 34833: $next = get_node($section->{'toplevelnext'});
! 34834: }
! 34835: elsif ($Texi2HTML::Config::USE_UP_FOR_ADJACENT_NODES)
! 34836: { # makeinfo don't do that. So this is conditionnal.
! 34837: # Also no warning, because it is expected that the
! 34838: # next found out with the up is not the next in menu.
! 34839: $warn_for_next_not_in_menu = 0;
! 34840: while (defined($section->{'sectionup'}) and !defined($section->{'sectionnext'}))
! 34841: {
! 34842: $section = $section->{'sectionup'};
! 34843: }
! 34844: if (defined($section->{'sectionnext'}))
! 34845: {
! 34846: $next = get_node($section->{'sectionnext'});
! 34847: }
! 34848: }
! 34849: if (defined($next) and $Texi2HTML::Config::SHOW_MENU and $warn_for_next_not_in_menu)
! 34850: {
! 34851: line_warn (sprintf(__("No node following `%s' in menu, but `%s' follows in sectioning"), $node->{'texi'}, $next->{'texi'}), $node->{'line_nr'}) if (!defined($node->{'menu_next'}));
! 34852: line_warn (sprintf(__("Node following `%s' in menu `%s' and in sectioning `%s' differ"), $node->{'texi'}, $node->{'menu_next'}->{'texi'}, $next->{'texi'}), $node->{'line_nr'})
! 34853: if (defined($node->{'menu_next'}) and $next ne $node->{'menu_next'});
! 34854: }
! 34855: $node->{'nodenext'} = $next;
! 34856: }
! 34857: elsif ($node->{'menu_next'})
! 34858: {
! 34859: $node->{'nodenext'} = $node->{'menu_next'};
! 34860: }
! 34861: }
! 34862:
! 34863: # Find prev node
! 34864: if ($node->{'nodeprev'})
! 34865: {
! 34866: # doing the following would be wrong:
! 34867: #$node->{'nodeprev'}->{'nodenext'} = $node if (!defined($node->{'nodeprev'}->{'nodenext'}));
! 34868: }
! 34869: elsif ($node->{'automatic_directions'})
! 34870: {
! 34871: if (defined($node->{'with_section'}))
! 34872: {
! 34873: my $section = $node->{'with_section'};
! 34874: if ($section->{'sectionprev'})
! 34875: {
! 34876: $node->{'nodeprev'} = get_node($section->{'sectionprev'});
! 34877: }
! 34878: # we use toplevelprev, mostly for chapters associated with
! 34879: # @part. But we don't want to have the @top as prev for
! 34880: # a @chapter or the like
! 34881: elsif ($section->{'toplevelprev'} and $section->{'toplevelprev'} ne $section_top)
! 34882: {
! 34883: $node->{'nodeprev'} = get_node($section->{'toplevelprev'});
! 34884: }
! 34885: elsif ($Texi2HTML::Config::USE_UP_FOR_ADJACENT_NODES and defined($section->{'sectionup'}))
! 34886: { # makeinfo don't do that
! 34887: $node->{'nodeprev'} = get_node($section->{'sectionup'});
! 34888: }
! 34889: }
! 34890: elsif ($node->{'menu_prev'})
! 34891: {
! 34892: $node->{'nodeprev'} = $node->{'menu_prev'};
! 34893: }
! 34894: # the prev node is the parent node
! 34895: elsif ($node->{'menu_up'} and ($node->{'menu_up'}->{'menu_child'} eq $node) and $Texi2HTML::Config::USE_UP_FOR_ADJACENT_NODES)
! 34896: {
! 34897: $node->{'nodeprev'} = $node->{'menu_up'};
! 34898: }
! 34899: }
! 34900:
! 34901: # the following node is the node following in node reading order
! 34902: # it is thus first the child, else the next, else the next following
! 34903: # the up
! 34904: if ($node->{'menu_child'})
! 34905: {
! 34906: $node->{'following'} = $node->{'menu_child'};
! 34907: }
! 34908: elsif ($node->{'automatic_directions'} and defined($node->{'with_section'}) and defined($node->{'with_section'}->{'child'}))
! 34909: {
! 34910: $node->{'following'} = get_node($node->{'with_section'}->{'child'});
! 34911: }
! 34912: elsif (defined($node->{'nodenext'}))
! 34913: {
! 34914: $node->{'following'} = $node->{'nodenext'};
! 34915: }
! 34916: else
! 34917: {
! 34918: my $up = $node->{'nodeup'};
! 34919: # in order to avoid infinite recursion in case the up node is the
! 34920: # node itself we use the up node as following when there isn't
! 34921: # a correct menu structure, here and also below.
! 34922: $node->{'following'} = $up if (defined($up) and grep {$_ eq $up->{'texi'}} @{$node->{'up_not_in_menu'}});
! 34923: while ((!defined($node->{'following'})) and (defined($up)))
! 34924: {
! 34925: if (($node_top) and ($up eq $node_top))
! 34926: { # if we are at Top, Top is following
! 34927: $node->{'following'} = $node_top;
! 34928: $up = undef;
! 34929: }
! 34930: if (defined($up->{'nodenext'}))
! 34931: {
! 34932: $node->{'following'} = $up->{'nodenext'};
! 34933: }
! 34934: elsif (defined($up->{'nodeup'}))
! 34935: {
! 34936: if (! grep { $_ eq $up->{'nodeup'}->{'texi'} } @{$node->{'up_not_in_menu'}})
! 34937: {
! 34938: $up = $up->{'nodeup'};
! 34939: }
! 34940: else
! 34941: { # in that case we can go into a infinite loop
! 34942: $node->{'following'} = $up->{'nodeup'};
! 34943: }
! 34944: }
! 34945: else
! 34946: {
! 34947: $up = undef;
! 34948: }
! 34949: }
! 34950: }
! 34951: # copy the direction of the associated section.
! 34952: if (defined($node->{'with_section'}))
! 34953: {
! 34954: my $section = $node->{'with_section'};
! 34955: foreach my $direction ('sectionnext', 'sectionprev', 'sectionup')
! 34956: {
! 34957: $node->{$direction} = $section->{$direction}
! 34958: if (defined($section->{$direction}));
! 34959: }
! 34960: }
! 34961: # 'up' is used in .init files. It is almost sectionup, but not
! 34962: # exactly, it allows to have something relevant whether elements
! 34963: # are nodes or sections -- just like Back and Forward. So it
! 34964: # should certainly be kept.
! 34965: if (defined($node->{'sectionup'}))
! 34966: {
! 34967: $node->{'up'} = $node->{'sectionup'};
! 34968: }
! 34969: elsif (defined($node->{'nodeup'}) and
! 34970: (!$node_top or ($node ne $node_top)))
! 34971: {
! 34972: $node->{'up'} = $node->{'nodeup'};
! 34973: }
! 34974: # 'next' not used but documented.
! 34975: if (defined($node->{'sectionnext'}))
! 34976: {
! 34977: $node->{'next'} = $node->{'sectionnext'};
! 34978: }
! 34979: if (defined($node->{'sectionprev'}))
! 34980: {
! 34981: $node->{'prev'} = $node->{'sectionprev'};
! 34982: }
! 34983:
! 34984: # default id for nodes. Should be overriden later.
! 34985: $node->{'id'} = 'NOD' . $node_nr;
! 34986: $node_nr++;
! 34987: }
! 34988:
! 34989: # do node directions for sections.
! 34990: foreach my $section (@sections_list)
! 34991: {
! 34992: # If the element is not a node, then all the node directions are copied
! 34993: # if there is an associated node
! 34994: if (defined($section->{'with_node'}))
! 34995: {
! 34996: $section->{'nodenext'} = $section->{'with_node'}->{'nodenext'};
! 34997: $section->{'nodeprev'} = $section->{'with_node'}->{'nodeprev'};
! 34998: $section->{'menu_next'} = $section->{'with_node'}->{'menu_next'};
! 34999: $section->{'menu_prev'} = $section->{'with_node'}->{'menu_prev'};
! 35000: $section->{'menu_child'} = $section->{'with_node'}->{'menu_child'};
! 35001: $section->{'menu_up'} = $section->{'with_node'}->{'menu_up'};
! 35002: $section->{'nodeup'} = $section->{'with_node'}->{'nodeup'};
! 35003: $section->{'following'} = $section->{'with_node'}->{'following'};
! 35004: }
! 35005: }
! 35006:
! 35007: my $only_nodes = 0;
! 35008: my $only_sections = 0;
! 35009:
! 35010: # for legibility
! 35011: my $use_nodes = $Texi2HTML::Config::USE_NODES;
! 35012: my $use_sections = $Texi2HTML::Config::USE_SECTIONS;
! 35013:
! 35014: $only_nodes = 1 if (
! 35015: (!scalar(@sections_list) and
! 35016: ($use_nodes or (!$use_sections and !defined($use_nodes))))
! 35017: or ($use_nodes and !$use_sections)
! 35018: );
! 35019: $only_sections = 1 if (!$only_nodes and !$use_nodes and ($use_sections or !defined($use_sections)));
! 35020: #print STDERR "USE_NODES $use_nodes, USE_SECTIONS $use_sections. only_nodes: $only_nodes, only_sections $only_sections\n";
! 35021:
! 35022: my $prev_element;
! 35023: print STDERR "# Build the elements list only_nodes: $only_nodes, only_sections $only_sections\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35024: foreach my $element (@all_elements)
! 35025: {
! 35026: if ($element->{'node'})
! 35027: {
! 35028: if ($element->{'section_ref'} and ($only_sections or (!$only_nodes and $element->{'with_section'})))
! 35029: {
! 35030: add_t2h_dependent_element ($element, $element->{'section_ref'});
! 35031: #$element->{'toc_level'} = $element->{'section_ref'}->{'toc_level'};
! 35032: }
! 35033: elsif (!$only_sections)
! 35034: {
! 35035: $prev_element = add_t2h_element($element, \@elements_list, $prev_element);
! 35036: }
! 35037: else # $only_section and !$section_ref. This should only
! 35038: # happen when there are no sections
! 35039: {
! 35040: #print STDERR "node $element->{'texi'} not associated with an element\n";
! 35041: }
! 35042: }
! 35043: else
! 35044: {
! 35045: my $part_element = $element->{'part_section_ref'};
! 35046: if (($element->{'node_ref'} or ($part_element and $part_element->{'node_ref'})) and $only_nodes)
! 35047: {
! 35048: my $element_with_node = $element;
! 35049: $element_with_node = $part_element if ($part_element);
! 35050: add_t2h_dependent_element ($element, $element_with_node->{'node_ref'});
! 35051: }
! 35052: elsif (!$only_nodes)
! 35053: {
! 35054: if ($part_element)
! 35055: {
! 35056: add_t2h_dependent_element ($element, $part_element);
! 35057: }
! 35058: else
! 35059: {
! 35060: $prev_element = add_t2h_element($element, \@elements_list, $prev_element);
! 35061: }
! 35062: }
! 35063: else
! 35064: { # no node, and $only_nodes
! 35065: #print STDERR "$element->{'tag'} $element->{'texi'} not associated with an element\n";
! 35066: }
! 35067: }
! 35068: }
! 35069:
! 35070: # find texi2html specific directions and elements that are not texinfo
! 35071: # language features.
! 35072: #
! 35073: # Maybe Config hooks should be used at that point (up to index
! 35074: # preparation)
! 35075: #
! 35076: # find first, last and top elements
! 35077: if (@elements_list)
! 35078: {
! 35079: $element_first = $elements_list[0];
! 35080: print STDERR "# element first: $element_first->{'texi'}\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35081: # It is the last element before indices split, which may add new
! 35082: # elements
! 35083: $element_last = $elements_list[-1];
! 35084: }
! 35085: else
! 35086: {
! 35087: print STDERR "# \@elements_list is empty\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35088: }
! 35089: print STDERR "# top node: $node_top->{'texi'}\n" if (defined($node_top) and
! 35090: ($T2H_DEBUG & $DEBUG_ELEMENTS));
! 35091:
! 35092: # Remark: there are many subtle distinctions among the elements that
! 35093: # have a flavor of being at top. First there are the texinfo top
! 35094: # elements (if present), namely $section_top for the @top element
! 35095: # and $node_top for the @node Top element (and both may be associated).
! 35096:
! 35097: # Then there is $element_top, set up just below. In addition to
! 35098: # $section_top and $node_top, the section associated with $node_top
! 35099: # and the first element may be used. $element_top is used to determine
! 35100: # file splitting and file names, since it is always associated with
! 35101: # $docu_top file.
! 35102:
! 35103: # The $element_top may have 'top' set, in case it is a node or @top.
! 35104: # In that case, special formatting is done, like using print_Top and
! 35105: # similar.
! 35106:
! 35107: # Similarly with element_top, some other nodes than $node_top may
! 35108: # get associated with the top node filename without being considered
! 35109: # as top otherwise (this is done below).
! 35110:
! 35111: if (defined($section_top) and $section_top->{'this'})
! 35112: {
! 35113: # element top is the element with @top.
! 35114: $element_top = $section_top;
! 35115: }
! 35116: elsif (defined($node_top) and $node_top->{'this'})
! 35117: {
! 35118: # otherwise top node may be the element_top
! 35119: $element_top = $node_top;
! 35120: }
! 35121: elsif (defined($node_top) and defined($node_top->{'with_section'}) and $node_top->{'with_section'}->{'this'})
! 35122: {
! 35123: # next, the element associated with the @node Top may be
! 35124: # the $element_top. In that case $element_top->{'top'} won't be set
! 35125: $element_top = $node_top->{'with_section'};
! 35126: }
! 35127: elsif (defined($element_first))
! 35128: {
! 35129: # If there is no @top section no top node associated with an element,
! 35130: # first element is used
! 35131: $element_top = $element_first;
! 35132: }
! 35133:
! 35134: # Rather arbitrarily, 'top' is set for nodes as top elements
! 35135: # and @top. This triggers specific formatting, like calling
! 35136: # print_Top and similar things.
! 35137: if (defined($element_top))
! 35138: {
! 35139: $element_top->{'top'} = 1 if ($element_top->{'node'} or $element_top->{'tag'} eq 'top');
! 35140: print STDERR "# element top: $element_top->{'texi'}\n" if ($element_top and
! 35141: ($T2H_DEBUG & $DEBUG_ELEMENTS));
! 35142: }
! 35143:
! 35144: print STDERR "# find fastback and fastforward\n"
! 35145: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35146: foreach my $element (@elements_list)
! 35147: { # nodes are ignored here, although their associated sectioning
! 35148: # command may be taken into account.
! 35149: my $up = get_top($element);
! 35150: next unless (defined($up));
! 35151: # take the opportunity to set the first chapter with index
! 35152: $element_chapter_index = $up if ($element_index and ($element_index eq $element));
! 35153: # fastforward is the next element on same level than the upper parent
! 35154: # element.
! 35155: if (exists ($up->{'toplevelnext'}))
! 35156: {
! 35157: $element->{'fastforward'} = $up->{'toplevelnext'}
! 35158: }
! 35159: # if the element isn't at the highest level, fastback is the
! 35160: # highest parent element
! 35161: if ($up and ($up ne $element))
! 35162: {
! 35163: $element->{'fastback'} = $up;
! 35164: }
! 35165: elsif ($element->{'toplevel'})
! 35166: {
! 35167: # the element is a top level element, we adjust the next
! 35168: # toplevel element fastback
! 35169: $element->{'fastforward'}->{'fastback'} = $element if ($element->{'fastforward'});
! 35170: }
! 35171: }
! 35172:
! 35173: # set 'reference_element' which is used each time there is a cross ref
! 35174: # to that node (xref and menu entry), to do the href, and also the
! 35175: # element heading text.
! 35176: # It is the section associated with the node if there are only sections.
! 35177: # Since in the default case the target is the node target, even for
! 35178: # sections, this, in fact shouldn't lead to a different target, unless
! 35179: # the node and the section don't have the same file associated, which could
! 35180: # only happen with indices split. The heading text will be different, though.
! 35181: # The node name should also always be passed to the formatting functions
! 35182: # such that it is always possible for the formatting to chose the node
! 35183: # heading over the element heading selected using 'reference_element'.
! 35184: if ($only_sections)
! 35185: {
! 35186: foreach my $node(@nodes_list)
! 35187: {
! 35188: if ($node->{'with_section'})
! 35189: {
! 35190: $node->{'reference_element'} = $node->{'with_section'};
! 35191: }
! 35192: }
! 35193: }
! 35194: # the symmetric is not done for sections, since there is no crossref
! 35195: # to sections in texinfo (only to anchors and nodes), so that when
! 35196: # there is a link to an element (in Toc, for instance),
! 35197: # there is no reason to want to have the node (though, once again,
! 35198: # the href is almost surely the same than what would be with the node,
! 35199: # the heading would be different).
! 35200:
! 35201: # end texi2html added directions
! 35202:
! 35203: # do human readable id
! 35204: print STDERR "# find float id\n"
! 35205: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35206: foreach my $float (@floats)
! 35207: {
! 35208: $float->{'style_id'} = cross_manual_line($float->{'style_texi'});
! 35209: my $float_style = { };
! 35210: if (exists($floats{$float->{'style_id'}}))
! 35211: {
! 35212: $float_style = $floats{$float->{'style_id'}};
! 35213: }
! 35214: else
! 35215: {
! 35216: $floats{$float->{'style_id'}} = $float_style;
! 35217: }
! 35218: push @{$float_style->{'floats'}}, $float;
! 35219: $float->{'absolute_nr'} = scalar(@{$float_style->{'floats'}});
! 35220: my $up = get_top($float->{'element'});
! 35221: if (defined($up) and (!defined($float_style->{'current_chapter'}) or ($up->{'texi'} ne $float_style->{'current_chapter'})))
! 35222: {
! 35223: $float_style->{'current_chapter'} = $up->{'texi'};
! 35224: $float_style->{'nr_in_chapter'} = 1;
! 35225: }
! 35226: else
! 35227: {
! 35228: $float_style->{'nr_in_chapter'}++;
! 35229: }
! 35230: if (defined($up) and $up->{'toplevel'} and $up->{'number'} ne '')
! 35231: {
! 35232: $float->{'chapter_nr'} = $up->{'plain_number'};
! 35233: $float->{'nr'} = $float->{'chapter_nr'} . "." . $float_style->{'nr_in_chapter'};
! 35234: }
! 35235: else
! 35236: {
! 35237: $float->{'nr'} = $float->{'absolute_nr'};
! 35238: }
! 35239: }
! 35240:
! 35241: print STDERR "# do human-readable index entries id\n"
! 35242: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35243: if ($Texi2HTML::Config::NEW_CROSSREF_STYLE)
! 35244: {
! 35245: foreach my $entry_region (sort(keys(%{$Texi2HTML::THISDOC{'index_entries_region_array'}})))
! 35246: {
! 35247: foreach my $index_entry (@{$Texi2HTML::THISDOC{'index_entries_region_array'}->{$entry_region}})
! 35248: {
! 35249: my $region = '';
! 35250: $region = "$index_entry->{'region'}-" if (defined($index_entry->{'region'}) and $index_entry->{'region'} ne '');
! 35251: my $index_id = "index-" . $region .$index_entry->{'cross'};
! 35252: my $index = 1;
! 35253: # $index > 0 should prevent integer overflow, hopefully
! 35254: while (exists($cross_reference_nodes{$index_id}) and $index > 0)
! 35255: {
! 35256: $index_id = "index-" . $region . $index_entry->{'cross'} . "-" .$index;
! 35257: $index++;
! 35258: }
! 35259: $index_entry->{'id'} = $index_id;
! 35260: $index_entry->{'target'} = $index_id;
! 35261: my $texi_entry = "index-".$region.$index_entry->{'texi'};
! 35262: $texi_entry .= "-".$index if ($index > 1);
! 35263: push @{$cross_reference_nodes{$index_id}}, $texi_entry;
! 35264: }
! 35265: }
! 35266: }
! 35267:
! 35268:
! 35269: if ($Texi2HTML::Config::NEW_CROSSREF_STYLE)
! 35270: {
! 35271: foreach my $key (keys(%nodes))
! 35272: {
! 35273: my $node = $nodes{$key};
! 35274: next if ($node->{'external_node'});
! 35275: $node->{'id'} = node_to_id($node->{'cross_manual_target'});
! 35276: # FIXME if NEW_CROSSREF_STYLE false is it done for anchors?
! 35277: $node->{'target'} = $node->{'id'};
! 35278: }
! 35279: }
! 35280:
! 35281: # use %sections and %headings to modify also the headings
! 35282: foreach my $section (values(%sections), values(%headings))
! 35283: {
! 35284: if ($Texi2HTML::Config::NEW_CROSSREF_STYLE and ($section->{'cross'} =~ /\S/))
! 35285: {
! 35286: my $section_cross = $section->{'cross'};
! 35287: if (defined($section->{'region'}))
! 35288: { # for headings appearing in special regions like @copying...
! 35289: $section_cross = "${target_prefix}-$section->{'region'}_$section_cross";
! 35290: }
! 35291: $section->{'cross_manual_target'} = $section_cross;
! 35292:
! 35293: my $index = 1;
! 35294: # $index > 0 should prevent integer overflow, hopefully
! 35295: while (exists($cross_reference_nodes{$section->{'cross_manual_target'}}) and $index > 0)
! 35296: {
! 35297: $section->{'cross_manual_target'} = $section_cross . "-" .$index;
! 35298: $index++;
! 35299: }
! 35300: my $texi_entry = $section->{'texi'};
! 35301: $texi_entry .= "-".$index if ($index > 1);
! 35302: push @{$cross_reference_nodes{$section->{'cross_manual_target'}}}, $texi_entry;
! 35303: $section->{'id'} = node_to_id($section->{'cross_manual_target'});
! 35304: }
! 35305: }
! 35306: # use the associated @part as target if there is an associated part.
! 35307: # do it separately to be sure that all the parts have an id.
! 35308: foreach my $section (values(%sections), values(%headings))
! 35309: {
! 35310: my $target = $section;
! 35311: $target = $section->{'with_part'} if ($section->{'with_part'});
! 35312: if ($Texi2HTML::Config::USE_NODE_TARGET and $target->{'with_node'})
! 35313: {
! 35314: $section->{'target'} = $target->{'with_node'}->{'target'};
! 35315: }
! 35316: else
! 35317: {
! 35318: $section->{'target'} = $target->{'id'};
! 35319: }
! 35320: }
! 35321:
! 35322: # construct human readable tocid
! 35323: foreach my $section (values(%sections))
! 35324: {
! 35325: if ($Texi2HTML::Config::NEW_CROSSREF_STYLE and ($section->{'cross'} =~ /\S/))
! 35326: {
! 35327: foreach my $toc_id (['tocid','toc'], ['stocid', 'stoc'])
! 35328: {
! 35329: my $id_string = $toc_id->[0];
! 35330: my $prefix_string = $toc_id->[1];
! 35331: my $cross_string = '-' . $section->{'cross_manual_target'};
! 35332: $section->{$id_string} = $prefix_string . $cross_string;
! 35333: my $index = 1;
! 35334: # $index > 0 should prevent integer overflow, hopefully
! 35335: while (exists($cross_reference_nodes{$section->{$id_string}}) and $index > 0)
! 35336: {
! 35337: $section->{$id_string} = $prefix_string . "-" .$index .$cross_string;
! 35338: $index++;
! 35339: }
! 35340: my $texi_entry = $prefix_string.'-'.$section->{'texi'};
! 35341: $texi_entry = $prefix_string .'-'.$index.'-'.$section->{'texi'} if ($index > 1);
! 35342: push @{$cross_reference_nodes{$section->{$id_string}}}, $texi_entry;
! 35343: }
! 35344: }
! 35345: }
! 35346: if (!$Texi2HTML::Config::NEW_CROSSREF_STYLE)
! 35347: {
! 35348: my $tocnr = 1;
! 35349: foreach my $element (@elements_list)
! 35350: {
! 35351: $element->{'tocid'} = 'TOC' . $tocnr;
! 35352: $tocnr++;
! 35353: }
! 35354: }
! 35355:
! 35356: # Set file names
! 35357: # Find node file names and file names for nodes considered as elements
! 35358: my $node_as_top;
! 35359: if ($node_top)
! 35360: {
! 35361: $node_as_top = $node_top;
! 35362: }
! 35363: # following possibilities lead to some node being considered
! 35364: # as top for the purpose of setting the file node, but not as node_top
! 35365: elsif ($element_top->{'with_node'})
! 35366: {
! 35367: $node_as_top = $element_top->{'with_node'};
! 35368: }
! 35369: else
! 35370: {
! 35371: $node_as_top = $node_first;
! 35372: }
! 35373: if ($node_as_top)
! 35374: {
! 35375: do_node_target_file($node_as_top, 'top');
! 35376: }
! 35377: foreach my $key (keys(%nodes))
! 35378: {
! 35379: my $node = $nodes{$key};
! 35380: next if (defined($node_as_top) and ($node eq $node_as_top));
! 35381: do_node_target_file($node,'');
! 35382: }
! 35383:
! 35384: print STDERR "# split(".Texi2HTML::Config::get_conf('SPLIT').") and set files\n"
! 35385: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35386: # find document nr and document file for sections and nodes.
! 35387: # Split according to Texi2HTML::Config::SPLIT.
! 35388: # find file and id for placed elements (anchors, index entries, headings)
! 35389: if (Texi2HTML::Config::get_conf('SPLIT'))
! 35390: {
! 35391: $Texi2HTML::THISDOC{'split_level'} = $toplevel;
! 35392: my $doc_nr = -1;
! 35393: if (Texi2HTML::Config::get_conf('SPLIT') eq 'section')
! 35394: {
! 35395: $Texi2HTML::THISDOC{'split_level'} = 2 if ($toplevel <= 2);
! 35396: }
! 35397: my $previous_file;
! 35398: my $previous_is_top = 0;
! 35399: foreach my $element (@elements_list)
! 35400: {
! 35401: print STDERR "# Splitting (".Texi2HTML::Config::get_conf('SPLIT').":$Texi2HTML::THISDOC{'split_level'}) $element->{'texi'}\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35402: my $new_file = 0;
! 35403: if (
! 35404: (!defined($previous_file)) or
! 35405: (Texi2HTML::Config::get_conf('SPLIT') eq 'node') or
! 35406: (
! 35407: defined($element->{'level'}) and ($element->{'level'} <= $Texi2HTML::THISDOC{'split_level'})
! 35408: ) or
! 35409: (
! 35410: !defined($element->{'level'}) and defined($element->{'with_section'}) and ($element->{'with_section'}->{'level'} <= $Texi2HTML::THISDOC{'split_level'})
! 35411: ) or
! 35412: ( # top file after another file
! 35413: (defined($previous_file) and ($element eq $element_top)
! 35414: and ($previous_file ne $docu_top))
! 35415: ) # element following top element is always considered to be
! 35416: # in a different file.
! 35417: or ($previous_is_top)
! 35418: )
! 35419: {
! 35420: $new_file = 1;
! 35421: $doc_nr++;
! 35422: }
! 35423: $previous_is_top = 0 if ($previous_is_top);
! 35424:
! 35425: $element->{'doc_nr'} = $doc_nr;
! 35426: $element->{'file'} = "${docu_name}_$doc_nr"
! 35427: . (defined($Texi2HTML::THISDOC{'extension'}) ? ".$Texi2HTML::THISDOC{'extension'}" : '');
! 35428: my $use_node_file = 0;
! 35429: if ($element eq $element_top)
! 35430: { # the top element
! 35431: $element->{'file'} = $docu_top;
! 35432: $previous_is_top = 1;
! 35433: }
! 35434: elsif ($Texi2HTML::Config::NODE_FILENAMES)
! 35435: {
! 35436: $use_node_file = 1;
! 35437: if ($new_file)
! 35438: {
! 35439: my $node = get_node($element);
! 35440: if ($node and defined($node->{'node_file'}))
! 35441: {
! 35442: $element->{'file'} = $node->{'node_file'};
! 35443: }
! 35444: elsif ($element->{'cross'} =~ /\S/)
! 35445: { # use the canonicalized/transliterated section file name.
! 35446: $element->{'file'} = $element->{'cross'}
! 35447: . (defined($Texi2HTML::THISDOC{'extension'}) ? ".$Texi2HTML::THISDOC{'extension'}" : '');
! 35448: }
! 35449: # The remaining case is for sectioning elements with empty
! 35450: # headings and no node associated. They will have a name
! 35451: # with numbers, like "${docu_name}_$doc_nr", they may
! 35452: # collide with split indices names
! 35453: }
! 35454: else
! 35455: {
! 35456: $element->{'file'} = $previous_file;
! 35457: }
! 35458: }
! 35459: $previous_file = $element->{'file'};
! 35460: do_element_targets($element, $use_node_file);
! 35461: print STDERR "# [$doc_nr] add_file($use_node_file,$new_file,".var_to_str($previous_file).") $element->{'file'} for $element->{'texi'}\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35462: add_file($element->{'file'});
! 35463: }
! 35464: }
! 35465: else
! 35466: { # not split
! 35467: add_file($docu_doc);
! 35468: foreach my $element(@elements_list)
! 35469: {
! 35470: $element->{'file'} = $docu_doc;
! 35471: $element->{'doc_nr'} = 0;
! 35472: do_element_targets($element);
! 35473: }
! 35474: }
! 35475: # 'pathological' cases. No texinfo sectioning element at all or no
! 35476: # texi2html sectioning elements
! 35477: if (!@elements_list)
! 35478: {
! 35479: if (@all_elements)
! 35480: {
! 35481: # in fact this happens only if there is no top element, but still
! 35482: # sections, so only if USE_SECTIONS = 0 and there is no node.
! 35483: #document_warn ("No elements available for splitting") if (Texi2HTML::Config::get_conf('SPLIT'));
! 35484: foreach my $element (@all_elements)
! 35485: {
! 35486: #print STDERR "# no \@elements_list. Processing $element->{'texi'}\n";
! 35487: $element->{'file'} = $docu_doc;
! 35488: $element->{'doc_nr'} = 0;
! 35489: push @{$element->{'place'}}, @{$element->{'current_place'}};
! 35490: do_element_targets($element,$Texi2HTML::Config::NODE_FILENAMES);
! 35491: print STDERR "# no \@elements_list, setting $element->{'file'} for $element->{'texi'}\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35492: }
! 35493: add_file($docu_doc);
! 35494: }
! 35495: else
! 35496: {
! 35497: #document_warn ("No elements at all") if (Texi2HTML::Config::get_conf('SPLIT'));
! 35498: $element_before_anything->{'file'} = $docu_doc;
! 35499: $element_before_anything->{'doc_nr'} = 0;
! 35500: do_element_targets($element_before_anything,$Texi2HTML::Config::NODE_FILENAMES);
! 35501: print STDERR "# no element at all, setting $element_before_anything->{'file'} for $element_before_anything->{'texi'}\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35502: }
! 35503: }
! 35504:
! 35505: # correct the id and file for the things placed in footnotes
! 35506: foreach my $place(@{$footnote_element->{'place'}})
! 35507: {
! 35508: do_place_target_file ($place, $footnote_element, 'footnotes');
! 35509: }
! 35510: # if setcontentsaftertitlepage is set, the contents should be associated
! 35511: # with the titlepage. That's what is done there.
! 35512: push @$no_element_associated_place, $content_element{'contents'}
! 35513: if (Texi2HTML::Config::get_conf('contents') and $Texi2HTML::THISDOC{'setcontentsaftertitlepage'});
! 35514: push @$no_element_associated_place, $content_element{'shortcontents'}
! 35515: if (Texi2HTML::Config::get_conf('shortcontents') and $Texi2HTML::THISDOC{'setshortcontentsaftertitlepage'});
! 35516: # correct the id and file for the things placed in regions (copying...)
! 35517: foreach my $place(@$no_element_associated_place)
! 35518: {
! 35519: #print STDERR "entry $place->{'entry'} texi $place->{'texi'}\n";
! 35520: $place->{'element'} = $element_top if (exists($place->{'element'}));
! 35521: do_place_target_file ($place, $element_top, 'no_associated_element');
! 35522: }
! 35523:
! 35524: # determine contents element and files
! 35525: foreach my $content_type(keys(%content_element))
! 35526: {
! 35527: # with set*aftertitlepage, there will always be a href to Contents
! 35528: # or Overview pointing to the top element, even if there is no
! 35529: # titlepage outputed.
! 35530: if (!scalar(@{$all_content_elements{$content_type}}))
! 35531: {
! 35532: if ($Texi2HTML::Config::INLINE_CONTENTS)
! 35533: {
! 35534: print STDERR "# No content $content_type\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35535: $content_element{$content_type} = undef;
! 35536: }
! 35537: }
! 35538: elsif ($Texi2HTML::Config::INLINE_CONTENTS and !Texi2HTML::Config::get_conf('set' . $content_type .'aftertitlepage'))
! 35539: { # use the last element for references in case there is more than one
! 35540: $content_element{$content_type} = $all_content_elements{$content_type}->[-1];
! 35541: }
! 35542: }
! 35543: my ($toc_file, $stoc_file);
! 35544: $toc_file = $docu_toc;
! 35545: $stoc_file = $docu_stoc;
! 35546: if ($Texi2HTML::Config::INLINE_CONTENTS)
! 35547: {
! 35548: $toc_file = $content_element{'contents'}->{'file'} if (defined($content_element{'contents'}));
! 35549: $stoc_file = $content_element{'shortcontents'}->{'file'} if (defined($content_element{'shortcontents'}));
! 35550: }
! 35551: $Texi2HTML::THISDOC{'toc_file'} = $toc_file;
! 35552: $Texi2HTML::THISDOC{'stoc_file'} = $stoc_file;
! 35553:
! 35554: print STDERR "# find NextFile and PrevFile\n"
! 35555: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35556: foreach my $element (@elements_list)
! 35557: {
! 35558: my $current_element = $element;
! 35559: my $file = $current_element->{'file'};
! 35560: my $previous_file;
! 35561: while ($current_element->{'back'})
! 35562: {
! 35563: #print STDERR "Back $current_element->{'texi'}\n";
! 35564: $current_element = $current_element->{'back'};
! 35565: if ($current_element->{'file'} ne $file)
! 35566: {
! 35567: $previous_file = $current_element->{'file'};
! 35568: last;
! 35569: }
! 35570: }
! 35571: if (defined($previous_file))
! 35572: {
! 35573: while ($current_element->{'back'})
! 35574: {
! 35575: if ($current_element->{'back'}->{'file'} ne $previous_file)
! 35576: {
! 35577: last;
! 35578: }
! 35579: $current_element = $current_element->{'back'};
! 35580: }
! 35581: $element->{'prevfile'} = $current_element;
! 35582: }
! 35583:
! 35584: $current_element = $element;
! 35585: while ($current_element->{'forward'})
! 35586: {
! 35587: #print STDERR "Fwd $current_element->{'texi'}\n";
! 35588: $current_element = $current_element->{'forward'};
! 35589: if ($current_element->{'file'} ne $file)
! 35590: {
! 35591: $element->{'nextfile'} = $current_element;
! 35592: }
! 35593: }
! 35594: }
! 35595: # convert directions in direction with first letter in all caps, to be
! 35596: # consistent with the convention used in the .init file.
! 35597: foreach my $element (@elements_list)
! 35598: {
! 35599: foreach my $direction (@element_directions)
! 35600: {
! 35601: my $direction_no_caps = $direction;
! 35602: $direction_no_caps =~ tr/A-Z/a-z/;
! 35603: $element->{$direction} = $element->{$direction_no_caps};
! 35604: }
! 35605: }
! 35606:
! 35607: ########################### debug prints
! 35608: foreach my $file (keys(%files))
! 35609: {
! 35610: last unless ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35611: print STDERR "$file: counter $files{$file}->{'counter'}\n";
! 35612: }
! 35613: my $output_elements = \@elements_list;
! 35614: if (!scalar(@elements_list) and ($T2H_DEBUG & $DEBUG_ELEMENTS))
! 35615: {
! 35616: print STDERR "No elements_list, no texi2html elements\n";
! 35617: $output_elements = \@all_elements;
! 35618: }
! 35619: foreach my $element ((@$output_elements, $footnote_element))
! 35620: {
! 35621: last unless ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 35622: my $is_toplevel = 'not toplevel';
! 35623: $is_toplevel = 'toplevel' if ($element->{'toplevel'});
! 35624: print STDERR "$element ";
! 35625: if ($element->{'node'})
! 35626: {
! 35627: print STDERR "node($element->{'id'}, $is_toplevel, doc_nr $element->{'doc_nr'}($element->{'file'})) $element->{'texi'}:\n";
! 35628: print STDERR " section_ref: $element->{'section_ref'}->{'texi'}\n" if (defined($element->{'section_ref'}));
! 35629: print STDERR " with_section: $element->{'with_section'}->{'texi'}\n" if (defined($element->{'with_section'}));
! 35630: }
! 35631: elsif ($element->{'footnote'})
! 35632: {
! 35633: print STDERR "footnotes($element->{'id'}, file $element->{'file'})\n";
! 35634: }
! 35635: else
! 35636: {
! 35637: my $number = "UNNUMBERED";
! 35638: $number = $element->{'number'} if ($element->{'number'});
! 35639: print STDERR "$number ($element->{'id'}, $is_toplevel, level $element->{'level'}-$element->{'toc_level'}, doc_nr $element->{'doc_nr'}($element->{'file'})) $element->{'texi'}:\n";
! 35640: print STDERR " with_node: $element->{'with_node'}->{'texi'}\n" if (defined($element->{'with_node'}));
! 35641: print STDERR " node_ref: $element->{'node_ref'}->{'texi'}\n" if (defined($element->{'node_ref'}));
! 35642: }
! 35643:
! 35644: if (!$element->{'footnote'})
! 35645: {
! 35646: if (!defined($files{$element->{'file'}}))
! 35647: {
! 35648: die "Bug: files{\$element->{'file'}} undef element $element->{'texi'}, file $element->{'file'}.";
! 35649: }
! 35650: print STDERR " file: $element->{'file'} $files{$element->{'file'}}, counter $files{$element->{'file'}}->{'counter'}\n";
! 35651: }
! 35652: print STDERR " level: $element->{'level'}\n" if (defined($element->{'level'}));
! 35653: print STDERR " TOP($toplevel) " if ($element->{'top'});
! 35654: print STDERR " u: $element->{'up'}->{'texi'}\n" if (defined($element->{'up'}));
! 35655: print STDERR " ch: $element->{'child'}->{'texi'}\n" if (defined($element->{'child'}));
! 35656: print STDERR " fb: $element->{'fastback'}->{'texi'}\n" if (defined($element->{'fastback'}));
! 35657: print STDERR " b: $element->{'back'}->{'texi'}\n" if (defined($element->{'back'}));
! 35658: print STDERR " p: $element->{'prev'}->{'texi'}\n" if (defined($element->{'prev'}));
! 35659: print STDERR " u: $element->{'sectionup'}->{'texi'}\n" if (defined($element->{'sectionup'}));
! 35660: print STDERR " n: $element->{'sectionnext'}->{'texi'}\n" if (defined($element->{'sectionnext'}));
! 35661: print STDERR " t_n: $element->{'toplevelnext'}->{'texi'}\n" if (defined($element->{'toplevelnext'}));
! 35662: print STDERR " t_p: $element->{'toplevelprev'}->{'texi'}\n" if (defined($element->{'toplevelprev'}));
! 35663: print STDERR " n_u: $element->{'nodeup'}->{'texi'}\n" if (defined($element->{'nodeup'}));
! 35664: print STDERR " f: $element->{'forward'}->{'texi'}\n" if (defined($element->{'forward'}));
! 35665: print STDERR " follow: $element->{'following'}->{'texi'}\n" if (defined($element->{'following'}));
! 35666: print STDERR " m_p: $element->{'menu_prev'}->{'texi'}\n" if (defined($element->{'menu_prev'}));
! 35667: print STDERR " m_n: $element->{'menu_next'}->{'texi'}\n" if (defined($element->{'menu_next'}));
! 35668: print STDERR " m_u: $element->{'menu_up'}->{'texi'}\n" if (defined($element->{'menu_up'}));
! 35669: print STDERR " m_ch: $element->{'menu_child'}->{'texi'}\n" if (defined($element->{'menu_child'}));
! 35670: print STDERR " ff: $element->{'fastforward'}->{'texi'}\n" if (defined($element->{'fastforward'}));
! 35671: print STDERR " n_f: $element->{'nextfile'}->{'texi'}\n" if (defined($element->{'nextfile'}));
! 35672: print STDERR " p_f: $element->{'prevfile'}->{'texi'}\n" if (defined($element->{'prevfile'}));
! 35673: my $section_childs = '';
! 35674: if (defined($element->{'section_childs'}))
! 35675: {
! 35676: foreach my $child (@{$element->{'section_childs'}})
! 35677: {
! 35678: $section_childs .= "$child->{'texi'}|";
! 35679: }
! 35680: }
! 35681: print STDERR " s_chs: $section_childs\n" if ($section_childs ne '');
! 35682: my $node_childs = '';
! 35683: if (defined($element->{'node_childs'}))
! 35684: {
! 35685: foreach my $child (@{$element->{'node_childs'}})
! 35686: {
! 35687: $node_childs .= "$child->{'texi'}|";
! 35688: }
! 35689: }
! 35690: print STDERR " n_chs: $node_childs\n" if ($node_childs ne '');
! 35691:
! 35692: if (defined($element->{'menu_up_hash'}))
! 35693: {
! 35694: print STDERR " parent nodes:\n";
! 35695: foreach my $menu_up (keys%{$element->{'menu_up_hash'}})
! 35696: {
! 35697: print STDERR " $menu_up ($element->{'menu_up_hash'}->{$menu_up})\n";
! 35698: }
! 35699: }
! 35700: print STDERR " places: $element->{'place'}\n";
! 35701: foreach my $place(@{$element->{'place'}})
! 35702: {
! 35703: if (!$place->{'entry'} and !$place->{'float'} and !$place->{'texi'} and !$place->{'contents'} and !$place->{'shortcontents'} and (!defined($place->{'command'} or $place->{'command'} ne 'printindex')))
! 35704: {
! 35705: print STDERR "BUG: unknown placed stuff ========\n";
! 35706: foreach my $key (keys(%$place))
! 35707: {
! 35708: print STDERR "$key: $place->{$key}\n";
! 35709: }
! 35710: print STDERR "==================================\n";
! 35711: }
! 35712: elsif ($place->{'entry'})
! 35713: {
! 35714: print STDERR " index($place): $place->{'entry'} ($place->{'id'}, $place->{'file'})\n";
! 35715: }
! 35716: elsif ($place->{'anchor'})
! 35717: {
! 35718: print STDERR " anchor: $place->{'texi'} ($place->{'id'}, $place->{'file'})\n";
! 35719: }
! 35720: elsif ($place->{'float'})
! 35721: {
! 35722: if (defined($place->{'texi'}))
! 35723: {
! 35724: print STDERR " float($place): $place->{'texi'} ($place->{'id'}, $place->{'file'})\n";
! 35725: }
! 35726: else
! 35727: {
! 35728: print STDERR " float($place): NO LABEL ($place->{'id'}, $place->{'file'})\n";
! 35729: }
! 35730: }
! 35731: elsif ($place->{'contents'})
! 35732: {
! 35733: print STDERR " contents\n";
! 35734: }
! 35735: elsif ($place->{'shortcontents'})
! 35736: {
! 35737: print STDERR " shortcontents\n";
! 35738: }
! 35739: elsif (defined($place->{'command'}) and $place->{'command'} eq 'printindex')
! 35740: {
! 35741: print STDERR " printindex $place->{'name'}\n";
! 35742: }
! 35743: else
! 35744: {
! 35745: print STDERR " heading: $place->{'texi'} ($place->{'id'}, $place->{'file'})\n";
! 35746: }
! 35747: }
! 35748: }
! 35749: ########################### end debug prints
! 35750: }
! 35751:
! 35752: sub add_file($)
! 35753: {
! 35754: my $file = shift;
! 35755: if ($files{$file})
! 35756: {
! 35757: $files{$file}->{'counter'}++;
! 35758: }
! 35759: else
! 35760: {
! 35761: $files{$file} = {
! 35762: 'counter' => 1,
! 35763: 'relative_foot_num' => 0,
! 35764: 'foot_lines' => []
! 35765: };
! 35766: }
! 35767: }
! 35768:
! 35769: # find parent element which is a toplevel element
! 35770: sub get_top($)
! 35771: {
! 35772: my $element = shift;
! 35773: if ($element->{'node'})
! 35774: {
! 35775: if (defined($element->{'section_ref'}))
! 35776: {
! 35777: $element = $element->{'section_ref'};
! 35778: }
! 35779: else
! 35780: {
! 35781: return undef;
! 35782: }
! 35783: }
! 35784: return undef if ($element eq $element_before_anything);
! 35785: my $up = $element;
! 35786: while (!$up->{'toplevel'} and $up->{'tag'} ne 'top')
! 35787: {
! 35788: if (!defined($up->{'sectionup'}))
! 35789: {
! 35790: # If there is no section, it is normal not to have toplevel element,
! 35791: # and it is also the case if there is a low level element before
! 35792: # a top level element
! 35793: return undef;
! 35794: }
! 35795: $up = $up->{'sectionup'};
! 35796: }
! 35797: return $up;
! 35798: }
! 35799:
! 35800: sub get_node($)
! 35801: {
! 35802: my $element = shift;
! 35803: return undef if (!defined($element));
! 35804: return $element if ($element->{'node'});
! 35805: return $element->{'with_node'} if ($element->{'with_node'});
! 35806: }
! 35807:
! 35808: sub do_section_names($$)
! 35809: {
! 35810: my $number = shift;
! 35811: my $section = shift;
! 35812: my $texi = &$Texi2HTML::Config::heading_texi($section->{'tag'}, $section->{'texi'}, $section->{'number'});
! 35813: $section->{'text'} = substitute_line($texi, "\@$section->{'tag'}", undef, $section->{'line_nr'});
! 35814: # no need for translation since there is no line number it should never
! 35815: # appear in error messages.
! 35816: $section->{'text_nonumber'} = substitute_line($section->{'texi'}, "\@$section->{'tag'} no number");
! 35817: # backward compatibility
! 35818: # Removed from doc in nov 2009
! 35819: $section->{'name'} = $section->{'text_nonumber'};
! 35820: $section->{'no_texi'} = remove_texi($texi);
! 35821: $section->{'simple_format'} = simple_format(undef,undef,"\@$section->{'tag'} simple_format", $texi);
! 35822: $section->{'heading_texi'} = $texi;
! 35823: }
! 35824:
! 35825: # get the html names from the texi for all elements
! 35826: sub do_names()
! 35827: {
! 35828: print STDERR "# Doing ". scalar(keys(%nodes)) . " nodes, ".
! 35829: scalar(keys(%sections)) . " sections, " .
! 35830: scalar(keys(%headings)) . " headings in ". $#elements_list .
! 35831: " elements\n" if ($T2H_DEBUG);
! 35832: # for nodes and anchors we haven't any state defined
! 35833: # This seems right, however, as we don't want @refs or @footnotes
! 35834: # or @anchors within nodes, section commands or anchors.
! 35835: $global_pass = '2 node names';
! 35836: foreach my $node (keys(%nodes))
! 35837: {
! 35838: my $texi = &$Texi2HTML::Config::heading_texi($nodes{$node}->{'tag'},
! 35839: $nodes{$node}->{'texi'}, undef);
! 35840: my $command = 'node';
! 35841: $command = $nodes{$node}->{'tag'} if ($nodes{$node}->{'tag'});
! 35842: $nodes{$node}->{'text'} = substitute_line ($texi, "\@$command", {'code_style' => 1}, $nodes{$node}->{'line_nr'});
! 35843: $nodes{$node}->{'text_nonumber'} = $nodes{$node}->{'text'};
! 35844: # backward compatibility -> maybe used to have the name without code_style ?
! 35845: # Removed from doc in nov 2009
! 35846: $nodes{$node}->{'name'} = substitute_line($texi, "\@$command name");
! 35847: $nodes{$node}->{'no_texi'} = remove_texi($texi);
! 35848: $nodes{$node}->{'simple_format'} = simple_format(undef, undef, "\@$command simple_format", $texi);
! 35849: $nodes{$node}->{'heading_texi'} = $texi;
! 35850:
! 35851: ################# debug
! 35852: # if $nodes{$node}->{'external_node'} and $nodes{$node}->{'seen'}
! 35853: # this is a bug, since there are checks that the node hasn't an
! 35854: # external node syntax.
! 35855: msg_debug ("$nodes{$node}->{'texi'} is external and was seen", $nodes{$node}->{'line_nr'}) if ($nodes{$node}->{'seen'} and $nodes{$node}->{'external_node'});
! 35856: ################# end debug
! 35857: }
! 35858: $global_pass = '2 section names';
! 35859: foreach my $number (keys(%sections))
! 35860: {
! 35861: do_section_names($number, $sections{$number});
! 35862: }
! 35863: $global_pass = '2 heading names';
! 35864: foreach my $number (keys(%headings))
! 35865: {
! 35866: do_section_names($number, $headings{$number});
! 35867: }
! 35868: print STDERR "# Names done\n" if ($T2H_DEBUG);
! 35869: }
! 35870:
! 35871:
! 35872: #+++############################################################################
! 35873: # #
! 35874: # Stuff related to Index generation #
! 35875: # #
! 35876: #---############################################################################
! 35877:
! 35878: # called during pass_structure
! 35879: sub enter_index_entry($$$$$)
! 35880: {
! 35881: my $prefix = shift;
! 35882: my $line_nr = shift;
! 35883: my $entry = shift;
! 35884: my $command = shift;
! 35885: my $state = shift;
! 35886:
! 35887: my $heading_element = $state->{'heading_element'};
! 35888: my $current_element = $state->{'current_element'};
! 35889: my $place = $state->{'place'};
! 35890: my $region = $state->{'region'};
! 35891:
! 35892: my $index_name = $index_prefix_to_name{$prefix};
! 35893: if (!defined($index_name))
! 35894: {
! 35895: line_error (sprintf(__("Unknown index `%s'"), $prefix), $line_nr);
! 35896: }
! 35897: if ($current_element eq $element_before_anything)
! 35898: {
! 35899: #line_warn ("Index entry before document: \@${prefix}index $entry", $line_nr);
! 35900: line_error (sprintf(__("Entry for index `%s' outside of any node"), $index_name), $line_nr);
! 35901: }
! 35902: $entry = trim_comment_spaces ($entry, "index entry in \@$command", $line_nr);
! 35903: # beware that the texinfo could be non empty, but the no_texi be empty.
! 35904: # So the $no_texi should be used to determine whether the entry is
! 35905: # empty or not.
! 35906: my $no_texi = remove_texi($entry);
! 35907:
! 35908: my $id;
! 35909: # don't add a specific index target if the index entry is in a special
! 35910: # region like @copying or the like or the index is not defined
! 35911: if (!defined($region))
! 35912: {
! 35913: $region = 'document';
! 35914: # No id if the index is unknown.
! 35915: $id = 'IDX' . ++$document_idx_num if (defined($index_name));
! 35916: }
! 35917: my $target = $id;
! 35918:
! 35919: # entry will later be in @code for code-like index entry. texi stays
! 35920: # the same.
! 35921: my $index_entry = {
! 35922: 'entry' => $entry,
! 35923: 'texi' => $entry,
! 35924: 'element' => $heading_element,
! 35925: 'real_element' => $current_element,
! 35926: 'prefix' => $prefix,
! 35927: 'id' => $id,
! 35928: 'target' => $target,
! 35929: 'command' => $command,
! 35930: 'region' => $state->{'region'},
! 35931: 'line_nr' => $line_nr,
! 35932: 'index_name' => $index_name
! 35933: };
! 35934:
! 35935: my $id_text = $id;
! 35936: $id_text = 'NO ID' if (!defined($id));
! 35937: print STDERR "# in $region enter \@$command ${prefix}index($no_texi) [$entry] with id $id_text ($index_entry)\n"
! 35938: if ($T2H_DEBUG & $DEBUG_INDEX);
! 35939:
! 35940: $index_entry->{'entry'} = '@code{'.$index_entry->{'entry'}.'}'
! 35941: if (defined($index_name) and
! 35942: defined($index_names{$index_name}->{'prefixes'}) and
! 35943: $index_names{$index_name}->{'prefixes'}->{$prefix}
! 35944: and $no_texi =~ /\S/);
! 35945:
! 35946: push @$place, $index_entry;
! 35947:
! 35948: #msg_debug("enter_index_entry: region $region, index_entry $index_entry, \@$command, texi `$entry'", $line_nr);
! 35949:
! 35950: # don't add the index entry to the list of index entries used for index
! 35951: # entry formatting, if the index entry appears in a region like copying
! 35952: # currently this is only used for debugging purposes, since the
! 35953: # index entries lists are broken by region now.
! 35954: push @index_labels, $index_entry unless (defined($state->{'region'}));
! 35955:
! 35956: # these lists are used to retrieve index entries in pass 3
! 35957: push @{$Texi2HTML::THISDOC{'index_entries'}->{$region}->{$entry}->{'entries'}}, $index_entry;
! 35958: if (defined($index_name))
! 35959: {
! 35960: # this is used for @printindex
! 35961: push @{$Texi2HTML::THISDOC{'index_entries_array'}->{$index_name}}, $index_entry;
! 35962: # this is used for targets
! 35963: push @{$Texi2HTML::THISDOC{'index_entries_region_array'}->{$region}}, $index_entry;
! 35964: }
! 35965: else
! 35966: {
! 35967: push @unknown_index_index_entries, $index_entry;
! 35968: }
! 35969: }
! 35970:
! 35971: # these variables are global, so great care should be taken with
! 35972: # state->{'multiple_state'}, ->{'region'}, ->{'region_pass'} and
! 35973: # {'outside_document'}.
! 35974: my $global_head_num = 0; # heading index. it is global for the main doc,
! 35975: # and taken from the state if in multiple_pass.
! 35976: my $global_foot_num = 0;
! 35977: my $global_relative_foot_num = 0;
! 35978: my @foot_lines = (); # footnotes
! 35979: my $copying_comment = ''; # comment constructed from text between
! 35980: # @copying and @end copying with licence
! 35981: my %acronyms_like = (); # acronyms or similar commands associated texts
! 35982: # the key are the commands, the values are
! 35983: # hash references associating shorthands to
! 35984: # texts.
! 35985:
! 35986: # detailmenu number of opened detailed menus
! 35987: sub fill_state($)
! 35988: {
! 35989: my $state = shift;
! 35990: foreach my $key ('preformatted', 'code_style', 'math_style', 'keep_texi',
! 35991: 'keep_nr', 'detailmenu', 'direntry', 'sec_num', 'menu', 'multiple_pass')
! 35992: {
! 35993: $state->{$key} = 0 unless exists($state->{$key});
! 35994: }
! 35995:
! 35996: $state->{'paragraph_style'} = [ '' ] unless exists($state->{'paragraph_style'});
! 35997: $state->{'preformatted_stack'} = [ '' ] unless exists($state->{'preformatted_stack'});
! 35998: $state->{'command_stack'} = [] unless exists($state->{'command_stack'});
! 35999: $state->{'quotation_stack'} = [] unless exists($state->{'quotation_stack'});
! 36000: # if there is no $state->{'element'} the first element is used
! 36001: if ((!$state->{'element'} or $state->{'element'}->{'before_anything'}) and (@elements_list))
! 36002: {
! 36003: $state->{'element'} = $elements_list[0];
! 36004: }
! 36005: # this is consistent with what is done in rearrange_elements
! 36006: $state->{'element'} = {'file' => $docu_doc, 'texi' => 'VIRTUAL ELEMENT'} if (!$state->{'element'});
! 36007: }
! 36008:
! 36009: sub do_element_directions ($)
! 36010: {
! 36011: my $this_element = shift;
! 36012: #print STDERR "Doing hrefs for $this_element->{'texi'} First ";
! 36013: $Texi2HTML::HREF{'First'} = href($element_first, $this_element->{'file'});
! 36014: #print STDERR "Last ";
! 36015: $Texi2HTML::HREF{'Last'} = href($element_last, $this_element->{'file'});
! 36016: #print STDERR "Index ";
! 36017: $Texi2HTML::HREF{'Index'} = href($element_chapter_index, $this_element->{'file'}) if (defined($element_chapter_index));
! 36018: #print STDERR "Top ";
! 36019: $Texi2HTML::HREF{'Top'} = href($element_top, $this_element->{'file'});
! 36020: if ($Texi2HTML::Config::INLINE_CONTENTS)
! 36021: {
! 36022: $Texi2HTML::HREF{'Contents'} = href($content_element{'contents'}, $this_element->{'file'});
! 36023: $Texi2HTML::HREF{'Overview'} = href($content_element{'shortcontents'}, $this_element->{'file'});
! 36024: }
! 36025: else
! 36026: {
! 36027: $Texi2HTML::HREF{'Contents'} = file_target_href($Texi2HTML::THISDOC{'toc_file'}, $this_element->{'file'}, $content_element{'contents'}->{'target'}) if (@{$Texi2HTML::TOC_LINES} and defined($content_element{'contents'}));
! 36028: $Texi2HTML::HREF{'Overview'} = file_target_href($Texi2HTML::THISDOC{'stoc_file'}, $this_element->{'file'}, $content_element{'shortcontents'}->{'target'}) if (@{$Texi2HTML::OVERVIEW} and defined($content_element{'shortcontents'}));
! 36029: }
! 36030: if ($Texi2HTML::THISDOC{'do_about'})
! 36031: {
! 36032: $Texi2HTML::HREF{'About'} = file_target_href($docu_about, $this_element->{'file'}, $Texi2HTML::Config::misc_pages_targets{'About'});
! 36033: }
! 36034: $Texi2HTML::HREF{'Footnotes'} = file_target_href($docu_foot, $this_element->{'file'}, $Texi2HTML::Config::misc_pages_targets{'Footnotes'});
! 36035: foreach my $direction (@element_directions)
! 36036: {
! 36037: my $elem = $this_element->{$direction};
! 36038: $Texi2HTML::NODE{$direction} = undef;
! 36039: $Texi2HTML::HREF{$direction} = undef;
! 36040: $Texi2HTML::NAME{$direction} = undef;
! 36041: #print STDERR "$direction \n";
! 36042: next unless (defined($elem));
! 36043: if ($elem->{'node'} or $elem->{'external_node'} or !$elem->{'seen'})
! 36044: {
! 36045: $Texi2HTML::NODE{$direction} = $elem->{'text'};
! 36046: }
! 36047: elsif ($elem->{'with_node'})
! 36048: {
! 36049: $Texi2HTML::NODE{$direction} = $elem->{'with_node'}->{'text'};
! 36050: }
! 36051: if (!$elem->{'seen'})
! 36052: {
! 36053: $Texi2HTML::HREF{$direction} = do_external_href($elem->{'texi'});
! 36054: }
! 36055: else
! 36056: {
! 36057: $Texi2HTML::HREF{$direction} = href($elem, $this_element->{'file'});
! 36058: }
! 36059: $Texi2HTML::NAME{$direction} = $elem->{'text'};
! 36060: $Texi2HTML::NO_TEXI{$direction} = $elem->{'no_texi'};
! 36061: $Texi2HTML::SIMPLE_TEXT{$direction} = $elem->{'simple_format'};
! 36062: #print STDERR "$direction ($this_element->{'texi'}): \n NO_TEXI: $Texi2HTML::NO_TEXI{$direction}\n NAME $Texi2HTML::NAME{$direction}\n NODE $Texi2HTML::NODE{$direction}\n HREF $Texi2HTML::HREF{$direction}\n\n";
! 36063: }
! 36064: #print STDERR "\nDone hrefs for $this_element->{'texi'}\n";
! 36065: }
! 36066:
! 36067: sub open_out_file($)
! 36068: {
! 36069: my $new_file = shift;
! 36070: my $do_page_head = 0;
! 36071: # if the filehandle is closed, with fileno undef, open_out
! 36072: # is called with the second argument true, which leads to opening
! 36073: # the file in append mode, to avoid overwriting the previous
! 36074: # file.
! 36075: if ($files{$new_file}->{'filehandle'} and defined(fileno($files{$new_file}->{'filehandle'})))
! 36076: {
! 36077: $Texi2HTML::THISDOC{'FH'} = $files{$new_file}->{'filehandle'};
! 36078: }
! 36079: else
! 36080: {
! 36081: my $known_file = 0;
! 36082: if ($files{$new_file}->{'filehandle'})
! 36083: {
! 36084: $known_file = 1;
! 36085: document_warn ("The file $new_file was already closed and is reopened");
! 36086: }
! 36087: $Texi2HTML::THISDOC{'FH'} = open_out("$docu_rdir$new_file", $known_file);
! 36088: #print STDERR "OPEN $docu_rdir$file, $Texi2HTML::THISDOC{'FH'}". scalar($Texi2HTML::THISDOC{'FH'})."\n";
! 36089: $files{$new_file}->{'filehandle'} = $Texi2HTML::THISDOC{'FH'};
! 36090: $do_page_head = !$known_file;
! 36091: }
! 36092: return $do_page_head;
! 36093: }
! 36094:
! 36095: sub set_line_nr_in_stack($$$)
! 36096: {
! 36097: my $state = shift;
! 36098: my $stack = shift;
! 36099: my $line_nr = shift;
! 36100:
! 36101: if ($state->{'keep_texi'} and defined($line_nr))
! 36102: {
! 36103: my $stack_index = $#$stack;
! 36104: while ($stack_index >= 0 and defined($stack->[$stack_index]->{'keep_line_nr'}))
! 36105: {
! 36106: push @{$stack->[$stack_index]->{'keep_line_nr'}}, $line_nr;
! 36107: $stack_index --;
! 36108: }
! 36109: }
! 36110: }
! 36111:
! 36112: sub unref_file($)
! 36113: {
! 36114: my $file = shift;
! 36115: $files{$file}->{'counter'}--;
! 36116: print STDERR "# Unref file $file, remaining counter $files{$file}->{'counter'}\n"
! 36117: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36118:
! 36119: }
! 36120:
! 36121: sub pass_text($$)
! 36122: {
! 36123: my $doc_lines = shift;
! 36124: my $doc_numbers = shift;
! 36125: my %state;
! 36126: fill_state(\%state);
! 36127: my @stack;
! 36128: my $text = '';
! 36129: my $doc_nr;
! 36130: my $in_doc = 0;
! 36131: my @text =();
! 36132: my $one_section = 1 if (@elements_list <= 1);
! 36133:
! 36134: push_state(\%state);
! 36135:
! 36136: $global_pass = '3 prepare names';
! 36137: set_special_names();
! 36138: $footnote_element->{'text'} = $Texi2HTML::NAME{'Footnotes'};
! 36139: # We set titlefont only if the titlefont appeared in the top element
! 36140: if (defined($element_top->{'titlefont'}))
! 36141: {
! 36142: $Texi2HTML::THISDOC{'titlefont_texi'} = $element_top->{'titlefont'};
! 36143: # backward compatibility nov 2009
! 36144: $value{'_titlefont'} = $element_top->{'titlefont'};
! 36145: }
! 36146:
! 36147: # prepare %Texi2HTML::THISDOC
! 36148: $Texi2HTML::THISDOC{'command_stack'} = $state{'command_stack'};
! 36149:
! 36150: #foreach my $texi_cmd (('shorttitlepage', 'settitle', 'author', 'title',
! 36151: # 'subtitle'))
! 36152: #{
! 36153: # $Texi2HTML::THISDOC{$texi_cmd . '_texi'} = $value{'_' . $texi_cmd};
! 36154: #}
! 36155: $Texi2HTML::THISDOC{'top_texi'} = $section_top->{'texi'} if (defined($section_top));
! 36156:
! 36157: $Texi2HTML::THISDOC{'fulltitle_texi'} = '';
! 36158: foreach my $possible_fulltitle('settitle', 'title', 'shorttitlepage', 'top', 'titlefont')
! 36159: {
! 36160: if (defined($Texi2HTML::THISDOC{$possible_fulltitle . '_texi'}) and $Texi2HTML::THISDOC{$possible_fulltitle . '_texi'} =~ /\S/)
! 36161: {
! 36162: $Texi2HTML::THISDOC{'fulltitle_texi'} = $Texi2HTML::THISDOC{$possible_fulltitle . '_texi'};
! 36163: last;
! 36164: }
! 36165: }
! 36166: $Texi2HTML::THISDOC{'simpletitle_texi'} = '';
! 36167: foreach my $possible_simpletitle('settitle', 'shorttitlepage')
! 36168: {
! 36169: if (defined($Texi2HTML::THISDOC{$possible_simpletitle . '_texi'}) and $Texi2HTML::THISDOC{$possible_simpletitle . '_texi'} =~ /\S/)
! 36170: {
! 36171: $Texi2HTML::THISDOC{'simpletitle_texi'} = $Texi2HTML::THISDOC{$possible_simpletitle . '_texi'};
! 36172: last;
! 36173: }
! 36174: }
! 36175:
! 36176: foreach my $doc_thing (('shorttitlepage', 'settitle', 'author',
! 36177: 'titlefont', 'subtitle', 'title', 'fulltitle', 'simpletitle'))
! 36178: {
! 36179: my $thing_texi = $Texi2HTML::THISDOC{$doc_thing . '_texi'};
! 36180: $Texi2HTML::THISDOC{$doc_thing} = substitute_line($thing_texi, "\@$doc_thing", undef, $Texi2HTML::THISDOC{$doc_thing . '_line_nr'});
! 36181: $Texi2HTML::THISDOC{$doc_thing . '_no_texi'} =
! 36182: remove_texi($thing_texi);
! 36183: $Texi2HTML::THISDOC{$doc_thing . '_simple_format'} =
! 36184: simple_format(undef, undef, "simple_format \@$doc_thing", $thing_texi);
! 36185: }
! 36186:
! 36187:
! 36188: # find the triplet (Top name, Top with texi removed, Top simply formatted)
! 36189: # the corresponding href is used a lot but these are only used because
! 36190: # they are used in LINKS_BUTTONS...
! 36191:
! 36192: my $element_top_Top = [undef,undef,undef];
! 36193: my $node_top_Top = [undef,undef,undef];
! 36194: # Preferred Top name is the element_top name if it is not the @node Top
! 36195: # the @node Top may also be used, but before fulltitle is tried
! 36196: if (defined($element_top))
! 36197: {
! 36198: if ($element_top->{'node'} and $element_top->{'texi'} =~ /^Top$/i)
! 36199: {
! 36200: $node_top_Top = [ $element_top->{'text'}, $element_top->{'no_texi'}, $element_top->{'simple_format'} ];
! 36201: }
! 36202: else
! 36203: {
! 36204: $element_top_Top = [ $element_top->{'text'}, $element_top->{'no_texi'}, $element_top->{'simple_format'} ];
! 36205: }
! 36206: }
! 36207: # FIXME remove fulltitle?
! 36208: foreach my $possible_top (
! 36209: [substitute_line($Texi2HTML::Config::TOP_HEADING, '$TOP_HEADING'),
! 36210: remove_texi($Texi2HTML::Config::TOP_HEADING),
! 36211: simple_format(undef, undef, 'simple_format $TOP_HEADING', $Texi2HTML::Config::TOP_HEADING)],
! 36212: $element_top_Top,
! 36213: [$Texi2HTML::THISDOC{'fulltitle'},
! 36214: $Texi2HTML::THISDOC{'fulltitle_no_texi'},
! 36215: $Texi2HTML::THISDOC{'fulltitle_simple_format'}],
! 36216: $node_top_Top
! 36217: )
! 36218: {
! 36219: if (defined($possible_top->[0]) and $possible_top->[0] =~ /\S/)
! 36220: {
! 36221: ($Texi2HTML::NAME{'Top'}, $Texi2HTML::NO_TEXI{'Top'}, $Texi2HTML::SIMPLE_TEXT{'Top'}) = @$possible_top;
! 36222: last;
! 36223: }
! 36224: }
! 36225:
! 36226: $Texi2HTML::THISDOC{'program'} = $THISPROG;
! 36227: $Texi2HTML::THISDOC{'program_homepage'} = $T2H_HOMEPAGE;
! 36228: $Texi2HTML::THISDOC{'program_authors'} = $T2H_AUTHORS;
! 36229: foreach my $command (('authors', 'subtitles', 'titles'))
! 36230: {
! 36231: $Texi2HTML::THISDOC{$command} = [];
! 36232: my $i;
! 36233: for ($i = 0; $i < $#{$Texi2HTML::THISDOC{$command .'_texi'}} + 1; $i++)
! 36234: {
! 36235: my $texi_line = $Texi2HTML::THISDOC{$command .'_texi'}->[$i];
! 36236: my $command_line_nr = $Texi2HTML::THISDOC{$command .'_line_nr'}->[$i];
! 36237: chomp ($texi_line);
! 36238: $Texi2HTML::THISDOC{$command}->[$i] = substitute_line($texi_line, "\@$command", undef, $command_line_nr);
! 36239: #print STDERR "$command:$i: $Texi2HTML::THISDOC{$command}->[$i]\n";
! 36240: }
! 36241: }
! 36242:
! 36243: $Texi2HTML::THISDOC{'do_about'} = 1 unless (defined($Texi2HTML::THISDOC{'do_about'}) or $one_section or (not Texi2HTML::Config::get_conf('SPLIT') and not Texi2HTML::Config::get_conf('headers')));
! 36244:
! 36245: $Texi2HTML::NAME{'First'} = $element_first->{'text'};
! 36246: $Texi2HTML::NAME{'Last'} = $element_last->{'text'};
! 36247: $Texi2HTML::NAME{'Index'} = $element_chapter_index->{'text'} if (defined($element_chapter_index));
! 36248: $Texi2HTML::NAME{'Index'} = $Texi2HTML::Config::INDEX_CHAPTER if ($Texi2HTML::Config::INDEX_CHAPTER ne '');
! 36249:
! 36250: $Texi2HTML::NO_TEXI{'First'} = $element_first->{'no_texi'};
! 36251: $Texi2HTML::NO_TEXI{'Last'} = $element_last->{'no_texi'};
! 36252: $Texi2HTML::NO_TEXI{'Index'} = $element_chapter_index->{'no_texi'} if (defined($element_chapter_index));
! 36253: $Texi2HTML::SIMPLE_TEXT{'First'} = $element_first->{'simple_format'};
! 36254: $Texi2HTML::SIMPLE_TEXT{'Last'} = $element_last->{'simple_format'};
! 36255: $Texi2HTML::SIMPLE_TEXT{'Index'} = $element_chapter_index->{'simple_format'} if (defined($element_chapter_index));
! 36256:
! 36257: # We do the regions formatting here, even if they never appear.
! 36258: # so we should be very carefull to take into accout 'outside_document' to
! 36259: # avoid messing with information that has to be set in the main document.
! 36260: # FIXME also the error messages will appear even though the corresponding
! 36261: # texinfo is never used. Since no state is passed to the do_special_region_lines
! 36262: # 'outside_document' will be true. Also 'multiple_pass' is equal to -1
! 36263: # for this case.
! 36264: $global_pass = '3 prepare regions';
! 36265:
! 36266: my ($region_text, $region_no_texi, $region_simple_format);
! 36267: ($region_text, $region_no_texi, $region_simple_format) = do_special_region_lines('documentdescription');
! 36268: &$Texi2HTML::Config::documentdescription($region_lines{'documentdescription'}, $region_text, $region_no_texi, $region_simple_format);
! 36269:
! 36270: # do copyright notice inserted in comment at the beginning of the files
! 36271: ($region_text, $region_no_texi, $region_simple_format) = do_special_region_lines('copying');
! 36272: $copying_comment = &$Texi2HTML::Config::copying_comment($region_lines{'copying'}, $region_text, $region_no_texi, $region_simple_format);
! 36273:
! 36274: $Texi2HTML::THISDOC{'copying_comment'} = $copying_comment;
! 36275: # must be after toc_body, but before titlepage
! 36276: foreach my $command ('contents', 'shortcontents')
! 36277: {
! 36278: next if (!defined($content_element{$command}));
! 36279: my $toc_lines = &$Texi2HTML::Config::inline_contents(undef, $command, $content_element{$command}, \@sections_list);
! 36280: @{$Texi2HTML::THISDOC{'inline_contents'}->{$command}} = @$toc_lines if (defined($toc_lines));
! 36281: }
! 36282:
! 36283: ($region_text, $region_no_texi, $region_simple_format) = do_special_region_lines('titlepage');
! 36284:
! 36285: &$Texi2HTML::Config::titlepage($region_lines{'titlepage'}, $region_text, $region_no_texi, $region_simple_format);
! 36286:
! 36287: $global_pass = '3';
! 36288: &$Texi2HTML::Config::init_out();
! 36289:
! 36290: # FIXME It is not clear whether it should be here or before
! 36291: # command_handler_output calls. After, it means that
! 36292: # command_handler_output may modify the initializations. Before
! 36293: # it allows to look at the values from the preceding pass.
! 36294: texinfo_initialization(2);
! 36295:
! 36296: foreach my $handler(@Texi2HTML::Config::command_handler_output)
! 36297: {
! 36298: &$handler;
! 36299: }
! 36300:
! 36301: ############################################################################
! 36302: # print frame and frame toc file
! 36303: #
! 36304: if ( $Texi2HTML::Config::FRAMES )
! 36305: {
! 36306: my $FH = open_out($docu_frame_file);
! 36307: print STDERR "# Creating frame in $docu_frame_file ...\n" if $T2H_VERBOSE;
! 36308: &$Texi2HTML::Config::print_frame($FH, $docu_toc_frame_file, $docu_top_file);
! 36309: close_out($FH, $docu_frame_file);
! 36310:
! 36311: $FH = open_out($docu_toc_frame_file);
! 36312: print STDERR "# Creating toc frame in $docu_frame_file ...\n" if $T2H_VERBOSE;
! 36313: &$Texi2HTML::Config::print_toc_frame($FH, $Texi2HTML::OVERVIEW);
! 36314: close_out($FH, $docu_toc_frame_file);
! 36315: }
! 36316:
! 36317:
! 36318:
! 36319: ############################################################################
! 36320: # Start processing the document
! 36321: #
! 36322:
! 36323: #my $FH;
! 36324: my $line_nr;
! 36325: my $current_file;
! 36326: my $first_section = 0; # 1 if it is the first section of a page
! 36327: my $previous_is_top = 0; # 1 if it is the element following the top element
! 36328:
! 36329: my $cline;
! 36330: # this is true for the state that goes through the document
! 36331: $state{'inside_document'} = 1;
! 36332: while (@$doc_lines)
! 36333: {
! 36334: $cline = shift @$doc_lines;
! 36335: my $chomped_line = $cline;
! 36336: if (!chomp($chomped_line) and @$doc_lines)
! 36337: { # if the line has no end of line it is concatenated with the next
! 36338: # this shouldn't happen anymore. And will certainly mess up
! 36339: # line counting. Let it be a bug.
! 36340: msg_debug ("no end of line line passed in doc_line",$line_nr);
! 36341: $doc_lines->[0] = $cline . $doc_lines->[0];
! 36342: next;
! 36343: }
! 36344: $line_nr = shift (@$doc_numbers);
! 36345: $Texi2HTML::THISDOC{'line_nr'} = $line_nr;
! 36346: print STDERR "BUG: line_nr not defined in pass_text. cline: $cline" if (!defined($cline));
! 36347: #dump_stack(\$text, \@stack, \%state);
! 36348:
! 36349: # make sure the current state from here is $Texi2HTML::THIS_ELEMENT
! 36350: # in case it was set by the user.
! 36351: $state{'element'} = $Texi2HTML::THIS_ELEMENT if (defined($Texi2HTML::THIS_ELEMENT));
! 36352: #print STDERR "PASS_TEXT($line_nr->{'line_nr'})$cline";
! 36353: if (!$state{'raw'} and !$state{'verb'})
! 36354: {
! 36355: my $tag = '';
! 36356: $tag = $1 if ($cline =~ /^\@(\w+)/);
! 36357: if ($tag eq 'setfilename' and $Texi2HTML::Config::IGNORE_BEFORE_SETFILENAME)
! 36358: {
! 36359: if (defined($Texi2HTML::THIS_ELEMENT))
! 36360: {
! 36361: line_warn (sprintf(__("\@%s after the first element"), $tag), $line_nr);
! 36362: }
! 36363: else
! 36364: {
! 36365: @{$Texi2HTML::THIS_SECTION} = ();
! 36366: }
! 36367: }
! 36368:
! 36369: if (($tag eq 'node') or (defined($sec2level{$tag}) and ($tag !~ /heading/)))
! 36370: {
! 36371: # in pass text node and section shouldn't appear in formats
! 36372: #print STDERR "close_stack before \@$tag\n";
! 36373: #print STDERR "text!$text%" if (! @stack);
! 36374: close_stack(\$text, \@stack, \%state, $line_nr);
! 36375: msg_debug ("text undef", $line_nr) if (!defined($text));
! 36376: push @{$Texi2HTML::THIS_SECTION}, $text if ($text ne '');
! 36377: $text = '';
! 36378:
! 36379: $state{'sec_num'}++ if ($sec2level{$tag} and ($tag ne 'top'));
! 36380: my $new_element;
! 36381: my $current_element;
! 36382:
! 36383: # handle node and structuring elements
! 36384: $current_element = shift (@all_elements);
! 36385: ########################## begin debug section
! 36386: if (!defined($current_element))
! 36387: {
! 36388: msg_debug ("No element left for $cline", $line_nr);
! 36389: }
! 36390: if ($current_element->{'node'})
! 36391: {
! 36392: print STDERR 'NODE ' . "$current_element->{'texi'}($current_element->{'file'})" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36393: print STDERR "($current_element->{'section_ref'}->{'texi'})" if ($current_element->{'section_ref'} and ($T2H_DEBUG & $DEBUG_ELEMENTS));
! 36394: }
! 36395: else
! 36396: {
! 36397: print STDERR 'SECTION ' . $current_element->{'texi'} if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36398: }
! 36399: print STDERR ": $cline" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36400: ########################## end debug section
! 36401:
! 36402: # The element begins a new section if there is no previous
! 36403: # or the reference element is not the same
! 36404: if (defined($current_element->{'element_ref'}) and (!$Texi2HTML::THIS_ELEMENT or ($current_element->{'element_ref'} ne $Texi2HTML::THIS_ELEMENT)))
! 36405: {
! 36406: $new_element = $current_element->{'element_ref'};
! 36407:
! 36408: ########################### debug
! 36409: my $old = 'NO_OLD';
! 36410: $old = $Texi2HTML::THIS_ELEMENT->{'texi'} if (defined($Texi2HTML::THIS_ELEMENT));
! 36411: print STDERR "NEW: $new_element->{'texi'}, OLD: $old\n" if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36412: ########################### end debug
! 36413: # print the element that just finished
! 36414: if ($Texi2HTML::THIS_ELEMENT)
! 36415: {
! 36416: finish_element($Texi2HTML::THISDOC{'FH'}, $Texi2HTML::THIS_ELEMENT, $new_element, $first_section);
! 36417: $first_section = 0;
! 36418: $previous_is_top = 0 if (!$Texi2HTML::THIS_ELEMENT->{'top'});
! 36419: @{$Texi2HTML::THIS_SECTION} = ();
! 36420: }
! 36421: else
! 36422: {
! 36423: print STDERR "# Writing elements:" if ($T2H_VERBOSE);
! 36424: if ($Texi2HTML::Config::IGNORE_PREAMBLE_TEXT)
! 36425: {
! 36426: @{$Texi2HTML::THIS_SECTION} = ();
! 36427: }
! 36428: # remove empty for the first document lines
! 36429: shift @{$Texi2HTML::THIS_SECTION} while (@{$Texi2HTML::THIS_SECTION} and ($Texi2HTML::THIS_SECTION->[0] =~ /^\s*$/));
! 36430: my $title = &$Texi2HTML::Config::print_title();
! 36431: unshift @{$Texi2HTML::THIS_SECTION}, $title if (defined($title) and $title ne '');
! 36432: }
! 36433: # begin new element
! 36434: $Texi2HTML::THIS_ELEMENT = $new_element;
! 36435: $state{'element'} = $Texi2HTML::THIS_ELEMENT;
! 36436:
! 36437: do_element_directions($Texi2HTML::THIS_ELEMENT);
! 36438: unref_file ($Texi2HTML::THIS_ELEMENT->{'file'});
! 36439: #if (!defined($previous_file) or ($Texi2HTML::THIS_ELEMENT->{'file'} ne $previous_file))
! 36440: if (!defined($current_file) or ($Texi2HTML::THIS_ELEMENT->{'file'} ne $current_file))
! 36441: {
! 36442: $current_file = $Texi2HTML::THIS_ELEMENT->{'file'};
! 36443: print STDERR "\n" if ($T2H_VERBOSE and !$T2H_DEBUG);
! 36444: print STDERR "# Writing to $docu_rdir$current_file " if $T2H_VERBOSE;
! 36445: my $do_page_head = open_out_file($current_file);
! 36446: if ($Texi2HTML::THIS_ELEMENT->{'top'})
! 36447: {
! 36448: &$Texi2HTML::Config::print_Top_header($Texi2HTML::THISDOC{'FH'}, $do_page_head);
! 36449: $previous_is_top = 1;
! 36450: }
! 36451: else
! 36452: {
! 36453: &$Texi2HTML::Config::print_page_head($Texi2HTML::THISDOC{'FH'}) if ($do_page_head);
! 36454: &$Texi2HTML::Config::print_chapter_header($Texi2HTML::THISDOC{'FH'}, $Texi2HTML::THIS_ELEMENT) if Texi2HTML::Config::get_conf('SPLIT') eq 'chapter';
! 36455: &$Texi2HTML::Config::print_section_header($Texi2HTML::THISDOC{'FH'}, $Texi2HTML::THIS_ELEMENT) if Texi2HTML::Config::get_conf('SPLIT') eq 'section';
! 36456: }
! 36457: $first_section = 1;
! 36458: }
! 36459: print STDERR "." if ($T2H_VERBOSE);
! 36460: print STDERR "\n" if ($T2H_DEBUG);
! 36461: }
! 36462:
! 36463: my $cmd_line = $cline;
! 36464: $cmd_line =~ s/\@$tag\s*//;
! 36465:
! 36466: ######################## begin debug
! 36467: msg_debug ("Element $current_element current_element->{'tag_level'} not defined", $line_nr)
! 36468: if (!defined($current_element->{'tag_level'}));
! 36469: msg_debug ("Element $current_element $tag ne ".var_to_str($current_element->{'tag'}), $line_nr)
! 36470: if ($tag ne 'node' and (!defined($current_element->{'tag'}) or $tag ne $current_element->{'tag'}));
! 36471: msg_debug ("Element $current_element ".var_to_str($current_element->{'tag'})." is not a node, but tag is a node", $line_nr)
! 36472: if ($tag eq 'node' and !$current_element->{'node'});
! 36473: ######################## end debug
! 36474:
! 36475: my $heading_formatted = &$Texi2HTML::Config::element_heading($current_element, $tag, $cmd_line, substitute_line($cmd_line, "\@$tag"), undef, $one_section, $current_element->{'this'}, $first_section, $current_element->{'top'}, $previous_is_top, $cline, $current_element->{'id'}, $new_element);
! 36476: push @{$Texi2HTML::THIS_SECTION}, $heading_formatted if (defined($heading_formatted) and ($heading_formatted ne ''));
! 36477: next;
! 36478: }
! 36479: }
! 36480:
! 36481: set_line_nr_in_stack(\%state, \@stack, $line_nr);
! 36482: scan_line($cline, \$text, \@stack, \%state, $line_nr);
! 36483:
! 36484: #print STDERR "after scan_line: $cline";
! 36485: #dump_stack(\$text, \@stack, \%state);
! 36486: next if (@stack);
! 36487: if ($text ne '')
! 36488: {
! 36489: push @{$Texi2HTML::THIS_SECTION}, $text;
! 36490: $text = '';
! 36491: }
! 36492: }
! 36493: # close stack at the end of pass text
! 36494: close_stack(\$text, \@stack, \%state, $line_nr);
! 36495: if (defined($text))
! 36496: {
! 36497: push @{$Texi2HTML::THIS_SECTION}, $text;
! 36498: }
! 36499: print STDERR "\n" if ($T2H_VERBOSE);
! 36500:
! 36501: # if no sections, then simply print document as is
! 36502: if ($one_section)
! 36503: {
! 36504: # may happen if there are 0 sections
! 36505: if (! defined($Texi2HTML::THISDOC{'FH'}))
! 36506: {
! 36507: open_out_file($docu_doc);
! 36508: &$Texi2HTML::Config::print_page_head($Texi2HTML::THISDOC{'FH'});
! 36509: shift @{$Texi2HTML::THIS_SECTION} while (@{$Texi2HTML::THIS_SECTION} and ($Texi2HTML::THIS_SECTION->[0] =~ /^\s*$/));
! 36510: my $title = &$Texi2HTML::Config::print_title();
! 36511: unshift @{$Texi2HTML::THIS_SECTION}, $title if (defined($title) and $title ne '');
! 36512: }
! 36513: if (@foot_lines)
! 36514: {
! 36515: &$Texi2HTML::Config::foot_section (\@foot_lines);
! 36516: push @{$Texi2HTML::THIS_SECTION}, @foot_lines;
! 36517: }
! 36518: print STDERR "# Write the section $Texi2HTML::THIS_ELEMENT->{'texi'}\n" if ($T2H_VERBOSE);
! 36519: &$Texi2HTML::Config::one_section($Texi2HTML::THISDOC{'FH'}, $Texi2HTML::THIS_ELEMENT);
! 36520: close_out($Texi2HTML::THISDOC{'FH'}, $docu_doc_file);
! 36521: # no misc element is done
! 36522: return;
! 36523: }
! 36524:
! 36525: finish_element ($Texi2HTML::THISDOC{'FH'}, $Texi2HTML::THIS_ELEMENT, undef, $first_section);
! 36526:
! 36527: ############################################################################
! 36528: # Print ToC, Overview, Footnotes
! 36529: #
! 36530: foreach my $direction (@element_directions)
! 36531: {
! 36532: $Texi2HTML::HREF{$direction} = undef;
! 36533: delete $Texi2HTML::HREF{$direction};
! 36534: # it is better to undef in case the references to these hash entries
! 36535: # are used, as if deleted, the
! 36536: # references are still refering to the old, undeleted element
! 36537: # (we could do both)
! 36538: $Texi2HTML::NAME{$direction} = undef;
! 36539: $Texi2HTML::NO_TEXI{$direction} = undef;
! 36540: $Texi2HTML::SIMPLE_TEXT{$direction} = undef;
! 36541: $Texi2HTML::NODE{$direction} = undef;
! 36542:
! 36543: $Texi2HTML::THIS_ELEMENT = undef;
! 36544: }
! 36545: my $about_body;
! 36546: $about_body = &$Texi2HTML::Config::about_body() if (defined($Texi2HTML::Config::about_body));
! 36547: # @foot_lines is emptied in finish_element if footnotestyle separate
! 36548: my %misc_page_infos = (
! 36549: 'Footnotes' => { 'file' => $docu_foot_file,
! 36550: 'relative_file' => $docu_foot,
! 36551: 'process' => $Texi2HTML::Config::print_Footnotes,
! 36552: 'section' => \@foot_lines },
! 36553: 'Contents' => { 'file' => $docu_toc_file,
! 36554: 'relative_file' => $docu_toc,
! 36555: 'process' => $Texi2HTML::Config::print_Toc,
! 36556: 'section' => $Texi2HTML::TOC_LINES },
! 36557: 'Overview' => { 'file' => $docu_stoc_file,
! 36558: 'relative_file' => $docu_stoc,
! 36559: 'process' => $Texi2HTML::Config::print_Overview,
! 36560: 'section' => $Texi2HTML::OVERVIEW },
! 36561: 'About' => { 'file' => $docu_about_file,
! 36562: 'relative_file' => $docu_about,
! 36563: 'process' => $Texi2HTML::Config::print_About,
! 36564: 'section' => [$about_body] }
! 36565: );
! 36566: $misc_page_infos{'Footnotes'}->{'do'} = 1 if (@foot_lines);
! 36567: $misc_page_infos{'Contents'}->{'do'} = 1 if
! 36568: (@{$Texi2HTML::TOC_LINES} and !$Texi2HTML::Config::INLINE_CONTENTS and (!Texi2HTML::Config::get_conf('setcontentsaftertitlepage') or !$Texi2HTML::Config::USE_TITLEPAGE_FOR_TITLE));
! 36569: $misc_page_infos{'Overview'}->{'do'} = 1 if
! 36570: (@{$Texi2HTML::OVERVIEW} and !$Texi2HTML::Config::INLINE_CONTENTS and (!Texi2HTML::Config::get_conf('setshortcontentsaftertitlepage') or !$Texi2HTML::Config::USE_TITLEPAGE_FOR_TITLE));
! 36571: $misc_page_infos{'About'}->{'do'} = 1 if ($about_body and $Texi2HTML::THISDOC{'do_about'});
! 36572:
! 36573: foreach my $misc_page('Footnotes', 'Contents', 'Overview', 'About')
! 36574: {
! 36575: next unless ($misc_page_infos{$misc_page}->{'do'});
! 36576: my $file = $misc_page_infos{$misc_page}->{'file'};
! 36577: my $relative_file = $misc_page_infos{$misc_page}->{'relative_file'};
! 36578: print STDERR "# writing $misc_page in $file\n" if $T2H_VERBOSE;
! 36579: my $saved_FH;
! 36580: my $open_new = 0;
! 36581: if ($relative_file ne $docu_doc)
! 36582: {
! 36583: $saved_FH = $Texi2HTML::THISDOC{'FH'};
! 36584: # Use open_out_file not to overwrite a file that the user would have
! 36585: # created
! 36586: open_out_file ($relative_file);
! 36587: print STDERR "# Opening $file for $misc_page\n" if $T2H_VERBOSE;
! 36588: $open_new = 1;
! 36589: }
! 36590: else
! 36591: {
! 36592: print STDERR "# writing $misc_page in current file\n" if $T2H_VERBOSE;
! 36593: }
! 36594: foreach my $href_page (keys(%misc_page_infos))
! 36595: {
! 36596: $Texi2HTML::HREF{$href_page} = file_target_href(
! 36597: $misc_page_infos{$href_page}->{'relative_file'}, $relative_file,
! 36598: $Texi2HTML::Config::misc_pages_targets{$href_page})
! 36599: if ($misc_page_infos{$href_page}->{'do'});
! 36600: }
! 36601: #print STDERR "Doing hrefs for $misc_page First ";
! 36602: $Texi2HTML::HREF{'First'} = href($element_first, $relative_file);
! 36603: #print STDERR "Last ";
! 36604: $Texi2HTML::HREF{'Last'} = href($element_last, $relative_file);
! 36605: #print STDERR "Index ";
! 36606: $Texi2HTML::HREF{'Index'} = href($element_chapter_index, $relative_file) if (defined($element_chapter_index));
! 36607: #print STDERR "Top ";
! 36608: $Texi2HTML::HREF{'Top'} = href($element_top, $relative_file);
! 36609: if ($Texi2HTML::Config::INLINE_CONTENTS)
! 36610: {
! 36611: $Texi2HTML::HREF{'Contents'} = href($content_element{'contents'}, $relative_file);
! 36612: $Texi2HTML::HREF{'Overview'} = href($content_element{'shortcontents'}, $relative_file);
! 36613: }
! 36614: $Texi2HTML::HREF{$misc_page} = '#' . $Texi2HTML::Config::misc_pages_targets{$misc_page};
! 36615: $Texi2HTML::HREF{'This'} = $Texi2HTML::HREF{$misc_page};
! 36616: $Texi2HTML::NAME{'This'} = $Texi2HTML::NAME{$misc_page};
! 36617: $Texi2HTML::NO_TEXI{'This'} = $Texi2HTML::NO_TEXI{$misc_page};
! 36618: $Texi2HTML::SIMPLE_TEXT{'This'} = $Texi2HTML::SIMPLE_TEXT{$misc_page};
! 36619: $Texi2HTML::THIS_SECTION = $misc_page_infos{$misc_page}->{'section'}
! 36620: if defined($misc_page_infos{$misc_page}->{'section'});
! 36621: &{$misc_page_infos{$misc_page}->{'process'}}($Texi2HTML::THISDOC{'FH'}, $open_new, $misc_page);
! 36622:
! 36623: if ($open_new)
! 36624: {
! 36625: close_out($Texi2HTML::THISDOC{'FH'}, $file);
! 36626: $Texi2HTML::THISDOC{'FH'} = $saved_FH;
! 36627: }
! 36628: }
! 36629:
! 36630: unless (Texi2HTML::Config::get_conf('SPLIT'))
! 36631: {
! 36632: &$Texi2HTML::Config::print_page_foot($Texi2HTML::THISDOC{'FH'});
! 36633: # this leaves the possibility for external code to close the file
! 36634: # without erroring out
! 36635: close_out ($Texi2HTML::THISDOC{'FH'}, $docu_doc_file) if (fileno($Texi2HTML::THISDOC{'FH'}));
! 36636: }
! 36637: pop_state();
! 36638: }
! 36639:
! 36640: # print section, close file if needed.
! 36641: sub finish_element($$$$)
! 36642: {
! 36643: my $FH = shift;
! 36644: my $element = shift;
! 36645: my $new_element = shift;
! 36646: my $first_section = shift;
! 36647: #print STDERR "FINISH_ELEMENT($FH)($element->{'texi'})[$element->{'file'}] counter $files{$element->{'file'}}->{'counter'}\n";
! 36648:
! 36649: # handle foot notes
! 36650: if (Texi2HTML::Config::get_conf('SPLIT') and scalar(@foot_lines)
! 36651: and (Texi2HTML::Config::get_conf('footnotestyle') eq 'end')
! 36652: and (! $new_element or
! 36653: ($element and ($new_element->{'file'} ne $element->{'file'})))
! 36654: )
! 36655: {
! 36656: if ($files{$element->{'file'}}->{'counter'})
! 36657: {# there are other elements in that page we are not on its foot
! 36658: $files{$element->{'file'}}->{'relative_foot_num'}
! 36659: = $global_relative_foot_num;
! 36660: push @{$files{$element->{'file'}}->{'foot_lines'}},
! 36661: @foot_lines;
! 36662: }
! 36663: else
! 36664: {# we output the footnotes as we are at the file end
! 36665: unshift @foot_lines, @{$files{$element->{'file'}}->{'foot_lines'}};
! 36666: &$Texi2HTML::Config::foot_section (\@foot_lines);
! 36667: push @{$Texi2HTML::THIS_SECTION}, @foot_lines;
! 36668: }
! 36669: if ($new_element)
! 36670: {
! 36671: $global_relative_foot_num =
! 36672: $files{$new_element->{'file'}}->{'relative_foot_num'};
! 36673: }
! 36674: @foot_lines = ();
! 36675: }
! 36676:
! 36677: if ($element->{'top'})
! 36678: {
! 36679: ############### debug
! 36680: #print STDERR "TOP $element->{'texi'}, @{$Texi2HTML::THIS_SECTION}\n";
! 36681: die "element->{'top'} $element ne element_top $element_top" if ($element ne $element_top);
! 36682: print STDERR "# Doing element top\n"
! 36683: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36684: print STDERR "[Top]" if ($T2H_VERBOSE);
! 36685: ############### end debug
! 36686:
! 36687: &$Texi2HTML::Config::print_Top($FH, $element->{'titlefont'}, $element);
! 36688: my $end_page = 0;
! 36689: if (Texi2HTML::Config::get_conf('SPLIT'))
! 36690: {
! 36691: if ($files{$element->{'file'}}->{'counter'} == 0)
! 36692: {
! 36693: $end_page = 1;
! 36694: }
! 36695: }
! 36696: &$Texi2HTML::Config::print_Top_footer($FH, $end_page, $element);
! 36697: close_out($FH, $docu_top_file) if ($end_page);
! 36698: }
! 36699: else
! 36700: {
! 36701: print STDERR "# do element $element->{'texi'}\n"
! 36702: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36703: &$Texi2HTML::Config::print_section($FH, $first_section, 0, $element);
! 36704: ################# debug
! 36705: my $new_elem_file = 'NO ELEM => no file';
! 36706: $new_elem_file = $new_element->{'file'} if (defined($new_element));
! 36707: print STDERR "# FILES new: $new_elem_file old(".fileno($FH)."): $element->{'file'}\n"
! 36708: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36709: ################# end debug
! 36710: if (defined($new_element) and ($new_element->{'file'} ne $element->{'file'}))
! 36711: {
! 36712: print STDERR "# End of section with change in file(".fileno($FH).") $element->{'file'} -> $new_element->{'file'}\n"
! 36713: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36714: if (!$files{$element->{'file'}}->{'counter'})
! 36715: {
! 36716: &$Texi2HTML::Config::print_chapter_footer($FH, $element) if (Texi2HTML::Config::get_conf('SPLIT') eq 'chapter');
! 36717: &$Texi2HTML::Config::print_section_footer($FH, $element) if (Texi2HTML::Config::get_conf('SPLIT') eq 'section');
! 36718: print STDERR "# Close file(".fileno($FH).") after $element->{'texi'}\n"
! 36719: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36720: &$Texi2HTML::Config::print_page_foot($FH);
! 36721: close_out($FH, "$docu_rdir$element->{'file'}");
! 36722: }
! 36723: else
! 36724: {
! 36725: print STDERR "# Counter $files{$element->{'file'}}->{'counter'} ne 0, file(".fileno($FH).") $element->{'file'}\n"
! 36726: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36727: }
! 36728: }
! 36729: elsif (!defined($new_element))
! 36730: {
! 36731: print STDERR "# End of last section, file(".fileno($FH).") $element->{'file'}, counter $files{$element->{'file'}}->{'counter'}\n"
! 36732: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36733: if (Texi2HTML::Config::get_conf('SPLIT'))
! 36734: { # end of last splitted section
! 36735: &$Texi2HTML::Config::print_chapter_footer($FH, $element) if (Texi2HTML::Config::get_conf('SPLIT') eq 'chapter');
! 36736: &$Texi2HTML::Config::print_section_footer($FH, $element) if (Texi2HTML::Config::get_conf('SPLIT') eq 'section');
! 36737: &$Texi2HTML::Config::print_page_foot($FH);
! 36738: close_out($FH, "$docu_rdir$element->{'file'}");
! 36739: }
! 36740: else
! 36741: { # end of last unsplit section
! 36742: &$Texi2HTML::Config::end_section($FH, 1, $element);
! 36743: }
! 36744: }
! 36745: elsif ($new_element->{'top'})
! 36746: {
! 36747: print STDERR "# Section followed by Top, file(".fileno($FH).") counter $files{$element->{'file'}}->{'counter'}\n"
! 36748: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36749: &$Texi2HTML::Config::end_section($FH, 1, $element);
! 36750: }
! 36751: else
! 36752: { # end of section followed by another one
! 36753: print STDERR "# Section followed by another one, file(".fileno($FH).") counter $files{$element->{'file'}}->{'counter'}\n"
! 36754: if ($T2H_DEBUG & $DEBUG_ELEMENTS);
! 36755: &$Texi2HTML::Config::end_section($FH, 0, $element);
! 36756: }
! 36757: }
! 36758: }
! 36759:
! 36760: # write to files with name the node name for cross manual references.
! 36761: sub do_node_files()
! 36762: {
! 36763: foreach my $key (keys(%nodes))
! 36764: {
! 36765: my $node = $nodes{$key};
! 36766: next unless ($node->{'node_file'});
! 36767: my $redirection_file = $docu_doc;
! 36768: $redirection_file = $node->{'file'} if (Texi2HTML::Config::get_conf('SPLIT'));
! 36769: if (!$redirection_file)
! 36770: {
! 36771: print STDERR "Bug: file for redirection for `$node->{'texi'}' don't exist\n" unless (Texi2HTML::Config::get_conf('novalidate') or !$node->{'seen'});
! 36772: next;
! 36773: }
! 36774: next if ($redirection_file eq $node->{'node_file'});
! 36775: my $file = "${docu_rdir}$node->{'node_file'}";
! 36776: $Texi2HTML::NODE{'This'} = $node->{'text'};
! 36777: $Texi2HTML::NO_TEXI{'This'} = $node->{'no_texi'};
! 36778: $Texi2HTML::SIMPLE_TEXT{'This'} = $node->{'simple_format'};
! 36779: $Texi2HTML::NAME{'This'} = $node->{'text'};
! 36780: my $href_file = $node->{'file'};
! 36781: if (!defined($href_file))
! 36782: {
! 36783: if (Texi2HTML::Config::get_conf('novalidate'))
! 36784: {
! 36785: $href_file = '';
! 36786: }
! 36787: else
! 36788: {
! 36789: msg_debug ("Undefined file for `$node->{'texi'}' in do_node_files");
! 36790: }
! 36791: }
! 36792: $Texi2HTML::HREF{'This'} = "$href_file#$node->{'id'}";
! 36793: my $redirect = &$Texi2HTML::Config::print_redirection_page ();
! 36794: if (defined($redirect))
! 36795: {
! 36796: my $NODEFILE = open_out ($file);
! 36797: print $NODEFILE "$redirect";
! 36798: close $NODEFILE || document_error ("Can't close $file: $!", 1);
! 36799: }
! 36800: }
! 36801: }
! 36802:
! 36803: #+++############################################################################
! 36804: # #
! 36805: # Low level functions #
! 36806: # #
! 36807: #---############################################################################
! 36808:
! 36809: sub locate_include_file($)
! 36810: {
! 36811: my $file = shift;
! 36812:
! 36813: # APA: Don't implicitely search ., to conform with the docs!
! 36814:
! 36815: # if file begins with /, ./ or ../ don't search in -I (Karl)
! 36816: if ($file =~ m,^(/|\./|\.\./),)
! 36817: {
! 36818: return "$file" if (-e "$file" && -r "$file");
! 36819: return undef;
! 36820: }
! 36821: foreach my $dir (@Texi2HTML::Config::INCLUDE_DIRS)
! 36822: {
! 36823: return "$dir/$file" if (-e "$dir/$file" && -r "$dir/$file");
! 36824: }
! 36825: return undef;
! 36826: }
! 36827:
! 36828: sub open_file($$$)
! 36829: {
! 36830: my $name = shift;
! 36831: # my $line_number = shift;
! 36832: my $macro = shift;
! 36833: my $files_stack = shift;
! 36834:
! 36835: my $line_number;
! 36836: my $input_spool;
! 36837:
! 36838: local *FH;
! 36839: if (open(*FH, "<$name"))
! 36840: {
! 36841: my $in_encoding = Texi2HTML::Config::get_conf('IN_ENCODING');
! 36842: if (defined($in_encoding) and $Texi2HTML::Config::USE_UNICODE)
! 36843: {
! 36844: binmode(*FH, ":encoding($in_encoding)");
! 36845: }
! 36846: my $file = { 'fh' => *FH,
! 36847: 'input_spool' => { 'spool' => [],
! 36848: 'macro' => '' },
! 36849: 'name' => $name,
! 36850: 'line_nr' => 0 };
! 36851: unshift(@$files_stack, $file);
! 36852: $input_spool = $file->{'input_spool'};
! 36853: $line_number->{'file_name'} = $name;
! 36854: $line_number->{'line_nr'} = 1;
! 36855: $line_number->{'macro'} = $macro;
! 36856: }
! 36857: else
! 36858: {
! 36859: document_error ("Can't read file $name: $!", 1);
! 36860: }
! 36861: return ($line_number, $input_spool);
! 36862: }
! 36863:
! 36864: my %filehandles = ();
! 36865:
! 36866: sub open_out($;$)
! 36867: {
! 36868: my $file = shift;
! 36869: my $append = shift;
! 36870: local *FILE;
! 36871: #print STDERR "open_out $file $Texi2HTML::THISDOC{'OUT_ENCODING'}\n";
! 36872: if ($file eq '-')
! 36873: {
! 36874: binmode(STDOUT, ":encoding($Texi2HTML::THISDOC{'OUT_ENCODING'})") if (defined($Texi2HTML::THISDOC{'OUT_ENCODING'}) and $Texi2HTML::Config::USE_UNICODE);
! 36875: return \*STDOUT;
! 36876: }
! 36877:
! 36878: my $mode = '>';
! 36879: $mode = '>>' if ($append);
! 36880: unless (open(FILE, $mode, $file))
! 36881: {
! 36882: document_error ("could not open $file for writing: $!", 1);
! 36883: }
! 36884: push @opened_files, $file;
! 36885: if (defined($Texi2HTML::THISDOC{'OUT_ENCODING'}) and $Texi2HTML::Config::USE_UNICODE)
! 36886: {
! 36887: if ($Texi2HTML::THISDOC{'OUT_ENCODING'} eq 'utf8' or $Texi2HTML::THISDOC{'OUT_ENCODING'} eq 'utf-8-strict')
! 36888: {
! 36889: binmode(FILE, ':utf8');
! 36890: }
! 36891: else
! 36892: {
! 36893: binmode(FILE, ':bytes');
! 36894: #binmode(FILE, ":encoding($Texi2HTML::THISDOC{'OUT_ENCODING'})");
! 36895: }
! 36896: # FIXME is it useful when in utf8?
! 36897: binmode(FILE, ":encoding($Texi2HTML::THISDOC{'OUT_ENCODING'})");
! 36898: }
! 36899: $file =~ s/^(\.[\/]+)*//;
! 36900: $filehandles{fileno(*FILE)} = $file;
! 36901: return *FILE;
! 36902: }
! 36903:
! 36904: sub close_out($$)
! 36905: {
! 36906: my $FH = shift;
! 36907: my $file = shift;
! 36908: return if (defined($file) and $file eq '-');
! 36909: $file =~ s/^(\.[\/]+)*//;
! 36910: my $fileno = fileno($FH);
! 36911: #print STDERR "close_out $file $fileno\n";
! 36912: if (!defined($fileno))
! 36913: {
! 36914: msg_debug("fileno not defined for $file")
! 36915: }
! 36916: elsif (defined($filehandles{$fileno}) and $filehandles{$fileno} ne $file)
! 36917: {
! 36918: #msg_debug("filehandles{$fileno} $filehandles{$fileno} and file $file different")
! 36919: }
! 36920: close ($FH) || document_error ("Error when closing $file: $!");
! 36921: }
! 36922:
! 36923: sub next_line($$)
! 36924: {
! 36925: my $line_number = shift;
! 36926: my $files_stack = shift;
! 36927: my $input_spool;
! 36928: while (@$files_stack)
! 36929: {
! 36930: my $file = $files_stack->[0];
! 36931: $line_number->{'file_name'} = $file->{'name'};
! 36932: $input_spool = $file->{'input_spool'};
! 36933: if (@{$input_spool->{'spool'}})
! 36934: {
! 36935: $line_number->{'macro'} = $file->{'input_spool'}->{'macro'};
! 36936: $line_number->{'line_nr'} = $file->{'line_nr'};
! 36937: my $line = shift(@{$input_spool->{'spool'}});
! 36938: print STDERR "# unspooling $line" if ($T2H_DEBUG & $DEBUG_MACROS);
! 36939: return($line, $input_spool);
! 36940: }
! 36941: else
! 36942: {
! 36943: $file->{'input_spool'}->{'macro'} = '';
! 36944: $line_number->{'macro'} = '';
! 36945: }
! 36946: my $fh = $file->{'fh'};
! 36947: no strict "refs";
! 36948: my $line = <$fh>;
! 36949: use strict "refs";
! 36950: my $chomped_line = $line;
! 36951: $file->{'line_nr'}++ if (defined($line) and chomp($chomped_line));
! 36952: $line_number->{'line_nr'} = $file->{'line_nr'};
! 36953: # do that right now, before any other treatement
! 36954: $line =~ s/\x{7F}.*\s*// if (defined($line));
! 36955: return($line, $input_spool) if (defined($line));
! 36956: no strict "refs";
! 36957: close($fh);
! 36958: use strict "refs";
! 36959: shift(@$files_stack);
! 36960: }
! 36961: return(undef, $input_spool);
! 36962: }
! 36963:
! 36964: sub check_die(;$)
! 36965: {
! 36966: my $always_die = shift;
! 36967:
! 36968: if (!$Texi2HTML::Config::FORCE)
! 36969: {
! 36970: if (@opened_files == 1)
! 36971: {
! 36972: warn sprintf(__("%s: Removing output file `%s' due to errors; use --force to preserve.\n"), $real_command_name, $opened_files[0]);
! 36973: }
! 36974: elsif (@opened_files > 1)
! 36975: {
! 36976: warn sprintf(__("%s: Removing output files due to errors; use --force to preserve.\n"), $real_command_name);
! 36977: }
! 36978: foreach my $file (@opened_files)
! 36979: {
! 36980: unlink ($file);
! 36981: }
! 36982: foreach my $dir (@created_directories)
! 36983: {
! 36984: rmdir ($dir);
! 36985: }
! 36986: }
! 36987: if ($always_die or !$Texi2HTML::Config::FORCE)
! 36988: {
! 36989: exit (1);
! 36990: }
! 36991: }
! 36992:
! 36993: sub file_line_warn($$;$)
! 36994: {
! 36995: return if ($Texi2HTML::Config::NO_WARN);
! 36996: my $text = shift;
! 36997: chomp($text);
! 36998: my $file = shift;
! 36999: my $line_nr = shift;
! 37000:
! 37001: if (!defined($line_nr))
! 37002: {
! 37003: warn "$file: $text\n";
! 37004: }
! 37005: else
! 37006: {
! 37007: warn "$file:$line_nr: $text\n";
! 37008: }
! 37009: }
! 37010:
! 37011: sub document_warn ($)
! 37012: {
! 37013: return if ($Texi2HTML::Config::NO_WARN);
! 37014: my $text = shift;
! 37015: chomp ($text);
! 37016: warn sprintf(__p("warning: warning_message", "warning: %s\n"), $text);
! 37017: }
! 37018:
! 37019: my $error_nrs = 0;
! 37020: sub check_errors()
! 37021: {
! 37022: $error_nrs ++;
! 37023: die __("Too many errors! Gave up.\n") if ($error_nrs >= $Texi2HTML::Config::ERROR_LIMIT);
! 37024: }
! 37025:
! 37026: sub msg_debug($;$)
! 37027: {
! 37028: my $text = shift;
! 37029: chomp ($text);
! 37030: my $line_number = shift;
! 37031: if (defined($line_number))
! 37032: {
! 37033: warn "!! $text " . format_line_number($line_number) . "\n";
! 37034: }
! 37035: else
! 37036: {
! 37037: warn "!! $text\n";
! 37038: }
! 37039: }
! 37040:
! 37041: sub cmdline_warn ($)
! 37042: {
! 37043: my $text = shift;
! 37044: #chomp ($text);
! 37045: warn sprintf(__p("command_name: warning_message", "%s: %s"), $real_command_name, $text);
! 37046: }
! 37047:
! 37048: # seems not to be used
! 37049: sub cmdline_error ($)
! 37050: {
! 37051: my $text = shift;
! 37052: #chomp ($text);
! 37053: warn sprintf(__p("command_name: error_message", "%s: %s"), $real_command_name, $text);
! 37054: }
! 37055:
! 37056: sub document_error($;$)
! 37057: {
! 37058: my $text = shift;
! 37059: chomp ($text);
! 37060: my $die = shift;
! 37061: warn ("$text\n");
! 37062: check_die ($die);
! 37063: check_errors();
! 37064: }
! 37065:
! 37066: # echo an error
! 37067: sub msg_error($;$)
! 37068: {
! 37069: my $text = shift;
! 37070: my $line_number = shift;
! 37071: if (defined($line_number))
! 37072: {
! 37073: line_error ($text, $line_number);
! 37074: }
! 37075: else
! 37076: {
! 37077: document_error ($text);
! 37078: }
! 37079: }
! 37080:
! 37081: # echo a warning
! 37082: sub msg_warn($;$$)
! 37083: {
! 37084: my $text = shift;
! 37085: my $line_number = shift;
! 37086: my $context_string = shift;
! 37087:
! 37088: if (defined($line_number))
! 37089: {
! 37090: line_warn ($text, $line_number);
! 37091: }
! 37092: elsif (defined($context_string))
! 37093: {
! 37094: document_warn ("$text (in $context_string)");
! 37095: }
! 37096: else
! 37097: {
! 37098: document_warn ($text);
! 37099: }
! 37100: }
! 37101:
! 37102: # echo a warning associated with a line in the document
! 37103: sub line_warn($$)
! 37104: {
! 37105: return if ($Texi2HTML::Config::NO_WARN);
! 37106: my $text = shift;
! 37107: chomp ($text);
! 37108: my $line_number = shift;
! 37109: return if (!defined($line_number));
! 37110: my $file = $line_number->{'file_name'};
! 37111: # otherwise out of source build fail since the file names are different
! 37112: $file =~ s/^.*\/// if ($Texi2HTML::Config::TEST);
! 37113: if ($line_number->{'macro'} ne '')
! 37114: {
! 37115: warn sprintf(__("%s:%d: warning: %s (via \@%s)\n"), $file, $line_number->{'line_nr'}, $text, $line_number->{'macro'});
! 37116: }
! 37117: else
! 37118: {
! 37119: warn sprintf(__("%s:%d: warning: %s\n"), $file, $line_number->{'line_nr'}, $text);
! 37120: }
! 37121: }
! 37122:
! 37123: sub line_error($$)
! 37124: {
! 37125: my $text = shift;
! 37126: chomp ($text);
! 37127: my $line_number = shift;
! 37128: if (defined($line_number))
! 37129: {
! 37130: my $file = $line_number->{'file_name'};
! 37131: $file =~ s/^.*\/// if ($Texi2HTML::Config::TEST);
! 37132: my $macro_text = '';
! 37133: $macro_text = " (via \@$line_number->{'macro'})" if ($line_number->{'macro'} ne '');
! 37134: warn "$file:$line_number->{'line_nr'}: $text$macro_text\n";
! 37135: check_die();
! 37136: }
! 37137: check_errors();
! 37138: }
! 37139:
! 37140: sub format_line_number(;$)
! 37141: {
! 37142: my $line_number = shift;
! 37143: $line_number = $Texi2HTML::THISDOC{'line_nr'} if (!defined($line_number));
! 37144: my $macro_text = '';
! 37145: #$line_number = undef;
! 37146: return '' unless (defined($line_number));
! 37147: my $print_filename = ($line_number->{'file_name'} ne $Texi2HTML::THISDOC{'input_file_name'});
! 37148: if ($line_number->{'macro'} ne '')
! 37149: {
! 37150: if ($print_filename)
! 37151: {
! 37152: return sprintf(__("(in %s l. %d via \@%s)"), $line_number->{'file_name'}, $line_number->{'line_nr'}, $line_number->{'macro'});
! 37153: }
! 37154: else
! 37155: {
! 37156: return sprintf(__("(l. %d via \@%s)"), $line_number->{'line_nr'}, $line_number->{'macro'});
! 37157: }
! 37158: }
! 37159: elsif ($print_filename)
! 37160: {
! 37161: return sprintf(__("(in %s l. %d)"), $line_number->{'file_name'}, $line_number->{'line_nr'});
! 37162: }
! 37163: else
! 37164: {
! 37165: return sprintf(__("(l. %d)"), $line_number->{'line_nr'});
! 37166: }
! 37167: }
! 37168:
! 37169: # to debug, dump the result of pass_texi and pass_structure in a file
! 37170: sub dump_texi($$;$$)
! 37171: {
! 37172: my $lines = shift;
! 37173: my $pass = shift;
! 37174: my $numbers = shift;
! 37175: my $file = shift;
! 37176: $file = "$docu_rdir$docu_name" . ".pass$pass" if (!defined($file));
! 37177: my $FH = open_out($file);
! 37178: print STDERR "# Dump texi\n" if ($T2H_VERBOSE);
! 37179: my $index = 0;
! 37180: foreach my $line (@$lines)
! 37181: {
! 37182: my $number_information = '';
! 37183: my $chomped_line = $line;
! 37184: # if defined, it means that an output of the file is asked for
! 37185: if (defined($numbers))
! 37186: {
! 37187: my $basefile = $numbers->[$index]->{'file_name'};
! 37188: $basefile = 'no file' if (!defined($basefile));
! 37189: $basefile =~ s|.*/||;
! 37190: my $macro_name = $numbers->[$index]->{'macro'};
! 37191: $macro_name = '' if (!defined($macro_name));
! 37192: my $line_number = $numbers->[$index]->{'line_nr'};
! 37193: $line_number = '' if (!defined($line_number));
! 37194: $number_information = "${basefile}($macro_name,$line_number) ";
! 37195: }
! 37196: print $FH "${number_information}$line";
! 37197: $index++ if (chomp($chomped_line));
! 37198: }
! 37199: close_out ($FH, $file);
! 37200: }
! 37201:
! 37202:
! 37203: # return next tag on the line
! 37204: sub next_tag($)
! 37205: {
! 37206: my $line = shift;
! 37207: # macro_regexp
! 37208: if ($line =~ /^\s*\@(["'~\@\}\{,\.!\?\s\*\-\^`=:\|\/\\])/o or $line =~ /^\s*\@([a-zA-Z][\w-]*)/)
! 37209: {
! 37210: return ($1);
! 37211: }
! 37212: return '';
! 37213: }
! 37214:
! 37215: sub next_end_tag($)
! 37216: {
! 37217: my $line = shift;
! 37218: if ($line =~ /^\s*\@end\s+([a-zA-Z][\w-]*)/)
! 37219: {
! 37220: return $1;
! 37221: }
! 37222: return '';
! 37223: }
! 37224:
! 37225: sub next_tag_or_end_tag($)
! 37226: {
! 37227: my $line = shift;
! 37228: my $next_tag = next_tag($line);
! 37229: return $next_tag if (defined($next_tag) and $next_tag ne '');
! 37230: return next_end_tag($line);
! 37231: }
! 37232:
! 37233: sub top_stack($;$)
! 37234: {
! 37235: my $stack = shift;
! 37236: my $ignore_para = shift;
! 37237:
! 37238: my $index = scalar (@$stack);
! 37239: return undef unless ($index);
! 37240:
! 37241: return $stack->[-1] unless ($ignore_para);
! 37242: if ($ignore_para == 1)
! 37243: {
! 37244: if (exists($stack->[-1]->{'format'}) and ($stack->[-1]->{'format'} eq 'paragraph' or $stack->[-1]->{'format'} eq 'preformatted'))
! 37245: {
! 37246: if (exists($stack->[-2]))
! 37247: {
! 37248: return $stack->[-2];
! 37249: }
! 37250: else
! 37251: {
! 37252: return undef;
! 37253: }
! 37254: }
! 37255: else
! 37256: {
! 37257: return $stack->[-1];
! 37258: }
! 37259: }
! 37260: else
! 37261: {
! 37262: while ($index and
! 37263: (
! 37264: (exists($stack->[$index-1]->{'format'})
! 37265: and ($stack->[$index-1]->{'format'} eq 'paragraph' or $stack->[$index-1]->{'format'} eq 'preformatted'))
! 37266: or (exists($stack->[$index-1]->{'style'}))
! 37267: ))
! 37268: {
! 37269: $index--;
! 37270: }
! 37271: }
! 37272: return undef unless ($index);
! 37273: return $stack->[$index-1];
! 37274: }
! 37275:
! 37276: # return the next element with balanced {}
! 37277: sub next_bracketed($$$;$)
! 37278: {
! 37279: my $line = shift;
! 37280: my $command = shift;
! 37281: my $line_nr = shift;
! 37282: my $report = shift;
! 37283: my $opened_braces = 0;
! 37284: my $result = '';
! 37285: my $spaces;
! 37286: #print STDERR "next_bracketed $line";
! 37287: if ($line =~ /^(\s*)$/)
! 37288: {
! 37289: return ('','',$1);
! 37290: }
! 37291: while ($line !~ /^\s*$/)
! 37292: {
! 37293: #print STDERR "next_bracketed($opened_braces): $result !!! $line";
! 37294: if (!$opened_braces)
! 37295: { # beginning of item
! 37296: $line =~ s/^(\s*)//;
! 37297: $spaces = $1;
! 37298: #if ($line =~ s/^([^\{\}\s]+)//)
! 37299: if ($line =~ s/^([^\{\}]+?)(\s+)/$2/ or $line =~ s/^([^\{\}]+?)$//)
! 37300: {
! 37301: $result = $1;
! 37302: $result = trim_around_spaces($result);
! 37303: return ($result, $line, $spaces);
! 37304: }
! 37305: elsif ($line =~ s/^([^\{\}]+?)([\{\}])/$2/)
! 37306: {
! 37307: $result = $1;
! 37308: }
! 37309: }
! 37310: elsif($line =~ s/^([^\{\}]+)//)
! 37311: {
! 37312: $result .= $1;
! 37313: }
! 37314: if ($line =~ s/^([\{\}])//)
! 37315: {
! 37316: my $brace = $1;
! 37317: $opened_braces++ if ($brace eq '{');
! 37318: $opened_braces-- if ($brace eq '}');
! 37319:
! 37320: if ($opened_braces < 0)
! 37321: {
! 37322: line_error(sprintf(__("Too much '}' in \@%s"), $command), $line_nr) if ($report);
! 37323: $opened_braces = 0;
! 37324: #next;
! 37325: }
! 37326: $result .= $brace;
! 37327: return ($result, $line, $spaces) if ($opened_braces == 0);
! 37328: }
! 37329: }
! 37330: if ($opened_braces)
! 37331: {
! 37332: line_error(sprintf(__("Missing `}' on \@%s line"), $command), $line_nr) if ($report);
! 37333: return ($result, '', $spaces);
! 37334: #return ($result . ( '}' x $opened_braces), '', $spaces);
! 37335: }
! 37336: msg_debug ("BUG: at the end of next_bracketed", $line_nr);
! 37337: return undef;
! 37338: }
! 37339:
! 37340: # def prams are also split at @-commands if not in brackets
! 37341: sub next_def_param($$$;$)
! 37342: {
! 37343: my $line = shift;
! 37344: my $command = shift;
! 37345: my $line_nr = shift;
! 37346: my $report = shift;
! 37347: my ($item, $spaces);
! 37348: ($item, $line, $spaces) = next_bracketed($line, $command, $line_nr, $report);
! 37349: return ($item, $line, $spaces) if (!defined($item));
! 37350: if ($item =~ /^\{/)
! 37351: {
! 37352: $item =~ s/^\{(.*)\}$/$1/;
! 37353: }
! 37354: else
! 37355: {
! 37356: my $delimeter_quoted = quotemeta($Texi2HTML::Config::def_argument_separator_delimiters);
! 37357: if ($item =~ s/^([^\@$delimeter_quoted]+)//)
! 37358: {
! 37359: $line = $item . $line;
! 37360: $item = $1;
! 37361: }
! 37362: elsif ($item =~ s/^([$delimeter_quoted])//)
! 37363: {
! 37364: $line = $item . $line;
! 37365: $item = $1;
! 37366: }
! 37367: elsif ($item =~ s/^(\@[^\@\{]+)(\@)/$2/)
! 37368: {
! 37369: $line = $item . $line;
! 37370: $item = $1;
! 37371: }
! 37372: }
! 37373: return ($item, $line, $spaces);
! 37374: }
! 37375:
! 37376: # do a href using file and id and taking care of ommitting file if it is
! 37377: # the same
! 37378: # element: structuring element to point to
! 37379: # file: current file
! 37380: sub href($$;$)
! 37381: {
! 37382: my $element = shift;
! 37383: my $file = shift;
! 37384: my $line_nr = shift;
! 37385: return '' unless defined($element);
! 37386: my $href = '';
! 37387: msg_debug("Bug: $element->{'texi'}, target undef", $line_nr) if (!defined($element->{'target'}));
! 37388: msg_debug("Bug: $element->{'texi'}, file undef", $line_nr) if (!defined($element->{'file'}));
! 37389: msg_debug("Bug: file undef in href", $line_nr) if (!defined($file));
! 37390: $href .= $element->{'file'} if (defined($element->{'file'}) and $file ne $element->{'file'});
! 37391: $href .= "#$element->{'target'}" if (defined($element->{'target'}));
! 37392: return $href;
! 37393: }
! 37394:
! 37395: sub file_target_href($$$)
! 37396: {
! 37397: my $dest_file = shift;
! 37398: my $orig_file = shift;
! 37399: my $target = shift;
! 37400: my $href = '';
! 37401: $href .= $dest_file if (defined($dest_file) and ($dest_file ne $orig_file));
! 37402: $href .= "#$target" if (defined($target));
! 37403: return $href;
! 37404: }
! 37405:
! 37406: sub trim_around_spaces($)
! 37407: {
! 37408: my $text = shift;
! 37409: $text =~ s/^\s*//;
! 37410: $text =~ s/(\s)\s*$/$1/;
! 37411: if ($text =~ /(\@+)\s$/)
! 37412: {
! 37413: my $arobases = $1;
! 37414: if ((length($arobases) % 2) == 0)
! 37415: {
! 37416: $text =~ s/\s$//;
! 37417: }
! 37418: }
! 37419: else
! 37420: {
! 37421: $text =~ s/\s$//;
! 37422: }
! 37423: return $text;
! 37424: }
! 37425:
! 37426: sub normalise_space($)
! 37427: {
! 37428: return undef unless (defined ($_[0]));
! 37429: my $text = shift;
! 37430: $text =~ s/\s+/ /go;
! 37431: $text =~ s/ $//;
! 37432: $text =~ s/^ //;
! 37433: return $text;
! 37434: }
! 37435:
! 37436:
! 37437: sub normalise_texi_space($)
! 37438: {
! 37439: return undef unless (defined ($_[0]));
! 37440: my $text = shift;
! 37441: $text = trim_around_spaces($text);
! 37442: $text =~ s/\s+/ /go;
! 37443: return $text;
! 37444: }
! 37445:
! 37446: sub normalise_node($)
! 37447: {
! 37448: return undef unless (defined ($_[0]));
! 37449: my $text = shift;
! 37450: $text = normalise_texi_space($text);
! 37451: $text =~ s/^top$/Top/i;
! 37452: return $text;
! 37453: }
! 37454:
! 37455: sub normalise_node_array($)
! 37456: {
! 37457: my $array = shift;
! 37458: my @result;
! 37459: foreach my $node (@$array)
! 37460: {
! 37461: push @result, normalise_node($node);
! 37462: }
! 37463: return @result;
! 37464: }
! 37465:
! 37466: sub do_anchor_label($$$$)
! 37467: {
! 37468: my $command = shift;
! 37469: #my $anchor = shift;
! 37470: my $args = shift;
! 37471: my $anchor = $args->[0];
! 37472: my $style_stack = shift;
! 37473: my $state = shift;
! 37474: my $line_nr = shift;
! 37475:
! 37476: #msg_debug("do_anchor_label $state->{'region'} m_p $state->{'multiple_pass'} remove $state->{'remove_texi'} `$anchor'", $line_nr);
! 37477:
! 37478: $anchor = normalise_node($anchor);
! 37479: if ((defined($state->{'multiple_pass'}) and $state->{'multiple_pass'} > 0) or $state->{'outside_document'})
! 37480: {
! 37481: # no warning when outside of document.
! 37482: line_warn(sprintf(__("Anchor `%s' ignored in %s expanded more than once"),$anchor, $state->{'region'}), $line_nr) unless ($state->{'outside_document'} or defined($state->{'expansion'}));
! 37483: return '';
! 37484: }
! 37485:
! 37486: if (!exists($nodes{$anchor}) or !defined($nodes{$anchor}->{'id'}))
! 37487: {
! 37488: msg_debug("Unknown anchor `$anchor'", $line_nr);
! 37489: }
! 37490: return &$Texi2HTML::Config::anchor_label($nodes{$anchor}->{'id'}, $anchor, $nodes{$anchor}, $state->{'expansion'});
! 37491: }
! 37492:
! 37493: sub get_format_command($)
! 37494: {
! 37495: my $format = shift;
! 37496: my $command = '';
! 37497: my $format_name = '';
! 37498: my $term = 0;
! 37499: my $item_nr;
! 37500: my $paragraph_number;
! 37501: my $enumerate_type;
! 37502: my $number;
! 37503:
! 37504: $command = $format->{'command'} if (defined($format->{'command'}));
! 37505: $format_name = $format->{'format'} if (defined($format->{'format'}));
! 37506:
! 37507: return ($format_name,$command,\$format->{'paragraph_number'},$term,
! 37508: $format->{'item_nr'}, $format->{'spec'}, $format->{'number'},
! 37509: $format->{'stack_at_beginning'});
! 37510: }
! 37511:
! 37512: sub do_paragraph($$;$)
! 37513: {
! 37514: my $text = shift;
! 37515: my $state = shift;
! 37516: my $stack = shift;
! 37517:
! 37518: if (!defined ($state->{'paragraph_context'}))
! 37519: {
! 37520: msg_debug ("paragraph_context undef", $Texi2HTML::THISDOC{'line_nr'});
! 37521: dump_stack (undef, $stack, $state);
! 37522: }
! 37523:
! 37524: my ($format, $paragraph_command, $paragraph_number, $term, $item_nr,
! 37525: $enumerate_type, $number, $stack_at_beginning)
! 37526: = get_format_command ($state->{'paragraph_context'});
! 37527: delete $state->{'paragraph_context'};
! 37528:
! 37529: my $indent_style = '';
! 37530: if (exists($state->{'paragraph_indent'}))
! 37531: {
! 37532: $indent_style = $state->{'paragraph_indent'};
! 37533: $state->{'paragraph_indent'} = undef;
! 37534: delete $state->{'paragraph_indent'};
! 37535: }
! 37536: my $paragraph_command_formatted;
! 37537: $state->{'paragraph_nr'}--;
! 37538: (print STDERR "Bug text undef in do_paragraph", return '') unless defined($text);
! 37539: my $align = '';
! 37540: $align = $state->{'paragraph_style'}->[-1] if ($state->{'paragraph_style'}->[-1]);
! 37541:
! 37542: if ($paragraph_command and !exists($Texi2HTML::Config::special_list_commands{$format}->{$paragraph_command}))
! 37543: {
! 37544: $paragraph_command_formatted = substitute_line("\@$paragraph_command\{\}", "paragraph \@$format \@$paragraph_command", duplicate_formatting_state($state));
! 37545: }
! 37546: return &$Texi2HTML::Config::paragraph($text, $align, $indent_style, $paragraph_command, $paragraph_command_formatted, $paragraph_number, $format, $item_nr, $enumerate_type, $number,$state->{'command_stack'},$stack_at_beginning);
! 37547: }
! 37548:
! 37549: sub do_preformatted($$;$)
! 37550: {
! 37551: my $text = shift;
! 37552: my $state = shift;
! 37553: my $stack = shift;
! 37554:
! 37555: if (!defined ($state->{'preformatted_context'}))
! 37556: {
! 37557: msg_debug ("preformatted_context undef", $Texi2HTML::THISDOC{'line_nr'});
! 37558: dump_stack (undef, $stack, $state);
! 37559: }
! 37560:
! 37561: my ($format, $leading_command, $preformatted_number, $term, $item_nr,
! 37562: $enumerate_type, $number,$stack_at_beginning)
! 37563: = get_format_command($state->{'preformatted_context'});
! 37564: delete ($state->{'preformatted_context'});
! 37565: my $leading_command_formatted;
! 37566: my $pre_style = '';
! 37567: my $class = '';
! 37568: $pre_style = $state->{'preformatted_stack'}->[-1]->{'pre_style'} if ($state->{'preformatted_stack'}->[-1]->{'pre_style'});
! 37569: $class = $state->{'preformatted_stack'}->[-1]->{'class'};
! 37570: print STDERR "BUG: !state->{'preformatted_stack'}->[-1]->{'class'}\n" unless ($class);
! 37571: if (defined($leading_command) and $leading_command ne '' and !exists($Texi2HTML::Config::special_list_commands{$format}->{$leading_command}))
! 37572: {
! 37573: $leading_command_formatted = substitute_line("\@$leading_command\{\}", "preformatted \@$format \@$leading_command", duplicate_formatting_state($state));
! 37574: }
! 37575: return &$Texi2HTML::Config::preformatted($text, $pre_style, $class, $leading_command, $leading_command_formatted, $preformatted_number, $format, $item_nr, $enumerate_type, $number,$state->{'command_stack'},$stack_at_beginning);
! 37576: }
! 37577:
! 37578: sub do_external_href($)
! 37579: {
! 37580: # node_id is a unique node identifier with only letters, digits, - and _
! 37581: # node_xhtml_id is almost the same, but xhtml id can only begin with
! 37582: # letters, so a prefix has to be appended
! 37583: my $texi_node = shift;
! 37584: my $file = '';
! 37585: my $node_file = '';
! 37586: my $node_id = '';
! 37587: my $node_xhtml_id = '';
! 37588:
! 37589: #print STDERR "do_external_href $texi_node\n";
! 37590:
! 37591: if ($texi_node =~ s/^\((.+?)\)//)
! 37592: {
! 37593: $file = $1;
! 37594: }
! 37595: $texi_node = normalise_node($texi_node);
! 37596: if ($texi_node ne '')
! 37597: {
! 37598: if (exists($nodes{$texi_node}) and ($nodes{$texi_node}->{'cross_manual_target'}))
! 37599: {
! 37600: $node_id = $nodes{$texi_node}->{'cross_manual_target'};
! 37601: if ($Texi2HTML::Config::TRANSLITERATE_FILE_NAMES)
! 37602: {
! 37603: $node_file = $nodes{$texi_node}->{'cross_manual_file'};
! 37604: }
! 37605: }
! 37606: else
! 37607: {
! 37608: if ($Texi2HTML::Config::TRANSLITERATE_FILE_NAMES)
! 37609: {
! 37610: ($node_id, $node_file) = cross_manual_line($texi_node,1);
! 37611: }
! 37612: else
! 37613: {
! 37614: $node_id = cross_manual_line($texi_node);
! 37615: }
! 37616: }
! 37617: $node_xhtml_id = node_to_id($node_id);
! 37618: $node_file = $node_id unless ($Texi2HTML::Config::TRANSLITERATE_FILE_NAMES);
! 37619: }
! 37620: return &$Texi2HTML::Config::external_href($texi_node, $node_file,
! 37621: $node_xhtml_id, $file);
! 37622: }
! 37623:
! 37624: # transform node for cross ref name to id suitable for xhtml: an xhtml id
! 37625: # must begin with a letter.
! 37626: sub node_to_id($)
! 37627: {
! 37628: my $cross_ref_node_name = shift;
! 37629: $cross_ref_node_name =~ s/^([0-9_])/g_t$1/;
! 37630: return $cross_ref_node_name;
! 37631: }
! 37632:
! 37633: # return an empty string if the command is not a index command, the prefix
! 37634: # if it is one
! 37635: sub index_command_prefix($)
! 37636: {
! 37637: my $command = shift;
! 37638: return $1 if ($command =~ /^(\w+?)index/ and ($1 ne 'print') and ($1 ne 'syncode') and ($1 ne 'syn') and ($1 ne 'def') and ($1 ne 'defcode'));
! 37639: return '';
! 37640: }
! 37641:
! 37642: # return 1 if the following tag shouldn't begin a line
! 37643: sub no_line($)
! 37644: {
! 37645: my $line = shift;
! 37646: my $next_tag = next_tag($line);
! 37647: return 1 if (($line =~ /^\s*$/) or $Texi2HTML::Config::no_paragraph_commands{$next_tag} or
! 37648: ($Texi2HTML::Config::no_paragraph_commands{'cindex'} and (index_command_prefix($next_tag) ne '')) or
! 37649: (($line =~ /^\@end\s+(\w+)/) and $Texi2HTML::Config::no_paragraph_commands{"end $1"}) or
! 37650: ($next_tag =~ /^special_(\w+)_(\d+)$/ and $Texi2HTML::Config::no_paragraph_commands{$1})
! 37651: );
! 37652: return 0;
! 37653: }
! 37654:
! 37655: sub no_paragraph($$)
! 37656: {
! 37657: my $state = shift;
! 37658: my $line = shift;
! 37659: return ($state->{'paragraph_context'} or $state->{'preformatted'} or $state->{'remove_texi'} or no_line($line) or $state->{'no_paragraph'});
! 37660: }
! 37661:
! 37662: # We restart the preformatted format which was stopped
! 37663: # by the format if in preformatted, and start a paragraph
! 37664: # for the text following the end of the format, if needed
! 37665: sub begin_paragraph_after_command($$$$)
! 37666: {
! 37667: my $state = shift;
! 37668: my $stack = shift;
! 37669: my $command = shift;
! 37670: my $text_following = shift;
! 37671:
! 37672: #if (($state->{'preformatted'}
! 37673: # and !$Texi2HTML::Config::format_in_paragraph{$command})
! 37674: if ($state->{'preformatted'}
! 37675: or (!no_paragraph($state,$text_following)))
! 37676: {
! 37677: begin_paragraph($stack, $state);
! 37678: }
! 37679: }
! 37680:
! 37681: # handle raw formatting, ignored regions...
! 37682: # called from scan_texi, so only in first pass.
! 37683: sub do_text_macro($$$$$)
! 37684: {
! 37685: my $type = shift;
! 37686: my $line = shift;
! 37687: my $state = shift;
! 37688: my $stack = shift;
! 37689: my $line_nr = shift;
! 37690: my $value;
! 37691: #print STDERR "do_text_macro $type\n";
! 37692:
! 37693: if ($Texi2HTML::Config::texi_formats_map{$type} eq 'raw')
! 37694: {
! 37695: $state->{'raw'} = $type;
! 37696: #print STDERR "RAW\n";
! 37697: if ($state->{'raw'})
! 37698: {
! 37699: push @$stack, { 'style' => $type, 'text' => '' };
! 37700: }
! 37701: }
! 37702: elsif ($Texi2HTML::Config::texi_formats_map{$type} eq 'value')
! 37703: {
! 37704: if (($line =~ s/(\s+)($VARRE)$//) or ($line =~ s/(\s+)($VARRE)(\s)//))
! 37705: {
! 37706: $value = $1 . $2;
! 37707: $value .= $3 if defined($3);
! 37708: if ($state->{'ignored'})
! 37709: {
! 37710: if ($type eq $state->{'ignored'})
! 37711: {
! 37712: $state->{'ifvalue_inside'}++;
! 37713: }
! 37714: # if 'ignored' we don't care about the command as long as
! 37715: # the nesting is correct
! 37716: return ($line,'');
! 37717: }
! 37718: my $open_ignored_ifvalue = 0;
! 37719: if ($type eq 'ifclear')
! 37720: {
! 37721: if (defined($value{$2}))
! 37722: {
! 37723: $open_ignored_ifvalue = 1;
! 37724: }
! 37725: else
! 37726: {
! 37727: push @{$state->{'text_macro_stack'}}, $type;
! 37728: }
! 37729: }
! 37730: elsif ($type eq 'ifset')
! 37731: {
! 37732: unless (defined($value{$2}))
! 37733: {
! 37734: $open_ignored_ifvalue = 1;
! 37735: }
! 37736: else
! 37737: {
! 37738: push @{$state->{'text_macro_stack'}}, $type;
! 37739: }
! 37740: }
! 37741: if ($open_ignored_ifvalue)
! 37742: {
! 37743: $state->{'ignored'} = $type;
! 37744: $state->{'ifvalue'} = $type;
! 37745: $state->{'ifvalue_inside'} = 1;
! 37746: # We add at the top of the stack to be able to close all
! 37747: # opened comands when closing the ifset/ifclear (and ignore
! 37748: # everything that is in those commands)
! 37749: push @$stack, { 'style' => 'ifvalue', 'text' => '' };
! 37750: }
! 37751: }
! 37752: else
! 37753: { # we accept a lone @ifset or @ifclear if it is nested in an @if*
! 37754: if ($state->{'ifvalue'} and $type eq $state->{'ifvalue'})
! 37755: {
! 37756: $state->{'ifvalue_inside'}++;
! 37757: return ($line,'');
! 37758: }
! 37759: line_error (sprintf(__("%c%s requires a name"), ord('@'), $type), $line_nr) unless ($state->{'ignored'});
! 37760: }
! 37761: }
! 37762: elsif (not $Texi2HTML::Config::texi_formats_map{$type})
! 37763: { # ignored text
! 37764: $state->{'ignored'} = $type;
! 37765: #print STDERR "IGNORED\n";
! 37766: }
! 37767: else
! 37768: {
! 37769: push @{$state->{'text_macro_stack'}}, $type unless($state->{'ignored'}) ;
! 37770: }
! 37771: my $text = "\@$type";
! 37772: $text .= $value if defined($value);
! 37773: return ($line, $text);
! 37774: }
! 37775:
! 37776: # do regions handled specially, for example tex or math going through latex2html
! 37777: sub init_special($$)
! 37778: {
! 37779: my $style = shift;
! 37780: my $text = shift;
! 37781: if (defined($Texi2HTML::Config::command_handler{$style}) and
! 37782: defined($Texi2HTML::Config::command_handler{$style}->{'init'}))
! 37783: {
! 37784: $special_commands{$style}->{'count'} = 0 if (!defined($special_commands{$style}));
! 37785: if ($Texi2HTML::Config::command_handler{$style}->{'init'}($style,$text,
! 37786: $special_commands{$style}->{'count'} +1))
! 37787: {
! 37788: $special_commands{$style}->{'count'}++;
! 37789: return "\@special_${style}_".$special_commands{$style}->{'count'}."{}";
! 37790: }
! 37791: return '';
! 37792: }
! 37793: }
! 37794:
! 37795: sub reset_index_entries($)
! 37796: {
! 37797: my $region = shift;
! 37798: if (defined($Texi2HTML::THISDOC{'index_entries'}->{$region}))
! 37799: {
! 37800: foreach my $entry (values(%{$Texi2HTML::THISDOC{'index_entries'}->{$region}}))
! 37801: {
! 37802: if (scalar(@{$entry->{'entries'}}) > 1)
! 37803: {
! 37804: $entry->{'index'} = 0;
! 37805: }
! 37806: }
! 37807: }
! 37808: if (defined($Texi2HTML::THISDOC{'indices_numbers'}->{$region}))
! 37809: {
! 37810: foreach my $index_name (keys(%{$Texi2HTML::THISDOC{'indices_numbers'}->{$region}}))
! 37811: {
! 37812: $Texi2HTML::THISDOC{'indices_numbers'}->{$region}->{$index_name} = undef;
! 37813: }
! 37814: }
! 37815: }
! 37816:
! 37817: # FIXME we cannot go through the commands too 'often'. The error messages
! 37818: # are duplicated and global stuff is changed.
! 37819: # -> identify what is global
! 37820: # -> use local state
! 37821: sub do_special_region_lines($;$$)
! 37822: {
! 37823: my $region = shift;
! 37824: my $state = shift;
! 37825: my $line_nr = shift;
! 37826:
! 37827: # this case covers something like
! 37828: # @copying
! 37829: # @insertcopying
! 37830: # @end copying
! 37831: if (defined($state) and exists($state->{'region'}) and ($region eq $state->{'region'}))
! 37832: {
! 37833: line_error(sprintf(__("Region %s inside region %s is not allowed"), $region, $state->{'region'}), $line_nr);
! 37834: return ('','', '');
! 37835: }
! 37836:
! 37837: print STDERR "# do_special_region_lines for region $region ['multiple_pass','region_pass']: ($region_initial_state{$region}->{'multiple_pass'}, $region_initial_state{$region}->{'region_pass'})" if ($T2H_DEBUG);
! 37838: if (!defined($state))
! 37839: {
! 37840: $state = {};
! 37841: fill_state($state);
! 37842: $state->{'outside_document'} = 1;
! 37843: print STDERR " outside document\n" if ($T2H_DEBUG);
! 37844: }
! 37845: elsif (!$state->{'outside_document'})
! 37846: {
! 37847: $region_initial_state{$region}->{'multiple_pass'}++;
! 37848: print STDERR " multiple pass $region_initial_state{$region}->{'multiple_pass'}\n" if ($T2H_DEBUG);
! 37849: }
! 37850: else
! 37851: {
! 37852: print STDERR " in $state->{'region'}, outside document\n" if ($T2H_DEBUG);
! 37853: }
! 37854:
! 37855: return ('','','') unless @{$region_lines{$region}};
! 37856:
! 37857: my @result;
! 37858:
! 37859: foreach my $context ('normal', 'remove_texi', 'simple_format')
! 37860: {
! 37861: print STDERR "# $context\n" if ($T2H_DEBUG);
! 37862: my $new_state = duplicate_formatting_state($state);
! 37863: reset_index_entries($region);
! 37864: foreach my $key (keys(%{$region_initial_state{$region}}))
! 37865: {
! 37866: $new_state->{$key} = $region_initial_state{$region}->{$key};
! 37867: }
! 37868: $new_state->{'remove_texi'} = 1 if ($context eq 'remove_texi');
! 37869:
! 37870: &$Texi2HTML::Config::begin_special_region($region,$new_state,$region_lines{$region})
! 37871: if (defined($Texi2HTML::Config::begin_special_region));
! 37872:
! 37873:
! 37874: my $line_numbers;
! 37875: my $context_string = "$region ($region_initial_state{$region}->{'multiple_pass'}, $region_initial_state{$region}->{'region_pass'})";
! 37876: if ($context eq 'normal')
! 37877: { # the line numbers are given only for the normal context, therefore
! 37878: # there will be error messages only in that case
! 37879: $line_numbers = [ @{$region_line_nrs{$region}} ];
! 37880: }
! 37881: else
! 37882: {
! 37883: $context_string = "$context $context_string";
! 37884: }
! 37885:
! 37886: my $result;
! 37887: if ($context ne 'simple_format')
! 37888: {
! 37889: $result = substitute_text($new_state, $line_numbers,
! 37890: $context_string, @{$region_lines{$region}});
! 37891: }
! 37892: else
! 37893: {
! 37894: $result = simple_format($new_state, $line_numbers,
! 37895: $context_string, @{$region_lines{$region}});
! 37896: }
! 37897: $result = &$Texi2HTML::Config::end_special_region($region,$new_state,$result)
! 37898: if (defined($Texi2HTML::Config::end_special_region));
! 37899:
! 37900: push @result, $result;
! 37901: $region_initial_state{$region}->{'region_pass'}++;
! 37902: }
! 37903:
! 37904: return @result;
! 37905: }
! 37906:
! 37907: sub do_insertcopying($$)
! 37908: {
! 37909: my $state = shift;
! 37910: my $line_nr = shift;
! 37911: my ($text, $comment, $simple_formatted) = do_special_region_lines('copying', $state, $line_nr);
! 37912: return &$Texi2HTML::Config::insertcopying($text, $comment, $simple_formatted);
! 37913: }
! 37914:
! 37915: sub get_deff_index($$$$)
! 37916: {
! 37917: my $tag = shift;
! 37918: my $line = shift;
! 37919: my $line_nr = shift;
! 37920: my $warn = shift;
! 37921:
! 37922: $tag =~ s/x$//;
! 37923: my ($command, $style, $category, $name, $type, $class, $arguments, $args_array, $args_type_array);
! 37924: ($command, $style, $category, $name, $type, $class, $arguments, $args_array, $args_type_array) = parse_def($tag, $line, $line_nr, $warn);
! 37925: $name = &$Texi2HTML::Config::definition_index_entry($name, $class, $style, $command);
! 37926: return ($style, '') if (!defined($name) or ($name =~ /^\s*$/));
! 37927: return ($style, $name, $arguments);
! 37928: }
! 37929:
! 37930: sub parse_def($$$;$)
! 37931: {
! 37932: my $command = shift;
! 37933: my $line = shift;
! 37934: my $line_nr = shift;
! 37935: my $report = shift;
! 37936:
! 37937: my $format = $command;
! 37938:
! 37939: if (!ref ($Texi2HTML::Config::def_map{$command}))
! 37940: {
! 37941: # substitute shortcuts for definition commands
! 37942: my $substituted = $Texi2HTML::Config::def_map{$command};
! 37943: $substituted =~ s/(\w+)//;
! 37944: $format = $1;
! 37945: $line = $substituted . $line;
! 37946: }
! 37947: #print STDERR "PARSE_DEF($command,$format) $line";
! 37948: my ($category, $name, $type, $class, $arguments);
! 37949: my @arguments = ();
! 37950: my @args = @{$Texi2HTML::Config::def_map{$format}};
! 37951: my $style = shift @args;
! 37952: my @arg_types = ();
! 37953: while (@args and $args[0] ne 'arg' and $args[0] ne 'argtype')
! 37954: {
! 37955: my $arg = shift @args;
! 37956: # backward compatibility, it was possible to have a { in front.
! 37957: $arg =~ s/^\{//;
! 37958: my ($item, $spaces);
! 37959: ($item, $line, $spaces) = next_def_param($line, $command, $line_nr, $report);
! 37960: last if (!defined($item));
! 37961: if ($arg eq 'category')
! 37962: {
! 37963: $category = $item;
! 37964: }
! 37965: elsif ($arg eq 'name')
! 37966: {
! 37967: $name = $item;
! 37968: }
! 37969: elsif ($arg eq 'type')
! 37970: {
! 37971: $type = $item;
! 37972: }
! 37973: elsif ($arg eq 'class')
! 37974: {
! 37975: $class = $item;
! 37976: }
! 37977: push @arg_types, $arg;
! 37978: push @arguments, $item;
! 37979: }
! 37980: my $line_remaining = $line;
! 37981: $line = '';
! 37982: my $arg_and_type = 1;
! 37983: foreach my $arg (@args)
! 37984: {
! 37985: if ($arg eq 'arg')
! 37986: {
! 37987: $arg_and_type = 0;
! 37988: last;
! 37989: }
! 37990: elsif ($arg eq 'argtype')
! 37991: {
! 37992: last;
! 37993: }
! 37994: }
! 37995:
! 37996: my $always_delimiter_quoted = quotemeta($Texi2HTML::Config::def_always_delimiters);
! 37997: my $in_type_delimiter_quoted = quotemeta($Texi2HTML::Config::def_in_type_delimiters);
! 37998: my $after_type = 0;
! 37999: while ($line_remaining !~ /^\s*$/)
! 38000: {
! 38001: my ($item, $spaces);
! 38002: ($item, $line_remaining,$spaces) = next_def_param($line_remaining, $command, $line_nr);
! 38003: if ($item =~ /^([$always_delimiter_quoted])/ or (!$arg_and_type and $item =~ /^([$in_type_delimiter_quoted].*)/))
! 38004: {
! 38005: $item = $1;
! 38006: push @arg_types, 'delimiter';
! 38007: $after_type = 0;
! 38008: }
! 38009: elsif (!$arg_and_type or $item =~ /^\@/ or $after_type)
! 38010: {
! 38011: push @arg_types, 'param';
! 38012: $after_type = 0;
! 38013: }
! 38014: elsif ($item =~ /^([$in_type_delimiter_quoted])/)
! 38015: {
! 38016: push @arg_types, 'delimiter';
! 38017: }
! 38018: else
! 38019: {
! 38020: push @arg_types, 'paramtype';
! 38021: $after_type = 1;
! 38022: }
! 38023: $spaces = ' ' if ($spaces);
! 38024: $line .= $spaces . $item;
! 38025: push @arguments, $spaces .$item;
! 38026: }
! 38027: #print STDERR "PARSE_DEF (style $style, category $category, name $name, type $type, class $class, line $line)\n";
! 38028: return ($format, $style, $category, $name, $type, $class, $line, \@arguments, \@arg_types);
! 38029: }
! 38030:
! 38031: sub begin_paragraph($$)
! 38032: {
! 38033: my $stack = shift;
! 38034: my $state = shift;
! 38035:
! 38036: my $command = { };
! 38037: my $top_format = top_format($stack);
! 38038: if (defined($top_format))
! 38039: {
! 38040: $command = $top_format;
! 38041: }
! 38042: $command->{'stack_at_beginning'} = [ @{$state->{'command_stack'}} ];
! 38043: my $paragraph_or_preformatted = 'paragraph';
! 38044: if ($state->{'preformatted'})
! 38045: {
! 38046: $paragraph_or_preformatted = 'preformatted';
! 38047: $state->{'preformatted_context'} = $command;
! 38048: }
! 38049: else
! 38050: {
! 38051: $state->{'paragraph_context'} = $command;
! 38052: $state->{'paragraph_nr'}++;
! 38053: }
! 38054: push @$stack, {'format' => $paragraph_or_preformatted, 'text' => '' };
! 38055: # FIXME give line, and modify line?
! 38056: &$Texi2HTML::Config::begin_paragraph_texi($paragraph_or_preformatted,
! 38057: $state->{'paragraph_macros'}, $command, $state, $stack)
! 38058: if (defined($Texi2HTML::Config::begin_paragraph_texi));
! 38059: # if there are macros which weren't closed when the previous
! 38060: # paragraph was closed we reopen them here
! 38061: push @$stack, @{$state->{'paragraph_macros'}} if $state->{'paragraph_macros'};
! 38062: delete $state->{'paragraph_macros'};
! 38063: }
! 38064:
! 38065: sub parse_format_command($$)
! 38066: {
! 38067: my $line = shift;
! 38068: my $tag = shift;
! 38069: my $command = '';
! 38070:
! 38071: my $orig_line = $line;
! 38072: # macro_regexp
! 38073: if ($line =~ s/^\s*\@([A-Za-z][\w-]*)(\{\})?\s*$//)
! 38074: {
! 38075: $command = $1;
! 38076: $command = $alias{$command} if (exists($alias{$command}));
! 38077: }
! 38078: return ('', $command) if ($line =~ /^\s*$/);
! 38079: chomp $line;
! 38080: $line = substitute_text ({'keep_nr' => 1, 'keep_texi' => 1, 'check_item' => $tag}, undef, "parse_format_command", $line);
! 38081: return ($line, $command);
! 38082: }
! 38083:
! 38084: sub parse_enumerate($)
! 38085: {
! 38086: my $line = shift;
! 38087: my $spec;
! 38088: if ($line =~ /^\s*(\w)\b/ and ($1 ne '_'))
! 38089: {
! 38090: $spec = $1;
! 38091: $line =~ s/^\s*(\w)\s*//;
! 38092: }
! 38093: return ($line, $spec);
! 38094: }
! 38095:
! 38096: sub parse_multitable($$)
! 38097: {
! 38098: my $line = shift;
! 38099: my $line_nr = shift;
! 38100: # first find the table width
! 38101: my $table_width = 0;
! 38102: my $fractions;
! 38103: my $elements;
! 38104: if ($line =~ s/^\s+\@columnfractions\s+//)
! 38105: {
! 38106: @$fractions = split /\s+/, $line;
! 38107: $table_width = scalar(@$fractions);
! 38108: foreach my $fraction (@$fractions)
! 38109: {
! 38110: unless ($fraction =~ /^(\d*\.\d+)|(\d+)\.?$/)
! 38111: {
! 38112: line_error (sprintf(__("column fraction not a number: %s"), $fraction), $line_nr);
! 38113: }
! 38114: }
! 38115: }
! 38116: else
! 38117: {
! 38118: my $element;
! 38119: my $line_orig = $line;
! 38120: while ($line !~ /^\s*$/)
! 38121: {
! 38122: my $spaces;
! 38123: ($element, $line, $spaces) = next_bracketed($line, 'multitable', $line_nr, 1);
! 38124: if ($element =~ /^\{/)
! 38125: {
! 38126: $table_width++;
! 38127: $element =~ s/^\{//;
! 38128: $element =~ s/\}\s*$//;
! 38129: push @$elements, $element;
! 38130: }
! 38131: else
! 38132: {
! 38133: line_warn (sprintf(__("ignoring stray text `%s' after \@multitable"), $element), $line_nr);
! 38134: }
! 38135: }
! 38136: }
! 38137: return ($table_width, $fractions, $elements);
! 38138: }
! 38139:
! 38140: sub end_format($$$$$)
! 38141: {
! 38142: my $text = shift;
! 38143: my $stack = shift;
! 38144: my $state = shift;
! 38145: my $format = shift;
! 38146: my $line_nr = shift;
! 38147: #msg_debug ("END FORMAT $format", $line_nr);
! 38148: #dump_stack($text, $stack, $state);
! 38149: #sleep 1;
! 38150: if ($format_type{$format} eq 'menu')
! 38151: {
! 38152: $state->{$format}--;
! 38153: if ($state->{$format} < 0)
! 38154: { # FIXME currently happens, see invalid/not_closed_in_menu.texi
! 38155: line_error(sprintf(__("Too many %s closed"), $format), $line_nr);
! 38156: #print STDERR "Bug, $format counter negative: $state->{$format}\n";
! 38157: #dump_stack($text, $stack, $state);
! 38158: #exit 1;
! 38159: $state->{$format} = 0;
! 38160: }
! 38161: close_menu_comment($text, $stack, $state, "\@end $format", $line_nr);
! 38162: }
! 38163:
! 38164: if ($format_type{$format} eq 'list')
! 38165: { # those functions return if they detect an inapropriate context
! 38166: add_item($text, $stack, $state, $line_nr); # handle lists
! 38167: }
! 38168: elsif ($format eq 'multitable')
! 38169: {
! 38170: add_row($text, $stack, $state, $line_nr); # handle multitable
! 38171: }
! 38172: elsif ($format_type{$format} eq 'table')
! 38173: {
! 38174: add_term($text, $stack, $state, $line_nr); # handle table
! 38175: add_line($text, $stack, $state, $line_nr); # handle table
! 38176: }
! 38177:
! 38178: #print STDERR "END_FORMAT\n";
! 38179: #dump_stack($text, $stack, $state);
! 38180:
! 38181: # set to 1 if there is a mismatch between the closed format and format
! 38182: # opened before
! 38183: my $format_mismatch = 0;
! 38184: # set to 1 in normal menu context after an end menu or detailmenu
! 38185: my $begin_menu_comment_after_end_format = 0;
! 38186:
! 38187: my $format_ref = pop @$stack;
! 38188:
! 38189: ######################### debug
! 38190: if (!defined($format_ref->{'text'}))
! 38191: {
! 38192: push @$stack, $format_ref;
! 38193: print STDERR "Bug: text undef in end_format $format\n";
! 38194: dump_stack($text, $stack, $state);
! 38195: pop @$stack;
! 38196: }
! 38197: ######################### end debug
! 38198:
! 38199: if ($region_lines{$format})
! 38200: {
! 38201: ######################### debug
! 38202: if ($format ne $state->{'region_lines'}->{'format'})
! 38203: {
! 38204: msg_debug ("Bug: mismatched region `$format' ne `$state->{'region_lines'}->{'format'}'");
! 38205: }
! 38206: ######################### end debug
! 38207: $state->{'region_lines'}->{'number'}--;
! 38208: if ($state->{'region_lines'}->{'number'} == 0)
! 38209: {
! 38210: close_region($state);
! 38211: }
! 38212: }
! 38213:
! 38214: if ($format_type{$format} eq 'table' or $format_type{$format} eq 'list' or $format eq 'multitable')
! 38215: {
! 38216: if ($format_ref->{'format'} ne $format)
! 38217: { # for example vtable closing a table. Cannot be known
! 38218: # before if in a cell
! 38219: $format_mismatch = 1;
! 38220: line_error (sprintf(__("`\@end' expected `%s', but saw `%s'"), $format_ref->{'format'}, $format), $line_nr);
! 38221:
! 38222: }
! 38223: if (!$format_ref->{'empty_first'} and $format_ref->{'item_nr'} == 0)
! 38224: {
! 38225: line_warn (sprintf(__("\@%s has text but no \@item"),$format_ref->{'format'}), $line_nr);
! 38226: }
! 38227: }
! 38228:
! 38229: if (defined($Texi2HTML::Config::def_map{$format}))
! 38230: {
! 38231: close_stack($text, $stack, $state, $line_nr, 'deff_item')
! 38232: unless ($format_ref->{'format'} eq 'deff_item');
! 38233: add_prev($text, $stack, &$Texi2HTML::Config::def_item($format_ref->{'text'}, $format_ref->{'only_inter_commands'}, $format_ref->{'orig_command'}));
! 38234: $format_ref = pop @$stack; # pop deff
! 38235: ######################################### debug
! 38236: if (!defined($format_ref->{'format'}) or !defined($Texi2HTML::Config::def_map{$format_ref->{'format'}}))
! 38237: {
! 38238: print STDERR "Bug: not a def* under deff_item\n";
! 38239: push (@$stack, $format_ref);
! 38240: dump_stack($text, $stack, $state);
! 38241: pop @$stack;
! 38242: }
! 38243: ######################################### end debug
! 38244: elsif ($format_ref->{'format'} ne $format)
! 38245: {
! 38246: $format_mismatch = 1;
! 38247: line_error (sprintf(__("`\@end' expected `%s', but saw `%s'"), $format_ref->{'format'}, $format), $line_nr);
! 38248: }
! 38249: add_prev($text, $stack, &$Texi2HTML::Config::def($format_ref->{'text'}, $format_ref->{'orig_format'}));
! 38250: }
! 38251: elsif ($format eq 'float')
! 38252: {
! 38253: unless (defined($state->{'float'}))
! 38254: {
! 38255: msg_debug("state->{'float'} not defined in float", $line_nr);
! 38256: next;
! 38257: }
! 38258: my ($caption_lines, $shortcaption_lines) = &$Texi2HTML::Config::caption_shortcaption($state->{'float'});
! 38259: my ($caption_text, $shortcaption_text);
! 38260: my $caption_state = duplicate_formatting_state($state);
! 38261: push @{$caption_state->{'command_stack'}}, 'caption';
! 38262: $caption_text = substitute_text($caption_state, undef, '@caption in @end float', @$caption_lines) if (defined($caption_lines));
! 38263:
! 38264: my $shortcaption_state = duplicate_formatting_state($state);
! 38265: push @{$shortcaption_state->{'command_stack'}}, 'shortcaption';
! 38266: $shortcaption_text = substitute_text($shortcaption_state, undef, '@shortcaption in @end float', @$shortcaption_lines) if (defined($shortcaption_lines));
! 38267: add_prev($text, $stack, &$Texi2HTML::Config::float($format_ref->{'text'}, $state->{'float'}, $caption_text, $shortcaption_text));
! 38268: delete $state->{'float'};
! 38269: }
! 38270: # FIXME $complex_format_map obsoleted in nov 2009
! 38271: elsif ((exists ($Texi2HTML::Config::complex_format_map->{$format})
! 38272: or exists ($Texi2HTML::Config::complex_format_map{$format}))
! 38273: and ($format_type{$format} ne 'menu' or $Texi2HTML::Config::SIMPLE_MENU))
! 38274: {
! 38275: $state->{'preformatted'}--;
! 38276: pop @{$state->{'preformatted_stack'}};
! 38277: my $complex_format;
! 38278: if (exists ($Texi2HTML::Config::complex_format_map->{$format}))
! 38279: {
! 38280: $complex_format = $Texi2HTML::Config::complex_format_map->{$format};
! 38281: }
! 38282: else
! 38283: {
! 38284: $complex_format = $Texi2HTML::Config::complex_format_map{$format};
! 38285: }
! 38286: # debug
! 38287: if (!defined($complex_format->{'begin'}))
! 38288: {
! 38289: msg_debug ("Bug undef $format_ref->{'format'}" . "->{'begin'} (for $format...)", $line_nr);
! 38290: dump_stack ($text, $stack, $state);
! 38291: }
! 38292: if ($fake_format{$format_ref->{'format'}} and $format_ref->{'text'} =~ /^\s*$/)
! 38293: {
! 38294: # discard empty fake formats
! 38295: }
! 38296: #print STDERR "before $format\n";
! 38297: #dump_stack ($text, $stack, $state);
! 38298: else
! 38299: {
! 38300: add_prev($text, $stack, &$Texi2HTML::Config::complex_format($format_ref->{'format'}, $format_ref->{'text'}));
! 38301: }
! 38302: #print STDERR "after $format\n";
! 38303: #dump_stack ($text, $stack, $state);
! 38304: }
! 38305: elsif ($format_type{$format} eq 'table' or $format_type{$format} eq 'list' or $format eq 'multitable')
! 38306: {
! 38307: if (exists ($Texi2HTML::Config::format_map{$format}))
! 38308: { # table or list has a simple format
! 38309: add_prev($text, $stack, end_simple_format($format_ref->{'format'}, $format_ref->{'text'}, $state));
! 38310: }
! 38311: else
! 38312: { # table or list handler defined by the user
! 38313: add_prev($text, $stack, &$Texi2HTML::Config::table_list($format_ref->{'format'}, $format_ref->{'text'}, $format_ref->{'command'}, $format_ref->{'formatted_command'}, $format_ref->{'item_nr'}, $format_ref->{'spec'}, $format_ref->{'prepended'}, $format_ref->{'prepended_formatted'}, $format_ref->{'columnfractions'}, $format_ref->{'prototype_row'}, $format_ref->{'prototype_lengths'}, $format_ref->{'max_columns'}));
! 38314: }
! 38315: }
! 38316: elsif ($format_type{$format} eq 'quotation')
! 38317: {
! 38318: my $quotation_args = pop @{$state->{'quotation_stack'}};
! 38319: #add_prev($text, $stack, &$Texi2HTML::Config::quotation($format, $format_ref->{'text'}, $quotation_args->{'text'}, $quotation_args->{'text_texi'}));
! 38320: add_prev($text, $stack, &$Texi2HTML::Config::quotation($format, $format_ref->{'text'}, $format_ref->{'argument_text'}, $format_ref->{'argument_texi'}, $format_ref->{'quote_authors'}));
! 38321: }
! 38322: elsif ($Texi2HTML::Config::paragraph_style{$format})
! 38323: {
! 38324: if ($state->{'paragraph_style'}->[-1] eq $format)
! 38325: {
! 38326: pop @{$state->{'paragraph_style'}};
! 38327: }
! 38328: if ($fake_format{$format_ref->{'format'}} and $format_ref->{'text'} =~ /^\s*$/)
! 38329: {
! 38330: # discard empty fake formats
! 38331: }
! 38332: else
! 38333: {
! 38334: add_prev($text, $stack, &$Texi2HTML::Config::paragraph_style_command($format_ref->{'format'},$format_ref->{'text'}));
! 38335: }
! 38336: }
! 38337: elsif (exists($Texi2HTML::Config::format_map{$format}))
! 38338: {
! 38339: if ($fake_format{$format_ref->{'format'}} and $format_ref->{'text'} =~ /^\s*$/)
! 38340: {
! 38341: # discard empty fake formats
! 38342: }
! 38343: else
! 38344: {
! 38345: add_prev($text, $stack, end_simple_format($format_ref->{'format'}, $format_ref->{'text'}, $state));
! 38346: }
! 38347: }
! 38348: elsif ($format_type{$format} eq 'cartouche')
! 38349: {
! 38350: add_prev($text, $stack, &$Texi2HTML::Config::cartouche($format_ref->{'text'},$state->{'command_stack'}));
! 38351: }
! 38352: elsif ($format_type{$format} eq 'menu')
! 38353: {
! 38354: # it should be short-circuited if $Texi2HTML::Config::SIMPLE_MENU
! 38355: if ($state->{'preformatted'})
! 38356: {
! 38357: # remove the fake complex style
! 38358: $state->{'preformatted'}--;
! 38359: pop @{$state->{'preformatted_stack'}};
! 38360: }
! 38361:
! 38362: # backward compatibility with 1.78 jun 2007
! 38363: if (defined($Texi2HTML::Config::menu))
! 38364: {
! 38365: if ($format eq 'menu')
! 38366: {
! 38367: add_prev($text, $stack, &$Texi2HTML::Config::menu($format_ref->{'text'}));
! 38368: }
! 38369: elsif ($format eq 'detailmenu') # detailmenu
! 38370: {
! 38371: add_prev($text, $stack, $format_ref->{'text'});
! 38372: }
! 38373: else # direntry
! 38374: {
! 38375: }
! 38376: }
! 38377: else
! 38378: {
! 38379: add_prev($text, $stack, &$Texi2HTML::Config::menu_command($format, $format_ref->{'text'}, $state->{'preformatted'}));
! 38380: }
! 38381: $begin_menu_comment_after_end_format = 1;
! 38382: }
! 38383: else
! 38384: {
! 38385: line_warn(sprintf(__("Unknown format %s"), $format), $line_nr);
! 38386: }
! 38387:
! 38388: # fake formats are not on the command_stack
! 38389: return 1 if ($fake_format{$format_ref->{'format'}});
! 38390: # special case for center as it is at the bottom of the stack
! 38391: my $removed_from_stack;
! 38392: if ($format eq 'center')
! 38393: {
! 38394: $removed_from_stack = shift @{$state->{'command_stack'}};
! 38395: }
! 38396: else
! 38397: {
! 38398: $removed_from_stack = pop @{$state->{'command_stack'}};
! 38399: }
! 38400: if ($removed_from_stack ne $format and !$format_mismatch)
! 38401: {
! 38402: #line_error ("Bug: removed_from_stack $removed_from_stack ne format $format", $line_nr);
! 38403: # it may not be a bug. Consider, for example a @code{in code
! 38404: # @end cartouche
! 38405: # The @code is closed when the paragraph is closed by
! 38406: # @end cartouche but not really closed since it might have been
! 38407: # a multiple paragraph @code. So it is not removed from
! 38408: # command_stack but still have disapeared from the stack!
! 38409: line_error(sprintf(__("mismatched \@end %s with \@%s"), $format, $removed_from_stack), $line_nr);
! 38410: }
! 38411: if ($begin_menu_comment_after_end_format and $state->{'menu'})
! 38412: {
! 38413: begin_format($text, $stack, $state, 'menu_comment', '', $line_nr);
! 38414: return 0;
! 38415: }
! 38416: return 1;
! 38417: }
! 38418:
! 38419: sub push_complex_format_style($$$$)
! 38420: {
! 38421: my $command = shift;
! 38422: my $complex_format = shift;
! 38423: my $state = shift;
! 38424: my $line_nr = shift;
! 38425: my $class = $command;
! 38426:
! 38427: if (!defined($state->{'preformatted_stack'}))
! 38428: {
! 38429: msg_debug ("'preformatted_stack' not defined in push_complex_format_style", $line_nr);
! 38430: }
! 38431:
! 38432: $class = $complex_format->{'class'} if (defined($complex_format->{'class'}));
! 38433: my $format_style = {'pre_style' =>$complex_format->{'pre_style'}, 'class' => $class, 'command' => $command };
! 38434: if (defined($complex_format->{'style'}))
! 38435: {
! 38436: $format_style->{'style'} = $complex_format->{'style'};
! 38437: }
! 38438: else
! 38439: {
! 38440: if ($state->{'preformatted'} and defined($state->{'preformatted_stack'}->[-1]->{'style'}))
! 38441: {
! 38442: $format_style->{'style'} = $state->{'preformatted_stack'}->[-1]->{'style'};
! 38443: }
! 38444: my $index = scalar(@{$state->{'preformatted_stack'}}) -1;
! 38445: # since preformatted styles are not nested, the preformatted format
! 38446: # of the first format with style has to be used
! 38447: if ($index > 0)
! 38448: {
! 38449: while ($index)
! 38450: {
! 38451: if ($state->{'preformatted_stack'}->[$index]->{'style'})
! 38452: {
! 38453: $format_style->{'class'} = $state->{'preformatted_stack'}->[$index]->{'class'} if (defined($state->{'preformatted_stack'}->[$index]->{'class'}));
! 38454: last;
! 38455: }
! 38456: $index--;
! 38457: }
! 38458: }
! 38459: }
! 38460: $state->{'preformatted'}++;
! 38461: push @{$state->{'preformatted_stack'}}, $format_style;
! 38462: }
! 38463:
! 38464: sub prepare_state_multiple_pass($$)
! 38465: {
! 38466: my $command = shift;
! 38467: my $state = shift;
! 38468: my $return_state = {
! 38469: 'multiple_pass' => 1,
! 38470: 'element' => $state->{'element'},
! 38471: 'outside_document' => $state->{'outside_document'},
! 38472: 'new_state' => 1
! 38473: };
! 38474: if (defined($command))
! 38475: {
! 38476: $return_state->{'expansion'} = $command;
! 38477: $return_state->{'command_stack'} = ["$command"];
! 38478: }
! 38479: else
! 38480: {
! 38481: msg_debug("prepare_state_multiple_pass command not defined");
! 38482: }
! 38483: return $return_state;
! 38484: }
! 38485:
! 38486: sub begin_format($$$$$$);
! 38487:
! 38488: sub begin_format($$$$$$)
! 38489: {
! 38490: my $text = shift;
! 38491: my $stack = shift;
! 38492: my $state = shift;
! 38493: my $macro = shift;
! 38494: my $line = shift;
! 38495: my $line_nr = shift;
! 38496: #msg_debug ("BEGIN FORMAT $macro",$line_nr);
! 38497:
! 38498: my $in_term;
! 38499: my $top_format = top_stack($stack, 2);
! 38500: $in_term = 1 if (defined($top_format->{'format'}) and $top_format->{'format'} eq 'term');
! 38501:
! 38502: if ($format_type{$macro} eq 'menu')
! 38503: {
! 38504: if ($state->{'menu'})
! 38505: {
! 38506: # there should not be any paragraph/preformatted to close
! 38507: # if the comment or the description were closed since they
! 38508: # close it
! 38509: if (! close_menu_comment($text, $stack, $state, "\@$macro", $line_nr)
! 38510: and !close_menu_description($text, $stack, $state, "\@$macro", $line_nr))
! 38511: {
! 38512: close_paragraph($text, $stack, $state, "\@$macro", $line_nr);
! 38513: }
! 38514: }
! 38515: else
! 38516: {
! 38517: close_paragraph($text, $stack, $state, "\@$macro", $line_nr);
! 38518: }
! 38519: $state->{$macro}++;
! 38520: }
! 38521: elsif (!$in_term)
! 38522: {
! 38523: close_paragraph($text, $stack, $state, "\@$macro", $line_nr);
! 38524: }
! 38525:
! 38526: # close def_item if this is a matching @def*x command
! 38527: if (defined($Texi2HTML::Config::def_map{$macro}))
! 38528: {
! 38529: my $top_format = top_format($stack);
! 38530: if (defined($top_format) and ("$top_format->{'format'}x" eq $macro))
! 38531: {
! 38532: # this is a matching @DEFx command.
! 38533: my $deff_item = pop @$stack;
! 38534: add_prev($text, $stack,
! 38535: &$Texi2HTML::Config::def_item($deff_item->{'text'}, $deff_item->{'only_inter_commands'}, $deff_item->{'orig_command'}));
! 38536: #print STDERR "DEFx $macro\n";
! 38537: }
! 38538: elsif ($macro =~ /x$/)
! 38539: {
! 38540: my $base_def_command = $macro;
! 38541: $base_def_command =~ s/x$//;
! 38542: line_error(sprintf(__("Must be in `\@%s' environment to use `\@%s'"), $base_def_command, $macro), $line_nr);
! 38543: }
! 38544: }
! 38545:
! 38546: $line = &$Texi2HTML::Config::begin_format_texi($macro, $line, $state)
! 38547: unless($fake_format{$macro});
! 38548:
! 38549: push (@{$state->{'command_stack'}}, $macro) unless ($fake_format{$macro});
! 38550: if ($region_lines{$macro})
! 38551: {
! 38552: open_region($macro,$state);
! 38553: }
! 38554: # A deff like macro
! 38555: if (defined($Texi2HTML::Config::def_map{$macro}))
! 38556: {
! 38557: my $top_format = top_format($stack);
! 38558: my $orig_command = $macro;
! 38559: if (defined($top_format) and ("$top_format->{'format'}x" eq $macro))
! 38560: {
! 38561: # this is a matching @DEFx command.
! 38562: # the @DEFx macro has been put at the top of the
! 38563: # command_stack, although there is no real format opening
! 38564: pop @{$state->{'command_stack'}};
! 38565: $macro =~ s/x$//o;
! 38566: #print STDERR "DEFx $macro\n";
! 38567: }
! 38568: else
! 38569: {
! 38570: # a new @def.
! 38571: $macro =~ s/x$//o;
! 38572: # we remove what is on the stack and put it back,
! 38573: # to make sure that it is the form without x.
! 38574: pop @{$state->{'command_stack'}};
! 38575: push @{$state->{'command_stack'}}, $macro;
! 38576: #print STDERR "DEF begin $macro\n";
! 38577: $top_format = { 'format' => $macro, 'text' => '', 'orig_format' =>$orig_command};
! 38578: push @$stack, $top_format;
! 38579: }
! 38580: #print STDERR "BEGIN_DEFF $macro\n";
! 38581: #dump_stack ($text, $stack, $state);
! 38582:
! 38583: my ($command, $style, $category, $name, $type, $class, $args_array, $args_type_array);
! 38584: ($command, $style, $category, $name, $type, $class, $line, $args_array, $args_type_array) = parse_def($macro, $line, $line_nr);
! 38585: my $class_name_texi = &$Texi2HTML::Config::definition_index_entry($name, $class, $style, $command);
! 38586:
! 38587: #print STDERR "AFTER parse_def $line";
! 38588: my @formatted_args = ();
! 38589: my $arguments = '';
! 38590: my %formatted_arguments = ();
! 38591: my @types = @$args_type_array;
! 38592: my $arg_nr = 0;
! 38593: my $previous_type;
! 38594: foreach my $arg (@$args_array)
! 38595: {
! 38596: $arg_nr++;
! 38597: my $type = shift @types;
! 38598: my $substitution_state = duplicate_formatting_state($state);
! 38599: # all @def* arguments are in code_style
! 38600: $substitution_state->{'code_style'}++;
! 38601: push @formatted_args, substitute_line($arg, sprintf(__("\@%s (argument nr %d)"), $macro, $arg_nr), $substitution_state, $line_nr);
! 38602: if (grep {$_ eq $type} ('param', 'paramtype', 'delimiter'))
! 38603: {
! 38604: $arguments .= $formatted_args[-1];
! 38605: }
! 38606: else
! 38607: {
! 38608: $formatted_arguments{$type} = $formatted_args[-1];
! 38609: }
! 38610:
! 38611: $previous_type = $type;
! 38612: }
! 38613: $name = $formatted_arguments{'name'};
! 38614: $category = $formatted_arguments{'category'};
! 38615: $type = $formatted_arguments{'type'};
! 38616: $class = $formatted_arguments{'class'};
! 38617:
! 38618: $name = '' if (!defined($name));
! 38619: $category = '' if (!defined($category));
! 38620:
! 38621: my $class_category = &$Texi2HTML::Config::definition_category($category, $class, $style, $command);
! 38622: my $class_name = &$Texi2HTML::Config::definition_index_entry($name, $class, $style, $command);
! 38623: my ($index_entry, $formatted_index_entry, $index_label) = do_index_entry_label($macro, $state, $line_nr, $class_name_texi, $line);
! 38624: add_prev($text, $stack, &$Texi2HTML::Config::def_line($class_category, $name, $type, $arguments, $index_label, \@formatted_args, $args_type_array, $args_array, $command, $class_name, $category, $class, $style, $orig_command));
! 38625: $line = '';
! 38626: push @$stack, { 'format' => 'deff_item', 'text' => '', 'only_inter_commands' => 1, 'format_ref' => $top_format, 'orig_command' => $orig_command};
! 38627: begin_paragraph_after_command($state, $stack, $macro, $line);
! 38628: }
! 38629: # FIXME $complex_format_map obsoleted in nov 2009
! 38630: elsif ((exists ($Texi2HTML::Config::complex_format_map->{$macro})
! 38631: or exists ($Texi2HTML::Config::complex_format_map{$macro}))
! 38632: and ($format_type{$macro} ne 'menu' or $Texi2HTML::Config::SIMPLE_MENU))
! 38633: { # handle menu if SIMPLE_MENU. see texi2html.init
! 38634: my $complex_format;
! 38635: if (exists ($Texi2HTML::Config::complex_format_map->{$macro}))
! 38636: {
! 38637: $complex_format = $Texi2HTML::Config::complex_format_map->{$macro};
! 38638: }
! 38639: else
! 38640: {
! 38641: $complex_format = $Texi2HTML::Config::complex_format_map{$macro};
! 38642: }
! 38643: my $format = { 'format' => $macro, 'text' => '', 'pre_style' => $complex_format->{'pre_style'} };
! 38644: push_complex_format_style($macro, $complex_format, $state, $line_nr);
! 38645: push @$stack, $format;
! 38646:
! 38647: begin_paragraph($stack, $state);
! 38648: }
! 38649: elsif ($Texi2HTML::Config::paragraph_style{$macro})
! 38650: {
! 38651:
! 38652: push (@$stack, { 'format' => $macro, 'text' => '' });
! 38653: begin_paragraph_after_command($state,$stack,$macro,$line) unless ($in_term);
! 38654: push @{$state->{'paragraph_style'}}, $macro;
! 38655: if ($macro eq 'center')
! 38656: {
! 38657: # @center may be in a weird state with regard with
! 38658: # nesting, so we put it on the bottom of the stack
! 38659: pop @{$state->{'command_stack'}};
! 38660: unshift @{$state->{'command_stack'}}, $macro;
! 38661: # for similar reasons, we may have a bad stack nesting
! 38662: # which results in } after a closing.
! 38663: # The following isn't really true anymore, I think: for example
! 38664: # @center @samp{something @center end of samp}
! 38665: # resulted to samp being kept in the 'command_stack'
! 38666:
! 38667: }
! 38668: }
! 38669: elsif ($format_type{$macro} eq 'list' or $format_type{$macro} eq 'table' or $macro eq 'multitable')
! 38670: {
! 38671: my $format;
! 38672: #print STDERR "LIST_TABLE $macro\n";
! 38673: #dump_stack($text, $stack, $state);
! 38674: if ($macro eq 'itemize' or $format_type{$macro} eq 'table')
! 38675: {
! 38676: my $command;
! 38677: my $prepended;
! 38678: ($prepended, $command) = parse_format_command($line,$macro);
! 38679: if (($command eq '') and ($macro ne 'itemize'))
! 38680: {
! 38681: $command = 'asis';
! 38682: line_error(sprintf(__("%s requires an argument: the formatter for %citem"), $macro, ord('@')), $line_nr);
! 38683: }
! 38684: my $prepended_formatted;
! 38685: $prepended_formatted = substitute_line($prepended, sprintf(__("prepended for \@%s"), $macro), prepare_state_multiple_pass('item', $state)) if (defined($prepended));
! 38686: $format = { 'format' => $macro, 'text' => '', 'command' => $command, 'prepended' => $prepended, 'prepended_formatted' => $prepended_formatted };
! 38687: $line = '';
! 38688: }
! 38689: elsif ($macro eq 'enumerate')
! 38690: {
! 38691: my $spec;
! 38692: ($line, $spec) = parse_enumerate ($line);
! 38693: $spec = 1 if (!defined($spec));
! 38694: $format = { 'format' => $macro, 'text' => '', 'spec' => $spec };
! 38695: }
! 38696: elsif ($macro eq 'multitable')
! 38697: {
! 38698: my ($max_columns, $fractions, $prototype_row) = parse_multitable ($line, $line_nr);
! 38699: if (!$max_columns)
! 38700: {
! 38701: line_warn (__("empty multitable"), $line_nr);
! 38702: $max_columns = 0;
! 38703: }
! 38704: my @prototype_lengths = ();
! 38705: if (defined($prototype_row))
! 38706: {
! 38707: my $prototype_nr = 0;
! 38708: foreach my $prototype (@$prototype_row)
! 38709: {
! 38710: $prototype_nr++;
! 38711: push @prototype_lengths, 2+Texi2HTML::Config::t2h_default_string_width(substitute_line($prototype, sprintf(__("\@columnfraction (argument nr %d)"), $prototype_nr), prepare_state_multiple_pass('columnfractions', $state)));
! 38712: }
! 38713: }
! 38714: $format = { 'format' => $macro, 'text' => '', 'max_columns' => $max_columns, 'columnfractions' => $fractions, 'prototype_row' => $prototype_row, 'prototype_lengths' => \@prototype_lengths, 'cell' => 1 };
! 38715: }
! 38716: $format->{'first'} = 1;
! 38717: $format->{'item_nr'} = 0;
! 38718: $format->{'paragraph_number'} = 0;
! 38719: push @$stack, $format;
! 38720: if ($format_type{$macro} eq 'table')
! 38721: {
! 38722: push @$stack, { 'format' => 'line', 'text' => '', 'format_ref' => $format, 'only_inter_commands' => 1};
! 38723: }
! 38724: elsif ($macro eq 'multitable')
! 38725: {
! 38726: push @$stack, { 'format' => 'row', 'text' => '', 'format_ref' => $format, 'item_cmd' => $macro };
! 38727: push @$stack, { 'format' => 'cell', 'text' => '', 'format_ref' => $format, 'only_inter_commands' => 1};
! 38728: }
! 38729: if ($format_type{$macro} eq 'list')
! 38730: {
! 38731: push @$stack, { 'format' => 'item', 'text' => '', 'format_ref' => $format, 'only_inter_commands' => 1};
! 38732: }
! 38733: begin_paragraph_after_command($state,$stack,$macro,$line)
! 38734: if ($macro ne 'multitable');
! 38735: return '' unless ($macro eq 'enumerate');
! 38736: }
! 38737: elsif ($macro eq 'float' or $format_type{$macro} eq 'quotation')
! 38738: {
! 38739: push @$stack, {'format' => $macro, 'text' => '' };
! 38740: if ($macro eq 'float')
! 38741: {
! 38742:
! 38743: my @args = parse_line_arguments($line, 2, "\@$macro");
! 38744: do_float_line ($macro, \@args, $state->{'style_stack'}, $state, $line_nr);
! 38745: }
! 38746: elsif ($format_type{$macro} eq 'quotation')
! 38747: {
! 38748: my @args = parse_line_arguments($line, 1, "\@$macro", $line_nr);
! 38749: do_quotation_line ($macro, $stack->[-1], \@args, $state->{'style_stack'}, $state, $line_nr);
! 38750:
! 38751: }
! 38752:
! 38753: $line = '';
! 38754: if ($state->{'preformatted'})
! 38755: { # inconditionally begin a preformatted section if needed
! 38756: begin_paragraph($stack, $state);
! 38757: }
! 38758: #dump_stack($text, $stack, $state);
! 38759: }
! 38760: # keep this one at the end as there are some other formats
! 38761: # which are also in format_map
! 38762: elsif (defined($Texi2HTML::Config::format_map{$macro}) or ($format_type{$macro} eq 'cartouche'))
! 38763: {
! 38764: push @$stack, { 'format' => $macro, 'text' => '' };
! 38765: $state->{'code_style'}++ if ($Texi2HTML::Config::format_code_style{$macro});
! 38766: begin_paragraph_after_command($state,$stack,$macro,$line);
! 38767: }
! 38768: elsif ($format_type{$macro} eq 'menu')
! 38769: {
! 38770: # if $Texi2HTML::Config::SIMPLE_MENU we won't get there
! 38771: # as the menu is a complex format in that case, so it
! 38772: # is handled above
! 38773: push @$stack, { 'format' => $macro, 'text' => '' };
! 38774: if ($state->{'preformatted'})
! 38775: {
! 38776: # add a fake complex style in order to have a given pre style
! 38777: push_complex_format_style('menu',
! 38778: $Texi2HTML::Config::MENU_PRE_COMPLEX_FORMAT, $state, $line_nr);
! 38779: begin_paragraph_after_command($state,$stack,$macro,$line);
! 38780: }
! 38781: else
! 38782: {
! 38783: begin_format($text, $stack, $state, 'menu_comment', $line, $line_nr);
! 38784: }
! 38785: }
! 38786: # this is useful for @center, and also if there was something on the
! 38787: # line after a format that isn't there anymore, like
! 38788: # @format @c
! 38789: # if @center line is empty we don't remove the end of line
! 38790: $line =~ s/^\s*// unless ($macro eq 'center' and $line =~ /^\s*$/);
! 38791: return $line;
! 38792: }
! 38793:
! 38794: sub do_text($;$)
! 38795: {
! 38796: my $text = shift;
! 38797: my $state = shift;
! 38798: return $text if ($state->{'keep_texi'});
! 38799: my $remove_texi = 1 if ($state->{'remove_texi'} and !$state->{'simple_format'});
! 38800: my $preformatted_style = 0;
! 38801: if ($state->{'preformatted'})
! 38802: {
! 38803: $preformatted_style = $state->{'preformatted_stack'}->[-1]->{'style'};
! 38804: }
! 38805: return (&$Texi2HTML::Config::normal_text($text, $remove_texi, $preformatted_style, $state->{'code_style'}, $state->{'math_style'}, $state->{'simple_format'},$state->{'command_stack'}, $state));
! 38806: }
! 38807:
! 38808: sub end_simple_format($$$)
! 38809: {
! 38810: my $command = shift;
! 38811: my $text = shift;
! 38812: my $state = shift;
! 38813:
! 38814: my $element = $Texi2HTML::Config::format_map{$command};
! 38815:
! 38816: my $result = &$Texi2HTML::Config::format($command, $element, $text);
! 38817: $state->{'code_style'}-- if ($Texi2HTML::Config::format_code_style{$command});
! 38818: return $result;
! 38819: }
! 38820:
! 38821: # only get there if not in SIMPLE_MENU and not in preformatted and
! 38822: # right in @menu
! 38823: sub close_menu_comment($$$$$)
! 38824: {
! 38825: my $text = shift;
! 38826: my $stack = shift;
! 38827: my $state = shift;
! 38828: my $reason = shift;
! 38829: my $line_nr = shift;
! 38830:
! 38831: my $top_format = top_stack($stack,2);
! 38832: if (defined($top_format->{'format'}) and $top_format->{'format'} eq 'menu_comment')
! 38833: { # this is needed to avoid empty menu-comments <tr>...<pre></pre>
! 38834: abort_empty_preformatted($stack, $state);
! 38835:
! 38836: close_paragraph($text, $stack, $state, $reason, $line_nr);
! 38837: end_format($text, $stack, $state, 'menu_comment', $line_nr);
! 38838: return 1;
! 38839: }
! 38840: }
! 38841:
! 38842: # never get there if in $SIMPLE_MENU
! 38843: # the last arg is used only if in description and an empty line may
! 38844: # stop it and begin a menu_comment
! 38845: sub close_menu_description($$$$$;$)
! 38846: {
! 38847: my $text = shift;
! 38848: my $stack = shift;
! 38849: my $state = shift;
! 38850: my $reason = shift;
! 38851: my $line_nr = shift;
! 38852: my $line = shift;
! 38853:
! 38854: my $top_format = top_stack($stack,1);
! 38855: if (!$state->{'preformatted'})
! 38856: {
! 38857: $top_format = top_stack($stack);
! 38858: }
! 38859:
! 38860: if (defined($top_format->{'format'}) and $top_format->{'format'} eq 'menu_description' and (!defined($line) or $line =~ /^\s*$/) )
! 38861: {
! 38862: close_paragraph($text, $stack, $state, $reason, $line_nr) if ($state->{'preformatted'});
! 38863: my $descr = pop(@$stack);
! 38864: add_prev($text, $stack, do_menu_description($descr, $state));
! 38865: print STDERR "# close_menu: close description\n" if ($T2H_DEBUG & $DEBUG_MENU);
! 38866: $state->{'code_style'}-- if ($Texi2HTML::Config::format_code_style{'menu_description'});
! 38867: return 1;
! 38868: }
! 38869: }
! 38870:
! 38871: # Format menu link
! 38872: # FIXME also pass node and name?
! 38873: sub do_menu_link($$$)
! 38874: {
! 38875: my $state = shift;
! 38876: my $line_nr = shift;
! 38877: my $menu_entry = shift;
! 38878:
! 38879: my $file = $state->{'element'}->{'file'};
! 38880: my $node_name = normalise_node($menu_entry->{'node'});
! 38881: # normalise_node is used in fact to determine if name is empty.
! 38882: # It is not passed down to the function reference.
! 38883: my $name = normalise_node($menu_entry->{'name'});
! 38884:
! 38885: # there is one substitution with spaces kept, and one with spaces
! 38886: # normalized. In every cases nodes are in code_style
! 38887: my $node_substitution_state = duplicate_formatting_state($state);
! 38888: my $name_substitution_state = duplicate_formatting_state($state);
! 38889: my $node_normalized_substitution_state = duplicate_formatting_state($state);
! 38890: $node_substitution_state->{'code_style'} = 1;
! 38891: $node_normalized_substitution_state->{'code_style'} = 1;
! 38892: $name_substitution_state->{'code_style'} = 1 if ($Texi2HTML::Config::format_code_style{'menu_name'});
! 38893: my $node_formatted = substitute_line($menu_entry->{'node'}, __("node name in menu"), $node_substitution_state, $line_nr);
! 38894: my $node_normalized_formatted = substitute_line($node_name, __("normalized node name in menu"), $node_normalized_substitution_state);
! 38895:
! 38896: my $name_formatted;
! 38897: my $has_name = 0;
! 38898: if (defined($name) and $name ne '')
! 38899: {
! 38900: $name_formatted = substitute_line($menu_entry->{'name'}, __("menu entry name"), $name_substitution_state, $line_nr);
! 38901: $has_name = 1;
! 38902: }
! 38903: else
! 38904: {
! 38905: my $node_as_name = $menu_entry->{'node'};
! 38906: $node_as_name =~ s/^\s*//;
! 38907: $name_formatted = substitute_line($node_as_name, __("node name in menu"), $name_substitution_state);
! 38908: }
! 38909:
! 38910: my $entry = '';
! 38911: my $href;
! 38912:
! 38913: my $element;
! 38914: if ($state->{'direntry'})
! 38915: {
! 38916: $href = do_external_href($node_name);
! 38917: }
! 38918: else
! 38919: {
! 38920: $element = $nodes{$node_name};
! 38921: }
! 38922:
! 38923: # menu points to an unknown node
! 38924: if (defined($element) and !$element->{'seen'})
! 38925: {
! 38926: if ($menu_entry->{'node'} =~ /^\s*\(.*\)/o or Texi2HTML::Config::get_conf('novalidate'))
! 38927: {
! 38928: # menu entry points to another info manual or invalid nodes
! 38929: # and novalidate is set
! 38930: #$href = $nodes{$node_name}->{'file'};
! 38931: $href = do_external_href($node_name);
! 38932: }
! 38933: else
! 38934: {
! 38935: line_error (sprintf(__("Menu reference to nonexistent node `%s'"), $node_name), $line_nr);
! 38936: # try to find an equivalent node
! 38937: my @equivalent_nodes = equivalent_nodes($node_name);
! 38938: my $node_seen;
! 38939: foreach my $equivalent_node (@equivalent_nodes)
! 38940: {
! 38941: if ($nodes{$equivalent_node}->{'seen'})
! 38942: {
! 38943: $node_seen = $equivalent_node;
! 38944: last;
! 38945: }
! 38946: }
! 38947: if (defined($node_seen))
! 38948: {
! 38949: document_warn("---> but equivalent node `$node_seen' found");
! 38950: $element = $nodes{$node_seen};
! 38951: }
! 38952: }
! 38953: }
! 38954:
! 38955: # the original node or an equivalent node was seen
! 38956: if (defined($element) and $element->{'seen'})
! 38957: {
! 38958: if ($element->{'reference_element'})
! 38959: {
! 38960: $element = $element->{'reference_element'};
! 38961: }
! 38962:
! 38963: #print STDERR "SUBHREF in menu for `$element->{'texi'}'\n";
! 38964: $href = href($element, $file, $line_nr);
! 38965: if (! $element->{'node'})
! 38966: {
! 38967: $entry = $element->{'text'}; # this is the section/node name
! 38968: $entry = "$Texi2HTML::Config::MENU_SYMBOL $entry" if (($entry ne '') and (!defined($element->{'number'}) or ($element->{'number'} =~ /^\s*$/)) and $Texi2HTML::Config::UNNUMBERED_SYMBOL_IN_MENU);
! 38969: }
! 38970: }
! 38971: # save the element used for the href for the description
! 38972: $menu_entry->{'menu_reference_element'} = $element;
! 38973:
! 38974: return &$Texi2HTML::Config::menu_link($entry, $state, $href, $node_formatted, $name_formatted, $menu_entry->{'ending'}, $has_name, $state->{'command_stack'}, $state->{'preformatted'}, $node_normalized_formatted);
! 38975: }
! 38976:
! 38977: sub do_menu_description($$)
! 38978: {
! 38979: my $descr = shift;
! 38980: my $state = shift;
! 38981: my $text = $descr->{'text'};
! 38982: my $menu_entry = $descr->{'menu_entry'};
! 38983:
! 38984: my $element = $menu_entry->{'menu_reference_element'};
! 38985:
! 38986: ############# debug
! 38987: # this is not a bug if element is not defined in direntry
! 38988: print STDERR "Bug: !defined(element) in do_menu_description\n" if (!defined($element) and ($state->{'menu'} or $state->{'detailmenu'}));
! 38989: ############# end debug
! 38990: my $element_text = '';
! 38991: $element_text = $element->{'text_nonumber'} if (defined($element));
! 38992:
! 38993: return &$Texi2HTML::Config::menu_description($text, duplicate_formatting_state($state),$element_text, $state->{'command_stack'}, $state->{'preformatted'});
! 38994: }
! 38995:
! 38996: sub do_xref($$$$)
! 38997: {
! 38998: my $macro = shift;
! 38999: my $args = shift;
! 39000: my $style_stack = shift;
! 39001: my $state = shift;
! 39002: my $line_nr = shift;
! 39003:
! 39004: my $result = '';
! 39005: my @args = @$args;
! 39006:
! 39007: my $j;
! 39008: for ($j = 0; $j <= $#$args; $j++)
! 39009: {
! 39010: $args[$j] = normalise_texi_space($args[$j]);
! 39011: # print STDERR " ($j)$args[$j]\n";
! 39012: }
! 39013: #print STDERR "DO_XREF: $macro\n";
! 39014: if ($macro eq 'inforef')
! 39015: {
! 39016: if ((@args < 1) or $args[0] eq '')
! 39017: {
! 39018: line_error (sprintf(__("First argument to \@%s may not be empty"), $macro), $line_nr);
! 39019: return '';
! 39020: }
! 39021: }
! 39022:
! 39023: my $node_texi = $args[0];
! 39024: $node_texi = normalise_node($node_texi);
! 39025:
! 39026: #print STDERR "XREF: (@args)\n";
! 39027: my $i;
! 39028: my $new_state = duplicate_formatting_state($state);
! 39029: $new_state->{'keep_texi'} = 0;
! 39030: $new_state->{'keep_nr'} = 0;
! 39031:
! 39032: my $remove_texi = $new_state->{'remove_texi'};
! 39033:
! 39034: my @formatted_args;
! 39035: for ($i = 0; $i < 5; $i++)
! 39036: {
! 39037: $args[$i] = '' if (!defined($args[$i]));
! 39038: my $in_file_style;
! 39039: $in_file_style = 1 if ($i == 2 and $macro eq 'inforef' or $i == 3 and $macro ne 'inforef');
! 39040: $new_state->{'code_style'}++ if ($in_file_style or $i == 0);
! 39041: $new_state->{'remove_texi'} = 1 if ($in_file_style);
! 39042: $formatted_args[$i] = substitute_line($args[$i], sprintf(__("\@%s (argument nr %d)"), $macro, $i), $new_state, $line_nr);
! 39043: $new_state->{'code_style'}-- if ($in_file_style or $i == 0);
! 39044: $new_state->{'remove_texi'} = $remove_texi if ($in_file_style);
! 39045: }
! 39046:
! 39047:
! 39048: my ($file_texi, $file);
! 39049: if ($macro eq 'inforef')
! 39050: {
! 39051: $file_texi = $args[2];
! 39052: $file = $formatted_args[2];
! 39053: }
! 39054: else
! 39055: {
! 39056: $file_texi = $args[3];
! 39057: $file = $formatted_args[3];
! 39058: }
! 39059: # Remark: makeinfo has this odd error message if the file is empty:
! 39060: # warning (_("Empty file name for HTML cross reference in `%s'")
! 39061: # This seems to be spurious.
! 39062:
! 39063: # can be an argument or extracted from the node name
! 39064: my $file_arg_or_node_texi = $file_texi;
! 39065: my $file_arg_or_node = $file;
! 39066:
! 39067: my $node_name;
! 39068: # the file in parenthesis is removed from node_without_file_texi if needed
! 39069: my $node_without_file_texi = $node_texi;
! 39070: # node with file, like (file)node
! 39071: my $node_and_file_texi;
! 39072: # the file in parenthesis present with the node
! 39073: my ($file_of_node_texi, $file_of_node);
! 39074: if ($node_without_file_texi =~ s/^\(([^\)]+)\)\s*//)
! 39075: {
! 39076: $file_of_node_texi = $1;
! 39077: $file_of_node = substitute_line($file_of_node_texi, sprintf(__p("\@*ref", "\@%s node file"), $macro), $new_state);
! 39078: $node_name = substitute_line($node_without_file_texi, sprintf(__p("\@*ref", "\@%s node name"), $macro), $new_state);
! 39079: $file_arg_or_node_texi = $file_of_node_texi if ($file_arg_or_node_texi eq '');
! 39080: $file_arg_or_node = $file_of_node if ($file_arg_or_node eq '');
! 39081: # the file argument takes precedence
! 39082: $node_and_file_texi = "($file_arg_or_node_texi)$node_without_file_texi";
! 39083: }
! 39084: else
! 39085: {
! 39086: # normalized node name
! 39087: $new_state->{'code_style'}++;
! 39088: $node_name = substitute_line($node_without_file_texi, sprintf(__p("\@*ref", "\@%s node name"), $macro), $new_state);
! 39089: $new_state->{'code_style'}--;
! 39090: if (defined ($file_texi) and $file_texi ne '')
! 39091: {
! 39092: $node_and_file_texi = "($file_texi)$node_texi";
! 39093: }
! 39094: }
! 39095:
! 39096: my $node_and_file;
! 39097: if (defined($node_and_file_texi))
! 39098: {
! 39099: $node_and_file = substitute_line($node_and_file_texi, sprintf(__p("\@*ref","\@%s node with file name"), $macro), $new_state);
! 39100: }
! 39101: else
! 39102: {
! 39103: $node_and_file_texi = $node_texi;
! 39104: $node_and_file = $node_name;
! 39105: }
! 39106:
! 39107: my $cross_ref_texi = $args[1];
! 39108: my $cross_ref = $formatted_args[1];
! 39109:
! 39110: my ($manual_texi, $section_texi, $manual, $section);
! 39111: if ($macro ne 'inforef')
! 39112: {
! 39113: $manual_texi = $args[4];
! 39114: $section_texi = $args[2];
! 39115: $manual = $formatted_args[4];
! 39116: $section = $formatted_args[2];
! 39117: }
! 39118: else
! 39119: {
! 39120: $manual = $section = '';
! 39121: }
! 39122:
! 39123: #print STDERR "XREF: (@args)\n";
! 39124:
! 39125: if (($macro eq 'inforef') or ($file_arg_or_node_texi ne '') or ($manual_texi ne ''))
! 39126: {# external ref
! 39127: my $href = '';
! 39128: if ($file_arg_or_node_texi ne '')
! 39129: {
! 39130: $href = do_external_href($node_and_file_texi);
! 39131: }
! 39132: else
! 39133: {
! 39134: $node_and_file = '';
! 39135: }
! 39136: #my $section_or_node = '';
! 39137: #if ($manual ne '')
! 39138: #{
! 39139: # $section_or_node = $node_name;
! 39140: # if ($section ne '')
! 39141: # {
! 39142: # $section_or_node = $section;
! 39143: # }
! 39144: #}
! 39145: #$result = &$Texi2HTML::Config::external_ref($macro, $section_or_node, $manual, $node_and_file, $href, $cross_ref, \@args, \@formatted_args);
! 39146: $result = &$Texi2HTML::Config::external_ref($macro, $section, $manual, $file_arg_or_node, $href, $cross_ref, \@args, \@formatted_args, $node_name);
! 39147: }
! 39148: else
! 39149: {
! 39150: my $element = $nodes{$node_without_file_texi};
! 39151: if ($element and $element->{'seen'})
! 39152: {
! 39153: if ($element->{'reference_element'})
! 39154: {
! 39155: $element = $element->{'reference_element'};
! 39156: }
! 39157: my $file = '';
! 39158: if (defined($state->{'element'}))
! 39159: {
! 39160: $file = $state->{'element'}->{'file'};
! 39161: }
! 39162: else
! 39163: {
! 39164: line_warn (sprintf(__("\@%s not in text (in anchor, node, section...)"), $macro), $line_nr);
! 39165: # if Texi2HTML::Config::SPLIT the file is '' which ensures
! 39166: # a href with the file name. if ! Texi2HTML::Config::SPLIT
! 39167: # the 2 file will be the same thus there won't be the file name
! 39168: $file = $element->{'file'} unless (Texi2HTML::Config::get_conf('SPLIT'));
! 39169: }
! 39170: #print STDERR "SUBHREF in ref to node `$node_texi'";
! 39171: my $href = href($element, $file, $line_nr);
! 39172: my $section_or_cross_ref = $section;
! 39173: $section_or_cross_ref = $cross_ref if ($section eq '');
! 39174: if ($element->{'float'} and $section_or_cross_ref eq '')
! 39175: {
! 39176: my $style = substitute_line(&$Texi2HTML::Config::listoffloats_float_style($element->{'style_texi'}, $element), __("\@listoffloats \@float type"));
! 39177: $section_or_cross_ref = $style if (defined($style));
! 39178: }
! 39179: my $name = $section_or_cross_ref;
! 39180: my $short_name = $section_or_cross_ref;
! 39181: if ($section_or_cross_ref eq '')
! 39182: {
! 39183: # FIXME maybe one should use 'text' instead of 'text_nonumber'
! 39184: # However the real fix would be to have an internal_ref call
! 39185: # with more informations
! 39186: $name = $element->{'text_nonumber'};
! 39187: $short_name = $node_name;
! 39188: }
! 39189: $result = &$Texi2HTML::Config::internal_ref ($macro, $href, $short_name, $name, $element->{'section'}, \@args, \@formatted_args, $element);
! 39190: }
! 39191: else
! 39192: {
! 39193: if (($node_texi eq '') or (! Texi2HTML::Config::get_conf('novalidate')))
! 39194: {
! 39195: line_error (sprintf(__("\@%s reference to nonexistent node `%s'"), $macro, $node_texi), $line_nr);
! 39196: my $text = '';
! 39197: for (my $i = 0; $i < @$args -1; $i++)
! 39198: {
! 39199: $text .= $args->[$i] .',';
! 39200: }
! 39201: $text .= $args->[-1];
! 39202: $result = "\@$macro"."{${text}}";
! 39203: }
! 39204: else
! 39205: {
! 39206: #$result = &$Texi2HTML::Config::external_ref($macro, '', '', $node_name, do_external_href($node_texi), $cross_ref, \@args, \@formatted_args);
! 39207: $result = &$Texi2HTML::Config::external_ref($macro, '', '', '', do_external_href($node_texi), $cross_ref, \@args, \@formatted_args, $node_name);
! 39208: }
! 39209: }
! 39210: }
! 39211: return $result;
! 39212: }
! 39213:
! 39214: sub do_acronym_like($$$$$)
! 39215: {
! 39216: my $command = shift;
! 39217: my $args = shift;
! 39218: my $acronym_texi = shift @$args;
! 39219: my $explanation = shift @$args;
! 39220: my $style_stack = shift;
! 39221: my $state = shift;
! 39222: my $line_nr = shift;
! 39223:
! 39224: my $explanation_lines;
! 39225: my $explanation_text;
! 39226: my $explanation_simple_format;
! 39227:
! 39228: if (defined($explanation))
! 39229: {
! 39230: $explanation = trim_around_spaces($explanation);
! 39231: $explanation = undef if ($explanation eq '');
! 39232: }
! 39233: $acronym_texi = trim_around_spaces($acronym_texi);
! 39234:
! 39235: return '' if ($acronym_texi eq '');
! 39236:
! 39237: my $with_explanation = 0;
! 39238: my $normalized_text = cross_manual_line(normalise_node($acronym_texi));
! 39239: if (defined($explanation))
! 39240: {
! 39241: $with_explanation = 1;
! 39242: $acronyms_like{$command}->{$normalized_text} = $explanation;
! 39243: }
! 39244: elsif (exists($acronyms_like{$command}->{$normalized_text}))
! 39245: {
! 39246: $explanation = $acronyms_like{$command}->{$normalized_text};
! 39247: }
! 39248:
! 39249: if (defined($explanation))
! 39250: {
! 39251: @$explanation_lines = map {$_ = $_."\n"} split (/\n/, $explanation);
! 39252: my $text = '';
! 39253: foreach my $line(@$explanation_lines)
! 39254: {
! 39255: $line .= ' ' if (chomp ($line));
! 39256: $text .= $line
! 39257: }
! 39258: $text =~ s/ $//;
! 39259: $explanation_simple_format = simple_format($state, [ $line_nr ], "simple_format \@$command explanation", $text);
! 39260: $explanation_text = substitute_line($text, sprintf(__p("\@abbr or \@acronym", "\@%s explanation"), $command), duplicate_formatting_state($state), $line_nr);
! 39261: }
! 39262: return &$Texi2HTML::Config::acronym_like($command, $acronym_texi, substitute_line($acronym_texi, "\@$command", duplicate_formatting_state($state), $line_nr),
! 39263: $with_explanation, $explanation_lines, $explanation_text, $explanation_simple_format);
! 39264: }
! 39265:
! 39266: sub do_caption_shortcaption($$$$$$)
! 39267: {
! 39268: my $command = shift;
! 39269: my $args = shift;
! 39270: my $text_texi = $args->[0];
! 39271: my $style_stack = shift;
! 39272: my $state = shift;
! 39273: my $line_nr = shift;
! 39274: my $kept_line_nrs = shift;
! 39275:
! 39276: if (!exists($state->{'float'}))
! 39277: {
! 39278: line_error(sprintf(__("\@%s not meaningful outside `\@float' environment"), $command), $line_nr);
! 39279: return '';
! 39280: }
! 39281: my $float = $state->{'float'};
! 39282: my @texi_lines = map {$_ = $_."\n"} split (/\n/, $text_texi);
! 39283: $float->{"${command}_texi"} = \@texi_lines;
! 39284: if (defined($kept_line_nrs))
! 39285: {
! 39286: $float->{"${command}_keep_line_nr"} = [ @$kept_line_nrs ];
! 39287: msg_debug ("Empty $kept_line_nrs", $line_nr) unless (@{$kept_line_nrs});
! 39288: }
! 39289: else
! 39290: {
! 39291: $float->{"${command}_keep_line_nr"} = [ $line_nr ];
! 39292: msg_debug("do_caption_shortcaption $command, $float, kept_line_nrs not defined", $line_nr);
! 39293: }
! 39294: #print STDERR "GGGGGGG @$kept_line_nrs\n";
! 39295: return &$Texi2HTML::Config::caption_shortcaption_command($command,
! 39296: substitute_text(prepare_state_multiple_pass($command, $state), $kept_line_nrs, "\@$command in do_caption_shortcaption", @texi_lines), \@texi_lines, $float);
! 39297: }
! 39298:
! 39299: # function called when a @float is encountered. Don't do any output
! 39300: # but prepare $state->{'float'}
! 39301: sub do_float_line($$$$$)
! 39302: {
! 39303: my $command = shift;
! 39304: my $args = shift;
! 39305: my $style_stack = shift;
! 39306: my $state = shift;
! 39307: my $line_nr = shift;
! 39308:
! 39309: my @args = @$args;
! 39310: my $style_texi = shift @args;
! 39311: my $label_texi = shift @args;
! 39312:
! 39313: $style_texi = undef if (defined($style_texi) and $style_texi=~/^\s*$/);
! 39314: $label_texi = undef if (defined($label_texi) and $label_texi=~/^\s*$/);
! 39315:
! 39316: $style_texi = normalise_texi_space($style_texi) if (defined($style_texi));
! 39317:
! 39318: if (defined($label_texi))
! 39319: { # the float is considered as a node as it may be a target for refs.
! 39320: # it was entered as a node in the pass_structure and the float
! 39321: # line was parsed at that time
! 39322: $state->{'float'} = $nodes{normalise_node($label_texi)};
! 39323: #msg_debug("float: $state->{'float'}, $state->{'float'}->{'texi'}", $line_nr);
! 39324: }
! 39325: else
! 39326: { # a float without label. It can't be the target for refs.
! 39327: $state->{'float'} = { 'float' => 1 };
! 39328: if (defined($style_texi))
! 39329: {
! 39330: $state->{'float'}->{'style_texi'} = $style_texi;
! 39331: $state->{'float'}->{'style_id'} =
! 39332: cross_manual_line($state->{'float'}->{'style_texi'});
! 39333: }
! 39334: #print STDERR "float: (no label) $state->{'float'}\n";
! 39335: }
! 39336: $state->{'float'}->{'style'} = substitute_line($state->{'float'}->{'style_texi'}, __("\@float style"), undef, $line_nr);
! 39337: return '';
! 39338: }
! 39339:
! 39340: sub do_quotation_line($$$$$$)
! 39341: {
! 39342: my $command = shift;
! 39343: my $format_ref = shift;
! 39344: my $args = shift;
! 39345: my @args = @$args;
! 39346: my $text_texi = shift @args;
! 39347: my $style_stack = shift;
! 39348: my $state = shift;
! 39349: my $line_nr = shift;
! 39350: my $text;
! 39351:
! 39352: $text_texi = undef if (defined($text_texi) and $text_texi=~ /^\s*$/);
! 39353: if (defined($text_texi))
! 39354: {
! 39355: $text_texi = trim_around_spaces($text_texi);
! 39356: $text = substitute_line($text_texi, sprintf(__p("\@*quotation", "\@%s argument"), $command), duplicate_formatting_state($state), $line_nr);
! 39357: #$text =~ s/\s*$//;
! 39358: }
! 39359: my $quotation_args = { 'text' => $text, 'text_texi' => $text_texi };
! 39360: push @{$state->{'quotation_stack'}}, $quotation_args;
! 39361: $format_ref->{'argument_text'} = $text;
! 39362: $format_ref->{'argument_texi'} = $text_texi;
! 39363: $state->{'prepend_text'} = &$Texi2HTML::Config::quotation_prepend_text($command, $text_texi);
! 39364: return '';
! 39365: }
! 39366:
! 39367: sub do_footnote($$$$$$)
! 39368: {
! 39369: my $command = shift;
! 39370: my $args = shift;
! 39371: my $text = $args->[0];
! 39372: my $style_stack = shift;
! 39373: my $doc_state = shift;
! 39374: my $line_nr = shift;
! 39375: my $kept_line_nrs = shift;
! 39376:
! 39377: $text .= "\n";
! 39378: $text = &$Texi2HTML::Config::footnote_texi($text, $doc_state, $style_stack)
! 39379: if (defined($Texi2HTML::Config::footnote_texi));
! 39380:
! 39381: my $foot_state = duplicate_state($doc_state);
! 39382: fill_state($foot_state);
! 39383: push @{$foot_state->{'command_stack'}}, 'footnote';
! 39384:
! 39385: push_state($foot_state);
! 39386:
! 39387: my ($foot_num, $relative_foot_num);
! 39388: my $special_place;
! 39389: if (!defined($foot_state->{'expansion'}) and !defined($foot_state->{'region'}))
! 39390: {
! 39391: $foot_num = \$global_foot_num;
! 39392: $relative_foot_num = \$global_relative_foot_num;
! 39393: }
! 39394: else
! 39395: {
! 39396: $special_place = $foot_state->{'expansion'};
! 39397: $special_place = $foot_state->{'region'} if (!defined($special_place));
! 39398: $foot_num = \$doc_state->{'foot_num'};
! 39399: $relative_foot_num = \$doc_state->{'relative_foot_num'};
! 39400: }
! 39401: $$foot_num++;
! 39402: $$relative_foot_num++;
! 39403:
! 39404: my $docid = "DOCF$$foot_num";
! 39405: my $footid = "FOOT$$foot_num";
! 39406: if (defined($special_place))
! 39407: {
! 39408: $docid = $target_prefix . $special_place . "_$docid";
! 39409: $footid = $target_prefix . $special_place . "_$footid";
! 39410: }
! 39411: my $from_file = $docu_doc;
! 39412: if ($doc_state->{'element'})
! 39413: {
! 39414: $from_file = $doc_state->{'element'}->{'file'};
! 39415: }
! 39416:
! 39417: if (Texi2HTML::Config::get_conf('footnotestyle') eq 'separate')
! 39418: {
! 39419: $foot_state->{'element'} = $footnote_element;
! 39420: }
! 39421:
! 39422: $foot_state->{'footnote_number_in_doc'} = $$foot_num;
! 39423: $foot_state->{'footnote_number_in_page'} = $$relative_foot_num;
! 39424: $foot_state->{'footnote_footnote_id'} = $footid;
! 39425: $foot_state->{'footnote_place_id'} = $docid;
! 39426: $foot_state->{'footnote_document_file'} = $from_file;
! 39427: $foot_state->{'footnote_footnote_file'} = $foot_state->{'element'}->{'file'};
! 39428: $foot_state->{'footnote_document_state'} = $doc_state;
! 39429:
! 39430: # FIXME use split_lines ? It seems to work like it is now ?
! 39431: msg_debug ("No line nnumbers in footnote", $line_nr) if (!defined($kept_line_nrs) or !@$kept_line_nrs);
! 39432: my @lines;
! 39433: if (defined($text))
! 39434: {
! 39435: @lines = substitute_text($foot_state, $kept_line_nrs, '@footnote', map {$_ = $_."\n"} split (/\n/, $text));
! 39436: }
! 39437: my ($foot_lines, $foot_label) = &$Texi2HTML::Config::foot_line_and_ref($$foot_num,
! 39438: $$relative_foot_num, $footid, $docid, $from_file, $foot_state->{'element'}->{'file'}, \@lines, $doc_state);
! 39439: if ($doc_state->{'outside_document'} or (defined($doc_state->{'multiple_pass'}) and $doc_state->{'multiple_pass'} > 0))
! 39440: {
! 39441: #print STDERR "multiple_pass $doc_state->{'multiple_pass'}, 'outside_document' $doc_state->{'outside_document'}\n";
! 39442: #print STDERR "REGION FOOTNOTE($$foot_num): $doc_state->{'region'} ($doc_state->{'region_pass'})\n";
! 39443: $region_initial_state{$doc_state->{'region'}}->{'footnotes'}->{$$foot_num}->{$doc_state->{'region_pass'}} = $foot_lines if (defined($doc_state->{'region'}));
! 39444: }
! 39445: else
! 39446: {
! 39447: #print STDERR "GLOBAL FOOTNOTE($$foot_num)\n";
! 39448: push(@foot_lines, @{$foot_lines});
! 39449: }
! 39450: pop_state();
! 39451: return $foot_label;
! 39452: }
! 39453:
! 39454: sub do_image($$$$$)
! 39455: {
! 39456: # replace images
! 39457: my $command = shift;
! 39458: my $args = shift;
! 39459: my $style_stack = shift;
! 39460: my $state = shift;
! 39461: my $line_nr = shift;
! 39462: my @args;
! 39463: foreach my $arg (@$args)
! 39464: {
! 39465: $arg = trim_around_spaces($arg) if (defined($arg));
! 39466: push @args, $arg;
! 39467: }
! 39468: my $base = substitute_line($args[0], __("\@image base name"),{'code_style' => 1, 'remove_texi' => 1});
! 39469: my $base_simple = substitute_line($args[0], __("\@image base name"), {'simple_format' => 1, 'code_style' => 1});
! 39470: if ($base eq '')
! 39471: {
! 39472: line_error ("\@image missing filename argument", $line_nr);
! 39473: return '';
! 39474: }
! 39475: $args[4] = '' if (!defined($args[4]));
! 39476: $args[3] = '' if (!defined($args[3]));
! 39477: my $image;
! 39478: my $extension = substitute_line($args[4], __("\@image extension"), {'code_style' => 1, 'remove_texi' => 1});
! 39479: my $extension_simple = substitute_line($args[4], __("\@image extension"), {'simple_format' => 1, 'code_style' => 1});
! 39480: my ($file_name, $image_name, $simple_file_name);
! 39481: my @file_locations;
! 39482: my @file_names = &$Texi2HTML::Config::image_files($base,$extension,$args[0],$args[4]);
! 39483: # $image = locate_include_file("$base.$args[4]") if ($args[4] ne '');
! 39484: foreach my $file (@file_names)
! 39485: {
! 39486: my $simple_file = substitute_line($file->[1], __("\@image file name"), {'simple_format' => 1, 'code_style' => 1});
! 39487: if ($image = locate_include_file($file->[0]))
! 39488: {
! 39489: if (!defined($file_name))
! 39490: {
! 39491: $file_name = $file->[0];
! 39492: $image_name = $image;
! 39493: $simple_file_name = $simple_file;
! 39494: }
! 39495: push @file_locations, [$file, $image, $simple_file];
! 39496: }
! 39497: else
! 39498: {
! 39499: push @file_locations, [$file, undef, $simple_file];
! 39500: }
! 39501: }
! 39502: $image_name = '' if (!defined($image_name));
! 39503: $simple_file_name = '' if (!defined($simple_file_name));
! 39504:
! 39505: my $alt;
! 39506: if ($args[3] =~ /\S/)
! 39507: {
! 39508: $alt = substitute_line($args[3], __("\@image alt text"), {'simple_format' => 1}, $line_nr);
! 39509: }
! 39510: return &$Texi2HTML::Config::image($path_to_working_dir . $image_name,
! 39511: $base,
! 39512: $state->{'preformatted'}, $file_name, $alt, $args[1], $args[2],
! 39513: $args[3], $extension, $path_to_working_dir, $image_name,
! 39514: $state->{'paragraph_context'}, \@file_locations, $base_simple,
! 39515: $extension_simple, $simple_file_name, $line_nr);
! 39516: }
! 39517:
! 39518: # usefull if we want to duplicate only the global state, nothing related with
! 39519: # formatting
! 39520: sub duplicate_state($)
! 39521: {
! 39522: my $state = shift;
! 39523: my $new_state = { 'element' => $state->{'element'},
! 39524: 'multiple_pass' => $state->{'multiple_pass'},
! 39525: 'region_pass' => $state->{'region_pass'},
! 39526: 'region' => $state->{'region'},
! 39527: 'expansion' => $state->{'expansion'},
! 39528: 'sec_num' => $state->{'sec_num'},
! 39529: 'outside_document' => $state->{'outside_document'},
! 39530: 'inside_document' => $state->{'inside_document'},
! 39531: 'duplicated' => 1
! 39532: };
! 39533: return $new_state;
! 39534: }
! 39535:
! 39536: # duplicate global and formatting state.
! 39537: sub duplicate_formatting_state($)
! 39538: {
! 39539: my $state = shift;
! 39540: my $new_state = duplicate_state($state);
! 39541:
! 39542: # Things passed here should be things that are not emptied/set to 0 by
! 39543: # any command. Also they shouldn't need anything to be on the
! 39544: # stack. This rules out paragraphs, for example.
! 39545: foreach my $format_key ('preformatted', 'code_style', 'keep_texi',
! 39546: 'keep_nr', 'preformatted_stack')
! 39547: {
! 39548: $new_state->{$format_key} = $state->{$format_key};
! 39549: }
! 39550: # this is needed for preformatted
! 39551: my $command_stack = $state->{'command_stack'};
! 39552: $command_stack = [] if (!defined($command_stack));
! 39553: $new_state->{'command_stack'} = [ @$command_stack ];
! 39554: $new_state->{'preformatted_context'} = {'stack_at_beginning' => [ @$command_stack ]};
! 39555: $new_state->{'code_style'} = 0 if (!defined($new_state->{'code_style'}));
! 39556: return $new_state;
! 39557: }
! 39558:
! 39559: sub expand_macro($$$$$)
! 39560: {
! 39561: my $name = shift;
! 39562: my $args = shift;
! 39563: my $end_line = shift;
! 39564: my $line_nr = shift;
! 39565: my $state = shift;
! 39566:
! 39567: # we dont expand macros when in ignored environment.
! 39568: return if ($state->{'ignored'});
! 39569:
! 39570: die "Bug end_line not defined" if (!defined($end_line));
! 39571:
! 39572: my $index = 0;
! 39573: foreach my $arg (@$args)
! 39574: { # expand @macros in arguments. It is complicated because we must be
! 39575: # carefull not to expand macros in @ignore section or the like, and
! 39576: # still keep every single piece of text (including the @ignore macros).
! 39577: $args->[$index] = substitute_text({'texi' => 1, 'arg_expansion' => 1}, undef, "expand_macro in $name", split_lines($arg));
! 39578: $index++;
! 39579: }
! 39580: # retrieve the macro definition
! 39581: my $macrobody = $macros->{$name}->{'body'};
! 39582: my $formal_args = $macros->{$name}->{'args'};
! 39583: my $args_index = $macros->{$name}->{'args_index'};
! 39584:
! 39585: my $i;
! 39586: for ($i=0; $i<=$#$formal_args; $i++)
! 39587: {
! 39588: $args->[$i] = "" unless (defined($args->[$i]));
! 39589: print STDERR "# arg($i): $args->[$i]\n" if ($T2H_DEBUG & $DEBUG_MACROS);
! 39590: }
! 39591: line_error (sprintf(__("Macro `%s' called with too many args"), $name), $line_nr) if (defined($args->[$i + 1]));
! 39592: my $result = '';
! 39593: while ($macrobody ne '')
! 39594: {
! 39595: if ($macrobody =~ s/^([^\\]*)\\//o)
! 39596: {
! 39597: $result .= $1 if defined($1);
! 39598: if ($macrobody =~ s/^\\//)
! 39599: {
! 39600: $result .= '\\';
! 39601: }
! 39602: elsif ($macrobody =~ s/^(\@end\sr?macro)$// or $macrobody =~ s/^(\@end\sr?macro\s)// or $macrobody =~ s/^(\@r?macro\s+\w+\s*.*)//)
! 39603: { # \ protect @end macro
! 39604: $result .= $1;
! 39605: }
! 39606: elsif ($macrobody =~ s/^([^\\]*)\\//)
! 39607: {
! 39608: my $arg = $1;
! 39609: if (defined($args_index->{$arg}))
! 39610: {
! 39611: $result .= $args->[$args_index->{$arg}];
! 39612: }
! 39613: else
! 39614: {
! 39615: line_error (sprintf(__("\\ in macro expansion followed `%s' instead of parameter name or \\"), $arg), $macros->{$name}->{'line_nr'});
! 39616: $result .= '\\' . $arg;
! 39617: }
! 39618: }
! 39619: next;
! 39620: }
! 39621: $result .= $macrobody;
! 39622: last;
! 39623: }
! 39624: my @result = split(/^/m, $result);
! 39625: # for a completly empty macro, $result = '', and the split leads
! 39626: # to an empty array, so add back an empty string
! 39627: @result = ('') if (!scalar(@result));
! 39628: # Add the result of the macro expansion back to the input_spool.
! 39629: # Set the macro name if in the outer macro
! 39630: if ($state->{'arg_expansion'})
! 39631: { # in that case we are in substitute_text for an arg
! 39632: unshift @{$state->{'spool'}}, (@result, $end_line);
! 39633: }
! 39634: else
! 39635: {
! 39636: #$result[-1].=$end_line;
! 39637: #foreach my $res (@result)
! 39638: #{
! 39639: # print STDERR "RESULT:$res";
! 39640: #}
! 39641: #print STDERR "#########end->$end_line";
! 39642: my $last_line = $result[-1];
! 39643: if (chomp($last_line))
! 39644: {
! 39645: push @result, $end_line;
! 39646: }
! 39647: else
! 39648: {
! 39649: $result[-1] .= $end_line;
! 39650: }
! 39651: unshift @{$state->{'input_spool'}->{'spool'}}, (@result); #, $end_line);
! 39652: $state->{'input_spool'}->{'macro'} = $name if ($state->{'input_spool'}->{'macro'} eq '');
! 39653: }
! 39654: if ($T2H_DEBUG & $DEBUG_MACROS)
! 39655: {
! 39656: print STDERR "# macro expansion result:\n";
! 39657: #print STDERR "$first_line";
! 39658: foreach my $line (@result)
! 39659: {
! 39660: print STDERR "$line";
! 39661: }
! 39662: print STDERR "# macro expansion result end\n";
! 39663: }
! 39664: }
! 39665:
! 39666: sub do_index_summary_file($$)
! 39667: {
! 39668: my $name = shift;
! 39669: my $docu_name = shift;
! 39670: &$Texi2HTML::Config::index_summary_file_begin ($name, $printed_indices{$name}, $docu_name);
! 39671: print STDERR "# writing $name index summary for $docu_name\n" if $T2H_VERBOSE;
! 39672:
! 39673: foreach my $letter_entries (@{$Texi2HTML::THISDOC{'index_letters_array'}->{$name}})
! 39674: {
! 39675: foreach my $entry (@{$letter_entries->{'entries'}})
! 39676: {
! 39677: #my $entry = $entries->{$key};
! 39678: my $indexed_element = $entry->{'element'};
! 39679: my $entry_element = $indexed_element;
! 39680: $entry_element = $entry_element->{'element_ref'} if (defined($entry_element->{'element_ref'}));
! 39681: my $origin_href = $entry->{'file'};
! 39682: #print STDERR "$entry $entry->{'entry'}, real elem $indexed_element->{'texi'}, section $entry_element->{'texi'}, real $indexed_element->{'file'}, entry file $entry->{'file'}\n";
! 39683: if ($entry->{'target'})
! 39684: {
! 39685: $origin_href .= '#' . $entry->{'target'};
! 39686: }
! 39687: else
! 39688: {
! 39689: $origin_href .= '#' . $indexed_element->{'target'};
! 39690: }
! 39691: &$Texi2HTML::Config::index_summary_file_entry ($name,
! 39692: $entry->{'key'}, $origin_href,
! 39693: substitute_line($entry->{'entry'}, "\@$entry->{'command'}"), $entry->{'entry'},
! 39694: href($entry_element, ''),
! 39695: $entry_element->{'text'},
! 39696: $printed_indices{$name},
! 39697: $docu_name);
! 39698: }
! 39699: }
! 39700: &$Texi2HTML::Config::index_summary_file_end ($name, $printed_indices{$name}, $docu_name);
! 39701: }
! 39702:
! 39703: sub get_index_entry_infos($$;$)
! 39704: {
! 39705: my $entry = shift;
! 39706: my $element = shift;
! 39707: my $line_nr = shift;
! 39708: my $index_heading_element = $entry->{'element'};
! 39709: my $entry_heading_element = $index_heading_element;
! 39710: my $real_index_element = $entry->{'real_element'};
! 39711:
! 39712: if (!defined($entry->{'real_element'}))
! 39713: {
! 39714: print STDERR "BUG: entry->{'real_element'} not defined\n";
! 39715: }
! 39716: # we always use the associated element_ref, instead of the original
! 39717: # element
! 39718: $entry_heading_element = $entry_heading_element->{'element_ref'}
! 39719: if (defined($entry_heading_element->{'element_ref'}));
! 39720: if ($entry->{'real_element'} eq $element_before_anything)
! 39721: {
! 39722: $real_index_element = $element_top;
! 39723: }
! 39724: else
! 39725: {
! 39726: $real_index_element = $entry->{'real_element'}->{'element_ref'};
! 39727: if (!defined($real_index_element))
! 39728: { # happens when $USE_NODES = 0 and there are only sections,
! 39729: # and vice-versa
! 39730: $real_index_element = $entry->{'real_element'};
! 39731: }
! 39732: }
! 39733:
! 39734: my $origin_href = '';
! 39735: print STDERR "BUG: entry->{'file'} not defined for `$entry->{'entry'}'\n"
! 39736: if (!defined($entry->{'file'}));
! 39737: print STDERR "BUG: element->{'file'} not defined for `$entry->{'entry'}', `$element->{'texi'}'\n"
! 39738: if (!defined($element->{'file'}));
! 39739: $origin_href = $entry->{'file'} if ($entry->{'file'} ne $element->{'file'});
! 39740: #print STDERR "$entry $entry->{'entry'}, real heading elem $index_heading_element->{'texi'}, section $entry_element->{'texi'}, real $index_heading_element->{'file'}, entry file $entry->{'file'}\n";
! 39741: if (defined($entry->{'target'}))
! 39742: {
! 39743: $origin_href .= '#' . $entry->{'target'};
! 39744: }
! 39745: else
! 39746: { # this means that the index entry is in a special region like @copying...
! 39747: $origin_href .= '#' . $index_heading_element->{'target'};
! 39748: }
! 39749: #print STDERR "SUBHREF in index entry `$entry->{'entry'}' for `$entry_element->{'texi'}'\n";
! 39750: return ($origin_href,
! 39751: $entry->{'file'},
! 39752: $element->{'file'},
! 39753: $entry->{'target'},
! 39754: $index_heading_element->{'target'},
! 39755: substitute_line($entry->{'entry'}, "\@$entry->{'command'} index infos"),
! 39756: href($entry_heading_element, $element->{'file'}, $line_nr),
! 39757: $entry_heading_element->{'text'},
! 39758: (!$entry->{'seen_in_output'} and defined($entry->{'region'})));
! 39759: }
! 39760:
! 39761: # remove texi commands, replacing with what seems adequate. see simple_map_texi
! 39762: # and texi_map.
! 39763: # Doesn't protect html
! 39764: sub remove_texi(@)
! 39765: {
! 39766: return substitute_text ({ 'remove_texi' => 1}, undef, undef, @_);
! 39767: }
! 39768:
! 39769: # Same as remove texi but protect text and use special maps for @-commands
! 39770: sub simple_format($$$@)
! 39771: {
! 39772: my $state = shift;
! 39773: my $line_nrs = shift;
! 39774: my $context = shift;
! 39775: if (!defined($state))
! 39776: {
! 39777: $state = {};
! 39778: }
! 39779: else
! 39780: {
! 39781: $state = duplicate_formatting_state($state);
! 39782: }
! 39783: $state->{'remove_texi'} = 1;
! 39784: $state->{'simple_format'} = 1;
! 39785: $::simple_map_texi_ref = \%Texi2HTML::Config::simple_format_simple_map_texi;
! 39786: $::style_map_texi_ref = \%Texi2HTML::Config::simple_format_style_map_texi;
! 39787: $::texi_map_ref = \%Texi2HTML::Config::simple_format_texi_map;
! 39788: my $text = substitute_text($state, $line_nrs, $context, @_);
! 39789: $::simple_map_texi_ref = \%Texi2HTML::Config::simple_map_texi;
! 39790: $::style_map_texi_ref = \%Texi2HTML::Config::style_map_texi;
! 39791: $::texi_map_ref = \%Texi2HTML::Config::texi_map;
! 39792: return $text;
! 39793: }
! 39794:
! 39795: sub index_entry_command_prefix($$$)
! 39796: {
! 39797: my $command = shift;
! 39798: my $line = shift;
! 39799: my $line_nr = shift;
! 39800: if ($command =~ /^(v|f)table$/)
! 39801: {
! 39802: return $1;
! 39803: }
! 39804: elsif (defined($Texi2HTML::Config::def_map{$command}))
! 39805: {
! 39806: my ($prefix, $entry, $argument) = get_deff_index($command, $line, undef, 0);
! 39807: return $prefix;
! 39808: }
! 39809: my $prefix = index_command_prefix($command);
! 39810: line_error(sprintf(__("No index prefix found for \@%s"),$command),$line_nr) if ($prefix eq '');
! 39811: return $prefix;
! 39812: }
! 39813:
! 39814: sub enter_table_index_entry($$$$)
! 39815: {
! 39816: my $text = shift;
! 39817: my $stack = shift;
! 39818: my $state = shift;
! 39819: my $line_nr = shift;
! 39820: if ($state->{'item'})
! 39821: {
! 39822: my $item_command = $state->{'item'};
! 39823: delete $state->{'item'};
! 39824: my $item = pop @$stack;
! 39825: if ($state->{'table_stack'}->[-1] =~ /^(v|f)table$/)
! 39826: {
! 39827: my $index = $1;
! 39828: enter_index_entry($index, $line_nr,
! 39829: $item->{'text'}, $state->{'table_stack'}->[-1], $state);
! 39830: }
! 39831: add_prev($text, $stack, "\@$item_command" . $item->{'text'});
! 39832: }
! 39833: }
! 39834:
! 39835: sub end_macro($$$)
! 39836: {
! 39837: my $state = shift;
! 39838: my $end_string = shift;
! 39839: my $remaining_on_the_line = shift;
! 39840:
! 39841: $state->{'macro_inside'}--;
! 39842: return (0, undef) if ($state->{'ignored'});
! 39843: if ($state->{'macro_inside'})
! 39844: {
! 39845: $state->{'macro'}->{'body'} .= $end_string;
! 39846: return (0, undef);
! 39847: }
! 39848: my $macro_text = $state->{'macro'}->{'header'} . $state->{'macro'}->{'body'}.$end_string;
! 39849: chomp $state->{'macro'}->{'body'};
! 39850: print STDERR "# end macro def. Body:\n$state->{'macro'}->{'body'}"
! 39851: if ($T2H_DEBUG & $DEBUG_MACROS);
! 39852: $macros->{$state->{'macro'}->{'name'}} = $state->{'macro'} unless ($state->{'arg_expansion'});
! 39853: delete $state->{'macro'};
! 39854: return (1, $macro_text.$remaining_on_the_line) if ($remaining_on_the_line =~ /^\s*$/);
! 39855: return (0, $macro_text);
! 39856: }
! 39857:
! 39858: sub close_macro_arg($$$)
! 39859: {
! 39860: my $state = shift;
! 39861: my $current_line = shift;
! 39862: my $line_nr = shift;
! 39863:
! 39864: # balanced } ends the macro call, otherwise it is in the arg
! 39865: $state->{'macro_depth'}--;
! 39866: if ($state->{'macro_depth'} == 0)
! 39867: {
! 39868: #print STDERR "BEFORE: $current_line";
! 39869: print STDERR "# expanding macro $state->{'macro_name'}\n" if ($T2H_DEBUG & $DEBUG_MACROS);
! 39870: #$current_line =
! 39871: expand_macro($state->{'macro_name'}, $state->{'macro_args'}, $current_line, $line_nr, $state);
! 39872: delete $state->{'macro_name'};
! 39873: delete $state->{'macro_depth'};
! 39874: delete $state->{'macro_args'};
! 39875: #print STDERR "AFTER: $current_line";
! 39876: #return $current_line;
! 39877: return 1;
! 39878: }
! 39879: else
! 39880: {
! 39881: print STDERR "# macro call: closing }\n" if ($T2H_DEBUG & $DEBUG_MACROS);
! 39882: add_text('}', \$state->{'macro_args'}->[-1]);
! 39883: return undef;
! 39884: }
! 39885: }
! 39886:
! 39887: sub close_style_texi($$$$;$)
! 39888: {
! 39889: my $style = shift;
! 39890: my $text = shift;
! 39891: my $stack = shift;
! 39892: my $state = shift;
! 39893: my $no_close = shift;
! 39894:
! 39895: $no_close = 0 if (!defined($no_close));
! 39896:
! 39897: my $result;
! 39898: if (!defined($style->{'style'}))
! 39899: {
! 39900: msg_debug("'style' not defined in close_style_texi ($no_close)");
! 39901: foreach my $key (keys(%$style))
! 39902: {
! 39903: print STDERR " --> $key: ".var_to_str($style->{$key})."\n";
! 39904: }
! 39905: }
! 39906:
! 39907: if (($style->{'style'} ne '') and exists($info_enclose{$style->{'style'}}) and !$state->{'arg_expansion'})
! 39908: {
! 39909: $result = $info_enclose{$style->{'style'}}->[0] . $style->{'text'} . $info_enclose{$style->{'style'}}->[1];
! 39910: }
! 39911: elsif ($style->{'style'} ne '')
! 39912: {
! 39913: $result = '@' . $style->{'style'} . '{' . $style->{'text'};
! 39914: $result .= '}' unless ($no_close);
! 39915: }
! 39916: else
! 39917: {
! 39918: $result = '{' . $style->{'text'};
! 39919: # don't close { if we are closing stack as we are not
! 39920: # sure this is a { ... } construct. i.e. we are
! 39921: # not sure that the user properly closed the matching
! 39922: # brace, so we don't close it ourselves
! 39923: $result .= '}' unless ($no_close or $state->{'arg_expansion'});
! 39924: }
! 39925: if ($state->{'ignored'})
! 39926: {# ARG_EXPANSION
! 39927: print STDERR "# Popped `$style->{'style'}' in ifset/ifclear\n" if ($T2H_DEBUG);
! 39928: }
! 39929: else
! 39930: {
! 39931: add_prev ($text, $stack, $result);
! 39932: }
! 39933: }
! 39934:
! 39935: sub close_ignored ($$)
! 39936: {
! 39937: my $state = shift;
! 39938: my $stack = shift;
! 39939: if (($state->{'ifvalue_inside'}) and $state->{'ignored'} eq $state->{'ifvalue'})
! 39940: {
! 39941: if ($state->{'ifvalue_inside'} == 1)
! 39942: {# closing still opened @-commands with braces
! 39943: pop (@$stack) while (@$stack and $stack->[-1]->{'style'} ne 'ifvalue')
! 39944: }
! 39945: pop (@$stack);
! 39946: $state->{'ifvalue_inside'}--;
! 39947: }
! 39948: $state->{'ignored'} = undef;
! 39949: delete $state->{'ignored'};
! 39950: # We are stil in the ignored ifset or ifclear section
! 39951: $state->{'ignored'} = $state->{'ifvalue'} if ($state->{'ifvalue_inside'});
! 39952: #dump_stack($text, $stack, $state);
! 39953: }
! 39954:
! 39955:
! 39956: # Called in 2 contexts:
! 39957: # * in main document
! 39958: # * from substitute_text, called in turn from arg_expansion. In that case
! 39959: # 'texi' is true, and so is 'arg_expansion'. In that case constructs are
! 39960: # expanded but no action is performed. Therefore $line_nr is not of use.
! 39961: sub scan_texi($$$$;$)
! 39962: {
! 39963: my $scanned_line = shift;
! 39964: my $text = shift;
! 39965: my $stack = shift;
! 39966: my $state = shift;
! 39967: my $line_nr = shift;
! 39968:
! 39969: die "stack not an array ref" unless (ref($stack) eq "ARRAY");
! 39970: my $cline = $scanned_line;
! 39971:
! 39972: while(1)
! 39973: {
! 39974: # scan_texi
! 39975: #print STDERR "WHILE(t):$cline";
! 39976: #print STDERR "ARG_EXPANSION: $state->{'arg_expansion'}\n" if ($state->{'arg_expansion'});
! 39977: #dump_stack($text, $stack, $state);
! 39978: #print STDERR "ifvalue_inside $state->{'ifvalue_inside'}\n";
! 39979:
! 39980:
! 39981: # first we handle special cases:
! 39982: # macro definition: $state->{'macro_inside'}
! 39983: # macro arguments: $state->{'macro_name'}
! 39984: # raw format: $state->{'raw'}
! 39985: # @verb: $state->{'verb'}
! 39986: # ignored: $state->{'ignored'}
! 39987: # and then the remaining text/macros.
! 39988:
! 39989: # in macro definition
! 39990: if ($state->{'macro_inside'})
! 39991: {
! 39992: if ($cline =~ s/^([^\\\@]*\\)//)
! 39993: {# protected character or @end macro
! 39994: $state->{'macro'}->{'body'} .= $1 unless ($state->{'ignored'});
! 39995: if ($cline =~ s/^\\//)
! 39996: {
! 39997: $state->{'macro'}->{'body'} .= '\\' unless ($state->{'ignored'});
! 39998: next;
! 39999: }
! 40000: # I believe it is correct, although makeinfo don't do that.
! 40001: elsif ($cline =~ s/^(\@end\sr?macro)$//o or $cline =~ s/^(\@end\sr?macro\s)//o
! 40002: or $cline =~ s/^(\@r?macro\s+\w+\s*.*)//o)
! 40003: {
! 40004: $state->{'macro'}->{'body'} .= $1 unless ($state->{'ignored'});
! 40005: next;
! 40006: }
! 40007: }
! 40008: #if ($cline =~ s/^(.*?)\@end\sr?macro$//o or $cline =~ s/^(.*?)\@end\sr?macro\s+//o)
! 40009: if ($cline =~ s/^(\@end\sr?macro)$//o or $cline =~ s/^(\@end\sr?macro\s+)//o)
! 40010: {
! 40011: my ($no_remaining, $result) = end_macro($state, $1, $cline);
! 40012: add_prev ($text, $stack, $result) if (defined($result));
! 40013: return 1 if ($no_remaining);
! 40014: next;
! 40015: }
! 40016:
! 40017: elsif($cline =~ /^(\@r?macro\s+\w+\s*.*)/)
! 40018: {
! 40019: $state->{'macro'}->{'body'} .= $cline unless ($state->{'ignored'});
! 40020: $state->{'macro_inside'}++;
! 40021: #return;
! 40022: return 1;
! 40023: }
! 40024: elsif ($cline =~ s/^\@(.)//)
! 40025: {
! 40026: $state->{'macro'}->{'body'} .= '@' . $1 unless ($state->{'ignored'});
! 40027: next;
! 40028: }
! 40029: elsif ($cline =~ s/^\@//)
! 40030: {
! 40031: $state->{'macro'}->{'body'} .= '@' unless ($state->{'ignored'});
! 40032: next;
! 40033: }
! 40034: else
! 40035: {
! 40036: $cline =~ s/([^\@\\]*)//;
! 40037: if ($state->{'ignored'})
! 40038: {
! 40039: return if ($cline =~ /^$/);
! 40040: next;
! 40041: }
! 40042: $state->{'macro'}->{'body'} .= $1 if (defined($1));
! 40043: if ($cline =~ /^$/)
! 40044: {
! 40045: $state->{'macro'}->{'body'} .= $cline;
! 40046: #return;
! 40047: return 1;
! 40048: }
! 40049: next;
! 40050: }
! 40051: }
! 40052: # in macro arguments parsing/expansion. Here \ { } and , if this is a
! 40053: # multi args macro have a signification, the remaining is passed
! 40054: # unmodified
! 40055: if (defined($state->{'macro_name'}))
! 40056: {
! 40057: my $special_chars = quotemeta ('\{}');
! 40058: my $multi_args = 0;
! 40059: my $formal_args = $macros->{$state->{'macro_name'}}->{'args'};
! 40060: $multi_args = 1 if ($#$formal_args >= 1);
! 40061: $special_chars .= quotemeta(',') if ($multi_args);
! 40062: if ($state->{'macro_args'}->[-1] eq '')
! 40063: {# remove space at the very beginning
! 40064: $cline =~ s/^\s*//o;
! 40065: }
! 40066: if ($cline =~ s/^([^$special_chars]*)([$special_chars])//)
! 40067: {
! 40068: $state->{'macro_args'}->[-1] .= $1 if defined($1);
! 40069: # \ protects any character in macro arguments
! 40070: if ($2 eq '\\')
! 40071: {
! 40072: print STDERR "# macro call: protected char\n" if ($T2H_DEBUG & $DEBUG_MACROS);
! 40073: if ($cline =~ s/^(.)//)
! 40074: {
! 40075: $state->{'macro_args'}->[-1] .= $1;
! 40076: }
! 40077: else
! 40078: {
! 40079: $state->{'macro_args'}->[-1] .= '\\';
! 40080: }
! 40081: }
! 40082: elsif ($2 eq ',')
! 40083: { # in texinfo 4.8.90 a comma in braces is protected
! 40084: if ($state->{'macro_depth'} > 1)
! 40085: {
! 40086: $state->{'macro_args'}->[-1] .= ',';
! 40087: }
! 40088: else
! 40089: { # separate args
! 40090: print STDERR "# macro call: new arg\n" if ($T2H_DEBUG & $DEBUG_MACROS);
! 40091: $cline =~ s/^\s*//o;
! 40092: push @{$state->{'macro_args'}}, '';
! 40093: }
! 40094: }
! 40095: elsif ($2 eq '}')
! 40096: {
! 40097: #my $macro_result_line = close_macro_arg($state, $cline);
! 40098: return if (close_macro_arg($state, $cline, $line_nr));
! 40099: #if (defined($macro_result_line))
! 40100: #{
! 40101: # $cline = $macro_result_line;
! 40102: # return;
! 40103: #}
! 40104: }
! 40105: elsif ($2 eq '{')
! 40106: {
! 40107: print STDERR "# macro call: opening {\n" if ($T2H_DEBUG & $DEBUG_MACROS);
! 40108: $state->{'macro_depth'}++;
! 40109: add_text('{', \$state->{'macro_args'}->[-1]);
! 40110: }
! 40111: next;
! 40112: }
! 40113: print STDERR "# macro call: end of line\n" if ($T2H_DEBUG & $DEBUG_MACROS);
! 40114: $state->{'macro_args'}->[-1] .= $cline;
! 40115: return;
! 40116: }
! 40117: # in a raw format, verbatim, tex or html
! 40118: if ($state->{'raw'})
! 40119: {
! 40120: my $tag = $state->{'raw'};
! 40121:
! 40122: # debugging
! 40123: if (! @$stack or ($stack->[-1]->{'style'} ne $tag))
! 40124: {
! 40125: print STDERR "Bug: raw or special: $tag but not on top of stack\n";
! 40126: print STDERR "line: $cline";
! 40127: dump_stack($text, $stack, $state);
! 40128: exit 1;
! 40129: }
! 40130:
! 40131: # macro_regexp
! 40132: if ($cline =~ /^(.*?)\@end\s([a-zA-Z][\w-]*)/o and ($2 eq $tag))
! 40133: {
! 40134: $cline =~ s/^(.*?)(\@end\s$tag)//;
! 40135: # we add it even if 'ignored', it'll be discarded just below
! 40136: # with the @end
! 40137: add_prev ($text, $stack, $1);
! 40138: my $end = $2;
! 40139: my $style = pop @$stack;
! 40140: # if 'arg_expansion' and 'ignored' are both true text
! 40141: # is ignored.
! 40142: add_prev ($text, $stack, $style->{'text'} . $end) unless ($state->{'ignored'});
! 40143: delete $state->{'raw'};
! 40144: next;
! 40145: }
! 40146: else
! 40147: {# we add it even if 'ignored', it'll be discarded when there is
! 40148: # the @end
! 40149: add_prev ($text, $stack, $cline);
! 40150: last;
! 40151: }
! 40152: }
! 40153:
! 40154: # in a @verb{ .. } macro
! 40155: if (defined($state->{'verb'}))
! 40156: {
! 40157: #dump_stack($text, $stack, $state);
! 40158: my $char = quotemeta($state->{'verb'});
! 40159: #print STDERR "VERB $char\n";
! 40160: if ($cline =~ s/^(.*?)$char\}/\}/)
! 40161: {# we add it even if 'ignored', it'll be discarded when closing
! 40162: add_prev($text, $stack, $1 . $state->{'verb'});
! 40163: $stack->[-1]->{'text'} = $state->{'verb'} . $stack->[-1]->{'text'};
! 40164: delete $state->{'verb'};
! 40165: next;
! 40166: }
! 40167: else
! 40168: {# we add it even if 'ignored', it'll be discarded when closing
! 40169: add_prev($text, $stack, $cline);
! 40170: last;
! 40171: }
! 40172: }
! 40173: # In ignored region
! 40174: if ($state->{'ignored'})
! 40175: {
! 40176: #print STDERR "IGNORED(ifvalue($state->{'ifvalue_inside'})): $state->{'ignored'}\n";
! 40177: if ($cline =~ /^.*?\@end(\s+)([a-zA-Z]\w+)/)
! 40178: {
! 40179: if ($2 eq $state->{'ignored'})
! 40180: {
! 40181: $cline =~ s/^(.*?\@end)(\s+)([a-zA-Z]\w+)//;
! 40182: my $end_ignore = $1.$2.$3;
! 40183: close_ignored($state, $stack);
! 40184: #dump_stack($text, $stack, $state);
! 40185: # MACRO_ARG => keep ignored text
! 40186: if ($state->{'arg_expansion'})
! 40187: {# this may not be very usefull as it'll be remove later
! 40188: add_prev ($text, $stack, $end_ignore);
! 40189: next;
! 40190: }
! 40191: return if ($cline =~ /^\s*$/o);
! 40192: next;
! 40193: }
! 40194: }
! 40195: add_prev ($text, $stack, $cline) if ($state->{'arg_expansion'});
! 40196: # we could theoretically continue for ignored commands other
! 40197: # than ifset or ifclear, however it isn't usefull.
! 40198: return unless ($state->{'ifvalue_inside'} and ($state->{'ignored'} eq $state->{'ifvalue'}));
! 40199: }
! 40200:
! 40201:
! 40202: # an @end tag
! 40203: # macro_regexp
! 40204: if ($cline =~ s/^([^{}@]*)\@end(\s+)([a-zA-Z][\w-]*)//)
! 40205: {
! 40206: my $leading_text = $1;
! 40207: my $space = $2;
! 40208: my $end_tag = $3;
! 40209: # when 'ignored' we don't open environments that aren't associated
! 40210: # with ignored regions, so we don't need to close them.
! 40211: next if ($state->{'ignored'});# ARG_EXPANSION
! 40212: add_prev($text, $stack, $leading_text);
! 40213: if (defined($state->{'text_macro_stack'})
! 40214: and @{$state->{'text_macro_stack'}}
! 40215: and ($end_tag eq $state->{'text_macro_stack'}->[-1]))
! 40216: {
! 40217: pop @{$state->{'text_macro_stack'}};
! 40218: # we keep menu and titlepage for the following pass
! 40219: if (($Texi2HTML::Config::texi_formats_map{$end_tag} eq 'normal') or ($region_lines{$end_tag}) or $state->{'arg_expansion'})
! 40220: {
! 40221: add_prev($text, $stack, "\@end${space}$end_tag");
! 40222: }
! 40223: else
! 40224: {
! 40225: #print STDERR "End $end_tag\n";
! 40226: #dump_stack($text, $stack, $state);
! 40227: return if ($cline =~ /^\s*$/);
! 40228: }
! 40229: }
! 40230: elsif ($Texi2HTML::Config::texi_formats_map{$end_tag})
! 40231: {
! 40232: line_error (sprintf(__("Unmatched `%c%s'"), ord('@'), 'end'), $line_nr);
! 40233: }
! 40234: else # a format that is not handled during the first pass
! 40235: {# ARG_EXPANSION
! 40236: add_prev($text, $stack, "\@end${space}$end_tag");
! 40237: }
! 40238: next;
! 40239: }
! 40240: # macro_regexp
! 40241: elsif ($cline =~ s/^([^{}@]*)\@(["'~\@\}\{,\.!\?\s\*\-\^`=:\|\/\\])//o or $cline =~ s/^([^{}@]*)\@([a-zA-Z][\w-]*)//o)
! 40242: {# ARG_EXPANSION
! 40243: add_prev($text, $stack, $1) unless $state->{'ignored'};
! 40244: my $command = $2;
! 40245: # FIXME: if it is an alias, it is substituted below, in the
! 40246: # diverse add_prev and output of \@$command. Maybe it could be
! 40247: # kept and only substituted in the last passes?
! 40248: $command = $alias{$command} if (exists($alias{$command}));
! 40249: #print STDERR "MACRO $command\n";
! 40250: # handle skipped @-commands
! 40251: $state->{'bye'} = 1 if ($command eq 'bye' and !$state->{'ignored'} and !$state->{'arg_expansion'});
! 40252: # 'ignored' and 'arg_expansion' are handled in misc_command_texi
! 40253: # these are the commands in which the @value and @macro
! 40254: # and @-commands in general should not be expanded
! 40255: if (defined($Texi2HTML::Config::misc_command{$command}) and
! 40256: ($command eq 'c' or $command eq 'comment' or $command eq 'set'
! 40257: or $command eq 'clear' or $command eq 'bye' or $command eq 'alias'))
! 40258: {
! 40259: my $cmd_arg;
! 40260: ($cline, $cmd_arg) = misc_command_texi($cline, $command, $state,
! 40261: $line_nr);
! 40262: add_prev ($text, $stack, "\@$command" . $cmd_arg) unless $state->{'ignored'};
! 40263: }
! 40264: elsif ($command eq 'setfilename' or $command eq 'documentencoding'
! 40265: or $command eq 'definfoenclose' or $command eq 'include')
! 40266: { # special commands whose arguments will have @macro and
! 40267: # @value expanded, and that are processed in this pass
! 40268: if ($state->{'ignored'} or ($line_nr->{'file_name'} ne $Texi2HTML::THISDOC{'input_file_name'} and $command eq 'setfilename'))
! 40269: { # @setfilename is ignored in @include file as said in the manual
! 40270: $cline = '';
! 40271: }
! 40272: elsif ($state->{'arg_expansion'})
! 40273: {
! 40274: add_prev($text, $stack, "\@$command" . $cline);
! 40275: return;
! 40276: }
! 40277: else
! 40278: {
! 40279: $cline =~ s/^(\s+)//;
! 40280: my $space = $1;
! 40281: # not sure if it happpens at end of line, or with
! 40282: # special char following the @-command or only at end of file
! 40283: $space = '' if (!defined($space));
! 40284: if (!$state->{'line_command'})
! 40285: {
! 40286: #print STDERR "LINE_COMMAND Start line_command $command, cline $cline";
! 40287: $state->{'line_command'} = $command;
! 40288: push @$stack, { 'line_command' => $command, 'text' => $space };
! 40289: }
! 40290: else
! 40291: {
! 40292: line_error (sprintf(__("\@%s not allowed in argument to \@%s"), $command, $state->{'line_command'}), $line_nr);
! 40293: #add_prev($text, $stack, "\@$command" . $space);
! 40294: add_prev($text, $stack, $space);
! 40295: }
! 40296: }
! 40297: }
! 40298: # pertusus: it seems that value substitution are performed after
! 40299: # macro argument expansions: if we have
! 40300: # @set comma ,
! 40301: # and a call to a macro @macro {arg1 @value{comma} arg2}
! 40302: # the macro arg is arg1 , arg2 and the comma don't separate
! 40303: # args. Likewise it seems that the @value are not expanded
! 40304: # in macro definitions
! 40305:
! 40306: elsif ($command =~ /^r?macro$/)
! 40307: { # in 'arg_expansion' (ie within another macro call arguments)
! 40308: # the macro is parsed as usual, but isn't registered in
! 40309: # end_macro.
! 40310: if ($cline =~ /^\s+(\w[\w-]*)\s*(.*)/)
! 40311: {
! 40312: my $name = $1;
! 40313: my $args_def = $2;
! 40314: unless ($state->{'ignored'} or $state->{'arg_expansion'})
! 40315: {
! 40316: if (exists($macros->{$name}))
! 40317: {
! 40318: #line_warn ("macro `$name' already defined " .
! 40319: # format_line_number($macros->{$name}->{'line_nr'}) . " redefined", $line_nr);
! 40320: line_warn (sprintf(__("macro `%s' previously defined"), $name), $line_nr);
! 40321: line_warn (sprintf(__("here is the previous definition of `%s'"), $name), $macros->{$name}->{'line_nr'});
! 40322: }
! 40323: }
! 40324: $state->{'macro_inside'} = 1;
! 40325:
! 40326: next if ($state->{'ignored'});
! 40327: my @args = ();
! 40328: if ($args_def =~ /^\s*{\s*(.*?)\s*}\s*/)
! 40329: {
! 40330: @args = split(/\s*,\s*/ , $1)
! 40331: }
! 40332: # keep the context information of the definition
! 40333: my $macro = { 'name' => $name };
! 40334: $macro->{'line_nr'} = { 'file_name' => $line_nr->{'file_name'},
! 40335: 'line_nr' => $line_nr->{'line_nr'}, 'macro' => $line_nr->{'macro'} } if (defined($line_nr));
! 40336: $macro->{'args'} = \@args;
! 40337: $macro->{'header'} = "\@$command" .$cline;
! 40338: my $arg_index = 0;
! 40339: my $debug_msg = '';
! 40340: foreach my $arg (@args)
! 40341: { # when expanding macros, the argument index is retrieved
! 40342: # with args_index
! 40343: $macro->{'args_index'}->{$arg} = $arg_index;
! 40344: $debug_msg .= "$arg($arg_index) ";
! 40345: $arg_index++;
! 40346: }
! 40347: $macro->{'body'} = '';
! 40348: $state->{'macro'} = $macro;
! 40349: print STDERR "# macro def $name: $debug_msg\n"
! 40350: if ($T2H_DEBUG & $DEBUG_MACROS);
! 40351: }
! 40352: else
! 40353: {# it means we have a macro without a name
! 40354: line_error (sprintf(__("Macro definition without macro name: %s"), $cline), $line_nr)
! 40355: unless ($state->{'ignored'});
! 40356: }
! 40357: return 1;
! 40358: }
! 40359: elsif (defined($Texi2HTML::Config::texi_formats_map{$command}))
! 40360: {
! 40361: my $tag;
! 40362: ($cline, $tag) = do_text_macro($command, $cline, $state, $stack, $line_nr);
! 40363: # if it is a raw formatting command or a menu command
! 40364: # we must keep it for later, unless we are in an 'ignored'.
! 40365: # if in 'arg_expansion' we keep everything.
! 40366: my $command_kept;
! 40367: if ((($state->{'raw'} or ($Texi2HTML::Config::texi_formats_map{$command} eq 'normal') or (exists($region_lines{$command}))) and !$state->{'ignored'}) or $state->{'arg_expansion'})
! 40368: {
! 40369: add_prev($text, $stack, $tag);
! 40370: $command_kept = 1;
! 40371: }
! 40372: #dump_stack ($text, $stack, $state);
! 40373: next if $command_kept;
! 40374: return if ($cline =~ /^\s*$/);
! 40375: }
! 40376: elsif ($command eq 'value')
! 40377: {
! 40378: if ($cline =~ s/^{($VARRE)}//)
! 40379: {
! 40380: my $value = $1;
! 40381: if ($state->{'arg_expansion'})
! 40382: {
! 40383: add_prev($text, $stack, "\@$command" .'{'. $value .'}');
! 40384: next;
! 40385: }
! 40386: next if ($state->{'ignored'});
! 40387: my $expansion;
! 40388: if (defined($value{$value}))
! 40389: {
! 40390: $expansion = $value{$value}
! 40391: }
! 40392: else
! 40393: {
! 40394: $expansion = gdt('@{No value for `{value}\'@}', {'value' => $value}, {'keep_texi'=> 1});
! 40395: line_warn (sprintf(__("undefined flag: %s"), $value), $line_nr);
! 40396: }
! 40397: $cline = $expansion . $cline;
! 40398: }
! 40399: else
! 40400: {
! 40401: if ($state->{'arg_expansion'})
! 40402: {
! 40403: add_prev($text, $stack, "\@$command");
! 40404: next;
! 40405: }
! 40406: next if ($state->{'ignored'});
! 40407: line_error (__("Bad syntax for \@value"), $line_nr);
! 40408: }
! 40409: }
! 40410: elsif ($command eq 'unmacro')
! 40411: { #FIXME with 'arg_expansion' should it be passed unmodified ?
! 40412: if ($state->{'ignored'})
! 40413: {
! 40414: $cline =~ s/^\s+(\w+)//;
! 40415: }
! 40416: else
! 40417: {
! 40418: delete $macros->{$1} if ($cline =~ s/^\s+(\w+)//);
! 40419: }
! 40420: return if ($cline =~ /^\s*$/);
! 40421: $cline =~ s/^\s*//;
! 40422: }
! 40423: elsif (exists($macros->{$command}))
! 40424: {# it must be before the handling of {, otherwise it is considered
! 40425: # to be regular texinfo @-command. Maybe it could be placed higher
! 40426: # if we want user defined macros to override texinfo @-commands
! 40427:
! 40428: # in 'ignored' we parse macro defined args anyway as it removes
! 40429: # some text, but we don't expand the macro
! 40430:
! 40431: my $ref = $macros->{$command}->{'args'};
! 40432: my $args_number = $#$ref +1;
! 40433: # we remove any space/new line before the argument
! 40434: if ($cline =~ s/^\s*{\s*//)
! 40435: { # the macro has args
! 40436: $state->{'macro_args'} = [ "" ];
! 40437: $state->{'macro_name'} = $command;
! 40438: $state->{'macro_depth'} = 1;
! 40439: }
! 40440: elsif (($args_number >= 2) or ($args_number <1))
! 40441: { # no brace -> no arg
! 40442: #$cline =
! 40443: #line_warn("\@$command defined with $args_number arguments should be invoked with {}", $line_nr);
! 40444: line_warn(sprintf(__("\@%s defined with zero or more than one argument should be invoked with {}"), $command), $line_nr);
! 40445: expand_macro ($command, [], $cline, $line_nr, $state);
! 40446: return;
! 40447: }
! 40448: else
! 40449: { # macro with one arg on the line
! 40450: chomp $cline;
! 40451: #$cline =
! 40452: expand_macro ($command, [$cline], "\n", $line_nr, $state);
! 40453: return;
! 40454: }
! 40455: }
! 40456: elsif ($cline =~ s/^{//)
! 40457: {# we add nested commands in a stack. verb is also on the stack
! 40458: # but handled specifically.
! 40459: # we add it the comands even in 'ignored' as their result is
! 40460: # discarded when the closing brace appear, or the ifset or
! 40461: # iclear is closed.
! 40462: if ($command eq 'verb')
! 40463: {
! 40464: if ($cline =~ /^$/)
! 40465: {
! 40466: line_error (sprintf(__("\@%s without associated character"), $command), $line_nr);
! 40467: }
! 40468: else
! 40469: {
! 40470: $cline =~ s/^(.)//;
! 40471: $state->{'verb'} = $1;
! 40472: }
! 40473: }
! 40474: if ($state->{'line_command'} and $command eq 'verb')
! 40475: { # have to close it now to catch if it is not
! 40476: # closed at te end of the line. In subsequent passes this
! 40477: # is done in scan_line_separator.
! 40478: my $result;
! 40479: if (defined($state->{'verb'}))
! 40480: {
! 40481: $result = '@verb{'.$state->{'verb'};
! 40482: my $verb_char = quotemeta($state->{'verb'});
! 40483: if ($cline =~ s/^(.*?${verb_char}\})//)
! 40484: {
! 40485: $result .= $1;
! 40486: }
! 40487: else
! 40488: {
! 40489: $cline =~ s/^(.*)//;
! 40490: $result .= $1;
! 40491: }
! 40492: delete $state->{'verb'};
! 40493: }
! 40494: else
! 40495: {
! 40496: $result = '@verb{'
! 40497: }
! 40498: add_prev($text, $stack, $result) unless($state->{'ignored'});
! 40499: }
! 40500: else
! 40501: {
! 40502: push (@$stack, { 'style' => $command, 'text' => '' });
! 40503: }
! 40504: }
! 40505: else
! 40506: {
! 40507: $cline = do_unknown(0, $command, $cline, $text, $stack, $state, $line_nr);
! 40508: }
! 40509: next;
! 40510: }
! 40511: #elsif(s/^([^{}@]*)\@(.)//o)
! 40512: elsif($cline =~ s/^([^{}@]*)\@([^\s\}\{\@]*)//o)
! 40513: {# ARG_EXPANSION
! 40514: # No need to warn here for @ followed by a character that
! 40515: # is not in any @-command and it is done later
! 40516: add_prev($text, $stack, $1) unless($state->{'ignored'});
! 40517: $cline = do_unknown(0, $2, $cline, $text, $stack, $state, $line_nr);
! 40518: next;
! 40519: }
! 40520: elsif ($cline =~ s/^([^{}]*)([{}])//o)
! 40521: {
! 40522: # in ignored section we cannot be sure that there is an @-command
! 40523: # already opened so we must discard the text.
! 40524: # ARG_EXPANSION
! 40525: add_prev($text, $stack, $1) unless($state->{'ignored'});
! 40526: if ($2 eq '{')
! 40527: {
! 40528: # this empty style is for a lone brace.
! 40529: # we add it even in 'ignored' as it is discarded when the closing
! 40530: # brace appear, or the ifset or iclear is closed.
! 40531: push @$stack, { 'style' => '', 'text' => '' };
! 40532: }
! 40533: else
! 40534: {
! 40535: if (@$stack)
! 40536: {
! 40537: my $style = pop @$stack;
! 40538: close_style_texi($style, $text, $stack, $state);
! 40539: #print STDERR "MACRO end $style->{'style'} remaining: $cline";
! 40540: next;
! 40541: }
! 40542: else
! 40543: {# ARG_EXPANSION
! 40544: # we warn in the last pass that there is a } without open
! 40545: add_prev ($text, $stack, '}') unless($state->{'ignored'});
! 40546: }
! 40547: }
! 40548: }
! 40549: else
! 40550: {# ARG_EXPANSION
! 40551: #print STDERR "END_LINE $cline";
! 40552: add_prev($text, $stack, $cline) unless($state->{'ignored'});
! 40553: if ($state->{'line_command'})
! 40554: {
! 40555: if (!scalar(@$stack))
! 40556: {
! 40557: print STDERR "BUG: empty state for $state->{'line_command'}\n";
! 40558: return;
! 40559: delete $state->{'line_command'};
! 40560: }
! 40561: while (!defined($stack->[-1]->{'line_command'}))
! 40562: {
! 40563: my $top = pop @$stack;
! 40564: # defer this to later?
! 40565: #line_error ("unclosed command in \@$state->{'line_command'}: $top->{'style'}");
! 40566: add_prev($text, $stack, "\@$top->{'style'}".'{'.$top->{'text'}.'}');
! 40567: }
! 40568: my $command = pop @$stack;
! 40569: ###################### debug
! 40570: if (!defined($command) or !defined($command->{'text'}) or
! 40571: !defined($command->{'line_command'}) or ($command->{'line_command'} ne $state->{'line_command'}))
! 40572: {
! 40573: msg_debug ("BUG: messed $state->{'line_command'} stack", $line_nr);
! 40574: delete $state->{'line_command'};
! 40575: return;
! 40576: }
! 40577: ###################### end debug
! 40578: else
! 40579: {
! 40580: delete $state->{'line_command'};
! 40581: my $macro = $command->{'line_command'};
! 40582: # include are not kept
! 40583: if ($macro eq 'include')
! 40584: {
! 40585: #if (s/^\s+([\/\w.+-]+)//o)
! 40586: if ($command->{'text'} =~ s/^(\s+)(.+)//o)
! 40587: {
! 40588: my $file_name = $2;
! 40589: # FIXME scan_line_separators
! 40590: $file_name = trim_around_spaces($file_name);
! 40591: $file_name = substitute_line($file_name, "\@$macro", {'code_style' => 1, 'remove_texi' => 1});
! 40592: my $file = locate_include_file($file_name);
! 40593: if (defined($file))
! 40594: {
! 40595: my ($line_nr_file, $input_spool_file) = open_file($file, $line_nr->{'macro'}, $state->{'files_stack'});
! 40596: ($line_nr, $state->{'input_spool'}) = ($line_nr_file, $input_spool_file) if (defined($line_nr_file));
! 40597: print STDERR "# including $file\n" if $T2H_VERBOSE;
! 40598: }
! 40599: else
! 40600: {
! 40601: line_error (sprintf(__("\@%s: Cannot find %s"), $macro, $file_name), $line_nr);
! 40602: }
! 40603: }
! 40604: else
! 40605: {
! 40606: line_error (sprintf(__("Bad argument to \@%s: %s"), $macro, $command->{'text'}), $line_nr);
! 40607: }
! 40608: return;
! 40609: }
! 40610: else
! 40611: { # these are kept (setfilename, documentencoding, definfoenclose)
! 40612: if ($macro eq 'setfilename' and $Texi2HTML::Config::USE_SETFILENAME)
! 40613: {
! 40614: if (defined(Texi2HTML::Config::get_conf ('setfilename')))
! 40615: {
! 40616: line_error (sprintf(__("\@%s already set"), $macro), $line_nr);
! 40617: # the line is removed, because we don't want to reset
! 40618: # get_conf('setfilename') between passes, and we don't want
! 40619: # the last one to be picked up
! 40620: $cline = "\n";
! 40621: next;
! 40622: }
! 40623: }
! 40624: my $cmd_arg;
! 40625: ($cline, $cmd_arg) = misc_command_texi($command->{'text'},
! 40626: $macro, $state, $line_nr);
! 40627: add_prev ($text, $stack, "\@$macro" . $cmd_arg);
! 40628: next;
! 40629: }
! 40630: }
! 40631: }
! 40632: last;
! 40633: }
! 40634: }
! 40635: return undef if ($state->{'ignored'});
! 40636: return 1;
! 40637: } # end scan_texi
! 40638:
! 40639: sub close_structure_command($$$$)
! 40640: {
! 40641: my $cmd_ref = shift;
! 40642: my $state = shift;
! 40643: my $unclosed_commands = shift;
! 40644: my $line_nr = shift;
! 40645: my $result;
! 40646:
! 40647: #print STDERR "close_structure_command $cmd_ref->{'style'}\n";
! 40648: # If the anchor is in @titlepage or @copying, it is nevertheless only
! 40649: # expanded once in pass_structure, during the @copying or @titlepage
! 40650: # expansion.
! 40651: # It is not true, however if INLINE_INSERTCOPYING is true.
! 40652: # See indices/index_special_region.texi tests.
! 40653: if ($cmd_ref->{'style'} eq 'anchor')
! 40654: {
! 40655: my $anchor = $cmd_ref->{'text'};
! 40656: $anchor = normalise_node($anchor);
! 40657: #print STDERR "Anchor $anchor\n";
! 40658: if ($nodes{$anchor})
! 40659: {# makeinfo error message are the following:
! 40660: # "Anchor `%s' and node `%s' map to the same file name"
! 40661: # "This @anchor command ignored; references to it will not work"
! 40662: # "Rename this anchor or use the `--no-split' option"
! 40663: #
! 40664: # "Anchors `%s' and `%s' map to the same file name"
! 40665: # "Anchor `%s' and node `%s' map to the same file name"
! 40666: # "@anchor command ignored; references to it will not work"
! 40667: # "Rename this anchor or use the `--no-split' option"
! 40668: line_error (sprintf(__("Anchor `%s' previously defined %s"), $anchor, format_line_number($nodes{$anchor}->{'line_nr'})), $line_nr);
! 40669: return '';
! 40670: }
! 40671: elsif ($anchor =~ /^\(.+\)/)
! 40672: {
! 40673: line_error (sprintf(__("Syntax for an external node used for `%s'"), $anchor), $line_nr);
! 40674: return '';
! 40675: }
! 40676: $document_anchor_num++;
! 40677: $nodes{$anchor} = { 'anchor' => 1, 'seen' => 1, 'texi' => $anchor, 'id' => 'ANC' . $document_anchor_num, 'line_nr' => $line_nr, 'tag' => 'anchor'};
! 40678: push @{$state->{'place'}}, $nodes{$anchor};
! 40679: }
! 40680: elsif ($cmd_ref->{'style'} eq 'footnote')
! 40681: {
! 40682: if (Texi2HTML::Config::get_conf('footnotestyle') eq 'separate')
! 40683: {
! 40684: $state->{'heading_element'} = $state->{'footnote_heading_element'};
! 40685: $state->{'place'} = $state->{'footnote_place'};
! 40686: }
! 40687: }
! 40688: elsif ($cmd_ref->{'style'} eq 'caption' or $cmd_ref->{'style'}
! 40689: eq 'shortcaption' and $state->{'float'})
! 40690: {
! 40691: my @texi_lines = map {$_ = $_."\n"} split (/\n/, $cmd_ref->{'text'});
! 40692: $state->{'float'}->{$cmd_ref->{'style'} . "_texi"} = \@texi_lines;
! 40693: }
! 40694: if (($cmd_ref->{'style'} eq 'titlefont') and ($cmd_ref->{'text'} =~ /\S/))
! 40695: {
! 40696: $state->{'heading_element'}->{'titlefont'} = $cmd_ref->{'text'} unless ((exists($state->{'region'}) and ($state->{'region'} eq 'titlepage')) or defined($state->{'heading_element'}->{'titlefont'})) ;
! 40697: }
! 40698: if (defined($Texi2HTML::Config::command_handler{$cmd_ref->{'style'}}))
! 40699: {
! 40700: $result = init_special($cmd_ref->{'style'},$cmd_ref->{'text'});
! 40701: if ($unclosed_commands)
! 40702: {
! 40703: $result .= "\n"; # the end of line is eaten by init_special
! 40704: line_error(sprintf(__("No closing brace for specially handled command %s"), $cmd_ref->{'style'}),$line_nr);
! 40705: }
! 40706: }
! 40707: elsif ($cmd_ref->{'style'})
! 40708: {
! 40709: $result = '@' . $cmd_ref->{'style'} . '{' . $cmd_ref->{'text'};
! 40710: $result .= '}' unless ($unclosed_commands);
! 40711: }
! 40712: else
! 40713: {
! 40714: $result = '{' . $cmd_ref->{'text'};
! 40715: # don't close { if we are closing stack as we are not
! 40716: # sure this is a licit { ... } construct.
! 40717: $result .= '}' unless ($unclosed_commands);
! 40718: }
! 40719: return $result;
! 40720: }
! 40721:
! 40722: sub end_format_structure($$$$$$)
! 40723: {
! 40724: my $end_tag = shift;
! 40725: my $text = shift;
! 40726: my $stack = shift;
! 40727: my $state = shift;
! 40728: my $line_nr = shift;
! 40729: my $remaining_on_line = shift;
! 40730:
! 40731: if (defined($state->{'text_macro_stack'})
! 40732: and @{$state->{'text_macro_stack'}}
! 40733: and ($end_tag eq $state->{'text_macro_stack'}->[-1]))
! 40734: {
! 40735: pop @{$state->{'text_macro_stack'}};
! 40736: if (exists($region_lines{$end_tag}))
! 40737: { # end a region_line macro, like documentdescription, copying
! 40738: print STDERR "Bug: end_tag $end_tag ne $state->{'region_lines'}->{'format'}\n"
! 40739: if ($end_tag ne $state->{'region_lines'}->{'format'});
! 40740: print STDERR "Bug: end_tag $end_tag ne $state->{'region'}\n"
! 40741: if ($end_tag ne $state->{'region'});
! 40742: $state->{'region_lines'}->{'number'}--;
! 40743: if ($state->{'region_lines'}->{'number'} == 0)
! 40744: {
! 40745: close_region($state);
! 40746: }
! 40747: #dump_stack($text, $stack, $state);
! 40748: }
! 40749: if (($Texi2HTML::Config::texi_formats_map{$end_tag} eq 'normal') or $Texi2HTML::Config::region_formats_kept{$end_tag})
! 40750: {
! 40751: $state->{$end_tag}-- if ($Texi2HTML::Config::texi_formats_map{$end_tag} eq 'normal');
! 40752: add_prev($text, $stack, "\@end $end_tag");
! 40753: }
! 40754: else
! 40755: {
! 40756: #print STDERR "End $end_tag\n";
! 40757: #dump_stack($text, $stack, $state);
! 40758: return 1 if ($remaining_on_line =~ /^\s*$/);
! 40759: }
! 40760: }
! 40761: elsif ($Texi2HTML::Config::texi_formats_map{$end_tag})
! 40762: {
! 40763: line_error (sprintf(__("Unmatched `%c%s'"), ord('@'), 'end'), $line_nr);
! 40764: #dump_stack($text, $stack, $state);
! 40765: }
! 40766: elsif ($end_tag eq 'detailmenu' or $end_tag eq 'direntry')
! 40767: {
! 40768: $state->{$end_tag}-- if $state->{$end_tag};
! 40769: add_prev($text, $stack, "\@end $end_tag");
! 40770: }
! 40771: else
! 40772: {
! 40773: if ($end_tag eq 'float' and $state->{'float'})
! 40774: {
! 40775: delete $state->{'float'};
! 40776: }
! 40777: elsif ($end_tag eq $state->{'table_stack'}->[-1])
! 40778: {
! 40779: enter_table_index_entry($text, $stack, $state, $line_nr);
! 40780: pop @{$state->{'table_stack'}};
! 40781: }
! 40782: #add end tag
! 40783: add_prev($text, $stack, "\@end $end_tag");
! 40784: }
! 40785: return 0;
! 40786: }
! 40787:
! 40788: sub parse_menu_entry($)
! 40789: {
! 40790: my $menu_line = shift;
! 40791: my ($node, $name, $ending, $remaining);
! 40792:
! 40793: return ($node, $name, $ending, $remaining) unless $menu_line =~ s/^\*//;
! 40794:
! 40795: my ($before_colon, $separator);
! 40796: ($before_colon, $remaining, $separator) = scan_line_separators($menu_line, ':', 'menu entry');
! 40797: if (defined($before_colon) and defined($separator))
! 40798: {
! 40799: if ($remaining =~ s/^://)
! 40800: {
! 40801: $node = $before_colon;
! 40802: $ending = '::';
! 40803: }
! 40804: elsif ($remaining =~ /\S/)
! 40805: {
! 40806: my $after_colon;
! 40807: $ending = "";
! 40808: ($after_colon, $remaining, $separator) = scan_line_separators($remaining, '\t,\.', 'menu entry node');
! 40809: # this certainly corresponds with an error in the node.
! 40810: # this is considered not to be a menu entry.
! 40811: return (undef, $name, $ending, $remaining) if (!defined($after_colon));
! 40812: $node = $after_colon;
! 40813:
! 40814: while (1)
! 40815: {
! 40816: if (!defined($separator) or (defined($separator) and $separator ne '.') or (defined($separator) and (!defined($remaining) or $remaining =~ /^\s/)))
! 40817: {
! 40818: last;
! 40819: }
! 40820: $node .= $separator;
! 40821: my $after_dot;
! 40822: ($after_dot, $remaining, $separator) = scan_line_separators($remaining, '\t,\.', 'menu entry node');
! 40823: $after_dot = '' if (!defined($after_dot));
! 40824: $node .= $after_dot;
! 40825: }
! 40826: $name = $before_colon;
! 40827: $ending = $separator if (defined($separator));
! 40828: # only spaces after the :, this is not a menu entry:
! 40829: $node = undef if ($node !~ /\S/);
! 40830: }
! 40831: }
! 40832: # remaining may be defined even if $node isn't.
! 40833: #print STDERR "\nLLLL $menu_line";
! 40834: #print STDERR " --> node:$node, name:$name, ending:$ending -> $remaining";
! 40835: return ($node, $name, $ending, $remaining);
! 40836: }
! 40837:
! 40838: sub scan_structure($$$$;$)
! 40839: {
! 40840: my $line = shift;
! 40841: my $text = shift;
! 40842: my $stack = shift;
! 40843: my $state = shift;
! 40844: my $line_nr = shift;
! 40845:
! 40846: die "stack not an array ref" unless (ref($stack) eq "ARRAY");
! 40847: my $cline = $line;
! 40848: #print STDERR "SCAN_STRUCTURE: $line";
! 40849: #dump_stack ($text, $stack, $state);
! 40850: if (!$state->{'raw'} and (!exists($state->{'region_lines'})))
! 40851: {
! 40852: #if (!$state->{'verb'} and $state->{'menu'} and $cline =~ /^\*\s+/o)
! 40853: if (!$state->{'verb'} and $state->{'menu'})
! 40854: {
! 40855: # new menu entry
! 40856: my ($node, $name, $ending, $remaining) = parse_menu_entry($cline);
! 40857: if (defined($node))
! 40858: {
! 40859: menu_entry_texi(normalise_node($node), $state, $line_nr);
! 40860: }
! 40861: }
! 40862: }
! 40863:
! 40864: while(1)
! 40865: {
! 40866: # scan structure
! 40867: #dump_stack($text, $stack, $state);
! 40868: #print STDERR "WHILE(s):$cline";
! 40869:
! 40870: # as texinfo 4.5
! 40871: # verbatim might begin at another position than beginning
! 40872: # of line, and end verbatim might too. To end a verbatim section
! 40873: # @end verbatim must have exactly one space between end and verbatim
! 40874: # things following end verbatim are not ignored.
! 40875: #
! 40876: # html might begin at another position than beginning
! 40877: # of line, but @end html must begin the line, and have
! 40878: # exactly one space. Things following end html are ignored.
! 40879: # tex and ignore works like html
! 40880: #
! 40881: # ifnothtml might begin at another position than beginning
! 40882: # of line, and @end ifnothtml might too, there might be more
! 40883: # than one space between @end and ifnothtml but nothing more on
! 40884: # the line.
! 40885: # @end itemize, @end ftable works like @end ifnothtml.
! 40886: # except that @item on the same line than @end vtable doesn't work
! 40887: #
! 40888: # text right after the itemize before an item is displayed.
! 40889: # @item might be somewhere in a line.
! 40890: # strangely @item on the same line than @end vtable doesn't work
! 40891: # there should be nothing else than a command following @itemize...
! 40892: #
! 40893: # see more examples in formatting directory
! 40894:
! 40895: if ($state->{'raw'})
! 40896: {
! 40897: my $tag = $state->{'raw'};
! 40898: ################# debug
! 40899: if (! @$stack or ($stack->[-1]->{'style'} ne $tag))
! 40900: {
! 40901: print STDERR "Bug: raw or special: $tag but not on top of stack\n";
! 40902: print STDERR "line: $cline";
! 40903: dump_stack($text, $stack, $state);
! 40904: exit 1;
! 40905: }
! 40906: ################# end debug
! 40907: if ($tag eq 'macro')
! 40908: {
! 40909: if ($cline =~ /^\s*\@macro\s+(\w[\w-]*)\s*(.*)/)
! 40910: {
! 40911: $state->{$tag}++;
! 40912: }
! 40913: }
! 40914: # macro_regexp
! 40915: if ($cline =~ /^(.*?)\@end\s([a-zA-Z][\w-]*)/o and ($2 eq $tag))
! 40916: {
! 40917: $cline =~ s/^(.*?)(\@end\s$tag)//;
! 40918: add_prev ($text, $stack, $1);
! 40919: my $end_text = $2;
! 40920: if ($tag eq 'macro')
! 40921: {
! 40922: $state->{$tag}--;
! 40923: if ($state->{$tag})
! 40924: {
! 40925: add_prev ($text, $stack, $end_text);
! 40926: next;
! 40927: }
! 40928: }
! 40929: delete $state->{'raw'};
! 40930: my $style = pop @$stack;
! 40931: if (defined($Texi2HTML::Config::command_handler{$tag}))
! 40932: { # replace the special region by what init_special give
! 40933: if ($style->{'text'} !~ /^\s*$/)
! 40934: {
! 40935: add_prev ($text, $stack, init_special($style->{'style'}, $style->{'text'}));
! 40936: }
! 40937: }
! 40938: else
! 40939: {
! 40940: add_prev ($text, $stack, $style->{'text'} . "\@end $tag");
! 40941: }
! 40942: next;
! 40943: }
! 40944: else
! 40945: {
! 40946: add_prev ($text, $stack, $cline);
! 40947: return if (defined($Texi2HTML::Config::command_handler{$tag}));
! 40948: last;
! 40949: }
! 40950: }
! 40951:
! 40952: if (defined($state->{'verb'}))
! 40953: {
! 40954: my $char = quotemeta($state->{'verb'});
! 40955: if ($cline =~ s/^(.*?)$char\}/\}/)
! 40956: {
! 40957: add_prev($text, $stack, $1 . $state->{'verb'});
! 40958: $stack->[-1]->{'text'} = $state->{'verb'} . $stack->[-1]->{'text'};
! 40959: delete $state->{'verb'};
! 40960: next;
! 40961: }
! 40962: else
! 40963: {
! 40964: add_prev($text, $stack, $cline);
! 40965: last;
! 40966: }
! 40967: }
! 40968:
! 40969: # macro_regexp
! 40970: if ($cline =~ s/^([^{}@]*)\@end\s+([a-zA-Z][\w-]*)//)
! 40971: {
! 40972: add_prev($text, $stack, $1);
! 40973: my $end_tag = $2;
! 40974: #print STDERR "END STRUCTURE $end_tag\n";
! 40975: return if (end_format_structure($end_tag, $text, $stack, $state, $line_nr, $cline));
! 40976: next;
! 40977: }
! 40978: # macro_regexp
! 40979: elsif ($cline =~ s/^([^{}@]*)\@(["'~\@\}\{,\.!\?\s\*\-\^`=:\|\/\\])//o or $cline =~ s/^([^{}@]*)\@([a-zA-Z][\w-]*)//o)
! 40980: {
! 40981: add_prev($text, $stack, $1);
! 40982: my $macro = $2;
! 40983: #print STDERR "MACRO $macro\n";
! 40984: $macro = $alias{$macro} if (exists($alias{$macro}));
! 40985: if (defined($Texi2HTML::Config::deprecated_commands{$macro}))
! 40986: {
! 40987: # makeinfo has
! 40988: # "%c%s is obsolete; use %c%s instead"
! 40989: if ($Texi2HTML::Config::deprecated_commands{$macro} eq '')
! 40990: {
! 40991: line_warn(sprintf(__("%c%s is obsolete."), ord('@'), $macro), $line_nr);
! 40992: }
! 40993: else
! 40994: {
! 40995: line_warn(sprintf(__("%c%s is obsolete; %s"),ord('@'), $macro, __($Texi2HTML::Config::deprecated_commands{$macro})), $line_nr);
! 40996: }
! 40997: }
! 40998: if (defined($Texi2HTML::Config::misc_command{$macro}))
! 40999: {
! 41000: my $line;
! 41001: ($cline, $line) = misc_command_structure($cline, $macro, $state,
! 41002: $line_nr);
! 41003: add_prev ($text, $stack, "\@$macro".$line);
! 41004: next;
! 41005: }
! 41006: elsif ($macro eq 'printindex' and ($cline =~ /^\s+(\w+)/))
! 41007: {
! 41008: my $index_name = $1;
! 41009: if (!exists($index_names{$index_name}))
! 41010: {
! 41011: line_error (sprintf(__("Unknown index `%s' in \@printindex"),$index_name), $line_nr);
! 41012: }
! 41013: my $associated_element;
! 41014: if ($state->{'current_element'} eq $element_before_anything)
! 41015: {
! 41016: line_warn (sprintf(__("Printindex before document beginning: \@printindex %s"), $index_name), $line_nr);
! 41017: }
! 41018: else
! 41019: {
! 41020: # $element_index is the first element with index
! 41021: $element_index = $state->{'current_element'} unless (defined($element_index));
! 41022: $associated_element = $state->{'current_element'};
! 41023: }
! 41024: my $region = $state->{'region'};
! 41025: $region = 'document' if (!defined($region));
! 41026: # FIXME use 'index_name' instead of 'name'
! 41027: my $printindex = { 'associated_element' => $associated_element, 'name' => $index_name, 'region' => $region, 'command' => 'printindex' };
! 41028: # prepare association of the index to the element by
! 41029: # putting it in the current place
! 41030: push @{$state->{'place'}}, $printindex;
! 41031: push @{$Texi2HTML::THISDOC{'indices'}->{$region}->{$index_name}}, $printindex;
! 41032: #print STDERR "PRINTINDEX add($printindex) region $region name $index_name, nr ".scalar(@{$Texi2HTML::THISDOC{'indices'}->{$region}->{$index_name}})."\n";
! 41033: add_prev ($text, $stack, "\@$macro" . $cline);
! 41034: last;
! 41035: }
! 41036: elsif ($macro eq 'listoffloats')
! 41037: {
! 41038: add_prev ($text, $stack, "\@$macro" . $cline);
! 41039: last;
! 41040: }
! 41041: elsif ($sec2level{$macro})
! 41042: {
! 41043: if ($cline =~ /^\s*(.*)$/)
! 41044: {
! 41045: my $name = $1;
! 41046: my $heading_ref = new_section_heading($macro, $name, $state, $line_nr);
! 41047: if (exists($state->{'region_lines'}) and $state->{'region_lines'}->{'format'})
! 41048: {
! 41049: my $region = $state->{'region_lines'}->{'format'};
! 41050: $state->{'region_lines'}->{'head_num'}++;
! 41051: my $num = $state->{'region_lines'}->{'head_num'};
! 41052: $heading_ref->{'id'} = "${target_prefix}${region}_HEAD$num";
! 41053: $heading_ref->{'sec_num'} = "${region}_$num";
! 41054: $heading_ref->{'region'} = $region;
! 41055: $heading_ref->{'region_head_num'} = $num;
! 41056: }
! 41057: else
! 41058: {
! 41059: $document_head_num++;
! 41060: $heading_ref->{'id'} = "HEAD$document_head_num";
! 41061: $heading_ref->{'sec_num'} = $document_head_num;
! 41062: }
! 41063: # this is only used when there is a index entry after the
! 41064: # heading
! 41065: $heading_ref->{'target'} = $heading_ref->{'id'};
! 41066: $heading_ref->{'heading'} = 1;
! 41067: $heading_ref->{'tag_level'} = $macro;
! 41068: $heading_ref->{'number'} = '';
! 41069:
! 41070: $state->{'heading_element'} = $heading_ref;
! 41071: push @{$state->{'place'}}, $heading_ref;
! 41072: $headings{$heading_ref->{'sec_num'}} = $heading_ref;
! 41073: }
! 41074: add_prev ($text, $stack, "\@$macro" . $cline);
! 41075: last;
! 41076: }
! 41077: elsif (index_command_prefix($macro) ne '')
! 41078: { # if we are already in a (v|f)table the construct is quite
! 41079: # wrong
! 41080: # FIXME should it be discarded?
! 41081: if ($state->{'item'})
! 41082: {
! 41083: line_error(sprintf(__("ignored \@%s already in an \@%s entry"), $macro, $state->{'item'}), $line_nr);
! 41084: next;
! 41085: }
! 41086: my $index_prefix = index_command_prefix($macro);
! 41087: enter_index_entry($index_prefix, $line_nr, $cline, $macro, $state);
! 41088: add_prev ($text, $stack, "\@$macro" . $cline);
! 41089: last;
! 41090: }
! 41091: elsif (defined($Texi2HTML::Config::texi_formats_map{$macro}))
! 41092: {
! 41093: my $macro_kept;
! 41094: #print STDERR "TEXT_MACRO: $macro\n";
! 41095: if ($Texi2HTML::Config::texi_formats_map{$macro} eq 'raw')
! 41096: {
! 41097: $state->{'raw'} = $macro;
! 41098: $state->{$macro}++ if ($macro eq 'macro');
! 41099: #print STDERR "RAW\n";
! 41100: }
! 41101: elsif ($Texi2HTML::Config::texi_formats_map{$macro} eq 'normal')
! 41102: {
! 41103: if ($macro eq 'menu')
! 41104: {
! 41105: delete ($state->{'prev_menu_node'});
! 41106: if (!$state->{'node_ref'})
! 41107: {
! 41108: line_error (sprintf(__("\@%s seen before first \@node"), $macro), $line_nr);
! 41109: line_error (__("perhaps your \@top node should be wrapped in \@ifnottex rather than \@ifinfo?"), $line_nr);
! 41110: }
! 41111: if ($state->{'menu_in_node'})
! 41112: {
! 41113: line_error (sprintf(__("Multiple \@%s"), $macro), $line_nr);
! 41114: }
! 41115: $state->{'menu_in_node'}++;
! 41116: }
! 41117: $state->{$macro}++;
! 41118: push @{$state->{'text_macro_stack'}}, $macro;
! 41119: #print STDERR "MENU (text_macro_stack: @{$state->{'text_macro_stack'}})\n";
! 41120: }
! 41121: elsif (exists($region_lines{$macro}))
! 41122: {
! 41123: if (exists($state->{'region_lines'}) and ($state->{'region_lines'}->{'format'} ne $macro))
! 41124: {
! 41125: line_error(sprintf(__("\@%s not allowed within %s"), $macro, $state->{'region_lines'}->{'format'}), $line_nr);
! 41126: next;
! 41127: }
! 41128: open_region ($macro, $state);
! 41129: if ($Texi2HTML::Config::region_formats_kept{$macro})
! 41130: {
! 41131: add_prev($text, $stack, "\@$macro");
! 41132: $macro_kept = 1;
! 41133: $state->{'region_lines'}->{'first_line'} = 1;
! 41134: }
! 41135: push @{$state->{'text_macro_stack'}}, $macro;
! 41136: }
! 41137: # if it is a raw formatting command or a menu command
! 41138: # we must keep it for later
! 41139: if (($state->{'raw'} and (!defined($Texi2HTML::Config::command_handler{$macro}))) or ($Texi2HTML::Config::texi_formats_map{$macro} eq 'normal'))
! 41140: {
! 41141: add_prev($text, $stack, "\@$macro");
! 41142: $macro_kept = 1;
! 41143: }
! 41144: if ($state->{'raw'})
! 41145: {
! 41146: push @$stack, { 'style' => $macro, 'text' => '' };
! 41147: }
! 41148: next if $macro_kept;
! 41149: #dump_stack ($text, $stack, $state);
! 41150: return if ($cline =~ /^\s*$/);
! 41151: }
! 41152: elsif ($macro eq 'detailmenu' or $macro eq 'direntry')
! 41153: {
! 41154: if ($macro eq 'detailmenu' and !$state->{'node_ref'})
! 41155: {
! 41156: line_error (sprintf(__("\@%s seen before first \@node"), $macro), $line_nr);
! 41157: }
! 41158: add_prev ($text, $stack, "\@$macro" . $cline);
! 41159: $state->{$macro}++;
! 41160: last;
! 41161: }
! 41162: elsif ($macro eq 'float')
! 41163: {
! 41164: my ($style_texi, $label_texi) = parse_line_arguments($cline, 2, "\@$macro", $line_nr);
! 41165: $style_texi = normalise_texi_space($style_texi);
! 41166: $label_texi = undef if (defined($label_texi) and ($label_texi =~ /^\s*$/));
! 41167: if (defined($label_texi))
! 41168: { # The float may be a target for refs if it has a label
! 41169: my $error_with_label = 1;
! 41170: $label_texi = normalise_node($label_texi);
! 41171: if (exists($nodes{$label_texi}) and defined($nodes{$label_texi})
! 41172: and $nodes{$label_texi}->{'seen'})
! 41173: {
! 41174: line_error (sprintf(__("Float label `%s' previously defined %s"), $label_texi, format_line_number($nodes{$label_texi}->{'line_nr'})), $line_nr);
! 41175: }
! 41176: elsif ($label_texi =~ /^\(.+\)/)
! 41177: {
! 41178: line_error (sprintf(__("Syntax for an external node used for `%s'"), $label_texi), $line_nr);
! 41179: }
! 41180: else
! 41181: {
! 41182: $error_with_label = 0;
! 41183: my $float = { };
! 41184: if (exists($nodes{$label_texi}) and defined($nodes{$label_texi}))
! 41185: { # float appeared in a menu
! 41186: $float = $nodes{$label_texi};
! 41187: }
! 41188: else
! 41189: {
! 41190: $nodes{$label_texi} = $float;
! 41191: }
! 41192: $float->{'float'} = 1;
! 41193: $float->{'tag'} = 'float';
! 41194: $float->{'texi'} = $label_texi;
! 41195: $float->{'seen'} = 1;
! 41196: $float->{'id'} = $label_texi;
! 41197: $float->{'target'} = $label_texi;
! 41198: #print STDERR "FLOAT: $float $float->{'texi'}, place $state->{'place'}\n";
! 41199: push @{$state->{'place'}}, $float;
! 41200: $float->{'element'} = $state->{'current_element'};
! 41201: $state->{'float'} = $float;
! 41202: $float->{'style_texi'} = $style_texi;
! 41203: $float->{'line_nr'} = $line_nr;
! 41204: push @floats, $float;
! 41205: }
! 41206:
! 41207: if ($error_with_label)
! 41208: {
! 41209: while ($cline =~ /,/)
! 41210: {
! 41211: $cline =~ s/,.*$//;
! 41212: }
! 41213: }
! 41214: }
! 41215: add_prev($text, $stack, "\@$macro" . $cline);
! 41216: last;
! 41217: }
! 41218: elsif (defined($Texi2HTML::Config::def_map{$macro}))
! 41219: {
! 41220: # @ may protect end of line in @def. We reconstruct lines here.
! 41221: # in the texinfo manual is said that spaces after @ collapse
! 41222: if ($cline =~ /(\@+)\s*$/)
! 41223: {
! 41224: my $at_at_end_of_line = $1;
! 41225: if ((length($at_at_end_of_line) % 2) == 1)
! 41226: {
! 41227: #print STDERR "Line continue $cline";
! 41228: my $def_line = $cline;
! 41229: $def_line =~ s/\@\s*$//;
! 41230: chomp($def_line);
! 41231: $state->{'in_deff_line'} = "\@$macro" .$def_line;
! 41232: return;
! 41233: }
! 41234: }
! 41235: #We must enter the index entries
! 41236: my ($prefix, $entry, $argument) = get_deff_index($macro, $cline, $line_nr,1);
! 41237: # use deffn instead of deffnx for @-command record
! 41238: # associated with index entry
! 41239: my $idx_macro = $macro;
! 41240: $idx_macro =~ s/x$//;
! 41241: enter_index_entry($prefix, $line_nr, $entry, $idx_macro, $state)
! 41242: if ($prefix);
! 41243: $cline =~ s/(.*)//;
! 41244: add_prev($text, $stack, "\@$macro" . $1);
! 41245: }
! 41246: elsif ($macro =~ /^itemx?$/)
! 41247: {
! 41248: enter_table_index_entry($text, $stack, $state, $line_nr);
! 41249: if ($state->{'table_stack'}->[-1] =~ /^(v|f)?table$/)
! 41250: {
! 41251: $state->{'item'} = $macro;
! 41252: push @$stack, { 'format' => 'index_item', 'text' => '', 'command' => $macro };
! 41253: }
! 41254: else
! 41255: {
! 41256: add_prev($text, $stack, "\@$macro");
! 41257: }
! 41258: }
! 41259: elsif ($format_type{$macro} and ($format_type{$macro} eq 'table' or $format_type{$macro} eq 'list' or $macro eq 'multitable'))
! 41260: { # We must enter the index entries of (v|f)table thus we track
! 41261: # in which table we are
! 41262: push @{$state->{'table_stack'}}, $macro;
! 41263: add_prev($text, $stack, "\@$macro");
! 41264: }
! 41265: elsif ($cline =~ s/^{//)
! 41266: {
! 41267: if ($macro eq 'verb')
! 41268: {
! 41269: if ($cline =~ /^$/)
! 41270: {
! 41271: # We already warned in pass texi
! 41272: }
! 41273: else
! 41274: {
! 41275: $cline =~ s/^(.)//;
! 41276: $state->{'verb'} = $1;
! 41277: }
! 41278: }
! 41279: elsif ($macro eq 'footnote' and (Texi2HTML::Config::get_conf('footnotestyle') eq 'separate'))
! 41280: {
! 41281: $state->{'footnote_heading_element'} = $state->{'heading_element'};
! 41282: $state->{'footnote_place'} = $state->{'place'};
! 41283: $state->{'heading_element'} = $footnote_element;
! 41284: $state->{'place'} = $footnote_element->{'place'};
! 41285: }
! 41286: push (@$stack, { 'style' => $macro, 'text' => '' });
! 41287: }
! 41288: else
! 41289: {
! 41290: $cline = do_unknown (1, $macro, $cline, $text, $stack, $state, $line_nr);
! 41291: }
! 41292: next;
! 41293: }
! 41294: #elsif($cline =~ s/^([^{}@]*)\@(.)//o)
! 41295: elsif($cline =~ s/^([^{}@]*)\@([^\s\}\{\@]*)//o)
! 41296: {
! 41297: add_prev($text, $stack, $1);
! 41298: $cline = do_unknown (1, $2, $cline, $text, $stack, $state, $line_nr);
! 41299: next;
! 41300: }
! 41301: elsif ($cline =~ s/^([^{}]*)([{}])//o)
! 41302: {
! 41303: add_prev($text, $stack, $1);
! 41304: if ($2 eq '{')
! 41305: {
! 41306: push @$stack, { 'style' => '', 'text' => '' };
! 41307: }
! 41308: else
! 41309: {
! 41310: if (@$stack)
! 41311: {
! 41312: my $style = pop @$stack;
! 41313: my $result;
! 41314: add_prev ($text, $stack,
! 41315: close_structure_command($style, $state, 0, $line_nr));
! 41316: next;
! 41317: }
! 41318: else
! 41319: {
! 41320: # We warn in the last pass
! 41321: add_prev ($text, $stack, '}');
! 41322: }
! 41323: }
! 41324: }
! 41325: else
! 41326: {
! 41327: add_prev($text, $stack, $cline);
! 41328: # in case of user mistake, with an @-command not closed on an @item line
! 41329: close_stack_structure($text, $stack, $state, $line_nr, 1) if ($state->{'item'});
! 41330: enter_table_index_entry($text, $stack, $state, $line_nr);
! 41331: #print STDERR "END_LINE(s) $cline";
! 41332: #dump_stack($text, $stack, $state);
! 41333: last;
! 41334: }
1.1 noro 41335: }
1.3 ! takayama 41336: return 1;
! 41337: } # end scan_structure
! 41338:
! 41339: sub check_bad_end_argument ($$$)
! 41340: {
! 41341: my $command = shift;
! 41342: my $line = shift;
! 41343: my $line_nr = shift;
! 41344:
! 41345: if ($line =~ /^(\S+)/)
! 41346: {
! 41347: my $symbols = $1;
! 41348: line_error (sprintf(__("Bad argument `%s' to `\@%s', using `%s'"), "${command}${symbols}", 'end', $command), $line_nr);
! 41349: }
! 41350: }
! 41351:
! 41352: sub close_style_command($$$$$;$)
! 41353: {
! 41354: my $text = shift;
! 41355: my $stack = shift;
! 41356: my $state = shift;
! 41357: my $line_nr = shift;
! 41358: my $line = shift;
! 41359: # not the end of the style, but the paragraph the style is in is closed
! 41360: my $no_close = shift;
! 41361:
! 41362: my $style = pop @$stack;
! 41363: my $command = $style->{'style'};
! 41364: my $result;
! 41365: if (!defined($command))
! 41366: {
! 41367: print STDERR "Bug: empty style in pass_text\n";
! 41368: return ($result, $command);
! 41369: }
! 41370: if (ref($::style_map_ref->{$command}) eq 'HASH')
! 41371: {
! 41372: push (@{$style->{'args'}}, $style->{'text'});
! 41373: $style->{'fulltext'} .= $style->{'text'};
! 41374: if (!defined($style->{'arg_nr'}))
! 41375: {
! 41376: msg_debug("Bug: undefined 'arg_nr' for $command", $line_nr);
1.1 noro 41377: }
1.3 ! takayama 41378: #print STDERR "DEBUG $command ($style->{'arg_nr'})\n";
! 41379: #my $number = 0;
! 41380: #foreach my $arg(@{$style->{'args'}})
! 41381: #{
! 41382: # print STDERR " $number: $arg\n";
! 41383: # $number++;
! 41384: #}
! 41385: #print STDERR "END DEBUG\n";
! 41386: $style->{'text'} = $style->{'fulltext'};
! 41387: $state->{'keep_texi'} = 0 if (
! 41388: ($::style_map_ref->{$command}->{'args'}->[$style->{'arg_nr'}] eq 'keep')
! 41389: and ($state->{'keep_nr'} == 1));
! 41390: }
! 41391: if ($no_paragraph_macro{$command})
! 41392: {
! 41393: $state->{'no_paragraph'}--;
! 41394: pop @{$state->{'no_paragraph_stack'}};
! 41395: }
! 41396: if ($::style_map_ref->{$command} and (defined($style_type{$command})) and ((!$no_close and ($style_type{$command} eq 'style')) or ($style_type{$command} eq 'accent')))
! 41397: {
! 41398: my $style_command = pop @{$state->{'command_stack'}};
! 41399: if ($style_command ne $command)
! 41400: {
! 41401: #line_warn ("Bug: $style_command on 'command_stack', not $command", $line_nr);
! 41402: # This can be a bug in case of bad nesting, see bad_style_nesting.texi
! 41403: line_warn("Bad nesting of \@$style_command and \@$command", $line_nr);
! 41404: push @{$state->{'command_stack'}}, $style_command;
! 41405: ############################ debug
! 41406: if ($T2H_DEBUG)
! 41407: {
! 41408: push @$stack, $style;
! 41409: print STDERR "Stacks before pop top:\n";
! 41410: dump_stack($text, $stack, $state);
! 41411: pop @$stack;
! 41412: ############################ end debug
! 41413: }
1.1 noro 41414: }
1.3 ! takayama 41415: }
! 41416: if ($state->{'keep_texi'})
! 41417: { # don't expand @-commands in anchor, refs...
! 41418: close_arg ($command, $style->{'arg_nr'}, $state);
! 41419: $result = '@' . $command . '{' . $style->{'text'} . '}';
! 41420: }
! 41421: elsif ($::things_map_ref->{$command})
! 41422: {
! 41423: $result = do_thing_command ($command, $style->{'text'}, $state, $line_nr);
! 41424: }
! 41425: else
! 41426: {
! 41427: $result = do_style_command($command, $style->{'text'}, $state, $style->{'args'}, $line_nr, $style->{'no_open'}, $no_close, $style->{'keep_line_nr'});
! 41428: if ($state->{'code_style'} < 0)
! 41429: {
! 41430: msg_debug ("Bug: negative code_style: $state->{'code_style'}, line:$line", $line_nr);
1.1 noro 41431: }
1.3 ! takayama 41432: if ($state->{'math_style'} < 0)
! 41433: {
! 41434: msg_debug ("Bug: negative math_style: $state->{'math_style'}, line:$line", $line_nr);
1.1 noro 41435: }
1.3 ! takayama 41436: }
! 41437: return ($result, $command);
1.1 noro 41438: }
41439:
1.3 ! takayama 41440: sub top_stack_is_menu($)
! 41441: {
! 41442: my $stack = shift;
! 41443: my $top_stack = top_stack($stack, 1);
! 41444: return 0 if (!$format_type{$top_stack->{'format'}} or $format_type{$top_stack->{'format'}} ne 'menu');
! 41445: return 1;
1.1 noro 41446: }
41447:
41448:
1.3 ! takayama 41449: sub scan_line($$$$;$)
! 41450: {
! 41451: my $original_line = shift;
! 41452: my $text = shift;
! 41453: my $stack = shift;
! 41454: my $state = shift;
! 41455: my $line_nr = shift;
! 41456:
! 41457: die "stack not an array ref" unless (ref($stack) eq "ARRAY");
! 41458: my $cline = $original_line;
! 41459: #msg_debug("SCAN_LINE (@{$state->{'command_stack'}}): $original_line", $line_nr);
! 41460: #dump_stack($text, $stack, $state);
! 41461: my $new_menu_entry; # true if there is a new menu entry
! 41462: # my $menu_description_in_format; # true if we are in a menu description
! 41463: # # but in another format section (@table....)
! 41464:
! 41465: # this can happen currently with quotations
! 41466: if (defined($state->{'prepend_text'}))
! 41467: {
! 41468: $cline = $state->{'prepend_text'} . $cline;
! 41469: $state->{'prepend_text'} = undef;
! 41470: delete $state->{'prepend_text'};
! 41471: }
1.1 noro 41472:
1.3 ! takayama 41473: if (!$state->{'raw'} and !$state->{'verb'} and ($state->{'menu'} or $state->{'direntry'}))
! 41474: { # new menu entry
! 41475: my ($node, $name, $ending, $remaining) = parse_menu_entry($cline);
! 41476: if (defined($node))
! 41477: {
! 41478: $cline = $remaining;
! 41479: print STDERR "# Potential menu entry: $node\n" if ($T2H_DEBUG & $DEBUG_MENU);
! 41480: $new_menu_entry = 1;
! 41481: my $menu_entry = { 'name' => $name, 'node' => $node, 'ending' => $ending };
! 41482: # in SIMPLE_MENU case we don't begin a description, description is
! 41483: # just some normal (preformatted) text
! 41484: if ($Texi2HTML::Config::SIMPLE_MENU)
! 41485: {
! 41486: add_prev ($text, $stack, do_menu_link($state, $line_nr, $menu_entry));
! 41487: #dump_stack($text, $stack, $state);
! 41488: }
! 41489: else
! 41490: {
! 41491: # close description and comment, if they are opened.
! 41492: #dump_stack($text, $stack, $state);
! 41493: if (!close_menu_comment($text, $stack, $state, __("new menu entry"), $line_nr)
! 41494: and !close_menu_description($text, $stack, $state, __("new menu entry"), $line_nr)
! 41495: and $state->{'preformatted'})
! 41496: {
! 41497: close_paragraph($text, $stack, $state, __("new menu entry"), $line_nr);
! 41498: }
! 41499: print STDERR "# New menu entry: $node\n" if ($T2H_DEBUG & $DEBUG_MENU);
! 41500: #dump_stack($text, $stack, $state);
! 41501: my $fusionned_description = 0;
! 41502: # fusionned looks better in preformatted. But some formats
! 41503: # want to always distinguish link and description
! 41504: if ($Texi2HTML::Config::SEPARATE_DESCRIPTION or !$state->{'preformatted'})
! 41505: {
! 41506: add_prev ($text, $stack, do_menu_link($state, $line_nr, $menu_entry));
! 41507: }
! 41508: else
! 41509: {
! 41510: $fusionned_description = 1;
! 41511: }
! 41512: push @$stack, {'format' => 'menu_description', 'text' => '', 'menu_entry' => $menu_entry, 'fusionned_description' => $fusionned_description};
! 41513: $state->{'code_style'}++ if ($Texi2HTML::Config::format_code_style{'menu_description'});
! 41514: if ($fusionned_description)
! 41515: {
! 41516: begin_paragraph($stack, $state) if $state->{'preformatted'};
! 41517: add_prev ($text, $stack, do_menu_link($state, $line_nr, $menu_entry));
! 41518: }
! 41519: }
! 41520: }
! 41521: # we may be in a menu entry description, we close it
! 41522: # if there is an empty line, so the last arg is $cline.
! 41523: # also if right in menu we always open a menu_comment, it
! 41524: # means that there was no menu entry seen since the menu beginning.
! 41525: if (!$new_menu_entry and (close_menu_description($text, $stack, $state, "end menu description", $line_nr, $cline) or ($stack->[-1]->{'format'} and $format_type{$stack->[-1]->{'format'}} and $format_type{$stack->[-1]->{'format'}} eq 'menu')))
! 41526: {
! 41527: if ($state->{'preformatted'})
! 41528: {
! 41529: begin_paragraph($stack, $state);
! 41530: }
! 41531: else
! 41532: {
! 41533: # only start a menu_comment if right in menu and not in
! 41534: # a format below a menu because if not right
! 41535: # in a menu we have no way to distinguish a menu_comment
! 41536: # and some normal text in the format.
! 41537: # also it is not started in preformatted environment
! 41538: begin_format($text, $stack, $state, 'menu_comment', $cline, $line_nr) if ($stack->[-1]->{'format'} and $format_type{$stack->[-1]->{'format'}} and $format_type{$stack->[-1]->{'format'}} eq 'menu');
! 41539: }
! 41540: }
! 41541: }
1.1 noro 41542:
1.3 ! takayama 41543: unless ($state->{'raw'} or $state->{'verb'} or $state->{'keep_texi'})
! 41544: {
! 41545: # first the line commands are taken into account
! 41546: my $next_command = next_tag($cline);
! 41547: if (defined($next_command) and defined($Texi2HTML::Config::line_command_map{$next_command}))
! 41548: {
! 41549: close_paragraph($text, $stack, $state, "\@$next_command", $line_nr, 1) if (stop_paragraph_command($next_command));
! 41550: my $arg_texi = $cline;
! 41551: $arg_texi =~ s/^\s*\@$next_command\s*//;
! 41552: $arg_texi = trim_comment_spaces ($arg_texi, "\@$next_command", $line_nr);
! 41553: my $arg_line = substitute_line($arg_texi, "\@$next_command", duplicate_formatting_state($state));
! 41554: add_prev ($text, $stack, &$Texi2HTML::Config::line_command($next_command, $arg_line, $arg_texi, $state));
! 41555: enter_author_command ($next_command, $arg_texi, $arg_line, $stack, $state, $line_nr);
! 41556: return '';
! 41557: }
! 41558: elsif (defined($next_command) and ($next_command eq 'contents') or ($next_command eq 'summarycontents') or ($next_command eq 'shortcontents'))
! 41559: {
! 41560: my $element_tag = $next_command;
! 41561: $element_tag = 'shortcontents' if ($element_tag ne 'contents');
! 41562: # at that point the content_element is defined for sure since
! 41563: # we already saw the tag
! 41564: if ($Texi2HTML::Config::INLINE_CONTENTS and !Texi2HTML::Config::get_conf('set' . $element_tag . 'aftertitlepage'))
! 41565: {
! 41566: my $content_element = shift (@{$all_content_elements{$element_tag}});
! 41567: my $toc_lines = &$Texi2HTML::Config::inline_contents($Texi2HTML::THISDOC{'FH'}, $element_tag, $content_element, \@sections_list);
! 41568: add_prev ($text, $stack, join('',@$toc_lines)) if (defined($toc_lines));
! 41569: }
! 41570: return '' unless (exists($Texi2HTML::Config::misc_command{$next_command}) and $Texi2HTML::Config::misc_command{$next_command}->{'keep'});
! 41571: }
! 41572:
! 41573: # The commands to ignore are ignored now in case after ignoring them
! 41574: # there is an empty line, to be able to stop the paragraph
! 41575: #my $leading_spaces = '';
! 41576:
! 41577: while (1)
! 41578: {
! 41579: my $next_tag = next_tag($cline);
! 41580: close_paragraph($text, $stack, $state, "\@$next_tag", $line_nr, 1) if (stop_paragraph_command($next_tag));
! 41581: if (defined($next_tag) and defined($Texi2HTML::Config::misc_command{$next_tag}) and !$Texi2HTML::Config::misc_command{$next_tag}->{'keep'})
! 41582: {
! 41583: $cline =~ s/^(\s*)\@$next_tag//;
! 41584: #$leading_spaces .= $1;
! 41585: add_prev ($text, $stack, do_text($1, $state));
! 41586: my $result;
! 41587: ($cline, $result) = misc_command_text($cline, $next_tag, $stack, $state, $text, $line_nr);
! 41588: add_prev($text, $stack, $result) if (defined($result));
! 41589: }
! 41590: else
! 41591: {
! 41592: last;
! 41593: }
! 41594: }
! 41595: #add_prev ($text, $stack, $leading_spaces);
! 41596: return '' if (!defined($cline) or $cline eq '');
1.1 noro 41597: }
1.3 ! takayama 41598: my $top_stack = top_stack($stack);
! 41599: if (($top_stack->{'format'} and $top_stack->{'format'} eq 'menu_description') or $state->{'raw'} or $state->{'preformatted'} or $state->{'no_paragraph'} or $state->{'keep_texi'} or $state->{'remove_texi'})
! 41600: { # empty lines are left unmodified in these contexts.
! 41601: # it is also possible to be in preformatted within a menu_description
! 41602: if ($cline =~ /^\s*$/)
! 41603: {
! 41604: if ($state->{'raw'})
! 41605: {
! 41606: print STDERR "#within raw $state->{'raw'}(empty line):$cline" if ($T2H_DEBUG & $DEBUG_FORMATS);
! 41607: add_prev($text, $stack, $cline);
! 41608: }
! 41609: else
! 41610: {
! 41611: add_prev($text, $stack, do_text($cline,$state));
! 41612: }
! 41613: return;
! 41614: }
1.1 noro 41615: }
1.3 ! takayama 41616: else
! 41617: {
! 41618: if ($cline =~ /^\s*$/)
! 41619: {
! 41620: if ($state->{'paragraph_context'})
! 41621: { # An empty line ends a paragraph
! 41622: close_paragraph($text, $stack, $state, __("paragraph end"), $line_nr);
! 41623: }
! 41624: add_prev($text, $stack, &$Texi2HTML::Config::empty_line($cline,$state));
! 41625: return 1;
! 41626: }
! 41627: else
! 41628: {
! 41629: if (!no_paragraph($state,$cline))
! 41630: { # open a paragraph, unless the line begins with a macro that
! 41631: # shouldn't trigger a paragraph opening
! 41632: begin_paragraph($stack, $state);
! 41633: }
! 41634: }
1.1 noro 41635: }
1.3 ! takayama 41636: # we flag specially deff_item and table line that contain only
! 41637: # inter_item_command, which typically is be @c, @comment, @*index, such
! 41638: # that the formatter can treat those specifically.
! 41639: my $top_format = top_stack($stack,2);
! 41640: if ($top_format->{'only_inter_commands'} and !$state->{'keep_texi'})
! 41641: {
! 41642: my $real_format = $top_format->{'format_ref'}->{'format'};
! 41643: my $next_tag = next_tag($cline);
! 41644: $next_tag = '' if (!defined($next_tag));
! 41645: my $next_end_tag = next_end_tag($cline);
! 41646: $next_end_tag = '' if (!defined($next_end_tag));
! 41647: #msg_debug("$top_format->{'format'} $next_tag, end $next_end_tag :::$cline");
! 41648: delete $top_format->{'only_inter_commands'} unless
! 41649: (
! 41650: $Texi2HTML::Config::inter_item_commands{$next_tag} or
! 41651: (index_command_prefix($next_tag) ne '' and $Texi2HTML::Config::inter_item_commands{'cindex'}) or
! 41652: ($top_format->{'format'} eq 'deff_item' and "${real_format}x" eq $next_tag) or
! 41653: ($top_format->{'format'} ne 'deff_item' and $next_tag =~ /^itemx?$/) or
! 41654: ( $next_end_tag eq $real_format )
! 41655: );
! 41656: #print STDERR "STILL $top_format->{'only_inter_commands'}\n" if ($top_format->{'only_inter_commands'});
1.1 noro 41657: }
1.3 ! takayama 41658:
! 41659: while(1)
! 41660: {
! 41661: # scan_line
! 41662: #print STDERR "WHILE(l): $cline|";
! 41663: #msg_debug("Dump stack in scan_line", $line_nr);
! 41664: #dump_stack($text, $stack, $state);
! 41665: # we're in a raw format (html, tex if !L2H, verbatim)
! 41666: if (defined($state->{'raw'}))
! 41667: {
! 41668: (dump_stack($text, $stack, $state), die "Bug for raw ($state->{'raw'})") if (! @$stack or ! ($stack->[-1]->{'style'} eq $state->{'raw'}));
! 41669: if ($state->{'raw'} eq 'macro')
! 41670: {
! 41671: if ($cline =~ /^\s*\@macro\s+(\w[\w-]*)\s*(.*)/)
! 41672: {
! 41673: $state->{$state->{'raw'}}++;
! 41674: }
! 41675: }
! 41676: # macro_regexp
! 41677: if ($cline =~ /^(.*?)\@end\s([a-zA-Z][\w-]*)/o and ($2 eq $state->{'raw'}))
! 41678: # don't protect html, it is done by Texi2HTML::Config::raw if needed
! 41679: {
! 41680: $cline =~ s/^(.*?)(\@end\s$state->{'raw'})//;
! 41681: my $remaining = $1;
! 41682: my $end_text = $2;
! 41683: if ($state->{'raw'} eq 'macro')
! 41684: {
! 41685: $state->{$state->{'raw'}}--;
! 41686: if ($state->{$state->{'raw'}})
! 41687: {
! 41688: add_prev ($text, $stack, $remaining.$end_text);
! 41689: last;
! 41690: }
! 41691: }
! 41692: check_bad_end_argument ($state->{'raw'}, $cline, $line_nr);
! 41693: add_prev ($text, $stack, $remaining);
! 41694: my $style = pop @$stack;
! 41695: if ($style->{'text'} !~ /^\s*$/)
! 41696: {
! 41697: if ($state->{'keep_texi'})
! 41698: {
! 41699: add_prev ($text, $stack, $style->{'text'} . "\@end $state->{'raw'}");
! 41700: }
! 41701: elsif ($state->{'remove_texi'})
! 41702: {
! 41703: add_prev ($text, $stack, &$Texi2HTML::Config::raw_no_texi($style->{'style'}, $style->{'text'}));
! 41704: }
! 41705: else
! 41706: {
! 41707: add_prev($text, $stack, &$Texi2HTML::Config::raw($style->{'style'}, $style->{'text'}, $line_nr));
! 41708: }
! 41709: }
! 41710: if (!$state->{'keep_texi'} and !$state->{'remove_texi'})
! 41711: {
! 41712: # reopen preformatted if it was interrupted by the raw format
! 41713: # if raw format is html the preformatted wasn't interrupted
! 41714: begin_paragraph($stack, $state) if ($state->{'preformatted'} and (!$Texi2HTML::Config::format_in_paragraph{$state->{'raw'}}));
! 41715: delete $state->{'raw'};
! 41716: return if ($cline =~ /^\s*$/);
! 41717: }
! 41718: delete $state->{'raw'};
! 41719: return if (($cline =~ /^\s*$/) and $state->{'remove_texi'});
! 41720: next;
! 41721: }
! 41722: else
! 41723: {
! 41724: print STDERR "#within raw $state->{'raw'}:$cline" if ($T2H_DEBUG & $DEBUG_FORMATS);
! 41725: add_prev ($text, $stack, $cline);
! 41726: last;
! 41727: }
! 41728: }
! 41729:
! 41730: # we are within a @verb
! 41731: if (defined($state->{'verb'}))
! 41732: {
! 41733: my $char = quotemeta($state->{'verb'});
! 41734: if ($cline =~ s/^(.*?)$char\}/\}/)
! 41735: {
! 41736: if ($state->{'keep_texi'})
! 41737: {
! 41738: add_prev($text, $stack, $1 . $state->{'verb'});
! 41739: $stack->[-1]->{'text'} = $state->{'verb'} . $stack->[-1]->{'text'};
! 41740: }
! 41741: else
! 41742: {
! 41743: add_prev($text, $stack, do_text($1, $state));
! 41744: }
! 41745: delete $state->{'verb'};
! 41746: next;
! 41747: }
! 41748: else
! 41749: {
! 41750: add_prev($text, $stack, $cline);
! 41751: last;
! 41752: }
! 41753: }
! 41754:
! 41755: # We handle now the end tags
! 41756: # macro_regexp
! 41757: if ($cline =~ s/^([^{}@]*)\@end\s+([a-zA-Z][\w-]*)//)
! 41758: {
! 41759: my $end_tag = $2;
! 41760: my $prev_text = $1;
! 41761: if ($state->{'keep_texi'})
! 41762: {
! 41763: add_prev($text, $stack, $prev_text . "\@end $end_tag");
! 41764: next;
! 41765: }
! 41766: elsif ($state->{'remove_texi'})
! 41767: {
! 41768: add_prev($text, $stack, $prev_text);
! 41769: next;
! 41770: }
! 41771:
! 41772: add_prev($text, $stack, do_text($prev_text, $state));
! 41773: #print STDERR "END_MACRO $end_tag\n";
! 41774: #dump_stack ($text, $stack, $state);
! 41775:
! 41776: # First we test if the stack is not empty.
! 41777: # Then we test if the end tag is a format tag.
! 41778: # We then close paragraphs and preformatted at top of the stack.
! 41779: # We handle the end tag (even when it was not the tag which appears
! 41780: # on the top of the stack; in that case we close anything
! 41781: # until that element)
! 41782: my $top_stack = top_stack($stack);
! 41783: if (!$top_stack)
! 41784: {
! 41785: line_error (sprintf(__("Unmatched `%c%s'"), ord('@'), 'end'), $line_nr);
! 41786: add_prev($text, $stack, "\@end $end_tag");
! 41787: next;
! 41788: }
! 41789:
! 41790: if (!$format_type{$end_tag})
! 41791: {
! 41792: line_warn ("Unknown \@end $end_tag", $line_nr);
! 41793: add_prev($text, $stack, "\@end $end_tag");
! 41794: next;
! 41795: }
! 41796: check_bad_end_argument ($end_tag, $cline, $line_nr);
! 41797: if (!close_menu_description($text, $stack, $state, "\@end $end_tag", $line_nr))
! 41798: {
! 41799: close_paragraph($text, $stack, $state, "\@end $end_tag", $line_nr);
! 41800: }
! 41801:
! 41802: $top_stack = top_stack($stack);
! 41803: if (!$top_stack or (!defined($top_stack->{'format'})))
! 41804: {
! 41805: line_error (sprintf(__("Unmatched `%c%s'"), ord('@'), 'end'), $line_nr);
! 41806: add_prev($text, $stack, "\@end $end_tag");
! 41807: dump_stack ($text, $stack, $state) if ($T2H_DEBUG);
! 41808: next;
! 41809: }
! 41810: # Warn if the format on top of stack is not compatible with the
! 41811: # end tag, and find the end tag.
! 41812: unless (
! 41813: ($top_stack->{'format'} eq $end_tag)
! 41814: or
! 41815: (
! 41816: $format_type{$end_tag} eq 'menu' and
! 41817: $top_stack->{'format'} eq 'menu_comment'
! 41818: ) or
! 41819: (
! 41820: $end_tag eq 'multitable' and $top_stack->{'format'} eq 'cell'
! 41821: ) or
! 41822: (
! 41823: $format_type{$end_tag} eq 'list' and $top_stack->{'format'} eq 'item'
! 41824: ) or
! 41825: (
! 41826: $format_type{$end_tag} eq 'table'
! 41827: and
! 41828: ($top_stack->{'format'} eq 'term' or $top_stack->{'format'} eq 'line')
! 41829: ) or
! 41830: (
! 41831: defined($Texi2HTML::Config::def_map{$end_tag}) and
! 41832: $top_stack->{'format'} eq 'deff_item'
! 41833: )
! 41834: )
! 41835: {
! 41836: # this is not the right format. We try to close other
! 41837: # formats to find the format we are searching for.
! 41838: # First we close paragraphs, as with a wrong $end_format
! 41839: # they may not be closed properly.
! 41840:
! 41841: #print STDERR " MISMATCH got $top_stack->{'format'} waited \@end $end_tag($top_stack->{'format'})\n";
! 41842: #dump_stack ($text, $stack, $state);
! 41843: close_paragraph($text, $stack, $state, "\@end $end_tag", $line_nr);
! 41844: $top_stack = top_stack($stack);
! 41845: if (!$top_stack or (!defined($top_stack->{'format'})))
! 41846: {
! 41847: line_error (sprintf(__("Unmatched `%c%s'"), ord('@'), 'end'), $line_nr);
! 41848: add_prev($text, $stack, "\@end $end_tag");
! 41849: # at that point the dump_stack is not very useful, since
! 41850: # close_paragraph above may hide interesting info
! 41851: dump_stack ($text, $stack, $state) if ($T2H_DEBUG);
! 41852: next;
! 41853: }
! 41854: my $waited_format = $top_stack->{'format'};
! 41855: $waited_format = $fake_format{$top_stack->{'format'}} if ($format_type{$top_stack->{'format'}} eq 'fake');
! 41856: if ($end_tag ne $waited_format)
! 41857: {
! 41858: line_error (sprintf(__("`\@end' expected `%s', but saw `%s'"), $waited_format, $end_tag), $line_nr);
! 41859: }
! 41860: else
! 41861: {
! 41862: msg_debug ("\@end is $end_tag, was waiting for $top_stack->{'format'}", $line_nr);
! 41863: dump_stack ($text, $stack, $state);
! 41864: }
! 41865: close_stack($text, $stack, $state, $line_nr, $end_tag);
! 41866: # FIXME this is too complex
! 41867: # an empty preformatted may appear when closing things as
! 41868: # when closed, formats reopen the preformatted environment
! 41869: # in case there is some text following, but we know it isn't
! 41870: # the case here, thus we can close paragraphs.
! 41871: close_paragraph($text, $stack, $state, "\@end $end_tag");
! 41872: my $new_top_stack = top_stack($stack);
! 41873: next unless ($new_top_stack and defined($new_top_stack->{'format'}) and (($new_top_stack->{'format'} eq $end_tag)
! 41874: or (($format_type{$new_top_stack->{'format'}} eq 'fake') and ($fake_format{$new_top_stack->{'format'}} eq $format_type{$end_tag}))));
! 41875: }
! 41876: # We should now be able to handle the format
! 41877: if (defined($format_type{$end_tag}))
! 41878: {# remove the space or new line following the @end command
! 41879: $cline =~ s/\s//;
! 41880: if (end_format($text, $stack, $state, $end_tag, $line_nr))
! 41881: { # if end_format is false, paragraph is already begun
! 41882: begin_paragraph_after_command($state,$stack,$end_tag,$cline);
! 41883: }
! 41884: }
! 41885: next;
! 41886: }
! 41887: # This is a macro
! 41888: #elsif (s/^([^{}@]*)\@([a-zA-Z]\w*|["'~\@\}\{,\.!\?\s\*\-\^`=:\/])//o)
! 41889: # macro_regexp
! 41890: elsif ($cline =~ s/^([^{},@]*)\@(["'~\@\}\{,\.!\?\s\*\-\^`=:\|\/\\])//o or $cline =~ s/^([^{}@,]*)\@([a-zA-Z][\w-]*)//o)
! 41891: {
! 41892: my $before_macro = $1;
! 41893: my $macro = $2;
! 41894: $macro = $alias{$macro} if (exists($alias{$macro}));
! 41895: my $punct;
! 41896: if (!$state->{'keep_texi'} and $macro eq ':' and $before_macro =~ /(.)$/ and $Texi2HTML::Config::colon_command_punctuation_characters{$1})
! 41897: {
! 41898: $before_macro =~ s/(.)$//;
! 41899: $punct = $1;
! 41900: }
! 41901: add_prev($text, $stack, do_text($before_macro, $state));
! 41902: add_prev($text, $stack, &$Texi2HTML::Config::colon_command($punct)) if (defined($punct));
! 41903: #print STDERR "MACRO $macro\n";
! 41904: #print STDERR "LINE $cline";
! 41905: #dump_stack ($text, $stack, $state);
! 41906:
! 41907: close_paragraph($text, $stack, $state, "\@$macro", $line_nr, 1) if (stop_paragraph_command($macro) and !$state->{'keep_texi'});
! 41908:
! 41909: if ($macro eq 'listoffloats' or $macro eq 'printindex')
! 41910: {
! 41911: if ($state->{'keep_texi'})
! 41912: {
! 41913: if ($cline =~ s/(.*)//o)
! 41914: {
! 41915: add_prev($text, $stack, "\@$macro" . $1);
! 41916: }
! 41917: next;
! 41918: }
! 41919: close_paragraph($text, $stack, $state, "\@$macro", $line_nr);
! 41920: return undef if ($state->{'remove_texi'});
! 41921: if ($macro eq 'listoffloats')
! 41922: {
! 41923: # remove possible comments
! 41924: my $arg = normalise_texi_space(trim_comment_spaces ($cline, "\@$macro", $line_nr));
! 41925:
! 41926: my $style_id = cross_manual_line($arg);
! 41927: my $style = substitute_line (&$Texi2HTML::Config::listoffloats_style($arg), __("\@listoffloats type"), undef, $line_nr);
! 41928: my $style_no_texi = remove_texi (&$Texi2HTML::Config::listoffloats_style($arg));
! 41929: if (exists ($floats{$style_id}))
! 41930: {
! 41931: my @listoffloats_entries = ();
! 41932: foreach my $float (@{$floats{$style_id}->{'floats'}})
! 41933: {
! 41934: my $float_style = substitute_line(&$Texi2HTML::Config::listoffloats_float_style($arg, $float), __("\@listoffloats \@float type"));
! 41935: my ($caption_lines, $caption_or_shortcaption) = &$Texi2HTML::Config::listoffloats_caption($float);
! 41936: # we set 'multiple_pass', and 'expansion'
! 41937: # such that index entries
! 41938: # and anchors are not handled one more time;
! 41939: # the caption has already been formatted,
! 41940: # and these have been handled at the right place
! 41941: # FIXME footnotes?
! 41942: my $caption = '';
! 41943: $caption = substitute_text(prepare_state_multiple_pass($macro, $state), undef, "\@$caption_or_shortcaption in listoffloats", @$caption_lines) if (defined($caption_or_shortcaption));
! 41944: push @listoffloats_entries, &$Texi2HTML::Config::listoffloats_entry($arg, $float, $float_style, $caption, href($float, $state->{'element'}->{'file'}, $line_nr));
! 41945: }
! 41946: add_prev($text, $stack, &$Texi2HTML::Config::listoffloats($arg, $style, \@listoffloats_entries));
! 41947: }
! 41948: else
! 41949: {
! 41950: line_warn (sprintf(__("Requested float type `%s' not previously used"), $arg), $line_nr);
! 41951: }
! 41952: }
! 41953: elsif ($macro eq 'printindex' and $cline =~ s/\s+(\w+)\s*//)
! 41954: {
! 41955: my $index_name = $1;
! 41956: my $region = $state->{'region'};
! 41957: $region = 'document' if (!defined($region));
! 41958:
! 41959: if (!defined($Texi2HTML::THISDOC{'indices'}->{$region}))
! 41960: {
! 41961: msg_debug ("\@printindex $index_name THISDOC{'indices'}->{$region} not defined", $line_nr);
! 41962: }
! 41963: elsif (!defined($Texi2HTML::THISDOC{'indices'}->{$region}->{$index_name}))
! 41964: {
! 41965: msg_debug ("\@printindex $index_name THISDOC{'indices'}->{$region}->{$index_name} not defined", $line_nr);
! 41966: }
! 41967:
! 41968: if (!defined($Texi2HTML::THISDOC{'indices_numbers'}->{$region}->{$index_name}))
! 41969: {
! 41970: $Texi2HTML::THISDOC{'indices_numbers'}->{$region}->{$index_name} = -1;
! 41971: }
! 41972: $Texi2HTML::THISDOC{'indices_numbers'}->{$region}->{$index_name}++;
! 41973: my $printindex = $Texi2HTML::THISDOC{'indices'}->{$region}->{$index_name}->[$Texi2HTML::THISDOC{'indices_numbers'}->{$region}->{$index_name}];
! 41974: if (!defined($printindex))
! 41975: {
! 41976: # this printindex hasn't been seen in the previous pass.
! 41977: # rint STDERR "Index $index_name not in sync, number $Texi2HTML::THISDOC{'indices_numbers'}->{$index_name} not defined\n";
! 41978: line_warn("\@printindex $index_name expanded more than once may lead to wrong references", $line_nr);
! 41979: $printindex = $Texi2HTML::THISDOC{'indices'}->{$region}->{$index_name}->[-1];
! 41980: }
! 41981: elsif ($printindex->{'name'} ne $index_name)
! 41982: {
! 41983: print STDERR "BUG: THISDOC{'indices'} $printindex->{'name'} ne $index_name\n";
! 41984: }
! 41985: #print STDERR "PRINTINDEX use($printindex) region $region, name $index_name number $Texi2HTML::THISDOC{'indices_numbers'}->{$region}->{$index_name}\n";
! 41986: add_prev($text, $stack, &$Texi2HTML::Config::printindex($index_name, $printindex));
! 41987: }
! 41988: else
! 41989: {
! 41990: $cline =~ s/^\s*//;
! 41991: chomp ($cline);
! 41992: line_error (sprintf(__("Bad argument to \@%s: %s"), $macro, $cline), $line_nr);
! 41993: }
! 41994: begin_paragraph ($stack, $state) if ($state->{'preformatted'});
! 41995: return undef;
! 41996: }
! 41997: if (defined($Texi2HTML::Config::misc_command{$macro}))
! 41998: {
! 41999: # Handle the misc command
! 42000: my $result;
! 42001: ($cline, $result) = misc_command_text($cline, $macro, $stack, $state, $text, $line_nr);
! 42002: add_prev($text, $stack, $result) if (defined($result));
! 42003: return unless (defined($cline));
! 42004: unless ($Texi2HTML::Config::misc_command{$macro}->{'keep'})
! 42005: {
! 42006: begin_paragraph($stack, $state) if
! 42007: (!no_paragraph($state,$cline));
! 42008: next;
! 42009: }
! 42010: }
! 42011: # This is a @macroname{...} construct. We add it on top of stack
! 42012: # It will be handled when we encounter the '}'
! 42013: # There is a special case for def macros as @deffn{def} is licit
! 42014: if (!$Texi2HTML::Config::def_map{$macro} and $cline =~ s/^{//) #}
! 42015: {
! 42016: if ($macro eq 'verb')
! 42017: {
! 42018: if ($cline =~ /^$/)
! 42019: {
! 42020: # Allready warned
! 42021: }
! 42022: else
! 42023: {
! 42024: $cline =~ s/^(.)//;
! 42025: $state->{'verb'} = $1;
! 42026: }
! 42027: }
! 42028: # currently if remove_texi and anchor/ref/footnote
! 42029: # the text within the command is ignored
! 42030: # see t2h_remove_command in texi2html.init
! 42031: my $new_command_ref = { 'style' => $macro, 'text' => '', 'arg_nr' => 0, 'line_nr' => $line_nr };
! 42032: push (@$stack, $new_command_ref);
! 42033: if ($no_paragraph_macro{$macro})
! 42034: {
! 42035: $state->{'no_paragraph'}++;
! 42036: push @{$state->{'no_paragraph_stack'}}, "\@$macro";
! 42037: }
! 42038: open_arg($macro, 0, $state);
! 42039: if ($state->{'keep_texi'})
! 42040: {
! 42041: $new_command_ref->{'keep_line_nr'} = [ $line_nr ];
! 42042: }
! 42043: my $real_style_command = 0;
! 42044: if (defined($style_type{$macro}) and (($style_type{$macro} eq 'style') or ($style_type{$macro} eq 'accent')))
! 42045: {
! 42046: push (@{$state->{'command_stack'}}, $macro);
! 42047: $real_style_command = 1;
! 42048: #print STDERR "# Stacked $macro (@{$state->{'command_stack'}})\n" if ($T2H_DEBUG);
! 42049: }
! 42050: # FIXME give line, and modify line?
! 42051: &$Texi2HTML::Config::begin_style_texi($macro, $state, $stack, $real_style_command, $state->{'remove_texi'})
! 42052: if (defined($Texi2HTML::Config::begin_style_texi)
! 42053: and !($state->{'keep_texi'}));
! 42054: next;
! 42055: }
! 42056:
! 42057: # special case if we are checking itemize line. In that case
! 42058: # we want to make sure that there is no @item on the @itemize
! 42059: # line, otherwise it will be added on the front of another @item,
! 42060: # leading to an infinite loop...
! 42061:
! 42062: if ($state->{'check_item'} and ($macro =~ /^itemx?$/ or $macro eq 'headitem'))
! 42063: {
! 42064: line_error(sprintf(__("\@%s not allowed in argument to \@%s"), $macro, $state->{'check_item'}), $line_nr);
! 42065: next;
! 42066: }
! 42067:
! 42068: # if we're keeping texi unmodified we can do it now
! 42069: if ($state->{'keep_texi'})
! 42070: {
! 42071: # We treat specially formats accepting {} on command line
! 42072: if ($macro eq 'multitable' or defined($Texi2HTML::Config::def_map{$macro}) or defined($sec2level{$macro}) or $macro eq 'macro')
! 42073: {
! 42074: add_prev($text, $stack, "\@$macro" . $cline);
! 42075: $cline = '';
! 42076: next;
! 42077: }
! 42078:
! 42079: add_prev($text, $stack, "\@$macro");
! 42080: if ($Texi2HTML::Config::texi_formats_map{$macro} and $Texi2HTML::Config::texi_formats_map{$macro} eq 'raw')
! 42081: {
! 42082: $state->{'raw'} = $macro;
! 42083: $state->{$macro}++ if ($macro eq 'macro');
! 42084: push (@$stack, {'style' => $macro, 'text' => ''});
! 42085: }
! 42086: next;
! 42087: }
! 42088:
! 42089: # If we are removing texi, the following macros are not removed
! 42090: # as is but modified. So they are collected first, as if we were
! 42091: # in normal text
! 42092:
! 42093: # a raw macro beginning
! 42094: if ($Texi2HTML::Config::texi_formats_map{$macro} and $Texi2HTML::Config::texi_formats_map{$macro} eq 'raw')
! 42095: {
! 42096: if (!$Texi2HTML::Config::format_in_paragraph{$macro})
! 42097: { # close paragraph before verbatim (and tex if !L2H)
! 42098: close_paragraph($text, $stack, $state, "\@$macro", $line_nr);
! 42099: }
! 42100: $state->{'raw'} = $macro;
! 42101: push (@$stack, {'style' => $macro, 'text' => ''});
! 42102: $state->{$macro}++ if ($macro eq 'macro');
! 42103: return if ($cline =~ /^\s*$/ or ($macro eq 'macro'));
! 42104: next;
! 42105: }
! 42106: my $simple_macro = 1;
! 42107: # An accent macro
! 42108: if (exists($Texi2HTML::Config::accent_map{$macro}))
! 42109: {
! 42110: # the command itself is not in the command stack, since with
! 42111: # braces, it is already popped when do_simple is called
! 42112: #push (@{$state->{'command_stack'}}, $macro);
! 42113: if ($macro =~ /^[a-zA-Z]/)
! 42114: {
! 42115: $cline =~ s/^\s*//;
! 42116: }
! 42117: elsif ($cline =~ /^\s/)
! 42118: {
! 42119: line_warn (sprintf(__("Accent command `\@%s' must not be followed by whitespace"), $macro), $line_nr);
! 42120: }
! 42121: if ($cline =~ /^\@/)
! 42122: {
! 42123: line_error (sprintf(__("Use braces to give a command as an argument to \@%s"), $macro), $line_nr);
! 42124: }
! 42125: if ($cline =~ s/^(\S)//o)
! 42126: {
! 42127: add_prev($text, $stack, do_style_command($macro, $1, $state, [ $1 ], $line_nr, undef, undef, undef));
! 42128: }
! 42129: else
! 42130: { # The accent is at end of line
! 42131: # FIXME warn? And test case? Maybe this is catched
! 42132: # above, by "Accent command `@%s' must not be followed by whitespace"
! 42133: # for commands with letter.
! 42134: add_prev($text, $stack, do_text($macro, $state));
! 42135: }
! 42136: #pop @{$state->{'command_stack'}};
! 42137: }
! 42138: # an @-command which should be like @command{}. We handle it...
! 42139: elsif ($::things_map_ref->{$macro})
! 42140: {
! 42141: line_error (sprintf(__("\@%s expected braces"), $macro), $line_nr);
! 42142: add_prev($text, $stack, do_thing_command($macro, '', $state, $line_nr));
! 42143: }
! 42144: # an @-command like @command
! 42145: elsif (defined($::simple_map_ref->{$macro}) or ($state->{'math_style'} and defined($::simple_map_math_ref->{$macro})))
! 42146: {
! 42147: add_prev($text, $stack, do_simple_command($macro, $state, $line_nr));
! 42148: }
! 42149: else
! 42150: {
! 42151: $simple_macro = 0;
! 42152: }
! 42153: if ($simple_macro)
! 42154: {# if the macro didn't triggered a paragraph start it might now
! 42155: begin_paragraph($stack, $state) if
! 42156: ($Texi2HTML::Config::no_paragraph_commands{$macro} and !no_paragraph($state,$cline));
! 42157: next;
! 42158: }
! 42159: # the following macros are modified or ignored if we are
! 42160: # removing texi, and they are not handled like macros in normal text
! 42161: if ($state->{'remove_texi'})
! 42162: {
! 42163: # handle specially some macros
! 42164: if ((index_command_prefix($macro) ne '') or
! 42165: ($macro eq 'itemize') or
! 42166: ($format_type{$macro} and ($format_type{$macro} eq 'table' or $format_type{$macro} eq 'quotation'))
! 42167: or ($macro eq 'multitable'))
! 42168: {
! 42169: return;
! 42170: }
! 42171: elsif ($macro eq 'enumerate')
! 42172: {
! 42173: my $spec;
! 42174: ($cline, $spec) = parse_enumerate ($cline);
! 42175: return if ($cline =~ /^\s*$/);
! 42176: next;
! 42177: }
! 42178: elsif (defined($Texi2HTML::Config::def_map{$macro}))
! 42179: {
! 42180: my ($command, $style, $category, $name, $type, $class, $arguments, $args_array);
! 42181: ($command, $style, $category, $name, $type, $class, $arguments, $args_array) = parse_def($macro, $cline, $line_nr);
! 42182: # FIXME -- --- ''... lead to simple text in texi2html
! 42183: # while they are kept as is in html coments by makeinfo
! 42184: $category = remove_texi($category) if (defined($category));
! 42185: $name = remove_texi($name) if (defined($name));
! 42186: $type = remove_texi($type) if (defined($type));
! 42187: $class = remove_texi($class) if (defined($class));
! 42188: $arguments = remove_texi($arguments) if (defined($arguments));
! 42189: chomp($arguments);
! 42190: add_prev($text, $stack, &$Texi2HTML::Config::def_line_no_texi($category, $name, $type, $arguments));
! 42191: return;
! 42192: }
! 42193: elsif (defined($sec2level{$macro}))
! 42194: { #FIXME there is certainly more intelligent stuff to do
! 42195: my $num;
! 42196: if ($state->{'region'})
! 42197: {
! 42198: $state->{'head_num'}++;
! 42199: $num = "$state->{'region'}_$state->{'head_num'}";
! 42200: }
! 42201: else
! 42202: {
! 42203: $num = $global_head_num;
! 42204: }
! 42205: my $heading_element = $headings{$num};
! 42206: $cline = trim_comment_spaces ($cline, "\@$macro");
! 42207: add_prev($text, $stack, &$Texi2HTML::Config::heading_no_texi($heading_element, $macro, $cline));
! 42208: return;
! 42209: }
! 42210:
! 42211: # ignore other macros
! 42212: next;
! 42213: }
! 42214:
! 42215: # handle the other macros, we are in the context of normal text
! 42216: if (defined($sec2level{$macro}))
! 42217: {
! 42218: #dump_stack($text, $stack, $state);
! 42219: my $num;
! 42220: if ($state->{'region'})
! 42221: {
! 42222: $state->{'head_num'}++;
! 42223: $num = "$state->{'region'}_$state->{'head_num'}";
! 42224: }
! 42225: else
! 42226: {
! 42227: $global_head_num++;
! 42228: $num = $global_head_num;
! 42229: }
! 42230: my $heading_element = $headings{$num};
! 42231: $cline = trim_comment_spaces($cline, "\@$macro", $line_nr);
! 42232: add_prev($text, $stack, &$Texi2HTML::Config::element_label($heading_element->{'id'}, $heading_element, $macro, $cline));
! 42233: add_prev($text, $stack, &$Texi2HTML::Config::heading($heading_element, $macro, $cline, substitute_line($cline, "\@$macro"), $state->{'preformatted'}));
! 42234: return;
! 42235: }
! 42236:
! 42237: if (index_command_prefix($macro) ne '')
! 42238: {
! 42239: my $index_name = index_command_prefix($macro);
! 42240: my $entry_texi = trim_comment_spaces($cline, "\@$macro", $line_nr);
! 42241: chomp($entry_texi);
! 42242: # multiple_pass is not really necessary, since it may be the place
! 42243: # where it is expanded once. However, this ensures that things
! 42244: # that are ignored with multiple_pass are ignored.
! 42245: my $entry_text = substitute_line($entry_texi, "\@$macro", prepare_state_multiple_pass($macro, $state));
! 42246: my ($index_entry, $formatted_index_entry, $index_label) = do_index_entry_label($macro,$state,$line_nr, $entry_texi);
! 42247:
! 42248: if (defined($index_entry))
! 42249: {
! 42250: msg_debug ("(bug?) Index out of sync `$index_entry->{'texi'}' ne `$entry_texi'", $line_nr) if ($index_entry->{'texi'} ne $entry_texi);
! 42251: }
! 42252: add_prev($text, $stack, &$Texi2HTML::Config::index_entry_command($macro, $index_name, $index_label, $entry_texi, $entry_text, $index_entry));
! 42253: # it eats the end of line and therefore don't start
! 42254: # table entries nor close @center. These should be stopped
! 42255: # on the next line, though.
! 42256: return;
! 42257: }
! 42258: if ($macro eq 'insertcopying')
! 42259: {
! 42260: #close_paragraph($text, $stack, $state, $line_nr);
! 42261: add_prev($text, $stack, do_insertcopying($state, $line_nr));
! 42262: # reopen a preformatted format if it was interrupted by the macro
! 42263: begin_paragraph ($stack, $state) if ($state->{'preformatted'});
! 42264: return;
! 42265: }
! 42266: if ($macro =~ /^itemx?$/o or ($macro eq 'headitem'))
! 42267: {
! 42268: #print STDERR "ITEM: $cline";
! 42269: #dump_stack($text, $stack, $state);
! 42270: abort_empty_preformatted($stack, $state);
! 42271: # FIXME let the user be able not to close the paragraph
! 42272: close_paragraph($text, $stack, $state, "\@$macro", $line_nr);
! 42273:
! 42274: #print STDERR "ITEM after close para: $cline";
! 42275: #dump_stack($text, $stack, $state);
! 42276: # these functions return the format if in the right context
! 42277: my $in_list_enumerate;
! 42278: my $format;
! 42279: if ($format = add_item($text, $stack, $state, $line_nr))
! 42280: { # handle lists
! 42281: $in_list_enumerate = 1;
! 42282: if ($macro ne 'item')
! 42283: {
! 42284: line_error (sprintf(__("\@%s not meaningful inside `\@%s' block"), $macro, $format->{'format'}), $line_nr);
! 42285: }
! 42286: }
! 42287: elsif ($format = add_term($text, $stack, $state, $line_nr))
! 42288: { # close table term
! 42289: }
! 42290: elsif ($format = add_line($text, $stack, $state, $line_nr))
! 42291: { # close table definition
! 42292: }
! 42293: if ($format)
! 42294: {
! 42295: if ($macro eq 'headitem')
! 42296: {
! 42297: line_error (sprintf(__("\@%s not meaningful inside `\@%s' block"), $macro, $format->{'format'}), $line_nr);
! 42298: }
! 42299: if (defined($Texi2HTML::Config::tab_item_texi))
! 42300: {
! 42301: my $resline = &$Texi2HTML::Config::tab_item_texi($macro, $state->{'command_stack'}, $stack, $state, $cline, $line_nr);
! 42302: $cline = $resline if (defined($resline));
! 42303: }
! 42304: if ($in_list_enumerate)
! 42305: {
! 42306: push (@$stack, { 'format' => 'item', 'text' => '', 'format_ref' => $format, 'item_cmd' => $macro });
! 42307: begin_paragraph($stack, $state) if ($state->{'preformatted'} or !no_line($cline));
! 42308: }
! 42309: else
! 42310: {# handle table @item term and restart another one
! 42311: # or after table text restart a term
! 42312: push (@$stack, { 'format' => 'term', 'text' => '', 'format_ref' => $format, 'item_cmd' => $macro });
! 42313: }
! 42314: $format->{'texi_line'} = $cline;
! 42315: my ($line, $open_command) = &$Texi2HTML::Config::format_list_item_texi($format->{'format'}, $cline, $format->{'prepended'}, $format->{'command'}, $format->{'number'});
! 42316: $cline = $line if (defined($line));
! 42317: #if ($open_command)
! 42318: #{
! 42319: # open_arg($format->{'command'},0, $state);
! 42320: # $format->{'command_opened'} = 1;
! 42321: #}
! 42322: $format->{'item_cmd'} = $macro;
! 42323: $format->{'texi_line_texi_formatted'} = $cline;
! 42324: next;
! 42325: }
! 42326: $format = add_row ($text, $stack, $state, $line_nr); # handle multitable
! 42327: if (!$format)
! 42328: { # makeinfo has:
! 42329: # "@%s not meaningful inside `@%s' block" for menu/quotation...
! 42330: # and, if outside of any format
! 42331: # "%c%s found outside of an insertion block"
! 42332: # The following error message seems better.
! 42333: line_error (sprintf(__("\@%s outside of table or list"), $macro), $line_nr);
! 42334: }
! 42335: else
! 42336: {
! 42337: push @$stack, {'format' => 'row', 'text' => '', 'item_cmd' => $macro, 'format_ref' => $format };
! 42338: push @$stack, {'format' => 'cell', 'text' => '', 'format_ref' => $format};
! 42339: $format->{'cell'} = 1;
! 42340: if ($format->{'max_columns'})
! 42341: {
! 42342: if (defined($Texi2HTML::Config::tab_item_texi))
! 42343: {
! 42344: my $resline = &$Texi2HTML::Config::tab_item_texi($macro, $state->{'command_stack'}, $stack, $state, $cline, $line_nr);
! 42345: $cline = $resline if (defined($resline));
! 42346: }
! 42347: begin_paragraph_after_command($state,$stack,$macro,$cline);
! 42348: }
! 42349: else
! 42350: {
! 42351: line_warn (sprintf(__("\@%s in empty multitable"), $macro), $line_nr);
! 42352: }
! 42353: }
! 42354: next;
! 42355: }
! 42356:
! 42357: if ($macro eq 'tab')
! 42358: {
! 42359: abort_empty_preformatted($stack, $state);
! 42360: # FIXME let the user be able not to close the paragraph?
! 42361: close_paragraph($text, $stack, $state, "\@$macro", $line_nr);
! 42362:
! 42363: my $format = add_cell ($text, $stack, $state, $line_nr);
! 42364: if (!$format)
! 42365: {
! 42366: line_error(__("ignoring \@tab outside of multitable"), $line_nr);
! 42367: }
! 42368: else
! 42369: {
! 42370: push @$stack, {'format' => 'cell', 'text' => '', 'format_ref' => $format};
! 42371: if (!$format->{'max_columns'})
! 42372: {
! 42373: line_warn (__("ignoring \@tab in empty multitable"), $line_nr);
! 42374: }
! 42375: elsif ($format->{'cell'} > $format->{'max_columns'})
! 42376: {
! 42377: line_error (sprintf(__("Too many columns in multitable item (max %d)"), $format->{'max_columns'}), $line_nr);
! 42378: }
! 42379: else
! 42380: {
! 42381: if (defined($Texi2HTML::Config::tab_item_texi))
! 42382: {
! 42383: my $resline = &$Texi2HTML::Config::tab_item_texi($macro, $state->{'command_stack'}, $stack, $state, $cline, $line_nr);
! 42384: $cline = $resline if (defined($resline));
! 42385: }
! 42386: }
! 42387: }
! 42388: begin_paragraph_after_command($state,$stack,$macro,$cline);
! 42389: next;
! 42390: }
! 42391: # Macro opening a format (table, list, deff, example...)
! 42392: if ($format_type{$macro} and ($format_type{$macro} ne 'fake'))
! 42393: {
! 42394: my $ignore_center = 0;
! 42395: # @center is forbidden in @-command with braces, @*table
! 42396: # @item line, @multitable, or another @center
! 42397: if ($macro eq 'center' and @$stack)
! 42398: {
! 42399: my $top_stack = top_stack($stack, 1);
! 42400: if (exists($top_stack->{'style'}) or (defined($top_stack->{'format'}) and ($top_stack->{'format'} eq 'term' or $top_stack->{'format'} eq 'cell')) or $state->{'preformatted'} or $state->{'paragraph_style'}->[-1] eq 'center')
! 42401: {
! 42402: $ignore_center = 1;
! 42403: }
! 42404: #dump_stack ($text, $stack, $state);
! 42405: }
! 42406: if ($ignore_center)
! 42407: {
! 42408: line_error(__("\@center should not appear in another format"), $line_nr);
! 42409: }
! 42410: else
! 42411: {
! 42412: $cline = begin_format($text, $stack, $state, $macro, $cline, $line_nr);
! 42413: }
! 42414: # we keep the end of line for @center, and for formats
! 42415: # that have cmd_line opened and need to see the end of line
! 42416: next if (($macro eq 'center') or
! 42417: (defined($Texi2HTML::Config::def_map{$macro}))
! 42418: or ($macro eq 'float') or ($format_type{$macro} eq 'quotation'));
! 42419: return if ($cline =~ /^\s*$/);
! 42420: next;
! 42421: }
! 42422: $cline = do_unknown (2, $macro, $cline, $text, $stack, $state, $line_nr);
! 42423: next;
! 42424: }
! 42425: elsif($cline =~ s/^([^{}@,]*)\@([^\s\}\{\@]*)//o)
! 42426: { # A macro with a character which shouldn't appear in macro name
! 42427: add_prev($text, $stack, do_text($1, $state));
! 42428: $cline = do_unknown (2, $2, $cline, $text, $stack, $state, $line_nr);
! 42429: next;
! 42430: }
! 42431: # a brace
! 42432: elsif ($cline =~ s/^([^{},]*)([{}])//o)
! 42433: {
! 42434: my $leading_text = $1;
! 42435: my $brace = $2;
! 42436: add_prev($text, $stack, do_text($leading_text, $state));
! 42437: if (defined($brace) and ($brace eq '{')) #'}'
! 42438: {
! 42439: add_prev($text, $stack, do_text('{',$state)); #}
! 42440: if ($state->{'math_style'})
! 42441: {
! 42442: $state->{'math_brace'}++;
! 42443: }
! 42444: else
! 42445: {
! 42446: unless ($state->{'keep_texi'} or $state->{'remove_texi'})
! 42447: {
! 42448: line_error (sprintf(__("Misplaced %c"), ord('{')), $line_nr);
! 42449: }
! 42450: }
! 42451: }
! 42452: elsif (defined($brace) and ($brace eq '}') and
! 42453: (!@$stack or (!defined($stack->[-1]->{'style'}))
! 42454: # braces are allowed in math
! 42455: or $state->{'math_brace'}))
! 42456: {
! 42457: if ($state->{'keep_texi'})
! 42458: {
! 42459: add_prev($text, $stack, '}');
! 42460: }
! 42461: elsif($state->{'math_style'} and $state->{'math_brace'})
! 42462: {
! 42463: add_prev($text, $stack, do_text('}',$state));
! 42464: $state->{'math_brace'}--;
! 42465: }
! 42466: else
! 42467: {
! 42468: line_error (sprintf(__("Misplaced %c"), ord('}')), $line_nr);
! 42469: #dump_stack($text, $stack, $state);
! 42470: }
! 42471: }
! 42472: else
! 42473: { # A @-command{ ...} is closed
! 42474: my ($result, $command) = close_style_command($text, $stack, $state, $line_nr, $cline);
! 42475: add_prev($text, $stack, $result);
! 42476: if ($Texi2HTML::Config::no_paragraph_commands{$command}
! 42477: and !$state->{'keep_texi'} and !no_paragraph($state,$cline))
! 42478: {
! 42479: begin_paragraph($stack, $state);
! 42480: }
! 42481: }
! 42482: }
! 42483: elsif ($cline =~ s/^([^,]*)[,]//o)
! 42484: {
! 42485: add_prev($text, $stack, do_text($1, $state));
! 42486: if (@$stack and defined($stack->[-1]->{'style'})
! 42487: and (ref($::style_map_ref->{$stack->[-1]->{'style'}}) eq 'HASH'))
! 42488: {
! 42489: my $macro = $stack->[-1]->{'style'};
! 42490: my $style_args = $::style_map_ref->{$macro}->{'args'};
! 42491: if (defined($style_args->[$stack->[-1]->{'arg_nr'} + 1]))
! 42492: {
! 42493: push (@{$stack->[-1]->{'args'}}, $stack->[-1]->{'text'});
! 42494: $stack->[-1]->{'fulltext'} .= $stack->[-1]->{'text'} . do_text(',', $state);
! 42495: $stack->[-1]->{'text'} = '';
! 42496: close_arg ($macro, $stack->[-1]->{'arg_nr'}, $state);
! 42497: $stack->[-1]->{'arg_nr'}++;
! 42498: open_arg ($macro, $stack->[-1]->{'arg_nr'}, $state);
! 42499: next;
! 42500: }
! 42501: }
! 42502: add_prev($text, $stack, do_text(',', $state));
! 42503: }
! 42504: else
! 42505: { # no macro nor '}', but normal text
! 42506: add_prev($text, $stack, do_text($cline, $state));
! 42507: # @center/line term is closed at the end of line. When a
! 42508: # @-command which
! 42509: # keeps the texi as is happens on the @center line, the @center
! 42510: # is closed at the end of line appearing after the @-command
! 42511: # closing (for example @ref, @footnote).
! 42512: last if ($state->{'keep_texi'});
! 42513: #print STDERR "END_LINE(l):$cline!!!\n";
! 42514: #dump_stack($text, $stack, $state);
! 42515: my $maybe_format_to_close = 1;
! 42516: my $in_table;
! 42517: while ($maybe_format_to_close)
! 42518: {
! 42519: $maybe_format_to_close = 0;
! 42520: #my $top_format = top_stack($stack, 1);
! 42521: my $top_format = top_stack($stack, 2);
! 42522: # the stack cannot easily be used, because there may be
! 42523: # opened commands in paragraphs if the center is in a
! 42524: # style command, like
! 42525: # @b{
! 42526: # bold
! 42527: #
! 42528: # @center centered bold
! 42529: #
! 42530: # }
! 42531: #
! 42532: # Therefore $state->{'paragraph_style'}->[-1] is used.
! 42533: #
! 42534: # The close_stack until 'center' is needed because
! 42535: # of constructs like
! 42536: #
! 42537: # @center something @table
! 42538: #
! 42539: # In that case what would be removed from the stack after
! 42540: # paragraph closing wold not be the @center. Such construct
! 42541: # is certainly incorrect, though.
! 42542: #
! 42543: # when 'closing_center' is true we don't retry to close
! 42544: # the @center line.
! 42545: if ($state->{'paragraph_style'}->[-1] eq 'center'
! 42546: and !$state->{'closing_center'} and !$state->{'keep_texi'})
! 42547: {
! 42548: $state->{'closing_center'} = 1;
! 42549: close_paragraph($text, $stack, $state, "\@center", $line_nr);
! 42550: close_stack($text, $stack, $state, $line_nr, 'center');
! 42551: delete $state->{'closing_center'};
! 42552: my $center = pop @$stack;
! 42553: add_prev($text, $stack, &$Texi2HTML::Config::paragraph_style_command('center',$center->{'text'}));
! 42554: my $top_paragraph_style = pop @{$state->{'paragraph_style'}};
! 42555:
! 42556: # center is at the bottom of the comand_stack because it
! 42557: # may be nested in many way
! 42558: my $bottom_command_stack = shift @{$state->{'command_stack'}};
! 42559: print STDERR "Bug: closing center, top_paragraph_style: $top_paragraph_style, bottom_command_stack: $bottom_command_stack.\n"
! 42560: if ($bottom_command_stack ne 'center' or $top_paragraph_style ne 'center');
! 42561: $maybe_format_to_close = 1;
! 42562: next;
! 42563: }
! 42564:
! 42565: # @item line is closed by end of line. In general there should
! 42566: # not be a paragraph in a term. However it may currently
! 42567: # happen in construct like
! 42568: #
! 42569: # @table @asis
! 42570: # @item @cindex index entry
! 42571: # some text still in term, and in paragraph
! 42572: # Not in term anymore
! 42573: # ....
! 42574: #
! 42575: if (defined($top_format->{'format'}) and $top_format->{'format'} eq 'term')
! 42576: {
! 42577: #close_paragraph($text, $stack, $state, $line_nr)
! 42578: # if ($state->{'paragraph_context'});
! 42579: close_stack($text, $stack, $state, $line_nr, 'term');
! 42580: $in_table = add_term($text, $stack, $state, $line_nr);
! 42581: if ($in_table)
! 42582: {
! 42583: $maybe_format_to_close = 1;
! 42584: next;
! 42585: }
! 42586: }
! 42587: }
! 42588: if ($in_table)
! 42589: {
! 42590: push (@$stack, { 'format' => 'line', 'text' => '', 'only_inter_commands' => 1, 'format_ref' => $in_table });
! 42591: begin_paragraph($stack, $state) if ($state->{'preformatted'});
! 42592: }
! 42593: last;
! 42594: }
1.1 noro 42595: }
1.3 ! takayama 42596: return 1;
! 42597: } # end scan_line
1.1 noro 42598:
1.3 ! takayama 42599: sub open_arg($$$)
! 42600: {
! 42601: my $macro = shift;
! 42602: my $arg_nr = shift;
! 42603: my $state = shift;
! 42604: if (ref($::style_map_ref->{$macro}) eq 'HASH')
! 42605: {
! 42606: my $arg = $::style_map_ref->{$macro}->{'args'}->[$arg_nr];
! 42607: if ($arg eq 'keep')
! 42608: {
! 42609: $state->{'keep_nr'}++;
! 42610: $state->{'keep_texi'} = 1;
! 42611: }
! 42612: elsif (!$state->{'keep_texi'})
! 42613: {
! 42614: if ($arg eq 'code')
! 42615: {
! 42616: $state->{'code_style'}++;
! 42617: }
! 42618: elsif ($arg eq 'math')
! 42619: {
! 42620: $state->{'math_style'}++;
! 42621: $state->{'code_style'}++;
! 42622: if ($state->{'math_style'} == 1)
! 42623: {
! 42624: $state->{'math_brace'} = 0;
! 42625: }
! 42626: }
! 42627: }
! 42628: }
! 42629: elsif ($code_style_map{$macro} and !$state->{'keep_texi'})
! 42630: {
! 42631: $state->{'code_style'}++;
1.1 noro 42632: }
42633: }
42634:
1.3 ! takayama 42635: sub close_arg($$$)
! 42636: {
! 42637: my $macro = shift;
! 42638: my $arg_nr = shift;
! 42639: my $state = shift;
! 42640: if (ref($::style_map_ref->{$macro}) eq 'HASH')
! 42641: {
! 42642: my $arg = $::style_map_ref->{$macro}->{'args'}->[$arg_nr];
! 42643: if ($arg eq 'keep')
! 42644: {
! 42645: $state->{'keep_nr'}--;
! 42646: $state->{'keep_texi'} = 0 if ($state->{'keep_nr'} == 0);
! 42647: }
! 42648: elsif (!$state->{'keep_texi'})
! 42649: {
! 42650: if ($arg eq 'code')
! 42651: {
! 42652: $state->{'code_style'}--;
! 42653: }
! 42654: elsif ($arg eq 'math')
! 42655: {
! 42656: $state->{'math_style'}--;
! 42657: $state->{'code_style'}--;
! 42658: }
! 42659: }
! 42660: #print STDERR "c $arg_nr $macro $arg $state->{'code_style'}\n";
1.1 noro 42661: }
1.3 ! takayama 42662: elsif ($code_style_map{$macro} and !$state->{'keep_texi'})
! 42663: {
! 42664: $state->{'code_style'}--;
1.1 noro 42665: }
42666: }
42667:
1.3 ! takayama 42668: # add a special style on the top of the stack. This is used for commands
! 42669: # that extend until the end of the line. Also add an entry in the @-command
! 42670: # hashes for this fakes style.
! 42671: #sub open_cmd_line($$$$$)
! 42672: #{
! 42673: # my $command = shift;
! 42674: # my $stack = shift;
! 42675: # my $state = shift;
! 42676: # my $args = shift;
! 42677: # my $function = shift;
! 42678: # push @$stack, {'style' => 'cmd_line', 'text' => '', 'arg_nr' => 0};
! 42679: # foreach my $hash (\%Texi2HTML::Config::style_map, \%Texi2HTML::Config::style_map_pre, \%Texi2HTML::Config::style_map_texi, \%Texi2HTML::Config::simple_format_style_map_texi)
! 42680: # {
! 42681: # $hash->{'cmd_line'}->{'args'} = $args;
! 42682: # $hash->{'cmd_line'}->{'function'} = $function;
! 42683: # }
! 42684: # $state->{'no_paragraph'}++;
! 42685: # push @{$state->{'no_paragraph_stack'}}, "\@$command line";
! 42686: ## $state->{'cmd_line'} = 1;
! 42687: # open_arg ('cmd_line', 0, $state);
! 42688: #}
! 42689:
! 42690: # finish @item line in @*table
! 42691: sub add_term($$$$)
! 42692: {
! 42693: my $text = shift;
! 42694: my $stack = shift;
! 42695: my $state = shift;
! 42696: my $line_nr = shift;
! 42697:
! 42698: my $top_format = top_stack($stack,2);
! 42699:
! 42700: return unless (defined($top_format->{'format'}) and $top_format->{'format'} eq 'term');
! 42701: #print STDERR "ADD_TERM\n";
! 42702:
! 42703: my $term = pop @$stack;
! 42704: my $format = $stack->[-1];
! 42705: $format->{'paragraph_number'} = 0;
! 42706: chomp ($term->{'text'});
! 42707:
! 42708: my ($index_label, $formatted_index_entry);
! 42709: if ($format->{'format'} =~ /^(f|v)/o)
! 42710: {
! 42711: my $index_entry;
! 42712: ($index_entry, $formatted_index_entry, $index_label) = do_index_entry_label($format->{'format'}, $state,$line_nr, $format->{'texi_line'});
! 42713: print STDERR "Bug: no index entry for $term->{'text'}\n" unless defined($index_label);
! 42714: }
1.1 noro 42715:
1.3 ! takayama 42716: my $item_result = &$Texi2HTML::Config::table_item($term->{'text'}, $index_label,$format->{'format'},$format->{'command'}, $state->{'command_stack'}, $term->{'item_cmd'}, $formatted_index_entry);
! 42717: add_prev($text, $stack, $item_result);
! 42718: return $format;
! 42719: }
1.1 noro 42720:
1.3 ! takayama 42721: sub add_row($$$$)
! 42722: {
! 42723: my $text = shift;
! 42724: my $stack = shift;
! 42725: my $state = shift;
! 42726: my $line_nr = shift;
! 42727:
! 42728: my $top_format = top_stack($stack);
! 42729: # @center a @item
! 42730: # will lead to row not being closed since a close paragraph doesn't
! 42731: # end the center.
! 42732: return unless (defined($top_format->{'format'}) and $top_format->{'format'} eq 'cell');
! 42733: my $cell = $top_format;
! 42734: my $format = $stack->[-3];
! 42735: print STDERR "Bug under row cell row not a multitable\n" if (!defined($format->{'format'}) or $format->{'format'} ne 'multitable');
! 42736: #print STDERR "ADD_ROW $format->{'item_nr'} first: $format->{'first'}\n";
! 42737: # dump_stack($text, $stack, $state);
! 42738:
! 42739: $format->{'item_nr'}++ unless ($format->{'first'});
! 42740: my $empty_first;
! 42741: if ($format->{'first'} and $format->{'cell'} == 1 and $stack->[-1]->{'text'} =~ /^\s*$/)
! 42742: {
! 42743: $empty_first = 1;
! 42744: $format->{'empty_first'} = 1;
! 42745: }
! 42746: if ($format->{'cell'} > $format->{'max_columns'} or $empty_first)
! 42747: {
! 42748: my $cell = pop @$stack;
! 42749: print STDERR "Bug: not a cell ($cell->{'format'}) in multitable\n" if ($cell->{'format'} ne 'cell');
1.1 noro 42750: }
1.3 ! takayama 42751: else
! 42752: {
! 42753: add_cell($text, $stack, $state);
1.1 noro 42754: }
1.3 ! takayama 42755: my $row = pop @$stack;
! 42756: print STDERR "Bug: not a row ($row->{'format'}) in multitable\n" if ($row->{'format'} ne 'row');
! 42757: if ($format->{'max_columns'} and !$empty_first)
! 42758: {
! 42759: # FIXME have the cell count in row and not in table. table could have
! 42760: # the whole structure, but cell count doesn't make much sense
! 42761: add_prev($text, $stack, &$Texi2HTML::Config::row($row->{'text'}, $row->{'item_cmd'}, $format->{'columnfractions'}, $format->{'prototype_row'}, $format->{'prototype_lengths'}, $format->{'max_columns'}, $cell->{'only_inter_commands'}, $format->{'first'}));
1.1 noro 42762: }
1.3 ! takayama 42763:
! 42764: $format->{'first'} = 0 if ($format->{'first'});
! 42765:
! 42766: return $format;
1.1 noro 42767: }
42768:
1.3 ! takayama 42769: # FIXME remove and merge, too much double checks and code
! 42770: sub add_cell($$$$)
! 42771: {
! 42772: my $text = shift;
! 42773: my $stack = shift;
! 42774: my $state = shift;
! 42775: my $line_nr = shift;
! 42776: my $top_format = top_stack($stack);
! 42777:
! 42778: #print STDERR "ADD_CELL\n";
! 42779: return unless (defined($top_format) and $top_format->{'format'} eq 'cell');
! 42780: # print STDERR "ADD_CELL, really\n";
! 42781:
! 42782: my $cell = pop @$stack;
! 42783: my $row = top_stack($stack);
! 42784: print STDERR "Bug: top_stack of cell not a row\n" if (!defined($row->{'format'}) or ($row->{'format'} ne 'row'));
! 42785: my $format = $stack->[-2];
! 42786: print STDERR "Bug under cell row not a multitable\n" if (!defined($format->{'format'}) or $format->{'format'} ne 'multitable');
! 42787:
! 42788: if ($format->{'first'} and $format->{'cell'} == 1)
! 42789: {
! 42790: line_warn(__("\@tab before \@item"), $line_nr);
! 42791: }
1.1 noro 42792:
1.3 ! takayama 42793: if ($format->{'cell'} <= $format->{'max_columns'})
! 42794: {
! 42795: #print STDERR "ADD_CELL, really, really\n";
! 42796: add_prev($text, $stack, &$Texi2HTML::Config::cell($cell->{'text'}, $row->{'item_cmd'}, $format->{'columnfractions'}, $format->{'prototype_row'}, $format->{'prototype_lengths'}, $format->{'max_columns'}, $cell->{'only_inter_commands'}, $format->{'first'}));
! 42797: }
! 42798: $format->{'cell'}++;
! 42799: $format->{'first'} = 0 if ($format->{'first'});
! 42800: return $format;
! 42801: }
1.1 noro 42802:
1.3 ! takayama 42803: sub add_line($$$$)
! 42804: {
! 42805: my $text = shift;
! 42806: my $stack = shift;
! 42807: my $state = shift;
! 42808: my $line_nr = shift;
! 42809: my $top_stack = top_stack($stack);
! 42810:
! 42811: # if there is something like
! 42812: # @center centered @item new item
! 42813: # the item isn't opened since it is in @center, and center isn't closed
! 42814: # by an @item appearing here (unlike a paragraph).
! 42815: # the error message is '@item outside of table or list'.
! 42816: # texi2dvi also has issue, but makeinfo is happy, however it
! 42817: # produces bad nesting.
! 42818: return unless(defined($top_stack->{'format'}) and $top_stack->{'format'} eq 'line');
! 42819: #print STDERR "ADD_LINE\n";
! 42820: #dump_stack($text, $stack, $state);
! 42821:
! 42822: my $line = pop @$stack;
! 42823: my $format = $stack->[-1];
! 42824: $format->{'paragraph_number'} = 0;
! 42825: if ($format->{'first'})
! 42826: {
! 42827: $format->{'first'} = 0;
! 42828: # we must have <dd> or <dt> following <dl> thus we do a
! 42829: # &$Texi2HTML::Config::table_line here too, although it could have
! 42830: # been a normal paragraph.
! 42831: if ($line->{'text'} =~ /\S/o)
! 42832: {
! 42833: add_prev($text, $stack, &$Texi2HTML::Config::table_line($line->{'text'}, $line->{'only_inter_commands'}, 1));
! 42834: $format->{'empty_first'} = 1 if ($line->{'only_inter_commands'});
! 42835: }
! 42836: else
! 42837: {
! 42838: $format->{'empty_first'} = 1;
! 42839: }
1.1 noro 42840: }
1.3 ! takayama 42841: else
! 42842: {
! 42843: $format->{'item_nr'}++;
! 42844: add_prev($text, $stack, &$Texi2HTML::Config::table_line($line->{'text'}, $line->{'only_inter_commands'}, 0));
1.1 noro 42845: }
1.3 ! takayama 42846: return $format;
1.1 noro 42847: }
42848:
1.3 ! takayama 42849: # finish @enumerate or @itemize @item
! 42850: sub add_item($$$$)
! 42851: {
! 42852: my $text = shift;
! 42853: my $stack = shift;
! 42854: my $state = shift;
! 42855: my $line_nr = shift;
! 42856:
! 42857: my $top_stack = top_stack($stack);
! 42858:
! 42859: return unless (defined($top_stack->{'format'}) and $top_stack->{'format'} eq 'item');
! 42860: #print STDERR "ADD_ITEM: \n";
! 42861: #dump_stack($text, $stack, $state);
! 42862: # as in pre the end of line are kept, we must explicitely abort empty
! 42863: # preformatted, close_stack doesn't do that.
! 42864: my $item = pop @$stack;
! 42865: my $format = $stack->[-1];
! 42866: #my $item_command = $item->{'format'};
! 42867: my $item_command = $item->{'item_cmd'};
! 42868: # first has no associated item, it is more like a 'title'
! 42869: $item_command = '' if ($format->{'first'});
! 42870:
! 42871: # debug message if it is the first item (much like a title) although
! 42872: # there is an item command.
! 42873: msg_debug("First in $format->{'format'} but item_cmd defined $item->{'item_cmd'}",$line_nr) if ($format->{'first'} and defined($item->{'item_cmd'}));
! 42874:
! 42875: $format->{'paragraph_number'} = 0;
! 42876:
! 42877: #dump_stack ($text, $stack, $state);
! 42878: # the element following ol or ul must be li. Thus even though there
! 42879: # is no @item we put a normal item.
! 42880: # don't do an item if it is the first and it is empty
! 42881: if (!$format->{'first'} or ($item->{'text'} =~ /\S/o))
! 42882: {
! 42883: my $formatted_command;
! 42884: if (defined($format->{'command'}) and $format->{'command'} ne '')# and exists($::things_map_ref->{$format->{'command'}}))
! 42885: {
! 42886: $formatted_command = substitute_line("\@$format->{'command'}\{\}", "\@item \@$format->{'command'}", duplicate_formatting_state($state));
! 42887: $format->{'formatted_command'} = $formatted_command;
! 42888: }
! 42889: #chomp($item->{'text'});
! 42890: add_prev($text, $stack, &$Texi2HTML::Config::list_item($item->{'text'},$format->{'format'},$format->{'command'}, $formatted_command, $format->{'item_nr'}, $format->{'spec'}, $format->{'number'}, $format->{'prepended'}, $format->{'prepended_formatted'}, $item->{'only_inter_commands'}, $format->{'first'},$item_command));
! 42891: }
! 42892: else
! 42893: {
! 42894: $format->{'empty_first'} = 1;
! 42895: }
! 42896: if ($format->{'first'})
! 42897: {
! 42898: $format->{'first'} = 0;
! 42899: }
! 42900: else
! 42901: {
! 42902: $format->{'item_nr'}++;
! 42903: }
! 42904:
! 42905: if ($format->{'format'} eq 'enumerate')
! 42906: {
! 42907: $format->{'number'} = '';
! 42908: my $spec = $format->{'spec'};
! 42909: if ($spec =~ /^[0-9]$/)
! 42910: {
! 42911: $format->{'number'} = $spec + $format->{'item_nr'};
! 42912: }
! 42913: else
! 42914: {
! 42915: my $base_letter = ord('a');
! 42916: $base_letter = ord('A') if (ucfirst($spec) eq $spec);
! 42917:
! 42918: my @letter_ords = decompose(ord($spec) - $base_letter + $format->{'item_nr'}, 26);
! 42919: foreach my $ord (@letter_ords)
! 42920: {# FIXME we go directly to 'ba' after 'z', and not 'aa'
! 42921: #because 'ba' is 1,0 and 'aa' is 0,0.
! 42922: $format->{'number'} = chr($base_letter + $ord) . $format->{'number'};
! 42923: }
! 42924: }
! 42925: }
1.1 noro 42926:
1.3 ! takayama 42927: return $format;
! 42928: }
1.1 noro 42929:
1.3 ! takayama 42930: # format ``simple'' macros, that is macros without arg or style macros
! 42931: sub do_simple_command($$$)
! 42932: {
! 42933: my $macro = shift;
! 42934: my $state = shift;
! 42935: my $line_nr = shift;
! 42936:
! 42937: #msg_debug ("DO_SIMPLE $macro $args $arg_nr (@$args)", $line_nr) if (defined($args));
! 42938: if ($state->{'remove_texi'})
! 42939: {
! 42940: #print STDERR "DO_SIMPLE remove_texi $macro\n";
! 42941: return $::simple_map_texi_ref->{$macro};
! 42942: }
! 42943: else
! 42944: {
! 42945: return &$Texi2HTML::Config::simple_command($macro, $state->{'preformatted'}, $state->{'math_style'}, $line_nr, $state);
1.1 noro 42946: }
42947: }
42948:
1.3 ! takayama 42949: sub do_thing_command($$$$)
! 42950: {
! 42951: my $macro = shift;
! 42952: my $text = shift;
! 42953: my $state = shift;
! 42954: my $line_nr = shift;
! 42955:
! 42956: if ($state->{'remove_texi'})
! 42957: {
! 42958: return $::texi_map_ref->{$macro}.$text;
! 42959: #print STDERR "DO_SIMPLE remove_texi texi_map $macro\n";
! 42960: }
! 42961: else
! 42962: {
! 42963: return &$Texi2HTML::Config::thing_command($macro, $text, $state->{'preformatted'}, $state->{'math_style'}, $line_nr, $state);
1.1 noro 42964: }
42965: }
42966:
1.3 ! takayama 42967: sub do_style_command($$$$$$$$)
! 42968: {
! 42969: my $macro = shift;
! 42970: my $text = shift;
! 42971: my $state = shift;
! 42972: my $args = shift;
! 42973: my $line_nr = shift;
! 42974: my $no_open = shift;
! 42975: my $no_close = shift;
! 42976: my $kept_line_nrs = shift;
1.1 noro 42977:
1.3 ! takayama 42978: my $arg_nr = 0;
! 42979: $arg_nr = @$args - 1 if (defined($args));
! 42980:
! 42981: if (defined($::style_map_ref->{$macro}))
! 42982: {
! 42983: my $style;
! 42984: my $result;
! 42985: if ($state->{'remove_texi'})
! 42986: {
! 42987: #print STDERR "REMOVE $macro, $style_map_texi_ref->{$macro}, fun $style_map_texi_ref->{$macro}->{'function'} remove cmd " . \&Texi2HTML::Config::t2h_remove_command . " ascii acc " . \&t2h_default_accent;
! 42988: $style = $::style_map_texi_ref->{$macro};
! 42989: }
! 42990: elsif ($state->{'math_style'} and defined($::style_map_math_ref->{$macro}))
! 42991: { # FIXME we are still in math when the @math is closed here, since
! 42992: # close_arg that does 'math_style'-- is called below.
! 42993: $style = $::style_map_math_ref->{$macro};
! 42994: }
! 42995: elsif ($state->{'preformatted'})
! 42996: {
! 42997: if ($macro eq 'kbd' and (Texi2HTML::Config::get_conf('kbdinputstyle') ne 'distinct'))
! 42998: {
! 42999: $style = $::style_map_pre_ref->{'code'};
! 43000: }
! 43001: else
! 43002: {
! 43003: $style = $::style_map_pre_ref->{$macro};
! 43004: }
! 43005: }
! 43006: else
! 43007: {
! 43008: # kbd is in code_style, so it is 'code_style' > 1
! 43009: if ($macro eq 'kbd' and ((Texi2HTML::Config::get_conf('kbdinputstyle') eq 'code') or ($state->{'code_style'} > 1 and Texi2HTML::Config::get_conf('kbdinputstyle') eq 'example')))
! 43010: {
! 43011: $style = $::style_map_ref->{'code'};
! 43012: }
! 43013: else
! 43014: {
! 43015: $style = $::style_map_ref->{$macro};
! 43016: }
! 43017: }
! 43018: if ($macro eq 'dotless')
! 43019: {
! 43020: if (scalar(@$args) ne 1)
! 43021: {
! 43022: line_error(sprintf(__("%c%s expects a single character `i' or `j' as argument"), ord('@'), $macro), $line_nr);
! 43023: }
! 43024: elsif ($args->[0] ne 'i' and $args->[0] ne 'j')
! 43025: { # FIXME an unformatted arg would have been better. Not a big deal.
! 43026: line_error (sprintf(__("%c%s expects `i' or `j' as argument, not `%s'"), ord('@'), $macro, $args->[0]), $line_nr);
! 43027: }
! 43028: }
! 43029: if (defined($style))
! 43030: { # known style
! 43031: $result = &$Texi2HTML::Config::style($style, $macro, $text, $args, $no_close, $no_open, $line_nr, $state, $state->{'command_stack'}, $kept_line_nrs);
! 43032: }
! 43033: if (!$no_close)
! 43034: {
! 43035: close_arg($macro,$arg_nr, $state);
! 43036: }
! 43037: return $result;
! 43038: }
! 43039: elsif ($macro =~ /^special_(\w+)_(\d+)$/o)
! 43040: {
! 43041: my $style = $1;
! 43042: my $count = $2;
! 43043:
! 43044: msg_debug ("Bug? text in \@$macro not empty", $line_nr) if ($text ne '');
! 43045: if (defined($Texi2HTML::Config::command_handler{$style}) and
! 43046: defined($Texi2HTML::Config::command_handler{$style}->{'expand'}))
! 43047: {
! 43048: my $struct_count = 1+ $special_commands{$style}->{'max'} - $special_commands{$style}->{'count'};
! 43049: # may happen for text expanded more than once, for example
! 43050: # in invalid/tex_in_copying
! 43051: if (($count != $struct_count) and $T2H_DEBUG)
! 43052: {
! 43053: msg_debug ("count $count in \@special $style and structure $struct_count differ", $line_nr);
! 43054: }
! 43055: $special_commands{$style}->{'count'}--;
! 43056: }
! 43057: my $result = $Texi2HTML::Config::command_handler{$style}->{'expand'}
! 43058: ($style,$count,$state,$text);
! 43059: $result = '' if (!defined($result));
! 43060: return $result;
! 43061: }
! 43062: # Unknown macro
! 43063: my $result = '';
! 43064: my ($done, $result_text, $message) = &$Texi2HTML::Config::unknown_style($macro, $text,$state,$no_close, $no_open);
! 43065: if ($done)
! 43066: {
! 43067: line_warn($message, $line_nr) if (defined($message));
! 43068: if (defined($result_text))
! 43069: {
! 43070: $result = $result_text;
! 43071: }
1.1 noro 43072: }
1.3 ! takayama 43073: else
! 43074: {
! 43075: unless ($no_open)
! 43076: { # we warn only if no_open is true, i.e. it is the first time we
! 43077: # close the macro for a multiline macro
! 43078: line_error (sprintf(__("Unknown command with braces `\@%s'"), $macro), $line_nr);
! 43079: $result = do_text("\@$macro") . "{";
! 43080: }
! 43081: $result .= $text;
! 43082: $result .= '}' unless ($no_close);
1.1 noro 43083: }
1.3 ! takayama 43084: return $result;
1.1 noro 43085: }
43086:
1.3 ! takayama 43087: sub do_unknown($$$$$$$)
! 43088: {
! 43089: my $pass = shift;
! 43090: my $macro = shift;
! 43091: my $line = shift;
! 43092: my $text = shift;
! 43093: my $stack = shift;
! 43094: my $state = shift;
! 43095: my $line_nr = shift;
! 43096: #print STDERR "do_unknown[$pass]($macro) ::: $line";
! 43097:
! 43098: my ($result_line, $result, $result_text, $message) = &$Texi2HTML::Config::unknown($macro, $line, $pass, $stack,$state);
! 43099: if ($result)
! 43100: {
! 43101: add_prev ($text, $stack, $result_text) if (defined($result_text));
! 43102: line_warn($message, $line_nr) if (defined($message));
! 43103: # if $state->{'preformatted'}, assume that the preformatted is
! 43104: # already opened. Otherwise we may end up opening one each time
! 43105: # there is an unknown command.
! 43106: begin_paragraph_after_command($state, $stack, $macro, $result_line)
! 43107: if (!$state->{'preformatted'});
! 43108: return $result_line;
! 43109: }
! 43110: elsif ($pass == 2)
! 43111: {
! 43112: if ($Texi2HTML::Config::style_map{$macro})
! 43113: {
! 43114: line_error (sprintf(__("%c%s expected braces"), ord('@'), $macro), $line_nr);
! 43115: }
! 43116: else
! 43117: {
! 43118: line_error (sprintf(__("Unknown command `%s'"), $macro), $line_nr);
! 43119: }
! 43120: add_prev ($text, $stack, do_text("\@$macro"));
! 43121: return $line;
! 43122: }
! 43123: elsif ($pass == 1)
! 43124: {
! 43125: add_prev ($text, $stack, "\@$macro");
! 43126: return $line;
! 43127: }
! 43128: elsif ($pass == 0)
! 43129: {
! 43130: add_prev ($text, $stack, "\@$macro") unless($state->{'ignored'});
! 43131: return $line;
1.1 noro 43132: }
43133: }
43134:
1.3 ! takayama 43135: # used only during @macro processing
! 43136: sub add_text($@)
! 43137: {
! 43138: my $string = shift;
! 43139:
! 43140: return if (!defined($string));
! 43141: foreach my $scalar_ref (@_)
! 43142: {
! 43143: next unless defined($scalar_ref);
! 43144: if (!defined($$scalar_ref))
! 43145: {
! 43146: $$scalar_ref = $string;
! 43147: }
! 43148: else
! 43149: {
! 43150: $$scalar_ref .= $string;
! 43151: }
! 43152: return;
! 43153: }
1.1 noro 43154: }
43155:
1.3 ! takayama 43156: sub add_prev ($$$)
! 43157: {
! 43158: my $text = shift;
! 43159: my $stack = shift;
! 43160: my $string = shift;
! 43161:
! 43162: unless (defined($text) and ref($text) eq "SCALAR")
! 43163: {
! 43164: die "text not a SCALAR ref: " . ref($text) . "";
! 43165: }
! 43166:
! 43167: return if (!defined($string));
! 43168: if (@$stack)
! 43169: {
! 43170: $stack->[-1]->{'text'} .= $string;
! 43171: return;
! 43172: }
1.1 noro 43173:
1.3 ! takayama 43174: if (!defined($$text))
! 43175: {
! 43176: $$text = $string;
1.1 noro 43177: }
1.3 ! takayama 43178: else
! 43179: {
! 43180: $$text .= $string;
1.1 noro 43181: }
43182: }
43183:
1.3 ! takayama 43184: sub close_stack_texi($$$$)
! 43185: {
! 43186: my $text = shift;
! 43187: my $stack = shift;
! 43188: my $state = shift;
! 43189: my $line_nr = shift;
! 43190:
! 43191:
! 43192: return undef unless (@$stack or $state->{'raw'} or $state->{'macro'} or $state->{'macro_name'} or $state->{'ignored'});
1.1 noro 43193:
1.3 ! takayama 43194: if ($state->{'ignored'})
! 43195: {
! 43196: line_error (sprintf(__("Reached eof before matching \@end %s"), $state->{'ignored'}), $line_nr);
! 43197: close_ignored($state, $stack);
1.1 noro 43198: }
43199:
1.3 ! takayama 43200: if ($state->{'macro'})
! 43201: {
! 43202: my ($no_remaining, $result) = end_macro($state, '@end macro', "\n");
! 43203: add_prev ($text, $stack, $result) if (defined($result));
! 43204: line_error (sprintf(__("%cend macro not found"), ord('@')), $line_nr);
! 43205: }
! 43206: elsif ($state->{'macro_name'})
! 43207: {
! 43208: #line_warn ("closing $state->{'macro_name'} ($state->{'macro_depth'} braces missing)", $line_nr);
! 43209: line_error (sprintf(__("\@%s missing close brace"), $state->{'macro_name'}), $line_nr);
! 43210: while ($state->{'macro_name'})
! 43211: {
! 43212: close_macro_arg($state, '', $line_nr);
! 43213: }
! 43214: }
! 43215: elsif ($state->{'verb'})
! 43216: {
! 43217: # warning in next pass
! 43218: #line_warn ("closing \@verb", $line_nr);
! 43219: $stack->[-1]->{'text'} = $state->{'verb'} . $stack->[-1]->{'text'};
! 43220: delete $state->{'verb'};
! 43221: }
! 43222: elsif ($state->{'raw'})
! 43223: {
! 43224: line_error (sprintf(__("Expected \@end %s"), $state->{'raw'}), $line_nr);
! 43225: my $style = pop @$stack;
! 43226: add_prev ($text, $stack, $style->{'text'} . "\@end $state->{'raw'}");
! 43227: delete $state->{'raw'};
! 43228: }
1.1 noro 43229:
1.3 ! takayama 43230: my $stack_level = $#$stack + 1;
! 43231:
! 43232: while ($stack_level--)
! 43233: {
! 43234: my $style = pop(@$stack);
! 43235: # would be better in close_stack_structure
! 43236: #line_warn ("closing \@-command $style->{'style'}", $line_nr) if ($style->{'style'} ne '');
! 43237: close_style_texi($style, $text, $stack, $state, 1);
! 43238: }
! 43239: #$stack = [ ];
1.1 noro 43240: }
43241:
43242:
1.3 ! takayama 43243: sub close_stack_structure($$$$;$)
! 43244: {
! 43245: my $text = shift;
! 43246: my $stack = shift;
! 43247: my $state = shift;
! 43248: my $line_nr = shift;
! 43249: my $close_only_item = shift;
! 43250: $close_only_item = 0 if (!defined($close_only_item));
! 43251:
! 43252: return undef unless (@$stack or $state->{'raw'});
! 43253:
! 43254: #print STDERR "close_stack_structure ($close_only_item)\n";
! 43255: #dump_stack ($text, $stack, $state);
! 43256: my $stack_level = $#$stack + 1;
! 43257: my $string = '';
! 43258:
! 43259: if ($state->{'verb'})
! 43260: {
! 43261: $stack->[-1]->{'text'} = $state->{'verb'} . $stack->[-1]->{'text'};
! 43262: #$string .= $state->{'verb'};
! 43263: }
1.1 noro 43264:
1.3 ! takayama 43265: while ($stack_level--)
! 43266: {
! 43267: last if ($close_only_item and defined($stack->[-1]->{'format'}));
! 43268: my $top_stack = pop @$stack;
! 43269: if ($top_stack->{'format'})
! 43270: {
! 43271: my $format = $top_stack->{'format'};
! 43272: if ($format eq 'index_item')
! 43273: {
! 43274: enter_table_index_entry($text, $stack, $state, $line_nr);
! 43275: }
! 43276: elsif (!defined($format_type{$format}) or ($format_type{$format} ne 'fake'))
! 43277: {
! 43278: end_format_structure($format_type{$format}, $text, $stack, $state, $line_nr, "\n");
! 43279: }
! 43280: }
! 43281: elsif (defined($top_stack->{'style'}))
! 43282: {
! 43283: add_prev($text, $stack,
! 43284: close_structure_command($top_stack, $state, 1, $line_nr));
! 43285: }
! 43286: }
! 43287: #$stack = [ ];
1.1 noro 43288: }
43289:
1.3 ! takayama 43290: # This is used in pass 2 and 3.
! 43291: sub open_region($$)
! 43292: {
! 43293: my $command = shift;
! 43294: my $state = shift;
! 43295: if (!exists($state->{'region_lines'}))
! 43296: {
! 43297: # FIXME 'format' is badly choosen 'region_name' would be much better
! 43298: $state->{'region_lines'}->{'format'} = $command;
! 43299: $state->{'region_lines'}->{'number'} = 1;
! 43300: $state->{'region_lines'}->{'kept_place'} = $state->{'place'};
! 43301: $state->{'place'} = $no_element_associated_place;
! 43302: $state->{'region'} = $command;
! 43303: $state->{'multiple_pass'}++;
! 43304: $state->{'region_pass'} = 1;
! 43305: }
! 43306: else
! 43307: {
! 43308: $state->{'region_lines'}->{'number'}++;
1.1 noro 43309: }
43310: }
43311:
1.3 ! takayama 43312: # close region like @insertcopying, titlepage...
! 43313: # restore $state and delete the structure
! 43314: # This is used in pass 2 and 3.
! 43315: sub close_region($)
! 43316: {
! 43317: my $state = shift;
! 43318: $state->{'place'} = $state->{'region_lines'}->{'kept_place'};
! 43319: $state->{'multiple_pass'}--;
! 43320: delete $state->{'region_lines'}->{'number'};
! 43321: delete $state->{'region_lines'}->{'format'};
! 43322: delete $state->{'region_lines'}->{'kept_place'};
! 43323: delete $state->{'region_lines'};
! 43324: delete $state->{'region'};
! 43325: delete $state->{'region_pass'};
1.1 noro 43326: }
43327:
1.3 ! takayama 43328: # close the stack, closing @-commands and formats left open.
! 43329: # if a $format is given if $format is encountered the closing stops
! 43330: sub close_stack($$$$;$)
! 43331: {
! 43332: my $text = shift;
! 43333: my $stack = shift;
! 43334: my $state = shift;
! 43335: my $line_nr = shift;
! 43336: my $format = shift;
! 43337:
! 43338: #print STDERR "sub_close_stack\n";
! 43339: if (@$stack)
! 43340: {
! 43341: my $stack_level = $#$stack + 1;
! 43342:
! 43343: #debugging
! 43344: #my $print_format = 'NO FORMAT';
! 43345: #$print_format = $format if ($format);
! 43346: #msg_debug ("Close_stack: format $print_format", $line_nr);
! 43347:
! 43348: while ($stack_level--)
! 43349: {
! 43350: if ($stack->[$stack_level]->{'format'})
! 43351: {
! 43352: my $stack_format = $stack->[$stack_level]->{'format'};
! 43353: last if (defined($format) and $stack_format eq $format);
! 43354: # We silently close paragraphs, preformatted sections and fake formats
! 43355: if ($stack_format eq 'paragraph')
! 43356: {
! 43357: my $paragraph = pop @$stack;
! 43358: add_prev ($text, $stack, do_paragraph($paragraph->{'text'}, $state, $stack));
! 43359: }
! 43360: elsif ($stack_format eq 'preformatted')
! 43361: {
! 43362: my $paragraph = pop @$stack;
! 43363: add_prev ($text, $stack, do_preformatted($paragraph->{'text'}, $state, $stack));
! 43364: }
! 43365: else
! 43366: {
! 43367: if ($fake_format{$stack_format})
! 43368: {
! 43369: warn "# Closing a fake format `$stack_format'\n" if ($T2H_VERBOSE);
! 43370: }
! 43371: elsif ($stack_format ne 'center')
! 43372: { # we don't warn for center
! 43373: line_error (sprintf(__("No matching `%cend %s'"), ord('@'), $stack_format), $line_nr);
! 43374: #dump_stack ($text, $stack, $state);
! 43375: }
! 43376: if ($state->{'keep_texi'})
! 43377: {
! 43378: add_prev($text, $stack, "\@end $stack_format");
! 43379: }
! 43380: elsif (!$state->{'remove_texi'})
! 43381: {
! 43382: end_format($text, $stack, $state, $stack_format, $line_nr)
! 43383: unless ($format_type{$stack_format} eq 'fake');
! 43384: }
! 43385: }
! 43386: }
! 43387: else
! 43388: {
! 43389: my $style = $stack->[$stack_level]->{'style'};
! 43390: ########################## debug
! 43391: if (!defined($style))
! 43392: {
! 43393: print STDERR "Bug: style not defined, on stack\n";
! 43394: dump_stack ($text, $stack, $state); # bug
! 43395: }
! 43396: ########################## end debug
! 43397: my $located_line_nr = $line_nr;
! 43398: # use the beginning of the @-command for the error message
! 43399: # line number if available.
! 43400: $located_line_nr = $stack->[$stack_level]->{'line_nr'} if (defined($stack->[$stack_level]->{'line_nr'}));
! 43401: line_error (sprintf(__("%c%s missing close brace"), ord('@'), $style), $located_line_nr);
! 43402: my ($result, $command) = close_style_command($text, $stack, $state, $line_nr, '');
! 43403:
! 43404: add_prev($text, $stack, $result) if (defined($result));
! 43405: }
! 43406: }
! 43407: }
1.1 noro 43408:
1.3 ! takayama 43409: # This tries to avoid cases where the command_stack is not empty
! 43410: # for a good reason, for example when doing a @def formatting the
! 43411: # outside command_stack is preserved. Also when expanding for
! 43412: # example @titleplage or @copying.
! 43413: # FIXME sort out which cases it is.
! 43414: return if ($format or (defined($state->{'multiple_pass'}) and $state->{'multiple_pass'} > 0) or $state->{'no_paragraph'});
! 43415:
! 43416: # The pending style commands are cleared here; And are closed next.
! 43417: delete $state->{'paragraph_macros'};
! 43418: # go through the command_stack and warn for each opened style format
! 43419: # and remove it. Those should be there because there is an opened style
! 43420: # that was stopped by a paragraph
! 43421: my @command_stack = @{$state->{'command_stack'}};
! 43422: @{$state->{'command_stack'}} = ();
! 43423: while (@command_stack)
! 43424: {
! 43425: my $latest_command = pop @command_stack;
! 43426: if (defined($style_type{$latest_command}) and $style_type{$latest_command} ne 'special')
! 43427: {
! 43428: line_error (sprintf(__("%c%s missing close brace"), ord('@'), $latest_command), $line_nr);
! 43429: }
! 43430: else
! 43431: {
! 43432: unshift @{$state->{'command_stack'}}, $latest_command;
! 43433: }
! 43434: }
1.1 noro 43435: }
43436:
1.3 ! takayama 43437: # given a stack and a list of formats, return true if the stack contains
! 43438: # these formats, first on top
! 43439: sub stack_order($@)
! 43440: {
! 43441: my $stack = shift;
! 43442: my $stack_level = $#$stack + 1;
! 43443: while (@_)
! 43444: {
! 43445: my $format = shift;
! 43446: while ($stack_level--)
! 43447: {
! 43448: if ($stack->[$stack_level]->{'format'})
! 43449: {
! 43450: if ($stack->[$stack_level]->{'format'} eq $format)
! 43451: {
! 43452: $format = undef;
! 43453: last;
! 43454: }
! 43455: else
! 43456: {
! 43457: return 0;
! 43458: }
! 43459: }
! 43460: }
! 43461: return 0 if ($format);
! 43462: }
! 43463: return 1;
! 43464: }
1.1 noro 43465:
1.3 ! takayama 43466: sub top_format($)
! 43467: {
! 43468: my $stack = shift;
! 43469: my $stack_level = $#$stack + 1;
! 43470: while ($stack_level--)
! 43471: {
! 43472: if ($stack->[$stack_level]->{'format'} and !$fake_format{$stack->[$stack_level]->{'format'}})
! 43473: {
! 43474: return $stack->[$stack_level];
! 43475: }
1.1 noro 43476: }
1.3 ! takayama 43477: return undef;
1.1 noro 43478: }
43479:
1.3 ! takayama 43480: sub close_paragraph($$$$;$$)
! 43481: {
! 43482: my $text = shift;
! 43483: my $stack = shift;
! 43484: my $state = shift;
! 43485: my $reason = shift;
! 43486: my $line_nr = shift;
! 43487: my $no_preformatted_closing = shift;
! 43488: #print STDERR "CLOSE_PARAGRAPH\n";
! 43489: #dump_stack($text, $stack, $state);
! 43490:
! 43491: # close until the first format,
! 43492: # duplicate stack of styles not closed
! 43493: my $new_stack;
! 43494: my $stack_level = $#$stack + 1;
! 43495:
! 43496: # In general close_paragraph is called because of a end of line, or
! 43497: # a format is opened or closed, or there is a @tab or @item and other
! 43498: # similar cases. In most cases there is a paragraph to be closed or
! 43499: # there are no style opened since most @-commands cause paragraph
! 43500: # opening and those that don't should not lead to a style opening.
! 43501: #
! 43502: # But in term or in @index (and maybe @node, @section, @ref), if
! 43503: # there is a command opened it won't be closed, since it is in
! 43504: # 'no_paragraph'. But @-commands that trigger close_paragraph should not
! 43505: # be called when in those no_paragraph settings.
! 43506:
! 43507: if ($state->{'no_paragraph'})
! 43508: { # This plays the role of "Multiline command %c%s used improperly"
! 43509: line_error(sprintf(__("%s should not appear in %s"), $reason, $state->{'no_paragraph_stack'}->[-1]), $line_nr);
! 43510: }
1.1 noro 43511:
1.3 ! takayama 43512: while ($stack_level--)
! 43513: {
! 43514: last if ($stack->[$stack_level]->{'format'});
! 43515: my $style = $stack->[$stack_level]->{'style'};
! 43516:
! 43517: # the !exists($style_type{$style}) condition catches the unknown
! 43518: # @-commands: by default they are considered as style commands
! 43519: if (!$state->{'no_paragraph'})
! 43520: {
! 43521: if (!exists($style_type{$style}) or $style_type{$style} eq 'style')
! 43522: {
! 43523: unshift @$new_stack, { 'style' => $style, 'text' => '', 'no_open' => 1, 'arg_nr' => 0 };
! 43524: }
! 43525: elsif (($style_type{$style} eq 'simple_style') or ($style_type{$style} eq 'accent'))
! 43526: {
! 43527: }
! 43528: else
! 43529: {
! 43530: # it shouldn't be possible to have 'special' styles, like
! 43531: # images, footnotes, xrefs, anchors, as
! 43532: # close_paragraph shouldn't be called with keep_texi
! 43533: # and when the arguments are expanded, there is a
! 43534: # substitute_line or similar with a new stack.
! 43535: msg_debug("BUG: special $style while closing paragraph", $line_nr);
! 43536: }
! 43537: }
! 43538: # if not in a paragraph, the command is simply closed, and not recorded
! 43539: # in new_stack.
! 43540: my ($result, $command) = close_style_command($text, $stack, $state, $line_nr, '', (!$state->{'no_paragraph'}));
! 43541: add_prev($text, $stack, $result) if (defined($result));
! 43542: }
1.1 noro 43543:
1.3 ! takayama 43544: if (!$state->{'paragraph_context'} and !$state->{'preformatted'} and defined($new_stack) and scalar(@$new_stack))
! 43545: { # in that case the $new_stack isn't recorded in $state->{'paragraph_macros'}
! 43546: # and therefore, it is lost
! 43547: msg_debug ("closing paragraph, but not in paragraph/preformatted, and new_stack not empty", $line_nr);
! 43548: dump_stack($text, $stack, $state);
! 43549: }
! 43550: my $top_stack = top_stack($stack);
! 43551: if ($top_stack and !defined($top_stack->{'format'}))
! 43552: { #debug
! 43553: msg_debug("Bug: no format on top stack", $line_nr);
! 43554: dump_stack($text, $stack, $state);
! 43555: }
! 43556: if ($top_stack and ($top_stack->{'format'} eq 'paragraph'))
! 43557: {
! 43558: my $paragraph = pop @$stack;
! 43559: add_prev($text, $stack, do_paragraph($paragraph->{'text'}, $state, $stack));
! 43560: $state->{'paragraph_macros'} = $new_stack;
! 43561: return 1;
! 43562: }
! 43563: elsif ($top_stack and ($top_stack->{'format'} eq 'preformatted') and !$no_preformatted_closing)
! 43564: {
! 43565: my $paragraph = pop @$stack;
! 43566: add_prev($text, $stack, do_preformatted($paragraph->{'text'}, $state, $stack));
! 43567: $state->{'paragraph_macros'} = $new_stack;
! 43568: return 1;
! 43569: }
! 43570: return;
1.1 noro 43571: }
43572:
1.3 ! takayama 43573: sub abort_empty_preformatted($$)
! 43574: {
! 43575: my $stack = shift;
! 43576: my $state = shift;
! 43577: if (@$stack and $stack->[-1]->{'format'}
! 43578: and ($stack->[-1]->{'format'} eq 'preformatted')
! 43579: and ($stack->[-1]->{'text'} !~ /\S/))
! 43580: {
! 43581: if (defined($Texi2HTML::Config::empty_preformatted))
! 43582: {
! 43583: return if (&$Texi2HTML::Config::empty_preformatted($stack->[-1]->{'text'}));
! 43584: }
! 43585: pop @$stack;
! 43586: }
1.1 noro 43587: }
43588:
1.3 ! takayama 43589: # for debugging
! 43590: sub dump_stack($$$)
! 43591: {
! 43592: my $text = shift;
! 43593: my $stack = shift;
! 43594: my $state = shift;
! 43595:
! 43596: if (defined($$text))
! 43597: {
! 43598: print STDERR "text: $$text\n";
! 43599: }
! 43600: else
! 43601: {
! 43602: print STDERR "text: UNDEF\n";
! 43603: }
! 43604: my $in_remove = 0;
! 43605: my $in_simple_format = 0;
! 43606: my $in_keep = 0;
! 43607: $in_keep = 1 if ($state->{'keep_texi'});
! 43608: if (!$in_keep)
! 43609: {
! 43610: $in_simple_format = 1 if ($state->{'simple_format'});
! 43611: $in_remove = 1 if ($state->{'remove_texi'} and !$in_simple_format);
! 43612: }
! 43613: print STDERR "state[$state](k${in_keep}s${in_simple_format}r${in_remove}): ";
! 43614: foreach my $key (keys(%$state))
! 43615: {
! 43616: my $value = 'UNDEF';
! 43617: $value = $state->{$key} if (defined($state->{$key}));
! 43618: print STDERR "$key: $value " if (!ref($value));
! 43619: }
! 43620: print STDERR "\n";
! 43621: my $stack_level = $#$stack + 1;
! 43622: while ($stack_level--)
! 43623: {
! 43624: print STDERR " $stack_level-> ";
! 43625: foreach my $key (keys(%{$stack->[$stack_level]}))
! 43626: {
! 43627: my $value = 'UNDEF';
! 43628: $value = $stack->[$stack_level]->{$key} if
! 43629: (defined($stack->[$stack_level]->{$key}));
! 43630: print STDERR "$key: $value ";
! 43631: }
! 43632: print STDERR "\n";
! 43633: }
! 43634: if (defined($state->{'command_stack'}))
! 43635: {
! 43636: print STDERR "command_stack: ";
! 43637: foreach my $style (@{$state->{'command_stack'}})
! 43638: {
! 43639: print STDERR "($style) ";
! 43640: }
! 43641: print STDERR "\n";
! 43642: }
! 43643: if (defined($state->{'region_lines'}))
! 43644: {
! 43645: print STDERR "region_lines($state->{'region_lines'}->{'number'}): $state->{'region_lines'}->{'format'}\n";
! 43646: }
! 43647: if (defined($state->{'paragraph_macros'}))
! 43648: {
! 43649: print STDERR "paragraph_macros: ";
! 43650: foreach my $style (@{$state->{'paragraph_macros'}})
! 43651: {
! 43652: print STDERR "($style->{'style'})";
! 43653: }
! 43654: print STDERR "\n";
! 43655: }
! 43656: if (defined($state->{'preformatted_stack'}))
! 43657: {
! 43658: print STDERR "preformatted_stack: ";
! 43659: foreach my $preformatted_style (@{$state->{'preformatted_stack'}})
! 43660: {
! 43661: if ($preformatted_style eq '')
! 43662: {
! 43663: print STDERR ".";
! 43664: next;
! 43665: }
! 43666: my $pre_style = '';
! 43667: $pre_style = $preformatted_style->{'pre_style'} if (exists $preformatted_style->{'pre_style'});
! 43668: my $class = '';
! 43669: $class = $preformatted_style->{'class'} if (exists $preformatted_style->{'class'});
! 43670: my $style = '';
! 43671: $style = $preformatted_style->{'style'} if (exists $preformatted_style->{'style'});
! 43672: print STDERR "($pre_style, $class,$style)";
! 43673: }
! 43674: print STDERR "\n";
! 43675: }
! 43676: if (defined($state->{'text_macro_stack'}) and @{$state->{'text_macro_stack'}})
! 43677: {
! 43678: print STDERR "text_macro_stack: (@{$state->{'text_macro_stack'}})\n";
1.1 noro 43679: }
43680: }
43681:
1.3 ! takayama 43682: # for debugging
! 43683: sub print_elements($)
! 43684: {
! 43685: my $elements = shift;
! 43686: foreach my $elem(@$elements)
! 43687: {
! 43688: if ($elem->{'node'})
! 43689: {
! 43690: print STDERR "node-> $elem ";
! 43691: }
! 43692: else
! 43693: {
! 43694: print STDERR "chap=> $elem ";
! 43695: }
! 43696: foreach my $key (keys(%$elem))
! 43697: {
! 43698: my $value = "UNDEF";
! 43699: $value = $elem->{$key} if (defined($elem->{$key}));
! 43700: print STDERR "$key: $value ";
! 43701: }
! 43702: print STDERR "\n";
1.1 noro 43703: }
43704: }
43705:
1.3 ! takayama 43706: # for debugging
! 43707: sub context_string(;$$$)
! 43708: {
! 43709: my $state = shift;
! 43710: my $line_nr = shift;
! 43711: my $message = shift;
! 43712:
! 43713: $state = $Texi2HTML::THISDOC{'state'}
! 43714: if (!defined($state) and defined($Texi2HTML::THISDOC{'state'}));
! 43715: $line_nr = $Texi2HTML::THISDOC{'line_nr'}
! 43716: if (!defined($line_nr) and defined($Texi2HTML::THISDOC{'line_nr'}));
! 43717: my $result = "Pass $global_pass";
! 43718: my $line_info = ', no line information';
! 43719: $line_info = ' ' .format_line_number($line_nr) if (defined($line_nr));
! 43720: $result .= $line_info;
! 43721: if (!defined($state))
! 43722: {
! 43723: $result .= ', no state information';
! 43724: }
! 43725: else
! 43726: {
! 43727: $result .= ", context $state->{'context'}" if defined($state->{'context'});
! 43728: my $expand = '';
! 43729: if ($state->{'keep_texi'})
! 43730: {
! 43731: $expand .= ' no expansion';
! 43732: }
! 43733: if ($state->{'remove_texi'})
! 43734: {
! 43735: $expand .= ' raw';
! 43736: }
! 43737: if ($state->{'preformatted'})
! 43738: {
! 43739: $expand .= ' preformatted';
! 43740: }
! 43741: if ($state->{'code_style'})
! 43742: {
! 43743: $expand .= " 'code'";
! 43744: }
! 43745: if ($state->{'simple_format'})
! 43746: {
! 43747: $expand .= ' simple';
! 43748: }
! 43749: $expand = ' normal' if (!$expand);
! 43750: $result .= ',' . $expand;
! 43751: if ($state->{'expansion'})
! 43752: {
! 43753: $result .= ", \@$state->{'expansion'}";
! 43754: }
! 43755: if ($state->{'region'})
! 43756: {
! 43757: $result .= ", region $state->{'region'}";
! 43758: }
! 43759: if ($state->{'outside_document'})
! 43760: {
! 43761: $result .= "; out";
! 43762: }
! 43763: if ($state->{'inside_document'})
! 43764: {
! 43765: $result .= "; in";
! 43766: }
! 43767: if ($state->{'multiple_pass'})
! 43768: {
! 43769: $result .= "; multiple $state->{'multiple_pass'}";
! 43770: }
! 43771: if ($state->{'new_state'})
! 43772: {
! 43773: $result .= "; new";
! 43774: }
! 43775: if ($state->{'duplicated'})
! 43776: {
! 43777: $result .= "; duplicated";
! 43778: }
! 43779: }
! 43780: $result .= "(in @{$Texi2HTML::THISDOC{'command_stack'}})"
! 43781: if (defined ($Texi2HTML::THISDOC{'command_stack'}) and @{$Texi2HTML::THISDOC{'command_stack'}});
! 43782: $result .= ' ' .$message if ($message);
! 43783: return $result;
! 43784: }
1.1 noro 43785:
43786:
1.3 ! takayama 43787: my @states_stack = ();
1.1 noro 43788:
1.3 ! takayama 43789: sub push_state($)
! 43790: {
! 43791: my $new_state = shift;
! 43792: push @states_stack, $new_state;
! 43793: $Texi2HTML::THISDOC{'state'} = $new_state;
1.1 noro 43794: }
43795:
1.3 ! takayama 43796: sub pop_state()
! 43797: {
! 43798: pop @states_stack;
! 43799: if (@states_stack)
! 43800: {
! 43801: $Texi2HTML::THISDOC{'state'} = $states_stack[-1];
! 43802: }
! 43803: else
! 43804: {
! 43805: $Texi2HTML::THISDOC{'state'} = undef;
! 43806: }
1.1 noro 43807: }
43808:
1.3 ! takayama 43809: sub substitute_line($$;$$)
! 43810: {
! 43811: my $line = shift;
! 43812: my $context_string = shift;
! 43813: my $state = shift;
! 43814: my $line_nr = shift;
! 43815: $state = {} if (!defined($state));
! 43816: $state->{'no_paragraph'} = 1;
! 43817:
! 43818: if (($state->{'inside_document'} or $state->{'outside_document'}) and (!$state->{'duplicated'} and !$state->{'new_state'}))
! 43819: {
! 43820: msg_debug("substitute_line with main state in: ".var_to_str($context_string), $line_nr);
! 43821: }
! 43822: push @{$state->{'no_paragraph_stack'}}, $context_string;
! 43823: # this is usefull when called from &$I, and also for image files
! 43824: return simple_format($state, [ $line_nr ], $context_string, $line) if ($state->{'simple_format'});
! 43825: return substitute_text($state, [ $line_nr ], $context_string, $line);
1.1 noro 43826: }
43827:
1.3 ! takayama 43828: sub substitute_text($$$@)
! 43829: {
! 43830: my $state = shift;
! 43831: my $line_nrs = shift;
! 43832: my $context = shift;
! 43833: my @stack = ();
! 43834: my $text = '';
! 43835: my $result = '';
! 43836: my $line_nr;
! 43837: if ($state->{'structure'})
! 43838: {
! 43839: initialise_state_structure($state);
! 43840: }
! 43841: elsif ($state->{'texi'})
! 43842: { # only in arg_expansion
! 43843: initialise_state_texi($state);
! 43844: msg_bug("substitute_text, 'texi' true but not 'arg_expansion'") if (!$state->{'arg_expansion'});
! 43845: }
! 43846: else
! 43847: {
! 43848: #print STDERR "FILL_STATE substitute_text ($state->{'preformatted'}): @_\n";
! 43849: if (($state->{'inside_document'} or $state->{'outside_document'}) and (!$state->{'duplicated'} and !$state->{'new_state'}))
! 43850: {
! 43851: msg_debug("substitute_text with main state in: ".var_to_str($context), $line_nr);
! 43852: }
! 43853: fill_state($state);
! 43854: $state->{'context'} = $context;
! 43855: }
! 43856: $state->{'spool'} = [];
! 43857: #print STDERR "SUBST_TEXT ".var_to_str($context)."\n";
! 43858: push_state($state);
1.1 noro 43859:
1.3 ! takayama 43860: my $line_nrs_kept = $Texi2HTML::THISDOC{'line_nr'};
! 43861: $Texi2HTML::THISDOC{'line_nr'} = undef;
! 43862:
! 43863: while (@_ or @{$state->{'spool'}} or $state->{'in_deff_line'})
! 43864: {
! 43865: my $line;
! 43866: if ($line_nrs and @{$line_nrs})
! 43867: {
! 43868: $line_nr = shift @{$line_nrs};
! 43869: $Texi2HTML::THISDOC{'line_nr'} = $line_nr;
! 43870: }
! 43871: if (@{$state->{'spool'}})
! 43872: {
! 43873: $line = shift @{$state->{'spool'}};
! 43874: }
! 43875: else
! 43876: {
! 43877: $line = shift @_;
! 43878: }
! 43879: # msg_debug ("SUBSTITUTE_TEXT $line", $line_nr) if (defined($line_nr));
! 43880: if ($state->{'in_deff_line'})
! 43881: {
! 43882: if (defined($line))
! 43883: {
! 43884: $line = $state->{'in_deff_line'} . $line;
! 43885: }
! 43886: else
! 43887: {
! 43888: $line = $state->{'in_deff_line'};
! 43889: }
! 43890: delete $state->{'in_deff_line'};
! 43891: }
! 43892: else
! 43893: {
! 43894: next unless (defined($line));
! 43895: }
! 43896: #{ my $p_line = $line; chomp($p_line); print STDERR "SUBST_TEXT $p_line\n"; }
! 43897: if ($state->{'structure'})
! 43898: {
! 43899: scan_structure ($line, \$text, \@stack, $state);
! 43900: }
! 43901: elsif ($state->{'texi'})
! 43902: {
! 43903: scan_texi ($line, \$text, \@stack, $state);
! 43904: }
! 43905: else
! 43906: {
! 43907: set_line_nr_in_stack($state, \@stack, $line_nr);
! 43908: scan_line($line, \$text, \@stack, $state, $line_nr);
! 43909: }
! 43910: next if (@stack);
! 43911: $result .= $text;
! 43912: $text = '';
! 43913: }
! 43914: if ($line_nrs and @{$line_nrs})
! 43915: {
! 43916: $line_nr = shift @{$line_nrs};
! 43917: $Texi2HTML::THISDOC{'line_nr'} = $line_nr;
! 43918: }
! 43919: # close stack in substitute_text
! 43920: if ($state->{'texi'})
! 43921: {
! 43922: close_stack_texi(\$text, \@stack, $state, $line_nr);
! 43923: }
! 43924: elsif ($state->{'structure'})
! 43925: {
! 43926: close_stack_structure(\$text, \@stack, $state, $line_nr);
! 43927: }
! 43928: else
! 43929: {
! 43930: close_stack(\$text, \@stack, $state, $line_nr);
1.1 noro 43931: }
1.3 ! takayama 43932: #print STDERR "SUBST_TEXT end\n";
! 43933: pop_state();
! 43934: $Texi2HTML::THISDOC{'line_nr'} = $line_nrs_kept;
! 43935: return $result . $text;
1.1 noro 43936: }
43937:
1.3 ! takayama 43938: sub print_lines($;$)
! 43939: {
! 43940: my ($fh, $lines) = @_;
! 43941: $lines = $Texi2HTML::THIS_SECTION unless $lines;
! 43942: my @cnt;
! 43943: my $cnt;
! 43944: for my $line (@$lines)
! 43945: {
! 43946: print $fh $line;
! 43947: if (defined($Texi2HTML::Config::WORDS_IN_PAGE) and (Texi2HTML::Config::get_conf('SPLIT') eq 'node'))
! 43948: {
! 43949: @cnt = split(/\W*\s+\W*/, $line);
! 43950: $cnt += scalar(@cnt);
! 43951: }
! 43952: }
! 43953: return $cnt;
1.1 noro 43954: }
43955:
1.3 ! takayama 43956: sub do_index_entry_label($$$$;$)
! 43957: {
! 43958: my $command = shift;
! 43959: my $state = shift;
! 43960: my $line_nr = shift;
! 43961: my $entry_texi = shift;
! 43962: # this is only needed for definitions since the whole line is parsed to
! 43963: # reuse get_deff_index.
! 43964: my $line = shift;
! 43965:
! 43966: my $prefix = index_entry_command_prefix($command, $line, $line_nr);
! 43967: my $index_name = $index_prefix_to_name{$prefix};
! 43968:
! 43969: msg_debug("do_index_entry_label($command): Undefined entry_texi", $line_nr)
! 43970: if (!defined($entry_texi));
! 43971: $entry_texi = trim_comment_spaces($entry_texi, "index label in \@$command", $line_nr);
! 43972:
! 43973: # index entries are not entered in special regions
! 43974: my $region = 'document';
! 43975: $region = $state->{'region'} if (defined($state->{'region'}));
! 43976:
! 43977: my $entry;
! 43978: # Can be within a @caption expanded within a listoffloat. In that
! 43979: # case the 2 conditions on state are not set.
! 43980: if (defined($state->{'region'}) or !defined($state->{'expansion'}))
! 43981: {
! 43982: # index entry on a line that is not searched for index entries, like
! 43983: # a @def* line
! 43984: if (!defined($Texi2HTML::THISDOC{'index_entries'}->{$region}) or !defined($Texi2HTML::THISDOC{'index_entries'}->{$region}->{$entry_texi}))
! 43985: {
! 43986: line_warn(sprintf(__("Index entry not caught: `%s' in %s"), $entry_texi, $region), $line_nr);
! 43987: }
! 43988: else
! 43989: {
! 43990: my $entry_ref = $Texi2HTML::THISDOC{'index_entries'}->{$region}->{$entry_texi};
! 43991: # ============================ debug
! 43992: if (!defined($entry_ref->{'entries'}))
! 43993: {
! 43994: msg_debug("BUG, not defined: {'index_entries'}->{$region}->{$entry_texi}->{'entries'}", $line_nr);
! 43995: }
! 43996: # ============================ end debug
! 43997: if (scalar(@{$entry_ref->{'entries'}}) > 1)
! 43998: {
! 43999: if (!defined($entry_ref->{'index'}))
! 44000: {
! 44001: $entry_ref->{'index'} = 0;
! 44002: }
! 44003: $entry = $entry_ref->{'entries'}->[$entry_ref->{'index'}];
! 44004: $entry_ref->{'index'}++;
! 44005: }
! 44006: else
! 44007: {
! 44008: $entry = $entry_ref->{'entries'}->[0];
! 44009: }
! 44010: $entry->{'seen_in_output'} = 1 if (!$state->{'outside_document'});
! 44011: ############################################# debug
! 44012: # verify that the old way of getting index entries (in an array) is
! 44013: # synchronized with the document
! 44014: if (!$state->{'region'})
! 44015: {
! 44016: my $entry_from_array = shift @index_labels;
! 44017: if ($entry_from_array ne $entry)
! 44018: {
! 44019: msg_debug ("entry `$entry->{'texi'}' ne entry_from_array `$entry_from_array->{'texi'}'", $line_nr);
! 44020: }
! 44021: if (!defined($entry_from_array))
! 44022: {
! 44023: mesg_debug ("Not enough index entries !", $line_nr);
! 44024: }
! 44025: }
! 44026: ############################################# end debug
! 44027: }
! 44028: }
! 44029:
! 44030: if (!defined($entry))
! 44031: {
! 44032: # this can happen for listoffloats and caption without being a user
! 44033: # error. Well, in fact, it could be argued that it is indeed a user
! 44034: # error, putting an index entry in a snippet that can be expanded
! 44035: # more than once and is not strictly associated with a node/section.
! 44036:
! 44037: #print STDERR "Entry for index $index_name not gathered in usual places ($region)\n";
! 44038: $entry = {
! 44039: 'command' => $command,
! 44040: 'texi' => $entry_texi,
! 44041: 'entry' => $entry_texi,
! 44042: 'prefix' => $prefix,
! 44043: 'index_name' => $index_name,
! 44044: };
! 44045: $entry->{'key'} = sorted_line($entry_texi);
! 44046: $entry->{'entry'} = '@code{'.$entry->{'entry'}.'}'
! 44047: if (defined($index_name) and
! 44048: defined($index_names{$index_name}->{'prefixes'}) and
! 44049: $index_names{$index_name}->{'prefixes'}->{$prefix}
! 44050: and $entry->{'key'} =~ /\S/);
! 44051: }
1.1 noro 44052:
1.3 ! takayama 44053: ###################################### debug
! 44054: else
! 44055: {
! 44056: if ($entry->{'prefix'} ne $prefix)
! 44057: {
! 44058: msg_debug ("prefix in entry $entry->{'prefix'} ne $prefix from $command", $line_nr);
! 44059: }
1.1 noro 44060: }
44061:
1.3 ! takayama 44062: if ($command ne $entry->{'command'})
! 44063: {
! 44064: # happened with bad texinfo with a line like
! 44065: # @deffn func aaaa args @defvr c--ategory d--efvr_name
! 44066: # now this case is caught above by "Index entry not caught:
! 44067: msg_debug ("($region) Waiting for index cmd \@$entry->{'command'} got \@$command", $line_nr);
! 44068: }
1.1 noro 44069:
1.3 ! takayama 44070: if ($entry->{'texi'} ne $entry_texi)
! 44071: {
! 44072: msg_debug ("Waiting for index `$entry->{'texi'}', got `$entry_texi'", $line_nr);
1.1 noro 44073: }
1.3 ! takayama 44074:
! 44075: my $id = 'no id';
! 44076: $id = $entry->{'id'} if (defined($entry->{'id'}));
! 44077: print STDERR "(index($index_name) $command) [$entry->{'entry'}] $id\n"
! 44078: if ($T2H_DEBUG & $DEBUG_INDEX);
! 44079: ###################################### end debug
! 44080:
! 44081: #return (undef,'','') if ($state->{'region'});
! 44082: if ($entry->{'key'} =~ /^\s*$/)
! 44083: {
! 44084: line_warn(sprintf(__("Empty index entry for \@%s"), $command), $entry->{'line_nr'});
1.1 noro 44085: }
1.3 ! takayama 44086: my $formatted_entry = substitute_line($entry->{'entry'}, "\@$command", prepare_state_multiple_pass("${command}_index", $state),$entry->{'line_nr'});
! 44087: my $formatted_entry_reference = substitute_line($entry->{'texi'}, "\@$command", prepare_state_multiple_pass("${command}_index", $state));
! 44088: return ($entry, $formatted_entry, &$Texi2HTML::Config::index_entry_label ($entry->{'id'}, $state->{'preformatted'}, $formatted_entry,
! 44089: $index_name,
! 44090: $command, $entry->{'texi'}, $formatted_entry_reference,
! 44091: (!$entry->{'seen_in_output'} and defined($entry->{'region'})),$entry));
1.1 noro 44092: }
44093:
1.3 ! takayama 44094: # decompose a decimal number on a given base. The algorithm looks like
! 44095: # the division with growing powers (division suivant les puissances
! 44096: # croissantes) ?
! 44097: sub decompose($$)
! 44098: {
! 44099: my $number = shift;
! 44100: my $base = shift;
! 44101: my @result = ();
! 44102:
! 44103: return (0) if ($number == 0);
! 44104: my $power = 1;
! 44105: my $remaining = $number;
! 44106:
! 44107: while ($remaining)
! 44108: {
! 44109: my $factor = $remaining % ($base ** $power);
! 44110: $remaining -= $factor;
! 44111: push (@result, $factor / ($base ** ($power - 1)));
! 44112: $power++;
! 44113: }
! 44114: return @result;
1.1 noro 44115: }
44116:
1.3 ! takayama 44117: # process a css file
! 44118: sub process_css_file ($$)
! 44119: {
! 44120: my $fh =shift;
! 44121: my $file = shift;
! 44122: my $in_rules = 0;
! 44123: my $in_comment = 0;
! 44124: my $in_import = 0;
! 44125: my $in_string = 0;
! 44126: my $rules = [];
! 44127: my $imports = [];
! 44128: my $line_nr = 0;
! 44129: while (my $line = <$fh>)
! 44130: {
! 44131: $line_nr++;
! 44132: #print STDERR "Line: $line";
! 44133: if ($in_rules)
! 44134: {
! 44135: push @$rules, $line;
! 44136: next;
! 44137: }
! 44138: my $text = '';
! 44139: while (1)
! 44140: {
! 44141: #sleep 1;
! 44142: #print STDERR "${text}!in_comment $in_comment in_rules $in_rules in_import $in_import in_string $in_string: $line";
! 44143: if ($in_comment)
! 44144: {
! 44145: if ($line =~ s/^(.*?\*\/)//)
! 44146: {
! 44147: $text .= $1;
! 44148: $in_comment = 0;
! 44149: }
! 44150: else
! 44151: {
! 44152: push @$imports, $text . $line;
! 44153: last;
! 44154: }
! 44155: }
! 44156: elsif (!$in_string and $line =~ s/^\///)
! 44157: { # what do '\' do here ?
! 44158: if ($line =~ s/^\*//)
! 44159: {
! 44160: $text .= '/*';
! 44161: $in_comment = 1;
! 44162: }
! 44163: else
! 44164: {
! 44165: push (@$imports, $text. "\n") if ($text ne '');
! 44166: push (@$rules, '/' . $line);
! 44167: $in_rules = 1;
! 44168: last;
! 44169: }
! 44170: }
! 44171: elsif (!$in_string and $in_import and $line =~ s/^([\"\'])//)
! 44172: { # strings outside of import start rules
! 44173: $text .= "$1";
! 44174: $in_string = quotemeta("$1");
! 44175: }
! 44176: elsif ($in_string and $line =~ s/^(\\$in_string)//)
! 44177: {
! 44178: $text .= $1;
! 44179: }
! 44180: elsif ($in_string and $line =~ s/^($in_string)//)
! 44181: {
! 44182: $text .= $1;
! 44183: $in_string = 0;
! 44184: }
! 44185: elsif ((! $in_string and !$in_import) and ($line =~ s/^([\\]?\@import)$// or $line =~ s/^([\\]?\@import\s+)//))
! 44186: {
! 44187: $text .= $1;
! 44188: $in_import = 1;
! 44189: }
! 44190: elsif (!$in_string and $in_import and $line =~ s/^\;//)
! 44191: {
! 44192: $text .= ';';
! 44193: $in_import = 0;
! 44194: }
! 44195: elsif (($in_import or $in_string) and $line =~ s/^(.)//)
! 44196: {
! 44197: $text .= $1;
! 44198: }
! 44199: elsif (!$in_import and $line =~ s/^([^\s])//)
! 44200: {
! 44201: push (@$imports, $text. "\n") if ($text ne '');
! 44202: push (@$rules, $1 . $line);
! 44203: $in_rules = 1;
! 44204: last;
! 44205: }
! 44206: elsif ($line =~ s/^(\s)//)
! 44207: {
! 44208: $text .= $1;
! 44209: }
! 44210: elsif ($line eq '')
! 44211: {
! 44212: push (@$imports, $text);
! 44213: last;
! 44214: }
! 44215: }
! 44216: }
! 44217: #file_line_warn (__("string not closed in css file"), $file) if ($in_string);
! 44218: #file_line_warn (__("--css-file ended in comment"), $file) if ($in_comment);
! 44219: #file_line_warn (__("\@import not finished in css file"), $file) if ($in_import and !$in_comment and !$in_string);
! 44220: warn (sprintf(__("%s:%d: string not closed in css file"), $file, $line_nr)) if ($in_string);
! 44221: warn (sprintf(__("%s:%d: --css-file ended in comment"), $file, $line_nr)) if ($in_comment);
! 44222: warn (sprintf(__("%s:%d \@import not finished in css file"), $file, $line_nr)) if ($in_import and !$in_comment and !$in_string);
! 44223: return ($imports, $rules);
1.1 noro 44224: }
44225:
1.3 ! takayama 44226: sub collect_all_css_files()
! 44227: {
! 44228: my @css_import_lines;
! 44229: my @css_rule_lines;
! 44230:
! 44231: # process css files
! 44232: return ([],[]) if ($Texi2HTML::Config::NO_CSS);
! 44233: foreach my $file (@Texi2HTML::Config::CSS_FILES)
! 44234: {
! 44235: my $css_file_fh;
! 44236: my $css_file;
! 44237: if ($file eq '-')
! 44238: {
! 44239: $css_file_fh = \*STDIN;
! 44240: $css_file = '-';
! 44241: }
! 44242: else
! 44243: {
! 44244: $css_file = locate_include_file ($file);
! 44245: unless (defined($css_file))
! 44246: {
! 44247: document_warn ("css file $file not found");
! 44248: next;
! 44249: }
! 44250: unless (open (CSSFILE, "$css_file"))
! 44251: {
! 44252: warn (sprintf(__("%s: could not open --css-file %s: %s\n"), $real_command_name, $css_file, $!));
! 44253: next;
! 44254: }
! 44255: $css_file_fh = \*CSSFILE;
! 44256: }
! 44257: my ($import_lines, $rules_lines);
! 44258: ($import_lines, $rules_lines) = process_css_file ($css_file_fh, $css_file);
! 44259: push @css_import_lines, @$import_lines;
! 44260: push @css_rule_lines, @$rules_lines;
! 44261: }
! 44262:
! 44263:
! 44264: if ($T2H_DEBUG & $DEBUG_USER)
! 44265: {
! 44266: if (@css_import_lines)
! 44267: {
! 44268: print STDERR "# css import lines\n";
! 44269: foreach my $line (@css_import_lines)
! 44270: {
! 44271: print STDERR "$line";
! 44272: }
! 44273: }
! 44274: if (@css_rule_lines)
! 44275: {
! 44276: print STDERR "# css rule lines\n";
! 44277: foreach my $line (@css_rule_lines)
! 44278: {
! 44279: print STDERR "$line";
! 44280: }
! 44281: }
! 44282: }
! 44283: return (\@css_import_lines, \@css_rule_lines);
1.1 noro 44284: }
44285:
1.3 ! takayama 44286: sub init_with_file_name($)
! 44287: {
! 44288: my $base_file = shift;
! 44289: set_docu_names($base_file, $Texi2HTML::THISDOC{'input_file_number'});
! 44290:
! 44291: foreach my $handler(@Texi2HTML::Config::command_handler_init)
! 44292: {
! 44293: &$handler;
! 44294: }
1.1 noro 44295: }
44296:
44297:
1.3 ! takayama 44298: #######################################################################
! 44299: #
! 44300: # Main processing, process all the files given on the command line
! 44301: #
! 44302: #######################################################################
! 44303:
! 44304: my @input_files = @ARGV;
! 44305: # use STDIN if not a tty, like makeinfo does
! 44306: @input_files = ('-') if (!scalar(@input_files) and !-t STDIN);
! 44307: die sprintf(__("%s: missing file argument.\n"), $real_command_name) .$T2H_FAILURE_TEXT unless (scalar(@input_files) >= 1);
! 44308:
! 44309: my $file_number = 0;
! 44310: # main processing
! 44311: while(@input_files)
! 44312: {
! 44313: my $input_file_arg = shift(@input_files);
! 44314:
! 44315: %Texi2HTML::THISDOC = ();
! 44316: $Texi2HTML::THIS_ELEMENT = undef;
! 44317:
! 44318: # Otherwise Texi2HTML::THISDOC wouldn't be set in case there was no call
! 44319: # to set_conf.
! 44320: foreach my $global_conf_vars('SPLIT', 'SPLIT_SIZE')
! 44321: {
! 44322: $Texi2HTML::THISDOC{$global_conf_vars} = Texi2HTML::Config::get_conf($global_conf_vars);
! 44323: }
! 44324:
! 44325: foreach my $global_key (keys(%Texi2HTML::GLOBAL))
! 44326: {
! 44327: $Texi2HTML::THISDOC{$global_key} = $Texi2HTML::GLOBAL{$global_key};
! 44328: }
! 44329:
! 44330: my $input_file_name;
! 44331: # try to concatenate with different suffixes. The last suffix is ''
! 44332: # such that the plain file name is checked.
! 44333: foreach my $suffix (@Texi2HTML::Config::INPUT_FILE_SUFFIXES)
! 44334: {
! 44335: $input_file_name = $input_file_arg.$suffix if (-e $input_file_arg.$suffix);
! 44336: }
! 44337: # in case no file was found, still set the file name
! 44338: $input_file_name = $input_file_arg if (!defined($input_file_name));
! 44339:
! 44340: $Texi2HTML::THISDOC{'input_file_name'} = $input_file_name;
! 44341: $Texi2HTML::THISDOC{'input_file_number'} = $file_number;
! 44342: $Texi2HTML::THISDOC{'input_directory'} = '.';
! 44343: if ($input_file_name =~ /(.*\/)/)
! 44344: {
! 44345: $Texi2HTML::THISDOC{'input_directory'} = $1;
! 44346: }
! 44347:
! 44348: my $input_file_base = $input_file_name;
! 44349: $input_file_base =~ s/\.te?x(i|info)?$//;
! 44350:
! 44351: @{$Texi2HTML::TOC_LINES} = (); # table of contents
! 44352: @{$Texi2HTML::OVERVIEW} = (); # short table of contents
! 44353: # this could be done here, but perl warns that
! 44354: # `"Texi2HTML::TITLEPAGE" used only once' and it is reset in
! 44355: # &$Texi2HTML::Config::titlepage anyway
! 44356: # $Texi2HTML::TITLEPAGE = undef;
! 44357: @{$Texi2HTML::THIS_SECTION} = ();
! 44358:
! 44359: # the reference to these hashes may be used before this point (for example
! 44360: # see makeinfo.init), so they should be kept as is and the values undef
! 44361: # but the key should not be deleted because the ref is on the key.
! 44362: foreach my $hash (\%Texi2HTML::HREF, \%Texi2HTML::NAME, \%Texi2HTML::NODE,
! 44363: \%Texi2HTML::NO_TEXI, \%Texi2HTML::SIMPLE_TEXT)
! 44364: {
! 44365: foreach my $key (keys(%$hash))
! 44366: {
! 44367: $hash->{$key} = undef;
! 44368: }
! 44369: }
! 44370:
! 44371: %region_lines = ();
! 44372: %region_line_nrs = ();
! 44373: foreach my $region (@special_regions)
! 44374: {
! 44375: $region_lines{$region} = [];
! 44376: $region_line_nrs{$region} = [];
! 44377: }
! 44378:
! 44379: @created_directories = ();
! 44380:
! 44381: $docu_dir = undef; # directory of the document
! 44382: $docu_name = undef; # basename of the document
! 44383: $docu_rdir = undef; # directory for the output
! 44384: $docu_toc = undef; # document's table of contents
! 44385: $docu_stoc = undef; # document's short toc
! 44386: $docu_foot = undef; # document's footnotes
! 44387: $docu_about = undef; # about this document
! 44388: $docu_top = undef; # document top
! 44389: $docu_doc = undef; # document (or document top of split)
! 44390: $docu_frame = undef; # main frame file
! 44391: $docu_toc_frame = undef; # toc frame file
! 44392: $path_to_working_dir = undef; # relative path leading to the working
! 44393: # directory from the document directory
! 44394: $docu_doc_file = undef;
! 44395: $docu_toc_file = undef;
! 44396: $docu_stoc_file = undef;
! 44397: $docu_foot_file = undef;
! 44398: $docu_about_file = undef;
! 44399: $docu_top_file = undef;
! 44400: $docu_frame_file = undef;
! 44401: $docu_toc_frame_file = undef;
! 44402:
! 44403: $global_pass = '0';
! 44404:
! 44405: # done before any processing, this is not necessarily
! 44406: # the case with command_handler_init
! 44407: foreach my $handler(@Texi2HTML::Config::command_handler_setup)
! 44408: {
! 44409: &$handler;
! 44410: }
! 44411:
! 44412: if (!$Texi2HTML::Config::USE_SETFILENAME)
! 44413: {
! 44414: init_with_file_name ($input_file_base);
! 44415: }
! 44416:
! 44417: # FIXME when to do that?
! 44418: ($Texi2HTML::THISDOC{'css_import_lines'}, $Texi2HTML::THISDOC{'css_rule_lines'})
! 44419: = collect_all_css_files();
! 44420:
! 44421: texinfo_initialization(0);
! 44422:
! 44423: print STDERR "# reading from $input_file_name\n" if $T2H_VERBOSE;
! 44424:
! 44425: $macros = undef; # macros. reference on a hash
! 44426: %info_enclose = (); # macros defined with definfoenclose
! 44427: @floats = (); # floats list
! 44428: %floats = (); # floats by style
! 44429: %nodes = (); # nodes hash. The key is the texi node name
! 44430: %cross_reference_nodes = (); # normalized node names arrays
! 44431:
! 44432:
! 44433: $global_pass = '1';
! 44434: my ($texi_lines, $first_texi_lines, $lines_numbers)
! 44435: = pass_texi($input_file_name);
! 44436:
! 44437: if ($Texi2HTML::Config::USE_SETFILENAME and !defined($docu_name))
! 44438: {
! 44439: init_with_file_name ($input_file_base);
! 44440: }
! 44441:
! 44442: $global_pass = '1 expand macros';
! 44443: Texi2HTML::Config::t2h_default_set_out_encoding();
! 44444: dump_texi($texi_lines, 'texi', $lines_numbers) if ($T2H_DEBUG & $DEBUG_TEXI);
! 44445: if (defined($Texi2HTML::Config::MACRO_EXPAND))
! 44446: {
! 44447: my @texi_lines = (@$first_texi_lines, @$texi_lines);
! 44448: dump_texi(\@texi_lines, '', undef, $Texi2HTML::Config::MACRO_EXPAND);
! 44449: }
! 44450:
! 44451: %content_element = ();
! 44452: foreach my $command('contents', 'shortcontents')
! 44453: {
! 44454: $all_content_elements{$command} = [];
! 44455: foreach my $key (keys(%{$reference_content_element{$command}}))
! 44456: {
! 44457: $content_element{$command}->{$key} = $reference_content_element{$command}->{$key};
! 44458: }
! 44459: }
! 44460:
! 44461: %sec2level = %reference_sec2level;
! 44462:
! 44463: $element_before_anything =
! 44464: {
! 44465: 'before_anything' => 1,
! 44466: 'place' => [],
! 44467: 'texi' => 'VIRTUAL ELEMENT BEFORE ANYTHING',
! 44468: };
! 44469:
! 44470:
! 44471: $footnote_element =
! 44472: {
! 44473: 'id' => $Texi2HTML::Config::misc_pages_targets{'Footnotes'},
! 44474: 'target' => $Texi2HTML::Config::misc_pages_targets{'Footnotes'},
! 44475: 'file' => $docu_foot,
! 44476: 'footnote' => 1,
! 44477: 'place' => [],
! 44478: };
! 44479:
! 44480: %region_initial_state = ();
! 44481: foreach my $region (@special_regions)
! 44482: {
! 44483: $region_initial_state{$region} = { };
! 44484: }
! 44485:
! 44486: # to determine if a command has to be processed the following are interesting
! 44487: # (and can be faked):
! 44488: # 'region': the name of the special region we are processing
! 44489: # 'region_pass': the number of passes in that specific region (both outside
! 44490: # of the main document, and in the main document)
! 44491: # 'multiple_pass': the number of pass in the formatting of the region in the
! 44492: # main document
! 44493: # It is set to 0 the first time the region is seen, before
! 44494: # it will be -1, for example when doing the
! 44495: # copying_comment, the titlepage... before starting with
! 44496: # the document itself.
! 44497: # 'outside_document': set to 1 if outside of the main document formatting
! 44498:
! 44499: foreach my $key (keys(%region_initial_state))
! 44500: {
! 44501: $region_initial_state{$key}->{'multiple_pass'} = -1;
! 44502: $region_initial_state{$key}->{'region_pass'} = 0;
! 44503: $region_initial_state{$key}->{'num_head'} = 0;
! 44504: $region_initial_state{$key}->{'foot_num'} = 0;
! 44505: $region_initial_state{$key}->{'relative_foot_num'} = 0;
! 44506: $region_initial_state{$key}->{'region'} = $key;
! 44507: }
! 44508:
! 44509: @opened_files = (); # all the files opened by the program to remove
! 44510: # them if FORCE is not set and an error occured
! 44511:
! 44512: texinfo_initialization(1);
! 44513:
! 44514:
! 44515: $no_element_associated_place = [];
! 44516:
! 44517: $document_idx_num = 0;
! 44518: $document_sec_num = 0;
! 44519: $document_head_num = 0;
! 44520: $document_anchor_num = 0;
! 44521:
! 44522: @nodes_list = (); # nodes in document reading order
! 44523: # each member is a reference on a hash
! 44524: @sections_list = (); # sections in reading order
! 44525: # each member is a reference on a hash
! 44526: @all_elements = (); # sectioning elements (nodes and sections)
! 44527: # in reading order. Each member is a reference
! 44528: # on a hash which also appears in %nodes,
! 44529: # @sections_list @nodes_list, @elements_list
! 44530: @elements_list = (); # all the resulting elements in document order
! 44531: %sections = (); # sections hash. The key is the section number
! 44532: %headings = (); # headings hash. The key is the heading number
! 44533: $section_top = undef; # @top section
! 44534: $element_top = undef; # Top element
! 44535: $node_top = undef; # Top node
! 44536: $node_first = undef; # First node
! 44537: $element_index = undef; # element with first index
! 44538: $element_chapter_index = undef; # chapter with first index
! 44539: $element_first = undef; # first element
! 44540: $element_last = undef; # last element
! 44541: %special_commands = (); # hash for the commands specially handled
! 44542: # by the user
! 44543:
! 44544: @index_labels = (); # array corresponding with @?index commands
! 44545: # constructed during pass_texi, used to
! 44546: # put labels in pass_text
! 44547: # right now it is only used for debugging
! 44548: # purposes.
! 44549: @unknown_index_index_entries = (); # holds index entries not associated
! 44550: # with any index
! 44551: %{$Texi2HTML::THISDOC{'index_entries_array'}} = (); # holds the index
! 44552: # entries in order of appearance in the document
! 44553: # for each index name.
! 44554: %{$Texi2HTML::THISDOC{'index_letters_array'}} = (); # holds the sorted
! 44555: # index letters for each index name. The sorted
! 44556: # letters hold the sorted index entries
! 44557:
! 44558: $global_pass = 2;
! 44559: my ($doc_lines, $doc_numbers) = pass_structure($texi_lines, $lines_numbers);
! 44560:
! 44561: foreach my $handler(@Texi2HTML::Config::command_handler_names)
! 44562: {
! 44563: &$handler;
! 44564: }
! 44565:
! 44566: if ($T2H_DEBUG & $DEBUG_TEXI)
! 44567: {
! 44568: dump_texi($doc_lines, 'first', $doc_numbers);
! 44569: if (defined($Texi2HTML::Config::MACRO_EXPAND and $Texi2HTML::Config::DUMP_TEXI))
! 44570: {
! 44571: my @all_doc_lines = (@$first_texi_lines, @$doc_lines);
! 44572: #push (@$doc_lines, "\@bye\n");
! 44573: dump_texi(\@all_doc_lines, '', undef, $Texi2HTML::Config::MACRO_EXPAND . ".first");
! 44574: }
! 44575: }
! 44576: next if ($Texi2HTML::Config::DUMP_TEXI);
! 44577:
! 44578: foreach my $style (keys(%special_commands))
! 44579: {
! 44580: $special_commands{$style}->{'max'} = $special_commands{$style}->{'count'};
! 44581: }
! 44582:
! 44583: %files = (); # keys are files. This is used to avoid reusing an already
! 44584: # used file name
! 44585: %printed_indices = (); # value is true for an index name not empty and
! 44586: # printed
! 44587: $global_pass = '2 prepare indices';
! 44588: prepare_indices();
! 44589: $global_pass = '2 element directions';
! 44590: rearrange_elements();
! 44591: do_names();
! 44592:
! 44593: $global_pass = '2-3 user functions';
! 44594: #Texi2HTML::LaTeX2HTML::latex2html();
! 44595: foreach my $handler(@Texi2HTML::Config::command_handler_process)
! 44596: {
! 44597: &$handler;
! 44598: }
! 44599:
! 44600: # maybe do that later to have more elements ready?
! 44601: &$Texi2HTML::Config::toc_body(\@sections_list);
! 44602:
! 44603: &$Texi2HTML::Config::css_lines($Texi2HTML::THISDOC{'css_import_lines'},
! 44604: $Texi2HTML::THISDOC{'css_rule_lines'});
! 44605:
! 44606:
! 44607: $global_head_num = 0; # heading index. it is global for the main doc,
! 44608: # and taken from the state if in multiple_pass.
! 44609: $global_foot_num = 0;
! 44610: $global_relative_foot_num = 0;
! 44611: @foot_lines = (); # footnotes
! 44612: $copying_comment = ''; # comment constructed from text between
! 44613: # @copying and @end copying with licence
! 44614: %acronyms_like = (); # acronyms or similar commands associated texts
! 44615: # the key are the commands, the values are
! 44616: # hash references associating shorthands to
! 44617: # texts.
! 44618: @states_stack = ();
! 44619:
! 44620: pass_text($doc_lines, $doc_numbers);
! 44621: print STDERR "BUG: " . scalar(@index_labels) . " index entries pending\n"
! 44622: if (scalar(@index_labels));
! 44623: foreach my $special (keys(%special_commands))
! 44624: {
! 44625: my $count = $special_commands{$special}->{'count'};
! 44626: if (($count != 0) and $T2H_VERBOSE)
! 44627: {
! 44628: document_warn ("$count special \@$special were not processed.\n");
! 44629: }
! 44630: }
! 44631: if ($Texi2HTML::Config::IDX_SUMMARY)
! 44632: {
! 44633: foreach my $entry (keys(%index_names))
! 44634: {
! 44635: do_index_summary_file($entry, $docu_name);
! 44636: }
! 44637: }
! 44638: if (defined($Texi2HTML::Config::INTERNAL_LINKS))
! 44639: {
! 44640: my $FH = open_out($Texi2HTML::Config::INTERNAL_LINKS);
! 44641: &$Texi2HTML::Config::internal_links($FH, \@elements_list, $Texi2HTML::THISDOC{'index_letters_array'});
! 44642: close ($FH);
! 44643: }
! 44644: do_node_files() if ($Texi2HTML::Config::NODE_FILES);
! 44645: #l2h_FinishFromHtml() if ($Texi2HTML::Config::L2H);
! 44646: #l2h_Finish() if($Texi2HTML::Config::L2H);
! 44647: #Texi2HTML::LaTeX2HTML::finish();
! 44648: foreach my $handler(@Texi2HTML::Config::command_handler_finish)
! 44649: {
! 44650: &$handler;
! 44651: }
! 44652: &$Texi2HTML::Config::finish_out();
! 44653:
! 44654: print STDERR "# File ($file_number) $input_file_name processed\n" if $T2H_VERBOSE;
! 44655: $file_number++;
1.1 noro 44656: }
1.3 ! takayama 44657: print STDERR "# that's all folks\n" if $T2H_VERBOSE;
! 44658: exit(0);
1.1 noro 44659:
44660:
44661: ##############################################################################
44662:
1.3 ! takayama 44663: # These next few lines are legal in both Perl and nroff.
! 44664:
! 44665: .00 ; # finish .ig
1.1 noro 44666:
44667: 'di \" finish diversion--previous line must be blank
44668: .nr nl 0-1 \" fake up transition to first page again
44669: .nr % 0 \" start at page 1
44670: '; __END__ ############# From here on it's a standard manual page ############
1.3 ! takayama 44671: .so /usr/local/man/man1/texi2html.1
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>