]> git.lyx.org Git - lyx.git/commitdiff
DocBook: export the preview images to the right format.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Sat, 16 Oct 2021 19:12:18 +0000 (21:12 +0200)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Sat, 16 Oct 2021 20:41:38 +0000 (22:41 +0200)
"docbook" is not the same as "docbook5", maybe it would be better to have an enumeration instead of strings.

autotests/export/docbook/Linguistics_forest.xml [new file with mode: 0644]
autotests/export/docbook/lyxpreviewAJskuj1.png [new file with mode: 0644]
src/insets/InsetText.cpp

diff --git a/autotests/export/docbook/Linguistics_forest.xml b/autotests/export/docbook/Linguistics_forest.xml
new file mode 100644 (file)
index 0000000..65c0f0b
--- /dev/null
@@ -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>
\ No newline at end of file
diff --git a/autotests/export/docbook/lyxpreviewAJskuj1.png b/autotests/export/docbook/lyxpreviewAJskuj1.png
new file mode 100644 (file)
index 0000000..3de9d3a
Binary files /dev/null and b/autotests/export/docbook/lyxpreviewAJskuj1.png differ
index 20bf3ead7395c6de4260218ee2a1925712a589d5..2fc63cef7fcfcde209408c184fb635e376106a60 100644 (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.