mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Simplify code to generate only one paragraph at a time.
This commit is contained in:
parent
9184ae14f0
commit
87dae26e4a
@ -1,69 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This DocBook file was created by LyX 2.4.0dev
|
||||
See http://www.lyx.org/ for more information -->
|
||||
<article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.1">
|
||||
|
||||
<info><title>I am a title</title>
|
||||
<author><personname>I am an author</personname></author>
|
||||
<article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
|
||||
<info>
|
||||
<title>I am a title</title>
|
||||
<author>
|
||||
<personname>I am an author</personname>
|
||||
</author>
|
||||
<date>I am a date</date>
|
||||
|
||||
<abstract><para>I am an abstract</para>
|
||||
<abstract>
|
||||
<para>I am an abstract</para>
|
||||
<para>I am also an abstract</para>
|
||||
</abstract>
|
||||
</info>
|
||||
<para>I am a standard paragraph. </para>
|
||||
<section xml:id="sec.Sec-1-0">
|
||||
<section xml:id="sec.Sec-1">
|
||||
<title>I am the first section </title>
|
||||
<para>I am the first paragraph of the first section. </para>
|
||||
|
||||
<para>I am the second paragraph of the first section. </para>
|
||||
|
||||
<blockquote><para>I am a quote
|
||||
<inlineequation>
|
||||
<m:math>
|
||||
<m:alt role='tex'>\,with\,a\,formula</m:alt>
|
||||
<blockquote>
|
||||
<para>I am a quote<inlineequation>
|
||||
<alt role='tex'>\,with\,a\,formula</alt>
|
||||
<m:math>
|
||||
|
||||
<m:mrow>
|
||||
<m:mrow>
|
||||
<m:mspace width="6px"/><m:mi>w</m:mi><m:mi>i</m:mi><m:mi>t</m:mi><m:mi>h</m:mi>
|
||||
<m:mspace width="6px"/><m:mi>a</m:mi>
|
||||
<m:mspace width="6px"/><m:mi>f</m:mi><m:mi>o</m:mi><m:mi>r</m:mi><m:mi>m</m:mi><m:mi>u</m:mi><m:mi>l</m:mi><m:mi>a</m:mi>
|
||||
<m:mrow><m:mspace width="6px" /><m:mi>w</m:mi><m:mi>i</m:mi><m:mi>t</m:mi><m:mi>h</m:mi><m:mspace width="6px" /><m:mi>a</m:mi><m:mspace width="6px" /><m:mi>f</m:mi><m:mi>o</m:mi><m:mi>r</m:mi><m:mi>m</m:mi><m:mi>u</m:mi><m:mi>l</m:mi><m:mi>a</m:mi>
|
||||
</m:mrow>
|
||||
</m:mrow>
|
||||
</m:math>
|
||||
</inlineequation>. </para>
|
||||
</m:math>
|
||||
</inlineequation>. </para>
|
||||
</blockquote>
|
||||
<para>
|
||||
<informalequation>
|
||||
<m:math>
|
||||
<m:alt role='tex'>Formula!</m:alt>
|
||||
<para><informalequation>
|
||||
<alt role='tex'>Formula!</alt>
|
||||
<m:math>
|
||||
|
||||
<m:mrow>
|
||||
<m:mrow><m:mi>F</m:mi><m:mi>o</m:mi><m:mi>r</m:mi><m:mi>m</m:mi><m:mi>u</m:mi><m:mi>l</m:mi><m:mi>a</m:mi><m:mo>!</m:mo>
|
||||
</m:mrow>
|
||||
</m:mrow>
|
||||
</m:math>
|
||||
</informalequation>
|
||||
<informalequation xml:id='eq.EQ.-1'>
|
||||
<m:math>
|
||||
<m:alt role='tex'>\text{I am a formula with a ref.}\label{eq:EQ.}</m:alt>
|
||||
</m:math>
|
||||
</informalequation><informalequation xml:id="eq.EQ.">
|
||||
<alt role='tex'>\text{I am a formula with a ref.}\label{eq:EQ.}</alt>
|
||||
<m:math>
|
||||
|
||||
<m:mrow>
|
||||
<m:mstyle mathvariant='normal'>
|
||||
<m:mrow><m:mi>I</m:mi> <m:mi>a</m:mi><m:mi>m</m:mi> <m:mi>a</m:mi> <m:mi>f</m:mi><m:mi>o</m:mi><m:mi>r</m:mi><m:mi>m</m:mi><m:mi>u</m:mi><m:mi>l</m:mi><m:mi>a</m:mi> <m:mi>w</m:mi><m:mi>i</m:mi><m:mi>t</m:mi><m:mi>h</m:mi> <m:mi>a</m:mi> <m:mi>r</m:mi><m:mi>e</m:mi><m:mi>f</m:mi><m:mn>.</m:mn>
|
||||
</m:mrow>
|
||||
</m:mstyle>
|
||||
</m:mrow>
|
||||
</m:math>
|
||||
</informalequation></para>
|
||||
|
||||
<para>See <xref linkend="sec.Sec-2kqgsdiflhqsdlifgjuzer-povtuizmvnuer-t-vmsrmfli--uh--a--rtpfuo----rtpc.m-ca-rgifzapeu-tvgz-2" />.</para>
|
||||
|
||||
<para>Also, a formula with an user-defined macro that outputs well in LaTeX but cannot in MathML (hence replaced by picture):
|
||||
<inlineequation>
|
||||
<m:math>
|
||||
<m:alt role='tex'>\testmacro</m:alt>
|
||||
</m:math>
|
||||
</inlineequation>. </para>
|
||||
|
||||
<!-- \latexCommandThatShouldBeCommented --><section>
|
||||
</m:math>
|
||||
</informalequation></para>
|
||||
<para>See <xref linkend="sec.Sec-2kqgsdiflhqsdlifgjuzer-povtuizmvnuer-t-vmsrmfli--uh--a--rtpfuo----rtpc.m-ca-rgifzapeu-tvgz" />.</para>
|
||||
<para>Also, a formula with an user-defined macro that outputs well in LaTeX but cannot in MathML (hence replaced by picture): <inlineequation>
|
||||
<alt role='tex'>\testmacro</alt>
|
||||
<mathphrase>MathML export failed. Please report this as a bug.</mathphrase>
|
||||
</inlineequation>. </para>
|
||||
<!-- \latexCommandThatShouldBeCommented -->
|
||||
<section>
|
||||
<title>I am the first subsection</title>
|
||||
<para>I am the only paragraph of the first subsection. </para>
|
||||
</section>
|
||||
@ -72,174 +65,150 @@
|
||||
<para>I am the only paragraph of the second subsection. </para>
|
||||
</section>
|
||||
</section>
|
||||
<section xml:id="sec.Sec-2kqgsdiflhqsdlifgjuzer-povtuizmvnuer-t-vmsrmfli--uh--a--rtpfuo----rtpc.m-ca-rgifzapeu-tvgz-2">
|
||||
<section xml:id="sec.Sec-2kqgsdiflhqsdlifgjuzer-povtuizmvnuer-t-vmsrmfli--uh--a--rtpfuo----rtpc.m-ca-rgifzapeu-tvgz">
|
||||
<title>I am the second section </title>
|
||||
<para>I am the only paragraph of the second section. <link xlink:href="http://example.org">Hyperlink.</link> “Text between quotes.”</para>
|
||||
|
||||
<para>See <xref linkend="sec.Sec-1-0" />.</para>
|
||||
<para>See <xref linkend="sec.Sec-1" />.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>I am the third section and I have fun with lists</title>
|
||||
<orderedlist><listitem>First item.
|
||||
<br />
|
||||
Second line of the first item, after a line break. </listitem></orderedlist>
|
||||
<orderedlist><listitem>Second item. </listitem></orderedlist>
|
||||
<itemizedlist><listitem>Item has no order (1). </listitem></itemizedlist>
|
||||
<itemizedlist><listitem>Item has no order (2). </listitem></itemizedlist>
|
||||
<variablelist><listitem><varlistentry>
|
||||
|
||||
Word description<!-- Output Error: Closing tag `listitem' when other tags are open, namely: -->
|
||||
<!-- Output Error: varlistentry -->
|
||||
</varlistentry></listitem></variablelist>
|
||||
<variablelist><listitem><varlistentry>
|
||||
|
||||
<orderedlist><listitem><para>First item. </para>
|
||||
<para>Second line of the first item, after a line break. </para>
|
||||
</listitem>
|
||||
|
||||
<listitem><para>Second item. </para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
|
||||
<itemizedlist><listitem><para>Item has no order (1). </para>
|
||||
</listitem>
|
||||
|
||||
<listitem><para>Item has no order (2). </para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<variablelist><varlistentry><term>Word</term>
|
||||
|
||||
|
||||
<listitem><para> description</para>
|
||||
</listitem></varlistentry>
|
||||
<varlistentry><term>Sentence</term>
|
||||
|
||||
|
||||
<listitem><para> meaning</para>
|
||||
</listitem></varlistentry>
|
||||
</variablelist>
|
||||
Sentence meaning<!-- Output Error: Closing tag `listitem' when other tags are open, namely: -->
|
||||
<!-- Output Error: varlistentry -->
|
||||
</varlistentry></listitem></variablelist>
|
||||
</section>
|
||||
<section>
|
||||
<title>I am the fourth section and I deal with formatting. </title>
|
||||
<para>The following paragraph should be code. </para>
|
||||
|
||||
<para><programlisting>I am some code.
|
||||
I am a second line of code. </programlisting>I am no more code. </para>
|
||||
|
||||
I am a second line of code.
|
||||
</programlisting>I am no more code. </para>
|
||||
<para>This line has inline code. <code>This has typewriter font</code><footnote><para>I repeat that in a footnote.</para>
|
||||
</footnote>. </para>
|
||||
|
||||
<para>On the other hand, <footnote><para>this footnote</para>
|
||||
|
||||
<para>has multiple </para>
|
||||
|
||||
<para>paragraphs.</para>
|
||||
</footnote>. </para>
|
||||
</section>
|
||||
<section>
|
||||
<title>I am the fifth section and I deal with floats</title>
|
||||
<para>Now, three tables: </para>
|
||||
|
||||
|
||||
<table><caption>I am a table caption below the table.</caption>
|
||||
|
||||
|
||||
<tbody><tr><td align='center' valign='top'>Table 1</td>
|
||||
<table>
|
||||
<caption>I am a table caption below the table.</caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align='center' valign='top'>Table 1</td>
|
||||
<td align='center' valign='top'>Table 2</td>
|
||||
<td align='center' valign='top'>Table 3</td>
|
||||
</tr>
|
||||
<tr><td align='center' valign='top'>Row 1</td>
|
||||
<tr>
|
||||
<td align='center' valign='top'>Row 1</td>
|
||||
<td align='center' valign='top'></td>
|
||||
<td align='center' valign='top'>Col 3, row 1</td>
|
||||
</tr>
|
||||
<tr><td align='center' valign='top'>Row 2</td>
|
||||
<tr>
|
||||
<td align='center' valign='top'>Row 2</td>
|
||||
<td align='center' valign='top'></td>
|
||||
<td align='center' valign='top'>Col 3, row 2</td>
|
||||
</tr></tbody>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<table><caption>I am a table caption above the table.</caption>
|
||||
|
||||
|
||||
|
||||
<tbody><tr><td align='center' valign='top'>Table 1</td>
|
||||
<table>
|
||||
<caption>I am a table caption above the table.</caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align='center' valign='top'>Table 1</td>
|
||||
<td align='center' valign='top'>Table 2</td>
|
||||
<td align='center' valign='top'>Table 3</td>
|
||||
</tr>
|
||||
<tr><td align='center' valign='top'>Row 1</td>
|
||||
<tr>
|
||||
<td align='center' valign='top'>Row 1</td>
|
||||
<td align='center' valign='top'></td>
|
||||
<td align='center' valign='top'>Col 3, row 1</td>
|
||||
</tr>
|
||||
<tr><td align='center' valign='top'>Row 2</td>
|
||||
<tr>
|
||||
<td align='center' valign='top'>Row 2</td>
|
||||
<td align='center' valign='top'></td>
|
||||
<td align='center' valign='top'>Col 3, row 2</td>
|
||||
</tr></tbody>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<informaltable><tbody><tr><td align='center' valign='top'>Table that has no caption 1</td>
|
||||
<informaltable>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align='center' valign='top'>Table that has no caption 1</td>
|
||||
<td align='center' valign='top'>Table that has no caption 2</td>
|
||||
<td align='center' valign='top'>Table that has no caption 3</td>
|
||||
</tr>
|
||||
<tr><td align='center' valign='top'>Row 1</td>
|
||||
<tr>
|
||||
<td align='center' valign='top'>Row 1</td>
|
||||
<td align='center' valign='top'></td>
|
||||
<td align='center' valign='top'>Col 3, row 1</td>
|
||||
</tr>
|
||||
<tr><td align='center' valign='top'>Row 2</td>
|
||||
<tr>
|
||||
<td align='center' valign='top'>Row 2</td>
|
||||
<td align='center' valign='top'></td>
|
||||
<td align='center' valign='top'>Col 3, row 2</td>
|
||||
</tr></tbody>
|
||||
</tr>
|
||||
</tbody>
|
||||
</informaltable>
|
||||
|
||||
<para>Then, one figure: </para>
|
||||
|
||||
|
||||
<figure><title>Caption.</title>
|
||||
|
||||
|
||||
<mediaobject><imageobject><imagedata fileref="0_mnt_d_Thibaut_LyX_autotests_export_docbook_lyx-logo.png" />
|
||||
<figure>
|
||||
<title>Caption.</title>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="D:/LyX/lyx-unstable/autotests/export/docbook/lyx-logo.png" />
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
|
||||
</figure>
|
||||
</section>
|
||||
<section>
|
||||
<title>I am the sixth section and I really like bibliographies</title>
|
||||
<para>This text has references. First reference: <biblioref endterm="big" />. Second reference: <biblioref endterm="small" />. Both at the same time: <biblioref endterm="big" />, <biblioref endterm="small" />. A book: <biblioref endterm="Gro60" />. </para>
|
||||
|
||||
<para>Many things, just testing for completeness: <biblioref endterm="article" />, <biblioref endterm="book" />, <biblioref endterm="booklet" />, <biblioref endterm="conference" />, <biblioref endterm="inbook" />, <biblioref endterm="incollection" />. </para>
|
||||
</section>
|
||||
<section>
|
||||
<title>I am the seventh section and I deal with indices</title>
|
||||
<para>First, a term to index: <indexterm type="idx"><primary>Term to index</primary></indexterm>. Then a term to add to the second index: <indexterm type="oth"><primary>Term to add to the second index</primary></indexterm>. </para>
|
||||
|
||||
<para>Then several terms for the first index: <indexterm type="idx"><primary>Term</primary><secondary>to</secondary><tertiary>index</tertiary></indexterm>. </para>
|
||||
|
||||
<para>With a see: <indexterm type="idx"><primary>Term</primary><see>index</see></indexterm>. With a see also: <indexterm type="idx"><primary>Term</primary><seealso>index</seealso></indexterm>. </para>
|
||||
|
||||
<para>Several terms with a see: <indexterm type="idx"><primary>Term</primary><secondary>to</secondary><tertiary>index</tertiary><see>index</see></indexterm>. Several terms with a see also: <indexterm type="idx"><primary>Term</primary><secondary>to</secondary><tertiary>index</tertiary><seealso>index</seealso></indexterm>. </para>
|
||||
|
||||
<para>A start of range: <indexterm type="idx" class="startofrange" xml:id="Term-to-index-3"><primary>Term to index</primary></indexterm>. The corresponding end of range: <indexterm type="idx" class="endofrange" startref="Term-to-index-3"><primary>Term to index</primary></indexterm>.</para>
|
||||
|
||||
<para>Several terms with a start of range: <indexterm type="idx" class="startofrange" xml:id="Term.to.index-4"><primary>Term</primary><secondary>to</secondary><tertiary>index</tertiary></indexterm>. The corresponding end of range: <indexterm type="idx" class="endofrange" startref="Term.to.index-4"><primary>Term</primary><secondary>to</secondary><tertiary>index</tertiary></indexterm>.</para>
|
||||
|
||||
<para>These terms already appeared before! Start of range: <indexterm type="idx" class="startofrange" xml:id="Term.to.index-0-5"><primary>Term</primary><secondary>to</secondary><tertiary>index</tertiary></indexterm>. The corresponding end of range: <indexterm type="idx" class="endofrange" startref="Term.to.index-0-5"><primary>Term</primary><secondary>to</secondary><tertiary>index</tertiary></indexterm>.</para>
|
||||
<para>A start of range: <indexterm type="idx" class="startofrange" xml:id="Term-to-index"><primary>Term to index</primary></indexterm>. The corresponding end of range: <indexterm type="idx" class="endofrange" startref="Term-to-index"><primary>Term to index</primary></indexterm>.</para>
|
||||
<para>Several terms with a start of range: <indexterm type="idx" class="startofrange" xml:id="Term.to.index"><primary>Term</primary><secondary>to</secondary><tertiary>index</tertiary></indexterm>. The corresponding end of range: <indexterm type="idx" class="endofrange" startref="Term.to.index"><primary>Term</primary><secondary>to</secondary><tertiary>index</tertiary></indexterm>.</para>
|
||||
<para>These terms already appeared before! Start of range: <indexterm type="idx" class="startofrange" xml:id="Term.to.index-0"><primary>Term</primary><secondary>to</secondary><tertiary>index</tertiary></indexterm>. The corresponding end of range: <indexterm type="idx" class="endofrange" startref="Term.to.index-0"><primary>Term</primary><secondary>to</secondary><tertiary>index</tertiary></indexterm>.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>I am the eight section and I deal with star sections</title>
|
||||
<bridgehead renderas="part">Star part</bridgehead>
|
||||
<bridgehead renderas='other' otherrenderas='part'>Star part</bridgehead>
|
||||
<bridgehead renderas="sect1">Star section (sect1)</bridgehead>
|
||||
<bridgehead renderas="sect2">Star subsection (sect2)</bridgehead>
|
||||
<bridgehead renderas="sect3">Star subsubsection (sect3)</bridgehead>
|
||||
<bridgehead renderas="sect4">Star paragraph (sect4)</bridgehead>
|
||||
<bridgehead renderas="sect5">Star subparagraph (sect5)</bridgehead>
|
||||
</section>
|
||||
|
||||
<bibliography><title>References</title>
|
||||
|
||||
<biblioentry xml:id="article"><title>The title of the work</title><volumenum>4</volumenum><artpagenums>201-213</artpagenums><bibliomisc role="type">article</bibliomisc>
|
||||
<bibliography>
|
||||
<title>References</title>
|
||||
<biblioentry xml:id="article">
|
||||
<title>The title of the work</title><volumenum>4</volumenum><artpagenums>201-213</artpagenums><bibliomisc role="type">article</bibliomisc>
|
||||
<pubdate>1993</pubdate>
|
||||
|
||||
<biblioset relation="journal"><title>The name of the journal</title>
|
||||
<biblioset relation="journal">
|
||||
<title>The name of the journal</title>
|
||||
</biblioset>
|
||||
|
||||
|
||||
<authorgroup><author><personname><firstname>Peter</firstname>
|
||||
<authorgroup><author>
|
||||
<personname>
|
||||
<firstname>Peter</firstname>
|
||||
<surname>Adams</surname>
|
||||
</personname>
|
||||
</author>
|
||||
@ -247,119 +216,119 @@ I am a second line of code. </programlisting>I am no more code. </para>
|
||||
<biblioid class="pubsnumber">2</biblioid>
|
||||
<bibliomisc role="note">An optional note</bibliomisc>
|
||||
</biblioentry>
|
||||
|
||||
<biblioentry xml:id="book"><title>The title of the work</title><volumenum>4</volumenum><edition>3</edition><bibliomisc role="type">book</bibliomisc>
|
||||
|
||||
<publisher><publishername>The name of the publisher</publishername>
|
||||
<biblioentry xml:id="book">
|
||||
<title>The title of the work</title><volumenum>4</volumenum><edition>3</edition><bibliomisc role="type">book</bibliomisc>
|
||||
<publisher>
|
||||
<publishername>The name of the publisher</publishername>
|
||||
<address>The address</address></publisher>
|
||||
<pubdate>1993</pubdate>
|
||||
|
||||
|
||||
<authorgroup><author><personname><firstname>Peter</firstname>
|
||||
<authorgroup><author>
|
||||
<personname>
|
||||
<firstname>Peter</firstname>
|
||||
<surname>Babington</surname>
|
||||
</personname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
<bibliomisc role="note">An optional note</bibliomisc>
|
||||
</biblioentry>
|
||||
|
||||
<biblioentry xml:id="booklet"><title>The title of the work</title><bibliomisc role="type">booklet</bibliomisc>
|
||||
<biblioentry xml:id="booklet">
|
||||
<title>The title of the work</title><bibliomisc role="type">booklet</bibliomisc>
|
||||
<pubdate>1993</pubdate>
|
||||
|
||||
|
||||
<authorgroup><author><personname><firstname>Peter</firstname>
|
||||
<authorgroup><author>
|
||||
<personname>
|
||||
<firstname>Peter</firstname>
|
||||
<surname>Caxton</surname>
|
||||
</personname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</biblioentry>
|
||||
|
||||
<biblioentry xml:id="conference"><title>The title of the work</title><artpagenums>213</artpagenums><bibliomisc role="type">conference</bibliomisc>
|
||||
|
||||
<publisher><publishername>The publisher</publishername>
|
||||
<biblioentry xml:id="conference">
|
||||
<title>The title of the work</title><artpagenums>213</artpagenums><bibliomisc role="type">conference</bibliomisc>
|
||||
<publisher>
|
||||
<publishername>The publisher</publishername>
|
||||
</publisher>
|
||||
<pubdate>1993</pubdate>
|
||||
|
||||
|
||||
<authorgroup><author><personname><firstname>Peter</firstname>
|
||||
<authorgroup><author>
|
||||
<personname>
|
||||
<firstname>Peter</firstname>
|
||||
<surname>Draper</surname>
|
||||
</personname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</biblioentry>
|
||||
|
||||
<biblioentry xml:id="inbook"><title>The title of the work</title><artpagenums>201-213</artpagenums><bibliomisc role="type">inbook</bibliomisc>
|
||||
|
||||
<publisher><publishername>The name of the publisher</publishername>
|
||||
<biblioentry xml:id="inbook">
|
||||
<title>The title of the work</title><artpagenums>201-213</artpagenums><bibliomisc role="type">inbook</bibliomisc>
|
||||
<publisher>
|
||||
<publishername>The name of the publisher</publishername>
|
||||
</publisher>
|
||||
<pubdate>1993</pubdate>
|
||||
|
||||
|
||||
<authorgroup><author><personname><firstname>Peter</firstname>
|
||||
<authorgroup><author>
|
||||
<personname>
|
||||
<firstname>Peter</firstname>
|
||||
<surname>Eston</surname>
|
||||
</personname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</biblioentry>
|
||||
|
||||
<biblioentry xml:id="incollection"><title>The title of the work</title><volumenum>4</volumenum><edition>3</edition><artpagenums>201-213</artpagenums><bibliomisc role="type">incollection</bibliomisc>
|
||||
|
||||
<publisher><publishername>The name of the publisher</publishername>
|
||||
<biblioentry xml:id="incollection">
|
||||
<title>The title of the work</title><volumenum>4</volumenum><edition>3</edition><artpagenums>201-213</artpagenums><bibliomisc role="type">incollection</bibliomisc>
|
||||
<publisher>
|
||||
<publishername>The name of the publisher</publishername>
|
||||
<address>The address of the publisher</address></publisher>
|
||||
<pubdate>1993</pubdate>
|
||||
|
||||
<biblioset relation="book"><title>The title of the book</title>
|
||||
<biblioset relation="book">
|
||||
<title>The title of the book</title>
|
||||
</biblioset>
|
||||
|
||||
|
||||
<authorgroup><author><personname><firstname>Peter</firstname>
|
||||
<authorgroup><author>
|
||||
<personname>
|
||||
<firstname>Peter</firstname>
|
||||
<surname>Farindon</surname>
|
||||
</personname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
<bibliomisc role="note">An optional note</bibliomisc>
|
||||
</biblioentry>
|
||||
|
||||
<biblioentry xml:id="small"><title>A small paper</title><volumenum>-1</volumenum><bibliomisc role="type">article</bibliomisc>
|
||||
<biblioentry xml:id="small">
|
||||
<title>A small paper</title><volumenum>-1</volumenum><bibliomisc role="type">article</bibliomisc>
|
||||
<pubdate>1997</pubdate>
|
||||
|
||||
<biblioset relation="journal"><title>The journal of small papers</title>
|
||||
<biblioset relation="journal">
|
||||
<title>The journal of small papers</title>
|
||||
</biblioset>
|
||||
|
||||
|
||||
<authorgroup><author><personname><surname>Freely</surname>
|
||||
<authorgroup><author>
|
||||
<personname>
|
||||
<surname>Freely</surname>
|
||||
<othername role="suffix">I. P.</othername>
|
||||
</personname>
|
||||
</author>
|
||||
|
||||
|
||||
<author><personname><firstname>Ditto</firstname>
|
||||
<author>
|
||||
<personname>
|
||||
<firstname>Ditto</firstname>
|
||||
<surname>Johannes</surname>
|
||||
</personname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
<bibliomisc role="note">to appear</bibliomisc>
|
||||
</biblioentry>
|
||||
|
||||
<biblioentry xml:id="Gro60."><title>Éléments de géométrie algébrique</title><bibliomisc role="type">book</bibliomisc>
|
||||
<biblioentry xml:id="Gro60">
|
||||
<title>Éléments de géométrie algébrique</title><bibliomisc role="type">book</bibliomisc>
|
||||
<pubdate>1960</pubdate>
|
||||
|
||||
|
||||
<authorgroup><author><personname><firstname>Alexander</firstname>
|
||||
<authorgroup><author>
|
||||
<personname>
|
||||
<firstname>Alexander</firstname>
|
||||
<surname>Grothendieck</surname>
|
||||
</personname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</biblioentry>
|
||||
|
||||
<biblioentry xml:id="big"><title>A big paper</title><volumenum>MCMXCVII</volumenum><bibliomisc role="type">article</bibliomisc>
|
||||
<biblioentry xml:id="big">
|
||||
<title>A big paper</title><volumenum>MCMXCVII</volumenum><bibliomisc role="type">article</bibliomisc>
|
||||
<pubdate>7991</pubdate>
|
||||
|
||||
<biblioset relation="journal"><title>The journal of big papers</title>
|
||||
<biblioset relation="journal">
|
||||
<title>The journal of big papers</title>
|
||||
</biblioset>
|
||||
|
||||
|
||||
<authorgroup><author><personname><firstname>Hugh</firstname>
|
||||
<authorgroup><author>
|
||||
<personname>
|
||||
<firstname>Hugh</firstname>
|
||||
<surname>Jass</surname>
|
||||
</personname>
|
||||
</author>
|
||||
|
253
autotests/export/docbook/easy.lyx
Normal file
253
autotests/export/docbook/easy.lyx
Normal file
@ -0,0 +1,253 @@
|
||||
#LyX 2.4 created this file. For more info see https://www.lyx.org/
|
||||
\lyxformat 598
|
||||
\begin_document
|
||||
\begin_header
|
||||
\save_transient_properties true
|
||||
\origin unavailable
|
||||
\textclass article
|
||||
\begin_preamble
|
||||
\newcommand{\testmacro}{\ensuremath{\operatorname{testmacro}}}
|
||||
\end_preamble
|
||||
\use_default_options true
|
||||
\maintain_unincluded_children no
|
||||
\language english
|
||||
\language_package default
|
||||
\inputencoding auto-legacy
|
||||
\fontencoding auto
|
||||
\font_roman "default" "default"
|
||||
\font_sans "default" "default"
|
||||
\font_typewriter "default" "default"
|
||||
\font_math "auto" "auto"
|
||||
\font_default_family default
|
||||
\use_non_tex_fonts false
|
||||
\font_sc false
|
||||
\font_roman_osf false
|
||||
\font_sans_osf false
|
||||
\font_typewriter_osf false
|
||||
\font_sf_scale 100 100
|
||||
\font_tt_scale 100 100
|
||||
\use_microtype false
|
||||
\use_dash_ligatures true
|
||||
\graphics default
|
||||
\default_output_format default
|
||||
\output_sync 0
|
||||
\bibtex_command default
|
||||
\index_command default
|
||||
\paperfontsize default
|
||||
\spacing single
|
||||
\use_hyperref false
|
||||
\papersize default
|
||||
\use_geometry false
|
||||
\use_package amsmath 1
|
||||
\use_package amssymb 1
|
||||
\use_package cancel 1
|
||||
\use_package esint 1
|
||||
\use_package mathdots 1
|
||||
\use_package mathtools 1
|
||||
\use_package mhchem 1
|
||||
\use_package stackrel 1
|
||||
\use_package stmaryrd 1
|
||||
\use_package undertilde 1
|
||||
\cite_engine basic
|
||||
\cite_engine_type default
|
||||
\biblio_style plain
|
||||
\use_bibtopic false
|
||||
\use_indices true
|
||||
\paperorientation portrait
|
||||
\suppress_date false
|
||||
\justification true
|
||||
\use_refstyle 1
|
||||
\use_minted 0
|
||||
\use_lineno 0
|
||||
\index Index
|
||||
\shortcut idx
|
||||
\color #008000
|
||||
\end_index
|
||||
\index Other index
|
||||
\shortcut oth
|
||||
\color #cc0000
|
||||
\end_index
|
||||
\secnumdepth 3
|
||||
\tocdepth 3
|
||||
\paragraph_separation indent
|
||||
\paragraph_indentation default
|
||||
\is_math_indent 0
|
||||
\math_numbering_side default
|
||||
\quotes_style english
|
||||
\dynamic_quotes 0
|
||||
\papercolumns 1
|
||||
\papersides 1
|
||||
\paperpagestyle default
|
||||
\tablestyle default
|
||||
\tracking_changes false
|
||||
\output_changes false
|
||||
\change_bars false
|
||||
\postpone_fragile_content false
|
||||
\html_math_output 0
|
||||
\html_css_as_file 0
|
||||
\html_be_strict false
|
||||
\docbook_table_output 0
|
||||
\end_header
|
||||
|
||||
\begin_body
|
||||
|
||||
\begin_layout Title
|
||||
I am a title
|
||||
\end_layout
|
||||
|
||||
\begin_layout Author
|
||||
I am an author
|
||||
\end_layout
|
||||
|
||||
\begin_layout Date
|
||||
I am a date
|
||||
\end_layout
|
||||
|
||||
\begin_layout Abstract
|
||||
I am an abstract
|
||||
\end_layout
|
||||
|
||||
\begin_layout Abstract
|
||||
I am also an abstract
|
||||
\end_layout
|
||||
|
||||
\begin_layout Section
|
||||
I am the first section
|
||||
\begin_inset CommandInset label
|
||||
LatexCommand label
|
||||
name "sec:Sec-1"
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
I am the first paragraph of the first section.
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
I am the second paragraph of the first section.
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Quote
|
||||
I am a quote
|
||||
\begin_inset Formula $\,with\,a\,formula$
|
||||
\end_inset
|
||||
|
||||
.
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_inset Formula
|
||||
\[
|
||||
Formula!
|
||||
\]
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
I am the first subsection
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
I am the only paragraph of the first subsection.
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
I am the second subsection
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
I am the only paragraph of the second subsection.
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Section
|
||||
I am the second section
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
I am the only paragraph of the second section.
|
||||
|
||||
\begin_inset CommandInset href
|
||||
LatexCommand href
|
||||
name "Hyperlink."
|
||||
target "http://example.org"
|
||||
literal "false"
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
Text between quotes.
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
See
|
||||
\begin_inset CommandInset ref
|
||||
LatexCommand ref
|
||||
reference "sec:Sec-1"
|
||||
plural "false"
|
||||
caps "false"
|
||||
noprefix "false"
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Section
|
||||
I am the third section and I deal with star sections
|
||||
\end_layout
|
||||
|
||||
\begin_layout Part*
|
||||
Star part
|
||||
\end_layout
|
||||
|
||||
\begin_layout Section*
|
||||
Star section (sect1)
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection*
|
||||
Star subsection (sect2)
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsubsection*
|
||||
Star subsubsection (sect3)
|
||||
\end_layout
|
||||
|
||||
\begin_layout Paragraph*
|
||||
Star paragraph (sect4)
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subparagraph*
|
||||
Star subparagraph (sect5)
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_inset CommandInset bibtex
|
||||
LatexCommand bibtex
|
||||
bibfiles "basic"
|
||||
options "plain"
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_body
|
||||
\end_document
|
68
autotests/export/docbook/easy.xml
Normal file
68
autotests/export/docbook/easy.xml
Normal file
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This DocBook file was created by LyX 2.4.0dev
|
||||
See http://www.lyx.org/ for more information -->
|
||||
<article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
|
||||
<info>
|
||||
<title>I am a title</title>
|
||||
<author>
|
||||
<personname>I am an author</personname>
|
||||
</author>
|
||||
<date>I am a date</date>
|
||||
<abstract>
|
||||
<para>I am an abstract</para>
|
||||
<para>I am also an abstract</para>
|
||||
</abstract>
|
||||
</info>
|
||||
<section xml:id="sec.Sec-1-0">
|
||||
<title>I am the first section </title>
|
||||
<para>I am the first paragraph of the first section. </para>
|
||||
<para>I am the second paragraph of the first section. </para>
|
||||
<blockquote>
|
||||
<para>I am a quote<inlineequation>
|
||||
<alt role='tex'>\,with\,a\,formula</alt>
|
||||
<m:math>
|
||||
|
||||
<m:mrow>
|
||||
<m:mrow><m:mspace width="6px" /><m:mi>w</m:mi><m:mi>i</m:mi><m:mi>t</m:mi><m:mi>h</m:mi><m:mspace width="6px" /><m:mi>a</m:mi><m:mspace width="6px" /><m:mi>f</m:mi><m:mi>o</m:mi><m:mi>r</m:mi><m:mi>m</m:mi><m:mi>u</m:mi><m:mi>l</m:mi><m:mi>a</m:mi>
|
||||
</m:mrow>
|
||||
</m:mrow>
|
||||
</m:math>
|
||||
</inlineequation>. </para>
|
||||
</blockquote>
|
||||
<informalequation>
|
||||
<alt role='tex'>Formula!</alt>
|
||||
<m:math>
|
||||
|
||||
<m:mrow>
|
||||
<m:mrow><m:mi>F</m:mi><m:mi>o</m:mi><m:mi>r</m:mi><m:mi>m</m:mi><m:mi>u</m:mi><m:mi>l</m:mi><m:mi>a</m:mi><m:mo>!</m:mo>
|
||||
</m:mrow>
|
||||
</m:mrow>
|
||||
</m:math>
|
||||
</informalequation><section>
|
||||
<title>I am the first subsection</title>
|
||||
<para>I am the only paragraph of the first subsection. </para>
|
||||
</section>
|
||||
<section>
|
||||
<title>I am the second subsection</title>
|
||||
<para>I am the only paragraph of the second subsection. </para>
|
||||
</section>
|
||||
</section>
|
||||
<section>
|
||||
<title>I am the second section </title>
|
||||
<para>I am the only paragraph of the second section. <link xlink:href="http://example.org">Hyperlink.</link> “Text between quotes.”</para>
|
||||
<para>See <xref linkend="sec.Sec-1-0" />.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>I am the third section and I deal with star sections</title>
|
||||
<bridgehead renderas='other' otherrenderas='part'>Star part</bridgehead>
|
||||
<bridgehead renderas="sect1">Star section (sect1)</bridgehead>
|
||||
<bridgehead renderas="sect2">Star subsection (sect2)</bridgehead>
|
||||
<bridgehead renderas="sect3">Star subsubsection (sect3)</bridgehead>
|
||||
<bridgehead renderas="sect4">Star paragraph (sect4)</bridgehead>
|
||||
<bridgehead renderas="sect5">Star subparagraph (sect5)</bridgehead>
|
||||
</section>
|
||||
<bibliography>
|
||||
<title>References</title>
|
||||
<!-- No entry in the bibliography. -->
|
||||
</bibliography>
|
||||
</article>
|
@ -87,7 +87,23 @@ Test document
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
A list:
|
||||
A simple list:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
First item
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Second item on two lines
|
||||
\begin_inset Newline newline
|
||||
\end_inset
|
||||
|
||||
I'm the second line
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
A complex list:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
|
@ -2,33 +2,61 @@
|
||||
<!-- This DocBook file was created by LyX 2.4.0dev
|
||||
See http://www.lyx.org/ for more information -->
|
||||
<article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
|
||||
<title>Test document</title>
|
||||
<para>A list:</para>
|
||||
<title>
|
||||
Test document
|
||||
</title>
|
||||
<para>
|
||||
A simple list:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>First item</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Second item on two lines<!-- Is para open? yes --><!-- Output Error: Closing tag `para' when other tags are open, namely: -->
|
||||
<!-- Output Error: &LyX_parsep_tag& -->
|
||||
</para>
|
||||
<para>I'm the second line<!-- Output Error: Tags still open in closeFontTags(). Probably not a problem,
|
||||
but you might want to check these tags: -->
|
||||
<!-- Output Error: para -->
|
||||
<!-- Output Error: listitem -->
|
||||
<!-- Output Error: itemizedlist -->
|
||||
<!-- Output Error: No division separation tag found in endDivision(). -->
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
A complex list:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>First item</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>First first item</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>First second item</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>Text after first item</para>
|
||||
</listitem>
|
||||
<para>
|
||||
Text after first item
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Second item</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<orderedlist><listitem>
|
||||
<para>Second first item</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
</orderedlist>
|
||||
<orderedlist><listitem>
|
||||
<para>Second second item</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
<para>Text after second item</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
Text after second item
|
||||
</para>
|
||||
|
||||
</article>
|
@ -28,8 +28,9 @@ Style Quotation
|
||||
AlignPossible Block, Left, Right, Center
|
||||
HTMLTag blockquote
|
||||
HTMLItem div
|
||||
DocBookTag blockquote
|
||||
DocBookItemTag para
|
||||
DocBookWrapperTag blockquote
|
||||
DocBookWrapperMergeWithPrevious true
|
||||
DocBookTag para
|
||||
End
|
||||
|
||||
|
||||
@ -50,8 +51,9 @@ Style Quote
|
||||
LabelType No_Label
|
||||
HTMLTag blockquote
|
||||
HTMLItem div
|
||||
DocBookTag blockquote
|
||||
DocBookItemTag para
|
||||
DocBookWrapperTag blockquote
|
||||
DocBookWrapperMergeWithPrevious true
|
||||
DocBookTag para
|
||||
End
|
||||
|
||||
|
||||
|
@ -43,7 +43,9 @@ Style Itemize
|
||||
Color latex
|
||||
EndFont
|
||||
EndArgument
|
||||
DocBookTag itemizedlist
|
||||
DocBookWrapperTag itemizedlist
|
||||
DocBookWrapperMergeWithPrevious true
|
||||
DocBookTag NONE
|
||||
DocBookItemTag listitem
|
||||
DocBookItemInnerTag para
|
||||
End
|
||||
|
@ -19,7 +19,7 @@ Style Part*
|
||||
LabelCounter ""
|
||||
ResetArgs 1
|
||||
DocBookTag bridgehead
|
||||
DocBookAttr renderas="part"
|
||||
DocBookAttr "renderas='other' otherrenderas='part'"
|
||||
DocBookSectionTag NONE
|
||||
DocBookForceAbstractTag NONE
|
||||
End
|
||||
@ -34,7 +34,7 @@ Style Chapter*
|
||||
LabelCounter ""
|
||||
ResetArgs 1
|
||||
DocBookTag bridgehead
|
||||
DocBookAttr renderas="chapter"
|
||||
DocBookAttr "renderas='other' otherrenderas='chapter'"
|
||||
DocBookSectionTag NONE
|
||||
DocBookForceAbstractTag NONE
|
||||
End
|
||||
|
@ -51,8 +51,9 @@ Style Abstract
|
||||
EndHTMLStyle
|
||||
DocBookAbstract true
|
||||
DocBookInInfo always
|
||||
DocBookTag abstract
|
||||
DocBookItemTag para
|
||||
DocBookWrapperTag abstract
|
||||
DocBookWrapperMergeWithPrevious true
|
||||
DocBookTag para
|
||||
End
|
||||
|
||||
|
||||
|
@ -3383,12 +3383,9 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
if (!runparams.for_toc || inset->isInToc()) {
|
||||
OutputParams np = runparams;
|
||||
np.local_font = &font;
|
||||
// If the paragraph has size 1, then we are in the "special
|
||||
// case" where we do not output the containing paragraph info.
|
||||
// This "special case" is defined in more details in output_docbook.cpp, makeParagraphs. The results
|
||||
// of that brittle logic is passed to this function through open_par.
|
||||
if (!inset->getLayout().htmlisblock() && size() != 1) // TODO: htmlisblock here too!
|
||||
np.docbook_in_par = true;
|
||||
|
||||
// TODO: special case will bite here.
|
||||
np.docbook_in_par = true;
|
||||
inset->docbook(xs, np);
|
||||
}
|
||||
} else {
|
||||
|
@ -29,6 +29,17 @@ public:
|
||||
ParagraphList(InputIterator first, InputIterator last)
|
||||
: RandomAccessList<Paragraph>(first, last)
|
||||
{}
|
||||
|
||||
const Paragraph * getParagraphBefore(const_iterator const & par) const
|
||||
{
|
||||
// No previous paragraph.
|
||||
if (par == begin())
|
||||
return nullptr;
|
||||
|
||||
auto prevpar = par;
|
||||
--prevpar;
|
||||
return &*prevpar;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -1157,10 +1157,11 @@ void InsetBibtex::docbook(XMLStream & xs, OutputParams const &) const
|
||||
|
||||
if (vit == ven) {
|
||||
xs << XMLStream::ESCAPE_NONE << "<!-- No entry in the bibliography. -->";
|
||||
xs << xml::CR();
|
||||
}
|
||||
|
||||
for (; vit != ven; ++vit) {
|
||||
BiblioInfo::const_iterator const biit = bibinfo.find(*vit);
|
||||
auto const biit = bibinfo.find(*vit);
|
||||
if (biit == bibinfo.end())
|
||||
continue;
|
||||
|
||||
|
@ -101,7 +101,7 @@ void InsetERT::docbook(XMLStream & xs, OutputParams const & runparams) const
|
||||
odocstringstream os2;
|
||||
XMLStream xs2(os2);
|
||||
|
||||
// Recreate the logic of makeParagraphs in output_docbook.cpp, but much simplified: never open <para>
|
||||
// Recreate the logic of makeParagraph in output_docbook.cpp, but much simplified: never open <para>
|
||||
// in an ERT, use simple line breaks.
|
||||
while (par != end) {
|
||||
par->simpleDocBookOnePar(buffer(), xs2, runparams, text().outerFont(distance(begin, par)));
|
||||
@ -116,6 +116,7 @@ void InsetERT::docbook(XMLStream & xs, OutputParams const & runparams) const
|
||||
xs << XMLStream::ESCAPE_NONE << "<!-- ";
|
||||
xs << XMLStream::ESCAPE_COMMENTS << os2.str();
|
||||
xs << XMLStream::ESCAPE_NONE << " -->";
|
||||
xs << xml::CR();
|
||||
}
|
||||
|
||||
|
||||
|
@ -176,17 +176,18 @@ void InsetNewline::docbook(XMLStream & xs, OutputParams const & runparams) const
|
||||
{
|
||||
if (runparams.docbook_in_par) {
|
||||
xs.closeFontTags();
|
||||
if (!xs.pending_tags_empty()) {
|
||||
xs << xml::EndTag("para");
|
||||
xs << xml::StartTag("para");
|
||||
}
|
||||
else {
|
||||
xs << xml::CR() << xml::CompTag("br") << xml::CR();
|
||||
}
|
||||
}
|
||||
else {
|
||||
xs << xml::CR() << xml::CompTag("br") << xml::CR();
|
||||
|
||||
// TODO: what if within a list item, and docbookiteminnertag is not para? This would require information
|
||||
// about the paragraph's layout... Good for now, though, this should not happen in DocBook, only maybe
|
||||
// extensions.
|
||||
xs << XMLStream::ESCAPE_NONE << from_utf8("<!-- Is para open? " + string((xs.isTagOpen(xml::StartTag("para"))) ? "yes" : "no") +" -->");
|
||||
xs << XMLStream::ESCAPE_NONE << from_utf8("</para>\n<para");
|
||||
// TODO: that's a hack...
|
||||
// xs << xml::EndTag("para");
|
||||
// xs << xml::CR();
|
||||
// xs << xml::StartTag("para");
|
||||
}
|
||||
// Outside a paragraph, no need to handle new lines.
|
||||
}
|
||||
|
||||
|
||||
|
@ -2471,7 +2471,8 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
|
||||
osmath << ostmp.str(); // osmath is not a XMLStream, so no need for XMLStream::ESCAPE_NONE.
|
||||
ms << ETag("math");
|
||||
} catch (MathExportException const &) {
|
||||
osmath << "MathML export failed. Please report this as a bug.";
|
||||
ms.cr();
|
||||
osmath << "<mathphrase>MathML export failed. Please report this as a bug.</mathphrase>";
|
||||
}
|
||||
|
||||
// Output the complete formula to the DocBook stream.
|
||||
|
File diff suppressed because it is too large
Load Diff
45
src/xml.cpp
45
src/xml.cpp
@ -200,7 +200,7 @@ bool XMLStream::closeFontTags()
|
||||
tag_stack_.pop_back();
|
||||
// this shouldn't happen, since then the font tags
|
||||
// weren't in any other tag.
|
||||
// LASSERT(!tag_stack_.empty(), return true);
|
||||
LASSERT(!tag_stack_.empty(), return true);
|
||||
if (tag_stack_.empty())
|
||||
return true;
|
||||
curtag = &tag_stack_.back();
|
||||
@ -583,62 +583,57 @@ docstring xml::uniqueID(docstring const & label)
|
||||
|
||||
docstring xml::cleanID(docstring const & orig)
|
||||
{
|
||||
// The standard xml:id only allows letters,
|
||||
// digits, '-' and '.' in a name.
|
||||
// This routine replaces illegal characters by '-' or '.'
|
||||
// and adds a number for uniqueness if need be.
|
||||
docstring const allowed = from_ascii(".-_");
|
||||
// The standard xml:id only allows letters, digits, '-' and '.' in a name.
|
||||
// This routine replaces illegal characters by '-' or '.' and adds a number for uniqueness if need be.
|
||||
|
||||
// Use a cache of already mangled names: the alterations may merge several IDs as one. This ensures that the IDs
|
||||
// are not mixed up in the document.
|
||||
// This code could be improved: it uses Qt outside the GUI part. Any TLS implementation could do the trick.
|
||||
typedef map<docstring, docstring> MangledMap;
|
||||
static QThreadStorage<MangledMap> tMangledNames;
|
||||
static QThreadStorage<int> tMangleID;
|
||||
|
||||
MangledMap & mangledNames = tMangledNames.localData();
|
||||
|
||||
// If the name is already known, just return it.
|
||||
MangledMap::const_iterator const known = mangledNames.find(orig);
|
||||
MangledMap & mangledNames = tMangledNames.localData();
|
||||
auto const known = mangledNames.find(orig);
|
||||
if (known != mangledNames.end())
|
||||
return known->second;
|
||||
|
||||
// Start creating the mangled name by iterating over the characters.
|
||||
docstring content;
|
||||
docstring::const_iterator it = orig.begin();
|
||||
docstring::const_iterator end = orig.end();
|
||||
auto it = orig.cbegin();
|
||||
auto end = orig.cend();
|
||||
|
||||
// Make sure it starts with a letter.
|
||||
if (!isAlphaASCII(*it) && allowed.find(*it) >= allowed.size())
|
||||
if (!isAlphaASCII(*it))
|
||||
content += "x";
|
||||
|
||||
// Do the mangling.
|
||||
// Parse the ID character by character and change what needs to.
|
||||
bool mangle = false; // Indicates whether the ID had to be changed, i.e. if ID no more ensured to be unique.
|
||||
for (; it != end; ++it) {
|
||||
char_type c = *it;
|
||||
if (isAlphaASCII(c) || isDigitASCII(c) || c == '-' || c == '.'
|
||||
|| allowed.find(c) < allowed.size())
|
||||
if (isAlphaASCII(c) || isDigitASCII(c) || c == '-' || c == '.' || c == '_') {
|
||||
content += c;
|
||||
else if (c == '_' || c == ' ') {
|
||||
mangle = true;
|
||||
content += "-";
|
||||
}
|
||||
else if (c == ':' || c == ',' || c == ';' || c == '!') {
|
||||
} else if (c == ':' || c == ',' || c == ';' || c == '!') {
|
||||
mangle = true;
|
||||
content += ".";
|
||||
}
|
||||
else {
|
||||
} else { // Other invalid characters, such as ' '.
|
||||
mangle = true;
|
||||
content += "-";
|
||||
}
|
||||
}
|
||||
|
||||
if (mangle) {
|
||||
// If there had to be a change, check if ID unicity is still guaranteed.
|
||||
// This avoids having a clash if satisfying XML requirements for ID makes two IDs identical, like "a:b" and "a!b",
|
||||
// as both of them would be transformed as "a.b". With this procedure, one will become "a.b" and the other "a.b-1".
|
||||
if (mangle && mangledNames.find(content) != mangledNames.end()) {
|
||||
int & mangleID = tMangleID.localData();
|
||||
content += "-" + convert<docstring>(mangleID++);
|
||||
content += "-" + convert<docstring>(mangleID);
|
||||
mangleID += 1;
|
||||
}
|
||||
|
||||
// Save the new ID to avoid recomputing it afterwards and to ensure stability over the document.
|
||||
mangledNames[orig] = content;
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user