summaryrefslogtreecommitdiff
path: root/macros/texinfo/texinfo/tp/Texinfo/Convert/IXINSXML.pm
blob: d15c95d5b6edc669a167b12ef08c8b0cd4008028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# IXINSXML.pm: output IXIN with Texinfo tree content converted to SXML.
#
# Copyright 2013, 2014, 2015, 2016, 2017, 2018, 2022 Free Software
# Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Original author: Patrice Dumas <pertusus@free.fr>
#
#
# This modules combines the Texinfo::Convert::IXIN module which
# outputs the IXIN format and the Texinfo::Convert::TexinfoSXML
# Texinfo tree converter, which converts Texinfo, and is called
# from Texinfo::Convert::IXIN, to obtain a functional IXIN format
# conversion implementation that can be called as a Texinfo converter.
# See comments at the beginning of IXIN.pm for more information.

package Texinfo::Convert::IXINSXML;

use 5.00405;
use strict;

use Texinfo::Convert::TexinfoSXML;
use Texinfo::Convert::IXIN;

use Carp qw(cluck);

use vars qw($VERSION @ISA);
@ISA = qw(Texinfo::Convert::TexinfoSXML Texinfo::Convert::IXIN);

$VERSION = '7.0.2';


my %defaults = (
  'ENABLE_ENCODING'      => 0,
  'FORMAT_MENU'          => 'menu',
  'EXTENSION'            => 'ixin',
  'OUTPUT_ENCODING_NAME' => 'utf-8',
  # next two are replaced by the main program value if called from
  # the main program.  'output_format' is also 'ixinsxml' when set by
  # the main program, but 'converted_format' is set to 'ixinsxml'.
  # More on that subject below.
  'converted_format'     => 'texinfosxml',
  'output_format'        => 'ixinsxml',
  'SPLIT'                => 0,
  'documentlanguage'     => 'en',
  'USE_NODES'            => 1,
);

sub converter_defaults($$)
{
  return %defaults;
}

# In the main program, the 'converted_format' needs to be 'ixinsxml'
# to find the right module used for conversion (this module).  However in
# the Texinfo::Convert::IXIN output_ixin() function, and maybe in
# Texinfo::Convert::TexinfoSXML convert_tree(), called from output_ixin(),
# it may be better to have 'converted_format' set to the format converted
# from the Texinfo tree, which is texinfosxml.  So far it is not needed,
# inheriting format specific functions is used to select the output format,
# but it could theoretically be needed for a flexible conversion
# (since the IXIN project is inactive, the corresponding code is not updated
# acively either, so it is unlikely to change, though).
sub converter_initialize($) { my $self = shift;

  $self->{'converted_format'} = $defaults{'converted_format'};

  # need to call parent module converter_initialize, to initialize
  # the converter state.  This method is actually implemented in
  # the Texinfo::Convert::TexinfoSXML parent class.
  $self->SUPER::converter_initialize(@_);
}

sub output($)
{
  my $self = shift;
  my $root = shift;

  return $self->output_ixin($root);
}

1;