DocBook: export the preview images to the right format.

"docbook" is not the same as "docbook5", maybe it would be better to have an enumeration instead of strings.
This commit is contained in:
Thibaut Cuvelier 2021-10-16 21:12:18 +02:00
parent e0830592f0
commit 33668e3a30
3 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This DocBook file was created by LyX 2.4.0dev
See https://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>Writing linguistic papers</title>
<author>
<personname>Jürgen Spitzmülle</personname>
</author>
</info>
<section>
<title>Linguistic structure trees</title>
<para>Here is a simple example:</para>
<mediaobject>
<imageobject>
<imagedata fileref='lyxpreviewAJskuj1.png' />
</imageobject>
<textobject>
<programlisting language='latex' role='forest'>[VP [DP[John]] [V' [V[sent]] [DP[Mary]] [DP[D[a]][NP[letter]]] ] ]</programlisting>
</textobject>
</mediaobject>
<para>If you view the PDF output, you will see that the input</para>
<blockquote>
<para><code><emphasis role='size_small'>[VP [DP[John]] [V' [V[sent]] [DP[Mary]] [DP[D[a]][NP[letter]]]]]</emphasis></code></para>
</blockquote>
<para>expands to a real structure tree. To view the result within the work area, you can simply embed the Structure Tree inset into a Preview inset. If instant preview is correctly installed and activated, you should see the tree immediately (just click on the image in order to edit):</para>
<para><mediaobject>
<imageobject>
<imagedata fileref='lyxpreviewWZhpAx1.png' />
</imageobject>
<textobject>
<programlisting language='latex' role='forest'>[VP [DP[Mary]] [V' [V[sent]] [DP[John]] [DP[D[a]][NP[response]]] ] ]</programlisting>
</textobject>
</mediaobject></para>
<para>Roofs can be easily generated by means of the <code>roof</code> option (note that the comma has special meaning, as it marks options):</para>
<mediaobject>
<imageobject>
<imagedata fileref='lyxpreviewQJTcYJ1.png' />
</imageobject>
<textobject>
<programlisting language='latex' role='forest'>[VP [DP[John]] [V' [V[sent]] [DP[Mary]] [DP[another letter, roof]] ] ]</programlisting>
</textobject>
</mediaobject>
<para>In order to align nodes of the tree more elegantly, use the &#8220;tier&#8221; option. All nodes which have the same <code>tier</code> allocated get aligned. Here is an example:</para>
<mediaobject>
<imageobject>
<imagedata fileref='lyxpreviewBkSuoA1.png' />
</imageobject>
<textobject>
<programlisting language='latex' role='forest'>[VP [DP[John,tier=word]] [V' [V[sent,tier=word]] [DP[Mary,tier=word]] [DP[D[a,tier=word]][NP[letter,tier=word]]] ] ]</programlisting>
</textobject>
</mediaobject>
<para>The package supports many additional features, such as movement arrows and decorations, that cannot documented here.</para>
</section>
</article>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -670,7 +670,7 @@ void InsetText::docbookRenderAsImage(XMLStream & xs, OutputParams const & rp, XH
support::FileName const & filename = img->filename();
// Copy the image into the right folder.
rp.exportdata->addExternalFile("docbook", filename, filename.onlyFileName());
rp.exportdata->addExternalFile("docbook5", filename, filename.onlyFileName());
// TODO: deal with opts. What exactly is the WriterOuterTag here, for instance?
// Start writing the DocBook code for the image.