Commit 93d55baa authored by Agustin Martin Domingo's avatar Agustin Martin Domingo

Merge branch 'experimental'

parents ed24786a 2a177480
......@@ -57,6 +57,7 @@ $info->{preASP} = sub {
my ($INFILE, $OUTFILE) = @_;
my $suffix = ( $global->{charset} eq "latin1" ) ? '.2l1texi' : '.2texi';
my $char_maps = load_char_maps ($suffix, [ Text::EntityMap::sdata_dirs() ]);
my $inheading;
# Replace some symbols in the file before sgmlsasp is called. This
# has been done in preNSGMLS, but if the specified sgml file is
......@@ -72,6 +73,7 @@ $info->{preASP} = sub {
if ( s/^-// ) {
chomp;
s/([^\\])\\n/$1 /g if $inheading; # Remove spurious \n in headings
print $OUTFILE "-" .
parse_data ($_, $char_maps, $info_escape) . "\n";
} elsif (/^A/) {
......@@ -84,6 +86,11 @@ $info->{preASP} = sub {
}
print $OUTFILE "A$name $type $value\n";
} else {
if (/^\(HEADING/){
$inheading = 1;
} elsif (/^\)HEADING/){
$inheading = '';
}
# Default action if not skipped over by previous conditions: copy in to out.
print $OUTFILE $_;
}
......
#
# fmt_lyx.pl
#
# $Id: fmt_lyx.pl,v 1.1.1.1 2001/05/24 15:57:40 sano Exp $
#
# Lyx-specific driver stuff
#
# Copyright 1996, Cees de Groot
......@@ -38,6 +36,7 @@ my $lyx_escape = sub {
# -----------------------------------------------------------------------
my ($data) = @_;
# The single exception backslash is treated below
return ($data);
};
......@@ -48,7 +47,8 @@ $lyx->{preASP} = sub {
# Note that currently LyX works only with isolatin1
# -----------------------------------------------------------------------
my ($INFILE, $OUTFILE) = @_;
# The single exception backslash is treated bellow
my $verbatim;
my $inheading;
# `sdata_dirs' list is passed as anonymous array to make a single argument
my $char_maps = load_char_maps ('.2l1b', [ Text::EntityMap::sdata_dirs() ]);
......@@ -63,7 +63,7 @@ $lyx->{preASP} = sub {
s/\\\|refnam\\\|/ /g;
if ( s/^-// ) {
print $OUTFILE "-" . &parse_data($_, $char_maps, $lyx_escape) . "\n";
print $OUTFILE "-" . parse_data($_, $char_maps, $lyx_escape) . "\n";
} elsif (/^A/) {
/^A(\S+) (IMPLIED|CDATA|NOTATION|ENTITY|TOKEN)( (.*))?$/
|| die "bad attribute data: $_\n";
......@@ -74,6 +74,15 @@ $lyx->{preASP} = sub {
}
print $OUTFILE "A$name $type $value\n";
} else {
if (/^\(HEADING/){
$inheading = 1;
} elsif (/^\)HEADING/){
$inheading = '';
} elsif (/^\((VERB|CODE)/) {
$verbatim = 1;
} elsif (/^\)(VERB|CODE)/) {
$verbatim = '';
}
print $OUTFILE $_ . "\n";
}
}
......@@ -85,7 +94,6 @@ $lyx->{postASP} = sub {
# -----------------------------------------------------------------------
# Take the sgmlsasp output, and make something useful from it.
# -----------------------------------------------------------------------
my $OUTFILE;
my $INFILE = shift;
my $lyxfile = "$global->{filename}.lyx";
my $nbsp = chr(160);
......@@ -94,22 +102,45 @@ $lyx->{postASP} = sub {
my $indent_level = -1;
my $verb_last_line = "";
my $verbatim = 0;
my $inlookchange;
my $inheading;
my $initem;
my $intag;
my $intt;
my $lyxout = '';
my $tscreen;
my $lyxout = "#This file was created by LinuxDoc-SGML
#(conversion : Frank Pavageau and Jose' Matos)
\\lyxformat 2.15
\\textclass \@textclass\@
\\language default
\\inputencoding default
\\fontscheme default
\\graphics default
\\paperfontsize default
\\spacing single
\\papersize Default
\\use_geometry 0
\\use_amsmath 0
\\paperorientation portrait
\\secnumdepth 3
\\tocdepth 3
\\paragraph_separation indent
\\defskip medskip
\\quotes_language default
\\quotes_times 2
\\papercolumns 1
\\papersides 1
\\paperpagestyle default\n";
while( <$INFILE> ) {
next if ( /^\s*$/ );
chomp;
# Itemize; Enumerate and Description. $indent_level counts the level
if( /^\@verb\@/ ) {
$verbatim = 1;
} elsif ( /^\@\/verb\@/ ) {
$verbatim = 0;
} elsif( /^\@itemize\@/ ) { # --- Itemized list begins
if ( /^\@(article|book|report)\@/ ) {
my $class = $1;
$lyxout =~ s/\@textclass\@/$class/;
} # Itemize; Enumerate and Description. $indent_level counts the level
elsif( /^\@itemize\@/ ) { # --- Itemized list begins
$indent_level++;
$level_layout[$indent_level] = "Itemize";
$lyxout .= "\\begin_deeper\n" if ($indent_level);
......@@ -150,24 +181,53 @@ $lyx->{postASP} = sub {
$lyxout .= "\\layout Description\n";
} elsif( /^\@\/tag@/ ) {
$intag = 0;
} # tscreen
elsif( /^\@tscreen\@/ ) {
$tscreen = 1;
} elsif ( /^\@\/tscreen\@/ ) {
$tscreen = 0;
$lyxout .= "\\layout Standard\n";
} # Verbatim
elsif( /^\@verb\@/ ) {
$verbatim = 1;
} elsif ( /^\@\/verb\@/ ) {
$verbatim = 0;
} else {
$inheading = 0 if ( /^\\layout Standard/ );
$intt = 0 if ( /^\\family default.*$/ );
$inheading = 1 if ( /^\\layout (Part|Chapter|.*section|.*paragraph)/ );
$inlookchange = 1 if ( m/^\\(family|series|shape)/ && ! m/default/ );
$intt = 1 if ( /^\\family typewriter.*$/ );
# For LyX file clarity
s/\\backslash/\n\\backslash\n/g unless ( $verbatim or $inheading or $intt);
s/\s+/ /g unless ( $verbatim or $intt );
s/\s+/ /g unless ( $verbatim or $intt or $tscreen );
if ( $intag ) {
s/\s+/\n\\protected_separator\n/g unless m/^\\(family|series|shape)/;
} elsif ( $verbatim ) {
$_ = "\\layout Verbatim\n$_";
} elsif ( $tscreen ) {
if ( $verbatim ) {
# If verbatim, there are no line breaks when things like <tt/../ appears.
$_ = "\\layout LyX-Code\n$_";
} else {
# We do not want to have LyX-Code commands when line breaks are caused by
# look changing commands like \family .... This also applies to the line
# after \... default (so the $inlookchange == 2 hack below.)
$_ = "\\layout LyX-Code\n$_" unless $inlookchange;
}
} elsif ( $inheading) {
s/\s+/ /g;
}
$inheading = 1 if ( /^\\layout (Part|Chapter|.*section|.*paragraph)/ );
$intt = 1 if ( /^\\family typewriter.*$/ );
$inheading = 0 if ( /^\\layout Standard/ );
if ( /^\\family default.*$/ ) {
$intt = 0;
# Signal for next line processing that this is an end-look-change command
$inlookchange = 2;
} elsif ( $inlookchange == 2 ) {
# Line previous to this one was an end-look-change command
$inlookchange = 0;
}
$lyxout .= "$_\n";
}
......@@ -189,7 +249,7 @@ $lyx->{postASP} = sub {
$lyxout =~ s/\\end_deeper/\\end_deeper\n/gms;
# Print result
open ($OUTFILE, "> $lyxfile")
open (my $OUTFILE, "> $lyxfile")
or die "fmt_lyx::postASP: Could not open \"$lyxfile\" for writing. Aborting ...";
print $OUTFILE $lyxout;
close $OUTFILE;
......
% linuxdoc to texinfo replacement file
% Heavily based on qwertz one
% qwertz to texinfo replacement file
<qwertz> +
</qwertz> +
<qwertz> +
</qwertz> +
<article> + "\\input texinfo\n" +
</article> + "@bye" +
<article> + "\\input texinfo\n" +
</article> + "@bye" +
<dina4> + "@afourpaper" +
<dina4> + "@afourpaper" +
</dina4>
% Manual Pages are expected to be formatted using nroff (or groff), unless
% they are included as sections of other qwertz documents.
% they are included as sections of other qwertz documents.
<manpage>
</manpage>
%<titlepag> + "@node Top\n@top" +
<titlepag> + "@TOP" +
<titlepag> + "@TOP" +
</titlepag> +
<title> + "@title "
</title>
</title>
<subtitle> + "@subtitle "
</subtitle>
</subtitle>
<author> + "@author "
</author>
<name>
<name>
</name>
<and> " and "
......@@ -39,44 +39,42 @@
</thanks>
% ???
<inst> " \\\\\n\\\\" +
<inst> " \\\\\n\\\\" +
</inst>
<date> + "@subtitle "
</date>
</date>
<abstract> + "\n\n"
</abstract> "" +
<newline> "@*"
</newline>
<label> + "@LABEL [ID]"
</label> +
% ----------
<header> + "@c %% "
</header>
<lhead> "{"
</lhead> "}"
<toc>
</toc>
<rhead> "{"
</rhead> "}" +
<lof>
</lof>
<comment> + "@example" +
</comment> + "@end example" +
<lot>
</lot>
<abstract> + "\n\n"
</abstract> "" +
% ----------
<appendix> + "\n@appendix "
</appendix>
<header> + "@c %% "
</header>
<toc>
</toc>
<lhead> "{"
</lhead> "}"
% <lof> + "\\listoffigures" +
% </lof>
<rhead> "{"
</rhead> "}" +
% <lot> + "\\listoftables" +
% </lot>
<heading> ""
</heading> "\n\n"
<sect> + "\n@SUB "
</sect> + "@ENDSUB" +
......@@ -93,23 +91,28 @@
<sect4> + "\n@SUB "
</sect4> + "@ENDSUB" +
<heading> ""
</heading> "\n\n"
<appendix> + "\n@appendix "
</appendix>
<p>
<biblio>
</biblio>
<p>
</p> "\n\n"
% ------------ List environments -----------------
<itemize> + "@itemize @bullet" +
</itemize> + "@end itemize" +
</itemize> + "@end itemize" +
<enum> + "@enumerate" +
<enum> + "@enumerate" +
</enum> + "@end enumerate" +
<list> + "\\begin{list}{}{}\n" +
</list> + "\\end{list}" +
<list> + "@itemize" +
</list> + "@end itemize" +
<descrip> + "@table @code" +
</descrip> + "@end table" +
<descrip> + "@table @code" +
</descrip> + "@end table" +
<item> + "@item\n"
</item>
......@@ -117,23 +120,42 @@
<tag> + "@item "
</tag> "\n"
% -- index commands are ignored for non LaTeX backends --
<idx>
</idx>
<cdx>
</cdx>
<nidx>
</nidx>
<ncdx>
</ncdx>
% ------------- referencing things ------------------
<label> + "@LABEL [ID]"
</label> +
<ref> + "@REF [ID]" +
</ref>
<pageref> "@REF [ID]"
</pageref>
<cite> "\\cite{[ID]"
</cite> "}"
<ncite> "\\cite\[[NOTE]\]{[ID]"
</ncite> "}"
% <idx> "\\idx{"
% </idx> "}"
%
% <cdx> "\\cdx{"
% </cdx> "}"
<idx>
</idx>
<url> "@uref{[URL],[NAME]}"
</url>
<cdx>
</cdx>
<htmlurl> "@uref{[NAME]}"
</htmlurl>
% The idea here is to automatically insert soft hyphens after every slash in
% the filename, so long filenames will break naturally. The url{} macro is
......@@ -141,33 +163,29 @@
<file> "\\url{"
</file> "}"
<footnote> "\\footnote{"
<footnote> "@footnote{"
</footnote> "}"
<sq> "``"
</sq> "''"
<lq> + "\\begin{quotation}\n" +
</lq> + "\n\\end{quotation}\n\n" +
<em> "`"
</em> "'"
% ------------- Different emphasis ------------------------
<bf> "`"
</bf> "'"
<em> "@emph{"
</em> "}"
<it> "`"
</it> "'"
<bf> "@strong{"
</bf> "}"
<sf> ""
</sf> ""
<sl> "`"
</sl> "'"
<rm> "`"
</rm> "'"
<tt> "`"
</tt> "'"
......@@ -175,34 +193,39 @@
<cparam> "\\cparam{"
</cparam> "}"
<ref> + "@REF [ID]" +
</ref>
<sc> "@sc{"
</sc> "}"
<pageref> "@REF [ID]"
</pageref>
<rm> "`"
</rm> "'"
<x>
% ------------
<x>
</x>
<mc>
<mc>
</mc>
<biblio>
</biblio>
<code> + "@example" +
</code> + "@end example" +
<code> + "@example" +
</code> + "@end example" +
<verb>
</verb>
<tscreen> + "@example" +
</tscreen> + "@end example" +
<tscreen> + "@example" +
</tscreen> + "@end example" +
<quote> + "@quotation" +
</quote> + "@end quotation" +
<quote> + "@quotation" +
</quote> + "@end quotation" +
% theorems and such
<lq> + "@quotation" +
</lq> + "@end quotation" +
<comment> + "@example" +
</comment> + "@end example" +
% ------------ theorems and such ---------------------
<def> + "@deffn"
</def> + "@end deffn" +
......@@ -225,19 +248,19 @@
<thtag> "\["
</thtag> "\]" +
% mathematics
% ------------ mathematics. Unused by linuxdoc ?? --
<f> "$"
</f> "$"
<dm> + "\\\["
</dm> "\\\]" +
<dm> + "\\\["
</dm> "\\\]" +
<eq> + "\\begin{equation}" +
</eq> + "\\end{equation}\n" +
<fr> "\\frac"
</fr>
</fr>
<nu> "{"
</nu> "}"
......@@ -245,7 +268,7 @@
<de> "{"
</de> "}"
<lim>
<lim>
</lim>
<op>
......@@ -267,7 +290,7 @@
</in>
<sum> "\\sum"
</sum>
</sum>
<root> "\\sqrt\[[n]\]{"
</root> "}"
......@@ -309,20 +332,20 @@
<tu> "\\\\ \n"
</tu>
% figures
% --------------- figures and tables ---------------------------
% <figure> + "\\begin{figure}\[[LOC]\]" +
% </figure> + "\\end{figure}\n" +
% <eps> + "\\centerline{\\epsffile{[FILE].ps}}" +
% </eps>
% </eps>
% <ph> + "\\vspace{[VSPACE]}\n\\par" +
% </ph>
% </ph>
% <caption> + "\\caption{"
% </caption> "}" +
% </caption> "}" +
% tables
......@@ -335,14 +358,14 @@
% "\\end{center}" +
<tabular> + "@table @asis \n"
"@item " +
</tabular> + "@end table" +
"@item " +
</tabular> + "@end table" +
% <rowsep> "\\\\ " +
% <rowsep> "\\\\ " +
% </rowsep>
<rowsep> " @*\n" +
</rowsep>
<rowsep> " @*\n" +
</rowsep>
% <colsep> "& "
% </colsep>
......@@ -351,16 +374,11 @@
</colsep>
<caption> + "@*\n@center "
</caption> "\n" +
</caption> "\n" +
% <hline> + "\\hline" +
% </hline>
<url> "[NAME] ([URL])"
</url>
<htmlurl> "[NAME]"
</htmlurl>
% end of texinfo replacement file
% =============== end of texinfo replacement file ==============
......@@ -11,37 +11,15 @@
<qwertz> +
</qwertz> +
<article> "#This file was created by LinuxDoc-SGML\n"
"#(conversion : Frank Pavageau and Jose' Matos)\n"
"\\lyxformat 2.15\n"
"\\textclass linuxdoc\n"
"\\language default\n"
"\\inputencoding default\n"
"\\fontscheme default\n"
"\\graphics default\n"
"\\paperfontsize default\n"
"\\spacing single\n"
"\\papersize Default\n"
"\\use_geometry 0\n"
"\\use_amsmath 0\n"
"\\paperorientation portrait\n"
"\\secnumdepth 3\n"
"\\tocdepth 3\n"
"\\paragraph_separation indent\n"
"\\defskip medskip\n"
"\\quotes_language default\n"
"\\quotes_times 2\n"
"\\papercolumns 1\n"
"\\papersides 1\n"
"\\paperpagestyle default\n\n" +
<article> + "@article@" +
</article> + "\\the_end"
<report>
</report>
<report> + "@report@" +
</report> + "\\the_end"
<book>
</book>
<book> + "@book@" +
</book> + "\\the_end"
<notes>
</notes>
......@@ -59,7 +37,7 @@
<subtitle> +
</subtitle> +
<author> + "\\layout Author\n"
<author> + "\\layout Author" +
</author> +
<name>
......@@ -68,10 +46,10 @@
<and> " and "
</and>
<date> + "\\layout Date\n"
<date> + "\\layout Date" +
</date> +
<abstract> + "\\layout Abstract\n"
<abstract> + "\\layout Abstract" +
</abstract> +
<toc> + "\\layout Standard\n"
......@@ -79,34 +57,37 @@
"\\end_inset\n" +
</toc>
<sect> + "\\layout Section\n"
<chapt> + "\\layout Chapter" +
</chapt>
<sect> + "\\layout Section" +
</sect>
<sect1> + "\\layout Subsection\n"
<sect1> + "\\layout Subsection" +
</sect1>
<sect2> + "\\layout Subsubsection\n"
<sect2> + "\\layout Subsubsection" +
</sect2>
<sect3> + "\\layout Paragraph\n"
<sect3> + "\\layout Paragraph" +
</sect3>
<sect4> + "\\layout Subparagraph\n"
<sect4> + "\\layout Subparagraph" +
</sect4>
<heading>
</heading>
<p> + "\\layout Standard\n"
<p> + "\\layout Standard" +
</p> + "\n"
<itemize> "@itemize@\n" +
</itemize> + "@/itemize@\n"
</itemize> + "@/itemize@" +
<enum> "@enumerate@\n" +
</enum> + "@/enumerate@\n"
</enum> + "@/enumerate@" +
<item> + "@item@\n"
<item> + "@item@" +
</item> + "\n" +
<descrip> + "@descrip@\n" +
......@@ -137,13 +118,10 @@
</code>
<verb> + "@verb@\n" +
</verb> + "@/verb@\n"
<tscreen> + "\\begin_deeper\n"
"\\layout Standard\n"
</verb> + "@/verb@" +
</tscreen> + "\\end_deeper\n"
"\\layout Standard\n"
<tscreen> + "@tscreen@" +
</tscreen> + "@/tscreen@" +
<quote> + "\\layout Quote\n" +
</quote>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment