The branch, feature/docbook, has been updated. - Log -----------------------------------------------------------------
commit 142b7c22395f8e00620976e5483770986cab9245 Author: Thibaut Cuvelier <[email protected]> Date: Mon Aug 31 03:09:16 2020 +0200 DocBook: do a little something for shapepar. diff --git a/lib/layouts/shapepar.module b/lib/layouts/shapepar.module index f5068dc..6b38cdf 100644 --- a/lib/layouts/shapepar.module +++ b/lib/layouts/shapepar.module @@ -35,41 +35,51 @@ Style "CD label" ParSkip 0.4 Align Block LabelType No_Label + DocBookWrapperTag sidebar + DocBookWrapperAttr role="cd-label" + DocBookTag para End Style "Circle" CopyStyle "CD label" LatexName circlepar + DocBookWrapperAttr role="circle" End Style "Diamond" CopyStyle "CD label" LatexName diamondpar + DocBookWrapperAttr role="diamond" End Style "Heart" CopyStyle "CD label" LatexName heartpar + DocBookWrapperAttr role="heart" End Style "Hexagon" CopyStyle "CD label" LatexName hexagonpar + DocBookWrapperAttr role="hexagon" End Style "Nut" CopyStyle "CD label" LatexName nutpar + DocBookWrapperAttr role="nut" End Style "Square" CopyStyle "CD label" LatexName squarepar + DocBookWrapperAttr role="square" End Style "Star" CopyStyle "CD label" LatexName starpar + DocBookWrapperAttr role="star" End # now the shapes defined in the .def files @@ -77,41 +87,49 @@ End Style "Candle" CopyStyle "CD label" LatexName shapepar{\candle} + DocBookWrapperAttr role="candle" End Style "Drop down" CopyStyle "CD label" LatexName droppar + DocBookWrapperAttr role="drop-down" End Style "Drop up" CopyStyle "CD label" LatexName dropuppar + DocBookWrapperAttr role="drop-up" End Style "TeX" CopyStyle "CD label" LatexName shapepar{\TeXshape} + DocBookWrapperAttr role="tex" End Style "Triangle up" CopyStyle "CD label" LatexName triangleuppar + DocBookWrapperAttr role="triangle-up" End Style "Triangle down" CopyStyle "CD label" LatexName triangledownpar + DocBookWrapperAttr role="triangle-down" End Style "Triangle left" CopyStyle "CD label" LatexName triangleleftpar + DocBookWrapperAttr role="triangle-left" End Style "Triangle right" CopyStyle "CD label" LatexName trianglerightpar + DocBookWrapperAttr role="triangle-right" End # finally the low-level commands commit 45b463296719e55709cc9b190bf776857c1626d5 Author: Thibaut Cuvelier <[email protected]> Date: Mon Aug 31 02:47:27 2020 +0200 DocBook: implement theorems. This is a minimal implementation, as DocBook lacks a serious way of encoding all of this. Maybe a <formalpara> could do the trick, but I'd need to find a way to shoehorn a title through the styles (i.e. a first complete tag): Theorem: Bla bla <formalpara> <title>Theorem</title> <para>Bla bla</para> </formalpara> This would also only be a solution for single-paragraph things, as formalpara only allows one paragraph. Or a sidebar, but it's semantically very remote. diff --git a/autotests/export/docbook/Additional_lyxcode.xml b/autotests/export/docbook/Additional_lyxcode.xml index b677971..f42ac9f 100644 --- a/autotests/export/docbook/Additional_lyxcode.xml +++ b/autotests/export/docbook/Additional_lyxcode.xml @@ -36,5 +36,40 @@ This ... <para>This section is somewhat out of date. Need to describe default master documents and how children are opened when the master is. [[FIXME]]</para> </sidebar> </section> +<section> +<title>AMS LaTeX</title> +<para>These same environments are provided only in the starred versions by the <code>Theorems (Starred)</code> module:</para> +<para role='theorem'>This is typically used for the statements of major results. </para> +<para role='corollary'>This is used for statements which follow fairly directly from previous statements. Again, these can be major results. </para> +<para role='lemma'>These are smaller results needed to prove other statements.</para> +<para role='proposition'>These are less major results which (hopefully) add to the general theory being discussed.</para> +<para role='conjecture'>These are statements provided without justification, which the author does not know how to prove, but which seem to be true (to the author, at least).</para> +<para role='definition'>Guess what this is for. The font is different for this environment than for the previous ones. </para> +<informalexample> +<para>Used for examples illustrating proven results.</para> +</informalexample> +<para role='problem'>It's not really known what this is for. You should figure it out.</para> +<para role='exercise'>Write a description for this one.</para> +<note role='theorem'> +<para>This environment is also a type of theorem, usually a lesser sort of observation.</para> +</note> +<para role='claim'>Often used in the course of giving a proof of a larger result.</para> +<para role='cases'>Generally, these are used to break up long arguments, using specific instances of some condition. The numbering scheme for cases is on its own, not together with other numbered statements. </para> +<para role='proof'>At the end of this environment, a QED symbol (usually a square, but it can vary with different styles) is placed. If you want to have other environments within this oneâfor example, Case environmentsâand have the QED symbol appear only after them, then the other environments need to be nested within the proof environment. See the section <emphasis>Nesting Environments</emphasis> of the <emphasis>User's Guide</emphasis> for information on nesting.</para> +<para>And these environments are provided by <code>Theorems (AMS-Extended)</code>:</para> +<para role='criterion'>A required condition.</para> +<para role='algorithm'>A general procedure to be used.</para> +<para role='axiom'>This is a property or statement taken as true within the system being discussed.</para> +<para role='condition'>Sometimes used to state a condition assumed within the present context of discussion.</para> +<note role='theorem'> +<para>Similar to a Remark.</para> +</note> +<para role='notation'>Used for the explanation of, yes, notation.</para> +<para role='summary'>Do we really need to tell you? </para> +<para role='acknowledgement'>Acknowledgement.</para> +<para role='conclusion'>Sometimes used at the end of a long train of argument.</para> +<para role='fact'>Used in a way similar to Proposition, though perhaps lower on the scale.</para> +<para>In addition, the AMS classes automatically provide the AMS LaTeX and AMS fonts packages. They need to be available on your system in order to use these environments.</para> +</section> </chapter> </book> \ No newline at end of file diff --git a/lib/layouts/theorems-ams-bytype.inc b/lib/layouts/theorems-ams-bytype.inc index ee87748..fede0e8 100644 --- a/lib/layouts/theorems-ams-bytype.inc +++ b/lib/layouts/theorems-ams-bytype.inc @@ -258,8 +258,9 @@ Style Example \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble LabelCounter example - DocBookWrapperTag example + DocBookWrapperTag informalexample DocBookTag para + DocBookAttr "" End @@ -372,6 +373,7 @@ Style Claim LabelCounter claim DocBookTag para DocBookAttr role='claim' + DocBookItemTag "" End Input theorems-case.inc diff --git a/lib/layouts/theorems-ams-chap-bytype.inc b/lib/layouts/theorems-ams-chap-bytype.inc index 6aa1f63..faaa2d0 100644 --- a/lib/layouts/theorems-ams-chap-bytype.inc +++ b/lib/layouts/theorems-ams-chap-bytype.inc @@ -305,8 +305,9 @@ Style Example \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble LabelCounter example - DocBookWrapperTag example + DocBookWrapperTag informalexample DocBookTag para + DocBookAttr "" End @@ -439,6 +440,7 @@ Style Claim LabelCounter claim DocBookTag para DocBookAttr role='claim' + DocBookItemTag "" End diff --git a/lib/layouts/theorems-ams-extended-bytype.module b/lib/layouts/theorems-ams-extended-bytype.module index e031a74..c537def 100644 --- a/lib/layouts/theorems-ams-extended-bytype.module +++ b/lib/layouts/theorems-ams-extended-bytype.module @@ -87,6 +87,9 @@ Style Criterion \addto\captions$$lang{\renewcommand{\criterionname}{_(Criterion)}} EndBabelPreamble LabelCounter criterion + DocBookTag para + DocBookAttr role='criterion' + DocBookItemTag "" End Style Criterion* @@ -103,6 +106,9 @@ Style Criterion* BabelPreamble \addto\captions$$lang{\renewcommand{\criterionname}{_(Criterion)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='criterion' + DocBookItemTag "" End @@ -121,6 +127,9 @@ Style Algorithm \addto\captions$$lang{\renewcommand{\algorithmname}{_(Algorithm)}} EndBabelPreamble LabelCounter algorithm + DocBookTag para + DocBookAttr role='algorithm' + DocBookItemTag "" End @@ -138,6 +147,9 @@ Style Algorithm* BabelPreamble \addto\captions$$lang{\renewcommand{\algorithmname}{_(Algorithm)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='algorithm' + DocBookItemTag "" End @@ -156,6 +168,9 @@ Style Axiom \addto\captions$$lang{\renewcommand{\axiomname}{_(Axiom)}} EndBabelPreamble LabelCounter axiom + DocBookTag para + DocBookAttr role='axiom' + DocBookItemTag "" End @@ -173,6 +188,9 @@ Style Axiom* BabelPreamble \addto\captions$$lang{\renewcommand{\axiomname}{_(Axiom)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='axiom' + DocBookItemTag "" End @@ -191,6 +209,9 @@ Style Condition \addto\captions$$lang{\renewcommand{\conditionname}{_(Condition)}} EndBabelPreamble LabelCounter condition + DocBookTag para + DocBookAttr role='condition' + DocBookItemTag "" End @@ -208,6 +229,9 @@ Style Condition* BabelPreamble \addto\captions$$lang{\renewcommand{\conditionname}{_(Condition)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='condition' + DocBookItemTag "" End @@ -226,6 +250,8 @@ Style Note \addto\captions$$lang{\renewcommand{\notename}{_(Note)}} EndBabelPreamble LabelCounter note + DocBookTag note + DocBookItemTag para End @@ -243,6 +269,8 @@ Style Note* BabelPreamble \addto\captions$$lang{\renewcommand{\notename}{_(Note)}} EndBabelPreamble + DocBookTag note + DocBookItemTag para End @@ -261,6 +289,9 @@ Style Notation \addto\captions$$lang{\renewcommand{\notationname}{_(Notation)}} EndBabelPreamble LabelCounter notation + DocBookTag para + DocBookAttr role='notation' + DocBookItemTag "" End @@ -278,6 +309,9 @@ Style Notation* BabelPreamble \addto\captions$$lang{\renewcommand{\notationname}{_(Notation)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='notation' + DocBookItemTag "" End @@ -296,6 +330,9 @@ Style Summary \addto\captions$$lang{\renewcommand{\summaryname}{_(Summary)}} EndBabelPreamble LabelCounter summary + DocBookTag para + DocBookAttr role='summary' + DocBookItemTag "" End @@ -313,6 +350,9 @@ Style Summary* BabelPreamble \addto\captions$$lang{\renewcommand{\summaryname}{_(Summary)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='summary' + DocBookItemTag "" End @@ -331,6 +371,9 @@ Style Acknowledgement \addto\captions$$lang{\renewcommand{\acknowledgementname}{_(Acknowledgement)}} EndBabelPreamble LabelCounter acknowledgement + DocBookTag para + DocBookAttr role='acknowledgement' + DocBookItemTag "" End @@ -348,6 +391,9 @@ Style Acknowledgement* BabelPreamble \addto\captions$$lang{\renewcommand{\acknowledgementname}{_(Acknowledgement)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='acknowledgement' + DocBookItemTag "" End @@ -366,6 +412,9 @@ Style Conclusion \addto\captions$$lang{\renewcommand{\conclusionname}{_(Conclusion)}} EndBabelPreamble LabelCounter conclusion + DocBookTag para + DocBookAttr role='conclusion' + DocBookItemTag "" End @@ -383,6 +432,9 @@ Style Conclusion* BabelPreamble \addto\captions$$lang{\renewcommand{\conclusionname}{_(Conclusion)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='conclusion' + DocBookItemTag "" End @@ -401,6 +453,9 @@ Style Assumption \addto\captions$$lang{\renewcommand{\assumptionname}{_(Assumption)}} EndBabelPreamble LabelCounter assumption + DocBookTag para + DocBookAttr role='assumption' + DocBookItemTag "" End @@ -418,6 +473,9 @@ Style Assumption* BabelPreamble \addto\captions$$lang{\renewcommand{\assumptionname}{_(Assumption)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='assumption' + DocBookItemTag "" End Style Question @@ -436,6 +494,9 @@ Style Question \addto\captions$$lang{\renewcommand{\questionname}{_(Question)}} EndBabelPreamble LabelCounter question + DocBookTag para + DocBookAttr role='question' + DocBookItemTag "" End Style Question* @@ -452,6 +513,9 @@ Style Question* BabelPreamble \addto\captions$$lang{\renewcommand{\questionname}{_(Question)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='question' + DocBookItemTag "" End Input theorems-refprefix.inc diff --git a/lib/layouts/theorems-ams-extended-chap-bytype.module b/lib/layouts/theorems-ams-extended-chap-bytype.module index 435eb65..7252073 100644 --- a/lib/layouts/theorems-ams-extended-chap-bytype.module +++ b/lib/layouts/theorems-ams-extended-chap-bytype.module @@ -105,6 +105,9 @@ Style Criterion \addto\captions$$lang{\renewcommand{\criterionname}{_(Criterion)}} EndBabelPreamble LabelCounter criterion + DocBookTag para + DocBookAttr role='criterion' + DocBookItemTag "" End @@ -122,6 +125,9 @@ Style Criterion* BabelPreamble \addto\captions$$lang{\renewcommand{\criterionname}{_(Criterion)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='criterion' + DocBookItemTag "" End @@ -144,6 +150,9 @@ Style Algorithm \addto\captions$$lang{\renewcommand{\algorithmname}{_(Algorithm)}} EndBabelPreamble LabelCounter algorithm + DocBookTag para + DocBookAttr role='algorithm' + DocBookItemTag "" End @@ -161,6 +170,9 @@ Style Algorithm* BabelPreamble \addto\captions$$lang{\renewcommand{\algorithmname}{_(Algorithm)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='algorithm' + DocBookItemTag "" End @@ -183,6 +195,9 @@ Style Axiom \addto\captions$$lang{\renewcommand{\axiomname}{_(Axiom)}} EndBabelPreamble LabelCounter axiom + DocBookTag para + DocBookAttr role='axiom' + DocBookItemTag "" End @@ -200,6 +215,9 @@ Style Axiom* BabelPreamble \addto\captions$$lang{\renewcommand{\axiomname}{_(Axiom)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='axiom' + DocBookItemTag "" End @@ -222,6 +240,9 @@ Style Condition \addto\captions$$lang{\renewcommand{\conditionname}{_(Condition)}} EndBabelPreamble LabelCounter condition + DocBookTag para + DocBookAttr role='condition' + DocBookItemTag "" End @@ -239,6 +260,9 @@ Style Condition* BabelPreamble \addto\captions$$lang{\renewcommand{\conditionname}{_(Condition)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='condition' + DocBookItemTag "" End @@ -261,6 +285,8 @@ Style Note \addto\captions$$lang{\renewcommand{\notename}{_(Note)}} EndBabelPreamble LabelCounter note + DocBookTag note + DocBookItemTag para End @@ -278,6 +304,8 @@ Style Note* BabelPreamble \addto\captions$$lang{\renewcommand{\notename}{_(Note)}} EndBabelPreamble + DocBookTag note + DocBookItemTag para End @@ -300,6 +328,9 @@ Style Notation \addto\captions$$lang{\renewcommand{\notationname}{_(Notation)}} EndBabelPreamble LabelCounter notation + DocBookTag para + DocBookAttr role='notation' + DocBookItemTag "" End @@ -317,6 +348,9 @@ Style Notation* BabelPreamble \addto\captions$$lang{\renewcommand{\notationname}{_(Notation)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='notation' + DocBookItemTag "" End @@ -340,6 +374,9 @@ Style Summary \addto\captions$$lang{\renewcommand{\summaryname}{_(Summary)}} EndBabelPreamble LabelCounter summary + DocBookTag para + DocBookAttr role='summary' + DocBookItemTag "" End @@ -357,6 +394,9 @@ Style Summary* BabelPreamble \addto\captions$$lang{\renewcommand{\summaryname}{_(Summary)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='summary' + DocBookItemTag "" End @@ -379,6 +419,9 @@ Style Acknowledgement \addto\captions$$lang{\renewcommand{\acknowledgementname}{_(Acknowledgement)}} EndBabelPreamble LabelCounter acknowledgement + DocBookTag para + DocBookAttr role='acknowledgement' + DocBookItemTag "" End @@ -396,6 +439,9 @@ Style Acknowledgement* BabelPreamble \addto\captions$$lang{\renewcommand{\acknowledgementname}{_(Acknowledgement)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='acknowledgement' + DocBookItemTag "" End @@ -418,6 +464,9 @@ Style Conclusion \addto\captions$$lang{\renewcommand{\conclusionname}{_(Conclusion)}} EndBabelPreamble LabelCounter conclusion + DocBookTag para + DocBookAttr role='conclusion' + DocBookItemTag "" End @@ -435,6 +484,9 @@ Style Conclusion* BabelPreamble \addto\captions$$lang{\renewcommand{\conclusionname}{_(Conclusion)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='conclusion' + DocBookItemTag "" End @@ -457,6 +509,9 @@ Style Assumption \addto\captions$$lang{\renewcommand{\assumptionname}{_(Assumption)}} EndBabelPreamble LabelCounter assumption + DocBookTag para + DocBookAttr role='assumption' + DocBookItemTag "" End @@ -474,6 +529,9 @@ Style Assumption* BabelPreamble \addto\captions$$lang{\renewcommand{\assumptionname}{_(Assumption)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='assumption' + DocBookItemTag "" End Style Question @@ -496,6 +554,9 @@ Style Question \addto\captions$$lang{\renewcommand{\questionname}{_(Question)}} EndBabelPreamble LabelCounter question + DocBookTag para + DocBookAttr role='question' + DocBookItemTag "" End Style Question* @@ -512,6 +573,9 @@ Style Question* BabelPreamble \addto\captions$$lang{\renewcommand{\questionname}{_(Question)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='question' + DocBookItemTag "" End Input theorems-refprefix.inc diff --git a/lib/layouts/theorems-ams-extended.module b/lib/layouts/theorems-ams-extended.module index 0f33a90..f2c4cf0 100644 --- a/lib/layouts/theorems-ams-extended.module +++ b/lib/layouts/theorems-ams-extended.module @@ -48,6 +48,9 @@ Style Criterion BabelPreamble \addto\captions$$lang{\renewcommand{\criterionname}{_(Criterion)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='criterion' + DocBookItemTag "" End Style Criterion* @@ -64,6 +67,9 @@ Style Criterion* BabelPreamble \addto\captions$$lang{\renewcommand{\criterionname}{_(Criterion)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='criterion' + DocBookItemTag "" End @@ -82,6 +88,9 @@ Style Algorithm BabelPreamble \addto\captions$$lang{\renewcommand{\algorithmname}{_(Algorithm)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='algorithm' + DocBookItemTag "" End @@ -99,6 +108,9 @@ Style Algorithm* BabelPreamble \addto\captions$$lang{\renewcommand{\algorithmname}{_(Algorithm)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='algorithm' + DocBookItemTag "" End @@ -117,6 +129,9 @@ Style Axiom BabelPreamble \addto\captions$$lang{\renewcommand{\axiomname}{_(Axiom)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='axiom' + DocBookItemTag "" End @@ -134,6 +149,9 @@ Style Axiom* BabelPreamble \addto\captions$$lang{\renewcommand{\axiomname}{_(Axiom)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='axiom' + DocBookItemTag "" End @@ -151,6 +169,9 @@ Style Condition BabelPreamble \addto\captions$$lang{\renewcommand{\conditionname}{_(Condition)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='condition' + DocBookItemTag "" End @@ -168,6 +189,9 @@ Style Condition* BabelPreamble \addto\captions$$lang{\renewcommand{\conditionname}{_(Condition)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='condition' + DocBookItemTag "" End @@ -185,6 +209,8 @@ Style Note BabelPreamble \addto\captions$$lang{\renewcommand{\notename}{_(Note)}} EndBabelPreamble + DocBookTag note + DocBookItemTag para End @@ -202,6 +228,8 @@ Style Note* BabelPreamble \addto\captions$$lang{\renewcommand{\notename}{_(Note)}} EndBabelPreamble + DocBookTag note + DocBookItemTag para End @@ -219,6 +247,9 @@ Style Notation BabelPreamble \addto\captions$$lang{\renewcommand{\notationname}{_(Notation)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='notation' + DocBookItemTag "" End @@ -236,6 +267,9 @@ Style Notation* BabelPreamble \addto\captions$$lang{\renewcommand{\notationname}{_(Notation)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='notation' + DocBookItemTag "" End @@ -253,6 +287,9 @@ Style Summary BabelPreamble \addto\captions$$lang{\renewcommand{\summaryname}{_(Summary)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='summary' + DocBookItemTag "" End @@ -270,6 +307,9 @@ Style Summary* BabelPreamble \addto\captions$$lang{\renewcommand{\summaryname}{_(Summary)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='summary' + DocBookItemTag "" End @@ -287,6 +327,9 @@ Style Acknowledgement BabelPreamble \addto\captions$$lang{\renewcommand{\acknowledgementname}{_(Acknowledgement)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='acknowledgement' + DocBookItemTag "" End @@ -304,6 +347,9 @@ Style Acknowledgement* BabelPreamble \addto\captions$$lang{\renewcommand{\acknowledgementname}{_(Acknowledgement)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='acknowledgement' + DocBookItemTag "" End @@ -321,6 +367,9 @@ Style Conclusion BabelPreamble \addto\captions$$lang{\renewcommand{\conclusionname}{_(Conclusion)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='conclusion' + DocBookItemTag "" End @@ -338,6 +387,9 @@ Style Conclusion* BabelPreamble \addto\captions$$lang{\renewcommand{\conclusionname}{_(Conclusion)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='conclusion' + DocBookItemTag "" End @@ -356,6 +408,9 @@ Style Assumption BabelPreamble \addto\captions$$lang{\renewcommand{\assumptionname}{_(Assumption)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='assumption' + DocBookItemTag "" End @@ -373,6 +428,9 @@ Style Assumption* BabelPreamble \addto\captions$$lang{\renewcommand{\assumptionname}{_(Assumption)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='assumption' + DocBookItemTag "" End Style Question @@ -390,6 +448,9 @@ Style Question BabelPreamble \addto\captions$$lang{\renewcommand{\questionname}{_(Question)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='question' + DocBookItemTag "" End Style Question* @@ -406,6 +467,9 @@ Style Question* BabelPreamble \addto\captions$$lang{\renewcommand{\questionname}{_(Question)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='question' + DocBookItemTag "" End Input theorems-refprefix.inc diff --git a/lib/layouts/theorems-ams.inc b/lib/layouts/theorems-ams.inc index c7a4507..44cc806 100644 --- a/lib/layouts/theorems-ams.inc +++ b/lib/layouts/theorems-ams.inc @@ -215,8 +215,9 @@ Style Example BabelPreamble \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble - DocBookWrapperTag example + DocBookWrapperTag informalexample DocBookTag para + DocBookAttr "" End @@ -321,6 +322,7 @@ Style Claim EndBabelPreamble DocBookTag para DocBookAttr role='claim' + DocBookItemTag "" End Input theorems-case.inc diff --git a/lib/layouts/theorems-bytype.inc b/lib/layouts/theorems-bytype.inc index 182b922..a40098b 100644 --- a/lib/layouts/theorems-bytype.inc +++ b/lib/layouts/theorems-bytype.inc @@ -214,8 +214,9 @@ Style Example \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble LabelCounter example - DocBookWrapperTag example + DocBookWrapperTag informalexample DocBookTag para + DocBookAttr "" End @@ -328,6 +329,7 @@ Style Claim LabelCounter claim DocBookTag para DocBookAttr role='claim' + DocBookItemTag "" End Input theorems-case.inc diff --git a/lib/layouts/theorems-starred.inc b/lib/layouts/theorems-starred.inc index a17ec06..fa02b21 100644 --- a/lib/layouts/theorems-starred.inc +++ b/lib/layouts/theorems-starred.inc @@ -208,8 +208,9 @@ Style Example* BabelPreamble \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble - DocBookWrapperTag example + DocBookWrapperTag informalexample DocBookTag para + DocBookAttr "" End @@ -313,5 +314,6 @@ Style Claim* EndBabelPreamble DocBookTag para DocBookAttr role='claim' + DocBookItemTag "" End diff --git a/lib/layouts/theorems-without-preamble.inc b/lib/layouts/theorems-without-preamble.inc index d61e54f..43b8c0c 100644 --- a/lib/layouts/theorems-without-preamble.inc +++ b/lib/layouts/theorems-without-preamble.inc @@ -240,8 +240,9 @@ Style Example BabelPreamble \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble - DocBookWrapperTag example + DocBookWrapperTag informalexample DocBookTag para + DocBookAttr "" End @@ -389,6 +390,7 @@ Style Claim EndBabelPreamble DocBookTag para DocBookAttr role='claim' + DocBookItemTag "" End diff --git a/lib/layouts/theorems.inc b/lib/layouts/theorems.inc index 9017ca6..822ee94 100644 --- a/lib/layouts/theorems.inc +++ b/lib/layouts/theorems.inc @@ -69,6 +69,8 @@ Style Theorem \addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}} EndBabelPreamble Requires amsthm + DocBookTag para + DocBookAttr role='theorem' End @@ -87,6 +89,8 @@ Style Corollary BabelPreamble \addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='corollary' End @@ -105,6 +109,8 @@ Style Lemma BabelPreamble \addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='lemma' End @@ -123,6 +129,8 @@ Style Proposition BabelPreamble \addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='proposition' End @@ -141,6 +149,8 @@ Style Conjecture BabelPreamble \addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='conjecture' End @@ -159,6 +169,8 @@ Style Fact BabelPreamble \addto\captions$$lang{\renewcommand{\factname}{_(Fact)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='fact' End @@ -184,6 +196,8 @@ Style Definition BabelPreamble \addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='definition' End @@ -201,6 +215,9 @@ Style Example BabelPreamble \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble + DocBookWrapperTag informalexample + DocBookTag para + DocBookAttr "" End @@ -218,6 +235,8 @@ Style Problem BabelPreamble \addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='problem' End @@ -235,6 +254,8 @@ Style Exercise BabelPreamble \addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='exercise' End @@ -252,6 +273,8 @@ Style Solution BabelPreamble \addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='solution' End @@ -278,6 +301,8 @@ Style Remark BabelPreamble \addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}} EndBabelPreamble + DocBookTag note + DocBookItemTag para End @@ -295,6 +320,9 @@ Style Claim BabelPreamble \addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='claim' + DocBookItemTag "" End Input theorems-case.inc commit 7a3bf9216c5ead6c80a85a1476d7354fe6953e57 Author: Thibaut Cuvelier <[email protected]> Date: Mon Aug 31 02:39:37 2020 +0200 DocBook: implement theorems. This is a minimal implementation, as DocBook lacks a serious way of encoding all of this. Maybe a <formalpara> could do the trick, but I'd need to find a way to shoehorn a title through the styles (i.e. a first complete tag): Theorem: Bla bla <formalpara> <title>Theorem</title> <para>Bla bla</para> </formalpara> This would also only be a solution for single-paragraph things, as formalpara only allows one paragraph. Or a sidebar, but it's semantically very remote. diff --git a/autotests/export/docbook/Additional_lyxcode.lyx b/autotests/export/docbook/Additional_lyxcode.lyx index fe2d428..797e315 100644 --- a/autotests/export/docbook/Additional_lyxcode.lyx +++ b/autotests/export/docbook/Additional_lyxcode.lyx @@ -367,5 +367,169 @@ This section is somewhat out of date. \end_layout +\begin_layout Section +AMS \SpecialChar LaTeX + +\end_layout + +\begin_layout Standard +These same environments are provided only in the starred versions by the + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +Theorems (Starred) +\end_layout + +\end_inset + + module: +\end_layout + +\begin_layout Theorem +This is typically used for the statements of major results. + +\end_layout + +\begin_layout Corollary* +This is used for statements which follow fairly directly from previous statement +s. + Again, these can be major results. + +\end_layout + +\begin_layout Lemma +These are smaller results needed to prove other statements. +\end_layout + +\begin_layout Proposition +These are less major results which (hopefully) add to the general theory + being discussed. +\end_layout + +\begin_layout Conjecture +These are statements provided without justification, which the author does + not know how to prove, but which seem to be true (to the author, at least). +\end_layout + +\begin_layout Definition* +Guess what this is for. + The font is different for this environment than for the previous ones. + +\end_layout + +\begin_layout Example* +Used for examples illustrating proven results. +\end_layout + +\begin_layout Problem +It's not really known what this is for. + You should figure it out. +\end_layout + +\begin_layout Exercise* +Write a description for this one. +\end_layout + +\begin_layout Remark +This environment is also a type of theorem, usually a lesser sort of observation. +\end_layout + +\begin_layout Claim* +Often used in the course of giving a proof of a larger result. +\end_layout + +\begin_layout Case +Generally, these are used to break up long arguments, using specific instances + of some condition. + +\end_layout + +\begin_layout Case +The numbering scheme for cases is on its own, not together with other numbered + statements. + +\end_layout + +\begin_layout Proof +At the end of this environment, a QED symbol (usually a square, but it can + vary with different styles) is placed. + If you want to have other environments within this oneâfor example, Case + environmentsâand have the QED symbol appear only after them, then the other + environments need to be nested within the proof environment. + See the section +\emph on +Nesting Environments +\emph default + of the +\emph on +User's Guide +\emph default + for information on nesting. +\end_layout + +\begin_layout Standard +And these environments are provided by +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +Theorems (AMS-Extended) +\end_layout + +\end_inset + +: +\end_layout + +\begin_layout Criterion* +A required condition. +\end_layout + +\begin_layout Algorithm* +A general procedure to be used. +\end_layout + +\begin_layout Axiom* +This is a property or statement taken as true within the system being discussed. +\end_layout + +\begin_layout Condition* +Sometimes used to state a condition assumed within the present context of + discussion. +\end_layout + +\begin_layout Note* +Similar to a Remark. +\end_layout + +\begin_layout Notation* +Used for the explanation of, yes, notation. +\end_layout + +\begin_layout Summary +Do we really need to tell you? +\end_layout + +\begin_layout Acknowledgement* +Acknowledgement. +\end_layout + +\begin_layout Conclusion* +Sometimes used at the end of a long train of argument. +\end_layout + +\begin_layout Fact +Used in a way similar to Proposition, though perhaps lower on the scale. +\end_layout + +\begin_layout Standard +In addition, the AMS classes automatically provide the AMS \SpecialChar LaTeX + and AMS fonts + packages. + They need to be available on your system in order to use these environments. +\end_layout + \end_body \end_document diff --git a/development/DocBookToDo b/development/DocBookToDo index 39ca534..6b6ca34 100644 --- a/development/DocBookToDo +++ b/development/DocBookToDo @@ -17,4 +17,25 @@ TableRefs, TableComments: no mapping in DocBook, not really a way to add these t Clearly, with this kind of template, we're reaching the limits of such a system! Having a really good converter for all these cases would require a lot of very specific code. -More general: what the heck with appendices? It's not handled in the LyX way (Document > Start Appendix Here), but in a custom way. Making this work would solve some correctness issues with this template. \ No newline at end of file +More general: what the heck with appendices? It's not handled in the LyX way (Document > Start Appendix Here), but in a custom way. Making this work would solve some correctness issues with this template. + + + +Things specific to modules +========================== + +AMS +--- + +Theorems and the like do not have counter parts in DocBook. Maybe a <formalpara> could do the trick, but I'd need to find a way to shoehorn a title through the styles (i.e. a first complete tag): + + LyX: + Theorem: Bla bla + + DocBook: + <formalpara> + <title>Theorem</title> + <para>Bla bla</para> + </formalpara> + +This would also only be a solution for single-paragraph things, as formalpara only allows one paragraph. Or a sidebar, but it's semantically very remote. \ No newline at end of file diff --git a/lib/layouts/theorems-ams-bytype.inc b/lib/layouts/theorems-ams-bytype.inc index a306f15..ee87748 100644 --- a/lib/layouts/theorems-ams-bytype.inc +++ b/lib/layouts/theorems-ams-bytype.inc @@ -110,6 +110,8 @@ Style Theorem \addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}} EndBabelPreamble Requires amsthm + DocBookTag para + DocBookAttr role='theorem' End @@ -128,6 +130,8 @@ Style Corollary BabelPreamble \addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='corollary' End @@ -146,6 +150,8 @@ Style Lemma \addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}} EndBabelPreamble LabelCounter lemma + DocBookTag para + DocBookAttr role='lemma' End @@ -164,6 +170,8 @@ Style Proposition \addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}} EndBabelPreamble LabelCounter proposition + DocBookTag para + DocBookAttr role='proposition' End @@ -182,6 +190,8 @@ Style Conjecture \addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}} EndBabelPreamble LabelCounter conjecture + DocBookTag para + DocBookAttr role='conjecture' End @@ -200,6 +210,8 @@ Style Fact \addto\captions$$lang{\renewcommand{\factname}{_(Fact)}} EndBabelPreamble LabelCounter fact + DocBookTag para + DocBookAttr role='fact' End @@ -225,6 +237,8 @@ Style Definition \addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}} EndBabelPreamble LabelCounter definition + DocBookTag para + DocBookAttr role='definition' End @@ -244,6 +258,8 @@ Style Example \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble LabelCounter example + DocBookWrapperTag example + DocBookTag para End @@ -263,6 +279,8 @@ Style Problem \addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}} EndBabelPreamble LabelCounter problem + DocBookTag para + DocBookAttr role='problem' End @@ -282,6 +300,8 @@ Style Exercise \addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}} EndBabelPreamble LabelCounter exercise + DocBookTag para + DocBookAttr role='exercise' End @@ -301,6 +321,8 @@ Style Solution \addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}} EndBabelPreamble LabelCounter solution + DocBookTag para + DocBookAttr role='solution' End @@ -348,6 +370,8 @@ Style Claim \addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}} EndBabelPreamble LabelCounter claim + DocBookTag para + DocBookAttr role='claim' End Input theorems-case.inc diff --git a/lib/layouts/theorems-ams-chap-bytype.inc b/lib/layouts/theorems-ams-chap-bytype.inc index e4528f7..6aa1f63 100644 --- a/lib/layouts/theorems-ams-chap-bytype.inc +++ b/lib/layouts/theorems-ams-chap-bytype.inc @@ -129,6 +129,8 @@ Style Theorem \addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}} EndBabelPreamble Requires amsthm + DocBookTag para + DocBookAttr role='theorem' End @@ -151,6 +153,8 @@ Style Corollary BabelPreamble \addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='corollary' End @@ -173,6 +177,8 @@ Style Lemma \addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}} EndBabelPreamble LabelCounter lemma + DocBookTag para + DocBookAttr role='lemma' End @@ -195,6 +201,8 @@ Style Proposition \addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}} EndBabelPreamble LabelCounter proposition + DocBookTag para + DocBookAttr role='proposition' End @@ -217,6 +225,8 @@ Style Conjecture \addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}} EndBabelPreamble LabelCounter conjecture + DocBookTag para + DocBookAttr role='conjecture' End @@ -239,6 +249,8 @@ Style Fact \addto\captions$$lang{\renewcommand{\factname}{_(Fact)}} EndBabelPreamble LabelCounter fact + DocBookTag para + DocBookAttr role='fact' End @@ -268,6 +280,8 @@ Style Definition \addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}} EndBabelPreamble LabelCounter definition + DocBookTag para + DocBookAttr role='definition' End @@ -291,6 +305,8 @@ Style Example \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble LabelCounter example + DocBookWrapperTag example + DocBookTag para End @@ -314,6 +330,8 @@ Style Problem \addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}} EndBabelPreamble LabelCounter problem + DocBookTag para + DocBookAttr role='problem' End @@ -337,6 +355,8 @@ Style Exercise \addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}} EndBabelPreamble LabelCounter exercise + DocBookTag para + DocBookAttr role='exercise' End @@ -360,6 +380,8 @@ Style Solution \addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}} EndBabelPreamble LabelCounter solution + DocBookTag para + DocBookAttr role='solution' End @@ -415,6 +437,8 @@ Style Claim \addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}} EndBabelPreamble LabelCounter claim + DocBookTag para + DocBookAttr role='claim' End diff --git a/lib/layouts/theorems-ams.inc b/lib/layouts/theorems-ams.inc index 99fcbf9..c7a4507 100644 --- a/lib/layouts/theorems-ams.inc +++ b/lib/layouts/theorems-ams.inc @@ -69,6 +69,8 @@ Style Theorem \addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}} EndBabelPreamble Requires amsthm + DocBookTag para + DocBookAttr role='theorem' End @@ -87,6 +89,8 @@ Style Corollary BabelPreamble \addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='corollary' End @@ -105,6 +109,8 @@ Style Lemma BabelPreamble \addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='lemma' End @@ -123,6 +129,8 @@ Style Proposition BabelPreamble \addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='proposition' End @@ -141,6 +149,8 @@ Style Conjecture BabelPreamble \addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='conjecture' End @@ -159,6 +169,8 @@ Style Fact BabelPreamble \addto\captions$$lang{\renewcommand{\factname}{_(Fact)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='fact' End @@ -184,6 +196,8 @@ Style Definition BabelPreamble \addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='definition' End @@ -201,6 +215,8 @@ Style Example BabelPreamble \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble + DocBookWrapperTag example + DocBookTag para End @@ -218,6 +234,8 @@ Style Problem BabelPreamble \addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='problem' End @@ -235,6 +253,8 @@ Style Exercise BabelPreamble \addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='exercise' End @@ -252,6 +272,8 @@ Style Solution BabelPreamble \addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='solution' End @@ -297,6 +319,8 @@ Style Claim BabelPreamble \addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='claim' End Input theorems-case.inc diff --git a/lib/layouts/theorems-bytype.inc b/lib/layouts/theorems-bytype.inc index a61a4df..182b922 100644 --- a/lib/layouts/theorems-bytype.inc +++ b/lib/layouts/theorems-bytype.inc @@ -66,6 +66,8 @@ Style Theorem \addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}} EndBabelPreamble Requires amsthm + DocBookTag para + DocBookAttr role='theorem' End @@ -84,6 +86,8 @@ Style Corollary \addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}} EndBabelPreamble LabelCounter corollary + DocBookTag para + DocBookAttr role='corollary' End @@ -102,6 +106,8 @@ Style Lemma \addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}} EndBabelPreamble LabelCounter lemma + DocBookTag para + DocBookAttr role='lemma' End @@ -120,6 +126,8 @@ Style Proposition \addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}} EndBabelPreamble LabelCounter proposition + DocBookTag para + DocBookAttr role='proposition' End @@ -138,6 +146,8 @@ Style Conjecture \addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}} EndBabelPreamble LabelCounter conjecture + DocBookTag para + DocBookAttr role='conjecture' End @@ -156,6 +166,8 @@ Style Fact \addto\captions$$lang{\renewcommand{\factname}{_(Fact)}} EndBabelPreamble LabelCounter fact + DocBookTag para + DocBookAttr role='fact' End @@ -181,6 +193,8 @@ Style Definition \addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}} EndBabelPreamble LabelCounter definition + DocBookTag para + DocBookAttr role='definition' End @@ -200,6 +214,8 @@ Style Example \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble LabelCounter example + DocBookWrapperTag example + DocBookTag para End @@ -219,6 +235,8 @@ Style Problem \addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}} EndBabelPreamble LabelCounter problem + DocBookTag para + DocBookAttr role='problem' End @@ -238,6 +256,8 @@ Style Exercise \addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}} EndBabelPreamble LabelCounter exercise + DocBookTag para + DocBookAttr role='exercise' End @@ -257,6 +277,8 @@ Style Solution \addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}} EndBabelPreamble LabelCounter solution + DocBookTag para + DocBookAttr role='solution' End @@ -304,6 +326,8 @@ Style Claim \addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}} EndBabelPreamble LabelCounter claim + DocBookTag para + DocBookAttr role='claim' End Input theorems-case.inc diff --git a/lib/layouts/theorems-case.inc b/lib/layouts/theorems-case.inc index cf85b48..1ee52a3 100644 --- a/lib/layouts/theorems-case.inc +++ b/lib/layouts/theorems-case.inc @@ -86,4 +86,6 @@ Style Case \addto\captions$$lang{\renewcommand{\casename}{_(Case)}} EndBabelPreamble RefPrefix OFF + DocBookTag para + DocBookAttr role='cases' End diff --git a/lib/layouts/theorems-proof-std.inc b/lib/layouts/theorems-proof-std.inc index 89c4173..8ba18cf 100644 --- a/lib/layouts/theorems-proof-std.inc +++ b/lib/layouts/theorems-proof-std.inc @@ -18,4 +18,6 @@ Style Proof \fi EndPreamble # No LangPreamble or BabelPreamble, since babel knows \proofname already. + DocBookTag para + DocBookAttr role='proof' End diff --git a/lib/layouts/theorems-proof.inc b/lib/layouts/theorems-proof.inc index 345ba38..949a35e 100644 --- a/lib/layouts/theorems-proof.inc +++ b/lib/layouts/theorems-proof.inc @@ -40,5 +40,7 @@ Style Proof LabelFont Shape Italic EndFont + DocBookTag para + DocBookAttr role='proof' End diff --git a/lib/layouts/theorems-starred.inc b/lib/layouts/theorems-starred.inc index 4add989..a17ec06 100644 --- a/lib/layouts/theorems-starred.inc +++ b/lib/layouts/theorems-starred.inc @@ -67,6 +67,8 @@ Style Theorem* \addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}} EndBabelPreamble Requires amsthm + DocBookTag para + DocBookAttr role='theorem' End @@ -84,6 +86,8 @@ Style Corollary* BabelPreamble \addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='corollary' End @@ -101,6 +105,8 @@ Style Lemma* BabelPreamble \addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='lemma' End @@ -118,6 +124,8 @@ Style Proposition* BabelPreamble \addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='proposition' End @@ -135,6 +143,8 @@ Style Conjecture* BabelPreamble \addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='conjecture' End @@ -152,6 +162,8 @@ Style Fact* BabelPreamble \addto\captions$$lang{\renewcommand{\factname}{_(Fact)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='fact' End @@ -177,6 +189,8 @@ Style Definition* BabelPreamble \addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='definition' End @@ -194,6 +208,8 @@ Style Example* BabelPreamble \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble + DocBookWrapperTag example + DocBookTag para End @@ -211,6 +227,8 @@ Style Problem* BabelPreamble \addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='problem' End @@ -228,6 +246,8 @@ Style Exercise* BabelPreamble \addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='exercise' End @@ -245,6 +265,8 @@ Style Solution* BabelPreamble \addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='solution' End @@ -270,6 +292,8 @@ Style Remark* BabelPreamble \addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}} EndBabelPreamble + DocBookTag note + DocBookItemTag para End @@ -287,5 +311,7 @@ Style Claim* BabelPreamble \addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='claim' End diff --git a/lib/layouts/theorems-without-preamble.inc b/lib/layouts/theorems-without-preamble.inc index 80beb8e..d61e54f 100644 --- a/lib/layouts/theorems-without-preamble.inc +++ b/lib/layouts/theorems-without-preamble.inc @@ -72,6 +72,8 @@ Style Theorem BabelPreamble \addto\captions$$lang{\renewcommand{\theoremname}{_(Theorem)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='theorem' End @@ -89,6 +91,8 @@ Style Corollary BabelPreamble \addto\captions$$lang{\renewcommand{\corollaryname}{_(Corollary)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='corollary' End @@ -106,6 +110,8 @@ Style Lemma BabelPreamble \addto\captions$$lang{\renewcommand{\lemmaname}{_(Lemma)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='lemma' End @@ -123,6 +129,8 @@ Style Proposition BabelPreamble \addto\captions$$lang{\renewcommand{\propositionname}{_(Proposition)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='proposition' End @@ -140,6 +148,8 @@ Style Prop LabelFont Series Medium EndFont + DocBookTag para + DocBookAttr role='proposition' End @@ -164,6 +174,8 @@ Style Conjecture BabelPreamble \addto\captions$$lang{\renewcommand{\conjecturename}{_(Conjecture)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='conjecture' End @@ -181,6 +193,8 @@ Style Fact BabelPreamble \addto\captions$$lang{\renewcommand{\factname}{_(Fact)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='fact' End @@ -206,6 +220,8 @@ Style Definition BabelPreamble \addto\captions$$lang{\renewcommand{\definitionname}{_(Definition)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='definition' End @@ -224,6 +240,8 @@ Style Example BabelPreamble \addto\captions$$lang{\renewcommand{\examplename}{_(Example)}} EndBabelPreamble + DocBookWrapperTag example + DocBookTag para End @@ -243,6 +261,8 @@ Style Problem BabelPreamble \addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='problem' End @@ -276,6 +296,8 @@ Style Prob EndFont AddToToc thm IsTocCaption true + DocBookTag para + DocBookAttr role='problem' End @@ -294,6 +316,8 @@ Style Solution BabelPreamble \addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='solution' End @@ -308,6 +332,8 @@ Style Sol Tooltip "Label of the corresponding problem" IsTocCaption true EndArgument + DocBookTag para + DocBookAttr role='solution' End @@ -326,6 +352,8 @@ Style Exercise BabelPreamble \addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='exercise' End @@ -344,6 +372,8 @@ Style Remark BabelPreamble \addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}} EndBabelPreamble + DocBookTag note + DocBookItemTag para End @@ -357,6 +387,8 @@ Style Claim BabelPreamble \addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='claim' End @@ -375,6 +407,8 @@ Style Case BabelPreamble \addto\captions$$lang{\renewcommand{\casename}{_(Case)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='case' End @@ -393,6 +427,8 @@ Style Property BabelPreamble \addto\captions$$lang{\renewcommand{\propertyname}{_(Property)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='property' End @@ -411,6 +447,8 @@ Style Question BabelPreamble \addto\captions$$lang{\renewcommand{\questionname}{_(Question)}} EndBabelPreamble + DocBookTag para + DocBookAttr role='question' End @@ -429,5 +467,7 @@ Style Note BabelPreamble \addto\captions$$lang{\renewcommand{\notename}{_(Note)}} EndBabelPreamble + DocBookTag note + DocBookItemTag para End commit 8f59c384b703daca6f6a10ce8611fe08cbcfccb1 Author: Thibaut Cuvelier <[email protected]> Date: Mon Aug 31 01:41:09 2020 +0200 DocBook: several missing features for Additional.lyx. Includes: semantic markup (sorry about noun: Additional.lyx uses it to mark menus; there is something better in DocBook, but it looks like the LaTeX equivalent is really for person names), boxes, info layouts. diff --git a/autotests/export/docbook/Additional_lyxcode.lyx b/autotests/export/docbook/Additional_lyxcode.lyx new file mode 100644 index 0000000..fe2d428 --- /dev/null +++ b/autotests/export/docbook/Additional_lyxcode.lyx @@ -0,0 +1,371 @@ +#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 scrbook +\begin_preamble +% DO NOT ALTER THIS PREAMBLE!!! +% +% This preamble is designed to ensure that the manual prints +% out as advertised. If you mess with this preamble, +% parts of the manual may not print out as expected. If you +% have problems LaTeXing this file, please contact +% the documentation team +% email: [email protected] + +% the pages of the TOC are numbered roman +% and a PDF-bookmark for the TOC is added +\pagenumbering{roman} +\let\myTOC\tableofcontents +\renewcommand{\tableofcontents}{% + \pdfbookmark[1]{\contentsname}{} + \myTOC + \cleardoublepage + \pagenumbering{arabic}} + +% extra space for tables +\newcommand{\extratablespace}[1]{\noalign{\vskip#1}} +\end_preamble +\options bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading +\use_default_options false +\begin_modules +logicalmkup +theorems-ams +theorems-ams-extended +multicol +shapepar +\end_modules +\maintain_unincluded_children no +\language english +\language_package default +\inputencoding utf8 +\fontencoding auto +\font_roman "lmodern" "default" +\font_sans "lmss" "default" +\font_typewriter "lmtt" "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 pdf2 +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize 12 +\spacing single +\use_hyperref true +\pdf_title "LyX's Additional Features manual" +\pdf_author "LyX Team" +\pdf_subject "LyX's additional features documentation" +\pdf_keywords "LyX, Documentation, Additional" +\pdf_bookmarks true +\pdf_bookmarksnumbered true +\pdf_bookmarksopen false +\pdf_bookmarksopenlevel 1 +\pdf_breaklinks false +\pdf_pdfborder false +\pdf_colorlinks true +\pdf_backref false +\pdf_pdfusetitle false +\pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false" +\papersize a4 +\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 false +\paperorientation portrait +\suppress_date false +\justification true +\use_refstyle 0 +\use_minted 0 +\use_lineno 0 +\notefontcolor #0000ff +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\is_math_indent 1 +\math_indentation default +\math_numbering_side default +\quotes_style english +\dynamic_quotes 0 +\papercolumns 1 +\papersides 2 +\paperpagestyle headings +\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 true +\docbook_table_output 0 +\end_header + +\begin_body + +\begin_layout Title +Additional \SpecialChar LyX + Features +\end_layout + +\begin_layout Subtitle +Version 2.3.x +\end_layout + +\begin_layout Author +by the \SpecialChar LyX + Team +\begin_inset Foot +status collapsed + +\begin_layout Plain Layout +\noindent +Principal maintainer of this file is +\noun on + Richard Heck +\noun default +. + If you have comments or error corrections, please send them to the \SpecialChar LyX + Documentati +on mailing list, +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +<[email protected]> +\end_layout + +\end_inset + +. +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset toc +LatexCommand tableofcontents + +\end_inset + + +\end_layout + +\begin_layout Chapter +\begin_inset CommandInset label +LatexCommand label +name "sec:Inserting-TeX-Code" + +\end_inset + +Inserting \SpecialChar TeX + Code into \SpecialChar LyX + Documents +\end_layout + +\begin_layout Standard +Anything you can do in \SpecialChar LaTeX + you can do in \SpecialChar LyX +, for a very simple reason: You can + always insert \SpecialChar TeX + code into any \SpecialChar LyX + document. + \SpecialChar LyX + cannot, and will never be able to, display every possible \SpecialChar LaTeX + construct. + If ever you need to insert \SpecialChar LaTeX + commands into your \SpecialChar LyX + document, you can use the + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +\SpecialChar TeX + Code +\end_layout + +\end_inset + + box, which you can insert into your document with +\begin_inset Flex Noun +status collapsed + +\begin_layout Plain Layout +Insert\SpecialChar menuseparator + +\family sans +TeX +\family default + Code +\end_layout + +\end_inset + + or the keyboard shortcut +\begin_inset Info +type "shortcut" +arg "ert-insert" +\end_inset + +. +\end_layout + +\begin_layout Standard +Here's an example of inserting \SpecialChar LaTeX + commands in a \SpecialChar LyX + document. + The code looks like this: +\end_layout + +\begin_layout LyX-Code + +\backslash +begin{tabular}{ll} +\begin_inset Newline newline +\end_inset + + +\backslash +begin{minipage}{5cm} +\begin_inset Newline newline +\end_inset + +This is an example of a minipage environment. + You +\begin_inset Newline newline +\end_inset + +can put nearly everything in it, even (non-floating) +\begin_inset Newline newline +\end_inset + +figures and tables. + +\begin_inset Newline newline +\end_inset + + +\backslash +end{minipage} +\begin_inset Newline newline +\end_inset + +& +\begin_inset Newline newline +\end_inset + + +\backslash +begin{minipage}{5cm} +\begin_inset Newline newline +\end_inset + + +\backslash +begin{verbatim} +\begin_inset Newline newline +\end_inset + + +\backslash +begin{minipage}{5cm} +\begin_inset Newline newline +\end_inset + +This ... + +\begin_inset Newline newline +\end_inset + + +\backslash +end{minipage} +\begin_inset Newline newline +\end_inset + + +\backslash +end{verbatim} +\begin_inset Newline newline +\end_inset + + +\backslash +end{minipage} +\begin_inset Newline newline +\end_inset + + +\backslash +end{tabular} +\end_layout + +\begin_layout Section +Cross-References Between Files +\end_layout + +\begin_layout Standard +\begin_inset Box Shadowbox +position "t" +hor_pos "c" +has_inner_box 1 +inner_pos "t" +use_parbox 0 +use_makebox 0 +width "100col%" +special "none" +height "1in" +height_special "totalheight" +thickness "0.4pt" +separation "3pt" +shadowsize "4pt" +framecolor "black" +backgroundcolor "none" +status open + +\begin_layout Plain Layout +This section is somewhat out of date. + Need to describe default master documents and how children are opened when + the master is. + [[FIXME]] +\end_layout + +\end_inset + + +\end_layout + +\end_body +\end_document diff --git a/autotests/export/docbook/Additional_lyxcode.xml b/autotests/export/docbook/Additional_lyxcode.xml new file mode 100644 index 0000000..b677971 --- /dev/null +++ b/autotests/export/docbook/Additional_lyxcode.xml @@ -0,0 +1,40 @@ +<?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 --> +<book 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>Additional LyX Features</title> +<subtitle>Version 2.3.x</subtitle> +<author> +<personname>by the LyX Team<footnote> +<para>Principal maintainer of this file is<personname> Richard Heck</personname>. If you have comments or error corrections, please send them to the LyX Documentation mailing list, <code><[email protected]></code>.</para> +</footnote></personname> +</author> +</info> +<chapter xml:id="sec.Inserting-TeX-Code"> +<title>Inserting TeX Code into LyX Documents</title> +<para>Anything you can do in LaTeX you can do in LyX, for a very simple reason: You can always insert TeX code into any LyX document. LyX cannot, and will never be able to, display every possible LaTeX construct. If ever you need to insert LaTeX commands into your LyX document, you can use the <code>TeX Code</code> box, which you can insert into your document with <personname>Insert⇒TeX Code</personname> or the keyboard shortcut <keycap>Ctrl+L</keycap>.</para> +<para>Here's an example of inserting LaTeX commands in a LyX document. The code looks like this:</para> +<programlisting language='lyx'>\begin{tabular}{ll} +\begin{minipage}{5cm} +This is an example of a minipage environment. You +can put nearly everything in it, even (non-floating) +figures and tables. +\end{minipage} +& +\begin{minipage}{5cm} +\begin{verbatim} +\begin{minipage}{5cm} +This ... +\end{minipage} +\end{verbatim} +\end{minipage} +\end{tabular}</programlisting> +<section> +<title>Cross-References Between Files</title> +<sidebar role='shadowbox'> +<para>This section is somewhat out of date. Need to describe default master documents and how children are opened when the master is. [[FIXME]]</para> +</sidebar> +</section> +</chapter> +</book> \ No newline at end of file diff --git a/lib/layouts/logicalmkup.module b/lib/layouts/logicalmkup.module index bedf6dc..005a3c9 100644 --- a/lib/layouts/logicalmkup.module +++ b/lib/layouts/logicalmkup.module @@ -27,6 +27,8 @@ InsetLayout Flex:Noun EndHTMLStyle ResetsFont true CustomPars false + DocBookTag personname + DocBookTagType inline End @@ -42,6 +44,8 @@ InsetLayout Flex:Emph HTMLTag em ResetsFont true CustomPars false + DocBookTag emphasis + DocBookTagType inline End @@ -60,6 +64,9 @@ InsetLayout Flex:Strong HTMLTag strong ResetsFont true CustomPars false + DocBookTag personname + DocBookAttr role='bold' + DocBookTagType inline End @@ -79,4 +86,6 @@ InsetLayout Flex:Code ResetsFont true CustomPars false Spellcheck false + DocBookTag code + DocBookTagType inline End diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc index ab15f77..2127440 100644 --- a/lib/layouts/stdinsets.inc +++ b/lib/layouts/stdinsets.inc @@ -434,6 +434,8 @@ InsetLayout Box Size Small EndFont MultiPar true + DocBookWrapperTag sidebar + DocBookTag para End InsetLayout Box:Frameless @@ -441,6 +443,9 @@ InsetLayout Box:Frameless HTMLStyle div.Frameless { margin: 1em; } EndHTMLStyle + DocBookWrapperTag sidebar + DocBookTag para + DocBookWrapperAttr role='frameless' End InsetLayout Box:Shaded @@ -452,6 +457,9 @@ InsetLayout Box:Shaded padding: 0.5ex; } EndHTMLStyle + DocBookWrapperTag sidebar + DocBookTag para + DocBookWrapperAttr role='shaded' End InsetLayout Box:Boxed @@ -462,6 +470,9 @@ InsetLayout Box:Boxed padding: 0.5ex; } EndHTMLStyle + DocBookWrapperTag sidebar + DocBookTag para + DocBookWrapperAttr role='boxed' End InsetLayout Box:Framed @@ -472,6 +483,9 @@ InsetLayout Box:Framed padding: 0.5ex; } EndHTMLStyle + DocBookWrapperTag sidebar + DocBookTag para + DocBookWrapperAttr role='framed' End InsetLayout Box:ovalbox @@ -482,6 +496,9 @@ InsetLayout Box:ovalbox padding: 0.5ex; } EndHTMLStyle + DocBookWrapperTag sidebar + DocBookTag para + DocBookWrapperAttr role='ovalbox' End InsetLayout Box:Ovalbox @@ -492,6 +509,9 @@ InsetLayout Box:Ovalbox padding: 0.5ex; } EndHTMLStyle + DocBookWrapperTag sidebar + DocBookTag para + DocBookWrapperAttr role='ovalbox-var' End InsetLayout Box:Shadowbox @@ -499,6 +519,9 @@ InsetLayout Box:Shadowbox HTMLStyle div.Shadowbox { border: solid gray medium; border-bottom: solid black 1ex; border-right: solid black 1ex; padding: 0.5ex; } EndHTMLStyle + DocBookWrapperTag sidebar + DocBookTag para + DocBookWrapperAttr role='shadowbox' End InsetLayout Box:Doublebox @@ -509,6 +532,9 @@ InsetLayout Box:Doublebox padding: 0.5ex; } EndHTMLStyle + DocBookWrapperTag sidebar + DocBookTag para + DocBookWrapperAttr role='doublebox' End InsetLayout Float @@ -609,6 +635,8 @@ InsetLayout Info:menu HTMLStyle span.menu { font-family: sans-serif; } EndHTMLStyle + DocBookTag guimenu + DocBookTagType inline End InsetLayout Info:shortcut @@ -626,6 +654,10 @@ InsetLayout Info:shortcut HTMLStyle span.shortcut { font-family: sans-serif; } EndHTMLStyle + DocBookTagWrapper keycombo + DocBookTagWrapperType inline + DocBookTag keycap + DocBookTagType inline End InsetLayout Info:shortcuts @@ -643,6 +675,10 @@ InsetLayout Info:shortcuts HTMLStyle span.shortcuts { font-family: sans-serif; } EndHTMLStyle + DocBookTagWrapper keycombo + DocBookTagWrapperType inline + DocBookTag keycap + DocBookTagType inline End InsetLayout Caption:Standard diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp index c61efe6..db76f53 100644 --- a/src/insets/InsetBox.cpp +++ b/src/insets/InsetBox.cpp @@ -717,7 +717,25 @@ int InsetBox::plaintext(odocstringstream & os, void InsetBox::docbook(XMLStream & xs, OutputParams const & runparams) const { + if (!getLayout().docbookwrappertag().empty()) { + if (!xs.isLastTagCR()) + xs << xml::CR(); + + xs << xml::StartTag(getLayout().docbookwrappertag(), getLayout().docbookwrapperattr()); + xs << xml::CR(); + } else { + LYXERR0("Assertion failed: box layout " + getLayout().name() + " missing DocBookWrapperTag."); + } + InsetText::docbook(xs, runparams); + + if (!getLayout().docbookwrappertag().empty()) { + if (!xs.isLastTagCR()) + xs << xml::CR(); + + xs << xml::EndTag(getLayout().docbookwrappertag()); + xs << xml::CR(); + } } diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp index ce0d25a..d758a1c 100644 --- a/src/insets/InsetLayout.cpp +++ b/src/insets/InsetLayout.cpp @@ -110,7 +110,11 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass, IL_HTMLSTYLE, IL_HTMLPREAMBLE, IL_DOCBOOKTAG, + IL_DOCBOOKTAGTYPE, IL_DOCBOOKATTR, + IL_DOCBOOKWRAPPERTAG, + IL_DOCBOOKWRAPPERTAGTYPE, + IL_DOCBOOKWRAPPERATTR, IL_INTOC, IL_ISTOCCAPTION, IL_LABELFONT, @@ -157,6 +161,10 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass, { "display", IL_DISPLAY }, { "docbookattr", IL_DOCBOOKATTR }, { "docbooktag", IL_DOCBOOKTAG }, + { "docbooktagtype", IL_DOCBOOKTAGTYPE }, + { "docbookwrapperattr", IL_DOCBOOKWRAPPERATTR }, + { "docbookwrappertag", IL_DOCBOOKWRAPPERTAG }, + { "docbookwrappertagtype", IL_DOCBOOKWRAPPERTAGTYPE }, { "editexternal", IL_EDITEXTERNAL }, { "end", IL_END }, { "fixedwidthpreambleencoding", IL_FIXEDWIDTH_PREAMBLE_ENCODING }, @@ -500,9 +508,21 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass, case IL_DOCBOOKTAG: lex >> docbooktag_; break; + case IL_DOCBOOKTAGTYPE: + lex >> docbooktagtype_; + break; case IL_DOCBOOKATTR: lex >> docbookattr_; break; + case IL_DOCBOOKWRAPPERTAG: + lex >> docbookwrappertag_; + break; + case IL_DOCBOOKWRAPPERTAGTYPE: + lex >> docbookwrappertagtype_; + break; + case IL_DOCBOOKWRAPPERATTR: + lex >> docbookwrapperattr_; + break; case IL_REQUIRES: { lex.eatLine(); vector<string> const req diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h index 00e3ba6..f11071f 100644 --- a/src/insets/InsetLayout.h +++ b/src/insets/InsetLayout.h @@ -150,8 +150,16 @@ public: /// std::string docbooktag() const { return docbooktag_; } /// + std::string docbooktagtype() const { return docbooktagtype_; } + /// std::string docbookattr() const { return docbookattr_; } /// + std::string docbookwrappertag() const { return docbookwrappertag_; } + /// + std::string docbookwrappertagtype() const { return docbookwrappertagtype_; } + /// + std::string docbookwrapperattr() const { return docbookwrapperattr_; } + /// std::set<std::string> required() const { return required_; } /// bool isMultiPar() const { return multipar_; } @@ -281,8 +289,16 @@ private: /// std::string docbooktag_; /// + std::string docbooktagtype_; + /// std::string docbookattr_; /// + std::string docbookwrappertag_; + /// + std::string docbookwrappertagtype_; + /// + std::string docbookwrapperattr_; + /// std::set<std::string> required_; /// bool multipar_; diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index c0a856e..3c6a2e2 100644 --- a/src/output_docbook.cpp +++ b/src/output_docbook.cpp @@ -491,6 +491,10 @@ void makeParagraph( // Listings should not get into their own paragraph. if (!special_case && firstInset->lyxCode() == lyx::LISTINGS_CODE) special_case = true; + + // Boxes cannot get into their own paragraph. + if (!special_case && firstInset->lyxCode() == lyx::BOX_CODE) + special_case = true; } bool const open_par = runparams.docbook_make_pars commit 8eb316653848bb270d9aa1fa80d2e221320a8a42 Author: Thibaut Cuvelier <[email protected]> Date: Mon Aug 31 01:24:28 2020 +0200 DocBook: implement LyX-Code. This is quite ugly. diff --git a/lib/layouts/beamer.layout b/lib/layouts/beamer.layout index f6d17c3..4438482 100644 --- a/lib/layouts/beamer.layout +++ b/lib/layouts/beamer.layout @@ -1408,6 +1408,9 @@ Style LyX-Code Font Family Typewriter EndFont + DocBookTag programlisting + DocBookTagType paragraph + DocBookAttr language='lyx' End Style NoteItem diff --git a/lib/layouts/egs.layout b/lib/layouts/egs.layout index 6ee01ed..0bd4543 100644 --- a/lib/layouts/egs.layout +++ b/lib/layouts/egs.layout @@ -734,6 +734,9 @@ Style LyX-Code Font Family Typewriter EndFont + DocBookTag programlisting + DocBookTagType paragraph + DocBookAttr language='lyx' End diff --git a/lib/layouts/lyxmacros.inc b/lib/layouts/lyxmacros.inc index 1696ffd..4cf5cf6 100644 --- a/lib/layouts/lyxmacros.inc +++ b/lib/layouts/lyxmacros.inc @@ -38,6 +38,9 @@ Style LyX-Code Font Family Typewriter EndFont + DocBookTag programlisting + DocBookTagType paragraph + DocBookAttr language='lyx' End diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index af38cf0..c0a856e 100644 --- a/src/output_docbook.cpp +++ b/src/output_docbook.cpp @@ -532,8 +532,19 @@ void makeEnvironment(Text const &text, OutputParams const &runparams, ParagraphList::const_iterator const & par) { - // TODO: simplify me! auto const end = text.paragraphs().end(); + auto nextpar = par; + ++nextpar; + + // Special cases for listing-like environments provided in layouts. This is quite ad-hoc, but provides a useful + // default. This should not be used by too many environments (only LyX-Code right now). + // This would be much simpler if LyX-Code was implemented as InsetListings... + bool mimicListing = false; + bool ignoreFonts = false; + if (par->layout().docbooktag() == "programlisting") { + mimicListing = true; + ignoreFonts = true; + } // Output the opening tag for this environment, but only if it has not been previously opened (condition // implemented in openParTag). @@ -545,65 +556,25 @@ void makeEnvironment(Text const &text, if (style.latextype == LATEX_COMMAND) { // Nothing to do (otherwise, infinite loops). } else if (style.latextype == LATEX_ENVIRONMENT) { - // Open a wrapper tag if needed. - if (style.docbookitemwrappertag() != "NONE") - openTag(xs, style.docbookitemwrappertag(), style.docbookitemwrapperattr(), style.docbookitemwrappertagtype()); - - // Generate the label, if need be. If it is taken from the text, sep != 0 and corresponds to the first - // character after the label. - pos_type sep = 0; - if (style.labeltype != LABEL_NO_LABEL && style.docbookitemlabeltag() != "NONE") { - // At least one condition must be met: - // - this environment is not a list - // - if this is a list, the label must not be manual (i.e. it must be taken from the layout) - if (style.latextype != LATEX_LIST_ENVIRONMENT || style.labeltype != LABEL_MANUAL) { - // Usual cases: maybe there is something specified at the layout level. Highly unlikely, though. - docstring const lbl = par->params().labelString(); + // Generate the paragraph, if need be. + auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(std::distance(text.paragraphs().begin(), par)), 0, false, ignoreFonts); - if (!lbl.empty()) { - openLabelTag(xs, style); - xs << lbl; - closeLabelTag(xs, style); - } - } else { - // Only variablelist gets here (or similar items defined as an extension in the layout). - openLabelTag(xs, style); - sep = par->firstWordDocBook(xs, runparams); - closeLabelTag(xs, style); - } - } - - // Maybe the item is completely empty, i.e. if the first word ends at the end of the current paragraph - // AND if the next paragraph doesn't have the same depth (if there is such a paragraph). - // Common case: there is only the first word on the line, but there is a nested list instead - // of more text. - bool emptyItem = false; - if (sep == par->size()) { // If the separator is already at the end of this paragraph... - auto next_par = par; - ++next_par; - if (next_par == text.paragraphs().end()) // There is no next paragraph. - emptyItem = true; - else // There is a next paragraph: check depth. - emptyItem = par->params().depth() >= next_par->params().depth(); - } - - if (emptyItem) { - // Avoid having an empty item, this is not valid DocBook. A single character is enough to force - // generation of a full <para>. - // TODO: this always worked only by magic... - xs << ' '; - } else { - // Generate the rest of the paragraph, if need be. Open as many inner tags as necessary. - auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(std::distance(text.paragraphs().begin(), par)), sep); + if (mimicListing) { auto p = pars.begin(); - while (true) { + while (p != pars.end()) { + openTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnerattr(), par->layout().docbookiteminnertagtype()); xs << XMLStream::ESCAPE_NONE << *p; + closeTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnertagtype()); ++p; - if (p != pars.end()) { - closeTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnertagtype()); - openTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnerattr(), par->layout().docbookiteminnertagtype()); - } else - break; + + if (p != pars.end()) + xs << xml::CR(); + } + } else { + for (auto const & p : pars) { + openTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnerattr(), par->layout().docbookiteminnertagtype()); + xs << XMLStream::ESCAPE_NONE << p; + closeTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnertagtype()); } } } else { @@ -611,8 +582,6 @@ void makeEnvironment(Text const &text, } // Close the environment. - auto nextpar = par; - ++nextpar; closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr); // TODO: switch in layout for par/block? } commit 59b2f74c89ca8492ca88b9c1ef697888f4d0788b Author: Thibaut Cuvelier <[email protected]> Date: Mon Aug 31 00:50:37 2020 +0200 DocBook: <person> is not valid per se, rather use <personname>. The cleanest solution would still be <person><personname>, but this ought to be enough. Otherwise, that would imply having two tags for some fonts... diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index ffd16d3..af38cf0 100644 --- a/src/output_docbook.cpp +++ b/src/output_docbook.cpp @@ -47,7 +47,7 @@ std::string fontToDocBookTag(xml::FontTypes type) case xml::FontTypes::FT_BOLD: return "emphasis"; case xml::FontTypes::FT_NOUN: - return "person"; + return "personname"; case xml::FontTypes::FT_UBAR: case xml::FontTypes::FT_WAVE: case xml::FontTypes::FT_DBAR: commit a2fbd10077ceff7c46d1a4a42b41345135d8a938 Author: Thibaut Cuvelier <[email protected]> Date: Mon Aug 31 00:46:49 2020 +0200 DocBook: subfigures example is fixed. Probably thanks to the magic of the previous commits. diff --git a/autotests/export/docbook/subfigures.xml b/autotests/export/docbook/subfigures.xml index 4a7c122..622edb8 100644 --- a/autotests/export/docbook/subfigures.xml +++ b/autotests/export/docbook/subfigures.xml @@ -1,7 +1,7 @@ <?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"> +<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>Formalgroup with two images: </para> <formalgroup> @@ -10,7 +10,7 @@ <title>Subfigure a.</title> <mediaobject> <imageobject> -<imagedata fileref="C:/Users/Thibaut/Documents/GitHub/Apprentissage_automatique/01_manus_lyx/lyx-logo.png" /> +<imagedata fileref="D:/LyX/lyx-unstable/autotests/export/docbook/lyx-logo.png" /> </imageobject> </mediaobject> </figure> @@ -18,7 +18,7 @@ <title>Subfigure b.</title> <mediaobject> <imageobject> -<imagedata fileref="C:/Users/Thibaut/Documents/GitHub/Apprentissage_automatique/01_manus_lyx/lyx-logo.png" /> +<imagedata fileref="D:/LyX/lyx-unstable/autotests/export/docbook/lyx-logo.png" /> </imageobject> </mediaobject> </figure> @@ -29,7 +29,7 @@ <title>Subfigure a.</title> <mediaobject> <imageobject> -<imagedata fileref="C:/Users/Thibaut/Documents/GitHub/Apprentissage_automatique/01_manus_lyx/lyx-logo.png" /> +<imagedata fileref="D:/LyX/lyx-unstable/autotests/export/docbook/lyx-logo.png" /> </imageobject> </mediaobject> </figure> @@ -37,11 +37,12 @@ <title>Subfigure b.</title> <mediaobject> <imageobject> -<imagedata fileref="C:/Users/Thibaut/Documents/GitHub/Apprentissage_automatique/01_manus_lyx/lyx-logo.png" /> +<imagedata fileref="D:/LyX/lyx-unstable/autotests/export/docbook/lyx-logo.png" /> </imageobject> </mediaobject> </figure> </formalgroup> + <para>Formalgroup with two tables: </para> <formalgroup> <title>Formalgroup, tables above.</title> @@ -51,10 +52,12 @@ <tr> <td align='center' valign='top'>a</td> <td align='center' valign='top'>b</td> -</tr><tr> +</tr> +<tr> <td align='center' valign='top'>c</td> <td align='center' valign='top'>d</td> -</tr></tbody> +</tr> +</tbody> </table> <table> <caption>Subtable b.</caption> @@ -62,7 +65,8 @@ <tr> <td align='center' valign='top'>a</td> <td align='center' valign='top'>b</td> -</tr><tr> +</tr> +<tr> <td align='center' valign='top'>c</td> <td align='center' valign='top'>d</td> </tr> @@ -77,10 +81,12 @@ <tr> <td align='center' valign='top'>a</td> <td align='center' valign='top'>b</td> -</tr><tr> +</tr> +<tr> <td align='center' valign='top'>c</td> <td align='center' valign='top'>d</td> -</tr></tbody> +</tr> +</tbody> </table> <table> <caption>Subtable b.</caption> @@ -88,11 +94,12 @@ <tr> <td align='center' valign='top'>a</td> <td align='center' valign='top'>b</td> -</tr><tr> +</tr> +<tr> <td align='center' valign='top'>c</td> <td align='center' valign='top'>d</td> -</tr></tbody> +</tr> +</tbody> </table> </formalgroup> - -</article> +</article> \ No newline at end of file commit f05e96d312730a324e36f894392c4b490a2c5057 Author: Thibaut Cuvelier <[email protected]> Date: Mon Aug 31 00:45:19 2020 +0200 DocBook: new-line behaviour in bibliographies. diff --git a/autotests/export/docbook/Tufte_Book.xml b/autotests/export/docbook/Tufte_Book.xml index 4968e25..3289cfd 100644 --- a/autotests/export/docbook/Tufte_Book.xml +++ b/autotests/export/docbook/Tufte_Book.xml @@ -34,12 +34,15 @@ Working with Text <bibliography> <title>References</title> <biblioentry xml:id="Bringhurst2005"> -<title>The Elements of Typographic Style</title><edition>3.1</edition><bibliomisc role="type">book</bibliomisc> +<title>The Elements of Typographic Style</title> +<edition>3.1</edition> +<bibliomisc role="type">book</bibliomisc> <publisher> <publishername>Hartley & Marks</publishername> </publisher> <pubdate>2005</pubdate> -<authorgroup><author> +<authorgroup> +<author> <personname> <firstname>Robert</firstname> <surname>Bringhurst</surname> diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp index e37d563..34fae75 100644 --- a/src/BiblioInfo.cpp +++ b/src/BiblioInfo.cpp @@ -1611,6 +1611,8 @@ docstring authorsToDocBookAuthorGroup(docstring const & authorsString, XMLStream // Output the list of authors. xs << xml::StartTag("authorgroup"); + xs << xml::CR(); + auto it = authors.cbegin(); auto en = authors.cend(); for (size_t i = 0; it != en; ++it, ++i) { diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index 05fd23d..bee485e 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -1200,6 +1200,7 @@ void InsetBibtex::docbook(XMLStream & xs, OutputParams const &) const xs << xml::StartTag(toDocBookTag[match[1]]); xs << from_utf8(match[2].str()); xs << xml::EndTag(toDocBookTag[match[1]]); + xs << xml::CR(); } } else { LYXERR0("The BibTeX field " << match[1].str() << " is unknown."); ----------------------------------------------------------------------- Summary of changes: autotests/export/docbook/Additional_lyxcode.lyx | 535 ++++++++++++++++++++ autotests/export/docbook/Additional_lyxcode.xml | 75 +++ autotests/export/docbook/Tufte_Book.xml | 7 +- autotests/export/docbook/subfigures.xml | 35 +- development/DocBookToDo | 23 +- lib/layouts/beamer.layout | 3 + lib/layouts/egs.layout | 3 + lib/layouts/logicalmkup.module | 9 + lib/layouts/lyxmacros.inc | 3 + lib/layouts/shapepar.module | 18 + lib/layouts/stdinsets.inc | 36 ++ lib/layouts/theorems-ams-bytype.inc | 26 + lib/layouts/theorems-ams-chap-bytype.inc | 26 + lib/layouts/theorems-ams-extended-bytype.module | 64 +++ .../theorems-ams-extended-chap-bytype.module | 64 +++ lib/layouts/theorems-ams-extended.module | 64 +++ lib/layouts/theorems-ams.inc | 26 + lib/layouts/theorems-bytype.inc | 26 + lib/layouts/theorems-case.inc | 2 + lib/layouts/theorems-proof-std.inc | 2 + lib/layouts/theorems-proof.inc | 2 + lib/layouts/theorems-starred.inc | 28 + lib/layouts/theorems-without-preamble.inc | 42 ++ lib/layouts/theorems.inc | 28 + src/BiblioInfo.cpp | 2 + src/insets/InsetBibtex.cpp | 1 + src/insets/InsetBox.cpp | 18 + src/insets/InsetLayout.cpp | 20 + src/insets/InsetLayout.h | 16 + src/output_docbook.cpp | 91 ++--- 30 files changed, 1219 insertions(+), 76 deletions(-) create mode 100644 autotests/export/docbook/Additional_lyxcode.lyx create mode 100644 autotests/export/docbook/Additional_lyxcode.xml hooks/post-receive -- Repository for new features
-- lyx-cvs mailing list [email protected] http://lists.lyx.org/mailman/listinfo/lyx-cvs
