[LyX features/feature/docbook] XHTML: fix for encodings in attributes (patch by Kornel)
Thibaut Cuvelier
tcuvelier at lyx.org
Sat Sep 19 18:16:41 UTC 2020
The branch, feature/docbook, has been updated.
discards 1b9da1fcac5c9c4ecfdf7eb2d64e841c9bf40217 (commit)
discards 85f3c14aa962acd918041b36cdd757db4b3f4ed0 (commit)
discards 4561df540602703b90b01c48d70e8c118692675d (commit)
discards 3e5114bdad6976479411ebda0fc32dc641bd69af (commit)
discards 119bc3dff5ff1b384e0106fc17622c243c8e998e (commit)
discards 6af788cd0afca874a07245d908e880ccd3837d73 (commit)
discards 2cb7050d010435c1b4345e7924699c6cfb0042da (commit)
discards 03c09bc16dee0dad2eefb14e81eadac9cb3feb2f (commit)
discards 52216b7323e3532639e5f67959443516fd582a56 (commit)
discards 85d8c77522a0d4cbc1ea7f690a6252cf7a01c205 (commit)
discards 98f92809874d68dc6c329cfd81a409331bc68d81 (commit)
discards 46f12f6a97e633a1776b10abe46369740efaa88d (commit)
discards e4dfc34ead151225af5a566ce68cb3775a24fd6b (commit)
discards 900dd8f58df2e3074e84f2c9aa8bce5ce290212b (commit)
discards c38e9e94c06775fd3c5d8ed8392332dba9e34117 (commit)
discards 5f1a3cc147eeb8bb375d21cee7098e95457129bd (commit)
discards e8545b466f2ebacf639f559a287b9d6c0276207b (commit)
discards 963d9cc0ae896b0377ec7f8ae21500b2dc597a28 (commit)
discards 4be80db357b195ee0b04ab0b90a2e4b88957832b (commit)
discards 812a140f6574f43ce99cfdcf327578ca6095aeb2 (commit)
discards 5503144d4949455dfa95b8be218eeed0a34b9a44 (commit)
discards da199f744ebd93665d6ca3af0ba39150f4c91521 (commit)
discards f42ba13433877b9629725ff79accf2a04e650a04 (commit)
discards 8f1cc760c8d0be1880e190a878e70bf7cb0c065b (commit)
discards 7c66a8b188da530fede92b4437f0e56188375712 (commit)
discards 13e8d503100b92d338a72131023f239e6e25ce96 (commit)
discards 55157ded667091fa41e08af6d32d1b8606cf476e (commit)
discards 57bf09e00ab469d1941588a3d158f8c9520a57f8 (commit)
discards 8498a3643dbd24f3cb58181ccad38f3ff2a846d6 (commit)
discards 4534899e7696f97069da8109dcfbe5765eeeec32 (commit)
discards 0c7106744ffb43f99f0adf3318f4d4aab8a1277d (commit)
discards ba6b9a2ba4e135e6a4cb8d2c45fbbfd3815c31f2 (commit)
discards bb58ae8c8a7c104d1f08e1cce820fb3e88880273 (commit)
discards 239f0d66024b1508da19c3737967179e2c10f5fd (commit)
discards 3dcdc451f33116aae32366d569032905f1cbbcc5 (commit)
discards b9ad1ef6edd964b1c858f4433aeaed238f8a3eca (commit)
discards 83b5416518c0bbb39919f09a22a2460a738be586 (commit)
discards 67988d233e297bbc70375572bd7b0a5e1d26a1d2 (commit)
discards b76a8fb57a990819579c66b8957727aec6998dfc (commit)
discards 260b2909dd0f77fda4cfbf76a3fb0748eccffc6a (commit)
discards 79601dbbe9d0607abb0adeeb39cc5ebaf2d26902 (commit)
discards a0043adead3d9471230a81b01242613020e37848 (commit)
discards 22b4d43f6ae040876a905eb431d500534c70179c (commit)
discards 029ab977e4564aacc712ed2bac6b04d5e41f434e (commit)
discards e64dd22aae50680d258a99ababee48ca7438763c (commit)
discards 737b1b3269d4aa02a587aa4b5f14ea7309962418 (commit)
discards 1d62f91bdb193165066bfd25d6e349aeff61b49a (commit)
discards aee969fed0369409dac0224fe2ce95964d06f208 (commit)
discards 6b55e5dd84054e96ccd2eae0fd490d86d37c6a5f (commit)
discards 154a3a5c76df995a16ff252f4a42d591c523789e (commit)
discards dd82fe02e617c44e3524d343bf2f5ea39e5a2865 (commit)
discards d45d3305559252f7d3e7e39ab54cfe90ab4475e1 (commit)
discards b2ede507bd640fb9cc42c6bfa6e50b3ede858430 (commit)
discards 04e88dcdd8f14bc28497d01862790eae6f4f6696 (commit)
discards a0ba094bcd6095abd09dda50d01713a9bf70a562 (commit)
discards e54ea8bbc327c296d21554df197a1f652ac81e1f (commit)
discards fc61bab5d4185e6f83652d6c96b8e504e1531976 (commit)
discards b75de4f79b53b2060930cffcb7ecaa8e78ea0b81 (commit)
discards 003378708a8caec3de70e25d6ab3d61f432a6dbe (commit)
discards 0f2a1bd8230ebd751a3a921200928848d826c8f0 (commit)
discards f5502ff1a073818177e64bad4c9accd16294d861 (commit)
discards 06fe08dc294ec6a696f4c5bc7900ad01d6694ecd (commit)
discards 70dd019e9ee64dc10aeba015cdc5ce8983fc8a52 (commit)
discards 3c5326367ed6a3d5bfb702d00bdfeeb3378d9797 (commit)
discards 87bb6000252fa99f426e8d405b61f970ad40f40c (commit)
discards 94f2e7c117db4720e0bf4e86a0dc8a85b1f96ea0 (commit)
discards e9f7b3ce79af5d058f304013904b91b8c25be303 (commit)
discards 0681b0f16ec72e83350187d836cfbd1182bea260 (commit)
discards 345a1fce9b768db6e5cfd520f98d2301ed69d035 (commit)
discards a47e2c19314c68f7132d68ecb5a69050c857f7ba (commit)
discards 18c313f10387660c64d8df10c9e7a45ca0336669 (commit)
discards afca5d0a88b7ef1f4f06d64e9a09469259ac709e (commit)
discards 675e62706782cb0eb64b52dc53dd49532a47a958 (commit)
discards dba20c7b5409660faa0232b09b475c43bc6b0e81 (commit)
discards b68620ce3d487034a2e81a4db7930a6a67f29268 (commit)
discards 862daa5dedb0ca009ee74f9ee591a11823116255 (commit)
discards f681e317d17166eaa0abf6e866521a1b52e46824 (commit)
discards cf728030733b7928e911dfb02f0fb0a0cede7de4 (commit)
discards 8118925ca6c1b5642b47a67aaa9d373934bdea58 (commit)
discards fcbd0372c3fda5e32d2093467e98448fd7f53b90 (commit)
discards badd5548402e73e80997153fa61bd5907fa59069 (commit)
discards 75e373c3d73d236b08041d337e11ef6e0ffc1d5b (commit)
discards 2eb396e0910df10c0ece28e4c565e120517f2e4c (commit)
discards ff2483e7acb18e3899550a715efdea6ce5b66876 (commit)
discards 6ee4d623cff3e4be9ed2b61fd8bd887f47c63273 (commit)
discards 018e128a5a1566598edde36a24a31ed472ccf2b6 (commit)
discards d2b820eecb1f6ae5fa858a2e9f002865ac09a3fc (commit)
discards 14806190ab9649be969921547b2ee1b574191767 (commit)
discards 76191b5a0a775c04b5ce012984c45fbd994dc6dc (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (1b9da1fcac5c9c4ecfdf7eb2d64e841c9bf40217)
\
N -- N -- N (b5adcec28aac69e722e8b2bbf28ad2974010f853)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
- Log -----------------------------------------------------------------
commit b5adcec28aac69e722e8b2bbf28ad2974010f853
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Sep 19 17:26:17 2020 +0200
XHTML: fix for encodings in attributes (patch by Kornel)
diff --git a/src/xml.h b/src/xml.h
index d5b4233..857867b 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -184,7 +184,7 @@ struct StartTag
///
explicit StartTag(std::string const & tag, std::string const & attr,
bool keepempty = false)
- : tag_(from_ascii(tag)), attr_(from_ascii(attr)), keepempty_(keepempty) {}
+ : tag_(from_ascii(tag)), attr_(from_utf8(attr)), keepempty_(keepempty) {}
///
explicit StartTag(std::string const & tag, docstring const & attr,
bool keepempty = false)
commit c83fd0eb069564710943ba308e484f937ac5bd4c
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Sep 19 04:26:06 2020 +0200
XHTML sections: saner code to close the section.
It only caused troubles in corner cases...
diff --git a/autotests/export/xhtml/A0_Poster_Simple.lyx b/autotests/export/xhtml/A0_Poster_Simple.lyx
new file mode 100644
index 0000000..998f210
--- /dev/null
+++ b/autotests/export/xhtml/A0_Poster_Simple.lyx
@@ -0,0 +1,192 @@
+#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 a0poster
+\begin_preamble
+% Adjust padding in boxes
+\setlength\fboxsep{12pt}
+% Added by lyx2lyx
+\setlength{\parskip}{\bigskipamount}
+\setlength{\parindent}{0pt}
+\end_preamble
+\options a0,portrait
+\use_default_options false
+\maintain_unincluded_children no
+\language english
+\language_package default
+\inputencoding utf8
+\fontencoding auto
+\font_roman "palatino" "default"
+\font_sans "default" "default"
+\font_typewriter "courier" "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 false
+\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 true
+\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
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\leftmargin 1cm
+\topmargin 1cm
+\rightmargin 1cm
+\bottommargin 1cm
+\secnumdepth 0
+\tocdepth 0
+\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 empty
+\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 Standard
+\align center
+\begin_inset Box Shadowbox
+position "c"
+hor_pos "c"
+has_inner_box 1
+inner_pos "c"
+use_parbox 1
+use_makebox 0
+width "98col%"
+special "none"
+height "5cm"
+height_special "none"
+thickness "0.4pt"
+separation "3pt"
+shadowsize "4pt"
+framecolor "black"
+backgroundcolor "none"
+status open
+
+\begin_layout Plain Layout
+\noindent
+\align center
+
+\series bold
+\noun on
+\begin_inset Flex Most Giant Snippet
+status open
+
+\begin_layout Plain Layout
+\noindent
+
+\series bold
+\noun on
+Poster Heading
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Box Boxed
+position "t"
+hor_pos "c"
+has_inner_box 1
+inner_pos "t"
+use_parbox 0
+use_makebox 0
+width "98col%"
+special "none"
+height "1in"
+height_special "totalheight"
+thickness "0.4pt"
+separation "3pt"
+shadowsize "4pt"
+framecolor "black"
+backgroundcolor "none"
+status open
+
+\begin_layout Section
+Summary
+\end_layout
+
+\begin_layout Itemize
+For multiple columns, use the
+\begin_inset Quotes eld
+\end_inset
+
+Multiple Columns
+\begin_inset Quotes erd
+\end_inset
+
+ module as documented in
+\family sans
+Help\SpecialChar menuseparator
+Additional Features
+\family default
+.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/xhtml/A0_Poster_Simple.xhtml b/autotests/export/xhtml/A0_Poster_Simple.xhtml
new file mode 100644
index 0000000..032aa32
--- /dev/null
+++ b/autotests/export/xhtml/A0_Poster_Simple.xhtml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta name="GENERATOR" content="LyX 2.4.0dev" />
+<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
+<title>LyX Document</title>
+<style type='text/css'>
+/* Layout-provided Styles */
+dfn.lyxnoun {
+ font-variant: small-caps;
+}
+div.standard {
+ margin-bottom: 2ex;
+}
+div.plain_layout {
+text-align: left;
+
+}
+h2.section {
+font-weight: bold;
+font-size: x-large;
+margin-top: 1.3ex;
+margin-bottom: 0.7ex;
+text-align: left;
+
+}
+ul.itemize {
+margin-top: 0.7ex;
+margin-bottom: 0.7ex;
+margin-left: 3ex;
+text-align: left;
+
+}
+div.Shadowbox { border: solid gray medium; border-bottom: solid black 1ex; border-right: solid black 1ex; padding: 0.5ex; }
+span.flex_most_giant_snippet {
+font-size: xx-large;
+}
+div.Boxed {
+ border: solid thick black;
+ padding: 0.5ex;
+}
+
+
+</style>
+</head>
+<body dir="auto">
+<div class="standard" style='text-align: center;' id='magicparlabel-1'><div class='Shadowbox' style='width: 98%; height: 5cm; '><div class="plain_layout" style='text-align: center;' id='magicparlabel-5'><dfn class='lyxnoun'><b><span class="flex_most_giant_snippet"><dfn class='lyxnoun'><b>Poster Heading</b></dfn></span></b></dfn></div>
+</div></div>
+
+<div class="standard" id='magicparlabel-10'><div class='Boxed' style='width: 98%; '><section>
+<h2 class="section" id='magicparlabel-14'><span class="section_label"></span> Summary</h2>
+<ul class="itemize" id='magicparlabel-15'>
+<li class="itemize_item">For multiple columns, use the “Multiple Columns” module as documented in <span style='font-family:sans-serif;'>Help⇒Additional Features</span>.</li>
+</ul>
+</section>
+</div></div>
+</body>
+</html>
diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp
index 0174339..d428761 100644
--- a/src/output_xhtml.cpp
+++ b/src/output_xhtml.cpp
@@ -679,9 +679,8 @@ void xhtmlParagraphs(Text const & text,
// If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning
// of the loop).
while (!headerLevels.empty() && headerLevels.top() != Layout::NOT_IN_TOC) {
- docstring tag = from_utf8("</section>");
headerLevels.pop();
- xs << XMLStream::ESCAPE_NONE << tag;
+ xs << xml::EndTag("section");
xs << xml::CR();
}
}
commit a85b4b88ed4e8e35ee8f6d976cc1a702a106c00f
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Sep 19 03:23:00 2020 +0200
XHTML sections: only filter out things that are not Sectioning, not based on the level.
diff --git a/autotests/export/xhtml/zh_CN_Tutorial.lyx b/autotests/export/xhtml/zh_CN_Tutorial.lyx
new file mode 100644
index 0000000..f5bbb69
--- /dev/null
+++ b/autotests/export/xhtml/zh_CN_Tutorial.lyx
@@ -0,0 +1,974 @@
+#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 book
+\begin_preamble
+% Chinese localization
+\@ifpackageloaded{fontspec}%
+{\usepackage{ctex}}% ctex with non-TeX fonts
+{%\usepackage[UTF8]{ctex}% error with font setup (missing font?)
+}
+\end_preamble
+\options cjk
+\use_default_options true
+\maintain_unincluded_children no
+\language chinese-simplified
+\language_package default
+\inputencoding utf8-cjk
+\fontencoding auto
+\font_roman "lmodern" "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
+\font_cjk gbsn
+\use_microtype false
+\use_dash_ligatures false
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\float_placement th
+\float_alignment class
+\paperfontsize 12
+\spacing onehalf
+\use_hyperref true
+\pdf_title "The LyX Tutorial"
+\pdf_author "LyX Team"
+\pdf_subject "LyX-documentation Tutorial"
+\pdf_keywords "LyX, documentation"
+\pdf_bookmarks true
+\pdf_bookmarksnumbered true
+\pdf_bookmarksopen true
+\pdf_bookmarksopenlevel 1
+\pdf_breaklinks false
+\pdf_pdfborder false
+\pdf_colorlinks true
+\pdf_backref section
+\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
+\index ç´¢å¼
+\shortcut idx
+\color #008000
+\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 2
+\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
+The \SpecialChar LyX
+ Tutorial
+\end_layout
+
+\begin_layout Chapter
+ä»ç»
+\end_layout
+
+\begin_layout Section
+欢è¿æ¥å° \SpecialChar LyX
+!
+\end_layout
+
+\begin_layout Standard
+è¿ä¸ªææ¡£æ¯ä¸ºé£äºä¸ç¥é \SpecialChar LaTeX
+ æç¥ä¹çå°ç人åå¤çãä¸å¿
æ
å¿ï¼ä½¿ç¨ \SpecialChar LyX
+ ä¸å¿
å¦ä¹ \SpecialChar LaTeX
+ã\SpecialChar LyX
+ çç®æ å°±æ¯æä¾ä¸ä¸ªæè§å³æå¾ç \SpecialChar LaTeX
+ åºç¨ã为äºé«æçä½¿ç¨ \SpecialChar LyX
+ï¼è¿æ¯éè¦å¦ä¹ ä¸äºä¸è¥¿ç
+ã
+\end_layout
+
+\begin_layout Standard
+ä½ ä¼åç°å¨å
¶å®åå¤ç软件ä¸å¸¸ç¨çæçæ¹å¼å¨ \SpecialChar LyX
+ ä¸é½ä¸è½ä½¿ç¨äºï¼æ¯å¦ï¼å¨â.âåè¾¹è¾å
¥ä¸¤ä¸ªç©ºæ ¼ï¼å¨æ®µé´è¾å
¥ä¸ä¸ªç©ºè¡ãä½ ä»¥å使ç¨ç软件å
许æå¨è°æ´é´è·ãåä½çä¸è¥¿ï¼æ
+ä»¥ä½ ä¸å¾ä¸å³å½å
¥åæçã\SpecialChar LyX
+ä¼å好æççäºæ
çï¼èä½ åªéè¦è½¬æ³¨äºéè¦çä¸è¥¿ï¼ä½ æ£å¨åçå
容ã
+\end_layout
+
+\begin_layout Standard
+继ç»è¯»ä¸å»ï¼äºè§£æ´å¤ \SpecialChar LyX
+ã读å®è¿ç¯æç¨ï¼ä½ ä¼è§å¾ç©ææå¼çã
+\end_layout
+
+\begin_layout Section
+æ¬æç¨ç®ä»
+\end_layout
+
+\begin_layout Standard
+å¨å¼å§ä¹å建议æ¨å
读ä¸ä¸ Introductionï¼é£é解éäºæ¬æ使ç¨ç注éæ¹å¼ãå½ä½ äºè§£äºåç§åä½çæä¹ä¹åï¼æ们å
æ¥è¯´è¯´æ¬ç¯æç¨æ¯å¹²ä»ä¹çã
+\end_layout
+
+\begin_layout Subsection
+å¦ä¹ æ¹å¼
+\end_layout
+
+\begin_layout Standard
+æ¬æç¨å
å«äºä¾ååç»ä¹ ãå¦ä¹ ä¸æ¨åºè¯¥è¯çè¾å
¥æä»¬è®©ä½ è¾å
¥çä¸è¥¿ï¼å®æææç»ä¹ ï¼ççæ¨æ¯ä¸æ¯å¾å°äºæ£ç¡®çä¸è¥¿ã为äºæ¹ä¾¿ï¼å°æ¬ææ¡£æå°åºæ¥ä¼æ¯ä¸ä¸ªå¥½éæ©ã
+\end_layout
+
+\begin_layout Standard
+å¦æ对 \SpecialChar LaTeX
+ æ¯è¾çæçè¯ï¼ä½ å°è½å¤è¾å¿«çé
读æ¬æç¨ï¼å 为 \SpecialChar LyX
+ çææ³å°±æ¯ \SpecialChar LaTeX
+ ææ³çä¸ç§å
è£
ã\SpecialChar LyX
+ èªèº«ä¹æå¾å¤ç¹æ§æ¯ä½ æ³äºè§£çãå°±ç®ä¸æ³ç»§ç»è¯»ä¸å»ï¼ä½ ä¹åºè¯¥çç
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "sec:LaTeX-ç¨æ·å¿
读"
+
+\end_inset
+
+ï¼å®æ¯ä¸é¨åç»çç»ç \SpecialChar LaTeX
+ ç¨æ·çã
+\end_layout
+
+\begin_layout Subsection
+æ¬æç¨æ²¡æç
+\end_layout
+
+\begin_layout Itemize
+\SpecialChar LyX
+ å
¨é¨ç¹æ§ç详ç»è§£éã
+\end_layout
+
+\begin_deeper
+\begin_layout Standard
+éè¦çè¯ï¼è¯·é
读 the
+\emph on
+User's Guideã
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
+\SpecialChar LaTeX
+ ç详ç»è§£éã
+\end_layout
+
+\begin_deeper
+\begin_layout Standard
+没å¿
è¦è¿æ ·åãè¦æ³ç¥éç¨ \SpecialChar LaTeX
+ å¨ \SpecialChar LyX
+ ä¸è½åäºä»ä¹ï¼å¯ä»¥çç the
+\emph on
+Embedded
+\begin_inset space ~
+\end_inset
+
+Objects
+\emph default
+ manualã
+\end_layout
+
+\end_deeper
+\begin_layout Standard
+ç°å¨æ¯å¼å§ä½ ç第ä¸ä¸ªææ¡£çæ¶åäºã
+\end_layout
+
+\begin_layout Chapter
+åè¯ \SpecialChar LyX
+
+\end_layout
+
+\begin_layout Section
+第ä¸ä¸ª \SpecialChar LyX
+ ææ¡£
+\end_layout
+
+\begin_layout Standard
+å¼å§ä¹å说å 件äºæ
ï¼è¿ä¼ä½¿æ¬æç¨åæ¥æ´å¤§çä½ç¨ã
+\end_layout
+
+\begin_layout Standard
+ç±äºæ¬æç¨ä¸ä¼æä¾ææä¿¡æ¯ï¼æä»¥ä½ éè¦æ¾å°å
¶å®ç帮å©æ件ãè¿å¾ç®åï¼å¯å¨ \SpecialChar LyX
+ï¼å¨å¸®å©èåä¸å°±æ the
+\emph on
+User's Guideã
+\shape italic
+å¨åèªå·±çæ件æ¶å°±å¯ä»¥è¯»å°å®ä»¬äºï¼å®ä»¬æ¬èº«å°±æ¯å¾å¥½çä¾åï¼ã注æï¼å½æå¼å¤ä¸ªæ件æ¶ï¼å¯ä»¥éè¿ View èåæææ¡£æ ç¾è¿è¡åæ¢ã
+\end_layout
+
+\begin_layout Standard
+æ们åè®¾ä½ å·²ç»æäºå
¨åè½ç \SpecialChar LyX
+ å \SpecialChar LaTeX
+ï¼å
æ¬ DVIãPDF æ件æµè§å¨ãä¸è¬æ¥è¯´ï¼å¨åç§æä½ç³»ç»ä¸ï¼å¨å®è£
\SpecialChar LyX
+ çæ¶å就已ç»å好äºã
+\end_layout
+
+\begin_layout Standard
+æåï¼æ们æä¾äºä¸ä¸ªæ件
+\family typewriter
+example_raw.lyxï¼
+\family default
+ç»ä½ ç»ä¹ 使ç¨ãåæ³è¿ä¸ªæ件æ¯ç±ä¸ä¸ªå®å
¨ä¸ç¥é \SpecialChar LyX
+ ç¹æ§ç人åçï¼å¨å¦ä¹ çè¿ç¨ä¸ï¼æ们ä¼å»ºè®®ä½ ä¿®æ¹è¿ä¸ªæ件çãexample_raw.lyx ä¸ä¹å
å«äºä¿®æ¹çæ示信æ¯
+ã为äºå¯¹æ¯ï¼æ们è¿æä¾äºä¸ä»½ \SpecialChar LyX
+ é«æåçåæ ·å
容çææ¡£ï¼example_lyxified.lyxã
+\end_layout
+
+\begin_layout Standard
+示ä¾ææ¡£åå¨äº \SpecialChar LyX
+ å®è£
è·¯å¾ç examples ç®å½ä¸ãæå¼ç¤ºä¾ææ¡£ï¼å¦åå°èªå·±çç®å½ä¸ï¼ä¿®æ¹åè¾åºå° DVI æ件çææã
+\end_layout
+
+\begin_layout Standard
+å¦å¤ï¼examples ç®å½ä¸è¿æå¾å¤å
¶å®ç示ä¾æ件ï¼å®ä»¬å°åæ¨å±ç¤º \SpecialChar LyX
+ ç强大åè½ãå½ä½ å¿è®°äºæ个åè½æä¹ä½¿ç¨çæ¶åï¼ä¹å¯ä»¥åæ¥ççè¿äºææ¡£ã
+\end_layout
+
+\begin_layout Subsection
+å½å
¥ãæ¥çãè¾åº
+\end_layout
+
+\begin_layout Itemize
+使ç¨èå
+\family sans
+File\SpecialChar menuseparator
+New æå¼æ°æ件ã
+\end_layout
+
+\begin_layout Itemize
+è¾å
¥ä¸ä¸ªå¥å:
+\family typewriter
+This is my first \SpecialChar LyX
+ document!
+\end_layout
+
+\begin_layout Itemize
+使ç¨èå
+\family sans
+File\SpecialChar menuseparator
+Save
+\begin_inset space ~
+\end_inset
+
+As ä¿åæ件ã
+\end_layout
+
+\begin_layout Itemize
+è¿è¡ \SpecialChar LaTeX
+ çæ DVI æ件ï¼ä½¿ç¨èå
+\family sans
+Document\SpecialChar menuseparator
+View
+\family default
+ æ å·¥å
·æ æé®
+\begin_inset Info
+type "icon"
+arg "buffer-view"
+\end_inset
+
+ã \SpecialChar LyX
+ å°æå¼ DVI-viewer ç¨åºæ¾ç¤ºææ¡£æå°æ¶çæ ·åã
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+ä¿æ DVI-viewerå¨åå°è¿è¡ä¼èçæ¶é´ã以åå¯ä»¥ç¹å»
+\family sans
+Document\SpecialChar menuseparator
+Update\SpecialChar menuseparator
+DVI
+\family default
+ æå·¥å
·æ æé®
+\begin_inset Info
+type "icon"
+arg "buffer-update"
+\end_inset
+
+ï¼ç \SpecialChar LyX
+ è¿ç®å®æååæ¢å° DVI-viewerå³å¯ã
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+使ç¨èå
+\family sans
+File\SpecialChar menuseparator
+Export
+\family default
+ å°ææ¡£è¾åºæå¸æçæ ¼å¼ã
+\end_layout
+
+\begin_layout Standard
+æåï¼ä½ å·²ç»ååºäºç¬¬ä¸ä¸ª \SpecialChar LyX
+ ææ¡£ãå
¶ä½çç»èï¼ä½ ä¼å¨å
¶å®æåä¸è¯»å°ã
+\end_layout
+
+\begin_layout Subsection
+ç®åæä½
+\end_layout
+
+\begin_layout Standard
+\SpecialChar LyX
+ è½å¤åå°å
¶å®è½¯ä»¶è½åçç»å¤§é¨åäºæ
ï¼å¦ï¼èªå¨æ¢è¡ã段è½ç¼©è¿â¦â¦ä»¥ä¸æ¯å 个ç®åæä½ç使ç¨æ¹æ³ã
+\end_layout
+
+\begin_layout Description
+æ¤æ¶ \SpecialChar LyX
+ æå¤çº§æ¤æ¶åè½ï¼ä½ å¯ä»¥ä½¿ç¨
+\family sans
+Edit\SpecialChar menuseparator
+Undo
+\family default
+ ï¼æå·¥å
·æ¦æé®
+\begin_inset Info
+type "icon"
+arg "undo"
+\end_inset
+
+ï¼æ¥æ¤æ¶æ¬æ¬¡ç¼è¾ä¼è¯å¼å§ä»¥æ¥çæææä½ãå¦ææ¤æ¶è¿å¤´äºï¼å¯ä»¥éæ©
+\family sans
+Edit\SpecialChar menuseparator
+Redo
+\family default
+ ï¼æå·¥å
·æ æé®
+\begin_inset Info
+type "icon"
+arg "redo"
+\end_inset
+
+ï¼æ¢å¤ã
+\end_layout
+
+\begin_deeper
+\begin_layout Standard
+ç®åæ¤æ¶æä½æ¯æ100æ¥ï¼èä¸æ¤æ¶ä¹ä¸æ¯è½å¤æ¯ææææ´æ¹çï¼æ¯å¦å¯¹ææ¡£å¸å±çæ´æ¹å°±ä¸è½è¢«æ¤æ¶ï¼è¿çç¡®æ¯ä¸ä¸ª bugã
+\end_layout
+
+\end_deeper
+\begin_layout Description
+åªå/ç²è´´/å¤å¶ 使ç¨
+\family sans
+Edit\SpecialChar menuseparator
+Cut
+\family default
+ ï¼å·¥å
·æ æé®
+\begin_inset Info
+type "icon"
+arg "cut"
+\end_inset
+
+ï¼ï¼
+\family sans
+Edit\SpecialChar menuseparator
+Copy
+\family default
+ ï¼å·¥å
·æ æé®
+\begin_inset Info
+type "icon"
+arg "copy"
+\end_inset
+
+ï¼ï¼å
+\family sans
+Edit\SpecialChar menuseparator
+Paste
+\family default
+ ï¼å·¥å
·æ æé®
+\begin_inset Info
+type "icon"
+arg "paste"
+\end_inset
+
+ï¼ æ¥å®ç°åªåãå¤å¶åç²è´´æä½ãæè
ä¹å¯éè¿é¼ æ ä¸é®æ¥ç²è´´éä¸çææ¬ï¼å
æ¬å
¶å®ç¨åºä¸éå®çææ¬ï¼ã
+\end_layout
+
+\begin_layout Description
+æ¥æ¾/æ¿æ¢ ç¹å»
+\family sans
+Edit\SpecialChar menuseparator
+Find
+\begin_inset space ~
+\end_inset
+
+&
+\begin_inset space ~
+\end_inset
+
+Replace
+\family default
+ ï¼å·¥å
·æ æé®
+\begin_inset Info
+type "icon"
+arg "dialog-show findreplace"
+\end_inset
+
+ï¼ ï¼å¨åºç°ç对è¯æ¡ä¸ç¹å»æé®â
+\family sans
+Find
+\begin_inset space ~
+\end_inset
+
+Nextâ
+\family default
+ è¿è¡æç´¢ï¼ç¹å»æé®â
+\family sans
+Replaceâæ¿æ¢æå°çåè¯ã
+\family default
+
+\begin_inset Foot
+status open
+
+\begin_layout Plain Layout
+å®æåå
³éçªå£ï¼å¦æè§å¾æ¹ä¾¿çè¯ä¹å¯ä¸ç´å¼çå®ã\SpecialChar LyX
+ ä¸ç大é¨åçªå£é½å¯ä»¥è¿æ ·ã使ç¨æ¶æ³¨æç¦ç¹çåæ¢å³å¯ã
+\end_layout
+
+\end_inset
+
+ ä½ è¿å¯ä»¥æå®åºå大å°åæå
¨åå¹é
ï¼å½ç¶ä¹å¯ä»¥ååæç´¢ææ¡£ã
+\end_layout
+
+\begin_layout Description
+åç¬¦æ ¼å¼ ç¨
+\family sans
+Edit\SpecialChar menuseparator
+Text
+\begin_inset space ~
+\end_inset
+
+Style
+\family default
+ 对è¯æ¡ä¸ç toggle buttons ï¼å¯ä»¥
+\shape italic
+强è°
+\shape default
+ï¼é»è®¤æä½ï¼ãå ç²æ设置为
+\noun on
+æ æ ¼å¼ï¼
+\noun default
+åä½ä¸è¬è¾å°ï¼ç¨äºäººåï¼ã
+\end_layout
+
+\begin_layout Description
+å·¥å
·æ èåæ¯è¾¹çå·¥å
·æ æä¾äºä¸äºå¸¸ç¨åè½çæé®ï¼ä¾å¦ï¼ç²è´´ãæå°ã
+\end_layout
+
+\begin_layout Standard
+å½ç¶ï¼ç®åè¿æ²¡æè¾å
¥è¶³å¤å¤çå
容以使ææè¿äºåè½å¯ç¨ã
+\end_layout
+
+\begin_layout Subsection
+æè§å³ææ³ï¼\SpecialChar LyX
+ ä¸ç空ç½
+\end_layout
+
+\begin_layout Standard
+对æ°ç¨æ·æ¥è¯´ï¼æé¾ç解çæ¯ \SpecialChar LyX
+ å¤ç空ç½çæ¹å¼ãæ²å¤æ¬¡å车åªè½å¾å°ä¸ä¸ªç©ºè¡ï¼æ²å¤æ¬¡ç©ºæ ¼åªè½å¾å°ä¸ä¸ªç©ºæ ¼ãå¨ç©ºç½è¡ä¸ï¼è¿ä¸ä¸ªç©ºæ ¼é½æ æ³å¾å°ãæä¸ Tab
+ é®ä¹ä¸ä¼ç§»å¨ä¸ä¸ª Tab ä½ï¼å®é
ä¸å°±æ²¡æ Tab ä½ï¼å¨é¡µé¢ä¸æ¹ä¹æ²¡ææ å°ºå¯ä¾è®¾ç½® Tab ä½åè¾¹è·ã
+\end_layout
+
+\begin_layout Standard
+å¾å¤åå¤ç软件建ç«å¨ WYSIWYG ç念ä¹ä¸ï¼ä¹å°±æ¯ï¼çå°çå°±æ¯å¾å°çï¼æè§å³æå¾ï¼ã\SpecialChar LyX
+ ä¸åï¼å®å»ºç«å¨ WYSIWYM ï¼ææ³å³æå¾ï¼çç念ä¹ä¸ãä½ æ³ä»ä¹å°±è¾
+å
¥ä»ä¹ï¼\SpecialChar LyX
+ ä¼å¤çæççé®é¢ï¼è¿æ ·ä¿è¯äºè¾åºæ件çç¾è§ãå车å段ï¼ç©ºæ ¼æè¯ï¼æ²¡çç±å¨ä¸è¡ä¸è¾å
¥å¥½å æ¬¡ç©ºæ ¼ãTab æ ¹æ¬å°±æ²¡æè¯æ³æä¹ï¼æ以 \SpecialChar LyX
+ ä¸æ¯æå®ã使ç¨
+ \SpecialChar LyX
+ï¼ä½ å°è±è´¹æ´å¤çæ¶é´å»èèææ¡£ç
+\series bold
+å
容
+\series default
+ï¼èä¸æ¯å®ç
+\series bold
+æ ¼å¼
+\series default
+ãæ´å¤å
³äº WYSIWYM ç解éåè§
+\emph on
+Introductionã
+\end_layout
+
+\begin_layout Standard
+\SpecialChar LyX
+ çç¡®ä¹æä¸å°ç²¾ç»è°æ´ææ¡£æ ¼å¼çæ¹æ³ãæ¯ç« \SpecialChar LyX
+ å¯è½ä¸ä¼ 100% 精确çæç
§ä½ æ³çå»æçã
+\emph on
+User's Guide
+\emph default
+ å
å«äºè°æ´ææ¡£æ ¼å¼ç详ç»æ¹æ³ï¼å
æ¬æ°´å¹³å¡«å
ï¼HFillsï¼ååç´è·ç¦»ï¼å®ä»¬æ¯ç©ºæ ¼ãå车æ´å 强大çµæ´»ï¼ï¼è®¾ç½®åä½å¤§å° ãæ ·å¼çæ¹æ³ï¼è°æ´æ®µè½å¯¹é½æ¹å¼çæ段ãä½ åª
+éè¦ä¸å¿åä½ çææ¡£ï¼å¨æåç»è°ä¸ä¸ææ¡£æ ¼å¼å°±å¥½äºã使ç¨æ®éçåå¤ç软件ï¼ä½ ä¼å¨åææ¡£çæ´ä¸ªè¿ç¨ä¸é½è¢«æ ¼å¼æçæå°æ°ã
+\begin_inset Foot
+status open
+
+\begin_layout Plain Layout
+è¯æ³¨ï¼è¿ AbiWord è¿æ ·è½»é级çåå¤ç软件é½ææ ·å¼äºï¼å°±ä¸è¦è¯´ MS WordãOOo äºã
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+ç¯å¢
+\end_layout
+
+\begin_layout Standard
+ææ¡£çä¸åé¨åæä¸åçä½ç¨ï¼æ们称è¿äºé¨å为âç¯å¢âï¼
+\emph on
+environments
+\emph default
+ï¼ãæ é¢åè¯è¯»è
æ°çè¯é¢ï¼åè¯é¢ï¼å°ä¼å¼å§ãæäºææ¡£å«æç¹æ®çç¯å¢ï¼æ¯å¦ï¼æåä¼ææè¦åé¢ç®ï¼ä¹¦ä¿¡å°±æ²¡ææè¦åé¢ç®ï¼ä½å®æå°åã
+\end_layout
+
+\begin_layout Standard
+ç¯å¢æ¯ \SpecialChar LyX
+ æè§å³æå¾å²å¦çéè¦é¨åãä¸ä¸ªç¯å¢éè¦å
·ä½çå®ä¹ï¼åä½å¤§å°ãæ ·å¼ã缩è¿ãè¡é´è·ççãè¿ä¸ªé®é¢é常éè¦ï¼å 为ä¸ä¸ªç»å®ç¯å¢çå
·ä½å®ä¹ä¼éçæ档类åçååè
+ååãæ¯å¦ï¼ææåè¦æ±æ é¢æ¯é»ä½ã18ptãå±
ä¸ï¼èå¦ä¸ä¸ªå¯è½è¦æ±æä½ã15ptã左对é½ï¼ä¸åçè¯è¨ä¹æä¸åç缩è¿æ åï¼åèæç®çæ ¼å¼å°±ååæ´å¤§äºã\SpecialChar LyX
+
+ ä¼æä½ ä»è¿äºæ ¼å¼ä¸é´æ¯æåºæ¥ã
+\end_layout
+
+\begin_layout Standard
+ä½ å¯ä»¥ä½¿ç¨å·¥å
·æ ä¸çç¯å¢ä¸æèå
+\begin_inset Graphics
+ filename ../../../lib/doc/clipart/ToolbarEnvBox.png
+ scale 50
+ groupId In line
+
+\end_inset
+
+æ¥éæ©ç¯å¢ï¼å®ä¹è½åè¯ä½ å½åçç¯å¢æ¯ä»ä¹ï¼å
¶ä¸âStandardâæ¯ææ¬çé»è®¤ç¯å¢ãç°å¨æ们å°å¨ä½ çæ°ææ¡£ä¸æ·»å å 个ç¯å¢ï¼æ¥ççå®ä»¬æ¯æä¹å·¥ä½çå§ã
+\end_layout
+
+\begin_layout Subsection
+èï¼
+\family sans
+Section
+\family default
+ï¼ä¸åèï¼Subsectionï¼
+\end_layout
+
+\begin_layout Standard
+å¨ \SpecialChar LyX
+ ææ¡£ç第ä¸è¡è¾å
¥â
+\family typewriter
+Introduction
+\family default
+âï¼å¨ç¯å¢ä¸æèåä¸è®¾ä¸ºâèâï¼
+\family sans
+Section
+\family default
+ï¼
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+设å®ç¯å¢ä¸éè¦éæ©æ´è¡ï¼æ®µï¼ï¼å
æ åçå
¶ä¸å³å¯ãè¥æ³ä¸æ¬¡æ¹åå¤è¡çç¯å¢ï¼åéè¦éå®ä¹ã
+\end_layout
+
+\end_inset
+
+ï¼ ç¡®å®ä½ éæ©äºâèâï¼
+\family sans
+Section
+\family default
+ï¼èä¸æ¯âè
+\family sans
+*
+\family default
+âï¼
+\family sans
+Section*
+\family default
+ï¼ã\SpecialChar LyX
+ å°å¨åè¾¹å ä¸â1â并æåä½è°å¤§ãç°å¨æ²å车ï¼ç¯å¢å°ä»âèâï¼
+\family sans
+Section
+\family default
+ï¼ååâæ åâï¼Standardï¼ãåå¤æ°ç¯å¢ç±»ä¼¼ï¼æ²å车åç¯å¢å°ç»æ¢ãè¾å
¥ææ¬ï¼
+\end_layout
+
+\begin_layout LyX-Code
+This is an introduction to my first \SpecialChar LyX
+ document.
+\end_layout
+
+\begin_layout Standard
+å次å车ï¼éæ©âèâï¼
+\family sans
+Section
+\family default
+ï¼ç¯å¢ï¼\SpecialChar LyX
+ å°åä¸â2â并çå¾
è¾å
¥ãç°å¨è¾å
¥â
+\family typewriter
+More Stuff
+\family default
+âï¼\SpecialChar LyX
+ ä¼æå®è®¾ç½®æèï¼
+\family sans
+Section
+\family default
+ï¼æ é¢çæ ·å¼ã
+\end_layout
+
+\begin_layout Standard
+å°å
æ å®ä½å°è 1 ï¼Section
+\begin_inset space ~
+\end_inset
+
+1ï¼æ«å°¾ï¼æ²å车ï¼å次设置为âèâï¼
+\family sans
+Section
+\family default
+ï¼ï¼\SpecialChar LyX
+ ä¼åä¸â2â并çå¾
è¾å
¥ãè¾å
¥â
+\family typewriter
+About This Document
+\family default
+âãåæçè 2 ï¼Section
+\begin_inset space ~
+\end_inset
+
+2ï¼ï¼âMore Stuffâï¼ç°å¨å·²ç»è¢«æ¹æäºè 3 ï¼Section
+\begin_inset space ~
+\end_inset
+
+3ï¼ãä½ åªéè¦ç¡®å®åªäºæåæ¯èï¼
+\family sans
+Section
+\family default
+ï¼æ é¢ï¼\SpecialChar LyX
+ ä¼å¤çç¼å·åæçæ ¼å¼çï¼è¿å°±æ¯æè§å³ææ³ï¼WYSIWYMï¼çé£æ ¼ã
+\end_layout
+
+\begin_layout Standard
+æ²å车ï¼åå°âæ åâï¼Standardï¼ç¯å¢ï¼è¾å
¥ä¸è¾¹ 5 è¡æåï¼
+\end_layout
+
+\begin_layout LyX-Code
+Sections and subsections are described below.
+\end_layout
+
+\begin_layout LyX-Code
+Section Description
+\end_layout
+
+\begin_layout LyX-Code
+Sections are bigger than subsections.
+\end_layout
+
+\begin_layout LyX-Code
+Subsection description
+\end_layout
+
+\begin_layout LyX-Code
+Subsections are smaller than sections.
+\end_layout
+
+\begin_layout Standard
+ç¹å»ç¬¬äºè¡ï¼å¨ç¯å¢ä¸æèåä¸è®¾ä¸ºâåèâï¼Subsectionï¼ã\SpecialChar LyX
+ å°ä¼å¨åè¾¹å ä¸â2.1âï¼å¹¶æåä½è°æ´çæ¯æ£æ大ï¼æ¯èï¼Sectionï¼æ é¢å°ãæ¥çæ第
+ 4 è¡ä¹è®¾ç½®æ为âåèâï¼Subsectionï¼ï¼\SpecialChar LyX
+ å°å¨å®åè¾¹å ä¸â2.2âãå¦æå¨è 2 ï¼Section 2ï¼åè¾¹å ä¸äºå«çèï¼è 2 å°ä¼èªå¨å为è
+ 3ï¼Section 3ï¼ï¼åè¾¹çåèä¹ä¼è·çåæâ3.1âåâ3.2âã
+\end_layout
+
+\begin_layout Standard
+ææ¡£çå±çº§ç»æè¿æ次åè ( Subsubsection )ã段 ( Paragraph ) åå段 ( Subparagraph )ï¼è¿äºå°±ç±è¯»è
èªè¡æç©å§ã
+段åå段çæ é¢é»è®¤æ¯ä¸ç¼å·çï¼èä¸å段è¿æ缩è¿ï¼åé
+\emph on
+User's Guide
+\emph default
+ å¾å°æ´å¤è§£é以åå¦ä½æ¹åå®ä»¬ãç« ï¼Chapterï¼æ¯ææ¡£å±çº§ç»æä¸æé«çä¸çº§ï¼åªè½å¨æäºç¹å®ç \SpecialChar LyX
+ æ档类åä¸æè½ä½¿ç¨å®ï¼è§
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "sec:æ档类"
+
+\end_inset
+
+ï¼ã
+\end_layout
+
+\begin_layout Standard
+ä½ å¯è½è¿å¸æä¸äºèååèæ¯ä¸ç¼å·çï¼\SpecialChar LyX
+ æä¸é¨çç¯å¢å®ç°è¿ä¸ªåè½ãå½æèçæ é¢ç¯å¢æ¹ä¸ºâè*
+\begin_inset Quotes erd
+\end_inset
+
+ï¼Section*ï¼åï¼\SpecialChar LyX
+ è¿å°å¯¹å®ä½¿ç¨ç¸åçåä½ï¼åªæ¯ä¸å对å®è¿è¡ç¼å·ãç¸åºçä¹æ带âæâçåèå次åèç¯å¢ãè¯çæä¸äºèæåèçæ é¢ç¯å¢æ¹ä¸ºå¸¦æçï¼åæ¶ççå
¶
+å®çç¼å·æä¹éä¹æ¹åã
+\end_layout
+
+\begin_layout Standard
+ç»ä¹ ï¼ä¿®æ¹ example_raw.lyx ä¸çèååèæ é¢ã
+\end_layout
+
+\begin_layout Subsection
+å表ï¼Listsï¼ååå表ï¼sublistsï¼
+\end_layout
+
+\begin_layout Standard
+\SpecialChar LyX
+ æ好å ç§å表ç¯å¢ï¼å¨åæ纲æè
éæ°æåºä¸ä¸ªå·²æçå表æ¶ï¼è¿äºå表ç¯å¢ä¼å¸®ä¸å¤§å¿ãä¸åçæ档类åéè¦ä¸åçå表ç¯å¢ï¼
+\end_layout
+
+\begin_layout Itemize
+å¹»ç¯ç使ç¨å¸¦åç¹çæ¡ç®ç¯å¢ï¼
+\family sans
+Itemize
+\family default
+ï¼ã
+\end_layout
+
+\begin_layout Itemize
+大纲使ç¨å¸¦ç¼å·çæ举ç¯å¢ï¼
+\family sans
+Enumerate
+\family default
+ï¼ã
+\end_layout
+
+\begin_layout Itemize
+åè¯è§£é常ç¨æè¿°ç¯å¢ï¼
+\family sans
+Description
+\family default
+ï¼ã
+\end_layout
+
+\begin_layout Itemize
+å表ç¯å¢ï¼
+\family sans
+List
+\family default
+ï¼åæè¿°ç¯å¢ï¼
+\family sans
+Description
+\family default
+ï¼å·®ä¸å¤ï¼åªæ¯å¯¹é½æ¹å¼ç¨æä¸åã
+\end_layout
+
+\begin_layout Standard
+ç°å¨æ们åä¸ä¸ª \SpecialChar LyX
+ æå
³ä¼ç¹çå表ãå¨ææ¡£ä¸è¾å
¥ï¼
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+\SpecialChar LyX
+ is better than other word processors because:
+\end_layout
+
+\begin_layout Standard
+ç¶åæ²å车ï¼å¹¶å¨ç¯å¢ä¸æå表ä¸éæ©æ¡ç®ç¯å¢ï¼
+\family sans
+Itemize
+\family default
+ï¼ã\SpecialChar LyX
+ ä¼å¨è¡é¦å ä¸åç¹ã继ç»è¾å
¥ï¼
+\end_layout
+
+\begin_layout LyX-Code
+Typesetting is done for you.
+\end_layout
+
+\begin_layout LyX-Code
+Math is WYSIWYG
+\end_layout
+
+\begin_layout LyX-Code
+Lists are very easy to create!
+\end_layout
+
+\begin_layout Standard
+åæ é¢ä¸åï¼å表ç¯å¢å¨æ²å车æ¶ä¸ä¼ç»æ¢ï¼\SpecialChar LyX
+ ä¼è®¤ä¸ºä½ å°ç»§ç»åä¸ä¸ä¸ªæ¡ç®ãæ以ä¸è¾¹çè¾å
¥å°ä¼äº§çä¸ä¸ªå表项ãéæ°éæ©æ åç¯å¢ï¼
+\family sans
+Standard
+\family default
+ï¼æ使ç¨å¿«æ·é®
+\family sans
+Alt+P
+\begin_inset space ~
+\end_inset
+
+S
+\family default
+ æè½éåºå表ç¯å¢ãè¦å¨ä¸ä¸ªå表项ä¸ä½¿ç¨å¤ä¸ªæ®µè½ï¼å¯ä½¿ç¨ä¿æ¤æ§ä¸æï¼
+\family sans
+Protected
+\begin_inset space ~
+\end_inset
+
+Break
+\family default
+ï¼ï¼æä¸ Ctrl + å车å³å¯ã
+\end_layout
+
+\begin_layout Standard
+ä½ å·²ç»å¾å°äºä¸ä¸ªæ¼äº®çæ¡ç®å表ï¼ä½ æ¯ä¸æ¯å·²ç»è¿«ä¸åå¾
çæ³è¿è¡ \SpecialChar LaTeX
+ ççå®ä»¬æå°åºæ¥çæ ·åäºï¼å¯å¦ææ¨æ³ç»å®ä»¬å ä¸ç¼å·å¢ï¼ä½ åªéè¦éå®æ´ä¸ªå表
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+å¦æä¸è¿åè¾¹ä¸æ®µä¹ä¸èµ·éä¸çè¯ï¼ä½ æ¯æ æ³éä¸ç¬¬ä¸ä¸ªæ¡ç®åè¾¹çåç¹çï¼ç±»ä¼¼çï¼ä½ ä¹æ æ³éå®ç« èç¼å·ãè¿æ¯ææå¦æ¤çï¼å 为éçæ档类ååæåä½ç½®çä¸åï¼è¿äºåç¹åç¼
+å·ä¹ä¼åçååã
+\end_layout
+
+\end_inset
+
+ï¼ç¶åéæ©æ举ç¯å¢ï¼
+\family sans
+Enumerate
+\family default
+ï¼å³å¯ãå¦æä½ å¢å æ¡ç®çè¯ï¼\SpecialChar LyX
+ ä¼èªå¨ä¿®æ¹æ举ç¼å·çã
+\end_layout
+
+\begin_layout Standard
+ç°å¨å表项è¿æ¯å¤äºè¢«éå®ç¶æçï¼ä½ å¯ä»¥åè¯è¯æè¿°ï¼
+\family sans
+Description
+\family default
+ï¼åå表ï¼
+\family sans
+List
+\family default
+ï¼ä¸¤ç§ç¯å¢ãè¿ä¸¤ç§ç¯å¢é½æ¯åè¯å å®ä¹çå½¢å¼ï¼æè¿°ç¯å¢åè¾¹çåè¯ç¨é»ä½ï¼å表ç¯å¢çåè¯ååè¾¹çå®ä¹ç±âTabâ
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+è¿éçTabæ¯æçTabï¼å®ä¼èªéåºå°æé¿çåè¯é¿åº¦ï¼ï¼èä¸æ¯å®é¿çæåæºTabã
+\end_layout
+
+\end_inset
+
+åéãåè¾¹çåè¯å¦æå¤äºä¸ä¸ªè¯çè¯ï¼éè¦ä½¿ç¨ä¿æ¤æ§ç©ºæ ¼ï¼
+\family sans
+Protected
+\begin_inset space ~
+\end_inset
+
+Blank
+\family default
+sï¼å°å®ä»¬åå¼ã
+\end_layout
+
+\begin_layout Standard
+ç»ä¹ ï¼æç
+\family typewriter
+example_raw.lyx
+\family default
+ ä¸çå表ã
+\end_layout
+
+\begin_layout Standard
+è¿äºå表ç¯å¢è¿å¯ä»¥åµå¥ä½¿ç¨ï¼æ纲就æ¯æ常è§çä¾åã带ç¼å·æåç¹çå表å¨åå表ä¸ä¼æä¸åç表ç°å½¢å¼ãæ´å¤è¯¦æ
åè§
+\emph on
+User's Guide
+\emph default
+ ã
+\end_layout
+
+\begin_layout Subsection
+å
¶å®ç¯å¢ï¼è¯ãå¼ç¨åæ´å¤
+\end_layout
+
+\begin_layout Standard
+æ两ç§å¼ç¨ç¯å¢ï¼çä¸ç¹çå¼ç¨ä½¿ç¨å¼ç¨ç¯å¢ï¼
+\family sans
+Quote
+\family default
+ï¼ï¼é¿ä¸ç¹çå¼ç¨ä½¿ç¨å¼æç¯å¢ï¼
+\family sans
+Quotation
+\family default
+ï¼ã计ç®æºä»£ç 使ç¨ä»£ç ç¯å¢ï¼
+\family sans
+\SpecialChar LyX
+-Code
+\family default
+ï¼ï¼è¯¥ç¯å¢ä½¿ç¨
+\family typewriter
+typewriter
+\family default
+ åä½ï¼èä¸è¿éæ¯ \SpecialChar LyX
+ ä¸å¯ä¸å
许使ç¨å¤ä¸ªç©ºæ ¼çå°æ¹ãä½ è¿å¯ä»¥ä½¿ç¨è¯ç¯å¢ï¼
+\family sans
+Verse
+\family default
+ï¼æ¥åè¯ï¼å车åèï¼Ctrl + å车æè¡ã对ææç¯å¢çå®æ´æè¿°åè§
+\emph on
+ User's Guide
+\emph default
+ã
+\end_layout
+
+\begin_layout Standard
+ç»ä¹ ï¼ä¿®æ¹
+\family typewriter
+example_raw.lyx
+\family default
+ ä¸çå¼ç¨ã代ç ãè¯ç¯å¢ã
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/xhtml/zh_CN_Tutorial.xhtml b/autotests/export/xhtml/zh_CN_Tutorial.xhtml
new file mode 100644
index 0000000..5755eee
--- /dev/null
+++ b/autotests/export/xhtml/zh_CN_Tutorial.xhtml
@@ -0,0 +1,256 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta name="GENERATOR" content="LyX 2.4.0dev" />
+<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
+<title>The LyX Tutorial</title>
+<style type='text/css'>
+/* Layout-provided Styles */
+dfn.lyxnoun {
+ font-variant: small-caps;
+}
+h1.title {
+font-size: x-large;
+margin-bottom: 1ex;
+text-align: center;
+
+}
+h1.chapter {
+font-weight: bold;
+font-size: xx-large;
+margin-top: 2ex;
+margin-bottom: 0.8ex;
+text-align: left;
+
+}
+h2.section {
+font-weight: bold;
+font-size: x-large;
+margin-top: 1.3ex;
+margin-bottom: 0.7ex;
+text-align: left;
+
+}
+div.standard {
+ margin-bottom: 2ex;
+}
+h3.subsection {
+font-weight: bold;
+font-size: large;
+margin-top: 0.9ex;
+margin-bottom: 0.5ex;
+text-align: left;
+
+}
+ul.itemize {
+margin-top: 0.7ex;
+margin-bottom: 0.7ex;
+margin-left: 3ex;
+text-align: left;
+
+}
+div.plain_layout {
+text-align: left;
+
+}
+dl.description dt { font-weight: bold; }
+div.lyx_code {
+font-family: monospace;
+margin-top: 0.5ex;
+margin-bottom: 0.5ex;
+margin-left: 3ex;
+margin-right: 3ex;
+text-align: left;
+
+}
+span.info { font-family: sans-serif; }
+span.foot_label {
+ vertical-align: super;
+ font-size: smaller;
+ font-weight: bold;
+ text-decoration: underline;
+}
+div.foot {
+ display: inline;
+ font-size: small;
+ font-weight: medium;
+ font-family: serif;
+ font-variant: normal;
+ font-style: normal;
+}
+div.foot_inner { display: none; }
+div.foot:hover div.foot_inner {
+ display: block;
+ border: 1px double black;
+ margin: 0em 1em;
+ padding: 1em;
+}
+
+
+</style>
+</head>
+<body dir="auto">
+<h1 class="title" id='magicparlabel-1'>The LyX Tutorial</h1>
+<section>
+<h1 class="chapter" id='magicparlabel-2'><span class="chapter_label">第 1 ç« </span> ä»ç»</h1>
+<section>
+<h2 class="section" id='magicparlabel-3'><span class="section_label">1.1</span> 欢è¿æ¥å° LyX!</h2>
+<div class="standard" id='magicparlabel-4'>è¿ä¸ªææ¡£æ¯ä¸ºé£äºä¸ç¥é LaTeX æç¥ä¹çå°ç人åå¤çãä¸å¿
æ
å¿ï¼ä½¿ç¨ LyX ä¸å¿
å¦ä¹ LaTeXãLyX çç®æ å°±æ¯æä¾ä¸ä¸ªæè§å³æå¾ç LaTeX åºç¨ã为äºé«æçä½¿ç¨ LyXï¼è¿æ¯éè¦å¦ä¹ ä¸äºä¸è¥¿çã</div>
+
+<div class="standard" id='magicparlabel-5'>ä½ ä¼åç°å¨å
¶å®åå¤ç软件ä¸å¸¸ç¨çæçæ¹å¼å¨ LyX ä¸é½ä¸è½ä½¿ç¨äºï¼æ¯å¦ï¼å¨â.âåè¾¹è¾å
¥ä¸¤ä¸ªç©ºæ ¼ï¼å¨æ®µé´è¾å
¥ä¸ä¸ªç©ºè¡ãä½ ä»¥å使ç¨ç软件å
许æå¨è°æ´é´è·ãåä½çä¸è¥¿ï¼æä»¥ä½ ä¸å¾ä¸å³å½å
¥åæçãLyXä¼å好æççäºæ
çï¼èä½ åªéè¦è½¬æ³¨äºéè¦çä¸è¥¿ï¼ä½ æ£å¨åçå
容ã</div>
+
+<div class="standard" id='magicparlabel-6'>继ç»è¯»ä¸å»ï¼äºè§£æ´å¤ LyXã读å®è¿ç¯æç¨ï¼ä½ ä¼è§å¾ç©ææå¼çã</div>
+</section>
+<section>
+<h2 class="section" id='magicparlabel-7'><span class="section_label">1.2</span> æ¬æç¨ç®ä»</h2>
+<div class="standard" id='magicparlabel-8'>å¨å¼å§ä¹å建议æ¨å
读ä¸ä¸ Introductionï¼é£é解éäºæ¬æ使ç¨ç注éæ¹å¼ãå½ä½ äºè§£äºåç§åä½çæä¹ä¹åï¼æ们å
æ¥è¯´è¯´æ¬ç¯æç¨æ¯å¹²ä»ä¹çã</div>
+<section>
+<h3 class="subsection" id='magicparlabel-9'><span class="subsection_label">1.2.1</span> å¦ä¹ æ¹å¼</h3>
+<div class="standard" id='magicparlabel-10'>æ¬æç¨å
å«äºä¾ååç»ä¹ ãå¦ä¹ ä¸æ¨åºè¯¥è¯çè¾å
¥æä»¬è®©ä½ è¾å
¥çä¸è¥¿ï¼å®æææç»ä¹ ï¼ççæ¨æ¯ä¸æ¯å¾å°äºæ£ç¡®çä¸è¥¿ã为äºæ¹ä¾¿ï¼å°æ¬ææ¡£æå°åºæ¥ä¼æ¯ä¸ä¸ªå¥½éæ©ã</div>
+
+<div class="standard" id='magicparlabel-11'>å¦æ对 LaTeX æ¯è¾çæçè¯ï¼ä½ å°è½å¤è¾å¿«çé
读æ¬æç¨ï¼å 为 LyX çææ³å°±æ¯ LaTeX ææ³çä¸ç§å
è£
ãLyX èªèº«ä¹æå¾å¤ç¹æ§æ¯ä½ æ³äºè§£çãå°±ç®ä¸æ³ç»§ç»è¯»ä¸å»ï¼ä½ ä¹åºè¯¥çç <a href="#sec_LaTeX_____">sec:LaTeX-ç¨æ·å¿
读</a>ï¼å®æ¯ä¸é¨åç»çç»ç LaTeX ç¨æ·çã</div>
+</section>
+<section>
+<h3 class="subsection" id='magicparlabel-12'><span class="subsection_label">1.2.2</span> æ¬æç¨æ²¡æç</h3>
+<ul class="itemize" id='magicparlabel-13'>
+<li class="itemize_item">LyX å
¨é¨ç¹æ§ç详ç»è§£éã
+<div class="standard" id='magicparlabel-14'>éè¦çè¯ï¼è¯·é
读 the <em>User's Guideã</em></div>
+</li><li class="itemize_item">LaTeX ç详ç»è§£éã
+<div class="standard" id='magicparlabel-16'>没å¿
è¦è¿æ ·åãè¦æ³ç¥éç¨ LaTeX å¨ LyX ä¸è½åäºä»ä¹ï¼å¯ä»¥çç the <em>Embedded Objects</em> manualã</div>
+</li></ul>
+<div class="standard" id='magicparlabel-17'>ç°å¨æ¯å¼å§ä½ ç第ä¸ä¸ªææ¡£çæ¶åäºã</div>
+</section>
+</section>
+</section>
+<section>
+<h1 class="chapter" id='magicparlabel-18'><span class="chapter_label">第 2 ç« </span> åè¯ LyX</h1>
+<section>
+<h2 class="section" id='magicparlabel-19'><span class="section_label">2.1</span> 第ä¸ä¸ª LyX ææ¡£</h2>
+<div class="standard" id='magicparlabel-20'>å¼å§ä¹å说å 件äºæ
ï¼è¿ä¼ä½¿æ¬æç¨åæ¥æ´å¤§çä½ç¨ã</div>
+
+<div class="standard" id='magicparlabel-21'>ç±äºæ¬æç¨ä¸ä¼æä¾ææä¿¡æ¯ï¼æä»¥ä½ éè¦æ¾å°å
¶å®ç帮å©æ件ãè¿å¾ç®åï¼å¯å¨ LyXï¼å¨å¸®å©èåä¸å°±æ the <em>User's Guideã<i>å¨åèªå·±çæ件æ¶å°±å¯ä»¥è¯»å°å®ä»¬äºï¼å®ä»¬æ¬èº«å°±æ¯å¾å¥½çä¾åï¼ã注æï¼å½æå¼å¤ä¸ªæ件æ¶ï¼å¯ä»¥éè¿ View èåæææ¡£æ ç¾è¿è¡åæ¢ã</i></em></div>
+
+<div class="standard" id='magicparlabel-22'>æ们åè®¾ä½ å·²ç»æäºå
¨åè½ç LyX å LaTeXï¼å
æ¬ DVIãPDF æ件æµè§å¨ãä¸è¬æ¥è¯´ï¼å¨åç§æä½ç³»ç»ä¸ï¼å¨å®è£
LyX çæ¶å就已ç»å好äºã</div>
+
+<div class="standard" id='magicparlabel-23'>æåï¼æ们æä¾äºä¸ä¸ªæ件 <span style='font-family:monospace;'>example_raw.lyxï¼</span>ç»ä½ ç»ä¹ 使ç¨ãåæ³è¿ä¸ªæ件æ¯ç±ä¸ä¸ªå®å
¨ä¸ç¥é LyX ç¹æ§ç人åçï¼å¨å¦ä¹ çè¿ç¨ä¸ï¼æ们ä¼å»ºè®®ä½ ä¿®æ¹è¿ä¸ªæ件çãexample_raw.lyx ä¸ä¹å
å«äºä¿®æ¹çæ示信æ¯ã为äºå¯¹æ¯ï¼æ们è¿æä¾äºä¸ä»½ LyX é«æåçåæ ·å
容çææ¡£ï¼example_lyxified.lyxã</div>
+
+<div class="standard" id='magicparlabel-24'>示ä¾ææ¡£åå¨äº LyX å®è£
è·¯å¾ç examples ç®å½ä¸ãæå¼ç¤ºä¾ææ¡£ï¼å¦åå°èªå·±çç®å½ä¸ï¼ä¿®æ¹åè¾åºå° DVI æ件çææã</div>
+
+<div class="standard" id='magicparlabel-25'>å¦å¤ï¼examples ç®å½ä¸è¿æå¾å¤å
¶å®ç示ä¾æ件ï¼å®ä»¬å°åæ¨å±ç¤º LyX ç强大åè½ãå½ä½ å¿è®°äºæ个åè½æä¹ä½¿ç¨çæ¶åï¼ä¹å¯ä»¥åæ¥ççè¿äºææ¡£ã</div>
+<section>
+<h3 class="subsection" id='magicparlabel-26'><span class="subsection_label">2.1.1</span> å½å
¥ãæ¥çãè¾åº</h3>
+<ul class="itemize" id='magicparlabel-27'>
+<li class="itemize_item">使ç¨èå <span style='font-family:sans-serif;'>File⇒New æå¼æ°æ件ã</span></li>
+<li class="itemize_item">è¾å
¥ä¸ä¸ªå¥å: <span style='font-family:monospace;'>This is my first LyX document!</span></li>
+<li class="itemize_item">使ç¨èå <span style='font-family:sans-serif;'>File⇒Save As ä¿åæ件ã</span></li>
+<li class="itemize_item">è¿è¡ LaTeX çæ DVI æ件ï¼ä½¿ç¨èå <span style='font-family:sans-serif;'>Document⇒View</span> æ å·¥å
·æ æé® <span class="info"><img src='D:/LyX/lyx-unstable/lib/images/buffer-view.svgz' alt='image: ' /></span>ã LyX å°æå¼ DVI-viewer ç¨åºæ¾ç¤ºææ¡£æå°æ¶çæ ·åã <div class="foot"><span class="foot_label">1</span><div class="foot_inner"><div class="plain_layout" id='magicparlabel-35'>ä¿æ DVI-viewerå¨åå°è¿è¡ä¼èçæ¶é´ã以åå¯ä»¥ç¹å» <span style='font-family:sans-serif;'>Document⇒Update⇒DVI</span> æå·¥å
·æ æé® <span class="info"><img src='D:/LyX/lyx-unstable/lib/images/buffer-update.svgz' alt='image: ' /></span>ï¼ç LyX è¿ç®å®æååæ¢å° DVI-viewerå³å¯ã</div>
+</div></div></li>
+<li class="itemize_item">使ç¨èå <span style='font-family:sans-serif;'>File⇒Export</span> å°ææ¡£è¾åºæå¸æçæ ¼å¼ã</li>
+</ul>
+<div class="standard" id='magicparlabel-38'>æåï¼ä½ å·²ç»ååºäºç¬¬ä¸ä¸ª LyX ææ¡£ãå
¶ä½çç»èï¼ä½ ä¼å¨å
¶å®æåä¸è¯»å°ã</div>
+</section>
+<section>
+<h3 class="subsection" id='magicparlabel-39'><span class="subsection_label">2.1.2</span> ç®åæä½</h3>
+<div class="standard" id='magicparlabel-40'>LyX è½å¤åå°å
¶å®è½¯ä»¶è½åçç»å¤§é¨åäºæ
ï¼å¦ï¼èªå¨æ¢è¡ã段è½ç¼©è¿â¦â¦ä»¥ä¸æ¯å 个ç®åæä½ç使ç¨æ¹æ³ã</div>
+<dl class='description' id='magicparlabel-41'>
+<dt class="description_label">æ¤æ¶</dt>
+<dd class="description_item"> LyX æå¤çº§æ¤æ¶åè½ï¼ä½ å¯ä»¥ä½¿ç¨ <span style='font-family:sans-serif;'>Edit⇒Undo</span> ï¼æå·¥å
·æ¦æé® <span class="info"><img src='D:/LyX/lyx-unstable/lib/images/undo.svgz' alt='image: ' /></span>ï¼æ¥æ¤æ¶æ¬æ¬¡ç¼è¾ä¼è¯å¼å§ä»¥æ¥çæææä½ãå¦ææ¤æ¶è¿å¤´äºï¼å¯ä»¥éæ© <span style='font-family:sans-serif;'>Edit⇒Redo</span> ï¼æå·¥å
·æ æé® <span class="info"><img src='D:/LyX/lyx-unstable/lib/images/redo.svgz' alt='image: ' /></span>ï¼æ¢å¤ã
+<div class="standard" id='magicparlabel-44'>ç®åæ¤æ¶æä½æ¯æ100æ¥ï¼èä¸æ¤æ¶ä¹ä¸æ¯è½å¤æ¯ææææ´æ¹çï¼æ¯å¦å¯¹ææ¡£å¸å±çæ´æ¹å°±ä¸è½è¢«æ¤æ¶ï¼è¿çç¡®æ¯ä¸ä¸ª bugã</div>
+</dd><dt class="description_label">åªå/ç²è´´/å¤å¶</dt>
+<dd class="description_item"> ä½¿ç¨ <span style='font-family:sans-serif;'>Edit⇒Cut</span> ï¼å·¥å
·æ æé® <span class="info"><img src='D:/LyX/lyx-unstable/lib/images/cut.svgz' alt='image: ' /></span>ï¼ï¼ <span style='font-family:sans-serif;'>Edit⇒Copy</span> ï¼å·¥å
·æ æé® <span class="info"><img src='D:/LyX/lyx-unstable/lib/images/copy.svgz' alt='image: ' /></span>ï¼ï¼å <span style='font-family:sans-serif;'>Edit⇒Paste</span> ï¼å·¥å
·æ æé® <span class="info"><img src='D:/LyX/lyx-unstable/lib/images/paste.svgz' alt='image: ' /></span>ï¼ æ¥å®ç°åªåãå¤å¶åç²è´´æä½ãæè
ä¹å¯éè¿é¼ æ ä¸é®æ¥ç²è´´éä¸çææ¬ï¼å
æ¬å
¶å®ç¨åºä¸éå®çææ¬ï¼ã</dd>
+<dt class="description_label">æ¥æ¾/æ¿æ¢</dt>
+<dd class="description_item"> ç¹å» <span style='font-family:sans-serif;'>Edit⇒Find & Replace</span> ï¼å·¥å
·æ æé® <span class="info"><img src='D:/LyX/lyx-unstable/lib/images/dialog-show_findreplace.svgz' alt='image: ' /></span>ï¼ ï¼å¨åºç°ç对è¯æ¡ä¸ç¹å»æé®â<span style='font-family:sans-serif;'>Find Nextâ</span> è¿è¡æç´¢ï¼ç¹å»æé®â <span style='font-family:sans-serif;'>Replaceâæ¿æ¢æå°çåè¯ã</span><div class="foot"><span class="foot_label">2</span><div class="foot_inner"><div class="plain_layout" id='magicparlabel-54'>å®æåå
³éçªå£ï¼å¦æè§å¾æ¹ä¾¿çè¯ä¹å¯ä¸ç´å¼çå®ãLyX ä¸ç大é¨åçªå£é½å¯ä»¥è¿æ ·ã使ç¨æ¶æ³¨æç¦ç¹çåæ¢å³å¯ã</div>
+</div></div> ä½ è¿å¯ä»¥æå®åºå大å°åæå
¨åå¹é
ï¼å½ç¶ä¹å¯ä»¥ååæç´¢ææ¡£ã</dd>
+<dt class="description_label">åç¬¦æ ¼å¼</dt>
+<dd class="description_item"> ç¨ <span style='font-family:sans-serif;'>Edit⇒Text Style</span> 对è¯æ¡ä¸ç toggle buttons ï¼å¯ä»¥<i>强è°</i>ï¼é»è®¤æä½ï¼ãå ç²æ设置为<dfn class='lyxnoun'>æ æ ¼å¼ï¼</dfn>åä½ä¸è¬è¾å°ï¼ç¨äºäººåï¼ã</dd>
+<dt class="description_label">å·¥å
·æ </dt>
+<dd class="description_item"> èåæ¯è¾¹çå·¥å
·æ æä¾äºä¸äºå¸¸ç¨åè½çæé®ï¼ä¾å¦ï¼ç²è´´ãæå°ã</dd>
+</dl>
+<div class="standard" id='magicparlabel-57'>å½ç¶ï¼ç®åè¿æ²¡æè¾å
¥è¶³å¤å¤çå
容以使ææè¿äºåè½å¯ç¨ã</div>
+</section>
+<section>
+<h3 class="subsection" id='magicparlabel-58'><span class="subsection_label">2.1.3</span> æè§å³ææ³ï¼LyX ä¸ç空ç½</h3>
+<div class="standard" id='magicparlabel-59'>对æ°ç¨æ·æ¥è¯´ï¼æé¾ç解çæ¯ LyX å¤ç空ç½çæ¹å¼ãæ²å¤æ¬¡å车åªè½å¾å°ä¸ä¸ªç©ºè¡ï¼æ²å¤æ¬¡ç©ºæ ¼åªè½å¾å°ä¸ä¸ªç©ºæ ¼ãå¨ç©ºç½è¡ä¸ï¼è¿ä¸ä¸ªç©ºæ ¼é½æ æ³å¾å°ãæä¸ Tab é®ä¹ä¸ä¼ç§»å¨ä¸ä¸ª Tab ä½ï¼å®é
ä¸å°±æ²¡æ Tab ä½ï¼å¨é¡µé¢ä¸æ¹ä¹æ²¡ææ å°ºå¯ä¾è®¾ç½® Tab ä½åè¾¹è·ã</div>
+
+<div class="standard" id='magicparlabel-60'>å¾å¤åå¤ç软件建ç«å¨ WYSIWYG ç念ä¹ä¸ï¼ä¹å°±æ¯ï¼çå°çå°±æ¯å¾å°çï¼æè§å³æå¾ï¼ãLyX ä¸åï¼å®å»ºç«å¨ WYSIWYM ï¼ææ³å³æå¾ï¼çç念ä¹ä¸ãä½ æ³ä»ä¹å°±è¾å
¥ä»ä¹ï¼LyX ä¼å¤çæççé®é¢ï¼è¿æ ·ä¿è¯äºè¾åºæ件çç¾è§ãå车å段ï¼ç©ºæ ¼æè¯ï¼æ²¡çç±å¨ä¸è¡ä¸è¾å
¥å¥½å æ¬¡ç©ºæ ¼ãTab æ ¹æ¬å°±æ²¡æè¯æ³æä¹ï¼æ以 LyX ä¸æ¯æå®ãä½¿ç¨ LyXï¼ä½ å°è±è´¹æ´å¤çæ¶é´å»èèææ¡£ç<b>å
容</b>ï¼èä¸æ¯å®ç<b>æ ¼å¼</b>ãæ´å¤å
³äº WYSIWYM ç解éåè§ <em>Introductionã</em></div>
+
+<div class="standard" id='magicparlabel-61'>LyX çç¡®ä¹æä¸å°ç²¾ç»è°æ´ææ¡£æ ¼å¼çæ¹æ³ãæ¯ç« LyX å¯è½ä¸ä¼ 100% 精确çæç
§ä½ æ³çå»æçã<em>User's Guide</em> å
å«äºè°æ´ææ¡£æ ¼å¼ç详ç»æ¹æ³ï¼å
æ¬æ°´å¹³å¡«å
ï¼HFillsï¼ååç´è·ç¦»ï¼å®ä»¬æ¯ç©ºæ ¼ãå车æ´å 强大çµæ´»ï¼ï¼è®¾ç½®åä½å¤§å° ãæ ·å¼çæ¹æ³ï¼è°æ´æ®µè½å¯¹é½æ¹å¼çæ段ãä½ åªéè¦ä¸å¿åä½ çææ¡£ï¼å¨æåç»è°ä¸ä¸ææ¡£æ ¼å¼å°±å¥½äºã使ç¨æ®éçåå¤ç软件ï¼ä½ ä¼å¨åææ¡£çæ´ä¸ªè¿ç¨ä¸é½è¢«æ ¼å¼æçæå°æ°ã<div class="foot"><span class="foot_label">3</span><div class="foot_inner"><div class="plain_layout" id='magicparlabel-65'>è¯æ³¨ï¼è¿ AbiWord è¿æ ·è½»é级çåå¤ç软件é½ææ ·å¼äºï¼å°±ä¸è¦è¯´ MS WordãOOo äºã</div>
+</div></div></div>
+</section>
+</section>
+<section>
+<h2 class="section" id='magicparlabel-66'><span class="section_label">2.2</span> ç¯å¢</h2>
+<div class="standard" id='magicparlabel-67'>ææ¡£çä¸åé¨åæä¸åçä½ç¨ï¼æ们称è¿äºé¨å为âç¯å¢âï¼<em>environments</em>ï¼ãæ é¢åè¯è¯»è
æ°çè¯é¢ï¼åè¯é¢ï¼å°ä¼å¼å§ãæäºææ¡£å«æç¹æ®çç¯å¢ï¼æ¯å¦ï¼æåä¼ææè¦åé¢ç®ï¼ä¹¦ä¿¡å°±æ²¡ææè¦åé¢ç®ï¼ä½å®æå°åã</div>
+
+<div class="standard" id='magicparlabel-68'>ç¯å¢æ¯ LyX æè§å³æå¾å²å¦çéè¦é¨åãä¸ä¸ªç¯å¢éè¦å
·ä½çå®ä¹ï¼åä½å¤§å°ãæ ·å¼ã缩è¿ãè¡é´è·ççãè¿ä¸ªé®é¢é常éè¦ï¼å 为ä¸ä¸ªç»å®ç¯å¢çå
·ä½å®ä¹ä¼éçæ档类åçååèååãæ¯å¦ï¼ææåè¦æ±æ é¢æ¯é»ä½ã18ptãå±
ä¸ï¼èå¦ä¸ä¸ªå¯è½è¦æ±æä½ã15ptã左对é½ï¼ä¸åçè¯è¨ä¹æä¸åç缩è¿æ åï¼åèæç®çæ ¼å¼å°±ååæ´å¤§äºãLyX ä¼æä½ ä»è¿äºæ ¼å¼ä¸é´æ¯æåºæ¥ã</div>
+
+<div class="standard" id='magicparlabel-69'>ä½ å¯ä»¥ä½¿ç¨å·¥å
·æ ä¸çç¯å¢ä¸æèå<img style='width:50%;' src='59dc5fa2c4be2dbbd812749fb08fd5394d0b655a4cf83a012745159aab4ec6af_ToolbarEnvBox_png.png' alt='image: 59dc5fa2c4be2dbbd812749fb08fd5394d0b655a4cf83a012745159aab4ec6af_ToolbarEnvBox_png.png' />æ¥éæ©ç¯å¢ï¼å®ä¹è½åè¯ä½ å½åçç¯å¢æ¯ä»ä¹ï¼å
¶ä¸âStandardâæ¯ææ¬çé»è®¤ç¯å¢ãç°å¨æ们å°å¨ä½ çæ°ææ¡£ä¸æ·»å å 个ç¯å¢ï¼æ¥ççå®ä»¬æ¯æä¹å·¥ä½çå§ã</div>
+<section>
+<h3 class="subsection" id='magicparlabel-70'><span class="subsection_label">2.2.1</span> èï¼<span style='font-family:sans-serif;'>Section</span>ï¼ä¸åèï¼Subsectionï¼</h3>
+<div class="standard" id='magicparlabel-71'>å¨ LyX ææ¡£ç第ä¸è¡è¾å
¥â<span style='font-family:monospace;'>Introduction</span>âï¼å¨ç¯å¢ä¸æèåä¸è®¾ä¸ºâèâï¼<span style='font-family:sans-serif;'>Section</span>ï¼<div class="foot"><span class="foot_label">4</span><div class="foot_inner"><div class="plain_layout" id='magicparlabel-75'>设å®ç¯å¢ä¸éè¦éæ©æ´è¡ï¼æ®µï¼ï¼å
æ åçå
¶ä¸å³å¯ãè¥æ³ä¸æ¬¡æ¹åå¤è¡çç¯å¢ï¼åéè¦éå®ä¹ã</div>
+</div></div>ï¼ ç¡®å®ä½ éæ©äºâèâï¼<span style='font-family:sans-serif;'>Section</span>ï¼èä¸æ¯âè<span style='font-family:sans-serif;'>*</span>âï¼<span style='font-family:sans-serif;'>Section*</span>ï¼ãLyX å°å¨åè¾¹å ä¸â1â并æåä½è°å¤§ãç°å¨æ²å车ï¼ç¯å¢å°ä»âèâï¼<span style='font-family:sans-serif;'>Section</span>ï¼ååâæ åâï¼Standardï¼ãåå¤æ°ç¯å¢ç±»ä¼¼ï¼æ²å车åç¯å¢å°ç»æ¢ãè¾å
¥ææ¬ï¼</div>
+<div class="lyx_code" id='magicparlabel-76'>
+<div class="lyx_code_item">This is an introduction to my first LyX document.</div>
+</div>
+<div class="standard" id='magicparlabel-77'>å次å车ï¼éæ©âèâï¼<span style='font-family:sans-serif;'>Section</span>ï¼ç¯å¢ï¼LyX å°åä¸â2â并çå¾
è¾å
¥ãç°å¨è¾å
¥â<span style='font-family:monospace;'>More Stuff</span>âï¼LyX ä¼æå®è®¾ç½®æèï¼<span style='font-family:sans-serif;'>Section</span>ï¼æ é¢çæ ·å¼ã</div>
+
+<div class="standard" id='magicparlabel-78'>å°å
æ å®ä½å°è 1 ï¼Section 1ï¼æ«å°¾ï¼æ²å车ï¼å次设置为âèâï¼<span style='font-family:sans-serif;'>Section</span>ï¼ï¼LyX ä¼åä¸â2â并çå¾
è¾å
¥ãè¾å
¥â<span style='font-family:monospace;'>About This Document</span>âãåæçè 2 ï¼Section 2ï¼ï¼âMore Stuffâï¼ç°å¨å·²ç»è¢«æ¹æäºè 3 ï¼Section 3ï¼ãä½ åªéè¦ç¡®å®åªäºæåæ¯èï¼<span style='font-family:sans-serif;'>Section</span>ï¼æ é¢ï¼LyX ä¼å¤çç¼å·åæçæ ¼å¼çï¼è¿å°±æ¯æè§å³ææ³ï¼WYSIWYMï¼çé£æ ¼ã</div>
+
+<div class="standard" id='magicparlabel-79'>æ²å车ï¼åå°âæ åâï¼Standardï¼ç¯å¢ï¼è¾å
¥ä¸è¾¹ 5 è¡æåï¼</div>
+<div class="lyx_code" id='magicparlabel-80'>
+<div class="lyx_code_item">Sections and subsections are described below.</div>
+<div class="lyx_code_item">Section Description</div>
+<div class="lyx_code_item">Sections are bigger than subsections.</div>
+<div class="lyx_code_item">Subsection description</div>
+<div class="lyx_code_item">Subsections are smaller than sections.</div>
+</div>
+<div class="standard" id='magicparlabel-85'>ç¹å»ç¬¬äºè¡ï¼å¨ç¯å¢ä¸æèåä¸è®¾ä¸ºâåèâï¼Subsectionï¼ãLyX å°ä¼å¨åè¾¹å ä¸â2.1âï¼å¹¶æåä½è°æ´çæ¯æ£æ大ï¼æ¯èï¼Sectionï¼æ é¢å°ãæ¥çæ第 4 è¡ä¹è®¾ç½®æ为âåèâï¼Subsectionï¼ï¼LyX å°å¨å®åè¾¹å ä¸â2.2âãå¦æå¨è 2 ï¼Section 2ï¼åè¾¹å ä¸äºå«çèï¼è 2 å°ä¼èªå¨å为è 3ï¼Section 3ï¼ï¼åè¾¹çåèä¹ä¼è·çåæâ3.1âåâ3.2âã</div>
+
+<div class="standard" id='magicparlabel-86'>ææ¡£çå±çº§ç»æè¿æ次åè ( Subsubsection )ã段 ( Paragraph ) åå段 ( Subparagraph )ï¼è¿äºå°±ç±è¯»è
èªè¡æç©å§ã段åå段çæ é¢é»è®¤æ¯ä¸ç¼å·çï¼èä¸å段è¿æ缩è¿ï¼åé
<em>User's Guide</em> å¾å°æ´å¤è§£é以åå¦ä½æ¹åå®ä»¬ãç« ï¼Chapterï¼æ¯ææ¡£å±çº§ç»æä¸æé«çä¸çº§ï¼åªè½å¨æäºç¹å®ç LyX æ档类åä¸æè½ä½¿ç¨å®ï¼è§ <a href="#sec____">sec:æ档类</a>ï¼ã</div>
+
+<div class="standard" id='magicparlabel-87'>ä½ å¯è½è¿å¸æä¸äºèååèæ¯ä¸ç¼å·çï¼LyX æä¸é¨çç¯å¢å®ç°è¿ä¸ªåè½ãå½æèçæ é¢ç¯å¢æ¹ä¸ºâè*”ï¼Section*ï¼åï¼LyX è¿å°å¯¹å®ä½¿ç¨ç¸åçåä½ï¼åªæ¯ä¸å对å®è¿è¡ç¼å·ãç¸åºçä¹æ带âæâçåèå次åèç¯å¢ãè¯çæä¸äºèæåèçæ é¢ç¯å¢æ¹ä¸ºå¸¦æçï¼åæ¶ççå
¶å®çç¼å·æä¹éä¹æ¹åã</div>
+
+<div class="standard" id='magicparlabel-88'>ç»ä¹ ï¼ä¿®æ¹ example_raw.lyx ä¸çèååèæ é¢ã</div>
+</section>
+<section>
+<h3 class="subsection" id='magicparlabel-89'><span class="subsection_label">2.2.2</span> å表ï¼Listsï¼ååå表ï¼sublistsï¼</h3>
+<div class="standard" id='magicparlabel-90'>LyX æ好å ç§å表ç¯å¢ï¼å¨åæ纲æè
éæ°æåºä¸ä¸ªå·²æçå表æ¶ï¼è¿äºå表ç¯å¢ä¼å¸®ä¸å¤§å¿ãä¸åçæ档类åéè¦ä¸åçå表ç¯å¢ï¼</div>
+<ul class="itemize" id='magicparlabel-91'>
+<li class="itemize_item">å¹»ç¯ç使ç¨å¸¦åç¹çæ¡ç®ç¯å¢ï¼<span style='font-family:sans-serif;'>Itemize</span>ï¼ã</li>
+<li class="itemize_item">大纲使ç¨å¸¦ç¼å·çæ举ç¯å¢ï¼<span style='font-family:sans-serif;'>Enumerate</span>ï¼ã</li>
+<li class="itemize_item">åè¯è§£é常ç¨æè¿°ç¯å¢ï¼<span style='font-family:sans-serif;'>Description</span>ï¼ã</li>
+<li class="itemize_item">å表ç¯å¢ï¼<span style='font-family:sans-serif;'>List</span>ï¼åæè¿°ç¯å¢ï¼<span style='font-family:sans-serif;'>Description</span>ï¼å·®ä¸å¤ï¼åªæ¯å¯¹é½æ¹å¼ç¨æä¸åã</li>
+</ul>
+<div class="standard" id='magicparlabel-95'>ç°å¨æ们åä¸ä¸ª LyX æå
³ä¼ç¹çå表ãå¨ææ¡£ä¸è¾å
¥ï¼</div>
+
+<div class="standard" id='magicparlabel-96'><span style='font-family:monospace;'>LyX is better than other word processors because: </span></div>
+
+<div class="standard" id='magicparlabel-97'>ç¶åæ²å车ï¼å¹¶å¨ç¯å¢ä¸æå表ä¸éæ©æ¡ç®ç¯å¢ï¼<span style='font-family:sans-serif;'>Itemize</span>ï¼ãLyX ä¼å¨è¡é¦å ä¸åç¹ã继ç»è¾å
¥ï¼</div>
+<div class="lyx_code" id='magicparlabel-98'>
+<div class="lyx_code_item">Typesetting is done for you.</div>
+<div class="lyx_code_item">Math is WYSIWYG</div>
+<div class="lyx_code_item">Lists are very easy to create!</div>
+</div>
+<div class="standard" id='magicparlabel-101'>åæ é¢ä¸åï¼å表ç¯å¢å¨æ²å车æ¶ä¸ä¼ç»æ¢ï¼LyX ä¼è®¤ä¸ºä½ å°ç»§ç»åä¸ä¸ä¸ªæ¡ç®ãæ以ä¸è¾¹çè¾å
¥å°ä¼äº§çä¸ä¸ªå表项ãéæ°éæ©æ åç¯å¢ï¼<span style='font-family:sans-serif;'>Standard</span>ï¼æ使ç¨å¿«æ·é® <span style='font-family:sans-serif;'>Alt+P S</span> æè½éåºå表ç¯å¢ãè¦å¨ä¸ä¸ªå表项ä¸ä½¿ç¨å¤ä¸ªæ®µè½ï¼å¯ä½¿ç¨ä¿æ¤æ§ä¸æï¼<span style='font-family:sans-serif;'>Protected Break</span>ï¼ï¼æä¸ Ctrl + å车å³å¯ã</div>
+
+<div class="standard" id='magicparlabel-102'>ä½ å·²ç»å¾å°äºä¸ä¸ªæ¼äº®çæ¡ç®å表ï¼ä½ æ¯ä¸æ¯å·²ç»è¿«ä¸åå¾
çæ³è¿è¡ LaTeX ççå®ä»¬æå°åºæ¥çæ ·åäºï¼å¯å¦ææ¨æ³ç»å®ä»¬å ä¸ç¼å·å¢ï¼ä½ åªéè¦éå®æ´ä¸ªå表<div class="foot"><span class="foot_label">5</span><div class="foot_inner"><div class="plain_layout" id='magicparlabel-106'>å¦æä¸è¿åè¾¹ä¸æ®µä¹ä¸èµ·éä¸çè¯ï¼ä½ æ¯æ æ³éä¸ç¬¬ä¸ä¸ªæ¡ç®åè¾¹çåç¹çï¼ç±»ä¼¼çï¼ä½ ä¹æ æ³éå®ç« èç¼å·ãè¿æ¯ææå¦æ¤çï¼å 为éçæ档类ååæåä½ç½®çä¸åï¼è¿äºåç¹åç¼å·ä¹ä¼åçååã</div>
+</div></div>ï¼ç¶åéæ©æ举ç¯å¢ï¼<span style='font-family:sans-serif;'>Enumerate</span>ï¼å³å¯ãå¦æä½ å¢å æ¡ç®çè¯ï¼LyX ä¼èªå¨ä¿®æ¹æ举ç¼å·çã</div>
+
+<div class="standard" id='magicparlabel-107'>ç°å¨å表项è¿æ¯å¤äºè¢«éå®ç¶æçï¼ä½ å¯ä»¥åè¯è¯æè¿°ï¼<span style='font-family:sans-serif;'>Description</span>ï¼åå表ï¼<span style='font-family:sans-serif;'>List</span>ï¼ä¸¤ç§ç¯å¢ãè¿ä¸¤ç§ç¯å¢é½æ¯åè¯å å®ä¹çå½¢å¼ï¼æè¿°ç¯å¢åè¾¹çåè¯ç¨é»ä½ï¼å表ç¯å¢çåè¯ååè¾¹çå®ä¹ç±âTabâ<div class="foot"><span class="foot_label">6</span><div class="foot_inner"><div class="plain_layout" id='magicparlabel-111'>è¿éçTabæ¯æçTabï¼å®ä¼èªéåºå°æé¿çåè¯é¿åº¦ï¼ï¼èä¸æ¯å®é¿çæåæºTabã</div>
+</div></div>åéãåè¾¹çåè¯å¦æå¤äºä¸ä¸ªè¯çè¯ï¼éè¦ä½¿ç¨ä¿æ¤æ§ç©ºæ ¼ï¼<span style='font-family:sans-serif;'>Protected Blank</span>sï¼å°å®ä»¬åå¼ã</div>
+
+<div class="standard" id='magicparlabel-112'>ç»ä¹ ï¼æç <span style='font-family:monospace;'>example_raw.lyx</span> ä¸çå表ã</div>
+
+<div class="standard" id='magicparlabel-113'>è¿äºå表ç¯å¢è¿å¯ä»¥åµå¥ä½¿ç¨ï¼æ纲就æ¯æ常è§çä¾åã带ç¼å·æåç¹çå表å¨åå表ä¸ä¼æä¸åç表ç°å½¢å¼ãæ´å¤è¯¦æ
åè§ <em>User's Guide</em> ã</div>
+</section>
+<section>
+<h3 class="subsection" id='magicparlabel-114'><span class="subsection_label">2.2.3</span> å
¶å®ç¯å¢ï¼è¯ãå¼ç¨åæ´å¤</h3>
+<div class="standard" id='magicparlabel-115'>æ两ç§å¼ç¨ç¯å¢ï¼çä¸ç¹çå¼ç¨ä½¿ç¨å¼ç¨ç¯å¢ï¼<span style='font-family:sans-serif;'>Quote</span>ï¼ï¼é¿ä¸ç¹çå¼ç¨ä½¿ç¨å¼æç¯å¢ï¼<span style='font-family:sans-serif;'>Quotation</span>ï¼ã计ç®æºä»£ç 使ç¨ä»£ç ç¯å¢ï¼<span style='font-family:sans-serif;'>LyX-Code</span>ï¼ï¼è¯¥ç¯å¢ä½¿ç¨<span style='font-family:monospace;'>typewriter</span> åä½ï¼èä¸è¿éæ¯ LyX ä¸å¯ä¸å
许使ç¨å¤ä¸ªç©ºæ ¼çå°æ¹ãä½ è¿å¯ä»¥ä½¿ç¨è¯ç¯å¢ï¼<span style='font-family:sans-serif;'>Verse</span>ï¼æ¥åè¯ï¼å车åèï¼Ctrl + å车æè¡ã对ææç¯å¢çå®æ´æè¿°åè§<em> User's Guide</em>ã</div>
+
+<div class="standard" id='magicparlabel-116'>ç»ä¹ ï¼ä¿®æ¹ <span style='font-family:monospace;'>example_raw.lyx</span> ä¸çå¼ç¨ã代ç ãè¯ç¯å¢ã</div>
+</section>
+</section>
+</section>
+</body>
+</html>
diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp
index fe396f8..0174339 100644
--- a/src/output_xhtml.cpp
+++ b/src/output_xhtml.cpp
@@ -35,6 +35,7 @@
#include "support/textutils.h"
#include <stack>
+#include <iostream>
// Uncomment to activate debugging code.
// #define XHTML_DEBUG
@@ -610,6 +611,8 @@ void xhtmlParagraphs(Text const & text,
ParagraphList::const_iterator send;
// Think about adding <section> and/or </section>s.
+ // Document title is not in Sectioning, but rather in FrontMatter, so that it does not need to be taken
+ // into account.
if (style.category() == from_utf8("Sectioning")) {
int level = style.toclevel;
@@ -620,7 +623,7 @@ void xhtmlParagraphs(Text const & text,
while (!headerLevels.empty() && level <= headerLevels.top()) {
// Output the tag only if it corresponds to a legit section.
int stackLevel = headerLevels.top();
- if (stackLevel != Layout::NOT_IN_TOC && level > 1) { // <h1> is the document title.
+ if (stackLevel != Layout::NOT_IN_TOC) {
xs << xml::EndTag("section");
xs << xml::CR();
}
@@ -630,7 +633,7 @@ void xhtmlParagraphs(Text const & text,
// Open the new section: first push it onto the stack, then output it in XHTML.
headerLevels.push(level);
// Some sectioning-like elements should not be output (such as FrontMatter).
- if (level != Layout::NOT_IN_TOC && level > 1) { // <h1> is the document title.
+ if (level != Layout::NOT_IN_TOC ) {
xs << xml::StartTag("section");
xs << xml::CR();
}
@@ -675,7 +678,7 @@ void xhtmlParagraphs(Text const & text,
// If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning
// of the loop).
- while (!headerLevels.empty() && headerLevels.top() != Layout::NOT_IN_TOC && headerLevels.top() > 1) {
+ while (!headerLevels.empty() && headerLevels.top() != Layout::NOT_IN_TOC) {
docstring tag = from_utf8("</section>");
headerLevels.pop();
xs << XMLStream::ESCAPE_NONE << tag;
commit 0dfa24020919a436a5ee8937bb0bbc7c0863406d
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Wed Sep 16 04:13:42 2020 +0200
XHTML: restore sections.
diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp
index f8cd53e..fe396f8 100644
--- a/src/output_xhtml.cpp
+++ b/src/output_xhtml.cpp
@@ -675,7 +675,7 @@ void xhtmlParagraphs(Text const & text,
// If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning
// of the loop).
- while (!headerLevels.empty() && headerLevels.top() > Layout::NOT_IN_TOC) {
+ while (!headerLevels.empty() && headerLevels.top() != Layout::NOT_IN_TOC && headerLevels.top() > 1) {
docstring tag = from_utf8("</section>");
headerLevels.pop();
xs << XMLStream::ESCAPE_NONE << tag;
commit 1991d0ed24780cbb0064b7be7a733bc1ee9e241e
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Wed Sep 16 04:12:26 2020 +0200
Converters: always set version to something.
Otherwise, it's common to compare "None >= (6,2,6)", which makes no sense. Set it to (0,0,0) so that any comparison fails (without an error message).
diff --git a/lib/scripts/convertDefault.py b/lib/scripts/convertDefault.py
index 5287e96..d04fa78 100644
--- a/lib/scripts/convertDefault.py
+++ b/lib/scripts/convertDefault.py
@@ -53,6 +53,8 @@ else:
gm = True
# we need version to be a valid integer 3-tuple
version = (1,0,0)
+ else:
+ version = (0,0,0)
# IM >= 5.5.8 separates options for source and target files
# See http://www.imagemagick.org/Usage/basics/#why
commit e4065cc1b1394c61108735611e0ebf02b12e6bbe
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Wed Sep 16 04:02:51 2020 +0200
Converters: slightly more pythonic code.
diff --git a/lib/scripts/convertDefault.py b/lib/scripts/convertDefault.py
index c927713..5287e96 100644
--- a/lib/scripts/convertDefault.py
+++ b/lib/scripts/convertDefault.py
@@ -25,7 +25,7 @@ re_version = re.compile(r'^Version:.*ImageMagick\s*(\d*)\.(\d*)\.(\d*).*$')
command = 'magick'
fout = os.popen('magick -version 2>&1')
output = fout.readline()
-if fout.close() != None:
+if fout.close() is not None:
# older versions
# caution: windows has a convert.exe for converting file systems
command = 'convert'
@@ -39,7 +39,7 @@ version = re_version.match(output)
im = False
gm = False
-if version != None:
+if version is not None:
major = int(version.group(1))
minor = int(version.group(2))
patch = int(version.group(3))
@@ -49,7 +49,7 @@ else:
# Try GraphicsMagick
re_version = re.compile(r'^GraphicsMagick.*http:..www.GraphicsMagick.org.*$')
version = re_version.match(output)
- if version != None:
+ if version is not None:
gm = True
# we need version to be a valid integer 3-tuple
version = (1,0,0)
@@ -72,10 +72,10 @@ if sys.argv[3] == 'ppm' and (im and version >= (6,3,5) or gm):
# print (command, sys.argv[2], sys.argv[4], file= sys.stdout)
if (im or gm) and os.system(r'%s %s "%s" %s "%s"' % (command, sopts, sys.argv[2], topts, sys.argv[3] + ':' + sys.argv[4])) != 0:
- print (sys.argv[0], 'ERROR', file= sys.stderr)
- print ('Execution of "%s" failed.' % command, file= sys.stderr)
+ print(sys.argv[0], 'ERROR', file= sys.stderr)
+ print('Execution of "%s" failed.' % command, file= sys.stderr)
sys.exit(1)
elif not im and not gm and sys.platform == 'darwin' and os.system(r'%s "%s" "%s"' % (command, sys.argv[2], sys.argv[4])) != 0:
- print (sys.argv[0], 'ERROR', file= sys.stderr)
- print ('Execution of "%s" failed.' % command, file= sys.stderr)
+ print(sys.argv[0], 'ERROR', file= sys.stderr)
+ print('Execution of "%s" failed.' % command, file=sys.stderr)
sys.exit(1)
commit 15dbc2b9ab0765b950ebe57300178fa4ec59f3cd
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Wed Sep 16 03:37:46 2020 +0200
Revert "XHTML: remove <section> support."
This reverts commit 52216b73
diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp
index 99d425e..f8cd53e 100644
--- a/src/output_xhtml.cpp
+++ b/src/output_xhtml.cpp
@@ -590,6 +590,7 @@ void xhtmlParagraphs(Text const & text,
ParagraphList::const_iterator const pend =
(epit == (int) paragraphs.size()) ?
paragraphs.end() : paragraphs.iterator_at(epit);
+ std::stack<int> headerLevels;
while (bpit < epit) {
ParagraphList::const_iterator par = paragraphs.iterator_at(bpit);
@@ -608,6 +609,33 @@ void xhtmlParagraphs(Text const & text,
ParagraphList::const_iterator const lastpar = par;
ParagraphList::const_iterator send;
+ // Think about adding <section> and/or </section>s.
+ if (style.category() == from_utf8("Sectioning")) {
+ int level = style.toclevel;
+
+ // Need to close a previous section if it has the same level or a higher one (close <section> if opening a
+ // <h2> after a <h2>, <h3>, <h4>, <h5> or <h6>). More examples:
+ // - current: h2; back: h1; do not close any <section>
+ // - current: h1; back: h2; close two <section> (first the <h2>, then the <h1>, so a new <h1> can come)
+ while (!headerLevels.empty() && level <= headerLevels.top()) {
+ // Output the tag only if it corresponds to a legit section.
+ int stackLevel = headerLevels.top();
+ if (stackLevel != Layout::NOT_IN_TOC && level > 1) { // <h1> is the document title.
+ xs << xml::EndTag("section");
+ xs << xml::CR();
+ }
+ headerLevels.pop();
+ }
+
+ // Open the new section: first push it onto the stack, then output it in XHTML.
+ headerLevels.push(level);
+ // Some sectioning-like elements should not be output (such as FrontMatter).
+ if (level != Layout::NOT_IN_TOC && level > 1) { // <h1> is the document title.
+ xs << xml::StartTag("section");
+ xs << xml::CR();
+ }
+ }
+
switch (style.latextype) {
case LATEX_COMMAND: {
// The files with which we are working never have more than
@@ -644,6 +672,15 @@ void xhtmlParagraphs(Text const & text,
}
bpit += distance(lastpar, par);
}
+
+ // If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning
+ // of the loop).
+ while (!headerLevels.empty() && headerLevels.top() > Layout::NOT_IN_TOC) {
+ docstring tag = from_utf8("</section>");
+ headerLevels.pop();
+ xs << XMLStream::ESCAPE_NONE << tag;
+ xs << xml::CR();
+ }
}
commit c8e2c17a5835f5c656fd6c26a84d793058dc4440
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Wed Sep 16 03:22:38 2020 +0200
XHTML: remove DOCTYPE, as the document is then understood as HTML4/XHTML1, and not XHTML5.
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 2ef5768..0cf87de 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -2217,7 +2217,7 @@ Buffer::ExportStatus Buffer::writeLyXHTMLSource(odocstream & os,
if (output_preamble) {
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN\" \"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd\">\n"
+ << "<!DOCTYPE html>\n"
// FIXME Language should be set properly.
<< "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
<< "<head>\n"
commit 92ad86daccfcdf9ae2ebfa084c38b2712d0cc8c3
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Wed Sep 16 03:18:32 2020 +0200
XHTML: remove <section> support.
diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp
index f8cd53e..99d425e 100644
--- a/src/output_xhtml.cpp
+++ b/src/output_xhtml.cpp
@@ -590,7 +590,6 @@ void xhtmlParagraphs(Text const & text,
ParagraphList::const_iterator const pend =
(epit == (int) paragraphs.size()) ?
paragraphs.end() : paragraphs.iterator_at(epit);
- std::stack<int> headerLevels;
while (bpit < epit) {
ParagraphList::const_iterator par = paragraphs.iterator_at(bpit);
@@ -609,33 +608,6 @@ void xhtmlParagraphs(Text const & text,
ParagraphList::const_iterator const lastpar = par;
ParagraphList::const_iterator send;
- // Think about adding <section> and/or </section>s.
- if (style.category() == from_utf8("Sectioning")) {
- int level = style.toclevel;
-
- // Need to close a previous section if it has the same level or a higher one (close <section> if opening a
- // <h2> after a <h2>, <h3>, <h4>, <h5> or <h6>). More examples:
- // - current: h2; back: h1; do not close any <section>
- // - current: h1; back: h2; close two <section> (first the <h2>, then the <h1>, so a new <h1> can come)
- while (!headerLevels.empty() && level <= headerLevels.top()) {
- // Output the tag only if it corresponds to a legit section.
- int stackLevel = headerLevels.top();
- if (stackLevel != Layout::NOT_IN_TOC && level > 1) { // <h1> is the document title.
- xs << xml::EndTag("section");
- xs << xml::CR();
- }
- headerLevels.pop();
- }
-
- // Open the new section: first push it onto the stack, then output it in XHTML.
- headerLevels.push(level);
- // Some sectioning-like elements should not be output (such as FrontMatter).
- if (level != Layout::NOT_IN_TOC && level > 1) { // <h1> is the document title.
- xs << xml::StartTag("section");
- xs << xml::CR();
- }
- }
-
switch (style.latextype) {
case LATEX_COMMAND: {
// The files with which we are working never have more than
@@ -672,15 +644,6 @@ void xhtmlParagraphs(Text const & text,
}
bpit += distance(lastpar, par);
}
-
- // If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning
- // of the loop).
- while (!headerLevels.empty() && headerLevels.top() > Layout::NOT_IN_TOC) {
- docstring tag = from_utf8("</section>");
- headerLevels.pop();
- xs << XMLStream::ESCAPE_NONE << tag;
- xs << xml::CR();
- }
}
commit bfeb3b66b104f6262de8169e32c49413bfe1a79d
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Sep 13 01:50:11 2020 +0200
DocBook: slight code simplification.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index c8ddc1a..0d0aa10 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -1087,8 +1087,7 @@ void docbookParagraphs(Text const &text,
// Close all sections before the bibliography.
// TODO: Only close all when the bibliography is at the end of the document? Or force to output the bibliography at the end of the document? Or don't care (as allowed by DocBook)?
- auto insetsLength = distance(par->insetList().begin(), par->insetList().end());
- if (insetsLength > 0) {
+ if (!par->insetList().empty()) {
Inset const *firstInset = par->getInset(0);
if (firstInset && (firstInset->lyxCode() == BIBITEM_CODE || firstInset->lyxCode() == BIBTEX_CODE)) {
while (!headerLevels.empty()) {
commit 6c51cabd35b48eb2245330cda49b2be5c9a2c223
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Sep 12 03:21:08 2020 +0200
DocBook: fix output in Layout::write.
diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout
index 78089a4..37dbd07 100644
--- a/lib/layouts/aastex.layout
+++ b/lib/layouts/aastex.layout
@@ -204,7 +204,7 @@ Style Altaffilation
Color green
EndFont
DocBookTag affiliation
- DocBookAttr role="alternate"
+ DocBookAttr role='alternate'
DocBookWrapperTag author
DocBookWrapperMergeWithPrevious true
DocBookItemTag orgname
diff --git a/lib/layouts/shapepar.module b/lib/layouts/shapepar.module
index 6b38cdf..2b2fbfe 100644
--- a/lib/layouts/shapepar.module
+++ b/lib/layouts/shapepar.module
@@ -36,50 +36,50 @@ Style "CD label"
Align Block
LabelType No_Label
DocBookWrapperTag sidebar
- DocBookWrapperAttr role="cd-label"
+ DocBookWrapperAttr role='cd-label'
DocBookTag para
End
Style "Circle"
CopyStyle "CD label"
LatexName circlepar
- DocBookWrapperAttr role="circle"
+ DocBookWrapperAttr role='circle'
End
Style "Diamond"
CopyStyle "CD label"
LatexName diamondpar
- DocBookWrapperAttr role="diamond"
+ DocBookWrapperAttr role='diamond'
End
Style "Heart"
CopyStyle "CD label"
LatexName heartpar
- DocBookWrapperAttr role="heart"
+ DocBookWrapperAttr role='heart'
End
Style "Hexagon"
CopyStyle "CD label"
LatexName hexagonpar
- DocBookWrapperAttr role="hexagon"
+ DocBookWrapperAttr role='hexagon'
End
Style "Nut"
CopyStyle "CD label"
LatexName nutpar
- DocBookWrapperAttr role="nut"
+ DocBookWrapperAttr role='nut'
End
Style "Square"
CopyStyle "CD label"
LatexName squarepar
- DocBookWrapperAttr role="square"
+ DocBookWrapperAttr role='square'
End
Style "Star"
CopyStyle "CD label"
LatexName starpar
- DocBookWrapperAttr role="star"
+ DocBookWrapperAttr role='star'
End
# now the shapes defined in the .def files
@@ -87,49 +87,49 @@ End
Style "Candle"
CopyStyle "CD label"
LatexName shapepar{\candle}
- DocBookWrapperAttr role="candle"
+ DocBookWrapperAttr role='candle'
End
Style "Drop down"
CopyStyle "CD label"
LatexName droppar
- DocBookWrapperAttr role="drop-down"
+ DocBookWrapperAttr role='drop-down'
End
Style "Drop up"
CopyStyle "CD label"
LatexName dropuppar
- DocBookWrapperAttr role="drop-up"
+ DocBookWrapperAttr role='drop-up'
End
Style "TeX"
CopyStyle "CD label"
LatexName shapepar{\TeXshape}
- DocBookWrapperAttr role="tex"
+ DocBookWrapperAttr role='tex'
End
Style "Triangle up"
CopyStyle "CD label"
LatexName triangleuppar
- DocBookWrapperAttr role="triangle-up"
+ DocBookWrapperAttr role='triangle-up'
End
Style "Triangle down"
CopyStyle "CD label"
LatexName triangledownpar
- DocBookWrapperAttr role="triangle-down"
+ DocBookWrapperAttr role='triangle-down'
End
Style "Triangle left"
CopyStyle "CD label"
LatexName triangleleftpar
- DocBookWrapperAttr role="triangle-left"
+ DocBookWrapperAttr role='triangle-left'
End
Style "Triangle right"
CopyStyle "CD label"
LatexName trianglerightpar
- DocBookWrapperAttr role="triangle-right"
+ DocBookWrapperAttr role='triangle-right'
End
# finally the low-level commands
diff --git a/lib/layouts/stdstarsections.inc b/lib/layouts/stdstarsections.inc
index 60354b1..0159b07 100644
--- a/lib/layouts/stdstarsections.inc
+++ b/lib/layouts/stdstarsections.inc
@@ -49,7 +49,7 @@ Style Section*
LabelCounter ""
ResetArgs 1
DocBookTag bridgehead
- DocBookAttr renderas="sect1"
+ DocBookAttr renderas='sect1'
DocBookSectionTag NONE
DocBookForceAbstractTag NONE
End
@@ -64,7 +64,7 @@ Style Subsection*
LabelCounter ""
ResetArgs 1
DocBookTag bridgehead
- DocBookAttr renderas="sect2"
+ DocBookAttr renderas='sect2'
DocBookSectionTag NONE
DocBookForceAbstractTag NONE
End
@@ -79,7 +79,7 @@ Style Subsubsection*
LabelCounter ""
ResetArgs 1
DocBookTag bridgehead
- DocBookAttr renderas="sect3"
+ DocBookAttr renderas='sect3'
DocBookSectionTag NONE
DocBookForceAbstractTag NONE
End
@@ -94,7 +94,7 @@ Style Paragraph*
LabelCounter ""
ResetArgs 1
DocBookTag bridgehead
- DocBookAttr renderas="sect4"
+ DocBookAttr renderas='sect4'
DocBookSectionTag NONE
DocBookForceAbstractTag NONE
End
@@ -109,7 +109,7 @@ Style Subparagraph*
LabelCounter ""
ResetArgs 1
DocBookTag bridgehead
- DocBookAttr renderas="sect5"
+ DocBookAttr renderas='sect5'
DocBookSectionTag NONE
DocBookForceAbstractTag NONE
End
diff --git a/src/Layout.cpp b/src/Layout.cpp
index 102410d..f5e6f77 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -1643,7 +1643,7 @@ void Layout::write(ostream & os) const
if(!docbooktag_.empty())
os << "\tDocBookTag " << docbooktag_ << '\n';
if(!docbookattr_.empty())
- os << "\tDocBookAttr " << docbookattr_ << '\n';
+ os << "\tDocBookAttr \"" << docbookattr_ << "\"\n";
if(!docbooktagtype_.empty())
os << "\tDocBookTagType " << docbooktagtype_ << '\n';
if(!docbookininfo_.empty())
@@ -1669,7 +1669,7 @@ void Layout::write(ostream & os) const
os << "\tDocBookItemWrapperAttr " << docbookitemwrapperattr_ << '\n';
if(!docbookitemwrappertagtype_.empty())
os << "\tDocBookItemWrapperTagType " << docbookitemwrappertagtype_ << '\n';
- os << "\tDocBookItemWrapperMergeWithPrevious " << docbookwrappermergewithprevious_ << '\n';
+ os << "\tDocBookWrapperMergeWithPrevious " << docbookwrappermergewithprevious_ << '\n';
if(!docbookitemlabeltag_.empty())
os << "\tDocBookItemLabelTag " << docbookitemlabeltag_ << '\n';
if(!docbookitemlabelattr_.empty())
commit 50f011e062646fbc7354ee4be938dd376769900d
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Sep 12 01:52:58 2020 +0200
DocBook: implement InsetBox titles.
diff --git a/autotests/export/docbook/A0_Poster_Simple.lyx b/autotests/export/docbook/A0_Poster_Simple.lyx
new file mode 100644
index 0000000..998f210
--- /dev/null
+++ b/autotests/export/docbook/A0_Poster_Simple.lyx
@@ -0,0 +1,192 @@
+#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 a0poster
+\begin_preamble
+% Adjust padding in boxes
+\setlength\fboxsep{12pt}
+% Added by lyx2lyx
+\setlength{\parskip}{\bigskipamount}
+\setlength{\parindent}{0pt}
+\end_preamble
+\options a0,portrait
+\use_default_options false
+\maintain_unincluded_children no
+\language english
+\language_package default
+\inputencoding utf8
+\fontencoding auto
+\font_roman "palatino" "default"
+\font_sans "default" "default"
+\font_typewriter "courier" "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 false
+\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 true
+\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
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\leftmargin 1cm
+\topmargin 1cm
+\rightmargin 1cm
+\bottommargin 1cm
+\secnumdepth 0
+\tocdepth 0
+\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 empty
+\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 Standard
+\align center
+\begin_inset Box Shadowbox
+position "c"
+hor_pos "c"
+has_inner_box 1
+inner_pos "c"
+use_parbox 1
+use_makebox 0
+width "98col%"
+special "none"
+height "5cm"
+height_special "none"
+thickness "0.4pt"
+separation "3pt"
+shadowsize "4pt"
+framecolor "black"
+backgroundcolor "none"
+status open
+
+\begin_layout Plain Layout
+\noindent
+\align center
+
+\series bold
+\noun on
+\begin_inset Flex Most Giant Snippet
+status open
+
+\begin_layout Plain Layout
+\noindent
+
+\series bold
+\noun on
+Poster Heading
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Box Boxed
+position "t"
+hor_pos "c"
+has_inner_box 1
+inner_pos "t"
+use_parbox 0
+use_makebox 0
+width "98col%"
+special "none"
+height "1in"
+height_special "totalheight"
+thickness "0.4pt"
+separation "3pt"
+shadowsize "4pt"
+framecolor "black"
+backgroundcolor "none"
+status open
+
+\begin_layout Section
+Summary
+\end_layout
+
+\begin_layout Itemize
+For multiple columns, use the
+\begin_inset Quotes eld
+\end_inset
+
+Multiple Columns
+\begin_inset Quotes erd
+\end_inset
+
+ module as documented in
+\family sans
+Help\SpecialChar menuseparator
+Additional Features
+\family default
+.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/A0_Poster_Simple.xml b/autotests/export/docbook/A0_Poster_Simple.xml
new file mode 100644
index 0000000..3594ffd
--- /dev/null
+++ b/autotests/export/docbook/A0_Poster_Simple.xml
@@ -0,0 +1,16 @@
+<?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">
+<sidebar role='shadowbox'>
+Poster Heading
+</sidebar>
+<sidebar role='boxed'>
+<title>Summary</title>
+<itemizedlist>
+<listitem>
+<para>For multiple columns, use the “Multiple Columns” module as documented in <emphasis role='sans'>Help⇒Additional Features</emphasis>.</para>
+</listitem>
+</itemizedlist>
+</sidebar>
+</article>
\ No newline at end of file
diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp
index db76f53..d714cf7 100644
--- a/src/insets/InsetBox.cpp
+++ b/src/insets/InsetBox.cpp
@@ -26,6 +26,7 @@
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "MetricsInfo.h"
+#include "output_docbook.h"
#include "output_xhtml.h"
#include "TexRow.h"
#include "texstream.h"
@@ -727,7 +728,21 @@ void InsetBox::docbook(XMLStream & xs, OutputParams const & runparams) const
LYXERR0("Assertion failed: box layout " + getLayout().name() + " missing DocBookWrapperTag.");
}
- InsetText::docbook(xs, runparams);
+ // If the box starts with a sectioning item, use as box title.
+ auto current_par = paragraphs().begin();
+ if (current_par->layout().category() == from_utf8("Sectioning")) {
+ // Only generate the first paragraph.
+ current_par = makeAny(text(), buffer(), xs, runparams, paragraphs().begin());
+ }
+
+ xs.startDivision(false);
+ // Don't call InsetText::docbook, as this would generate all paragraphs in the inset, not the ones we are
+ // interested in. The best solution would be to call docbookParagraphs with an updated OutputParams object to only
+ // generate paragraphs after the title, but it leads to strange crashes, as if text().paragraphs() then returns
+ // a smaller set of paragrphs.
+ while (current_par != paragraphs().end())
+ current_par = makeAny(text(), buffer(), xs, runparams, current_par);
+ xs.endDivision();
if (!getLayout().docbookwrappertag().empty()) {
if (!xs.isLastTagCR())
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index ee829e5..c8ddc1a 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -16,6 +16,7 @@
#include "BufferParams.h"
#include "Font.h"
#include "InsetList.h"
+#include "output_docbook.h"
#include "Paragraph.h"
#include "ParagraphList.h"
#include "ParagraphParameters.h"
@@ -347,13 +348,6 @@ void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpa
}
-ParagraphList::const_iterator makeAny(Text const &,
- Buffer const &,
- XMLStream &,
- OutputParams const &,
- ParagraphList::const_iterator);
-
-
void makeBibliography(
Text const & text,
Buffer const & buf,
@@ -714,35 +708,6 @@ void makeCommand(
}
-ParagraphList::const_iterator makeAny(Text const &text,
- Buffer const &buf,
- XMLStream &xs,
- OutputParams const &runparams,
- ParagraphList::const_iterator par)
-{
- switch (par->layout().latextype) {
- case LATEX_COMMAND:
- makeCommand(text, buf, xs, runparams, par);
- break;
- case LATEX_ENVIRONMENT:
- makeEnvironment(text, buf, xs, runparams, par);
- break;
- case LATEX_LIST_ENVIRONMENT:
- case LATEX_ITEM_ENVIRONMENT:
- // Only case when makeAny() might consume more than one paragraph.
- return makeListEnvironment(text, buf, xs, runparams, par);
- case LATEX_PARAGRAPH:
- makeParagraph(text, buf, xs, runparams, par);
- break;
- case LATEX_BIB_ENVIRONMENT:
- makeBibliography(text, buf, xs, runparams, par);
- break;
- }
- ++par;
- return par;
-}
-
-
bool isLayoutSectioning(Layout const & lay)
{
return lay.category() == from_utf8("Sectioning");
@@ -862,6 +827,35 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs,
} // end anonymous namespace
+ParagraphList::const_iterator makeAny(Text const &text,
+ Buffer const &buf,
+ XMLStream &xs,
+ OutputParams const &runparams,
+ ParagraphList::const_iterator par)
+{
+ switch (par->layout().latextype) {
+ case LATEX_COMMAND:
+ makeCommand(text, buf, xs, runparams, par);
+ break;
+ case LATEX_ENVIRONMENT:
+ makeEnvironment(text, buf, xs, runparams, par);
+ break;
+ case LATEX_LIST_ENVIRONMENT:
+ case LATEX_ITEM_ENVIRONMENT:
+ // Only case when makeAny() might consume more than one paragraph.
+ return makeListEnvironment(text, buf, xs, runparams, par);
+ case LATEX_PARAGRAPH:
+ makeParagraph(text, buf, xs, runparams, par);
+ break;
+ case LATEX_BIB_ENVIRONMENT:
+ makeBibliography(text, buf, xs, runparams, par);
+ break;
+ }
+ ++par;
+ return par;
+}
+
+
xml::FontTag docbookStartFontTag(xml::FontTypes type)
{
return xml::FontTag(from_utf8(fontToDocBookTag(type)), from_utf8(fontToAttribute(type)), type);
diff --git a/src/output_docbook.h b/src/output_docbook.h
index 4dcc853..401018d 100644
--- a/src/output_docbook.h
+++ b/src/output_docbook.h
@@ -16,6 +16,7 @@
#define OUTPUT_DOCBOOK_H
#include "LayoutEnums.h"
+#include "ParagraphList.h"
#include "support/docstream.h"
#include "support/strfwd.h"
@@ -27,18 +28,23 @@ class Buffer;
class OutputParams;
class Text;
-///
-std::string const fontToDocBookTag(xml::FontTypes type);
-///
+/// generates an xml::StartTag for the given style
xml::FontTag docbookStartFontTag(xml::FontTypes type);
-///
+/// generates an xml::EndTag for the given style
xml::EndFontTag docbookEndFontTag(xml::FontTypes type);
-///
-void docbookParagraphs(Text const & text,
- Buffer const & buf,
- XMLStream & os,
- OutputParams const & runparams);
+/// output a series of paragraphs into the XMLStream
+void docbookParagraphs(Text const &,
+ Buffer const &,
+ XMLStream &,
+ OutputParams const &);
+
+/// output a single paragraph into the XMLStream
+ParagraphList::const_iterator makeAny(Text const &,
+ Buffer const &,
+ XMLStream &,
+ OutputParams const &,
+ ParagraphList::const_iterator);
} // namespace lyx
commit 3711a38b9c2c1d777ead142460f69284efa82597
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Sep 12 01:43:57 2020 +0200
DocBook: fix a crash in bibliography paragraphs.
diff --git a/autotests/export/docbook/SciPoster.lyx b/autotests/export/docbook/SciPoster.lyx
new file mode 100644
index 0000000..1bd3b51
--- /dev/null
+++ b/autotests/export/docbook/SciPoster.lyx
@@ -0,0 +1,867 @@
+#LyX 2.3 created this file. For more info see http://www.lyx.org/
+\lyxformat 544
+\begin_document
+\begin_header
+\save_transient_properties true
+\origin /systemlyxdir/templates/Posters/
+\textclass sciposter
+\begin_preamble
+%% Comment this out and adapt if you want a poster background
+%\usepackage{wallpaper}
+%\CenterWallPaper{1.1}{poster-background}
+
+% Set all margins to 1cm
+\setmargins[1cm]
+
+% Set up column layout
+\setlength\columnseprule{0pt}
+\setlength\columnsep{4.5pc}
+
+% Color settings:
+\usepackage{sectionbox}
+% a.) background color
+%\definecolor{mainCol}{RGB}{255,237,208}
+% b.) text color (mainly subsection headers)
+\definecolor{TextCol}{RGB}{128,0,0}
+% c.) section header color
+\definecolor{SectionCol}{RGB}{0,0,255}
+% d.) color of section boxes
+\definecolor{sectboxfillcol}{RGB}{255,220,168}
+\definecolor{subsectboxfillcol}{RGB}{255,245,198}
+
+% Large section titles
+\renewcommand{\sectionsize}{\Large}
+\end_preamble
+\options landscape,a0,largefonts,plainsections
+\use_default_options false
+\begin_modules
+multicol
+sectionbox
+\end_modules
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding utf8
+\fontencoding global
+\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_osf false
+\font_sf_scale 100 100
+\font_tt_scale 100 100
+\use_microtype false
+\use_dash_ligatures false
+\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 natbib
+\cite_engine_type numerical
+\biblio_style plainnat
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\justification true
+\use_refstyle 0
+\use_minted 0
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 0
+\tocdepth -1
+\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
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Title
+Poster Title
+\end_layout
+
+\begin_layout Author
+Author One and Author Two
+\end_layout
+
+\begin_layout Institute
+The University, Some address, Postal Code
+\end_layout
+
+\begin_layout E-Mail
+author1 at somewhere and author2 at elsewhere
+\end_layout
+
+\begin_layout Conference
+The Conference
+\begin_inset Note Note
+status open
+
+\begin_layout Plain Layout
+appears in footer
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Note Note
+status open
+
+\begin_layout Section*
+Some advices
+\end_layout
+
+\begin_layout Subsubsection*
+Appearance
+\end_layout
+
+\begin_layout Itemize
+See
+\family sans
+Document\SpecialChar menuseparator
+Settings\SpecialChar menuseparator
+\SpecialChar LaTeX
+ Preamble
+\family default
+ for some possibilities to adjust the appearance of your poster.
+ Also check
+\family sans
+Document\SpecialChar menuseparator
+Settings\SpecialChar menuseparator
+Document Class\SpecialChar menuseparator
+Class Options
+\family default
+ for some general settings.
+ Please refer to the
+\family sans
+sciposter
+\family default
+ manual for possible values.
+\end_layout
+
+\begin_layout Subsubsection*
+Logo
+\end_layout
+
+\begin_layout Itemize
+You can use the
+\family sans
+LeftLogo
+\family default
+ and
+\family sans
+RightLogo
+\family default
+ style to insert graphic logos in the header of your poster.
+ The logos need to be given as file names (with our without extension) and
+ with full path, if the files are not in the TEXMF directory.
+\end_layout
+
+\begin_layout Itemize
+Note that the logos only appear if you do not specify a
+\begin_inset Quotes eld
+\end_inset
+
+Conference
+\begin_inset Quotes erd
+\end_inset
+
+ (i.
+\begin_inset space \thinspace{}
+\end_inset
+
+e., no foot line).
+\end_layout
+
+\begin_layout Subsubsection*
+Columns and Boxes
+\end_layout
+
+\begin_layout Itemize
+The
+\family sans
+Columns
+\family default
+ and
+\family sans
+(Section) Box
+\family default
+ insets can be found at
+\family sans
+Insert\SpecialChar menuseparator
+Custom Insets.
+\end_layout
+
+\begin_layout Itemize
+Instead of the Section Boxes, you can also use the differently looking Color
+ Boxes via the
+\begin_inset Quotes eld
+\end_inset
+
+Color Boxes
+\begin_inset Quotes erd
+\end_inset
+
+ module.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Flex Multiple Columns
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+
+3
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Abstract
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+
+\size small
+\emph on
+This is my special abstract This is my special abstract This is my special
+ abstract This is my special abstract This is my special abstract This is
+ my special abstract This is my special abstract This is my special abstract
+ This is my special abstract This is my special abstract.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Background
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+This is the background and our hypothesis.
+ This is the background and our hypothesis.
+ This is the background and our hypothesis.
+ This is the background and our hypothesis.
+ This is the background and our hypothesis.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+
+\size small
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+label "One/Two(2010)"
+key "key-1"
+literal "true"
+
+\end_inset
+
+Author One & Author Two (2010): Our Great Book.
+ Somewhere.
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+label "Two/One(2011)"
+key "key-2"
+literal "true"
+
+\end_inset
+
+Author Two & Author One (2011): Our Even Greater Book.
+ Somewhere.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+columnbreak
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Findings
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SubsectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Some evidence
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+point one
+\end_layout
+
+\begin_layout Itemize
+point two
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SubsectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+More evidence
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+point three
+\end_layout
+
+\begin_layout Itemize
+point four
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SubsectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Other issues
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+Really have to fill in this
+\end_layout
+
+\begin_layout Itemize
+Really have to fill in this
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+columnbreak
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Experiment
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Results
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+result
+\end_layout
+
+\begin_layout Itemize
+result
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Conclusions
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Enumerate
+first conclusion
+\end_layout
+
+\begin_layout Enumerate
+second conclusion
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Available font size (and corresponding
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+LaTeX
+\backslash
+
+\end_layout
+
+\end_inset
+
+ commands)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\paragraph_spacing single
+\begin_inset Note Note
+status open
+
+\begin_layout Plain Layout
+The extra sizes (
+\begin_inset Quotes eld
+\end_inset
+
+Giant
+\begin_inset Quotes erd
+\end_inset
+
+ etc.) are available at
+\family sans
+Insert\SpecialChar menuseparator
+Custom Insets
+\family default
+.
+ For small inline snippets, there are variants at
+\family sans
+Edit\SpecialChar menuseparator
+Text Style.
+\end_layout
+
+\begin_layout Plain Layout
+Note that for some paper sizes and font settings,
+\begin_inset Quotes eld
+\end_inset
+
+More Giant
+\begin_inset Quotes erd
+\end_inset
+
+ and
+\begin_inset Quotes eld
+\end_inset
+
+Most Giant
+\begin_inset Quotes erd
+\end_inset
+
+ are equal.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+
+\size tiny
+Tiny (
+\family typewriter
+
+\backslash
+tiny
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size scriptsize
+Smallest (
+\family typewriter
+
+\backslash
+scriptsize
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size footnotesize
+Smaller (
+\family typewriter
+
+\backslash
+footnotesize
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size normal
+Normal (
+\family typewriter
+\size default
+
+\backslash
+normalsize
+\family default
+\size normal
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size large
+Large (
+\family typewriter
+
+\backslash
+large
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size larger
+Larger (
+\family typewriter
+
+\backslash
+Large
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size largest
+Largest (
+\family typewriter
+
+\backslash
+LARGE
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size huge
+Huge (
+\family typewriter
+
+\backslash
+huge
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size giant
+Huger (
+\family typewriter
+
+\backslash
+Huge
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex Giant
+status open
+
+\begin_layout Plain Layout
+Giant (
+\family typewriter
+
+\backslash
+veryHuge
+\family default
+)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex More Giant
+status open
+
+\begin_layout Plain Layout
+More Giant (
+\family typewriter
+
+\backslash
+VeryHuge
+\family default
+)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex Most Giant
+status open
+
+\begin_layout Plain Layout
+Most Giant (
+\family typewriter
+
+\backslash
+VERYHuge
+\family default
+)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/SciPoster.xml b/autotests/export/docbook/SciPoster.xml
new file mode 100644
index 0000000..abd919b
--- /dev/null
+++ b/autotests/export/docbook/SciPoster.xml
@@ -0,0 +1,65 @@
+<?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>Poster Title</title>
+<author>
+<personname>Author One and Author Two</personname>
+</author><author>
+<personname>The University, Some address, Postal Code</personname>
+</author><author>
+<personname>author1 at somewhere and author2 at elsewhere</personname>
+</author><author>
+<personname>The Conference</personname>
+</author>
+</info>
+<para>This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract.This is the background and our hypothesis. This is the background and our hypothesis. This is the background and our hypothesis. This is the background and our hypothesis. This is the background and our hypothesis.<bibliography>
+<bibliomixed xml:id='key-1'>Author One & Author Two (2010): Our Great Book. Somewhere.</bibliomixed>
+<bibliomixed xml:id='key-2'>Author Two & Author One (2011): Our Even Greater Book. Somewhere.</bibliomixed>
+</bibliography>
+<!-- \columnbreak -->
+<itemizedlist>
+<listitem>
+<para>point one</para>
+</listitem>
+<listitem>
+<para>point two</para>
+</listitem>
+</itemizedlist>
+<itemizedlist>
+<listitem>
+<para>point three</para>
+</listitem>
+<listitem>
+<para>point four</para>
+</listitem>
+</itemizedlist>
+<itemizedlist>
+<listitem>
+<para>Really have to fill in this</para>
+</listitem>
+<listitem>
+<para>Really have to fill in this</para>
+</listitem>
+</itemizedlist>
+<!-- \columnbreak -->
+This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. <itemizedlist>
+<listitem>
+<para>result</para>
+</listitem>
+<listitem>
+<para>result</para>
+</listitem>
+</itemizedlist>
+<orderedlist>
+<listitem>
+<para>first conclusion</para>
+</listitem>
+<listitem>
+<para>second conclusion</para>
+</listitem>
+</orderedlist>
+</para>
+<para>Tiny (\tiny)Smallest (\scriptsize)Smaller (\footnotesize)Normal (\normalsize)Large (\large)Larger (\Large)Largest (\LARGE)Huge (\huge)Huger (\Huge)Giant (\veryHuge)More Giant (\VeryHuge)Most Giant (\VERYHuge)</para>
+</article>
\ No newline at end of file
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 1e804ee..ee829e5 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -362,8 +362,8 @@ void makeBibliography(
ParagraphList::const_iterator const & par)
{
// If this is the first paragraph in a bibliography, open the bibliography tag.
- auto pbegin_before = text.paragraphs().getParagraphBefore(par);
- if (pbegin_before->layout().latextype != LATEX_BIB_ENVIRONMENT) {
+ auto const * pbegin_before = text.paragraphs().getParagraphBefore(par);
+ if (pbegin_before == nullptr || (pbegin_before && pbegin_before->layout().latextype != LATEX_BIB_ENVIRONMENT)) {
xs << xml::StartTag("bibliography");
xs << xml::CR();
}
commit dd8660c07e2864d7abfd8708504d06b032c3ed48
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Sep 12 01:04:43 2020 +0200
layout2layout: use name instead of pseudonym.
diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index 7cf2332..74119bb 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -271,7 +271,7 @@ currentFormat = 84
# Incremented to format 81, 12 August 2019 by rikiheck
# New tag GuiName for counters
-# Incremented to format 82, 4 June 2017 by dourouc05
+# Incremented to format 82, 4 June 2017 by tcuvelier
# - Add new tags for Layout:
# DocBookTag, DocBookAttr, DocBookInInfo,
# DocBookWrapperTag, DocBookWrapperAttr,
@@ -281,7 +281,7 @@ currentFormat = 84
# - Removed tag Header from ClassOptionsClassOptions
# - Removed tag Element for flex insets
-# Incremented to format 83, 2 August 2020 by dourouc05
+# Incremented to format 83, 2 August 2020 by tcuvelier
# New tags DocBookWrapperMergeWithPrevious and DocBookAbstract
# Incremented to format 84, 17 August 2020 by tcuvelier
commit 1b818c448d3a4e7f6fd4ea2685d775761de95767
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Sep 12 00:39:23 2020 +0200
DocBook: work for more subfigure cases.
EmbeddedObjects hid quite a few gems :).
diff --git a/autotests/export/docbook/subfigures_EmbeddedObjects.lyx b/autotests/export/docbook/subfigures_EmbeddedObjects.lyx
new file mode 100644
index 0000000..0154d21
--- /dev/null
+++ b/autotests/export/docbook/subfigures_EmbeddedObjects.lyx
@@ -0,0 +1,444 @@
+#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
+% that links to image floats jumps
+% to the beginning of the float and
+% not to its caption
+\usepackage[figure]{hypcap}
+
+% the pages of the TOC are numbered roman
+% and a PDF-bookmark for the TOC is added
+\let\myTOC\tableofcontents
+\renewcommand\tableofcontents{%
+ \frontmatter
+ \pdfbookmark[1]{\contentsname}{}
+ \myTOC
+ \mainmatter }
+
+% provides caption formatting
+\usepackage[labelfont={bf,sf}]{caption}[2004/07/16]
+
+% provides commands to set caption
+% beside tables/images
+\newcommand{\TabBesBeg}[1][1.0]{%
+ \let\MyTable\table
+ \let\MyEndtable\endtable
+ \renewenvironment{table}[1]{\begin{SCtable}[#1]##1}{\end{SCtable}}}
+
+\newcommand{\TabBesEnd}{%
+ \let\table\MyTable
+ \let\endtable\MyEndtable}
+
+\newcommand{\FigBesBeg}[1][1.0]{%
+ \let\MyFigure\figure
+ \let\MyEndfigure\endfigure
+ \renewenvironment{figure}[1]{\begin{SCfigure}[#1]##1}{\end{SCfigure}}}
+
+\newcommand{\FigBesEnd}{%
+ \let\figure\MyFigure
+ \let\endfigure\MyEndfigure}
+
+% enables calculation of values,
+\usepackage{calc}
+
+% increase the bottom float placement fraction
+\renewcommand{\bottomfraction}{0.5}
+
+% avoids that floats are placed before their
+% corresponding section starts
+\let\mySection\section\renewcommand{\section}{\suppressfloats[t]\mySection}
+
+% speed up the longtable calculation
+\setcounter{LTchunksize}{100}
+
+% used for colored tables
+\@ifundefined{textcolor}
+ {\usepackage{color}}{}
+\definecolor{darkgreen}{cmyk}{0.5, 0, 1, 0.5}
+\definecolor{lightgrey}{gray}{0.8}
+
+% check for package colortbl
+% used for colored table cells
+\newboolean{colortbl}
+\IfFileExists{colortbl.sty}
+ {\usepackage{colortbl}
+ \setboolean{colortbl}{true}}
+ {\setboolean{colortbl}{false}}
+
+% used to have extra space in table cells
+\@ifundefined{extrarowheight}
+ {\usepackage{array}}{}
+\setlength{\extrarowheight}{2pt}
+
+% used for customized tables
+% ---
+\newcolumntype{M}[1]
+ {>{\centering\hspace{0pt}}m{#1}}
+
+\newcolumntype{S}[2]
+ {>{\centering\hspace{0pt}}m{(#1+(2\tabcolsep+\arrayrulewidth)*(1-#2))/#2}}
+
+\newcolumntype{K}[1]
+ {>{\columncolor{#1}\hspace{0pt}}c}
+
+\newcolumntype{V}{!{\vrule width 1.5pt}}
+
+\newcolumntype{W}{!{\color{green}\vline}}
+% ---
+
+% insert additional vertical space of
+% 1.5 mm between footnotes
+\let\myFoot\footnote
+\renewcommand{\footnote}[1]{\myFoot{#1\vspace{1.5mm}}}
+
+% number algorithm floats within chapters
+\numberwithin{algorithm}{chapter}
+
+% ------------------------------------
+% used to check for needed LaTeX packages
+\usepackage{ifthen}
+
+% check for package arydshln
+% used for tables with dashed lines
+\newboolean{arydshln}
+\IfFileExists{arydshln.sty}
+ {\usepackage{arydshln}
+ \setboolean{arydshln}{true}}
+ {\setboolean{arydshln}{false}}
+
+% check for package marginnote
+% used for margin notes
+\newboolean{marginnote}
+\IfFileExists{marginnote.sty}
+ {\usepackage{marginnote}
+ \let\marginpar\marginnote
+ \setboolean{marginnote}{true}}
+ {\setboolean{marginnote}{false}}
+
+% check for package sidecap
+% used for captions on the side
+\newboolean{sidecap}
+\IfFileExists{sidecap.sty}
+ {\usepackage{sidecap}
+ \setboolean{sidecap}{true}}
+ {\setboolean{sidecap}{false}}
+
+% check for picinpar
+% used for surrounded fixed objects
+\newboolean{picinpar}
+\IfFileExists{picinpar.sty}
+ {\usepackage{picinpar}
+ \setboolean{picinpar}{true}}
+ {\setboolean{picinpar}{false}}
+
+% check for lettrine
+\newboolean{lettrine}
+\IfFileExists{lettrine.sty}
+ {\usepackage{lettrine}
+ \setboolean{lettrine}{true}}
+ {\setboolean{lettrine}{false}}
+
+% check for diagbox
+\newboolean{diagbox}
+\IfFileExists{diagbox.sty}
+ {\usepackage{diagbox}
+ \setboolean{diagbox}{true}}
+ {\setboolean{diagbox}{false}}
+% Added by lyx2lyx
+\setlength{\parskip}{\medskipamount}
+\setlength{\parindent}{0pt}
+\end_preamble
+\options bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading,dvipsnames,table
+\use_default_options false
+\begin_modules
+initials
+graphicboxes
+varwidth
+\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 makeindex
+\paperfontsize 12
+\spacing single
+\use_hyperref true
+\pdf_title "LyX's Figure, Table, Floats, Notes, and Boxes manual"
+\pdf_author "LyX Team, Uwe Stöhr"
+\pdf_subject "LyX-documentation about figures, tables, floats, notes, and boxes"
+\pdf_keywords "LyX, Tables, Figures, Floats, Boxes, Notes"
+\pdf_bookmarks true
+\pdf_bookmarksnumbered true
+\pdf_bookmarksopen true
+\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 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 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 0
+\math_numbering_side default
+\quotes_style english
+\dynamic_quotes 0
+\papercolumns 1
+\papersides 2
+\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
+\SpecialChar LyX
+'s detailed Figure, Table, Floats, Notes, Boxes and External Material manual
+\end_layout
+
+\begin_layout Chapter
+Figures
+\end_layout
+
+\begin_layout Section
+Figure Floats
+\end_layout
+
+\begin_layout Standard
+Normally only one image is inserted to a figure float, but sometimes you
+ might want to use two images with separate subcaptions.
+ This can be done by inserting image floats into existing image floats.
+ Note that only the main caption of the float is added to the List of Figures.
+ Figure
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "fig:Two-distorted-images"
+
+\end_inset
+
+ is an example of a figure float with two images set side by side.
+ You can also set the images one below the other.
+ Figure
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "fig:Pink-object"
+
+\end_inset
+
+ and
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "fig:A-star"
+
+\end_inset
+
+ are the subfigures.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Float figure
+placement document
+alignment document
+wide false
+sideways false
+status open
+
+\begin_layout Plain Layout
+\begin_inset space \hfill{}
+\end_inset
+
+
+\begin_inset Float figure
+placement document
+alignment document
+wide false
+sideways false
+status open
+
+\begin_layout Plain Layout
+\begin_inset Caption Standard
+
+\begin_layout Plain Layout
+\begin_inset CommandInset label
+LatexCommand label
+name "fig:Pink-object"
+
+\end_inset
+
+Pink object.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Graphics
+ filename ../../../lib/doc/clipart/3D-structure-distort.pdf
+ width 45col%
+ scaleBeforeRotation
+ groupId distorted
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\begin_inset space \hfill{}
+\end_inset
+
+
+\begin_inset Float figure
+placement document
+alignment document
+wide false
+sideways false
+status open
+
+\begin_layout Plain Layout
+\begin_inset Caption Standard
+
+\begin_layout Plain Layout
+\begin_inset CommandInset label
+LatexCommand label
+name "fig:A-star"
+
+\end_inset
+
+A star.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Graphics
+ filename ../../../lib/doc/clipart/Star-structure.pdf
+ width 45col%
+ scaleBeforeRotation
+ groupId distorted
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\begin_inset space \hfill{}
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Caption Standard
+
+\begin_layout Plain Layout
+\begin_inset CommandInset label
+LatexCommand label
+name "fig:Two-distorted-images"
+
+\end_inset
+
+Two distorted images.
+ Both images are in the image settings group named
+\begin_inset Quotes eld
+\end_inset
+
+distorted
+\begin_inset Quotes erd
+\end_inset
+
+.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/subfigures_EmbeddedObjects.xml b/autotests/export/docbook/subfigures_EmbeddedObjects.xml
new file mode 100644
index 0000000..08fda04
--- /dev/null
+++ b/autotests/export/docbook/subfigures_EmbeddedObjects.xml
@@ -0,0 +1,32 @@
+<?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">
+<title>LyX's detailed Figure, Table, Floats, Notes, Boxes and External Material manual</title>
+<chapter>
+<title>Figures</title>
+<section>
+<title>Figure Floats</title>
+<para>Normally only one image is inserted to a figure float, but sometimes you might want to use two images with separate subcaptions. This can be done by inserting image floats into existing image floats. Note that only the main caption of the float is added to the List of Figures. Figure <xref linkend="fig.Two-distorted-images" /> is an example of a figure float with two images set side by side. You can also set the images one below the other. Figure <xref linkend="fig.Pink-object" /> and <xref linkend="fig.A-star" /> are the subfigures.</para>
+<formalgroup xml:id="fig.Two-distorted-images">
+<title>Two distorted images. Both images are in the image settings group named “distorted”.</title>
+<figure xml:id="fig.Pink-object">
+<title>Pink object.</title>
+<mediaobject>
+<imageobject>
+<imagedata fileref="D:/LyX/lyx-unstable/lib/doc/clipart/3D-structure-distort.pdf" width="45%" />
+</imageobject>
+</mediaobject>
+</figure>
+<figure xml:id="fig.A-star">
+<title>A star.</title>
+<mediaobject>
+<imageobject>
+<imagedata fileref="D:/LyX/lyx-unstable/lib/doc/clipart/Star-structure.pdf" width="45%" />
+</imageobject>
+</mediaobject>
+</figure>
+</formalgroup>
+</section>
+</chapter>
+</book>
\ No newline at end of file
diff --git a/autotests/export/docbook/subfigures_boxes_EmbeddedObjects.lyx b/autotests/export/docbook/subfigures_boxes_EmbeddedObjects.lyx
new file mode 100644
index 0000000..da41aa3
--- /dev/null
+++ b/autotests/export/docbook/subfigures_boxes_EmbeddedObjects.lyx
@@ -0,0 +1,420 @@
+#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
+% that links to image floats jumps
+% to the beginning of the float and
+% not to its caption
+\usepackage[figure]{hypcap}
+
+% the pages of the TOC are numbered roman
+% and a PDF-bookmark for the TOC is added
+\let\myTOC\tableofcontents
+\renewcommand\tableofcontents{%
+ \frontmatter
+ \pdfbookmark[1]{\contentsname}{}
+ \myTOC
+ \mainmatter }
+
+% provides caption formatting
+\usepackage[labelfont={bf,sf}]{caption}[2004/07/16]
+
+% provides commands to set caption
+% beside tables/images
+\newcommand{\TabBesBeg}[1][1.0]{%
+ \let\MyTable\table
+ \let\MyEndtable\endtable
+ \renewenvironment{table}[1]{\begin{SCtable}[#1]##1}{\end{SCtable}}}
+
+\newcommand{\TabBesEnd}{%
+ \let\table\MyTable
+ \let\endtable\MyEndtable}
+
+\newcommand{\FigBesBeg}[1][1.0]{%
+ \let\MyFigure\figure
+ \let\MyEndfigure\endfigure
+ \renewenvironment{figure}[1]{\begin{SCfigure}[#1]##1}{\end{SCfigure}}}
+
+\newcommand{\FigBesEnd}{%
+ \let\figure\MyFigure
+ \let\endfigure\MyEndfigure}
+
+% enables calculation of values,
+\usepackage{calc}
+
+% increase the bottom float placement fraction
+\renewcommand{\bottomfraction}{0.5}
+
+% avoids that floats are placed before their
+% corresponding section starts
+\let\mySection\section\renewcommand{\section}{\suppressfloats[t]\mySection}
+
+% speed up the longtable calculation
+\setcounter{LTchunksize}{100}
+
+% used for colored tables
+\@ifundefined{textcolor}
+ {\usepackage{color}}{}
+\definecolor{darkgreen}{cmyk}{0.5, 0, 1, 0.5}
+\definecolor{lightgrey}{gray}{0.8}
+
+% check for package colortbl
+% used for colored table cells
+\newboolean{colortbl}
+\IfFileExists{colortbl.sty}
+ {\usepackage{colortbl}
+ \setboolean{colortbl}{true}}
+ {\setboolean{colortbl}{false}}
+
+% used to have extra space in table cells
+\@ifundefined{extrarowheight}
+ {\usepackage{array}}{}
+\setlength{\extrarowheight}{2pt}
+
+% used for customized tables
+% ---
+\newcolumntype{M}[1]
+ {>{\centering\hspace{0pt}}m{#1}}
+
+\newcolumntype{S}[2]
+ {>{\centering\hspace{0pt}}m{(#1+(2\tabcolsep+\arrayrulewidth)*(1-#2))/#2}}
+
+\newcolumntype{K}[1]
+ {>{\columncolor{#1}\hspace{0pt}}c}
+
+\newcolumntype{V}{!{\vrule width 1.5pt}}
+
+\newcolumntype{W}{!{\color{green}\vline}}
+% ---
+
+% insert additional vertical space of
+% 1.5 mm between footnotes
+\let\myFoot\footnote
+\renewcommand{\footnote}[1]{\myFoot{#1\vspace{1.5mm}}}
+
+% number algorithm floats within chapters
+\numberwithin{algorithm}{chapter}
+
+% ------------------------------------
+% used to check for needed LaTeX packages
+\usepackage{ifthen}
+
+% check for package arydshln
+% used for tables with dashed lines
+\newboolean{arydshln}
+\IfFileExists{arydshln.sty}
+ {\usepackage{arydshln}
+ \setboolean{arydshln}{true}}
+ {\setboolean{arydshln}{false}}
+
+% check for package marginnote
+% used for margin notes
+\newboolean{marginnote}
+\IfFileExists{marginnote.sty}
+ {\usepackage{marginnote}
+ \let\marginpar\marginnote
+ \setboolean{marginnote}{true}}
+ {\setboolean{marginnote}{false}}
+
+% check for package sidecap
+% used for captions on the side
+\newboolean{sidecap}
+\IfFileExists{sidecap.sty}
+ {\usepackage{sidecap}
+ \setboolean{sidecap}{true}}
+ {\setboolean{sidecap}{false}}
+
+% check for picinpar
+% used for surrounded fixed objects
+\newboolean{picinpar}
+\IfFileExists{picinpar.sty}
+ {\usepackage{picinpar}
+ \setboolean{picinpar}{true}}
+ {\setboolean{picinpar}{false}}
+
+% check for lettrine
+\newboolean{lettrine}
+\IfFileExists{lettrine.sty}
+ {\usepackage{lettrine}
+ \setboolean{lettrine}{true}}
+ {\setboolean{lettrine}{false}}
+
+% check for diagbox
+\newboolean{diagbox}
+\IfFileExists{diagbox.sty}
+ {\usepackage{diagbox}
+ \setboolean{diagbox}{true}}
+ {\setboolean{diagbox}{false}}
+% Added by lyx2lyx
+\setlength{\parskip}{\medskipamount}
+\setlength{\parindent}{0pt}
+\end_preamble
+\options bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading,dvipsnames,table
+\use_default_options false
+\begin_modules
+initials
+graphicboxes
+varwidth
+\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 makeindex
+\paperfontsize 12
+\spacing single
+\use_hyperref true
+\pdf_title "LyX's Figure, Table, Floats, Notes, and Boxes manual"
+\pdf_author "LyX Team, Uwe Stöhr"
+\pdf_subject "LyX-documentation about figures, tables, floats, notes, and boxes"
+\pdf_keywords "LyX, Tables, Figures, Floats, Boxes, Notes"
+\pdf_bookmarks true
+\pdf_bookmarksnumbered true
+\pdf_bookmarksopen true
+\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 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 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 0
+\math_numbering_side default
+\quotes_style english
+\dynamic_quotes 0
+\papercolumns 1
+\papersides 2
+\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
+\SpecialChar LyX
+'s detailed Figure, Table, Floats, Notes, Boxes and External Material manual
+\end_layout
+
+\begin_layout Chapter
+Floats
+\end_layout
+
+\begin_layout Section
+Floats Side by Side
+\end_layout
+
+\begin_layout Standard
+To place floats side by side, as in Figures
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "fig:Float-left"
+
+\end_inset
+
+ and
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "fig:Float-right"
+
+\end_inset
+
+, only
+\emph on
+one
+\emph default
+ float is used.
+ In it two minipage boxes are inserted.
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Float figure
+placement document
+alignment document
+wide false
+sideways false
+status open
+
+\begin_layout Plain Layout
+\begin_inset Box Frameless
+position "b"
+hor_pos "c"
+has_inner_box 1
+inner_pos "t"
+use_parbox 0
+use_makebox 0
+width "45col%"
+special "none"
+height "1in"
+height_special "totalheight"
+thickness "0.4pt"
+separation "3pt"
+shadowsize "4pt"
+framecolor "black"
+backgroundcolor "none"
+status open
+
+\begin_layout Plain Layout
+\align center
+\begin_inset Graphics
+ filename ../../../lib/doc/clipart/2D-intensity-plot.pdf
+ width 100col%
+ scaleBeforeRotation
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Caption Standard
+
+\begin_layout Plain Layout
+\begin_inset CommandInset label
+LatexCommand label
+name "fig:Float-left"
+
+\end_inset
+
+Float on the left side.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\begin_inset space \hfill{}
+\end_inset
+
+
+\begin_inset Box Frameless
+position "b"
+hor_pos "c"
+has_inner_box 1
+inner_pos "t"
+use_parbox 0
+use_makebox 0
+width "45col%"
+special "none"
+height "1in"
+height_special "totalheight"
+thickness "0.4pt"
+separation "3pt"
+shadowsize "4pt"
+framecolor "black"
+backgroundcolor "none"
+status open
+
+\begin_layout Plain Layout
+\align center
+\begin_inset Graphics
+ filename ../../../lib/doc/clipart/Star-structure.pdf
+ width 100col%
+ scaleBeforeRotation
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Caption Standard
+
+\begin_layout Plain Layout
+\begin_inset CommandInset label
+LatexCommand label
+name "fig:Float-right"
+
+\end_inset
+
+Float on the right side.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/subfigures_boxes_EmbeddedObjects.xml b/autotests/export/docbook/subfigures_boxes_EmbeddedObjects.xml
new file mode 100644
index 0000000..7f010cf
--- /dev/null
+++ b/autotests/export/docbook/subfigures_boxes_EmbeddedObjects.xml
@@ -0,0 +1,32 @@
+<?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">
+<title>LyX's detailed Figure, Table, Floats, Notes, Boxes and External Material manual</title>
+<chapter>
+<title>Floats</title>
+<section>
+<title>Floats Side by Side</title>
+<para>To place floats side by side, as in Figures <xref linkend="fig.Float-left" /> and <xref linkend="fig.Float-right" />, only <emphasis>one</emphasis> float is used. In it two minipage boxes are inserted. </para>
+<formalgroup>
+<title>No caption</title>
+<figure xml:id="fig.Float-left">
+<title>Float on the left side.</title>
+<mediaobject>
+<imageobject>
+<imagedata fileref="D:/LyX/lyx-unstable/lib/doc/clipart/2D-intensity-plot.pdf" width="100%" />
+</imageobject>
+</mediaobject>
+</figure>
+<figure xml:id="fig.Float-right">
+<title>Float on the right side.</title>
+<mediaobject>
+<imageobject>
+<imagedata fileref="D:/LyX/lyx-unstable/lib/doc/clipart/Star-structure.pdf" width="100%" />
+</imageobject>
+</mediaobject>
+</figure>
+</formalgroup>
+</section>
+</chapter>
+</book>
\ No newline at end of file
diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp
index eaa24cb..4e7db11 100644
--- a/src/insets/InsetFloat.cpp
+++ b/src/insets/InsetFloat.cpp
@@ -566,6 +566,66 @@ const InsetCaption* findCaptionInParagraph(const Paragraph &par)
}
+/// Takes an unstructured subfigure container (typically, an InsetBox) and find the elements within:
+/// actual content (image or table), maybe a caption, maybe a label.
+std::tuple<InsetCode, const Inset *, const InsetCaption *, const InsetLabel *> docbookParseHopelessSubfigure(const InsetText * subfigure)
+{
+ InsetCode type = NO_CODE;
+ const Inset * content = nullptr;
+ const InsetCaption * caption = nullptr;
+ const InsetLabel * label = nullptr;
+
+ for (const auto & it : subfigure->paragraphs()) {
+ for (pos_type posIn = 0; posIn < it.size(); ++posIn) {
+ const Inset * inset = it.getInset(posIn);
+ if (inset) {
+ switch (inset->lyxCode()) {
+ case GRAPHICS_CODE:
+ case TABULAR_CODE:
+ if (!content) {
+ content = inset;
+ type = inset->lyxCode();
+ }
+ break;
+ case CAPTION_CODE:
+ if (!caption) {
+ caption = dynamic_cast<const InsetCaption *>(inset);
+
+ // A label often hides in a caption. Make a simplified version of the main loop.
+ if (!label) {
+ for (const auto &cit : caption->paragraphs()) {
+ for (pos_type cposIn = 0; cposIn < cit.size(); ++cposIn) {
+ const Inset *cinset = cit.getInset(posIn);
+ if (cinset && cinset->lyxCode() == LABEL_CODE) {
+ label = dynamic_cast<const InsetLabel *>(cinset);
+ break;
+ }
+ }
+
+ if (label)
+ break;
+ }
+ }
+ }
+ break;
+ case LABEL_CODE:
+ if (!label)
+ label = dynamic_cast<const InsetLabel *>(inset);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (content && caption && label)
+ break;
+ }
+
+ return std::make_tuple(type, content, caption, label);
+}
+
+
void docbookSubfigures(XMLStream & xs, OutputParams const & runparams, const InsetCaption * caption,
const InsetLabel * label, std::vector<const InsetCollapsible *> & subfigures)
{
@@ -595,22 +655,27 @@ void docbookSubfigures(XMLStream & xs, OutputParams const & runparams, const Ins
// Deal with each subfigure individually. This should also deal with their caption and their label.
// This should be a recursive call to InsetFloat.
- // An item in subfigure should either be an InsetBox containing an InsetFloat or directly an InsetFloat.
- for (const InsetCollapsible *subfigure: subfigures) {
- // If there is no InsetFloat in the paragraphs, output a warning.
- bool foundInsetFloat = false;
+ // An item in subfigure should either be an InsetBox containing an InsetFloat, or an InsetBox directly containing
+ // an image or a table, or directly an InsetFloat.
+ for (const InsetCollapsible * subfigure: subfigures) {
+ if (subfigure == nullptr)
+ continue;
// The collapsible may already be a float (InsetFloat).
- if (subfigure && dynamic_cast<const InsetFloat *>(subfigure))
- foundInsetFloat = true;
+ if (dynamic_cast<const InsetFloat *>(subfigure)) {
+ subfigure->docbook(xs, runparams);
+ continue;
+ }
- // Subfigures are in boxes.
- if (!foundInsetFloat) {
+ // Subfigures are in boxes, then in InsetFloat.
+ {
+ bool foundInsetFloat = false;
for (const auto &it : subfigure->paragraphs()) {
for (pos_type posIn = 0; posIn < it.size(); ++posIn) {
const Inset *inset = it.getInset(posIn);
- if (inset && dynamic_cast<const InsetFloat *>(inset)) {
+ if (inset && inset->lyxCode() == FLOAT_CODE) {
foundInsetFloat = true;
+ inset->docbook(xs, runparams);
break;
}
}
@@ -618,15 +683,79 @@ void docbookSubfigures(XMLStream & xs, OutputParams const & runparams, const Ins
if (foundInsetFloat)
break;
}
+ if (foundInsetFloat)
+ continue;
+ }
+
+ // Subfigures are in boxes, then directly an image or a table. In that case, generate the whole content of the
+ // InsetBox, but not the box container.
+ // Impose some model on the subfigure: at most a caption, at most a label, exactly one figure or one table.
+ {
+ InsetCode stype = NO_CODE;
+ const Inset * scontent = nullptr;
+ const InsetCaption * scaption = nullptr;
+ const InsetLabel * slabel = nullptr;
+
+ std::tie(stype, scontent, scaption, slabel) = docbookParseHopelessSubfigure(subfigure);
+
+ // If there is something, generate it. This is very much like docbookNoSubfigures, but many things
+ // must be coded differently because there is no float.
+ // TODO: some code is identical to Floating, like Floating::docbookTag or Floating::docbookCaption. How to reuse that code?
+ if (scontent) {
+ // Floating::docbookCaption()
+ string docbook_caption = "caption"; // This is already correct for tables.
+ if (stype == GRAPHICS_CODE)
+ docbook_caption = "title";
+
+ // Floating::docbookTag() with hasTitle = true, as we are in formalgroup.
+ string stag = "float";
+ if (stype == GRAPHICS_CODE)
+ stag = "figure";
+ else if (stype == TABULAR_CODE)
+ stag = "table";
+
+ // Ensure there is no label output, it is supposed to be handled as xml:id.
+ if (slabel)
+ rpNoLabel.docbook_anchors_to_ignore.emplace(slabel->screenLabel());
+
+ // Ensure the float does not output its caption, as it is handled here (DocBook mandates a specific place for
+ // captions, they cannot appear at the end of the float, albeit LyX is happy with that).
+ OutputParams rpNoTitle = runparams;
+ rpNoTitle.docbook_in_float = true;
+ if (stype == TABULAR_CODE)
+ rpNoTitle.docbook_in_table = true;
+
+ // Organisation: <float> <title if any/> <contents without title/> </float>.
+ docstring sattr = docstring();
+ if (slabel)
+ sattr += "xml:id=\"" + xml::cleanID(slabel->screenLabel()) + "\"";
+ // No layout way of adding attributes, unlike the normal code path.
+
+ xs << xml::StartTag(stag, sattr);
+ xs << xml::CR();
+ xs << xml::StartTag(docbook_caption);
+ if (scaption)
+ scaption->getCaptionAsDocBook(xs, rpNoLabel);
+ else // Mandatory in formalgroup.
+ xs << "No caption detected";
+ xs << xml::EndTag(docbook_caption);
+ xs << xml::CR();
+ scontent->docbook(xs, rpNoTitle);
+ xs << xml::EndTag(stag);
+ xs << xml::CR();
+
+ // This subfigure could be generated.
+ continue;
+ }
}
- if (!foundInsetFloat)
- xs << XMLStream::ESCAPE_NONE << "Error: no float found in the box. "
- "To use subfigures in DocBook, elements must be wrapped in a float "
- "inset and have a title/caption.";
+ // If there is no InsetFloat in the inset, output a warning.
+ xs << XMLStream::ESCAPE_NONE << "Error: no float found in the box. "
+ "To use subfigures in DocBook, elements must be wrapped in a float "
+ "inset and have a title/caption.";
// TODO: could also output a table, that would ensure that the document is correct and *displays* correctly (but without the right semantics), instead of just an error.
- // Finally, recurse.
+ // Recurse to generate as much content as possible (avoid any loss).
subfigure->docbook(xs, runparams);
}
commit 8758000641e9014cd40581d309ded0e1cea44acf
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Fri Sep 11 23:38:11 2020 +0200
DocBook: ensure xml:id is not output too many times.
This is mostly important for subfigures, but debugging this issue showed that InsetCaption could be slightly simplified and InsetLabel should be made a tad more robust.
diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp
index 0291625..8297c6f 100644
--- a/src/insets/InsetCaption.cpp
+++ b/src/insets/InsetCaption.cpp
@@ -367,8 +367,7 @@ void InsetCaption::getCaptionAsDocBook(XMLStream & xs,
return;
// Ignore full_label_, as the DocBook processor will deal with the numbering.
- InsetText::XHTMLOptions const opts =
- InsetText::WriteLabel | InsetText::WriteInnerTag;
+ InsetText::XHTMLOptions opts = InsetText::WriteInnerTag;
InsetText::docbook(xs, runparams, opts);
}
diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp
index d680013..eaa24cb 100644
--- a/src/insets/InsetFloat.cpp
+++ b/src/insets/InsetFloat.cpp
@@ -583,7 +583,7 @@ void docbookSubfigures(XMLStream & xs, OutputParams const & runparams, const Ins
xs << xml::StartTag("formalgroup", attr);
xs << xml::CR();
- xs << xml::StartTag("title", attr);
+ xs << xml::StartTag("title"); // Don't take attr here, the ID should only go in one place, not two.
if (caption) {
caption->getCaptionAsDocBook(xs, rpNoLabel);
} else {
diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp
index 2e80e26..5ba0344 100644
--- a/src/insets/InsetLabel.cpp
+++ b/src/insets/InsetLabel.cpp
@@ -356,8 +356,11 @@ int InsetLabel::plaintext(odocstringstream & os,
void InsetLabel::docbook(XMLStream & xs, OutputParams const & runparams) const
{
// Output an anchor only if it has not been processed before.
- if (runparams.docbook_anchors_to_ignore.find(getParam("name")) == runparams.docbook_anchors_to_ignore.end()) {
- docstring attr = from_utf8("xml:id=\"") + xml::cleanID(getParam("name")) + from_utf8("\"");
+ docstring id = getParam("name");
+ docstring cleaned_id = xml::cleanID(id);
+ if (runparams.docbook_anchors_to_ignore.find(id) == runparams.docbook_anchors_to_ignore.end() &&
+ runparams.docbook_anchors_to_ignore.find(cleaned_id) == runparams.docbook_anchors_to_ignore.end()) {
+ docstring attr = from_utf8("xml:id=\"") + cleaned_id + from_utf8("\"");
xs << xml::CompTag("anchor", to_utf8(attr));
}
}
commit d0a5ba4859702c78fb70ae30fe1f39818c98b102
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Fri Sep 11 03:14:41 2020 +0200
DocBook: handle other cases of subfigures.
diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp
index 981ba40..d680013 100644
--- a/src/insets/InsetFloat.cpp
+++ b/src/insets/InsetFloat.cpp
@@ -492,19 +492,22 @@ int InsetFloat::plaintext(odocstringstream & os, OutputParams const & runparams,
}
-std::vector<const InsetBox *> findSubfiguresInParagraph(const Paragraph &par)
+std::vector<const InsetCollapsible *> findSubfiguresInParagraph(const Paragraph &par)
{
// Don't make the hypothesis that all subfigures are in the same paragraph.
// Similarly, there may be several subfigures in the same paragraph (most likely case, based on the documentation).
// Any box is considered as a subfigure, even though the most likely case is \minipage.
- std::vector<const InsetBox *> subfigures;
+ // Boxes are not required to make subfigures. The common root between InsetBox and InsetFLoat is InsetCollapsible.
+ std::vector<const InsetCollapsible *> subfigures;
for (pos_type pos = 0; pos < par.size(); ++pos) {
const Inset *inset = par.getInset(pos);
if (!inset)
continue;
if (const auto box = dynamic_cast<const InsetBox *>(inset))
subfigures.push_back(box);
+ else if (const auto fl = dynamic_cast<const InsetFloat *>(inset))
+ subfigures.push_back(fl);
}
return subfigures;
}
@@ -564,7 +567,7 @@ const InsetCaption* findCaptionInParagraph(const Paragraph &par)
void docbookSubfigures(XMLStream & xs, OutputParams const & runparams, const InsetCaption * caption,
- const InsetLabel * label, std::vector<const InsetBox *> & subfigures)
+ const InsetLabel * label, std::vector<const InsetCollapsible *> & subfigures)
{
// Ensure there is no label output, it is supposed to be handled as xml:id.
OutputParams rpNoLabel = runparams;
@@ -592,20 +595,29 @@ void docbookSubfigures(XMLStream & xs, OutputParams const & runparams, const Ins
// Deal with each subfigure individually. This should also deal with their caption and their label.
// This should be a recursive call to InsetFloat.
- for (const InsetBox *subfigure: subfigures) {
+ // An item in subfigure should either be an InsetBox containing an InsetFloat or directly an InsetFloat.
+ for (const InsetCollapsible *subfigure: subfigures) {
// If there is no InsetFloat in the paragraphs, output a warning.
bool foundInsetFloat = false;
- for (const auto & it : subfigure->paragraphs()) {
- for (pos_type posIn = 0; posIn < it.size(); ++posIn) {
- const Inset *inset = it.getInset(posIn);
- if (inset && dynamic_cast<const InsetFloat*>(inset)) {
- foundInsetFloat = true;
- break;
+
+ // The collapsible may already be a float (InsetFloat).
+ if (subfigure && dynamic_cast<const InsetFloat *>(subfigure))
+ foundInsetFloat = true;
+
+ // Subfigures are in boxes.
+ if (!foundInsetFloat) {
+ for (const auto &it : subfigure->paragraphs()) {
+ for (pos_type posIn = 0; posIn < it.size(); ++posIn) {
+ const Inset *inset = it.getInset(posIn);
+ if (inset && dynamic_cast<const InsetFloat *>(inset)) {
+ foundInsetFloat = true;
+ break;
+ }
}
- }
- if (foundInsetFloat)
- break;
+ if (foundInsetFloat)
+ break;
+ }
}
if (!foundInsetFloat)
@@ -673,11 +685,11 @@ void InsetFloat::docbook(XMLStream & xs, OutputParams const & runparams) const
// The caption and the label for each subfigure is handled by recursive calls.
const InsetCaption* caption = nullptr;
const InsetLabel* label = nullptr;
- std::vector<const InsetBox *> subfigures;
+ std::vector<const InsetCollapsible *> subfigures;
auto end = paragraphs().end();
for (auto it = paragraphs().begin(); it != end; ++it) {
- std::vector<const InsetBox *> foundSubfigures = findSubfiguresInParagraph(*it);
+ std::vector<const InsetCollapsible *> foundSubfigures = findSubfiguresInParagraph(*it);
if (!foundSubfigures.empty()) {
subfigures.reserve(subfigures.size() + foundSubfigures.size());
subfigures.insert(subfigures.end(), foundSubfigures.begin(), foundSubfigures.end());
commit 41a15f7b6d7844842d3670e564403133e85f26fb
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Fri Sep 11 03:05:04 2020 +0200
DocBook: in configure.py, DeclareDocBookClass doesn't need to be checked anymore.
diff --git a/lib/configure.py b/lib/configure.py
index 35b9e51..7d996be 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -1311,7 +1311,7 @@ def _checkForClassExtension(x):
return x.strip()
def processLayoutFile(file):
- ''' process layout file and get a line of result
+ """ process layout file and get a line of result
Declare lines look like this:
@@ -1336,38 +1336,36 @@ def processLayoutFile(file):
"article" "article" "article" "false" "article.cls" "Articles"
"scrbook" "scrbook" "book (koma-script)" "false" "scrbook.cls" "Books"
"svjog" "svjour" "article (Springer - svjour/jog)" "false" "svjour.cls,svjog.clo" ""
- '''
+ """
classname = file.split(os.sep)[-1].split('.')[0]
- # return ('LaTeX', '[a,b]', 'a', ',b,c', 'article') for \DeclareLaTeXClass[a,b,c]{article}
- p = re.compile('\s*#\s*\\\\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}\s*$')
+ # return ('[a,b]', 'a', ',b,c', 'article') for \DeclareLaTeXClass[a,b,c]{article}
+ p = re.compile('\s*#\s*\\\\DeclareLaTeXClass\s*(\[([^,]*)(,.*)*])*\s*{(.*)}\s*$')
q = re.compile('\s*#\s*\\\\DeclareCategory{(.*)}\s*$')
classdeclaration = ""
categorydeclaration = '""'
for line in open(file, 'r', encoding='utf8').readlines():
res = p.match(line)
qres = q.match(line)
- if res != None:
- (classtype, optAll, opt, opt1, desc) = res.groups()
- avai = {'LaTeX': 'false', 'DocBook': 'true'}[classtype]
- if opt == None:
+ if res is not None:
+ (optAll, opt, opt1, desc) = res.groups()
+ if opt is None:
opt = classname
- prereq_latex = _checkForClassExtension(classname)
+ prereq = _checkForClassExtension(classname)
else:
prereq_list = optAll[1:-1].split(',')
prereq_list = list(map(_checkForClassExtension, prereq_list))
- prereq_latex = ','.join(prereq_list)
- prereq = {'LaTeX': prereq_latex, 'DocBook': ''}[classtype]
+ prereq = ','.join(prereq_list)
classdeclaration = ('"%s" "%s" "%s" "%s" "%s"'
- % (classname, opt, desc, avai, prereq))
+ % (classname, opt, desc, 'false', prereq))
if categorydeclaration != '""':
return classdeclaration + " " + categorydeclaration
- if qres != None:
- categorydeclaration = '"%s"' % (qres.groups()[0])
- if classdeclaration:
- return classdeclaration + " " + categorydeclaration
+ if qres is not None:
+ categorydeclaration = '"%s"' % (qres.groups()[0])
+ if classdeclaration:
+ return classdeclaration + " " + categorydeclaration
if classdeclaration:
return classdeclaration + " " + categorydeclaration
- logger.warning("Layout file " + file + " has no \DeclareXXClass line. ")
+ logger.warning("Layout file " + file + " has no \\DeclareLaTeXClass line. ")
return ""
@@ -1434,7 +1432,7 @@ def checkLatexConfig(check_config):
# Construct the list of classes to test for.
# build the list of available layout files and convert it to commands
# for chkconfig.ltx
- declare = re.compile('\\s*#\\s*\\\\Declare(LaTeX|DocBook)Class\\s*(\[([^,]*)(,.*)*\])*\\s*{(.*)}\\s*$')
+ declare = re.compile('\\s*#\\s*\\\\DeclareLaTeXClass\\s*(\[([^,]*)(,.*)*\])*\\s*{(.*)}\\s*$')
category = re.compile('\\s*#\\s*\\\\DeclareCategory{(.*)}\\s*$')
empty = re.compile('\\s*$')
testclasses = list()
@@ -1455,10 +1453,10 @@ def checkLatexConfig(check_config):
nodeclaration = True
# A class, but no category declaration. Just break.
break
- if declare.match(line) != None:
+ if declare.match(line) is not None:
decline = "\\TestDocClass{%s}{%s}" % (classname, line[1:].strip())
testclasses.append(decline)
- elif category.match(line) != None:
+ elif category.match(line) is not None:
catline = ("\\DeclareCategory{%s}{%s}"
% (classname, category.match(line).groups()[0]))
testclasses.append(catline)
commit f28c193569a8b88cbebb318c1f40c9e8d8dfe7b5
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Fri Sep 11 01:50:26 2020 +0200
DocBook: remove now useless function in configure.py.
diff --git a/lib/configure.py b/lib/configure.py
index 9f3c032..35b9e51 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -1265,26 +1265,6 @@ def checkConverterEntries():
''')
-def checkDocBook():
- ''' Check docbook '''
- path, DOCBOOK = checkProg('SGML-tools 2.x (DocBook), db2x scripts or xsltproc', ['sgmltools', 'db2dvi', 'xsltproc'],
- rc_entry = [
- r'''\converter docbook dvi "sgmltools -b dvi $$i" ""
-\converter docbook html "sgmltools -b html $$i" ""
-\converter docbook ps "sgmltools -b ps $$i" ""''',
- r'''\converter docbook dvi "db2dvi $$i" ""
-\converter docbook html "db2html $$i" ""''',
- r'''\converter docbook dvi "" ""
-\converter docbook html "" ""''',
- r'''\converter docbook dvi "" ""
-\converter docbook html "" ""'''])
- #
- if DOCBOOK:
- return ('yes', 'true', '\\def\\hasdocbook{yes}')
- else:
- return ('no', 'false', '')
-
-
def checkOtherEntries():
''' entries other than Format and Converter '''
checkProg('ChkTeX', ['chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38'],
commit 9a48c8d22b0dd2ae1d0a78af3c2c0f4e3a65c26d
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Fri Sep 11 01:28:59 2020 +0200
DocBook: fix handling of new lines and fonts.
Only the font variable was restored to the right state, not fs.
diff --git a/autotests/export/docbook/fonts_EmbeddedObjects.lyx b/autotests/export/docbook/fonts_EmbeddedObjects.lyx
new file mode 100644
index 0000000..9ea1ff1
--- /dev/null
+++ b/autotests/export/docbook/fonts_EmbeddedObjects.lyx
@@ -0,0 +1,288 @@
+#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
+% that links to image floats jumps
+% to the beginning of the float and
+% not to its caption
+\usepackage[figure]{hypcap}
+
+% the pages of the TOC are numbered roman
+% and a PDF-bookmark for the TOC is added
+\let\myTOC\tableofcontents
+\renewcommand\tableofcontents{%
+ \frontmatter
+ \pdfbookmark[1]{\contentsname}{}
+ \myTOC
+ \mainmatter }
+
+% provides caption formatting
+\usepackage[labelfont={bf,sf}]{caption}[2004/07/16]
+
+% provides commands to set caption
+% beside tables/images
+\newcommand{\TabBesBeg}[1][1.0]{%
+ \let\MyTable\table
+ \let\MyEndtable\endtable
+ \renewenvironment{table}[1]{\begin{SCtable}[#1]##1}{\end{SCtable}}}
+
+\newcommand{\TabBesEnd}{%
+ \let\table\MyTable
+ \let\endtable\MyEndtable}
+
+\newcommand{\FigBesBeg}[1][1.0]{%
+ \let\MyFigure\figure
+ \let\MyEndfigure\endfigure
+ \renewenvironment{figure}[1]{\begin{SCfigure}[#1]##1}{\end{SCfigure}}}
+
+\newcommand{\FigBesEnd}{%
+ \let\figure\MyFigure
+ \let\endfigure\MyEndfigure}
+
+% enables calculation of values,
+\usepackage{calc}
+
+% increase the bottom float placement fraction
+\renewcommand{\bottomfraction}{0.5}
+
+% avoids that floats are placed before their
+% corresponding section starts
+\let\mySection\section\renewcommand{\section}{\suppressfloats[t]\mySection}
+
+% speed up the longtable calculation
+\setcounter{LTchunksize}{100}
+
+% used for colored tables
+\@ifundefined{textcolor}
+ {\usepackage{color}}{}
+\definecolor{darkgreen}{cmyk}{0.5, 0, 1, 0.5}
+\definecolor{lightgrey}{gray}{0.8}
+
+% check for package colortbl
+% used for colored table cells
+\newboolean{colortbl}
+\IfFileExists{colortbl.sty}
+ {\usepackage{colortbl}
+ \setboolean{colortbl}{true}}
+ {\setboolean{colortbl}{false}}
+
+% used to have extra space in table cells
+\@ifundefined{extrarowheight}
+ {\usepackage{array}}{}
+\setlength{\extrarowheight}{2pt}
+
+% used for customized tables
+% ---
+\newcolumntype{M}[1]
+ {>{\centering\hspace{0pt}}m{#1}}
+
+\newcolumntype{S}[2]
+ {>{\centering\hspace{0pt}}m{(#1+(2\tabcolsep+\arrayrulewidth)*(1-#2))/#2}}
+
+\newcolumntype{K}[1]
+ {>{\columncolor{#1}\hspace{0pt}}c}
+
+\newcolumntype{V}{!{\vrule width 1.5pt}}
+
+\newcolumntype{W}{!{\color{green}\vline}}
+% ---
+
+% insert additional vertical space of
+% 1.5 mm between footnotes
+\let\myFoot\footnote
+\renewcommand{\footnote}[1]{\myFoot{#1\vspace{1.5mm}}}
+
+% number algorithm floats within chapters
+\numberwithin{algorithm}{chapter}
+
+% ------------------------------------
+% used to check for needed LaTeX packages
+\usepackage{ifthen}
+
+% check for package arydshln
+% used for tables with dashed lines
+\newboolean{arydshln}
+\IfFileExists{arydshln.sty}
+ {\usepackage{arydshln}
+ \setboolean{arydshln}{true}}
+ {\setboolean{arydshln}{false}}
+
+% check for package marginnote
+% used for margin notes
+\newboolean{marginnote}
+\IfFileExists{marginnote.sty}
+ {\usepackage{marginnote}
+ \let\marginpar\marginnote
+ \setboolean{marginnote}{true}}
+ {\setboolean{marginnote}{false}}
+
+% check for package sidecap
+% used for captions on the side
+\newboolean{sidecap}
+\IfFileExists{sidecap.sty}
+ {\usepackage{sidecap}
+ \setboolean{sidecap}{true}}
+ {\setboolean{sidecap}{false}}
+
+% check for picinpar
+% used for surrounded fixed objects
+\newboolean{picinpar}
+\IfFileExists{picinpar.sty}
+ {\usepackage{picinpar}
+ \setboolean{picinpar}{true}}
+ {\setboolean{picinpar}{false}}
+
+% check for lettrine
+\newboolean{lettrine}
+\IfFileExists{lettrine.sty}
+ {\usepackage{lettrine}
+ \setboolean{lettrine}{true}}
+ {\setboolean{lettrine}{false}}
+
+% check for diagbox
+\newboolean{diagbox}
+\IfFileExists{diagbox.sty}
+ {\usepackage{diagbox}
+ \setboolean{diagbox}{true}}
+ {\setboolean{diagbox}{false}}
+% Added by lyx2lyx
+\setlength{\parskip}{\medskipamount}
+\setlength{\parindent}{0pt}
+\end_preamble
+\options bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading,dvipsnames,table
+\use_default_options false
+\begin_modules
+initials
+graphicboxes
+varwidth
+\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 makeindex
+\paperfontsize 12
+\spacing single
+\use_hyperref true
+\pdf_title "LyX's Figure, Table, Floats, Notes, and Boxes manual"
+\pdf_author "LyX Team, Uwe Stöhr"
+\pdf_subject "LyX-documentation about figures, tables, floats, notes, and boxes"
+\pdf_keywords "LyX, Tables, Figures, Floats, Boxes, Notes"
+\pdf_bookmarks true
+\pdf_bookmarksnumbered true
+\pdf_bookmarksopen true
+\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 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 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 0
+\math_numbering_side default
+\quotes_style english
+\dynamic_quotes 0
+\papercolumns 1
+\papersides 2
+\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
+\SpecialChar LyX
+'s detailed Figure, Table, Floats, Notes, Boxes and External Material manual
+\end_layout
+
+\begin_layout Chapter
+Floats
+\end_layout
+
+\begin_layout Standard
+can be created using these commands in the document preamble:
+\end_layout
+
+\begin_layout Standard
+
+\series bold
+
+\backslash
+usepackage[tableposition=top]{caption}
+\series default
+
+\begin_inset Newline newline
+\end_inset
+
+
+\series bold
+
+\backslash
+captionsetup[figure]{labelfont={tt}, textfont=it, indention=1cm,%
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/fonts_EmbeddedObjects.xml b/autotests/export/docbook/fonts_EmbeddedObjects.xml
new file mode 100644
index 0000000..7ce65a1
--- /dev/null
+++ b/autotests/export/docbook/fonts_EmbeddedObjects.xml
@@ -0,0 +1,12 @@
+<?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">
+<title>LyX's detailed Figure, Table, Floats, Notes, Boxes and External Material manual</title>
+<chapter>
+<title>Floats</title>
+<para>can be created using these commands in the document preamble:</para>
+<para><emphasis role='bold'>\usepackage[tableposition=top]{caption}</emphasis></para>
+<para><emphasis role='bold'>\captionsetup[figure]{labelfont={tt}, textfont=it, indention=1cm,%</emphasis></para>
+</chapter>
+</book>
\ No newline at end of file
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index a409d20..8da67e3 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3350,6 +3350,7 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
vector<xml::EndFontTag> tagsToClose;
std::vector<docstring> generatedParagraphs;
+ DocBookFontState old_fs = fs;
odocstringstream os;
auto * xs = new XMLStream(os); // XMLStream has no copy constructor: to create a new object, the only solution
// is to hold a pointer to the XMLStream (xs = XMLStream(os) is not allowed once the first object is built).
@@ -3369,8 +3370,10 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
os = odocstringstream();
delete xs;
xs = new XMLStream(os);
- if (!ignore_fonts)
+ if (!ignore_fonts) {
font_old = outerfont.fontInfo();
+ fs = old_fs;
+ }
}
// Determine which tags should be opened or closed regarding fonts.
commit 5f0720e9475daa2ce865fc641a4e97d94b4b36a1
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Fri Sep 11 00:44:49 2020 +0200
XHTML: fix generation of many useless </section>.
diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp
index 7d9a69b..f8cd53e 100644
--- a/src/output_xhtml.cpp
+++ b/src/output_xhtml.cpp
@@ -611,20 +611,26 @@ void xhtmlParagraphs(Text const & text,
// Think about adding <section> and/or </section>s.
if (style.category() == from_utf8("Sectioning")) {
+ int level = style.toclevel;
+
// Need to close a previous section if it has the same level or a higher one (close <section> if opening a
- // <h2> after a <h2>, <h3>, <h4>, <h5>, or <h6>). More examples:
+ // <h2> after a <h2>, <h3>, <h4>, <h5> or <h6>). More examples:
// - current: h2; back: h1; do not close any <section>
// - current: h1; back: h2; close two <section> (first the <h2>, then the <h1>, so a new <h1> can come)
- // The level (h1, h2, etc.) corresponds to style.toclevel.
- while (! headerLevels.empty() && style.toclevel <= headerLevels.top()) {
+ while (!headerLevels.empty() && level <= headerLevels.top()) {
+ // Output the tag only if it corresponds to a legit section.
+ int stackLevel = headerLevels.top();
+ if (stackLevel != Layout::NOT_IN_TOC && level > 1) { // <h1> is the document title.
+ xs << xml::EndTag("section");
+ xs << xml::CR();
+ }
headerLevels.pop();
- xs << xml::EndTag("section");
- xs << xml::CR();
}
- // Open the new one.
- headerLevels.push(style.toclevel);
- if (style.toclevel > 1) { // <h1> is the document title.
+ // Open the new section: first push it onto the stack, then output it in XHTML.
+ headerLevels.push(level);
+ // Some sectioning-like elements should not be output (such as FrontMatter).
+ if (level != Layout::NOT_IN_TOC && level > 1) { // <h1> is the document title.
xs << xml::StartTag("section");
xs << xml::CR();
}
@@ -669,9 +675,11 @@ void xhtmlParagraphs(Text const & text,
// If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning
// of the loop).
- while (! headerLevels.empty() && headerLevels.top() > 1) {
+ while (!headerLevels.empty() && headerLevels.top() > Layout::NOT_IN_TOC) {
+ docstring tag = from_utf8("</section>");
headerLevels.pop();
- xs << xml::EndTag("section") << xml::CR();
+ xs << XMLStream::ESCAPE_NONE << tag;
+ xs << xml::CR();
}
}
commit faec7838222e5314ade3d89a3fadce731b93d759
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Fri Sep 11 00:39:41 2020 +0200
XML: bad fix for a crash that only happened in XHTML.
As an error is output, I suppose that this behaviour is OK.
diff --git a/src/xml.cpp b/src/xml.cpp
index 8e936f8..dda39a4 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -477,7 +477,8 @@ XMLStream &XMLStream::operator<<(xml::EndTag const &etag)
+ "' when other tags were pending. Last pending tag is `"
+ to_utf8(pending_tags_.back()->writeTag())
+ "'. Tag discarded.");
- pending_tags_.erase(dit);
+ if (!pending_tags_.empty())
+ pending_tags_.erase(dit);
return *this;
}
}
commit a632a9ae3cc6e8be411b84d8bc25b54b4ae2f140
Author: Scott Kostyshak <skostysh at lyx.org>
Date: Wed Sep 2 22:48:23 2020 -0400
DocBook: remove useless functions.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index ce7e641..1e804ee 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -347,30 +347,6 @@ void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpa
}
-void openLabelTag(XMLStream & xs, Layout const & lay) // Mostly for definition lists.
-{
- openTag(xs, lay.docbookitemlabeltag(), lay.docbookitemlabelattr(), lay.docbookitemlabeltagtype());
-}
-
-
-void closeLabelTag(XMLStream & xs, Layout const & lay)
-{
- closeTag(xs, lay.docbookitemlabeltag(), lay.docbookitemlabeltagtype());
-}
-
-
-void openItemTag(XMLStream & xs, Layout const & lay)
-{
- openTag(xs, lay.docbookitemtag(), lay.docbookitemattr(), lay.docbookitemtagtype());
-}
-
-
-void closeItemTag(XMLStream & xs, Layout const & lay)
-{
- closeTag(xs, lay.docbookitemtag(), lay.docbookitemtagtype());
-}
-
-
ParagraphList::const_iterator makeAny(Text const &,
Buffer const &,
XMLStream &,
@@ -656,17 +632,17 @@ ParagraphList::const_iterator makeListEnvironment(Text const &text,
if (style.labeltype != LABEL_NO_LABEL && style.docbookitemlabeltag() != "NONE") {
if (style.labeltype == LABEL_MANUAL) {
// Only variablelist gets here (or similar items defined as an extension in the layout).
- openLabelTag(xs, style);
+ openTag(xs, style.docbookitemlabeltag(), style.docbookitemlabelattr(), style.docbookitemlabeltagtype());
sep = 1 + par->firstWordDocBook(xs, runparams);
- closeLabelTag(xs, style);
+ closeTag(xs, style.docbookitemlabeltag(), style.docbookitemlabeltagtype());
} else {
// Usual cases: maybe there is something specified at the layout level. Highly unlikely, though.
docstring const lbl = par->params().labelString();
if (!lbl.empty()) {
- openLabelTag(xs, style);
+ openTag(xs, style.docbookitemlabeltag(), style.docbookitemlabelattr(), style.docbookitemlabeltagtype());
xs << lbl;
- closeLabelTag(xs, style);
+ closeTag(xs, style.docbookitemlabeltag(), style.docbookitemlabeltagtype());
}
}
}
commit 1a76fb9658cd26db9c224c0560905e6150b10efb
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Thu Sep 3 01:23:20 2020 +0200
DocBook: avoid using isspace in StartTag::writeTag.
This is the cause of crashes (on both Windows and Linux).
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index addf24a..ce7e641 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -429,16 +429,6 @@ void makeBibliography(
}
-bool isNotOnlySpace(docstring const & str)
-{
- for (auto const & c: str) {
- if (c != ' ' && c != '\t' && c != '\n' && c != '\v' && c != '\f' && c != '\r')
- return true;
- }
- return false;
-}
-
-
void makeParagraph(
Text const & text,
Buffer const & buf,
@@ -531,7 +521,7 @@ void makeParagraph(
++nextpar;
auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0, nextpar == end, special_case);
for (docstring const & parXML : pars) {
- if (isNotOnlySpace(parXML)) {
+ if (xml::isNotOnlySpace(parXML)) {
if (open_par)
openParTag(xs, &*par, prevpar);
diff --git a/src/xml.cpp b/src/xml.cpp
index dd9790f..8e936f8 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -108,12 +108,9 @@ docstring StartTag::writeTag() const
{
docstring output = '<' + tag_;
if (!attr_.empty()) {
- docstring attributes = xml::escapeString(attr_, XMLStream::ESCAPE_NONE);
- attributes.erase(attributes.begin(), std::find_if(attributes.begin(), attributes.end(),
- [](int c) {return !std::isspace(c);}));
- if (!attributes.empty()) {
+ docstring attributes = xml::trimLeft(xml::escapeString(attr_, XMLStream::ESCAPE_NONE));
+ if (!attributes.empty())
output += ' ' + attributes;
- }
}
output += ">";
return output;
@@ -601,6 +598,28 @@ docstring xml::uniqueID(docstring const & label)
}
+bool xml::isNotOnlySpace(docstring const & str)
+{
+ for (auto const & c: str) {
+ if (c != ' ' && c != '\t' && c != '\n' && c != '\v' && c != '\f' && c != '\r')
+ return true;
+ }
+ return false;
+}
+
+
+docstring xml::trimLeft(docstring const & str)
+{
+ size_t i = 0;
+ for (auto const & c: str) {
+ if (c != ' ' && c != '\t' && c != '\n' && c != '\v' && c != '\f' && c != '\r')
+ return str.substr(i, docstring::npos);
+ i++;
+ }
+ return str;
+}
+
+
docstring xml::cleanID(docstring const & orig)
{
// The standard xml:id only allows letters, digits, '-' and '.' in a name.
diff --git a/src/xml.h b/src/xml.h
index 52eeb22..d5b4233 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -160,6 +160,12 @@ docstring cleanID(docstring const &orig);
/// returns a unique numeric ID
docstring uniqueID(docstring const & label);
+/// determines whether a string only contains space characters
+bool isNotOnlySpace(docstring const & str);
+
+/// trims the string to the left, i.e. remove any space-like character at the beginning of the string
+docstring trimLeft(docstring const & str);
+
struct FontTag;
struct EndFontTag;
commit 2cd7a94f8b31f1b59d002c4861585c32059c4269
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Thu Sep 3 00:48:55 2020 +0200
DocBook: introduce Floating::docbookFloatType.
This ensures that all comparisons for DocBook are made on the same normalised version of the float type. This cased a strange bug where <table> was output within <informaltable> for Linguistics Tableaux.
diff --git a/autotests/export/docbook/Linguistics.xml b/autotests/export/docbook/Linguistics.xml
index 688ee2d..e7d7875 100644
--- a/autotests/export/docbook/Linguistics.xml
+++ b/autotests/export/docbook/Linguistics.xml
@@ -140,7 +140,6 @@ EndPreamble</programlisting>
<para>Wenn Sie allerdings Ihre Tableaux durch das Dokument hindurch nummerieren und ein eigenes Tableaux-Verzeichnis einrichten möchten, reichen die Bordmittel von LyX nicht aus. Auch hier hilft das Linguistikmodul. Wenn es ausgewählt ist, finden Sie unter <emphasis role='sans'>Einfügen⇒Gleitobjekte</emphasis> zusätzlich ein Tableau-Gleitobjekt (siehe Tableau <xref linkend="tab.Beispiel-Tableau" /> für ein Beispiel).</para>
<table xml:id="tab.Beispiel-Tableau">
<caption>Beispiel-Tableau</caption>
-<informaltable>
<tbody>
<tr>
<td align='right' valign='top'>/atikap/</td>
@@ -205,7 +204,6 @@ EndPreamble</programlisting>
<td align='center' valign='top'></td>
</tr>
</tbody>
-</informaltable>
</table>
<para>Bitte beachten Sie, dass die Legende in der Standardeinstellung immer unter dem Tableau ausgegeben wird, egal, wohin Sie sie im LyX-Arbeitsfenster setzen. Um die Legende über das Tableau zu setzen, müssen Sie den folgenden Code in <emphasis role='sans'>Dokument⇒Einstellungen⇒Präambel </emphasis>eingeben:</para>
diff --git a/src/Floating.cpp b/src/Floating.cpp
index 7ee042c..6ae52b4 100644
--- a/src/Floating.cpp
+++ b/src/Floating.cpp
@@ -44,6 +44,25 @@ Floating::Floating(string const & type, string const & placement,
{}
+std::string Floating::docbookFloatType() const
+{
+ // TODO: configure this in the layouts?
+ if (floattype_ == "figure") {
+ return "figure";
+ } else if (floattype_ == "table" || floattype_ == "tableau") {
+ return "table";
+ } else if (floattype_ == "algorithm") {
+ // TODO: no good translation for now! Figures are the closest match, as they can contain text.
+ // Solvable as soon as https://github.com/docbook/docbook/issues/157 has a definitive answer.
+ return "algorithm";
+ } else {
+ // If nothing matches, return something that will not be valid.
+ LYXERR0("Unrecognised float type: " + floattype_);
+ return "unknown";
+ }
+}
+
+
string const & Floating::htmlAttrib() const
{
if (html_attrib_.empty())
@@ -91,17 +110,17 @@ string const & Floating::docbookAttr() const
string Floating::docbookTag(bool hasTitle) const
{
// TODO: configure this in the layouts?
- if (floattype_ == "figure") {
+ if (docbookFloatType() == "figure") {
return hasTitle ? "figure" : "informalfigure";
- } else if (floattype_ == "table" || floattype_ == "tableau") {
+ } else if (docbookFloatType() == "table") {
return hasTitle ? "table" : "informaltable";
- } else if (floattype_ == "algorithm") {
+ } else if (docbookFloatType() == "algorithm") {
// TODO: no good translation for now! Figures are the closest match, as they can contain text.
// Solvable as soon as https://github.com/docbook/docbook/issues/157 has a definitive answer.
return "figure";
} else {
// If nothing matches, return something that will not be valid.
- LYXERR0("Unrecognised float type: " + floattype_);
+ LYXERR0("Unrecognised float type: " + floattype());
return "float";
}
}
diff --git a/src/Floating.h b/src/Floating.h
index 46816af..0a2eb50 100644
--- a/src/Floating.h
+++ b/src/Floating.h
@@ -44,6 +44,8 @@ public:
///
std::string const & floattype() const { return floattype_; }
///
+ std::string docbookFloatType() const;
+ ///
std::string const & placement() const { return placement_; }
///
std::string const & ext() const {return ext_; }
diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp
index 86bcf9d..981ba40 100644
--- a/src/insets/InsetFloat.cpp
+++ b/src/insets/InsetFloat.cpp
@@ -639,7 +639,7 @@ void docbookNoSubfigures(XMLStream & xs, OutputParams const & runparams, const I
// captions, they cannot appear at the end of the float, albeit LyX is happy with that).
OutputParams rpNoTitle = runparams;
rpNoTitle.docbook_in_float = true;
- if (ftype.floattype() == "table")
+ if (ftype.docbookFloatType() == "table")
rpNoTitle.docbook_in_table = true;
// Organisation: <float> <title if any/> <contents without title/> </float>.
commit 8ed8d36595617e20d7994346ad54aa0e50b36ec3
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Thu Sep 3 00:37:52 2020 +0200
Fix two warnings in BufferView.
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 75d8a4e..e75bc5e 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -947,7 +947,7 @@ bool BufferView::scrollToCursor(DocIterator const & dit, bool const recenter)
TextMetrics & tm = d->text_metrics_[bot.text()];
pos_type const max_pit = pos_type(bot.text()->paragraphs().size() - 1);
- int bot_pit = bot.pit();
+ pos_type bot_pit = bot.pit();
if (bot_pit > max_pit) {
// FIXME: Why does this happen?
LYXERR0("bottom pit is greater that max pit: "
commit 40f4da3c9f2ea863d3fe979000bfa095a75e88de
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Thu Sep 3 00:23:31 2020 +0200
DocBook: floats can no more override DocBookTag.
This lead to a quite subtle bug. The major problem is that float tags
depend on whether the LyX float has a title (formal) or nor (informal).
This information cannot be encoded in the layout format as easily as a
simple DocBookTag.
diff --git a/src/Floating.cpp b/src/Floating.cpp
index fe3c72c..7ee042c 100644
--- a/src/Floating.cpp
+++ b/src/Floating.cpp
@@ -30,7 +30,7 @@ Floating::Floating(string const & type, string const & placement,
string const & listName, std::string const & listCmd,
string const & refPrefix, std::string const & allowedplacement,
string const & htmlTag, string const & htmlAttrib,
- docstring const & htmlStyle, string const & docbookTag,
+ docstring const & htmlStyle,
string const & docbookAttr, string const & docbookTagType,
string const & required, bool usesfloat, bool ispredefined,
bool allowswide, bool allowssideways)
diff --git a/src/Floating.h b/src/Floating.h
index 977958b..46816af 100644
--- a/src/Floating.h
+++ b/src/Floating.h
@@ -37,7 +37,7 @@ public:
std::string const & listName, std::string const & listCmd,
std::string const & refPrefix, std::string const & allowedplacement,
std::string const & htmlType, std::string const & htmlClass,
- docstring const & htmlStyle, std::string const & docbookTag,
+ docstring const & htmlStyle,
std::string const & docbookAttr, std::string const & docbookTagType,
std::string const & required, bool usesfloat, bool isprefined,
bool allowswide, bool allowssideways);
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 900d6b2..2c467b6 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -1574,7 +1574,7 @@ bool TextClass::readFloat(Lexer & lexrc)
}
Floating fl(type, placement, ext, within, style, name,
listname, listcommand, refprefix, allowed_placement,
- htmltag, htmlattr, htmlstyle, docbooktag, docbookattr,
+ htmltag, htmlattr, htmlstyle, docbookattr,
docbooktagtype, required, usesfloat, ispredefined,
allowswide, allowssideways);
floatlist_.newFloat(fl);
commit 08a58242c157868efc5b3d52577e09f898725198
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Wed Sep 2 00:46:08 2020 +0200
DocBook: better output with the Linguistics module.
One issue left: <table> output within an <informaltable>, that does not make sense... I'm debugging it.
diff --git a/autotests/export/docbook/Linguistics.lyx b/autotests/export/docbook/Linguistics.lyx
new file mode 100644
index 0000000..39978c3
--- /dev/null
+++ b/autotests/export/docbook/Linguistics.lyx
@@ -0,0 +1,3209 @@
+#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
+%% Kommentieren Sie das Folgende aus, um Tableaux-Ãberschriften zu erzeugen:
+%\floatstyle{plaintop}
+%\restylefloat{tableau}
+
+% Rückwärtskompatibilität zu forest 1.x
+% Wenn Sie forest 2.0.1 oder neuer verwenden,
+% können Sie das Folgende löschen.
+\@ifpackageloaded{forest}{%
+ \@ifpackagelater{forest}{2016/02/20}{}{%
+ \forestset{
+ roof/.style={edge path={\noexpand\path[\forestoption{edge}]%
+ (.north west)--(!u.south)--(.north east)--cycle
+ \forestoption{edge label};
+ }
+ },
+ sn edges/.style={
+ for tree={parent anchor=south, child anchor=north},
+ },
+ linguistics preamble/.style={sn edges, baseline, for tree={align=center}}
+ }
+ \preto\forest at do{%
+ \forestOpreto{\forest at root}{given options}{linguistics preamble,}%
+ }
+ }
+}{}
+
+% Trennausnahmen
+\hyphenation{Dis-kurs-reprä-sen-ta-tions-struk-tur}
+\end_preamble
+\use_default_options false
+\begin_modules
+linguistics
+\end_modules
+\maintain_unincluded_children no
+\language ngerman
+\language_package default
+\inputencoding utf8
+\fontencoding auto
+\font_roman "lmodern" "FreeSerif"
+\font_sans "default" "FreeSans"
+\font_typewriter "default" "FreeMono"
+\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 false
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\float_placement class
+\float_alignment class
+\paperfontsize default
+\spacing single
+\use_hyperref true
+\pdf_bookmarks true
+\pdf_bookmarksnumbered false
+\pdf_bookmarksopen false
+\pdf_bookmarksopenlevel 1
+\pdf_breaklinks false
+\pdf_pdfborder true
+\pdf_colorlinks false
+\pdf_backref false
+\pdf_pdfusetitle true
+\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 false
+\paperorientation portrait
+\suppress_date false
+\justification true
+\use_refstyle 0
+\use_minted 0
+\use_lineno 0
+\index Stichwortverzeichnis
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\is_math_indent 0
+\math_numbering_side default
+\quotes_style german
+\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
+Linguistische Arbeiten mit \SpecialChar LyX
+
+\end_layout
+
+\begin_layout Author
+Jürgen Spitzmüller
+\begin_inset Newline newline
+\end_inset
+
+
+\begin_inset CommandInset href
+LatexCommand href
+target "spitz at lyx.org"
+type "mailto:"
+literal "false"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Date
+21.04.2015
+\end_layout
+
+\begin_layout Abstract
+In diesem Text werden einige Funktionen von \SpecialChar LyX
+ vorgestellt, die spezifisch
+ auf die Bedürfnisse von Linguistinnen und Linguisten ausgerichtet sind.
+ Es wird gezeigt, wie nummerierte Beispiele, Interlinear-Glossierung, OT-Tableau
+x, semantische Auszeichnung, Strukturbäume, Diskursrepräsentationsstrukturen
+ und phonetische Notation (IPA) erzeugt werden können.
+\end_layout
+
+\begin_layout Section
+Voraussetzungen und Ziele
+\end_layout
+
+\begin_layout Standard
+Die meisten der hier beschriebenen Funktionen werden vom
+\begin_inset Quotes gld
+\end_inset
+
+Linguistik
+\begin_inset Quotes grd
+\end_inset
+
+-Modul bereitgestellt, das seit Version 1.6.0 mit \SpecialChar LyX
+ mitgeliefert wird.
+
+\begin_inset Quotes gld
+\end_inset
+
+Module
+\begin_inset Quotes grd
+\end_inset
+
+ â das Konzept wurde ebenfalls mit \SpecialChar LyX
+ 1.6.0 eingeführt â sind Ergänzungsdateien,
+ welche die von der Dokumentklasse bereitgestellten Möglichkeiten zumeist
+ für sehr spezifische Aufgaben erweitern und die für jedes Dokument (egal
+ welcher Klasse) einfach ausgewählt werden können.
+ Um das Linguistik-Modul zu verwenden, gehen sie zu
+\family sans
+Dokument\SpecialChar menuseparator
+Einstellungen\SpecialChar menuseparator
+Module
+\family default
+, wählen Sie
+\begin_inset Quotes gld
+\end_inset
+
+Linguistik
+\begin_inset Quotes grd
+\end_inset
+
+ aus der Liste der verfügbaren Module und drücken auf den Knopf
+\family sans
+Hinzufügen
+\family default
+ (so wie es für dieses Dokument bereits getan wurde).
+\end_layout
+
+\begin_layout Standard
+Grundsätzlich sollte das Modul in jeder von \SpecialChar LyX
+ unterstützten Dokumentklasse
+ funktionieren (falls nicht, informieren Sie bitte den Autor dieses Textes).
+ Allerdings müssen Sie, um alle Features nutzen zu können, die folgenden
+ \SpecialChar LaTeX
+-Pakete installiert haben:
+\end_layout
+
+\begin_layout Enumerate
+
+\emph on
+covington.sty
+\emph default
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "covington"
+literal "true"
+
+\end_inset
+
+: Dieses Paket wird benötigt, um nummerierte Beispiele, Glossen und semantische
+ Auszeichnungen zu erzeugen.
+ Beachten Sie, dass mindestens Version 2.3 des Pakets erforderlich ist, um
+ alle Funktionen zu nutzen.
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+Auf Ihrem System installiert:
+\begin_inset Info
+type "package"
+arg "covington"
+\end_inset
+
+.
+\end_layout
+
+\end_deeper
+\begin_layout Enumerate
+
+\emph on
+csquotes.sty
+\emph default
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "csquotes"
+literal "true"
+
+\end_inset
+
+: Voraussetzung für den Textstil
+\emph on
+Bedeutung
+\emph default
+ und für Glossen.
+ Das Paket erlaubt es, kontextsensible Anführungszeichen zu generieren (bspw.
+ je nach aktuell verwendeter Sprache).
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+Auf Ihrem System installiert:
+\begin_inset Info
+type "package"
+arg "csquotes"
+\end_inset
+
+.
+\end_layout
+
+\end_deeper
+\begin_layout Enumerate
+
+\emph on
+drs.sty
+\emph default
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "drs"
+literal "true"
+
+\end_inset
+
+: Voraussetzung für Diskursrepräsentationsstrukturen.
+ Beachten Sie, dass mindestens Version 2.3 des Pakets
+\emph on
+covington
+\emph default
+ erforderlich ist, um dies mit anderen Funktionen gemeinsam zu nutzen.
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+Auf Ihrem System installiert:
+\begin_inset Info
+type "package"
+arg "drs"
+\end_inset
+
+.
+\end_layout
+
+\end_deeper
+\begin_layout Enumerate
+
+\emph on
+float.sty
+\emph default
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "float"
+literal "true"
+
+\end_inset
+
+: Dieses Paket brauchen wir für die OT-Tableaux und das Tableaux-Verzeichnis.
+ Es sollte Bestandteil jeder \SpecialChar LaTeX
+-Distribution sein.
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+Auf Ihrem System installiert:
+\begin_inset Info
+type "package"
+arg "float"
+\end_inset
+
+.
+\end_layout
+
+\end_deeper
+\begin_layout Enumerate
+
+\emph on
+forest.sty
+\emph default
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "forest"
+literal "true"
+
+\end_inset
+
+: Dieses Paket wird zur Erzeugung von Strukturbäumen verwendet.
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+Auf Ihrem System installiert:
+\begin_inset Info
+type "package"
+arg "forest"
+\end_inset
+
+.
+\end_layout
+
+\end_deeper
+\begin_layout Enumerate
+
+\emph on
+pict2e.sty
+\emph default
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "pict2e"
+literal "true"
+
+\end_inset
+
+: Voraussetzung für
+\emph on
+Duplex-Bedingungs-DRS
+\emph default
+.
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+Auf Ihrem System installiert:
+\begin_inset Info
+type "package"
+arg "pict2e"
+\end_inset
+
+.
+\end_layout
+
+\end_deeper
+\begin_layout Section
+Nummerierte Beispiele
+\end_layout
+
+\begin_layout Standard
+Nummerierte Beispiele werden über die Absatzstil-Auswahlliste in der Werkzeuglei
+ste eingefügt.
+ Es gibt drei Varianten:
+\end_layout
+
+\begin_layout Numbered Example (multiline)
+Das ist ein mehrzeiliges Beispiel [Stil
+\emph on
+Nummeriertes Beispiel (mehrere Zeilen)
+\emph default
+]
+\end_layout
+
+\begin_layout Numbered Example (multiline)
+Wie der Name sagt, kann es mehrere Absätze enthalten
+\end_layout
+
+\begin_layout Numbered Examples (consecutive)
+Das ist ein einzeiliges Beispiel
+\begin_inset CommandInset label
+LatexCommand label
+name "exa:Beispiel-einzeilig"
+
+\end_inset
+
+ [Stil
+\emph on
+Nummeriertes Beispiel (konsekutiv)
+\emph default
+]
+\end_layout
+
+\begin_layout Numbered Examples (consecutive)
+Jeder Absatz wird in diesem Stil neu nummeriert
+\end_layout
+
+\begin_layout Subexample
+Dies ist ein Unterbeispiel
+\begin_inset CommandInset label
+LatexCommand label
+name "subsec:Unterbeispiel"
+
+\end_inset
+
+ [Stil
+\emph on
+Unterbeispiel
+\emph default
+]
+\end_layout
+
+\begin_layout Subexample
+Und hier noch eines
+\end_layout
+
+\begin_layout Standard
+Querverweise auf Beispiele erzeugen Sie wie gewohnt: Sie fügen im Beispiel
+ eine Marke ein, und an der Stelle, an der der Querverweis erscheinen soll,
+ einen Verweis mittels
+\family sans
+Einfügen\SpecialChar menuseparator
+Querverweis\SpecialChar ldots
+
+\family default
+
+\end_layout
+
+\begin_layout Standard
+Als kleine Demonstration verweisen wir hier auf die Beispiele
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "exa:Beispiel-einzeilig"
+
+\end_inset
+
+ und
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "subsec:Unterbeispiel"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+Wenn Sie die Nummerierung für einzelne Beispiele ändern möchten, verwenden
+ Sie
+\family sans
+Einfügen\SpecialChar menuseparator
+Benutzerdef.
+ Nummerierung
+\family default
+.
+ Für globale Anpassungen bietet
+\emph on
+covington
+\emph default
+ selbst Möglichkeiten.
+ Bitte konsultieren Sie das Handbuch des Pakets
+\begin_inset CommandInset citation
+LatexCommand cite
+key "covington"
+literal "false"
+
+\end_inset
+
+ für Einzelheiten.
+\end_layout
+
+\begin_layout Standard
+Ab Version 2.3 bietet
+\emph on
+covingtons
+\emph default
+ subexamples-Umgebung ein optionales Argument (mit dem man Text zwischen
+ der Hauptnummer und dem ersten Unterbeispiel einfügen kann).
+ Dieses können Sie über
+\family sans
+Einfügen\SpecialChar menuseparator
+Optionen für Unterbeispiele
+\family default
+ eingeben.
+ Bitte konsultieren Sie auch hier das Handbuch des Pakets
+\begin_inset CommandInset citation
+LatexCommand cite
+key "covington"
+literal "false"
+
+\end_inset
+
+ für Einzelheiten.
+\end_layout
+
+\begin_layout Section
+Interlinear-Glossierung
+\end_layout
+
+\begin_layout Standard
+Das Linguistikmodul stellt zwei Arten von Glossen zur Verfügung.
+ Beide sind über
+\family sans
+Einfügen\SpecialChar menuseparator
+Spezifische Einfügung
+\family default
+ zugänglich.
+ Die
+\emph on
+Interlinear-Glosse (2
+\begin_inset space ~
+\end_inset
+
+Zeilen)
+\emph default
+ besteht aus zwei Zeilen für das Glossenpaar (bestehend aus der Darstellung
+ in der zu beschreibenden Sprache und einer interlinearen Wort-zu-Wort-Ãbersetzu
+ng) sowie einer weiteren Zeile für die freie Ãbersetzung, die
+\emph on
+Interlinear-Glosse (3
+\begin_inset space ~
+\end_inset
+
+Zeilen)
+\emph default
+ bietet eine zusätzliche Zeile für Interlinear-Glossierung (diese dritte
+ Zeile wird zumeist für morphologische oder phonologische Angaben verwendet).
+ Die freie Ãbersetzung kann länger sein als eine Zeile, sie wird dann einfach
+ automatisch und korrekt umbrochen.
+ Die Version in der zu beschreibenden Sprache (erste Zeile der Glosse) wird
+ direkt in die Glosse-Einfügung geschrieben, alle anderen Teile der Glosse
+ in spezifische Unter-Einfügungen (
+\family sans
+Interlinear-Glosse
+\family default
+, bzw.
+ mit dreizeiligen Glossen:
+\family sans
+Interlinear-Glosse (Zeile
+\begin_inset space ~
+\end_inset
+
+1)
+\family default
+ und
+\family sans
+Interlinear-Glosse (Zeile
+\begin_inset space ~
+\end_inset
+
+2)
+\family default
+, sowie
+\family sans
+Glossen-Ãbersetzung
+\family default
+).
+ \SpecialChar LyX
+ fügt diese Unter-Einfügungen automatisch ein, wenn Sie eine neue Glosse
+ einfügen.
+ Sie können aber auch manuell eingefügt werden, und zwar über
+\family sans
+Einfügen\SpecialChar menuseparator
+Glossen-Ãbersetzung
+\family default
+ und
+\family sans
+Einfügen\SpecialChar menuseparator
+Interlinear-Glosse
+\family default
+.
+ Ungeachtet wo Sie diese Untereinfügungen innerhalb der Glosse einfügen,
+ wird alles in der richtigen Reihenfolge ausgegeben.
+ SchlieÃlich können Sie über
+\family sans
+Einfügen\SpecialChar menuseparator
+Glossen-Optionen
+\family default
+ auch Glossen-Optionen eingeben.
+ Diese Optionen erlauben es Ihnen, die Darstellung der einzelnen Zeilen
+ zu verändern, eine Nummerierung oder vorangestellten Text hinzuzufügen.
+ Bitte konsultieren Sie das Handbuch des Pakets
+\emph on
+covington
+\emph default
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "covington"
+literal "false"
+
+\end_inset
+
+ für Einzelheiten.
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+Bitte beachten Sie, dass die Unterstützung für Glossen für \SpecialChar LyX
+ 2.4 komplett
+ überarbeitet wurde.
+ Nun werden die neuen und verbesserten Glossen-Makros verwendet, die
+\emph on
+covington
+\emph default
+ seit der Version 2.0 anbietet.
+ Wegen der erheblichen Veränderungen können alte Glossen leider nicht in
+ die neuen konvertiert werden.
+ Statt dessen werden sie in ihrer ursprünglichen Form importiert (und als
+
+\family sans
+Lokales Format
+\family default
+ im Dokument gespeichert).
+ Umgekehrt werden neue Glossen in \SpecialChar TeX
+-Code exportier, wenn Sie in eine ältere
+ \SpecialChar LyX
+-Version exportieren.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Hier ist ein einfaches Beispiel für eine zweizeilige Glosse:
+\end_layout
+
+\begin_layout Standard
+\begin_inset Flex Interlinear Gloss (2 Lines)
+status open
+
+\begin_layout Plain Layout
+C'est un exemple simple
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:1
+status open
+
+\begin_layout Plain Layout
+\begin_inset Flex GroupGlossedWords
+status open
+
+\begin_layout Plain Layout
+Dies ist
+\end_layout
+
+\end_inset
+
+ ein Beispiel einfach
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:2
+status open
+
+\begin_layout Plain Layout
+Dies ist ein einfaches Beispiel
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\noindent
+Verwenden Sie
+\family sans
+Bearbeiten\SpecialChar menuseparator
+Textstil\SpecialChar menuseparator
+Glossierte Wortgruppen
+\family default
+, um Mehrwortelemente zusammenzuhalten (alternativ können Sie auch im TeX-Modus
+
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+{
+\end_layout
+
+\end_inset
+
+diese Wörter geschweift einklammern
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+}
+\end_layout
+
+\end_inset
+
+).
+ Beachten Sie, dass Sie im \SpecialChar LyX
+-Fenster mehrere Leerzeichen nacheinander einfügen
+ können, um die Glossen dort schöner auszurichten.
+ Die Ausgabe wird davon nicht berührt.
+\end_layout
+
+\begin_layout Standard
+Hier ist eine dreizeilige Glosse.
+ Sie wird analog erzeugt:
+\end_layout
+
+\begin_layout Standard
+\begin_inset Flex Interlinear Gloss (3 Lines)
+status open
+
+\begin_layout Plain Layout
+Hoc est aliud exemplum
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:1
+status open
+
+\begin_layout Plain Layout
+n.sg.nom 3sg n.sg.nom n.sg.nom
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:2
+status open
+
+\begin_layout Plain Layout
+Dies ist anderes Beispiel
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:3
+status open
+
+\begin_layout Plain Layout
+Dies ist ein anderes Beispiel
+\end_layout
+
+\end_inset
+
+
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+fsii={
+\backslash
+normalfont
+\backslash
+scshape}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Beachten Sie, wie wir hier mit Hilfe der Glossen-Optionen die zweite Zeile
+ in Kapitälchen ausgeben lassen.
+\end_layout
+
+\begin_layout Standard
+\noindent
+Wenn Sie nummerierte Glossen benötigen, fügen Sie die Glosse entweder einfach
+ in einen Absatz mit dem Format
+\emph on
+Nummeriertes Beispiel
+\emph default
+ ein, so wie hier:
+\end_layout
+
+\begin_layout Numbered Examples (consecutive)
+\begin_inset Flex Interlinear Gloss (3 Lines)
+status open
+
+\begin_layout Plain Layout
+Mein Luftkissenfahrzeug ist voller Aale
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:1
+status open
+
+\begin_layout Plain Layout
+My skeertuig is vol palings
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:2
+status open
+
+\begin_layout Plain Layout
+My hovercraft is
+\begin_inset Flex GroupGlossedWords
+status open
+
+\begin_layout Plain Layout
+full of
+\end_layout
+
+\end_inset
+
+ eels
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:3
+status open
+
+\begin_layout Plain Layout
+Do you have matches?
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+oder verwenden Sie die Glossen-Option
+\emph on
+ex
+\emph default
+:
+\end_layout
+
+\begin_layout Standard
+\begin_inset Flex Interlinear Gloss (3 Lines)
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+ex
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+Mein Luftkissenfahrzeug ist voller Aale
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:1
+status open
+
+\begin_layout Plain Layout
+My skeertuig is vol palings
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:2
+status open
+
+\begin_layout Plain Layout
+My hovercraft is
+\begin_inset Flex GroupGlossedWords
+status open
+
+\begin_layout Plain Layout
+full of
+\end_layout
+
+\end_inset
+
+ eels
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:3
+status open
+
+\begin_layout Plain Layout
+Do you have matches?
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection*
+Tipps & Tricks
+\end_layout
+
+\begin_layout Subsubsection*
+Seitenumbrüche innerhalb von Glossen vermeiden
+\end_layout
+
+\begin_layout Standard
+In der Standardeinstellung können innerhalb von Glossen Seiten umbrochen
+ werden, was natürlich nicht erwünscht ist.
+ Um dies zu umgehen, können Sie in
+\family sans
+Dokument\SpecialChar menuseparator
+Einstellungen\SpecialChar ldots
+\SpecialChar menuseparator
+Dokumentklasse\SpecialChar menuseparator
+Klassenoptionen\SpecialChar menuseparator
+Benutzerdefiniert
+\family default
+ die Option
+\emph on
+noglossbreaks
+\emph default
+ eingeben; dies wird die meisten Umbrüche verhindern.
+ Wenn trotzdem welche vorkommen, können Sie Glossen in Boxen packen (über
+
+\family sans
+Einfügen\SpecialChar menuseparator
+Box\SpecialChar menuseparator
+Rahmenlos
+\family default
+).
+\end_layout
+
+\begin_layout Subsubsection*
+FuÃnoten in Glossen
+\end_layout
+
+\begin_layout Standard
+Sie können zwar eine FuÃnote in eine
+\emph on
+Glosse
+\emph default
+einfügen, dies führt aber zu einem LaTeX-Fehler.
+ Wenn Sie FuÃnoten benötigen, schreiben Sie an der Stelle, an der das FuÃnotenze
+ichen erscheinen soll, im TeX-Modus
+\family typewriter
+
+\backslash
+footnotemark
+\family default
+ in die Glosse.
+ Direkt nach (und auÃerhalb) der Glosse schreiben Sie, ebenfalls im TeX-Modus,
+\family typewriter
+
+\backslash
+footnotetext{Die FuÃnote ...}
+\family default
+.
+ Sollten Sie mehrere FuÃnoten brauchen, geben Sie einfach mehrere dieser
+ Befehlspaare ein.
+\end_layout
+
+\begin_layout Subsubsection*
+Glossen (und Beispiele) in Beamer-Präsentationen
+\end_layout
+
+\begin_layout Standard
+Wenn Sie das Linguistik-Modul in einer Beamer-Präsentation verwenden wollen,
+ beachten Sie bitte folgendes:
+\end_layout
+
+\begin_layout Itemize
+Für Glossen müssen Sie in Beamer immer einen
+\begin_inset Quotes gld
+\end_inset
+
+fragilen
+\begin_inset Quotes grd
+\end_inset
+
+ Rahmen verwenden.
+
+\end_layout
+
+\begin_layout Itemize
+Ãltere Versionen des Pakets
+\emph on
+covington
+\emph default
+ und die
+\emph on
+Beamer
+\emph default
+-Klasse arbeiten von Haus aus nicht gut zusammen, da beide die Befehle
+\family typewriter
+
+\backslash
+example
+\family default
+ und
+\family typewriter
+
+\backslash
+examples
+\family default
+ zu definieren versuchen, was in diesen älteren Versionen eine \SpecialChar LaTeX
+-Fehlermeldung
+ erzeugt, sobald sie Glossen oder Beispiele einfügen.
+ Sie können das Problem beheben, indem Sie in
+\family sans
+Dokument\SpecialChar menuseparator
+Einstellungen\SpecialChar menuseparator
+Lokales Format
+\family default
+ folgenden Code kopieren:
+\end_layout
+
+\begin_deeper
+\begin_layout Quote
+\begin_inset listings
+lstparams "basicstyle={\footnotesize\ttfamily},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+Provides covington 1
+\end_layout
+
+\begin_layout Plain Layout
+
+AddToPreamble
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
+let
+\backslash
+example
+\backslash
+relax
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
+let
+\backslash
+endexample
+\backslash
+relax
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
+let
+\backslash
+examples
+\backslash
+relax
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
+let
+\backslash
+endexamples
+\backslash
+relax
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
+usepackage{covington}
+\end_layout
+
+\begin_layout Plain Layout
+
+EndPreamble
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Drücken Sie
+\begin_inset Quotes gld
+\end_inset
+
+Validieren
+\begin_inset Quotes grd
+\end_inset
+
+ und dann
+\begin_inset Quotes gld
+\end_inset
+
+OK
+\begin_inset Quotes grd
+\end_inset
+
+.
+ Dies hat den Effekt, dass die Beispiel-Umgebungen von Beamer deaktiviert
+ werden (und also nicht mehr verwendet werden können), dafür können Sie
+ dann aber die des Linguistik-Moduls verwenden.
+\end_layout
+
+\begin_layout Standard
+Ab
+\emph on
+covington
+\emph default
+ 1.1 besteht dieses Problem nicht mehr.
+\end_layout
+
+\end_deeper
+\begin_layout Section
+Tableaux für Optimalitätstheorie
+\end_layout
+
+\begin_layout Standard
+Die OT-Tableaux selbst können natürlich einfach als normale Tabellen eingegeben
+ werden (Spezifika wie gestrichelte Tabellenlinien und schattierte Tabellenzelle
+n, die man hierfür manchmal braucht, sind in
+\family sans
+Hilfe\SpecialChar menuseparator
+Eingebettete Objekt
+\family default
+e beschrieben).
+
+\end_layout
+
+\begin_layout Standard
+Wenn Sie allerdings Ihre Tableaux durch das Dokument hindurch nummerieren
+ und ein eigenes Tableaux-Verzeichnis einrichten möchten, reichen die Bordmittel
+ von \SpecialChar LyX
+ nicht aus.
+ Auch hier hilft das Linguistikmodul.
+ Wenn es ausgewählt ist, finden Sie unter
+\family sans
+Einfügen\SpecialChar menuseparator
+Gleitobjekte
+\family default
+ zusätzlich ein Tableau-Gleitobjekt (siehe Tableau
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "tab:Beispiel-Tableau"
+
+\end_inset
+
+ für ein Beispiel).
+\end_layout
+
+\begin_layout Standard
+\begin_inset Float tableau
+placement h
+alignment document
+wide false
+sideways false
+status open
+
+\begin_layout Plain Layout
+\align center
+\begin_inset Tabular
+<lyxtabular version="3" rows="5" columns="5">
+<features tabularvalignment="middle">
+<column alignment="right" valignment="top">
+<column alignment="center" valignment="top">
+<column alignment="center" valignment="top">
+<column alignment="center" valignment="top" special="|c">
+<column alignment="center" valignment="top">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+/atikap/
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\noun on
+Onset
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\noun on
+NoCoda
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\noun on
+Dep
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\noun on
+Max
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+\begin_inset Formula $\mbox{â}$
+\end_inset
+
+
+\begin_inset Formula $\mbox{\textipa{P}}$
+\end_inset
+
+a.ti.ka
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+*
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+*
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+a.ti.ka
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+*!
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+*
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+\begin_inset Formula $\mbox{\textipa{P}}$
+\end_inset
+
+a.ti.kap
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+*!
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+*
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+a.ti.kap
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+*!
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+*!
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Caption Standard
+
+\begin_layout Plain Layout
+Beispiel-Tableau
+\begin_inset CommandInset label
+LatexCommand label
+name "tab:Beispiel-Tableau"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Bitte beachten Sie, dass die Legende in der Standardeinstellung immer unter
+ dem Tableau ausgegeben wird, egal, wohin Sie sie im \SpecialChar LyX
+-Arbeitsfenster setzen.
+ Um die Legende über das Tableau zu setzen, müssen Sie den folgenden Code
+ in
+\family sans
+Dokument\SpecialChar menuseparator
+Einstellungen\SpecialChar menuseparator
+Präambel
+\family default
+eingeben:
+\end_layout
+
+\begin_layout Quote
+\begin_inset listings
+lstparams "language={[LaTeX]TeX},basicstyle={\footnotesize\ttfamily}"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+floatstyle{plaintop}
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
+restylefloat{tableau}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Wenn Sie eine KOMA-Klasse verwenden, nehmen Sie statt dessen das Folgende
+ (welches im Kontext der KOMA-Klassen bessere Abstände erzeugt):
+\end_layout
+
+\begin_layout Quote
+\begin_inset listings
+lstparams "language={[LaTeX]TeX},basicstyle={\footnotesize\ttfamily}"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+floatstyle{komaabove}
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
+restylefloat{tableau}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Ein Verzeichnis der Tableaux geben Sie, wie bei normalen Tabellen auch,
+ über
+\family sans
+Einfügen\SpecialChar menuseparator
+Liste\SpecialChar breakableslash
+Inhaltsverzeichnis
+\family default
+ ein.
+ Dies sieht dann so aus:
+\end_layout
+
+\begin_layout Standard
+\begin_inset FloatList tableau
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Semantische Auszeichnung (Textstile)
+\end_layout
+
+\begin_layout Standard
+Das Linguistikmodul stellt einige Textstile zur Verfügung, die in linguistischen
+ Arbeiten allgemein gebräuchlich sind:
+\end_layout
+
+\begin_layout Enumerate
+Konzept (in Kapitälchen):
+\begin_inset Flex Concepts
+status collapsed
+
+\begin_layout Plain Layout
+Konzept
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Enumerate
+Ausdruck (hervorgehoben):
+\begin_inset Flex Expression
+status collapsed
+
+\begin_layout Plain Layout
+Ausdruck
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Enumerate
+Bedeutung (in einfachen Anführungszeichen):
+\begin_inset Flex Meaning
+status collapsed
+
+\begin_layout Plain Layout
+Bedeutung
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Diese Textstile finden Sie unter
+\family sans
+Bearbeiten\SpecialChar menuseparator
+Textstil
+\family default
+.
+ Der Vorteil solcher Stile gegenüber direkter Hervorhebung und Auszeichnung
+ ist vor allem der, dass sie alle (und nur die) damit markierten Textteile
+ leicht global verändern können.
+ Wenn Sie (oder Ihr Verlag) also etwa Ausdrücke doch fett gesetzt haben
+ wollen, geben Sie einfach den folgenden Code in
+\family sans
+Dokument\SpecialChar menuseparator
+Einstellungen\SpecialChar menuseparator
+Präambel
+\family default
+ ein:
+\end_layout
+
+\begin_layout Quote
+\begin_inset listings
+lstparams "language={[LaTeX]TeX},basicstyle={\footnotesize\ttfamily}"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+renewcommand
+\backslash
+lexp[1]{
+\backslash
+textbf{#1}}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Auf ähnliche Weise kann auch das Aussehen von
+\emph on
+Konzept
+\emph default
+ (
+\family typewriter
+
+\backslash
+lcon
+\family default
+) und
+\emph on
+Bedeutung
+\emph default
+ (
+\family typewriter
+
+\backslash
+lmean
+\family default
+) verändert werden.
+ Bitte konsultieren Sie das Handbuch des Pakets
+\emph on
+covington
+\emph default
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "covington"
+literal "false"
+
+\end_inset
+
+ für Einzelheiten.
+\end_layout
+
+\begin_layout Section
+Linguistische Strukturbäume
+\end_layout
+
+\begin_layout Standard
+Mittlerweile gibt es mehrere \SpecialChar LaTeX
+-Pakete, die bei der Erstellung von Strukturbäumen
+ helfen.
+ \SpecialChar LyX
+ unterstützt das Paket
+\family sans
+forest
+\family default
+, welches hohe Flexibilität und Mächtigkeit mit einer intuitiven Syntax
+ vereint.
+ Das Linguistik-Modul enthält eine Strukturbaum-Einfügung, die unter
+\family sans
+Einfügen\SpecialChar menuseparator
+Spezifische Einfügung
+\family default
+ zu finden ist.
+ Innerhalb dieser Einfügung können Sie die Klammernotation verwenden, die
+ das Paket
+\family sans
+forest
+\family default
+ (wie auch andere Pakete, z.
+\begin_inset space \thinspace{}
+\end_inset
+
+B.
+
+\family sans
+qtree
+\family default
+) anbietet.
+\end_layout
+
+\begin_layout Standard
+Hier ist ein einfaches Beispiel:
+\end_layout
+
+\begin_layout Standard
+\begin_inset Flex Structure Tree
+status open
+
+\begin_layout Plain Layout
+[VP [DP[Hans]] [V' [V[schickt]] [DP[Maria]] [DP[D[einen]][NP[Brief]]] ]
+ ]
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\noindent
+Wenn Sie die PDF-Ausgabe ansehen, sehen Sie, dass die Notation
+\end_layout
+
+\begin_layout Quote
+
+\family typewriter
+\size footnotesize
+[VP [DP[Hans]] [V' [V[schickt]] [DP[Maria]] [DP[D[einen]][NP[Brief]]]]]
+\end_layout
+
+\begin_layout Standard
+als Strukturbaum ausgegeben wird.
+ Um das Ergebnis bereits im \SpecialChar LyX
+
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+"=
+\end_layout
+
+\end_inset
+
+Eingabefenster zu sehen, können Sie die Strukturbaum-Einfügung einfach in
+ eine Vorschau-Einfügung (
+\family sans
+Einfügen\SpecialChar menuseparator
+Vorschau
+\family default
+) einbetten.
+ Wenn
+\begin_inset Quotes gld
+\end_inset
+
+Sofortige Vorschau
+\begin_inset Quotes grd
+\end_inset
+
+ richtig eingerichtet und aktiviert ist, sollten Sie den Baum sofort sehen
+ (zur Bearbeitung klicken Sie einfach auf das Bild):
+\end_layout
+
+\begin_layout Standard
+\begin_inset Preview
+
+\begin_layout Standard
+\begin_inset Flex Structure Tree
+status open
+
+\begin_layout Plain Layout
+[VP [DP[Maria]] [V' [V[schickt]] [DP[Hans]] [DP[D[eine]][NP[Antwort]]] ]
+ ]
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\noindent
+Dächer (
+\begin_inset Quotes gld
+\end_inset
+
+roofs
+\begin_inset Quotes grd
+\end_inset
+
+) können mittels der Option
+\begin_inset Quotes gld
+\end_inset
+
+roof
+\begin_inset Quotes grd
+\end_inset
+
+
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+\noindent
+Bitte beachten Sie, dass die Option
+\begin_inset Quotes gld
+\end_inset
+
+roof
+\begin_inset Quotes grd
+\end_inset
+
+ erst ab Version 2.0 des Pakets
+\family sans
+forest
+\family default
+ verfügbar ist.
+ Für frühere Versionen haben wir in den Vorspann dieses Dokuments Code eingefügt
+, die die Verwendung dennoch gestattet.
+ Wenn Ihre Version des Pakets
+\family sans
+forest
+\family default
+ kleiner ist als 2.0 und Sie
+\begin_inset Quotes gld
+\end_inset
+
+roof
+\begin_inset Quotes grd
+\end_inset
+
+ verwenden wollen, müssen Sie diesen Code in den Vorspann Ihres Dokuments
+ kopieren.
+ Statt dessen können Sie auch die alte Option
+\begin_inset Quotes gld
+\end_inset
+
+triangle
+\begin_inset Quotes grd
+\end_inset
+
+ (statt
+\begin_inset Quotes gld
+\end_inset
+
+roof
+\begin_inset Quotes grd
+\end_inset
+
+) verwenden.
+\end_layout
+
+\end_inset
+
+ erzeugt werden (beachten Sie, dass Kommata eine spezielle Bedeutung haben;
+ sie markieren Optionen):
+\end_layout
+
+\begin_layout Standard
+\begin_inset Flex Structure Tree
+status open
+
+\begin_layout Plain Layout
+[VP [DP[Hans]] [V' [V[schickt]] [DP[Maria]] [DP[einen weiteren Brief, roof]]
+ ] ]
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\noindent
+Um die Knoten des Baums besser auszurichten, verwenden Sie die Option
+\begin_inset Quotes gld
+\end_inset
+
+tier
+\begin_inset Quotes grd
+\end_inset
+
+.
+ Alle Knoten, denen dieselbe
+\begin_inset Quotes gld
+\end_inset
+
+tier
+\begin_inset Quotes grd
+\end_inset
+
+ (Ebene) zugewiesen wurde, werden in einer vertikalen Linie ausgerichtet.
+ Hier ist ein Beispiel:
+\end_layout
+
+\begin_layout Standard
+\begin_inset Flex Structure Tree
+status open
+
+\begin_layout Plain Layout
+[VP [DP[Hans, tier=word]] [V' [V[schickt, tier=word]] [DP[Maria, tier=word]]
+ [DP[D[einen, tier=word]][NP[Brief, tier=word]]] ] ]
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\noindent
+Das Paket bietet viel mehr Möglichkeiten, wie bspw.
+ Bewegungspfeile und Dekorationen.
+ Sie können hier nicht eingehend besprochen werden.
+ Bitte konsultieren Sie die ausführliche Dokumentation des Pakets
+\begin_inset CommandInset citation
+LatexCommand cite
+key "forest"
+literal "true"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Section
+Diskursrepräsentationsstrukturen
+\end_layout
+
+\begin_layout Standard
+Das Linguistik-Modul stellt auch Einfügungen zur Erzeugung von Diskursrepräsenta
+tionsstrukturen (DRSen) in der Box-Notation von
+\noun on
+Hans Kamps
+\noun default
+
+\emph on
+Diskursrepräsentationstheorie
+\emph default
+ zur Verfügung.
+ Diese Einfügungen finden Sie unter
+\family sans
+Einfügen\SpecialChar menuseparator
+Spezifische Einfügung
+\family default
+.
+\end_layout
+
+\begin_layout Standard
+Eine einfache DRS erzeugen Sie mit der Einfügung
+\family sans
+Diskursrepräsentationsstruktur
+\family default
+.
+ Eine DRS besteht aus (Diskurs-)
+\emph on
+Bedingungen
+\emph default
+, die direkt in die Einfügung geschrieben werden, uns den (u.
+\begin_inset space \thinspace{}
+\end_inset
+
+U.
+ leeren) (Diskurs-)
+\emph on
+Referenten
+\emph default
+ (bzw., im DRT-Jargon, dem
+\emph on
+Universum
+\emph default
+), welche in die (automatisch eingefügte) Untereinfügung
+\emph on
+Referenten
+\emph default
+ geschrieben werden.
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+Sollte diese nicht eingefügt werden, finden Sie sie unter
+\family sans
+Einfügen\SpecialChar menuseparator
+DRS-Referenten
+\family default
+.
+
+\end_layout
+
+\end_inset
+
+ Zeilenwechsel müssen mittels
+\begin_inset Info
+type "shortcut"
+arg "newline-insert newline"
+\end_inset
+
+ eingefügt werden.
+ Hier ist ein einfaches Beispiel:
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace defskip
+\end_inset
+
+
+\begin_inset Flex DRS
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+x
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+Esel(x)
+\begin_inset Newline newline
+\end_inset
+
+grün(x)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace defskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+DRSen sind durch spezifische Layout-Anpassungen so gestaltet, dass Sie gut
+ auf der Seite platziert werden.
+ Die Variante
+\family sans
+Diskursrepräsentationsstruktur (einfach)
+\family default
+ unterdrückt diese Anpassungen.
+
+\end_layout
+
+\begin_layout Standard
+Zusätzlich zu diesen einfachen DRSen werden die folgenden konditionalen
+ DRSen unterstützt (sie werden in der Regel in einfache eingebettet):
+\end_layout
+
+\begin_layout Enumerate
+Die
+\family sans
+Implikative DRS
+\family default
+ repräsentiert eine konditionale (implikative) Satzkonstruktion der Form
+
+\emph on
+wenn S
+\begin_inset script subscript
+
+\begin_layout Plain Layout
+
+\emph off
+1
+\end_layout
+
+\end_inset
+
+, dann S
+\emph default
+
+\begin_inset script subscript
+
+\begin_layout Plain Layout
+2
+\end_layout
+
+\end_inset
+
+:
+\end_layout
+
+\begin_deeper
+\begin_layout Standard
+\begin_inset Flex IfThen-DRS
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+x
+\begin_inset space ~
+\end_inset
+
+y
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+Joseph(x)
+\begin_inset Newline newline
+\end_inset
+
+Esel(y)
+\begin_inset Newline newline
+\end_inset
+
+besitzen(x,y)
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:1
+status open
+
+\begin_layout Plain Layout
+z
+\begin_inset space ~
+\end_inset
+
+w
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:2
+status open
+
+\begin_layout Plain Layout
+z = x
+\begin_inset Newline newline
+\end_inset
+
+w = y
+\begin_inset Newline newline
+\end_inset
+
+füttern(z,w)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_deeper
+\begin_layout Enumerate
+Die
+\family sans
+Konditionale DRS
+\family default
+ ist eine allgemeinere Variante, bei der Sie selbst eine beliebige Bedingung
+ (statt der implikativen) spezifizieren können.
+ In die Untereinfügung
+\family sans
+Bedingung
+\family default
+ können Sie ein beliebiges Symbol eingeben:
+\end_layout
+
+\begin_deeper
+\begin_layout Standard
+\begin_inset Flex Cond-DRS
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+x
+\begin_inset space ~
+\end_inset
+
+y
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+Joseph(x)
+\begin_inset Newline newline
+\end_inset
+
+Esel(y)
+\begin_inset Newline newline
+\end_inset
+
+besitzen(x,y)
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:1
+status open
+
+\begin_layout Plain Layout
+\begin_inset Formula $\wedge\!\,$
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:2
+status open
+
+\begin_layout Plain Layout
+z
+\begin_inset space ~
+\end_inset
+
+w
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:3
+status open
+
+\begin_layout Plain Layout
+z = x
+\begin_inset Newline newline
+\end_inset
+
+w = y
+\begin_inset Newline newline
+\end_inset
+
+lieben(w,z)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_deeper
+\begin_layout Enumerate
+Die
+\family sans
+Duplex-Bedingungs-DRS
+\family default
+ können Sie für sog.
+
+\emph on
+Duplex-Bedingungen
+\emph default
+ verwenden:
+\end_layout
+
+\begin_deeper
+\begin_layout Standard
+\begin_inset Flex QDRS
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+x
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+x
+\begin_inset Formula $\in$
+\end_inset
+
+ X
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:1
+status open
+
+\begin_layout Plain Layout
+alle
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:2
+status open
+
+\begin_layout Plain Layout
+x
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:3
+status open
+
+\begin_layout Plain Layout
+y
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument post:4
+status open
+
+\begin_layout Plain Layout
+Sekretärin(y)
+\begin_inset Newline newline
+\end_inset
+
+anstellen(x,y)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_deeper
+\begin_layout Enumerate
+Die
+\family sans
+Negierte DRS
+\family default
+ fügt eine DRS ein, der ein Negationszeichen vorangestellt ist:
+\end_layout
+
+\begin_deeper
+\begin_layout Standard
+\begin_inset Flex NegDRS
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+x
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+Esel(x)
+\begin_inset Newline newline
+\end_inset
+
+grün(x)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_deeper
+\begin_layout Standard
+
+\family sans
+DRS mit Satz oberhalb
+\family default
+ schlieÃlich tut, was es verspricht: Es setzt einen Satz über die Box-Repräsenta
+tion:
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace defskip
+\end_inset
+
+
+\begin_inset Flex SDRS
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+Ein Esel ist grün
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status open
+
+\begin_layout Plain Layout
+x
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+Esel(x)
+\begin_inset Newline newline
+\end_inset
+
+grün(x)
+\end_layout
+
+\end_inset
+
+
+\begin_inset VSpace defskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Das Paket
+\emph on
+drs
+\emph default
+ bietet einige Möglichkeiten, um das Erscheinungsbild der DRS-Modelle anzupassen.
+ Bitte konsultieren Sie das Handbuch des Pakets
+\begin_inset CommandInset citation
+LatexCommand cite
+key "drs"
+literal "false"
+
+\end_inset
+
+ für Einzelheiten.
+\end_layout
+
+\begin_layout Section
+Phonetische Notation (IPA)
+\end_layout
+
+\begin_layout Standard
+Um phonetische Zeichen einzugeben, brauchen Sie das Linguistikmodul nicht.
+ IPA-Unterstützung ist mittlerweile eine Grundfunktion von \SpecialChar LyX
+.
+ Da IPA aber von Linguistinnen und Linguisten sehr häufig gebraucht wird,
+ wird die Verwendung der IPA-Funktion hier trotzdem (kurz) beschrieben.
+\end_layout
+
+\begin_layout Standard
+Um \SpecialChar LyX
+' IPA-Funktion mit klassischem \SpecialChar LaTeX
+ oder PDF\SpecialChar LaTeX
+ zu benutzen, müssen Sie das
+ Paket
+\emph on
+tipa
+\emph default
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "tipa"
+literal "true"
+
+\end_inset
+
+ installiert haben.
+ Es wird von \SpecialChar LyX
+ automatisch geladen, wenn Sie dem unten beschriebenen Vorgehen
+ folgen.
+ Wenn Sie Xe\SpecialChar TeX
+ oder Lua\SpecialChar TeX
+ verwenden (und
+\begin_inset Quotes gld
+\end_inset
+
+Nicht-\SpecialChar TeX
+-Schriften verwenden
+\begin_inset Quotes grd
+\end_inset
+
+ in
+\family sans
+Dokument\SpecialChar menuseparator
+Einstellungen\SpecialChar menuseparator
+Schriften
+\family default
+ aktiviert haben), wird statt dessen das Paket
+\emph on
+xunicode
+\emph default
+ geladen, da
+\emph on
+tipa
+\emph default
+ in diesem Fall nicht funktioniert.
+ Das Paket
+\emph on
+xunicode
+\emph default
+ emuliert die Ausgabe von
+\emph on
+tipa
+\emph default
+, ist aber nicht perfekt, so dass die Ausgabe möglicherweise nicht wie erwartet
+ ist.
+ AuÃerdem müssen Sie in diesem Fall darauf achten, dass die Nicht-\SpecialChar TeX
+-Schrift
+ die IPA-Symbole auch enthält (empfehlenswert sind Schriften wie
+\emph on
+CMU Serif
+\emph default
+ oder
+\emph on
+SIL Doulos
+\emph default
+).
+ Sie können auch eine Schrift nur für IPA definieren, indem sie das Folgende
+ in
+\family sans
+Dokument\SpecialChar menuseparator
+Einstellungen\SpecialChar menuseparator
+LaTeX-Vorspann
+\family default
+ eingeben:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "language={[LaTeX]TeX},basicstyle={\footnotesize\ttfamily}"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+AtBeginDocument{%
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
+newfontfamily{
+\backslash
+ipafont}{CMU Serif}% oder eine ander Schriftart
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
+def
+\backslash
+useTIPAfont{
+\backslash
+ipafont}
+\end_layout
+
+\begin_layout Plain Layout
+
+}
+\end_layout
+
+\end_inset
+
+Für eine direkte Vorschau der IPA-Symbole im Arbeitsfenster sollten Sie
+ weiterhin (egal, welche der oben beschriebenen Ausgabeformate Sie verwenden)
+ das
+\emph on
+preview-latex
+\emph default
+-Paket
+\begin_inset CommandInset citation
+LatexCommand cite
+key "preview"
+literal "true"
+
+\end_inset
+
+ installiert haben.
+\end_layout
+
+\begin_layout Standard
+Phonetische Zeichen werden in eine spezielle Umgebung eingegeben, die Sie
+ über
+\family sans
+Einfügen\SpecialChar menuseparator
+Sonderzeichen\SpecialChar menuseparator
+Phonetische Symbole
+\family default
+aktivieren.
+ Es wird ein kleiner umrahmter Eingabebereich eingefügt, in den Sie einzelne
+ Zeichen, Wörter und Wortfolgen sowie auch mehrere Absätze mit phonetischer
+ Notation eingeben können.
+ Wenn Sie in dem Eingabebereich sind, wird eine Symbolleiste aktiviert,
+ die die wichtigsten IPA-Symbole (nach den IPA-Kategorien sortiert) bereitstellt.
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+Es fehlt ein Symbol: der (2005 in das IPA aufgenommene) labiodentale Flap.
+ Dieses Zeichen unterstützt das
+\emph on
+Tipa-
+\emph default
+Paket noch nicht; daher kann es auch nicht von LyX unterstützt werden.
+\end_layout
+
+\end_inset
+
+ Jeder Symbolbereich dieser Symbolleiste kann durch Klicken auf die gestrichelte
+ Linie abgetrennt werden.
+ Dadurch kann phonetische Notation recht komfortabel eingegeben werden:
+
+\begin_inset IPA
+
+\begin_layout Standard
+[ËÉtva zo:]
+\end_layout
+
+\end_inset
+
+.
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+Wenn Sie ein diakritisches Zeichen einfügen möchten, müssen Sie das Diakritikum
+
+\emph on
+nach
+\emph default
+ dem Basiszeichen einfügen.
+ Das heiÃt, für
+\begin_inset IPA
+
+\begin_layout Standard
+[d̥]
+\end_layout
+
+\end_inset
+
+ geben Sie zuerst
+\family typewriter
+<d>
+\family default
+ ein und dann direkt danach das Diakritikum
+\family typewriter
+<Stimmlos>
+\family default
+ von der Symbolleiste.
+ Wenn Sie nur ein Diakritikum eingeben möchten, können Sie das direkt nach
+ einem Leerzeichen tun, so wie hier:
+\begin_inset IPA
+
+\begin_layout Standard
+ ̼
+\end_layout
+
+\end_inset
+
+ (
+\family typewriter
+=
+\begin_inset space ~
+\end_inset
+
+<Leerzeichen>+<Lingolabial>
+\family default
+).
+\end_layout
+
+\end_inset
+
+ Wenn
+\emph on
+ preview-latex
+\emph default
+ installiert ist und Sie auÃerdem in
+\family sans
+ Werkzeuge\SpecialChar menuseparator
+Einstellungen\SpecialChar ldots
+\SpecialChar menuseparator
+Grafik
+\family default
+
+\begin_inset Quotes gld
+\end_inset
+
+Sofortige Vorschau
+\begin_inset Quotes grd
+\end_inset
+
+ aktiviert haben, zeigt \SpecialChar LyX
+ eine WYSIWYG-Vorschau der Notation an, sobald der
+ Cursor den IPA-Bereich verlässt.
+ Alternativ zur Symbolleiste können Sie die Zeichen auch direkt mithilfe
+ der Kurznotation eingeben können, die im
+\emph on
+tipa
+\emph default
+-Handbuch erläutert wird: hier eine
+\begin_inset IPA
+
+\begin_layout Standard
+[kOst"pro:b@]
+\end_layout
+
+\end_inset
+
+ (
+\emph on
+tipa
+\emph default
+-Kurznotation:
+\family typewriter
+[kOst"pro:b@
+\family default
+]).
+ Alternativ können Sie die meisten IPA-Zeichen auch über
+\family sans
+Einfügen\SpecialChar menuseparator
+Sonderzeichen\SpecialChar menuseparator
+Symbole\SpecialChar ldots
+
+\family default
+ in das Eingabefeld eingeben oder sie aus einem anderen Dokument kopieren
+ und dort einfügen.
+ Die Ausgabe sollte immer identisch sein, egal welche Eingabemethode Sie
+ wählen.
+\end_layout
+
+\begin_layout Standard
+Bitte beachten Sie, dass Sie die meisten IPA-Zeichen über die zuletzt genannten
+ Methoden auch auÃerhalb des IPA-Eingabebereichs einfügen können: [zoË viË
+ hiËÉ̯].
+ In der Ausgabe werden diese Zeichen dann ebenfalls direkt in die korrekten
+
+\emph on
+tipa
+\emph default
+-Makros umgewandelt (lassen Sie es uns wissen, falls das nicht der Fall
+ ist).
+ Dieses Verfahren hat aber gravierende Nachteile gegenüber der IPA-Umgebung,
+ denn die direkte Eingabe resultiert in der Regel in unerwünschter Schriftmischu
+ng (die lateinischen Buchstaben werden aus der Grundschrift, die speziellen
+ IPA-Zeichen aber aus der IPA-Schrift genommen, und diese beiden Schriften
+ passen nicht notwendigerweise zusammen).
+ Innerhalb der IPA-Eingabeumgebung wird dagegen für alle Zeichen dieselbe
+ Schrift verwendet.
+ Deshalb sollten Sie, wenn Sie nicht nur Einzelzeichen eingeben, unbedingt
+ den IPA-Eingabebereich verwenden.
+\end_layout
+
+\begin_layout Section
+Weitere Informationen
+\end_layout
+
+\begin_layout Standard
+Mehr und ausführlichere Informationen über die Möglichkeiten des Einsatzes
+ von \SpecialChar LyX
+ für linguistische Zwecke finden Sie auf der (englischsprachigen)
+\emph on
+Linguist\SpecialChar LyX
+
+\emph default
+-Seite auf dem \SpecialChar LyX
+-Wiki
+\begin_inset CommandInset citation
+LatexCommand cite
+key "linguistlyx"
+literal "true"
+
+\end_inset
+
+.
+ Sie sind übrigens herzlich eingeladen, dort aktiv mitzuschreiben!
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+key "covington"
+literal "true"
+
+\end_inset
+
+Das covington-Paket:
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+http://www.ctan.org/tex-archive/macros/latex/contrib/covington/
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+key "csquotes"
+literal "true"
+
+\end_inset
+
+Das csquotes-Paket:
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+http://www.ctan.org/tex-archive/macros/latex/contrib/csquotes/
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+key "drs"
+literal "false"
+
+\end_inset
+
+ Das drs-Paket:
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+https://ctan.org/tex-archive/macros/latex/contrib/drs
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+key "enumitem"
+literal "true"
+
+\end_inset
+
+Das enumitem-Paket:
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+http://www.ctan.org/tex-archive/macros/latex/contrib/enumitem/
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+key "float"
+literal "true"
+
+\end_inset
+
+Das float-Paket:
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+http://www.ctan.org/tex-archive/macros/latex/contrib/float/
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+key "forest"
+literal "true"
+
+\end_inset
+
+Das forest-Paket:
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+http://www.ctan.org/tex-archive/graphics/pgf/contrib/forest
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+key "linguistlyx"
+literal "true"
+
+\end_inset
+
+Maria Gouskova, Stacia Hartleben und Jürgen Spitzmüller: Using \SpecialChar LyX
+ for Linguistic
+ Papers.
+
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+https://wiki.lyx.org/LyX/LinguistLyX
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+key "pict2e"
+literal "false"
+
+\end_inset
+
+Das pict2e-Paket:
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+https://ctan.org/tex-archive/macros/latex/contrib/pict2e
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+key "preview"
+literal "true"
+
+\end_inset
+
+Das preview-latex-Paket:
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+http://www.ctan.org/tex-archive/macros/latex/contrib/preview/
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+key "tipa"
+literal "true"
+
+\end_inset
+
+Das tipa-Paket und die zugehörigen Schriften:
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+http://www.ctan.org/tex-archive/fonts/tipa/
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/Linguistics.xml b/autotests/export/docbook/Linguistics.xml
new file mode 100644
index 0000000..688ee2d
--- /dev/null
+++ b/autotests/export/docbook/Linguistics.xml
@@ -0,0 +1,339 @@
+<?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="de_DE" 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>Linguistische Arbeiten mit LyX</title>
+<author>
+<personname>Jürgen Spitzmüller<emphasis role='size_large'><link xlink:href="spitz at lyx.org"></link></emphasis></personname>
+</author>
+<date>21.04.2015</date>
+<abstract>
+<para>In diesem Text werden einige Funktionen von LyX vorgestellt, die spezifisch auf die Bedürfnisse von Linguistinnen und Linguisten ausgerichtet sind. Es wird gezeigt, wie nummerierte Beispiele, Interlinear-Glossierung, OT-Tableaux, semantische Auszeichnung, Strukturbäume, Diskursrepräsentationsstrukturen und phonetische Notation (IPA) erzeugt werden können.</para>
+</abstract>
+
+</info>
+<section>
+<title>Voraussetzungen und Ziele</title>
+<para>Die meisten der hier beschriebenen Funktionen werden vom „Linguistik“-Modul bereitgestellt, das seit Version 1.6.0 mit LyX mitgeliefert wird. „Module“ â das Konzept wurde ebenfalls mit LyX 1.6.0 eingeführt â sind Ergänzungsdateien, welche die von der Dokumentklasse bereitgestellten Möglichkeiten zumeist für sehr spezifische Aufgaben erweitern und die für jedes Dokument (egal welcher Klasse) einfach ausgewählt werden können. Um das Linguistik-Modul zu verwenden, gehen sie zu <emphasis role='sans'>Dokument⇒Einstellungen⇒Module</emphasis>, wählen Sie „Linguistik“ aus der Liste der verfügbaren Module und drücken auf den Knopf <emphasis role='sans'>Hinzufügen</emphasis> (so wie es für dieses Dokument bereits getan wurde).</para>
+<para>Grundsätzlich sollte das Modul in jeder von LyX unterstützten Dokumentklasse funktionieren (falls nicht, informieren Sie bitte den Autor dieses Textes). Allerdings müssen Sie, um alle Features nutzen zu können, die folgenden LaTeX-Pakete installiert haben:</para>
+<orderedlist>
+<listitem>
+<para><emphasis>covington.sty</emphasis> <biblioref endterm="covington" />: Dieses Paket wird benötigt, um nummerierte Beispiele, Glossen und semantische Auszeichnungen zu erzeugen. Beachten Sie, dass mindestens Version 2.3 des Pakets erforderlich ist, um alle Funktionen zu nutzen.</para>
+<itemizedlist>
+<listitem>
+<para>Auf Ihrem System installiert: nein.</para>
+</listitem>
+</itemizedlist>
+</listitem>
+<listitem>
+<para><emphasis>csquotes.sty</emphasis> <biblioref endterm="csquotes" />: Voraussetzung für den Textstil <emphasis>Bedeutung</emphasis> und für Glossen. Das Paket erlaubt es, kontextsensible Anführungszeichen zu generieren (bspw. je nach aktuell verwendeter Sprache).</para>
+<itemizedlist>
+<listitem>
+<para>Auf Ihrem System installiert: nein.</para>
+</listitem>
+</itemizedlist>
+</listitem>
+<listitem>
+<para><emphasis>drs.sty</emphasis> <biblioref endterm="drs" />: Voraussetzung für Diskursrepräsentationsstrukturen. Beachten Sie, dass mindestens Version 2.3 des Pakets <emphasis>covington</emphasis> erforderlich ist, um dies mit anderen Funktionen gemeinsam zu nutzen.</para>
+<itemizedlist>
+<listitem>
+<para>Auf Ihrem System installiert: nein.</para>
+</listitem>
+</itemizedlist>
+</listitem>
+<listitem>
+<para><emphasis>float.sty</emphasis> <biblioref endterm="float" />: Dieses Paket brauchen wir für die OT-Tableaux und das Tableaux-Verzeichnis. Es sollte Bestandteil jeder LaTeX-Distribution sein.</para>
+<itemizedlist>
+<listitem>
+<para>Auf Ihrem System installiert: nein.</para>
+</listitem>
+</itemizedlist>
+</listitem>
+<listitem>
+<para><emphasis>forest.sty</emphasis> <biblioref endterm="forest" />: Dieses Paket wird zur Erzeugung von Strukturbäumen verwendet.</para>
+<itemizedlist>
+<listitem>
+<para>Auf Ihrem System installiert: nein.</para>
+</listitem>
+</itemizedlist>
+</listitem>
+<listitem>
+<para><emphasis>pict2e.sty</emphasis> <biblioref endterm="pict2e" />: Voraussetzung für <emphasis>Duplex-Bedingungs-DRS</emphasis>.</para>
+<itemizedlist>
+<listitem>
+<para>Auf Ihrem System installiert: nein.</para>
+</listitem>
+</itemizedlist>
+</listitem>
+</orderedlist>
+</section>
+<section>
+<title>Nummerierte Beispiele</title>
+<para>Nummerierte Beispiele werden über die Absatzstil-Auswahlliste in der Werkzeugleiste eingefügt. Es gibt drei Varianten:</para>
+<informalexample role='numbered'>
+<para>Das ist ein mehrzeiliges Beispiel [Stil <emphasis>Nummeriertes Beispiel (mehrere Zeilen)</emphasis>]</para>
+<para>Wie der Name sagt, kann es mehrere Absätze enthalten</para>
+</informalexample>
+<informalexample role='consecutive'>
+<para>Das ist ein einzeiliges Beispiel<anchor xml:id="exa.Beispiel-einzeilig" /> [Stil <emphasis>Nummeriertes Beispiel (konsekutiv)</emphasis>]Jeder Absatz wird in diesem Stil neu nummeriert</para>
+</informalexample>
+<informalexample role='consecutive'>
+<para>Dies ist ein Unterbeispiel<anchor xml:id="subsec.Unterbeispiel" /> [Stil <emphasis>Unterbeispiel</emphasis>]Und hier noch eines</para>
+</informalexample>
+<para>Querverweise auf Beispiele erzeugen Sie wie gewohnt: Sie fügen im Beispiel eine Marke ein, und an der Stelle, an der der Querverweis erscheinen soll, einen Verweis mittels <emphasis role='sans'>Einfügen⇒Querverweis…</emphasis> </para>
+<para>Als kleine Demonstration verweisen wir hier auf die Beispiele <xref linkend="exa.Beispiel-einzeilig" /> und <xref linkend="subsec.Unterbeispiel" />.</para>
+<para>Wenn Sie die Nummerierung für einzelne Beispiele ändern möchten, verwenden Sie <emphasis role='sans'>Einfügen⇒Benutzerdef. Nummerierung</emphasis>. Für globale Anpassungen bietet <emphasis>covington</emphasis> selbst Möglichkeiten. Bitte konsultieren Sie das Handbuch des Pakets <biblioref endterm="covington" /> für Einzelheiten.</para>
+<para>Ab Version 2.3 bietet <emphasis>covingtons</emphasis> subexamples-Umgebung ein optionales Argument (mit dem man Text zwischen der Hauptnummer und dem ersten Unterbeispiel einfügen kann). Dieses können Sie über <emphasis role='sans'>Einfügen⇒Optionen für Unterbeispiele</emphasis> eingeben. Bitte konsultieren Sie auch hier das Handbuch des Pakets <biblioref endterm="covington" /> für Einzelheiten.</para>
+</section>
+<section>
+<title>Interlinear-Glossierung</title>
+<para>Das Linguistikmodul stellt zwei Arten von Glossen zur Verfügung. Beide sind über <emphasis role='sans'>Einfügen⇒Spezifische Einfügung</emphasis> zugänglich. Die <emphasis>Interlinear-Glosse (2 Zeilen)</emphasis> besteht aus zwei Zeilen für das Glossenpaar (bestehend aus der Darstellung in der zu beschreibenden Sprache und einer interlinearen Wort-zu-Wort-Ãbersetzung) sowie einer weiteren Zeile für die freie Ãbersetzung, die <emphasis>Interlinear-Glosse (3 Zeilen)</emphasis> bietet eine zusätzliche Zeile für Interlinear-Glossierung (diese dritte Zeile wird zumeist für morphologische oder phonologische Angaben verwendet). Die freie Ãbersetzung kann länger sein als eine Zeile, sie wird dann einfach automatisch und korrekt umbrochen. Die Version in der zu beschreibenden Sprache (erste Zeile der Glosse) wird direkt in die Glosse-Einfügung geschrieben, alle anderen Teile der Glosse in spezifische Unter-Einfügungen (<emphasis role='sans'>Inter
linear-Glosse</emphasis>, bzw. mit dreizeiligen Glossen: <emphasis role='sans'>Interlinear-Glosse (Zeile 1)</emphasis> und <emphasis role='sans'>Interlinear-Glosse (Zeile 2)</emphasis>, sowie <emphasis role='sans'>Glossen-Ãbersetzung</emphasis>). LyX fügt diese Unter-Einfügungen automatisch ein, wenn Sie eine neue Glosse einfügen. Sie können aber auch manuell eingefügt werden, und zwar über <emphasis role='sans'>Einfügen⇒Glossen-Ãbersetzung</emphasis> und <emphasis role='sans'>Einfügen⇒Interlinear-Glosse</emphasis>. Ungeachtet wo Sie diese Untereinfügungen innerhalb der Glosse einfügen, wird alles in der richtigen Reihenfolge ausgegeben. SchlieÃlich können Sie über <emphasis role='sans'>Einfügen⇒Glossen-Optionen</emphasis> auch Glossen-Optionen eingeben. Diese Optionen erlauben es Ihnen, die Darstellung der einzelnen Zeilen zu verändern, eine Nummerierung oder vorangestellten Text hinzuzufügen. Bitte konsultieren Sie das Handb
uch des Pakets <emphasis>covington </emphasis><biblioref endterm="covington" /> für Einzelheiten.<footnote>
+<para>Bitte beachten Sie, dass die Unterstützung für Glossen für LyX 2.4 komplett überarbeitet wurde. Nun werden die neuen und verbesserten Glossen-Makros verwendet, die <emphasis>covington</emphasis> seit der Version 2.0 anbietet. Wegen der erheblichen Veränderungen können alte Glossen leider nicht in die neuen konvertiert werden. Statt dessen werden sie in ihrer ursprünglichen Form importiert (und als <emphasis role='sans'>Lokales Format</emphasis> im Dokument gespeichert). Umgekehrt werden neue Glossen in TeX-Code exportier, wenn Sie in eine ältere LyX-Version exportieren.</para>
+</footnote></para>
+<para>Hier ist ein einfaches Beispiel für eine zweizeilige Glosse:</para>
+<para>C'est un exemple simple</para>
+<para>Verwenden Sie <emphasis role='sans'>Bearbeiten⇒Textstil⇒Glossierte Wortgruppen</emphasis>, um Mehrwortelemente zusammenzuhalten (alternativ können Sie auch im TeX-Modus <!-- { -->
+diese Wörter geschweift einklammern<!-- } -->
+). Beachten Sie, dass Sie im LyX-Fenster mehrere Leerzeichen nacheinander einfügen können, um die Glossen dort schöner auszurichten. Die Ausgabe wird davon nicht berührt.</para>
+<para>Hier ist eine dreizeilige Glosse. Sie wird analog erzeugt:</para>
+<para>Hoc est aliud exemplum</para>
+<para>Beachten Sie, wie wir hier mit Hilfe der Glossen-Optionen die zweite Zeile in Kapitälchen ausgeben lassen.</para>
+<para>Wenn Sie nummerierte Glossen benötigen, fügen Sie die Glosse entweder einfach in einen Absatz mit dem Format <emphasis>Nummeriertes Beispiel</emphasis> ein, so wie hier:</para>
+<informalexample role='consecutive'>
+<para>Mein Luftkissenfahrzeug ist voller Aale</para>
+</informalexample>
+<para>oder verwenden Sie die Glossen-Option <emphasis>ex</emphasis>:</para>
+<para>Mein Luftkissenfahrzeug ist voller Aale</para>
+<bridgehead renderas="sect2">Tipps & Tricks</bridgehead>
+<bridgehead renderas="sect3">Seitenumbrüche innerhalb von Glossen vermeiden</bridgehead>
+<para>In der Standardeinstellung können innerhalb von Glossen Seiten umbrochen werden, was natürlich nicht erwünscht ist. Um dies zu umgehen, können Sie in <emphasis role='sans'>Dokument⇒Einstellungen…⇒Dokumentklasse⇒Klassenoptionen⇒Benutzerdefiniert</emphasis> die Option <emphasis>noglossbreaks</emphasis> eingeben; dies wird die meisten Umbrüche verhindern. Wenn trotzdem welche vorkommen, können Sie Glossen in Boxen packen (über <emphasis role='sans'>Einfügen⇒Box⇒Rahmenlos</emphasis>).</para>
+<bridgehead renderas="sect3">FuÃnoten in Glossen</bridgehead>
+<para>Sie können zwar eine FuÃnote in eine <emphasis>Glosse </emphasis>einfügen, dies führt aber zu einem LaTeX-Fehler. Wenn Sie FuÃnoten benötigen, schreiben Sie an der Stelle, an der das FuÃnotenzeichen erscheinen soll, im TeX-Modus <code>\footnotemark</code> in die Glosse. Direkt nach (und auÃerhalb) der Glosse schreiben Sie, ebenfalls im TeX-Modus,<code> \footnotetext{Die FuÃnote ...}</code>. Sollten Sie mehrere FuÃnoten brauchen, geben Sie einfach mehrere dieser Befehlspaare ein.</para>
+<bridgehead renderas="sect3">Glossen (und Beispiele) in Beamer-Präsentationen</bridgehead>
+<para>Wenn Sie das Linguistik-Modul in einer Beamer-Präsentation verwenden wollen, beachten Sie bitte folgendes:</para>
+<itemizedlist>
+<listitem>
+<para>Für Glossen müssen Sie in Beamer immer einen „fragilen“ Rahmen verwenden. </para>
+</listitem>
+<listitem>
+<para>Ãltere Versionen des Pakets <emphasis>covington</emphasis> und die <emphasis>Beamer</emphasis>-Klasse arbeiten von Haus aus nicht gut zusammen, da beide die Befehle <code>\example</code> und <code>\examples</code> zu definieren versuchen, was in diesen älteren Versionen eine LaTeX-Fehlermeldung erzeugt, sobald sie Glossen oder Beispiele einfügen. Sie können das Problem beheben, indem Sie in <emphasis role='sans'>Dokument⇒Einstellungen⇒Lokales Format</emphasis> folgenden Code kopieren:</para>
+<blockquote>
+<para><programlisting>Provides covington 1
+AddToPreamble
+ \let\example\relax
+ \let\endexample\relax
+ \let\examples\relax
+ \let\endexamples\relax
+ \usepackage{covington}
+EndPreamble</programlisting>
+</para>
+</blockquote>
+<para>Drücken Sie „Validieren“ und dann „OK“. Dies hat den Effekt, dass die Beispiel-Umgebungen von Beamer deaktiviert werden (und also nicht mehr verwendet werden können), dafür können Sie dann aber die des Linguistik-Moduls verwenden.</para>
+<para>Ab <emphasis>covington</emphasis> 1.1 besteht dieses Problem nicht mehr.</para>
+</listitem>
+</itemizedlist>
+</section>
+<section>
+<title>Tableaux für Optimalitätstheorie</title>
+<para>Die OT-Tableaux selbst können natürlich einfach als normale Tabellen eingegeben werden (Spezifika wie gestrichelte Tabellenlinien und schattierte Tabellenzellen, die man hierfür manchmal braucht, sind in <emphasis role='sans'>Hilfe⇒Eingebettete Objekt</emphasis>e beschrieben). </para>
+<para>Wenn Sie allerdings Ihre Tableaux durch das Dokument hindurch nummerieren und ein eigenes Tableaux-Verzeichnis einrichten möchten, reichen die Bordmittel von LyX nicht aus. Auch hier hilft das Linguistikmodul. Wenn es ausgewählt ist, finden Sie unter <emphasis role='sans'>Einfügen⇒Gleitobjekte</emphasis> zusätzlich ein Tableau-Gleitobjekt (siehe Tableau <xref linkend="tab.Beispiel-Tableau" /> für ein Beispiel).</para>
+<table xml:id="tab.Beispiel-Tableau">
+<caption>Beispiel-Tableau</caption>
+<informaltable>
+<tbody>
+<tr>
+<td align='right' valign='top'>/atikap/</td>
+<td align='center' valign='top'>Onset</td>
+<td align='center' valign='top'>NoCoda</td>
+<td align='center' valign='top'>Dep</td>
+<td align='center' valign='top'>Max</td>
+</tr>
+<tr>
+<td align='right' valign='top'><inlineequation>
+<alt role='tex'>\mbox{â}</alt>
+ <m:math>
+
+ <m:mrow>
+ <m:mstyle class='mathbox'>â
+ </m:mstyle>
+ </m:mrow>
+ </m:math>
+</inlineequation> <inlineequation>
+<alt role='tex'>\mbox{\textipa{P}}</alt>
+ <m:math>
+
+ <m:mrow>
+ <m:mstyle class='mathbox'>P
+ </m:mstyle>
+ </m:mrow>
+ </m:math>
+</inlineequation>a.ti.ka</td>
+<td align='center' valign='top'></td>
+<td align='center' valign='top'></td>
+<td align='center' valign='top'>*</td>
+<td align='center' valign='top'>*</td>
+</tr>
+<tr>
+<td align='right' valign='top'>a.ti.ka</td>
+<td align='center' valign='top'>*!</td>
+<td align='center' valign='top'></td>
+<td align='center' valign='top'></td>
+<td align='center' valign='top'>*</td>
+</tr>
+<tr>
+<td align='right' valign='top'><inlineequation>
+<alt role='tex'>\mbox{\textipa{P}}</alt>
+ <m:math>
+
+ <m:mrow>
+ <m:mstyle class='mathbox'>P
+ </m:mstyle>
+ </m:mrow>
+ </m:math>
+</inlineequation>a.ti.kap</td>
+<td align='center' valign='top'></td>
+<td align='center' valign='top'>*!</td>
+<td align='center' valign='top'>*</td>
+<td align='center' valign='top'></td>
+</tr>
+<tr>
+<td align='right' valign='top'>a.ti.kap</td>
+<td align='center' valign='top'>*!</td>
+<td align='center' valign='top'>*!</td>
+<td align='center' valign='top'></td>
+<td align='center' valign='top'></td>
+</tr>
+</tbody>
+</informaltable>
+</table>
+
+<para>Bitte beachten Sie, dass die Legende in der Standardeinstellung immer unter dem Tableau ausgegeben wird, egal, wohin Sie sie im LyX-Arbeitsfenster setzen. Um die Legende über das Tableau zu setzen, müssen Sie den folgenden Code in <emphasis role='sans'>Dokument⇒Einstellungen⇒Präambel </emphasis>eingeben:</para>
+<blockquote>
+<para><programlisting language="[LaTeX]TeX">\floatstyle{plaintop}
+\restylefloat{tableau}</programlisting>
+</para>
+</blockquote>
+<para>Wenn Sie eine KOMA-Klasse verwenden, nehmen Sie statt dessen das Folgende (welches im Kontext der KOMA-Klassen bessere Abstände erzeugt):</para>
+<blockquote>
+<para><programlisting language="[LaTeX]TeX">\floatstyle{komaabove}
+\restylefloat{tableau}</programlisting>
+</para>
+</blockquote>
+<para>Ein Verzeichnis der Tableaux geben Sie, wie bei normalen Tabellen auch, über <emphasis role='sans'>Einfügen⇒Liste⁄Inhaltsverzeichnis</emphasis> ein. Dies sieht dann so aus:</para>
+</section>
+<section>
+<title>Semantische Auszeichnung (Textstile)</title>
+<para>Das Linguistikmodul stellt einige Textstile zur Verfügung, die in linguistischen Arbeiten allgemein gebräuchlich sind:</para>
+<orderedlist>
+<listitem>
+<para>Konzept (in Kapitälchen): Konzept </para>
+</listitem>
+<listitem>
+<para>Ausdruck (hervorgehoben): Ausdruck</para>
+</listitem>
+<listitem>
+<para>Bedeutung (in einfachen Anführungszeichen): Bedeutung</para>
+</listitem>
+</orderedlist>
+<para>Diese Textstile finden Sie unter <emphasis role='sans'>Bearbeiten⇒Textstil</emphasis>. Der Vorteil solcher Stile gegenüber direkter Hervorhebung und Auszeichnung ist vor allem der, dass sie alle (und nur die) damit markierten Textteile leicht global verändern können. Wenn Sie (oder Ihr Verlag) also etwa Ausdrücke doch fett gesetzt haben wollen, geben Sie einfach den folgenden Code in <emphasis role='sans'>Dokument⇒Einstellungen⇒Präambel</emphasis> ein:</para>
+<blockquote>
+<para><programlisting language="[LaTeX]TeX">\renewcommand\lexp[1]{\textbf{#1}}</programlisting>
+</para>
+</blockquote>
+<para>Auf ähnliche Weise kann auch das Aussehen von <emphasis>Konzept</emphasis> (<code>\lcon</code>) und <emphasis>Bedeutung</emphasis> (<code>\lmean</code>) verändert werden. Bitte konsultieren Sie das Handbuch des Pakets <emphasis>covington</emphasis> <biblioref endterm="covington" /> für Einzelheiten.</para>
+</section>
+<section>
+<title>Linguistische Strukturbäume</title>
+<para>Mittlerweile gibt es mehrere LaTeX-Pakete, die bei der Erstellung von Strukturbäumen helfen. LyX unterstützt das Paket <emphasis role='sans'>forest</emphasis>, welches hohe Flexibilität und Mächtigkeit mit einer intuitiven Syntax vereint. Das Linguistik-Modul enthält eine Strukturbaum-Einfügung, die unter <emphasis role='sans'>Einfügen⇒Spezifische Einfügung</emphasis> zu finden ist. Innerhalb dieser Einfügung können Sie die Klammernotation verwenden, die das Paket <emphasis role='sans'>forest</emphasis> (wie auch andere Pakete, z. B. <emphasis role='sans'>qtree</emphasis>) anbietet.</para>
+<para>Hier ist ein einfaches Beispiel:</para>
+<para>[VP [DP[Hans]] [V' [V[schickt]] [DP[Maria]] [DP[D[einen]][NP[Brief]]] ] ]</para>
+<para>Wenn Sie die PDF-Ausgabe ansehen, sehen Sie, dass die Notation</para>
+<blockquote>
+<para><code><emphasis role='size_footnote'>[VP [DP[Hans]] [V' [V[schickt]] [DP[Maria]] [DP[D[einen]][NP[Brief]]]]]</emphasis></code></para>
+</blockquote>
+<para>als Strukturbaum ausgegeben wird. Um das Ergebnis bereits im LyX<!-- "= -->
+Eingabefenster zu sehen, können Sie die Strukturbaum-Einfügung einfach in eine Vorschau-Einfügung (<emphasis role='sans'>Einfügen⇒Vorschau</emphasis>) einbetten. Wenn „Sofortige Vorschau“ richtig eingerichtet und aktiviert ist, sollten Sie den Baum sofort sehen (zur Bearbeitung klicken Sie einfach auf das Bild):</para>
+<para>[VP [DP[Maria]] [V' [V[schickt]] [DP[Hans]] [DP[D[eine]][NP[Antwort]]] ] ]</para>
+<para>Dächer („roofs“) können mittels der Option „roof“<footnote>
+<para>Bitte beachten Sie, dass die Option „roof“ erst ab Version 2.0 des Pakets <emphasis role='sans'>forest</emphasis> verfügbar ist. Für frühere Versionen haben wir in den Vorspann dieses Dokuments Code eingefügt, die die Verwendung dennoch gestattet. Wenn Ihre Version des Pakets <emphasis role='sans'>forest</emphasis> kleiner ist als 2.0 und Sie „roof“ verwenden wollen, müssen Sie diesen Code in den Vorspann Ihres Dokuments kopieren. Statt dessen können Sie auch die alte Option „triangle“ (statt „roof“) verwenden.</para>
+</footnote> erzeugt werden (beachten Sie, dass Kommata eine spezielle Bedeutung haben; sie markieren Optionen):</para>
+<para>[VP [DP[Hans]] [V' [V[schickt]] [DP[Maria]] [DP[einen weiteren Brief, roof]] ] ]</para>
+<para>Um die Knoten des Baums besser auszurichten, verwenden Sie die Option „tier“. Alle Knoten, denen dieselbe „tier“ (Ebene) zugewiesen wurde, werden in einer vertikalen Linie ausgerichtet. Hier ist ein Beispiel:</para>
+<para>[VP [DP[Hans, tier=word]] [V' [V[schickt, tier=word]] [DP[Maria, tier=word]] [DP[D[einen, tier=word]][NP[Brief, tier=word]]] ] ]</para>
+<para>Das Paket bietet viel mehr Möglichkeiten, wie bspw. Bewegungspfeile und Dekorationen. Sie können hier nicht eingehend besprochen werden. Bitte konsultieren Sie die ausführliche Dokumentation des Pakets <biblioref endterm="forest" />.</para>
+</section>
+<section>
+<title>Diskursrepräsentationsstrukturen</title>
+<para>Das Linguistik-Modul stellt auch Einfügungen zur Erzeugung von Diskursrepräsentationsstrukturen (DRSen) in der Box-Notation von <personname>Hans Kamps</personname> <emphasis>Diskursrepräsentationstheorie</emphasis> zur Verfügung. Diese Einfügungen finden Sie unter <emphasis role='sans'>Einfügen⇒Spezifische Einfügung</emphasis>.</para>
+<para>Eine einfache DRS erzeugen Sie mit der Einfügung <emphasis role='sans'>Diskursrepräsentationsstruktur</emphasis>. Eine DRS besteht aus (Diskurs-)<emphasis>Bedingungen</emphasis>, die direkt in die Einfügung geschrieben werden, uns den (u. U. leeren) (Diskurs-)<emphasis>Referenten</emphasis> (bzw., im DRT-Jargon, dem <emphasis>Universum</emphasis>), welche in die (automatisch eingefügte) Untereinfügung <emphasis>Referenten</emphasis> geschrieben werden.<footnote>
+<para>Sollte diese nicht eingefügt werden, finden Sie sie unter <emphasis role='sans'>Einfügen⇒DRS-Referenten</emphasis>. </para>
+</footnote> Zeilenwechsel müssen mittels <keycap>Ctrl+Return</keycap> eingefügt werden. Hier ist ein einfaches Beispiel:</para>
+<para>
+Esel(x)grün(x)</para>
+<para>DRSen sind durch spezifische Layout-Anpassungen so gestaltet, dass Sie gut auf der Seite platziert werden. Die Variante <emphasis role='sans'>Diskursrepräsentationsstruktur (einfach)</emphasis> unterdrückt diese Anpassungen. </para>
+<para>Zusätzlich zu diesen einfachen DRSen werden die folgenden konditionalen DRSen unterstützt (sie werden in der Regel in einfache eingebettet):</para>
+<orderedlist>
+<listitem>
+<para>Die <emphasis role='sans'>Implikative DRS</emphasis> repräsentiert eine konditionale (implikative) Satzkonstruktion der Form <emphasis>wenn S<subscript>1</subscript>, dann S</emphasis><subscript>2</subscript>:</para>
+<para>Joseph(x)Esel(y)besitzen(x,y)</para>
+</listitem>
+<listitem>
+<para>Die <emphasis role='sans'>Konditionale DRS</emphasis> ist eine allgemeinere Variante, bei der Sie selbst eine beliebige Bedingung (statt der implikativen) spezifizieren können. In die Untereinfügung <emphasis role='sans'>Bedingung</emphasis> können Sie ein beliebiges Symbol eingeben:</para>
+<para>Joseph(x)Esel(y)besitzen(x,y)</para>
+</listitem>
+<listitem>
+<para>Die <emphasis role='sans'>Duplex-Bedingungs-DRS</emphasis> können Sie für sog. <emphasis>Duplex-Bedingungen</emphasis> verwenden:</para>
+<para>x <inlineequation>
+<alt role='tex'>\in</alt>
+ <m:math>
+
+ <m:mrow><m:mo>∈</m:mo>
+ </m:mrow>
+ </m:math>
+</inlineequation> X</para>
+</listitem>
+<listitem>
+<para>Die <emphasis role='sans'>Negierte DRS</emphasis> fügt eine DRS ein, der ein Negationszeichen vorangestellt ist:</para>
+<para>Esel(x)grün(x)</para>
+</listitem>
+</orderedlist>
+<para><emphasis role='sans'>DRS mit Satz oberhalb</emphasis> schlieÃlich tut, was es verspricht: Es setzt einen Satz über die Box-Repräsentation:</para>
+<para>
+Esel(x)grün(x)
+</para>
+<para>Das Paket <emphasis>drs</emphasis> bietet einige Möglichkeiten, um das Erscheinungsbild der DRS-Modelle anzupassen. Bitte konsultieren Sie das Handbuch des Pakets <biblioref endterm="drs" /> für Einzelheiten.</para>
+</section>
+<section>
+<title>Phonetische Notation (IPA)</title>
+<para>Um phonetische Zeichen einzugeben, brauchen Sie das Linguistikmodul nicht. IPA-Unterstützung ist mittlerweile eine Grundfunktion von LyX. Da IPA aber von Linguistinnen und Linguisten sehr häufig gebraucht wird, wird die Verwendung der IPA-Funktion hier trotzdem (kurz) beschrieben.</para>
+<para>Um LyX' IPA-Funktion mit klassischem LaTeX oder PDFLaTeX zu benutzen, müssen Sie das Paket <emphasis>tipa</emphasis> <biblioref endterm="tipa" /> installiert haben. Es wird von LyX automatisch geladen, wenn Sie dem unten beschriebenen Vorgehen folgen. Wenn Sie XeTeX oder LuaTeX verwenden (und „Nicht-TeX-Schriften verwenden“ in <emphasis role='sans'>Dokument⇒Einstellungen⇒Schriften</emphasis> aktiviert haben), wird statt dessen das Paket <emphasis>xunicode</emphasis> geladen, da <emphasis>tipa</emphasis> in diesem Fall nicht funktioniert. Das Paket <emphasis>xunicode</emphasis> emuliert die Ausgabe von <emphasis>tipa</emphasis>, ist aber nicht perfekt, so dass die Ausgabe möglicherweise nicht wie erwartet ist. AuÃerdem müssen Sie in diesem Fall darauf achten, dass die Nicht-TeX-Schrift die IPA-Symbole auch enthält (empfehlenswert sind Schriften wie <emphasis>CMU Serif</emphasis> oder <emphasis>SIL Doulos</emphasis>). Sie können auch eine
Schrift nur für IPA definieren, indem sie das Folgende in <emphasis role='sans'>Dokument⇒Einstellungen⇒LaTeX-Vorspann</emphasis> eingeben:</para>
+<para><programlisting language="[LaTeX]TeX">\AtBeginDocument{%
+\newfontfamily{\ipafont}{CMU Serif}% oder eine ander Schriftart
+\def\useTIPAfont{\ipafont}
+}</programlisting>
+Für eine direkte Vorschau der IPA-Symbole im Arbeitsfenster sollten Sie weiterhin (egal, welche der oben beschriebenen Ausgabeformate Sie verwenden) das <emphasis>preview-latex</emphasis>-Paket <biblioref endterm="preview" /> installiert haben.</para>
+<para>Phonetische Zeichen werden in eine spezielle Umgebung eingegeben, die Sie über <emphasis role='sans'>Einfügen⇒Sonderzeichen⇒Phonetische Symbole </emphasis>aktivieren. Es wird ein kleiner umrahmter Eingabebereich eingefügt, in den Sie einzelne Zeichen, Wörter und Wortfolgen sowie auch mehrere Absätze mit phonetischer Notation eingeben können. Wenn Sie in dem Eingabebereich sind, wird eine Symbolleiste aktiviert, die die wichtigsten IPA-Symbole (nach den IPA-Kategorien sortiert) bereitstellt.<footnote>
+<para>Es fehlt ein Symbol: der (2005 in das IPA aufgenommene) labiodentale Flap. Dieses Zeichen unterstützt das <emphasis>Tipa-</emphasis>Paket noch nicht; daher kann es auch nicht von LyX unterstützt werden.</para>
+</footnote> Jeder Symbolbereich dieser Symbolleiste kann durch Klicken auf die gestrichelte Linie abgetrennt werden. Dadurch kann phonetische Notation recht komfortabel eingegeben werden: [ËÉtva zo:].<footnote>
+<para>Wenn Sie ein diakritisches Zeichen einfügen möchten, müssen Sie das Diakritikum <emphasis>nach</emphasis> dem Basiszeichen einfügen. Das heiÃt, für [dÌ¥] geben Sie zuerst <code><d></code> ein und dann direkt danach das Diakritikum <code><Stimmlos></code> von der Symbolleiste. Wenn Sie nur ein Diakritikum eingeben möchten, können Sie das direkt nach einem Leerzeichen tun, so wie hier: ̼ (<code>= <Leerzeichen>+<Lingolabial></code>).</para>
+</footnote> Wenn<emphasis> preview-latex</emphasis> installiert ist und Sie auÃerdem in<emphasis role='sans'> Werkzeuge⇒Einstellungen…⇒Grafik</emphasis> „Sofortige Vorschau“ aktiviert haben, zeigt LyX eine WYSIWYG-Vorschau der Notation an, sobald der Cursor den IPA-Bereich verlässt. Alternativ zur Symbolleiste können Sie die Zeichen auch direkt mithilfe der Kurznotation eingeben können, die im <emphasis>tipa</emphasis>-Handbuch erläutert wird: hier eine [kOst"pro:b@] (<emphasis>tipa</emphasis>-Kurznotation: <code>[kOst"pro:b@</code>]). Alternativ können Sie die meisten IPA-Zeichen auch über <emphasis role='sans'>Einfügen⇒Sonderzeichen⇒Symbole…</emphasis> in das Eingabefeld eingeben oder sie aus einem anderen Dokument kopieren und dort einfügen. Die Ausgabe sollte immer identisch sein, egal welche Eingabemethode Sie wählen.</para>
+<para>Bitte beachten Sie, dass Sie die meisten IPA-Zeichen über die zuletzt genannten Methoden auch auÃerhalb des IPA-Eingabebereichs einfügen können: [zoË viË hiËÉ̯]. In der Ausgabe werden diese Zeichen dann ebenfalls direkt in die korrekten <emphasis>tipa</emphasis>-Makros umgewandelt (lassen Sie es uns wissen, falls das nicht der Fall ist). Dieses Verfahren hat aber gravierende Nachteile gegenüber der IPA-Umgebung, denn die direkte Eingabe resultiert in der Regel in unerwünschter Schriftmischung (die lateinischen Buchstaben werden aus der Grundschrift, die speziellen IPA-Zeichen aber aus der IPA-Schrift genommen, und diese beiden Schriften passen nicht notwendigerweise zusammen). Innerhalb der IPA-Eingabeumgebung wird dagegen für alle Zeichen dieselbe Schrift verwendet. Deshalb sollten Sie, wenn Sie nicht nur Einzelzeichen eingeben, unbedingt den IPA-Eingabebereich verwenden.</para>
+</section>
+<section>
+<title>Weitere Informationen</title>
+<para>Mehr und ausführlichere Informationen über die Möglichkeiten des Einsatzes von LyX für linguistische Zwecke finden Sie auf der (englischsprachigen) <emphasis>LinguistLyX</emphasis>-Seite auf dem LyX-Wiki <biblioref endterm="linguistlyx" />. Sie sind übrigens herzlich eingeladen, dort aktiv mitzuschreiben!</para>
+</section>
+<bibliography>
+<bibliomixed xml:id='covington'>Das covington-Paket: <link xlink:href="http://www.ctan.org/tex-archive/macros/latex/contrib/covington/">http://www.ctan.org/tex-archive/macros/latex/contrib/covington/</link>.</bibliomixed>
+<bibliomixed xml:id='csquotes'>Das csquotes-Paket: <link xlink:href="http://www.ctan.org/tex-archive/macros/latex/contrib/csquotes/">http://www.ctan.org/tex-archive/macros/latex/contrib/csquotes/</link>.</bibliomixed>
+<bibliomixed xml:id='drs'> Das drs-Paket: <link xlink:href="https://ctan.org/tex-archive/macros/latex/contrib/drs">https://ctan.org/tex-archive/macros/latex/contrib/drs</link>.</bibliomixed>
+<bibliomixed xml:id='enumitem'>Das enumitem-Paket: <link xlink:href="http://www.ctan.org/tex-archive/macros/latex/contrib/enumitem/">http://www.ctan.org/tex-archive/macros/latex/contrib/enumitem/</link>.</bibliomixed>
+<bibliomixed xml:id='float'>Das float-Paket: <link xlink:href="http://www.ctan.org/tex-archive/macros/latex/contrib/float/">http://www.ctan.org/tex-archive/macros/latex/contrib/float/</link>.</bibliomixed>
+<bibliomixed xml:id='forest'>Das forest-Paket: <link xlink:href="http://www.ctan.org/tex-archive/graphics/pgf/contrib/forest">http://www.ctan.org/tex-archive/graphics/pgf/contrib/forest</link>.</bibliomixed>
+<bibliomixed xml:id='linguistlyx'>Maria Gouskova, Stacia Hartleben und Jürgen Spitzmüller: Using LyX for Linguistic Papers. <link xlink:href="https://wiki.lyx.org/LyX/LinguistLyX">https://wiki.lyx.org/LyX/LinguistLyX</link>.</bibliomixed>
+<bibliomixed xml:id='pict2e'>Das pict2e-Paket: <link xlink:href="https://ctan.org/tex-archive/macros/latex/contrib/pict2e">https://ctan.org/tex-archive/macros/latex/contrib/pict2e</link></bibliomixed>
+<bibliomixed xml:id='preview'>Das preview-latex-Paket: <link xlink:href="http://www.ctan.org/tex-archive/macros/latex/contrib/preview/">http://www.ctan.org/tex-archive/macros/latex/contrib/preview/</link>.</bibliomixed>
+<bibliomixed xml:id='tipa'>Das tipa-Paket und die zugehörigen Schriften: <link xlink:href="http://www.ctan.org/tex-archive/fonts/tipa/">http://www.ctan.org/tex-archive/fonts/tipa/</link>.</bibliomixed>
+</bibliography>
+</article>
\ No newline at end of file
diff --git a/lib/layouts/linguistics.module b/lib/layouts/linguistics.module
index d272c25..bcfc370 100644
--- a/lib/layouts/linguistics.module
+++ b/lib/layouts/linguistics.module
@@ -82,6 +82,10 @@ Style Numbered_Example_(multiline)
EndFont
Requires covington
Category Linguistics
+ DocBookWrapperTag informalexample
+ DocBookWrapperAttr role='numbered'
+ DocBookWrapperMergeWithPrevious true
+ DocBookTag para
End
@@ -107,6 +111,10 @@ Style Numbered_Examples_(consecutive)
LabelString "Custom Numbering|s"
Tooltip "Customize the numeration"
EndArgument
+ DocBookWrapperTag informalexample
+ DocBookWrapperAttr role='consecutive'
+ DocBookWrapperMergeWithPrevious true
+ DocBookTag para
End
diff --git a/src/Floating.cpp b/src/Floating.cpp
index a610c73..fe3c72c 100644
--- a/src/Floating.cpp
+++ b/src/Floating.cpp
@@ -90,9 +90,10 @@ string const & Floating::docbookAttr() const
string Floating::docbookTag(bool hasTitle) const
{
+ // TODO: configure this in the layouts?
if (floattype_ == "figure") {
return hasTitle ? "figure" : "informalfigure";
- } else if (floattype_ == "table") {
+ } else if (floattype_ == "table" || floattype_ == "tableau") {
return hasTitle ? "table" : "informaltable";
} else if (floattype_ == "algorithm") {
// TODO: no good translation for now! Figures are the closest match, as they can contain text.
@@ -119,7 +120,7 @@ string const & Floating::docbookCaption() const
docbook_caption_ = "";
if (floattype_ == "figure") {
docbook_caption_ = "title";
- } else if (floattype_ == "table") {
+ } else if (floattype_ == "table" || floattype_ == "tableau") {
docbook_caption_ = "caption";
} else if (floattype_ == "algorithm") {
// TODO: no good translation for now! Figures are the closest match, as they can contain text.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 28d2e1e..addf24a 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -293,7 +293,8 @@ void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar
if (prevpar != nullptr) {
Layout const & prevlay = prevpar->layout();
if (prevlay.docbookwrappertag() != "NONE") {
- if (prevlay.docbookwrappertag() == lay.docbookwrappertag())
+ if (prevlay.docbookwrappertag() == lay.docbookwrappertag() &&
+ prevlay.docbookwrapperattr() == lay.docbookwrapperattr())
openWrapper = !lay.docbookwrappermergewithprevious();
else
openWrapper = true;
@@ -329,7 +330,8 @@ void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpa
if (nextpar != nullptr) {
Layout const & nextlay = nextpar->layout();
if (nextlay.docbookwrappertag() != "NONE") {
- if (nextlay.docbookwrappertag() == lay.docbookwrappertag())
+ if (nextlay.docbookwrappertag() == lay.docbookwrappertag() &&
+ nextlay.docbookwrapperattr() == lay.docbookwrapperattr())
closeWrapper = !nextlay.docbookwrappermergewithprevious();
else
closeWrapper = true;
commit abed1f3e6e3654e60f5f4db877fc7f3c3180bbb2
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Wed Sep 2 00:36:46 2020 +0200
DocBook: fix crash with Linguistics example.
This was due to Floating::docbookTag not returning anything with the floattype_ tableau. Another issue that happened with that document is that the standard library's isspace crashed for some characters. I therefore implemented a more efficient version of the part that required it, and inlined the definition of isspace (even though that part becomes irrespective of locale, but was that feature ever used?).
diff --git a/src/Floating.cpp b/src/Floating.cpp
index 19fbf5f..a610c73 100644
--- a/src/Floating.cpp
+++ b/src/Floating.cpp
@@ -98,6 +98,10 @@ string Floating::docbookTag(bool hasTitle) const
// TODO: no good translation for now! Figures are the closest match, as they can contain text.
// Solvable as soon as https://github.com/docbook/docbook/issues/157 has a definitive answer.
return "figure";
+ } else {
+ // If nothing matches, return something that will not be valid.
+ LYXERR0("Unrecognised float type: " + floattype_);
+ return "float";
}
}
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 087d5a9..28d2e1e 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -427,6 +427,16 @@ void makeBibliography(
}
+bool isNotOnlySpace(docstring const & str)
+{
+ for (auto const & c: str) {
+ if (c != ' ' && c != '\t' && c != '\n' && c != '\v' && c != '\f' && c != '\r')
+ return true;
+ }
+ return false;
+}
+
+
void makeParagraph(
Text const & text,
Buffer const & buf,
@@ -518,8 +528,8 @@ void makeParagraph(
auto nextpar = par;
++nextpar;
auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0, nextpar == end, special_case);
- for (auto & parXML : pars) {
- if (!std::all_of(parXML.begin(), parXML.end(), ::isspace)) {
+ for (docstring const & parXML : pars) {
+ if (isNotOnlySpace(parXML)) {
if (open_par)
openParTag(xs, &*par, prevpar);
commit 594a4763b784edeaa96f875673dd3b5b4742ffc7
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Wed Sep 2 00:00:54 2020 +0200
Fix a few warnings.
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 9dea24b..a409d20 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3860,8 +3860,8 @@ bool Paragraph::isHardHyphenOrApostrophe(pos_type pos) const
char_type const c = d->text_[pos];
if (c != '-' && c != '\'')
return false;
- int nextpos = pos + 1;
- int prevpos = pos > 0 ? pos - 1 : 0;
+ pos_type nextpos = pos + 1;
+ pos_type prevpos = pos > 0 ? pos - 1 : 0;
if ((nextpos == psize || isSpace(nextpos))
&& (pos == 0 || isSpace(prevpos)))
return false;
diff --git a/src/insets/InsetNewline.cpp b/src/insets/InsetNewline.cpp
index b33cf00..4c6f17e 100644
--- a/src/insets/InsetNewline.cpp
+++ b/src/insets/InsetNewline.cpp
@@ -172,7 +172,7 @@ int InsetNewline::plaintext(odocstringstream & os,
}
-void InsetNewline::docbook(XMLStream & xs, OutputParams const & runparams) const
+void InsetNewline::docbook(XMLStream &, OutputParams const &) const
{
// New lines are handled by Paragraph::simpleDocBookOnePar.
}
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 1f17351..087d5a9 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -471,7 +471,7 @@ void makeParagraph(
// Plain layouts must be ignored.
special_case |= buf.params().documentClass().isPlainLayout(par->layout()) && !runparams.docbook_force_pars;
// Equations do not deserve their own paragraph (DocBook allows them outside paragraphs).
- special_case |= nInsets == par->size() && std::all_of(par->insetList().begin(), par->insetList().end(), [](InsetList::Element inset) {
+ special_case |= nInsets == (size_t) par->size() && std::all_of(par->insetList().begin(), par->insetList().end(), [](InsetList::Element inset) {
return inset.inset && inset.inset->asInsetMath();
});
commit 632bad62c9eb7939ed2d6eadf2f3bb5fdf4d31fe
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
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 ca1ca4326b027d7781c6ff31c1dfb1b5e4e53d8c
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
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/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/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..fede0e8 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,9 @@ Style Example
\addto\captions$$lang{\renewcommand{\examplename}{_(Example)}}
EndBabelPreamble
LabelCounter example
+ DocBookWrapperTag informalexample
+ DocBookTag para
+ DocBookAttr ""
End
@@ -263,6 +280,8 @@ Style Problem
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
LabelCounter problem
+ DocBookTag para
+ DocBookAttr role='problem'
End
@@ -282,6 +301,8 @@ Style Exercise
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
LabelCounter exercise
+ DocBookTag para
+ DocBookAttr role='exercise'
End
@@ -301,6 +322,8 @@ Style Solution
\addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
EndBabelPreamble
LabelCounter solution
+ DocBookTag para
+ DocBookAttr role='solution'
End
@@ -348,6 +371,9 @@ Style Claim
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
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 e4528f7..faaa2d0 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,9 @@ Style Example
\addto\captions$$lang{\renewcommand{\examplename}{_(Example)}}
EndBabelPreamble
LabelCounter example
+ DocBookWrapperTag informalexample
+ DocBookTag para
+ DocBookAttr ""
End
@@ -314,6 +331,8 @@ Style Problem
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
LabelCounter problem
+ DocBookTag para
+ DocBookAttr role='problem'
End
@@ -337,6 +356,8 @@ Style Exercise
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
LabelCounter exercise
+ DocBookTag para
+ DocBookAttr role='exercise'
End
@@ -360,6 +381,8 @@ Style Solution
\addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
EndBabelPreamble
LabelCounter solution
+ DocBookTag para
+ DocBookAttr role='solution'
End
@@ -415,6 +438,9 @@ Style Claim
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
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 99fcbf9..44cc806 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,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
@@ -297,6 +320,9 @@ Style Claim
BabelPreamble
\addto\captions$$lang{\renewcommand{\claimname}{_(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 a61a4df..a40098b 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,9 @@ Style Example
\addto\captions$$lang{\renewcommand{\examplename}{_(Example)}}
EndBabelPreamble
LabelCounter example
+ DocBookWrapperTag informalexample
+ DocBookTag para
+ DocBookAttr ""
End
@@ -219,6 +236,8 @@ Style Problem
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
LabelCounter problem
+ DocBookTag para
+ DocBookAttr role='problem'
End
@@ -238,6 +257,8 @@ Style Exercise
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
LabelCounter exercise
+ DocBookTag para
+ DocBookAttr role='exercise'
End
@@ -257,6 +278,8 @@ Style Solution
\addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
EndBabelPreamble
LabelCounter solution
+ DocBookTag para
+ DocBookAttr role='solution'
End
@@ -304,6 +327,9 @@ Style Claim
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
LabelCounter claim
+ DocBookTag para
+ DocBookAttr role='claim'
+ DocBookItemTag ""
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..fa02b21 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,9 @@ Style Example*
BabelPreamble
\addto\captions$$lang{\renewcommand{\examplename}{_(Example)}}
EndBabelPreamble
+ DocBookWrapperTag informalexample
+ DocBookTag para
+ DocBookAttr ""
End
@@ -211,6 +228,8 @@ Style Problem*
BabelPreamble
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
+ DocBookTag para
+ DocBookAttr role='problem'
End
@@ -228,6 +247,8 @@ Style Exercise*
BabelPreamble
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
+ DocBookTag para
+ DocBookAttr role='exercise'
End
@@ -245,6 +266,8 @@ Style Solution*
BabelPreamble
\addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
EndBabelPreamble
+ DocBookTag para
+ DocBookAttr role='solution'
End
@@ -270,6 +293,8 @@ Style Remark*
BabelPreamble
\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}
EndBabelPreamble
+ DocBookTag note
+ DocBookItemTag para
End
@@ -287,5 +312,8 @@ Style Claim*
BabelPreamble
\addto\captions$$lang{\renewcommand{\claimname}{_(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 80beb8e..43b8c0c 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,9 @@ Style Example
BabelPreamble
\addto\captions$$lang{\renewcommand{\examplename}{_(Example)}}
EndBabelPreamble
+ DocBookWrapperTag informalexample
+ DocBookTag para
+ DocBookAttr ""
End
@@ -243,6 +262,8 @@ Style Problem
BabelPreamble
\addto\captions$$lang{\renewcommand{\problemname}{_(Problem)}}
EndBabelPreamble
+ DocBookTag para
+ DocBookAttr role='problem'
End
@@ -276,6 +297,8 @@ Style Prob
EndFont
AddToToc thm
IsTocCaption true
+ DocBookTag para
+ DocBookAttr role='problem'
End
@@ -294,6 +317,8 @@ Style Solution
BabelPreamble
\addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
EndBabelPreamble
+ DocBookTag para
+ DocBookAttr role='solution'
End
@@ -308,6 +333,8 @@ Style Sol
Tooltip "Label of the corresponding problem"
IsTocCaption true
EndArgument
+ DocBookTag para
+ DocBookAttr role='solution'
End
@@ -326,6 +353,8 @@ Style Exercise
BabelPreamble
\addto\captions$$lang{\renewcommand{\exercisename}{_(Exercise)}}
EndBabelPreamble
+ DocBookTag para
+ DocBookAttr role='exercise'
End
@@ -344,6 +373,8 @@ Style Remark
BabelPreamble
\addto\captions$$lang{\renewcommand{\remarkname}{_(Remark)}}
EndBabelPreamble
+ DocBookTag note
+ DocBookItemTag para
End
@@ -357,6 +388,9 @@ Style Claim
BabelPreamble
\addto\captions$$lang{\renewcommand{\claimname}{_(Claim)}}
EndBabelPreamble
+ DocBookTag para
+ DocBookAttr role='claim'
+ DocBookItemTag ""
End
@@ -375,6 +409,8 @@ Style Case
BabelPreamble
\addto\captions$$lang{\renewcommand{\casename}{_(Case)}}
EndBabelPreamble
+ DocBookTag para
+ DocBookAttr role='case'
End
@@ -393,6 +429,8 @@ Style Property
BabelPreamble
\addto\captions$$lang{\renewcommand{\propertyname}{_(Property)}}
EndBabelPreamble
+ DocBookTag para
+ DocBookAttr role='property'
End
@@ -411,6 +449,8 @@ Style Question
BabelPreamble
\addto\captions$$lang{\renewcommand{\questionname}{_(Question)}}
EndBabelPreamble
+ DocBookTag para
+ DocBookAttr role='question'
End
@@ -429,5 +469,7 @@ Style Note
BabelPreamble
\addto\captions$$lang{\renewcommand{\notename}{_(Note)}}
EndBabelPreamble
+ DocBookTag note
+ DocBookItemTag para
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 e3da8b65f644df5d7de79c233187144825b9e7f1
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
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: lyx-docs at lists.lyx.org
+
+% 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
+<lyx-docs at lists.lyx.org>
+\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><lyx-docs at lists.lyx.org></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..fd2b75e 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
+ DocBookWrapperTag keycombo
+ DocBookWrapperTagType inline
+ DocBookTag keycap
+ DocBookTagType inline
End
InsetLayout Info:shortcuts
@@ -643,6 +675,10 @@ InsetLayout Info:shortcuts
HTMLStyle
span.shortcuts { font-family: sans-serif; }
EndHTMLStyle
+ DocBookWrapperTag keycombo
+ DocBookWrapperTagType 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 cf3873b..1f17351 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -493,6 +493,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 19734ea4543be66a186d6bf0592386d735c3a8cb
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
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 ce631e9..cf3873b 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -534,8 +534,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).
@@ -547,65 +558,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 {
@@ -613,8 +584,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 bc9d3ec262c0002827c2b1970350c7dec5ec860d
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
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 c80988b..ce631e9 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -49,7 +49,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 b5312cf51f7371044539aa492144cc6992374847
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
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 8f3d0fd88fa69d2b8b3f523a02fed88d55cdc22a
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
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 7005519..6d2af6c 100644
--- a/src/BiblioInfo.cpp
+++ b/src/BiblioInfo.cpp
@@ -1700,6 +1700,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.");
commit ff2e4ec7e65f43bf09b92f4b6b4be9ce135223d3
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Mon Aug 31 00:43:02 2020 +0200
DocBook: support Full Width from Tufte Book.
diff --git a/autotests/export/docbook/Tufte_Book.xml b/autotests/export/docbook/Tufte_Book.xml
index 3fb7f24..4968e25 100644
--- a/autotests/export/docbook/Tufte_Book.xml
+++ b/autotests/export/docbook/Tufte_Book.xml
@@ -3,26 +3,32 @@
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>Tufte Examples</title>
+<author>
+<personname>Fake Author</personname>
+</author>
</info>
<chapter>
-<title>The Features of the Tufte-book Class</title>
+<title>
+The Features of the Tufte-book Class
+</title>
<para>In this document, it was endeavored to show some of the features of the <emphasis role='sans'>Tufte-book</emphasis> class. In the first chapter, their use is outlined. In the second chapter, their use through a handout that was created in a calculus class is demonstrated.</para>
<section>
-<title>Working with Text</title>
-<para>One of the most prominent and distinctive features of this style is the extensive use of sidenotes. There is a wide margin to provide ample room for sidenotes and small figures. Any footnotes will automatically be converted to sidenotes.<footnote><para>This is a sidenote that was entered using a <code>footnote</code>.</para>
-</footnote> Alternatively, you can also use the <code>Sidenote</code> inset directly; you'll find it in the <emphasis role='sans'>Insert⇒Custom Insets</emphasis> menu.This is a sidenote that was entered using a <code>sidenote</code>.</para>
+<title>
+Working with Text
+</title>
+<para>One of the most prominent and distinctive features of this style is the extensive use of sidenotes. There is a wide margin to provide ample room for sidenotes and small figures. Any footnotes will automatically be converted to sidenotes.<footnote>
+<para>This is a sidenote that was entered using a <code>footnote</code>.</para>
+</footnote> Alternatively, you can also use the <code>Sidenote</code> inset directly; you'll find it in the <emphasis role='sans'>Insert⇒Custom Insets</emphasis> menu.This is a sidenote that was entered using a sidenote.</para>
<para>If you like to place ancillary information in the margin without the sidenote mark (the superscript number), you can use the <code>Marginnote</code> inset. This is Tufte's margin note. Notice that there isn't a number preceding the note, and there is no number in the main text where this note was written. The normal margin note will work as well, but it will look rather odd.<sidebar role="margin">
-<?dbfo float-type="margin.note"?><sidebar role="margin">This is a normal margin note. Don't use it.</sidebar></sidebar></para>
-<para>Another useful innovation is Tufte's <code>NewThought</code> character style (<emphasis role='sans'>Edit⇒TextStyle⇒NewThought</emphasis>). It introduces new thoughts by means of small caps, as demonstrated in this paragraph. </para>
+<?dbfo float-type="margin.note"?>
+<para>This is a normal margin note. Don't use it.</para></sidebar></para>
+<para><emphasis role='newthought'>Another useful</emphasis> innovation is Tufte's <code>NewThought</code> character style (<emphasis role='sans'>Edit⇒TextStyle⇒NewThought</emphasis>). It introduces new thoughts by means of small caps, as demonstrated in this paragraph. </para>
<para>The Tufte document classes include two new character styles and some improvements on existing commands for letterspacing.</para>
-<para>When setting strings of <emphasis role='allcaps'>ALL CAPS</emphasis> or small caps, the letterspacingâthat is, the spacing between the lettersâshould be increased slightly.<biblioref endterm="Bringhurst2005" /> The <emphasis>AllCaps</emphasis> character style (<emphasis role='sans'>Edit⇒TextStyle⇒AllCaps</emphasis>) has proper letterspacing for strings of <emphasis role='allcaps'>FULL CAPITAL LETTERS</emphasis>, and the <emphasis>SmallCaps</emphasis> character style (<emphasis role='sans'>Edit⇒TextStyle⇒SmallCaps</emphasis>) has letterspacing for small capital letters. These commands will also automatically convert the case of the text to upper- or lowercase, respectively.</para>
+<para>When setting strings of <emphasis role='allcaps'>ALL CAPS</emphasis> or <emphasis role='smallcaps'>small caps</emphasis>, the letterspacingâthat is, the spacing between the lettersâshould be increased slightly.<biblioref endterm="Bringhurst2005" /> The <emphasis>AllCaps</emphasis> character style (<emphasis role='sans'>Edit⇒TextStyle⇒AllCaps</emphasis>) has proper letterspacing for strings of <emphasis role='allcaps'>FULL CAPITAL LETTERS</emphasis>, and the <emphasis>SmallCaps</emphasis> character style (<emphasis role='sans'>Edit⇒TextStyle⇒SmallCaps</emphasis>) has letterspacing for <emphasis role='smallcaps'>small capital letters</emphasis>. These commands will also automatically convert the case of the text to upper- or lowercase, respectively.</para>
<para>The normal <emphasis>Small Caps</emphasis> shape has also been redefined to include letterspacing. Its case is left as is, however. This allows one to use both uppercase and lowercase letters: <emphasis role='smallcaps'>The Initial Letters Of The Words In This Sentence Are Capitalized.</emphasis></para>
<para>Finally, the<emphasis> Full Width</emphasis> paragraph environment provides a paragraph layout that stretches across the main text block and the sidenotes area:</para>
-<Full Width>
-Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
-</Full Width>
+<para role='fullwidth'>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.</para>
</section>
</chapter>
<bibliography>
diff --git a/lib/layouts/tufte-book.layout b/lib/layouts/tufte-book.layout
index 2b88ca3..e469996 100644
--- a/lib/layouts/tufte-book.layout
+++ b/lib/layouts/tufte-book.layout
@@ -243,6 +243,8 @@ Style Full_Width
Align Block
AlignPossible Block, Left, Right, Center
LabelType No_Label
+ DocBookTag para
+ DocBookAttr role='fullwidth'
End
# this steps the counters
commit 6d246bba695bdfd414c0359891fbbb4e9a061f99
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Mon Aug 31 00:42:32 2020 +0200
DocBook: fix margin notes.
They were nested twice in <sidebar>. Also fixes a new line issue.
diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc
index 04c464a..ab15f77 100644
--- a/lib/layouts/stdinsets.inc
+++ b/lib/layouts/stdinsets.inc
@@ -44,8 +44,7 @@ InsetLayout Marginal
EndHTMLStyle
AddToToc marginalnote
IsTocCaption true
- DocBookTag sidebar
- DocBookAttr role="margin"
+ DocBookTag para
End
InsetLayout Foot
diff --git a/src/insets/InsetMarginal.cpp b/src/insets/InsetMarginal.cpp
index 5d2fb90..3a5296d 100644
--- a/src/insets/InsetMarginal.cpp
+++ b/src/insets/InsetMarginal.cpp
@@ -49,6 +49,7 @@ void InsetMarginal::docbook(XMLStream & xs, OutputParams const & runparams) cons
xs << xml::StartTag("sidebar", "role=\"margin\"");
xs << xml::CR();
xs << XMLStream::ESCAPE_NONE << "<?dbfo float-type=\"margin.note\"?>";
+ xs << xml::CR();
InsetText::docbook(xs, runparams);
xs << xml::EndTag("sidebar");
}
commit 91982ee105c84395cebb637444e52342938edc39
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Mon Aug 31 00:21:12 2020 +0200
DocBook: new lines around formulae.
diff --git a/autotests/export/docbook/mathml_ns_entities.xml b/autotests/export/docbook/mathml_ns_entities.xml
index 2ee7f39..0c1509e 100644
--- a/autotests/export/docbook/mathml_ns_entities.xml
+++ b/autotests/export/docbook/mathml_ns_entities.xml
@@ -1,21 +1,24 @@
<?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>A formula:
- <informalequation>
- <m:math>
- <m:alt role='tex'>\Vert,\vert</m:alt>
+<informalequation>
+<alt role='tex'>\Vert,\vert</alt>
+ <m:math>
+
<m:mrow>
<m:mrow><m:mi>∥</m:mi><m:mo>,</m:mo><m:mi>|</m:mi>
</m:mrow>
</m:mrow>
- </m:math>
- </informalequation>A second formula:
- <informalequation>
- <m:math>
- <m:alt role='tex'>\left\Vert \mathbf{a^{T}\,x}\right\Vert _{2}\leq x_{0}</m:alt>
+ </m:math>
+</informalequation>
+A second formula:
+<informalequation>
+<alt role='tex'>\left\Vert \mathbf{a^{T}\,x}\right\Vert _{2}\leq x_{0}</alt>
+ <m:math>
+
<m:mrow>
<m:mrow>
<m:msub>
@@ -45,7 +48,7 @@
</m:msub>
</m:mrow>
</m:mrow>
- </m:math>
- </informalequation></para>
-
-</article>
+ </m:math>
+</informalequation>
+</para>
+</article>
\ No newline at end of file
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index af30e8e..e7326b6 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -2418,13 +2418,11 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
{
// Choose the tag around the MathML equation.
docstring name;
+ bool doCR = false;
if (getType() == hullSimple)
name = from_ascii("inlineequation");
else {
- // This is a block equation, always have <informalequation> on its own line.
- if (!xs.isLastTagCR())
- xs << xml::CR();
-
+ doCR = true; // This is a block equation, always have <informalequation> on its own line.
name = from_ascii("informalequation");
}
@@ -2439,6 +2437,10 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
}
}
+ if (doCR)
+ if (!xs.isLastTagCR())
+ xs << xml::CR();
+
xs << xml::StartTag(name, attr);
xs << xml::CR();
@@ -2485,6 +2487,8 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
xs << XMLStream::ESCAPE_NONE << osmath.str();
xs << xml::CR();
xs << xml::EndTag(name);
+ if (doCR)
+ xs << xml::CR();
}
commit e995414917937e1fd8bdf108c8269777cf215719
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Mon Aug 31 00:18:35 2020 +0200
DocBook: avoid generating fonts for "special cases" like equations.
diff --git a/autotests/export/docbook/lists.xml b/autotests/export/docbook/lists.xml
index 6812230..ce2d970 100644
--- a/autotests/export/docbook/lists.xml
+++ b/autotests/export/docbook/lists.xml
@@ -125,7 +125,7 @@
<varlistentry>
<term>LyX:</term>
<listitem>
-
+<para />
<variablelist>
<varlistentry>
<term>lyx16</term>
diff --git a/autotests/export/docbook/math_in_font.xml b/autotests/export/docbook/math_in_font.xml
index 0758a2e..45bb544 100644
--- a/autotests/export/docbook/math_in_font.xml
+++ b/autotests/export/docbook/math_in_font.xml
@@ -4,7 +4,8 @@
<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>LyX</title>
<para>Some text before.</para>
-<informalequation><alt role='tex'>\cfrac[l]{A}{B+C}\,,\,\cfrac{A}{B+C}\,,\,\cfrac[r]{A}{B+C}</alt>
+<informalequation>
+<alt role='tex'>\cfrac[l]{A}{B+C}\,,\,\cfrac{A}{B+C}\,,\,\cfrac[r]{A}{B+C}</alt>
<m:math>
<m:mrow>
@@ -35,6 +36,7 @@
</m:mfrac>
</m:mrow>
</m:mrow>
- </m:math></informalequation><para>Some text after.</para>
-
+ </m:math>
+</informalequation>
+<para>Some text after.</para>
</article>
\ No newline at end of file
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index b88c381..9dea24b 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3333,7 +3333,8 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
OutputParams const & runparams,
Font const & outerfont,
pos_type initial,
- bool is_last_par) const
+ bool is_last_par,
+ bool ignore_fonts) const
{
// Track whether we have opened these tags
DocBookFontState fs;
@@ -3362,33 +3363,37 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
// If this is an InsetNewline, generate a new paragraph. Also reset the fonts, so that tags are closed in
// this paragraph.
if (getInset(i) != nullptr && getInset(i)->lyxCode() == NEWLINE_CODE) {
- xs->closeFontTags();
+ if (!ignore_fonts)
+ xs->closeFontTags();
generatedParagraphs.push_back(os.str());
os = odocstringstream();
delete xs;
xs = new XMLStream(os);
- font_old = outerfont.fontInfo();
+ if (!ignore_fonts)
+ font_old = outerfont.fontInfo();
}
- // Determine which tags should be opened or closed.
+ // Determine which tags should be opened or closed regarding fonts.
Font const font = getFont(buf.masterBuffer()->params(), i, outerfont);
- tie(tagsToOpen, tagsToClose) = computeDocBookFontSwitch(font_old, font, default_family, fs);
+ if (!ignore_fonts) {
+ tie(tagsToOpen, tagsToClose) = computeDocBookFontSwitch(font_old, font, default_family, fs);
- // FIXME XHTML
- // Other such tags? What about the other text ranges?
+ // FIXME XHTML
+ // Other such tags? What about the other text ranges?
- vector<xml::EndFontTag>::const_iterator cit = tagsToClose.begin();
- vector<xml::EndFontTag>::const_iterator cen = tagsToClose.end();
- for (; cit != cen; ++cit)
- *xs << *cit;
+ vector<xml::EndFontTag>::const_iterator cit = tagsToClose.begin();
+ vector<xml::EndFontTag>::const_iterator cen = tagsToClose.end();
+ for (; cit != cen; ++cit)
+ *xs << *cit;
- vector<xml::FontTag>::const_iterator sit = tagsToOpen.begin();
- vector<xml::FontTag>::const_iterator sen = tagsToOpen.end();
- for (; sit != sen; ++sit)
- *xs << *sit;
+ vector<xml::FontTag>::const_iterator sit = tagsToOpen.begin();
+ vector<xml::FontTag>::const_iterator sen = tagsToOpen.end();
+ for (; sit != sen; ++sit)
+ *xs << *sit;
- tagsToClose.clear();
- tagsToOpen.clear();
+ tagsToClose.clear();
+ tagsToOpen.clear();
+ }
if (Inset const * inset = getInset(i)) {
if (!runparams.for_toc || inset->isInToc()) {
@@ -3409,7 +3414,8 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
// FIXME, this code is just imported from XHTML
// I'm worried about what happens if a branch, say, is itself
// wrapped in some font stuff. I think that will not work.
- xs->closeFontTags();
+ if (!ignore_fonts)
+ xs->closeFontTags();
// In listings, new lines are very important. Avoid generating one for the last line.
if (runparams.docbook_in_listing && !is_last_par)
diff --git a/src/Paragraph.h b/src/Paragraph.h
index 96c19c0..597a10b 100644
--- a/src/Paragraph.h
+++ b/src/Paragraph.h
@@ -214,7 +214,8 @@ public:
OutputParams const & runparams,
Font const & outerfont,
pos_type initial = 0,
- bool is_last_par = false) const;
+ bool is_last_par = false,
+ bool ignore_fonts = false) const;
/// \return any material that has had to be deferred until after the
/// paragraph has closed.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 808b4cf..c80988b 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -513,7 +513,7 @@ void makeParagraph(
// Open and close tags around each contained paragraph.
auto nextpar = par;
++nextpar;
- auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0, nextpar == end);
+ auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0, nextpar == end, special_case);
for (auto & parXML : pars) {
if (!std::all_of(parXML.begin(), parXML.end(), ::isspace)) {
if (open_par)
commit 654559feb8b4ed357647554b4043b6c631482b4e
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 23:56:16 2020 +0200
DocBook: fix line issues around programlisting.
diff --git a/autotests/export/docbook/listings.xml b/autotests/export/docbook/listings.xml
index e65de60..1ed2694 100644
--- a/autotests/export/docbook/listings.xml
+++ b/autotests/export/docbook/listings.xml
@@ -5,6 +5,5 @@
<title>Test document</title>
<para>This is a programlisting: </para>
<programlisting>First line of programlisting
-Second line of programlisting
-</programlisting>
+Second line of programlisting</programlisting>
</article>
\ No newline at end of file
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index b4e4bc3..b88c381 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3332,7 +3332,8 @@ std::tuple<vector<xml::FontTag>, vector<xml::EndFontTag>> computeDocBookFontSwit
std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
OutputParams const & runparams,
Font const & outerfont,
- pos_type initial) const
+ pos_type initial,
+ bool is_last_par) const
{
// Track whether we have opened these tags
DocBookFontState fs;
@@ -3409,7 +3410,9 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
// I'm worried about what happens if a branch, say, is itself
// wrapped in some font stuff. I think that will not work.
xs->closeFontTags();
- if (runparams.docbook_in_listing)
+
+ // In listings, new lines are very important. Avoid generating one for the last line.
+ if (runparams.docbook_in_listing && !is_last_par)
*xs << xml::CR();
// Finalise the last (and most likely only) paragraph.
diff --git a/src/Paragraph.h b/src/Paragraph.h
index ee31403..96c19c0 100644
--- a/src/Paragraph.h
+++ b/src/Paragraph.h
@@ -213,7 +213,8 @@ public:
std::vector<docstring> simpleDocBookOnePar(Buffer const & buf,
OutputParams const & runparams,
Font const & outerfont,
- pos_type initial = 0) const;
+ pos_type initial = 0,
+ bool is_last_par = false) const;
/// \return any material that has had to be deferred until after the
/// paragraph has closed.
diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp
index 848e4ae..93daab4 100644
--- a/src/insets/InsetListings.cpp
+++ b/src/insets/InsetListings.cpp
@@ -485,6 +485,9 @@ void InsetListings::docbook(XMLStream & xs, OutputParams const & rp) const
{
InsetLayout const & il = getLayout();
+ if (!xs.isLastTagCR())
+ xs << xml::CR();
+
// Forge the attributes.
string attrs;
if (!il.docbookattr().empty())
@@ -517,6 +520,7 @@ void InsetListings::docbook(XMLStream & xs, OutputParams const & rp) const
// Done with the listing.
xs.endDivision();
xs << xml::EndTag(il.docbooktag());
+ xs << xml::CR();
}
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index d672144..808b4cf 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -504,8 +504,6 @@ void makeParagraph(
// or we're not in the last paragraph, anyway.
// (ii) We didn't open it and docbook_in_par is true,
// but we are in the first par, and there is a next par.
- auto nextpar = par;
- ++nextpar;
bool const close_par = open_par && (!runparams.docbook_in_par);
// Determine if this paragraph has some real content. Things like new pages are not caught
@@ -513,7 +511,9 @@ void makeParagraph(
// Thus, remove all spaces (including new lines: \r, \n) before checking for emptiness.
// std::all_of allows doing this check without having to copy the string.
// Open and close tags around each contained paragraph.
- auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0);
+ auto nextpar = par;
+ ++nextpar;
+ auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0, nextpar == end);
for (auto & parXML : pars) {
if (!std::all_of(parXML.begin(), parXML.end(), ::isspace)) {
if (open_par)
commit 9d3a717ef1eda27ab2b58ae84b483d044364e156
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 23:38:40 2020 +0200
DocBook: fix font issues when a paragraph has an InsetNewline.
diff --git a/autotests/export/docbook/issue5165.xml b/autotests/export/docbook/issue5165.xml
index 2e24ebc..81d840d 100644
--- a/autotests/export/docbook/issue5165.xml
+++ b/autotests/export/docbook/issue5165.xml
@@ -4,9 +4,10 @@
<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>Title</title>
-<author><personname>Author</personname></author>
+<author>
+<personname>Author</personname>
+</author>
<date>Date</date>
</info>
<para>Content</para>
-
</article>
\ No newline at end of file
diff --git a/autotests/export/docbook/labeling_list_nested.xml b/autotests/export/docbook/labeling_list_nested.xml
index 261605c..4ecb1c6 100644
--- a/autotests/export/docbook/labeling_list_nested.xml
+++ b/autotests/export/docbook/labeling_list_nested.xml
@@ -7,22 +7,19 @@
<variablelist>
<varlistentry>
<term>LyX:</term>
-
<listitem>
-
+<para />
<variablelist>
<varlistentry>
<term>lyx16</term>
-
<listitem>
-<para> LyX 1.6 file format (lyx2lyx)</para>
+<para>LyX 1.6 file format (lyx2lyx)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>lyx21</term>
-
<listitem>
-<para> </para>
+<para />
</listitem>
</varlistentry>
</variablelist>
@@ -30,27 +27,23 @@
</varlistentry>
<varlistentry>
<term>LyX:</term>
-
<listitem>
-
+<para />
<variablelist>
<varlistentry>
<term>lyx16</term>
-
<listitem>
-<para> LyX 1.6 file format (lyx2lyx)</para>
+<para>LyX 1.6 file format (lyx2lyx)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>lyx21</term>
-
<listitem>
-<para> </para>
+<para />
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
-
</article>
\ No newline at end of file
diff --git a/autotests/export/docbook/list_depth.xml b/autotests/export/docbook/list_depth.xml
index 3833931..5eaa83c 100644
--- a/autotests/export/docbook/list_depth.xml
+++ b/autotests/export/docbook/list_depth.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>
<itemizedlist>
<listitem>
@@ -9,5 +9,4 @@
<para>Content.</para>
</listitem>
</itemizedlist>
-
-</article>
+</article>
\ No newline at end of file
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index aad1ccf..b4e4bc3 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3358,12 +3358,15 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
if (isDeleted(i))
continue;
- // If this is an InsetNewline, generate a new paragraph.
+ // If this is an InsetNewline, generate a new paragraph. Also reset the fonts, so that tags are closed in
+ // this paragraph.
if (getInset(i) != nullptr && getInset(i)->lyxCode() == NEWLINE_CODE) {
+ xs->closeFontTags();
generatedParagraphs.push_back(os.str());
os = odocstringstream();
delete xs;
xs = new XMLStream(os);
+ font_old = outerfont.fontInfo();
}
// Determine which tags should be opened or closed.
commit 7a1b82a16ae5594e7354c507ecb47082abada9f4
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 23:29:02 2020 +0200
DocBook: fix issue with fonts.
diff --git a/autotests/export/docbook/issue1732_charstyles-docbook.xml b/autotests/export/docbook/issue1732_charstyles-docbook.xml
index 0ed9b87..fc9bffe 100644
--- a/autotests/export/docbook/issue1732_charstyles-docbook.xml
+++ b/autotests/export/docbook/issue1732_charstyles-docbook.xml
@@ -3,5 +3,4 @@
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">
<para><emphasis role='bold'>Fett </emphasis><emphasis>hervorgehoben</emphasis> <code>monospace</code><emphasis role='underline'> unterstrichen.</emphasis></para>
-
</article>
\ No newline at end of file
diff --git a/src/xml.cpp b/src/xml.cpp
index 150f4c5..dd9790f 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -208,9 +208,6 @@ bool XMLStream::closeFontTags()
if (**curtag != xml::parsep_tag)
os_ << (*curtag)->writeEndTag();
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);
if (tag_stack_.empty())
return true;
curtag = &tag_stack_.back();
commit c3aa843da8ad1d56b54ac287a585022946422661
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 22:08:01 2020 +0200
DocBook: fixes in bibliography (missing new line at the end).
diff --git a/autotests/export/docbook/easy.xml b/autotests/export/docbook/easy.xml
index 883c982..e301321 100644
--- a/autotests/export/docbook/easy.xml
+++ b/autotests/export/docbook/easy.xml
@@ -12,8 +12,9 @@
<para>I am an abstract</para>
<para>I am also an abstract</para>
</abstract>
+
</info>
-<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>
@@ -50,7 +51,7 @@
<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>
+<para>See <xref linkend="sec.Sec-1" />.</para>
</section>
<section>
<title>I am the third section and I deal with star sections</title>
diff --git a/autotests/export/docbook/issue_infinite_loop.xml b/autotests/export/docbook/issue_infinite_loop.xml
index d6e55ee..e262ed4 100644
--- a/autotests/export/docbook/issue_infinite_loop.xml
+++ b/autotests/export/docbook/issue_infinite_loop.xml
@@ -5,7 +5,8 @@
<title>William Shakespeare</title>
<section>
<title>Publications</title>
-<bibliography>First Folio. Me. 1623..</bibliography>
</section>
-
+<bibliography>
+<bibliomixed xml:id='firstref'>First Folio. Me. 1623..</bibliomixed>
+</bibliography>
</article>
\ No newline at end of file
diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp
index c03a8e2..05fd23d 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -1411,6 +1411,7 @@ void InsetBibtex::docbook(XMLStream & xs, OutputParams const &) const
// Footer for bibliography.
xs << xml::EndTag("bibliography");
+ xs << xml::CR();
}
commit 6688b076cc6994b57564ba575d8276bd68f4bd2d
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 22:05:40 2020 +0200
DocBook: fixes in lists.
Actually output something when list item is empty. XMLStream discarded the sequence StartTag/EndTag (nothing in between).
New-line behaviour around term in description lists.
diff --git a/autotests/export/docbook/Development.xml b/autotests/export/docbook/Development.xml
index d0bc9a4..9ec891d 100644
--- a/autotests/export/docbook/Development.xml
+++ b/autotests/export/docbook/Development.xml
@@ -6,7 +6,7 @@
<subtitle>Version 2.3.x</subtitle>
<section>
<title>File formats</title>
-<section xml:id="sec.When-is-an-0">
+<section xml:id="sec.When-is-an">
<title>When is an update of the .lyx file format number needed?</title>
<para>When you are working on a new feature you may ask yourself whether it needs an update of the .lyx file format number. Whether an update is needed or not is not always obvious. Rule of thumb: </para>
<blockquote>
@@ -17,30 +17,30 @@
<varlistentry>
<term>New document setting</term>
<listitem>
-<para> Whenever you introduce a new setting that is stored in the document header, a file format update is needed.</para>
+<para>Whenever you introduce a new setting that is stored in the document header, a file format update is needed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Removed document setting</term>
<listitem>
-<para> If a certain setting becomes obsolete and gets removed, a file format update is needed.</para>
+<para>If a certain setting becomes obsolete and gets removed, a file format update is needed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>New valid value for an existing setting,</term>
<listitem>
-<para> e. g.</para>
+<para>e. g.</para>
<variablelist>
<varlistentry>
<term>Automatically loaded math package</term>
<listitem>
-<para> The reason for this is that there is no true ERT inset for math formulas: Each command is parsed, and if a user happens to define a local command with the same name as a command that triggers an automatic load of a package, they need to be able to switch off the automatic loading of that package. This switch is stored by the use_package header setting.</para>
+<para>The reason for this is that there is no true ERT inset for math formulas: Each command is parsed, and if a user happens to define a local command with the same name as a command that triggers an automatic load of a package, they need to be able to switch off the automatic loading of that package. This switch is stored by the use_package header setting.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>New language</term>
<listitem>
-<para> that is stored in \language. </para>
+<para>that is stored in \language. </para>
</listitem>
</varlistentry>
</variablelist>
@@ -49,49 +49,49 @@
<varlistentry>
<term>New inset</term>
<listitem>
-<para> Of course a new inset requires a file format update.</para>
+<para>Of course a new inset requires a file format update.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>New style</term>
<listitem>
-<para> If a new style or inset layout is added to any layout file or module shipped with LyX, then a new file format is needed in the master (development) branch. It is possible to backport new styles to the stable version without a file format change.</para>
+<para>If a new style or inset layout is added to any layout file or module shipped with LyX, then a new file format is needed in the master (development) branch. It is possible to backport new styles to the stable version without a file format change.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Removed style</term>
<listitem>
-<para> If a style or inset layout is removed in any layout file or module shipped with LyX, a new file format is required.</para>
+<para>If a style or inset layout is removed in any layout file or module shipped with LyX, a new file format is required.</para>
</listitem>
</varlistentry>
</variablelist>
<para>However, <emphasis role='bold'>new</emphasis> layouts and modules do <emphasis role='bold'>not</emphasis> require a file format update (changed 03/16). </para>
<para>If you are still unsure, please ask on the development list.</para>
-<section xml:id="par.export-test-output-formats-1">
+<section xml:id="par.export-test-output-formats">
<title>Output formats</title>
<para>The following output formats are currently tested for each sample document:</para>
<variablelist>
<varlistentry>
<term>LyX:</term>
<listitem>
-
+<para />
<variablelist>
<varlistentry>
<term>lyx16</term>
<listitem>
-<para> LyX 1.6 file format (lyx2lyx)</para>
+<para>LyX 1.6 file format (lyx2lyx)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>lyx21</term>
<listitem>
-<para> LyX 2.1 file format (lyx2lyx)</para>
+<para>LyX 2.1 file format (lyx2lyx)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>xhtml</term>
<listitem>
-<para> LyXHTML (native LyX HTML export)</para>
+<para>LyXHTML (native LyX HTML export)</para>
</listitem>
</varlistentry>
</variablelist>
@@ -100,54 +100,54 @@
<varlistentry>
<term>LyX + LaTeX:</term>
<listitem>
-
+<para />
<variablelist>
<varlistentry>
<term>dvi</term>
<listitem>
-<para> DVI (8-bit latex)</para>
+<para>DVI (8-bit latex)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>dvi3_texF</term>
<listitem>
-<para> DVI (LuaTeX with 8-bit TeX fonts)</para>
+<para>DVI (LuaTeX with 8-bit TeX fonts)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>dvi3_systemF</term>
<listitem>
-<para> DVI (LuaTeX with Unicode fonts)</para>
+<para>DVI (LuaTeX with Unicode fonts)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>pdf2</term>
<listitem>
-<para> PDF (pdflatex)</para>
+<para>PDF (pdflatex)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>pdf4_texF</term>
<listitem>
-<para> PDF (XeTeX with 8-bit TeX fonts)</para>
+<para>PDF (XeTeX with 8-bit TeX fonts)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>pdf4_systemF</term>
<listitem>
-<para> PDF (XeTeX with Unicode fonts)</para>
+<para>PDF (XeTeX with Unicode fonts)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>pdf5_texF</term>
<listitem>
-<para> PDF (LuaTeX with 8-bit TeX fonts)</para>
+<para>PDF (LuaTeX with 8-bit TeX fonts)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>pdf5_systemF</term>
<listitem>
-<para> PDF (LuaTeX with Unicode fonts)</para>
+<para>PDF (LuaTeX with Unicode fonts)</para>
</listitem>
</varlistentry>
</variablelist>
@@ -156,18 +156,18 @@
<varlistentry>
<term>LyX + LaTeX + postprocessing:</term>
<listitem>
-
+<para />
<variablelist>
<varlistentry>
<term>pdf</term>
<listitem>
-<para> DVI -> PS (dvips) -> PDF (ps2pdf)</para>
+<para>DVI -> PS (dvips) -> PDF (ps2pdf)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>pdf3</term>
<listitem>
-<para> DVI -> PDF (dvipdfm)</para>
+<para>DVI -> PDF (dvipdfm)</para>
</listitem>
</varlistentry>
</variablelist>
@@ -176,90 +176,90 @@
<varlistentry>
<term>not tested:</term>
<listitem>
-<para> (or only if set as default output format in the document source)</para>
+<para>(or only if set as default output format in the document source)</para>
<variablelist>
<varlistentry>
<term>latex</term>
<listitem>
-<para> LaTeX (plain)</para>
+<para>LaTeX (plain)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>luatex</term>
<listitem>
-<para> LaTeX (LuaTeX)</para>
+<para>LaTeX (LuaTeX)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>dviluatex</term>
<listitem>
-<para> LaTeX (dviluatex)</para>
+<para>LaTeX (dviluatex)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>pdflatex</term>
<listitem>
-<para> LaTeX (pdflatex)</para>
+<para>LaTeX (pdflatex)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>platex</term>
<listitem>
-<para> LaTeX (pLaTeX)</para>
+<para>LaTeX (pLaTeX)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>xetex</term>
<listitem>
-<para> LaTeX (XeTeX) </para>
+<para>LaTeX (XeTeX) </para>
</listitem>
</varlistentry>
<varlistentry>
<term>eps3</term>
<listitem>
-<para> EPS (encapsulated Postscript) (cropped)</para>
+<para>EPS (encapsulated Postscript) (cropped)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>ps</term>
<listitem>
-<para> DVI -> Postscript (dvips)</para>
+<para>DVI -> Postscript (dvips)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>odf</term>
<listitem>
-<para> </para>
+<para />
</listitem>
</varlistentry>
<varlistentry>
<term>text</term>
<listitem>
-<para> (nor text2, ..., text4)</para>
+<para>(nor text2, ..., text4)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>textparagraph</term>
<listitem>
-<para> </para>
+<para />
</listitem>
</varlistentry>
<varlistentry>
<term>word</term>
<listitem>
-<para> </para>
+<para />
</listitem>
</varlistentry>
<varlistentry>
<term>word2</term>
<listitem>
-<para> </para>
+<para />
</listitem>
</varlistentry>
<varlistentry>
<term>wordhtml</term>
<listitem>
-<para> </para>
+<para />
</listitem>
</varlistentry>
</variablelist>
@@ -269,5 +269,4 @@
</section>
</section>
</section>
-
</article>
\ No newline at end of file
diff --git a/lib/layouts/beamer.layout b/lib/layouts/beamer.layout
index b316b14..f6d17c3 100644
--- a/lib/layouts/beamer.layout
+++ b/lib/layouts/beamer.layout
@@ -234,6 +234,7 @@ Style Description
DocBookItemTag listitem
DocBookItemInnerTag para
DocBookItemLabelTag term
+ DocBookItemLabelTagType paragraph
End
diff --git a/lib/layouts/egs.layout b/lib/layouts/egs.layout
index 0298b69..6ee01ed 100644
--- a/lib/layouts/egs.layout
+++ b/lib/layouts/egs.layout
@@ -269,6 +269,7 @@ Style Description
DocBookItemTag listitem
DocBookItemInnerTag para
DocBookItemLabelTag term
+ DocBookItemLabelTagType paragraph
End
diff --git a/lib/layouts/hollywood.layout b/lib/layouts/hollywood.layout
index 38767c4..7d10bb9 100644
--- a/lib/layouts/hollywood.layout
+++ b/lib/layouts/hollywood.layout
@@ -142,6 +142,7 @@ Style Description
DocBookItemTag listitem
DocBookItemInnerTag para
DocBookItemLabelTag term
+ DocBookItemLabelTagType paragraph
End
diff --git a/lib/layouts/scrclass.inc b/lib/layouts/scrclass.inc
index 1a41a4d..9524ec0 100644
--- a/lib/layouts/scrclass.inc
+++ b/lib/layouts/scrclass.inc
@@ -69,6 +69,7 @@ Style Labeling
DocBookItemTag listitem
DocBookItemInnerTag para
DocBookItemLabelTag term
+ DocBookItemLabelTagType paragraph
End
Input stdsections.inc
diff --git a/lib/layouts/svcommon.inc b/lib/layouts/svcommon.inc
index 57573cc..67ed799 100644
--- a/lib/layouts/svcommon.inc
+++ b/lib/layouts/svcommon.inc
@@ -620,6 +620,7 @@ Style Description
DocBookItemTag listitem
DocBookItemInnerTag para
DocBookItemLabelTag term
+ DocBookItemLabelTagType paragraph
End
Style Petit
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index cf76bf4..d672144 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -255,6 +255,25 @@ void closeTag(XMLStream & xs, const std::string & tag, const std::string & tagty
}
+void compTag(XMLStream & xs, const std::string & tag, const std::string & attr, const std::string & tagtype)
+{
+ if (tag.empty() || tag == "NONE")
+ return;
+
+ // Special case for <para>: always considered as a paragraph.
+ if (tag == "para" || tagtype == "paragraph" || tagtype == "block") {
+ if (!xs.isLastTagCR())
+ xs << xml::CR();
+ xs << xml::CompTag(tag, attr);
+ xs << xml::CR();
+ } else if (tagtype == "inline") {
+ xs << xml::CompTag(tag, attr);
+ } else {
+ xs.writeError("Unrecognised tag type '" + tagtype + "' for '" + tag + "'");
+ }
+}
+
+
// Higher-level convenience functions.
void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
@@ -692,9 +711,8 @@ ParagraphList::const_iterator makeListEnvironment(Text const &text,
}
} else {
// DocBook doesn't like emptiness.
- openTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnerattr(),
+ compTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnerattr(),
par->layout().docbookiteminnertagtype());
- closeTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnertagtype());
}
// If the next item is deeper, it must go entirely within this item (do it recursively).
diff --git a/src/xml.cpp b/src/xml.cpp
index 557bb01..150f4c5 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -651,7 +651,8 @@ docstring xml::cleanID(docstring const & orig)
// 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);
+ if (mangleID > 0)
+ content += "-" + convert<docstring>(mangleID);
mangleID += 1;
}
commit 5b01c80635f9d33d405c4d9cac05aaf9f75c6aa2
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 21:51:40 2020 +0200
DocBook: fix titles in KOMA Script.
diff --git a/autotests/export/docbook/description_list_nested.xml b/autotests/export/docbook/description_list_nested.xml
index fc50c2c..ec57aaa 100644
--- a/autotests/export/docbook/description_list_nested.xml
+++ b/autotests/export/docbook/description_list_nested.xml
@@ -6,22 +6,19 @@
<variablelist>
<varlistentry>
<term>New valid value for an existing setting,</term>
-
<listitem>
-<para> e. g.</para>
+<para>e. g.</para>
<variablelist>
<varlistentry>
<term>Automatically loaded math package</term>
-
<listitem>
-<para> The reason </para>
+<para>The reason </para>
</listitem>
</varlistentry>
<varlistentry>
<term>New language</term>
-
<listitem>
-<para> that is stored</para>
+<para>that is stored</para>
</listitem>
</varlistentry>
</variablelist>
@@ -29,11 +26,9 @@
</varlistentry>
<varlistentry>
<term>New inset</term>
-
<listitem>
-<para> Of course a new inset requires a file format update.</para>
+<para>Of course a new inset requires a file format update.</para>
</listitem>
</varlistentry>
</variablelist>
-
</article>
\ No newline at end of file
diff --git a/autotests/export/docbook/deutsches_ert.xml b/autotests/export/docbook/deutsches_ert.xml
index 1d9b725..3e12603 100644
--- a/autotests/export/docbook/deutsches_ert.xml
+++ b/autotests/export/docbook/deutsches_ert.xml
@@ -5,12 +5,19 @@
<info>
<title>Erweiterte LyX Features</title>
<subtitle>Version 2.3.x</subtitle>
-<author><personname>vom LyX-Team<footnote>Ãbersetzung und Bearbeitung: Hartmut<person> Haase (<person>HHa, bis März 2010),Jürgen Spitzmüller (Version 2.3.x, 2017)</person></person></footnote></personname></author>
+<author>
+<personname>vom LyX-Team<footnote>
+<para>Ãbersetzung und Bearbeitung: Hartmut<person> </person>Haase (<person>HHa</person>, bis März 2010),</para>
+<para>Jürgen Spitzmüller (Version 2.3.x, 2017)</para>
+</footnote></personname>
+</author>
</info>
<chapter>
-<chapter>Einleitung</chapter>
-<para>Wählen Sie hierfür <emphasis role='sans'>Dokument⇒Einstellungen⇒LaTeX-Vorspann. Dies öffnet ein Editierfenster, in das Sie Ihre bevorzugten Befehle schreiben können.<footnote><para>Das Editierverhalten in diesem Fenster ist spezifisch, also erwarten Sie nicht, dass die LyX<!-- „= -->Tastenkombinationen darin funktionieren.</para>
-</footnote> LyX fügt alles im <emphasis role='sans'>LaTeX-Vorspann-Fenster zu seinem eingebauten Vorspann hinzu. Bevor Sie Ihre eigenen Deklarationen zum Vorspann hinzufügen, sollten Sie prüfen, ob LyX das nicht bereits unterstützt (Erinnern Sie sich, was wir über das Rad noch einmal erfinden sagten?). AuÃerdem: <emphasis>stellen Sie sicher, dass Ihre Vorspannzeilen richtig sind. LyX prüft das nicht. Wenn der Vorspann fehlerhaft ist, bekommen Sie sehr wahrscheinlich die Fehlermeldung Missing \begin{document}. Sollten Sie diese jemals bekommen, prüfen Sie Ihren Vorspann!. <!-- -- --></emphasis></emphasis></emphasis></para>
+<title>Einleitung</title>
+<para>Wählen Sie hierfür <emphasis role='sans'>Dokument⇒Einstellungen⇒LaTeX-Vorspann.</emphasis> Dies öffnet ein Editierfenster, in das Sie Ihre bevorzugten Befehle schreiben können.<footnote>
+<para>Das Editierverhalten in diesem Fenster ist spezifisch, also erwarten Sie nicht, dass die LyX<!-- „= -->
+Tastenkombinationen darin funktionieren.</para>
+</footnote> LyX fügt alles im <emphasis role='sans'>LaTeX-Vorspann</emphasis>-Fenster zu seinem eingebauten Vorspann hinzu. Bevor Sie Ihre eigenen Deklarationen zum Vorspann hinzufügen, sollten Sie prüfen, ob LyX das nicht bereits unterstützt (Erinnern Sie sich, was wir über das Rad noch einmal erfinden sagten?). AuÃerdem: <emphasis>stellen Sie sicher, dass Ihre Vorspannzeilen richtig sind</emphasis>. LyX prüft das nicht. Wenn der Vorspann fehlerhaft ist, bekommen Sie sehr wahrscheinlich die Fehlermeldung Missing \begin{document}. Sollten Sie diese jemals bekommen, prüfen Sie Ihren Vorspann!. <!-- -- -->
+</para>
</chapter>
-
</book>
\ No newline at end of file
diff --git a/lib/layouts/scrartcl.layout b/lib/layouts/scrartcl.layout
index 1b27e89..4f2a8d4 100644
--- a/lib/layouts/scrartcl.layout
+++ b/lib/layouts/scrartcl.layout
@@ -26,7 +26,9 @@ Style Part
Font
Size Larger
EndFont
- DocBookTag part
+ DocBookTag title
+ DocBookTagType paragraph
+ DocBookSectionTag part
End
Style Part*
@@ -36,5 +38,7 @@ Style Part*
Font
Size Larger
EndFont
- DocBookTag part
+ DocBookTag title
+ DocBookTagType paragraph
+ DocBookSectionTag part
End
diff --git a/lib/layouts/scrbook.layout b/lib/layouts/scrbook.layout
index 60caa1c..01d16ca 100644
--- a/lib/layouts/scrbook.layout
+++ b/lib/layouts/scrbook.layout
@@ -18,7 +18,9 @@ NoStyle Abstract
Style Chapter
LabelString "\thechapter"
TocLevel 0
- DocBookTag chapter
+ DocBookTag title
+ DocBookTagType paragraph
+ DocBookSectionTag chapter
End
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 2bffb0a..cf76bf4 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -978,6 +978,9 @@ void outputDocBookInfo(
// End the <info> tag if it was started.
if (needInfo) {
+ if (!xs.isLastTagCR())
+ xs << xml::CR();
+
xs << xml::EndTag("info");
xs << xml::CR();
xs.endDivision();
commit 976bd91fc2bfea65f22babcc7a9f4762a46f7795
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 03:30:56 2020 +0200
DocBook: bug fixing with wrapper merging.
diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml
index 70b19af..2ab4a79 100644
--- a/autotests/export/docbook/bibliography_precooked_aastex.xml
+++ b/autotests/export/docbook/bibliography_precooked_aastex.xml
@@ -40,16 +40,15 @@
<affiliation role="alternate">
<orgname>Patron, Alonso's Bar and Grill</orgname>
</affiliation>
-<keyword>
-clusters: globular, peanutâbosons: bozos
-</keyword>
-<!-- Output Error: Tried to close `keywordset' when tag was not open. Tag discarded. -->
-
+</author>
+<keywordset>
+<keyword>clusters: globular, peanutâbosons: bozos</keyword>
+</keywordset>
+<abstract>
<para>This is a preliminary report on surface photometry of the major fraction of known globular clusters, to see which of them show the signs of a collapsed core. We also explore some diversionary mathematics and recreational tables. </para>
+</abstract>
-<!-- Output Error: Closing tag `info' when other tags are open, namely: -->
-<!-- Output Error: author -->
-</author></info>
+</info>
<section>
<title>Introduction</title>
<para>A focal problem today in the dynamics of globular clusters is core collapse. It has been predicted by theory for decades <biblioref endterm="hen61" />, <biblioref endterm="lyn68" />, <biblioref endterm="spi85" />, but observation has been less alert to the phenomenon. For many years the central brightness peak in M15 <biblioref endterm="kin75" />, <biblioref endterm="new78" /> seemed a unique anomaly. Then <biblioref endterm="aur82" /> suggested a central peak in NGC 6397, and a limited photographic survey of ours <biblioref endterm="djo84" /> found three more cases, including NGC 6624, whose sharp center had often been remarked on <biblioref endterm="can78" />. </para>
@@ -1005,11 +1004,8 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</inlineequation> of the electronically submitted abstracts for AAS meetings are error-free. </para>
<acknowledgements>
<para>We are grateful to V. Barger, T. Han, and R. J. N. Phillips for doing the math in section <xref linkend="bozomath" />. More information on the AASTeX macros package are available at <link xlink:href="http://www.aas.org/publications/aastex">http://www.aas.org/publications/aastex</link> or the <link xlink:href="ftp://www.aas.org/pubs/AAS ftp site">AAS ftp site</link>.</para>
-<application>
-IRAF, AIPS, Astropy, ...
-</application>
-<!-- Output Error: Tried to close `para' when tag was not open. Tag discarded. -->
-
+</acknowledgements>
+<remark role='software'>IRAF, AIPS, Astropy, ...</remark>
</section>
<bibliography>
<bibliomixed xml:id='aur82'>Aurière, M. 1982, <!-- \aap -->
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 19bd1d8..2bffb0a 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -274,8 +274,10 @@ void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar
if (prevpar != nullptr) {
Layout const & prevlay = prevpar->layout();
if (prevlay.docbookwrappertag() != "NONE") {
- openWrapper = prevlay.docbookwrappertag() == lay.docbookwrappertag()
- && !lay.docbookwrappermergewithprevious();
+ if (prevlay.docbookwrappertag() == lay.docbookwrappertag())
+ openWrapper = !lay.docbookwrappermergewithprevious();
+ else
+ openWrapper = true;
}
}
@@ -308,8 +310,10 @@ void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpa
if (nextpar != nullptr) {
Layout const & nextlay = nextpar->layout();
if (nextlay.docbookwrappertag() != "NONE") {
- closeWrapper = nextlay.docbookwrappertag() == lay.docbookwrappertag()
- && !nextlay.docbookwrappermergewithprevious();
+ if (nextlay.docbookwrappertag() == lay.docbookwrappertag())
+ closeWrapper = !nextlay.docbookwrappermergewithprevious();
+ else
+ closeWrapper = true;
}
}
@@ -948,8 +952,7 @@ void outputDocBookInfo(
// that mandating a wrapper like <info> would repel users. Thus, generate them first.
makeAny(text, buf, xs, runparams, paragraphs.iterator_at(pit));
for (auto pit : info.mustBeInInfo)
- if (info.abstract.find(pit) == info.abstract.end()) // The abstract must be in info, but is dealt with after.
- makeAny(text, buf, xs, runparams, paragraphs.iterator_at(pit));
+ makeAny(text, buf, xs, runparams, paragraphs.iterator_at(pit));
// Always output the abstract as the last item of the <info>, as it requires special treatment (especially if
// it contains several paragraphs that are empty).
commit 7ec0307b13b002e5914882ece6c76f864ef61746
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 03:08:55 2020 +0200
DocBook: bug fixing in AASTeX layout.
That's mostly generating DocBook tags at an inappropriate place with some metadata, rather than outputting whatever you have at your disposal. Far from satisfying, but good enough for a generic tool (see details in the new TODO). Doesn't trigger assertions. Is valid XML.
diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml
index 71fe700..70b19af 100644
--- a/autotests/export/docbook/bibliography_precooked_aastex.xml
+++ b/autotests/export/docbook/bibliography_precooked_aastex.xml
@@ -382,9 +382,7 @@ clusters: globular, peanutâbosons: bozos
</m:mrow>
</m:math>
</inlineequation> may be formed from particle four-momenta, gauge-boson polarization vectors or fermion strings with an uncontracted Lorentz index associated with final-state fermions.</para>
-<NoteToEditor>
-Figures 1 and 2 should appear side-by-side in print
-</NoteToEditor>
+<remark role='to-editor'>Figures 1 and 2 should appear side-by-side in print</remark>
<para>In the chiral representation the <inlineequation>
<alt role='tex'>\gamma</alt>
<m:math>
@@ -634,7 +632,6 @@ Figures 1 and 2 should appear side-by-side in print
</m:mrow>
</m:math>
</inlineequation> by </para>
-<MathLetters>
<informalequation>
<alt role='tex'>u(p,\lambda)_{\pm} & = & (E\pm\lambda|{\textbf{p}}|)^{1/2}\chi_{\lambda}(p),\\
v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi_{-\lambda}(p)
@@ -724,9 +721,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mtr>
</m:mtable>
</m:math>
-</informalequation>
-</MathLetters>
-</section>
+</informalequation></section>
</section>
<section>
<title>Floating material and so forth</title>
@@ -1008,7 +1003,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation> of the electronically submitted abstracts for AAS meetings are error-free. </para>
-<acknowledgement>
+<acknowledgements>
<para>We are grateful to V. Barger, T. Han, and R. J. N. Phillips for doing the math in section <xref linkend="bozomath" />. More information on the AASTeX macros package are available at <link xlink:href="http://www.aas.org/publications/aastex">http://www.aas.org/publications/aastex</link> or the <link xlink:href="ftp://www.aas.org/pubs/AAS ftp site">AAS ftp site</link>.</para>
<application>
IRAF, AIPS, Astropy, ...
@@ -1139,7 +1134,7 @@ IRAF, AIPS, Astropy, ...
<m:mrow><m:mi>P</m:mi>
</m:mrow>
</m:math>
-</inlineequation>a</td>
+</inlineequation><remark role='tablenotemark'>a</remark></td>
<td align='right' valign='top'> <inlineequation>
<alt role='tex'>PR_{maj}</alt>
<m:math>
@@ -1183,7 +1178,7 @@ IRAF, AIPS, Astropy, ...
<m:mrow><m:mo>Θ</m:mo>
</m:mrow>
</m:math>
-</inlineequation>b</td>
+</inlineequation><remark role='tablenotemark'>b</remark></td>
<td align='center' valign='top'>Ref.</td>
</tr>
<tr>
@@ -1235,7 +1230,7 @@ IRAF, AIPS, Astropy, ...
<tr>
<td align='center' valign='top'> 4 </td>
<td align='right' valign='top'>32733.8 </td>
-<td align='right' valign='top'>-1.2c</td>
+<td align='right' valign='top'>-1.2<remark role='tablenotemark'>c</remark></td>
<td align='right' valign='top'>-0.5 </td>
<td align='right' valign='top'>41 </td>
<td align='right' valign='top'>54.8 </td>
@@ -1254,7 +1249,7 @@ IRAF, AIPS, Astropy, ...
<td align='right' valign='top'>-0.4 </td>
<td align='right' valign='top'>60 </td>
<td align='right' valign='top'>1.4 </td>
-<td align='right' valign='top'>1.669c</td>
+<td align='right' valign='top'>1.669<remark role='tablenotemark'>c</remark></td>
<td align='right' valign='top'>1.574 </td>
<td align='right' valign='top'>2.343 </td>
<td align='right' valign='top'>8.0 </td>
@@ -1279,23 +1274,13 @@ IRAF, AIPS, Astropy, ...
</tr>
</tbody>
-<Table note>
-a<!-- }{ -->
-Sample footnote for table <xref linkend="tbl-2" /> that was generated with the LaTeX table environment
-</Table note>
-<Table note>
-b<!-- }{ -->
-Yet another sample footnote for table <xref linkend="tbl-2" />
-</Table note>
-<Table note>
-c<!-- }{ -->
-Another sample footnote for table <xref linkend="tbl-2" />
-</Table note>
-<TableComments>
-We can also attach a long-ish paragraph of explanatory material to a table. Use \tablerefs to append a list of references. The following references were from a different table: I've patched them in here to show how they look, but don't take them too seriouslyâI certainly have not.
-</TableComments>
-<TableRefs>
-(1) Barbuy, Spite, & Spite 1985; (2) Bond 1980; (3) Carbon et al. 1987; (4) Hobbs & Duncan 1987; (5) Gilroy et al. 1988: (6) Gratton & Ortolani 1986; (7) Gratton & Sneden 1987; (8) Gratton & Sneden (1988); (9) Gratton & Sneden 1991; (10) Kraft et al. 1982; (11) LCL, or Laird, 1990; (12) Leep & Wallerstein 1981; (13) Luck & Bond 1981; (14) Luck & Bond 1985; (15) Magain 1987; (16) Magain 1989; (17) Peterson 1981; (18) Peterson, Kurucz, & Carney 1990; (19) RMB; (20) Schuster & Nissen 1988; (21) Schuster & Nissen 1989b; (22) Spite et al. 1984; (23) Spite & Spite 1986; (24) Hobbs & Thorburn 1991; (25) Hobbs et al. 1991; (26) Olsen 1983.
-</TableRefs>
+<remark role='tablenote'>a<!-- }{ -->
+Sample footnote for table <xref linkend="tbl-2" /> that was generated with the LaTeX table environment</remark>
+<remark role='tablenote'>b<!-- }{ -->
+Yet another sample footnote for table <xref linkend="tbl-2" /></remark>
+<remark role='tablenote'>c<!-- }{ -->
+Another sample footnote for table <xref linkend="tbl-2" /></remark>
+<remark role='tablecomments'>We can also attach a long-ish paragraph of explanatory material to a table. Use \tablerefs to append a list of references. The following references were from a different table: I've patched them in here to show how they look, but don't take them too seriouslyâI certainly have not.</remark>
+<remark role='tablerefs'>(1) Barbuy, Spite, & Spite 1985; (2) Bond 1980; (3) Carbon et al. 1987; (4) Hobbs & Duncan 1987; (5) Gilroy et al. 1988: (6) Gratton & Ortolani 1986; (7) Gratton & Sneden 1987; (8) Gratton & Sneden (1988); (9) Gratton & Sneden 1991; (10) Kraft et al. 1982; (11) LCL, or Laird, 1990; (12) Leep & Wallerstein 1981; (13) Luck & Bond 1981; (14) Luck & Bond 1985; (15) Magain 1987; (16) Magain 1989; (17) Peterson 1981; (18) Peterson, Kurucz, & Carney 1990; (19) RMB; (20) Schuster & Nissen 1988; (21) Schuster & Nissen 1989b; (22) Spite et al. 1984; (23) Spite & Spite 1986; (24) Hobbs & Thorburn 1991; (25) Hobbs et al. 1991; (26) Olsen 1983.</remark>
</table>
</article>
\ No newline at end of file
diff --git a/development/DocBookToDo b/development/DocBookToDo
new file mode 100644
index 0000000..39ca534
--- /dev/null
+++ b/development/DocBookToDo
@@ -0,0 +1,20 @@
+Things specific to layouts
+==========================
+
+AASTeX
+------
+
+No support for table notes. They could be implemented through <footnoteref>, but it becomes a nightmare to ensure xml:id uniqueness (the only ID available here is in the inset; mix it with the table ID?). Anyway, it would require a lot of specific code to make it work, probably not worth the effort right now.
+
+ Related parts of the layout:
+ Style "Table note"
+ InsetLayout "Flex:tablenotemark"
+ Alreayd used in the following test:
+ bibliography_precooked_aastex.lyx
+
+Notion of MathLetters: a group of equations. No good mapping in DocBook, maybe an informalgroup? To discuss with DocBook TC.
+TableRefs, TableComments: no mapping in DocBook, not really a way to add these things. To discuss with DocBook TC.
+
+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
diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout
index d79cd02..78089a4 100644
--- a/lib/layouts/aastex.layout
+++ b/lib/layouts/aastex.layout
@@ -285,6 +285,11 @@ Style Abstract
Series Bold
Size Normal
EndFont
+ DocBookAbstract true
+ DocBookInInfo always
+ DocBookWrapperTag abstract
+ DocBookWrapperMergeWithPrevious true
+ DocBookTag para
End
@@ -335,6 +340,7 @@ Style Keywords
Size Normal
EndFont
DocBookTag keyword
+ DocBookTagType paragraph
DocBookWrapperTag keywordset
DocBookInInfo always
End
@@ -359,7 +365,7 @@ Style Acknowledgements
Shape Italic
EndFont
DocBookTag para
- DocBookWrapperTag acknowledgement
+ DocBookWrapperTag acknowledgements
End
@@ -432,6 +438,7 @@ Style MathLetters
Font
Size Normal
EndFont
+ DocBookTag NONE
End
@@ -495,6 +502,9 @@ Style NoteToEditor
Size Normal
Shape Italic
EndFont
+ DocBookTag remark
+ DocBookTagType paragraph
+ DocBookAttr role='to-editor'
End
@@ -515,6 +525,9 @@ Style TableRefs
Family Roman
Size Normal
EndFont
+ DocBookTag remark
+ DocBookTagType paragraph
+ DocBookAttr role='tablerefs'
End
@@ -535,6 +548,9 @@ Style TableComments
Family Roman
Size Normal
EndFont
+ DocBookTag remark
+ DocBookTagType paragraph
+ DocBookAttr role='tablecomments'
End
@@ -550,6 +566,9 @@ Style "Table note"
LabelFont
Color magenta
EndFont
+ DocBookTag remark
+ DocBookTagType paragraph
+ DocBookAttr role='tablenote'
End
@@ -572,6 +591,9 @@ InsetLayout "Flex:tablenotemark"
Color magenta
Size Small
EndFont
+ DocBookTag remark
+ DocBookTagType paragraph
+ DocBookAttr role='tablenotemark'
End
diff --git a/lib/layouts/aastex6.layout b/lib/layouts/aastex6.layout
index 03d585e..6935365 100644
--- a/lib/layouts/aastex6.layout
+++ b/lib/layouts/aastex6.layout
@@ -67,8 +67,11 @@ Style Software
LabelFont
Shape Italic
EndFont
- DocBookWrapperTag para
- DocBookTag application
+ DocBookTag remark
+ DocBookAttr role='software'
+ # Override what's taken from Keywords, but not really wanted.
+ DocBookWrapperTag NONE
+ DocBookInInfo never
End
# other new commands are mainly for the user preamble
diff --git a/lib/layouts/aastex62.layout b/lib/layouts/aastex62.layout
index 3eb7dcc..1ef8636 100644
--- a/lib/layouts/aastex62.layout
+++ b/lib/layouts/aastex62.layout
@@ -78,8 +78,11 @@ Style Software
LabelFont
Shape Italic
EndFont
- DocBookWrapperTag para
- DocBookTag application
+ DocBookTag remark
+ DocBookAttr role='software'
+ # Override what's taken from Keywords, but not really wanted.
+ DocBookWrapperTag NONE
+ DocBookInInfo never
End
# other new commands are mainly for the user preamble
commit fb8c07a2c76e082593152086d495b5a3f278fd31
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 02:34:49 2020 +0200
DocBook: adapt AASTeX for tag types (new-line behaviour).
diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml
index fe77b72..71fe700 100644
--- a/autotests/export/docbook/bibliography_precooked_aastex.xml
+++ b/autotests/export/docbook/bibliography_precooked_aastex.xml
@@ -3,25 +3,53 @@
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>
-<!-- shouldBeInInfo --><title>Collapsed Cores in Globular Clusters, Gauge-Boson Couplings, and AASTeX Examples</title>
-<!-- mustBeInInfo --><author><personname>S. Djorgovski and Ivan R. King</personname>
-<affiliation><orgname>Astronomy Department, University of California, Berkeley, CA 94720</orgname></affiliation>
-<affiliation role="alternate"><orgname>Visiting Astronomer Cerro Tololo Inter-American Observatory.CTIO is operated by AURA Inc. under contract to the National Science Foundation.</orgname></affiliation>
-<affiliation role="alternate"><orgname>Society of Fellows, Harvard University.</orgname></affiliation>
-<affiliation role="alternate"><orgname>present address: Center for Astrophysics60 Garden Street, Cambridge, MA 02138</orgname></affiliation></author>
-<author><personname>C. D. Biemesderfer</personname>
-<affiliation><orgname>National Optical Astronomy Observatories, Tucson, AZ 85719</orgname></affiliation>
-<affiliation role="alternate"><orgname>Visiting Programmer, Space Telescope Science Institute</orgname></affiliation>
-<affiliation role="alternate"><orgname>Patron, Alonso's Bar and Grill</orgname></affiliation>
-<email>aastex-help at aas.org</email></author>
-<author><personname>R. J. Hanisch</personname>
-<affiliation><orgname>Space Telescope Science Institute, Baltimore, MD 21218</orgname></affiliation>
-<affiliation role="alternate"><orgname>Patron, Alonso's Bar and Grill</orgname></affiliation></author>
-<keywordset><keyword>clusters: globular, peanutâbosons: bozos</keyword></keywordset>
-<!-- /info --><!-- abs --><abstract><para>
+<title>Collapsed Cores in Globular Clusters, Gauge-Boson Couplings, and AASTeX Examples</title>
+<author>
+<personname>S. Djorgovski and Ivan R. King</personname>
+<affiliation>
+<orgname>Astronomy Department, University of California, Berkeley, CA 94720</orgname>
+</affiliation>
+<affiliation role="alternate">
+<orgname>Visiting Astronomer Cerro Tololo Inter-American Observatory.CTIO is operated by AURA Inc. under contract to the National Science Foundation.</orgname>
+</affiliation>
+<affiliation role="alternate">
+<orgname>Society of Fellows, Harvard University.</orgname>
+</affiliation>
+<affiliation role="alternate">
+<orgname>present address: Center for Astrophysics60 Garden Street, Cambridge, MA 02138</orgname>
+</affiliation>
+</author>
+<author>
+<personname>C. D. Biemesderfer</personname>
+<affiliation>
+<orgname>National Optical Astronomy Observatories, Tucson, AZ 85719</orgname>
+</affiliation>
+<affiliation role="alternate">
+<orgname>Visiting Programmer, Space Telescope Science Institute</orgname>
+</affiliation>
+<affiliation role="alternate">
+<orgname>Patron, Alonso's Bar and Grill</orgname>
+</affiliation>
+<email>aastex-help at aas.org</email>
+</author>
+<author>
+<personname>R. J. Hanisch</personname>
+<affiliation>
+<orgname>Space Telescope Science Institute, Baltimore, MD 21218</orgname>
+</affiliation>
+<affiliation role="alternate">
+<orgname>Patron, Alonso's Bar and Grill</orgname>
+</affiliation>
+<keyword>
+clusters: globular, peanutâbosons: bozos
+</keyword>
+<!-- Output Error: Tried to close `keywordset' when tag was not open. Tag discarded. -->
+
<para>This is a preliminary report on surface photometry of the major fraction of known globular clusters, to see which of them show the signs of a collapsed core. We also explore some diversionary mathematics and recreational tables. </para>
-</para></abstract>
-<!-- 15 --><!-- /abs --></info>
+
+<!-- Output Error: Closing tag `info' when other tags are open, namely: -->
+<!-- Output Error: author -->
+</author></info>
<section>
<title>Introduction</title>
<para>A focal problem today in the dynamics of globular clusters is core collapse. It has been predicted by theory for decades <biblioref endterm="hen61" />, <biblioref endterm="lyn68" />, <biblioref endterm="spi85" />, but observation has been less alert to the phenomenon. For many years the central brightness peak in M15 <biblioref endterm="kin75" />, <biblioref endterm="new78" /> seemed a unique anomaly. Then <biblioref endterm="aur82" /> suggested a central peak in NGC 6397, and a limited photographic survey of ours <biblioref endterm="djo84" /> found three more cases, including NGC 6624, whose sharp center had often been remarked on <biblioref endterm="can78" />. </para>
@@ -107,7 +135,8 @@
</section>
<section>
<title>Helicity Amplitudes</title>
-<para>It has been realized that helicity amplitudes provide a convenient means for Feynman diagram<footnote><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><para>Footnotes can be inserted like this.</para>
+<para>It has been realized that helicity amplitudes provide a convenient means for Feynman diagram<footnote>
+<para>Footnotes can be inserted like this.</para>
</footnote> evaluations. These amplitude-level techniques are particularly convenient for calculations involving many Feynman diagrams, where the usual trace techniques for the amplitude squared becomes unwieldy. Our calculations use the helicity techniques developed by other authors <biblioref endterm="hag86" />; we briefly summarize below.</para>
<section>
<title>Formalism</title>
@@ -133,7 +162,8 @@
</m:mrow>
</m:mrow>
</m:math>
-</inlineequation> collisions can be expressed in terms of fermion strings of the form <informalequation>
+</inlineequation> collisions can be expressed in terms of fermion strings of the form
+<informalequation>
<alt role='tex'>\bar{v}(p_{2},\sigma_{2})P_{-\tau}\hat{a}_{1}\hat{a}_{2}\cdots\hat{a}_{n}u(p_{1},\sigma_{1}),</alt>
<m:math>
@@ -352,7 +382,9 @@
</m:mrow>
</m:math>
</inlineequation> may be formed from particle four-momenta, gauge-boson polarization vectors or fermion strings with an uncontracted Lorentz index associated with final-state fermions.</para>
-<NoteToEditor>Figures 1 and 2 should appear side-by-side in print</NoteToEditor>
+<NoteToEditor>
+Figures 1 and 2 should appear side-by-side in print
+</NoteToEditor>
<para>In the chiral representation the <inlineequation>
<alt role='tex'>\gamma</alt>
<m:math>
@@ -376,7 +408,8 @@
<m:mrow><m:mi>σ</m:mi>
</m:mrow>
</m:math>
-</inlineequation> and the unit matrix 1 as <informalequation>
+</inlineequation> and the unit matrix 1 as
+<informalequation>
<alt role='tex'>\gamma^{\mu} & = & \left(\begin{array}{cc}
0 & \sigma_{+}^{\mu}\\
\sigma_{-}^{\mu} & 0
@@ -486,7 +519,8 @@
</m:mtr>
</m:mtable>
</m:math>
-</informalequation> giving <informalequation>
+</informalequation> giving
+<informalequation>
<alt role='tex'>\hat{a}=\left(\begin{array}{cc}
0 & (\hat{a})_{+}\\
(\hat{a})_{-} & 0
@@ -564,11 +598,13 @@
</m:mrow>
</m:mrow>
</m:math>
-</informalequation> The spinors are expressed in terms of two-component Weyl spinors as <informalequation>
+</informalequation> The spinors are expressed in terms of two-component Weyl spinors as
+<informalequation>
<alt role='tex'>u=\left(\begin{array}{c}
(u)_{-}\\
(u)_{+}
-\end{array}\right),v={\textbf{(}}\vdag_{+}{\textbf{,}}\vdag_{-}{\textbf{)}}.</alt>MathML export failed. Please report this as a bug.
+\end{array}\right),v={\textbf{(}}\vdag_{+}{\textbf{,}}\vdag_{-}{\textbf{)}}.</alt>
+<mathphrase>MathML export failed. Please report this as a bug.</mathphrase>
</informalequation></para>
<para>The Weyl spinors are given in terms of helicity eigenstates <inlineequation>
<alt role='tex'>\chi_{\lambda}(p)</alt>
@@ -694,7 +730,8 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</section>
<section>
<title>Floating material and so forth</title>
-<para>Consider a task that computes profile parameters for a modified Lorentzian of the form <informalequation>
+<para>Consider a task that computes profile parameters for a modified Lorentzian of the form
+<informalequation>
<alt role='tex'>I=\frac{1}{1+d_{1}^{P(1+d_{2})}}</alt>
<m:math>
@@ -732,7 +769,8 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:mrow>
</m:math>
-</informalequation> where <informalequation>
+</informalequation> where
+<informalequation>
<alt role='tex'>d_{1}=\sqrt{\left(\begin{array}{c}
\frac{x_{1}}{R_{maj}}\end{array}\right)^{2}+\left(\begin{array}{c}
\frac{y_{1}}{R_{min}}\end{array}\right)^{2}}</alt>
@@ -817,11 +855,14 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:mrow>
</m:math>
-</informalequation><informalequation>
+</informalequation>
+<informalequation>
<alt role='tex'>d_{2}=\sqrt{\left(\begin{array}{c}
\frac{x_{1}}{PR_{maj}}\end{array}\right)^{2}+\left(\begin{array}{c}
-\case{y_{1}}{PR_{min}}\end{array}\right)^{2}}</alt>MathML export failed. Please report this as a bug.
-</informalequation><informalequation>
+\case{y_{1}}{PR_{min}}\end{array}\right)^{2}}</alt>
+<mathphrase>MathML export failed. Please report this as a bug.</mathphrase>
+</informalequation>
+<informalequation>
<alt role='tex'>x_{1}=(x-x_{0})\cos\Theta+(y-y_{0})\sin\Theta</alt>
<m:math>
@@ -858,7 +899,8 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:mrow>
</m:math>
-</informalequation><informalequation>
+</informalequation>
+<informalequation>
<alt role='tex'>y_{1}=-(x-x_{0})\sin\Theta+(y-y_{0})\cos\Theta</alt>
<m:math>
@@ -951,7 +993,8 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:msub>
</m:mrow>
</m:math>
-</inlineequation>, but the assumption is that the alternate results should be less than 90° out of phase with previous values. We have no observations of <!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><!-- \ion{Ca}{2} -->. Roughly <inlineequation>
+</inlineequation>, but the assumption is that the alternate results should be less than 90° out of phase with previous values. We have no observations of <!-- \ion{Ca}{2} -->
+. Roughly <inlineequation>
<alt role='tex'>\nicefrac{4}{5}</alt>
<m:math>
@@ -965,33 +1008,49 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation> of the electronically submitted abstracts for AAS meetings are error-free. </para>
-<acknowledgement><para>We are grateful to V. Barger, T. Han, and R. J. N. Phillips for doing the math in section <xref linkend="bozomath" />. More information on the AASTeX macros package are available at <link xlink:href="http://www.aas.org/publications/aastex"><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->http://www.aas.org/publications/aastex</link> or the <link xlink:href="ftp://www.aas.org/pubs/AAS ftp site">AAS ftp site</link>.</para>
-<application>IRAF, AIPS, Astropy, ...</application><!-- Output Error: Tried to close `para' when tag was not open. Tag discarded. -->
+<acknowledgement>
+<para>We are grateful to V. Barger, T. Han, and R. J. N. Phillips for doing the math in section <xref linkend="bozomath" />. More information on the AASTeX macros package are available at <link xlink:href="http://www.aas.org/publications/aastex">http://www.aas.org/publications/aastex</link> or the <link xlink:href="ftp://www.aas.org/pubs/AAS ftp site">AAS ftp site</link>.</para>
+<application>
+IRAF, AIPS, Astropy, ...
+</application>
+<!-- Output Error: Tried to close `para' when tag was not open. Tag discarded. -->
+</section>
<bibliography>
-<bibliomixed xml:id='aur82'>Aurière, M. 1982, <!-- \aap -->, 109, 301 </bibliomixed>
-<bibliomixed xml:id='can78'>Canizares, C. R., Grindlay, J. E., Hiltner, W. A., Liller, W., and McClintock, J. E. 1978, <!-- \apj -->, 224, 39 </bibliomixed>
-<bibliomixed xml:id='djo84'>Djorgovski, S., and King, I. R. 1984, <!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><!-- \apjl -->, 277, L49 </bibliomixed>
+<bibliomixed xml:id='aur82'>Aurière, M. 1982, <!-- \aap -->
+, 109, 301 </bibliomixed>
+<bibliomixed xml:id='can78'>Canizares, C. R., Grindlay, J. E., Hiltner, W. A., Liller, W., and McClintock, J. E. 1978, <!-- \apj -->
+, 224, 39 </bibliomixed>
+<bibliomixed xml:id='djo84'>Djorgovski, S., and King, I. R. 1984, <!-- \apjl -->
+, 277, L49 </bibliomixed>
<bibliomixed xml:id='hag86'>Hagiwara, K., and Zeppenfeld, D. 1986, Nucl.Phys., 274, 1 </bibliomixed>
-<bibliomixed xml:id='har84'>Harris, W. E., and van den Bergh, S. 1984, <!-- \aj -->, 89, 1816 </bibliomixed>
+<bibliomixed xml:id='har84'>Harris, W. E., and van den Bergh, S. 1984, <!-- \aj -->
+, 89, 1816 </bibliomixed>
<bibliomixed xml:id='hen61'>Hénon, M. 1961, Ann.d'Ap., 24, 369 </bibliomixed>
-<bibliomixed xml:id='kin66'>King, I. R. 1966, <!-- \aj -->, 71, 276 </bibliomixed>
+<bibliomixed xml:id='kin66'>King, I. R. 1966, <!-- \aj -->
+, 71, 276 </bibliomixed>
<bibliomixed xml:id='kin75'>King, I. R. 1975, Dynamics of Stellar Systems, A. Hayli, Dordrecht: Reidel, 1975, 99 </bibliomixed>
-<bibliomixed xml:id='kin68'>King, I. R., Hedemann, E., Hodge, S. M., and White, R. E. 1968, <!-- \aj -->, 73, 456 </bibliomixed>
-<bibliomixed xml:id='kro84'>Kron, G. E., Hewitt, A. V., and Wasserman, L. H. 1984, <!-- \pasp -->, 96, 198 </bibliomixed>
-<bibliomixed xml:id='lyn68'>Lynden-Bell, D., and Wood, R. 1968, <!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><!-- \mnras -->, 138, 495 </bibliomixed>
-<bibliomixed xml:id='new78'>Newell, E. B., and O'Neil, E. J. 1978, <!-- \apjs -->, 37, 27 </bibliomixed>
-<bibliomixed xml:id='ort85'>Ortolani, S., Rosino, L., and Sandage, A. 1985, <!-- \aj -->, 90, 473 </bibliomixed>
-<bibliomixed xml:id='pet76'>Peterson, C. J. 1976, <!-- \aj -->, 81, 617 </bibliomixed>
+<bibliomixed xml:id='kin68'>King, I. R., Hedemann, E., Hodge, S. M., and White, R. E. 1968, <!-- \aj -->
+, 73, 456 </bibliomixed>
+<bibliomixed xml:id='kro84'>Kron, G. E., Hewitt, A. V., and Wasserman, L. H. 1984, <!-- \pasp -->
+, 96, 198 </bibliomixed>
+<bibliomixed xml:id='lyn68'>Lynden-Bell, D., and Wood, R. 1968, <!-- \mnras -->
+, 138, 495 </bibliomixed>
+<bibliomixed xml:id='new78'>Newell, E. B., and O'Neil, E. J. 1978, <!-- \apjs -->
+, 37, 27 </bibliomixed>
+<bibliomixed xml:id='ort85'>Ortolani, S., Rosino, L., and Sandage, A. 1985, <!-- \aj -->
+, 90, 473 </bibliomixed>
+<bibliomixed xml:id='pet76'>Peterson, C. J. 1976, <!-- \aj -->
+, 81, 617 </bibliomixed>
<bibliomixed xml:id='spi85'>Spitzer, L. 1985, Dynamics of Star Clusters, J. Goodman and P. Hut, Dordrecht: Reidel, 109 </bibliomixed>
</bibliography>
<table xml:id="tbl-2">
-<caption><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->Terribly relevant tabular information.</caption>
-<!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><tbody>
+<caption>Terribly relevant tabular information.</caption>
+<tbody>
<tr>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->Star </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> Height </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
+<td align='center' valign='top'>Star </td>
+<td align='right' valign='top'> Height </td>
+<td align='right' valign='top'> <inlineequation>
<alt role='tex'>d_{x}</alt>
<m:math>
@@ -1005,7 +1064,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
+<td align='right' valign='top'> <inlineequation>
<alt role='tex'>d_{y}</alt>
<m:math>
@@ -1019,7 +1078,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
+<td align='right' valign='top'> <inlineequation>
<alt role='tex'>n</alt>
<m:math>
@@ -1027,7 +1086,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
+<td align='right' valign='top'> <inlineequation>
<alt role='tex'>\chi^{2}</alt>
<m:math>
@@ -1041,7 +1100,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
+<td align='right' valign='top'> <inlineequation>
<alt role='tex'>R_{maj}</alt>
<m:math>
@@ -1057,7 +1116,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
+<td align='right' valign='top'> <inlineequation>
<alt role='tex'>R_{min}</alt>
<m:math>
@@ -1073,15 +1132,15 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='center' valign='top' colspan='1'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><inlineequation>
+<td align='center' valign='top' colspan='1'><inlineequation>
<alt role='tex'>P</alt>
<m:math>
<m:mrow><m:mi>P</m:mi>
</m:mrow>
</m:math>
-</inlineequation><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->a</td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
+</inlineequation>a</td>
+<td align='right' valign='top'> <inlineequation>
<alt role='tex'>PR_{maj}</alt>
<m:math>
@@ -1099,7 +1158,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
+<td align='right' valign='top'> <inlineequation>
<alt role='tex'>PR_{min}</alt>
<m:math>
@@ -1117,113 +1176,126 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='center' valign='top' colspan='1'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><inlineequation>
+<td align='center' valign='top' colspan='1'><inlineequation>
<alt role='tex'>\Theta</alt>
<m:math>
<m:mrow><m:mo>Θ</m:mo>
</m:mrow>
</m:math>
-</inlineequation><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->b</td>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->Ref.</td>
+</inlineequation>b</td>
+<td align='center' valign='top'>Ref.</td>
</tr>
<tr>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><!-- \tableline\tableline -->1 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->33472.5 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.1 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->0.4 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->53 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->27.4 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.065 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.940 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3.900 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->68.3 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->116.2 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-27.639</td>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1,2</td>
+<td align='center' valign='top'><!-- \tableline\tableline -->
+1 </td>
+<td align='right' valign='top'>33472.5 </td>
+<td align='right' valign='top'>-0.1 </td>
+<td align='right' valign='top'>0.4 </td>
+<td align='right' valign='top'>53 </td>
+<td align='right' valign='top'>27.4 </td>
+<td align='right' valign='top'>2.065 </td>
+<td align='right' valign='top'>1.940 </td>
+<td align='right' valign='top'>3.900 </td>
+<td align='right' valign='top'>68.3 </td>
+<td align='right' valign='top'>116.2 </td>
+<td align='right' valign='top'>-27.639</td>
+<td align='center' valign='top'>1,2</td>
</tr>
<tr>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 2 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->27802.4 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.3 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.2 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->60 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3.7 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.628 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.510 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.156 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->6.8 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->7.5 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-26.764</td>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3</td>
+<td align='center' valign='top'> 2 </td>
+<td align='right' valign='top'>27802.4 </td>
+<td align='right' valign='top'>-0.3 </td>
+<td align='right' valign='top'>-0.2 </td>
+<td align='right' valign='top'>60 </td>
+<td align='right' valign='top'>3.7 </td>
+<td align='right' valign='top'>1.628 </td>
+<td align='right' valign='top'>1.510 </td>
+<td align='right' valign='top'>2.156 </td>
+<td align='right' valign='top'>6.8 </td>
+<td align='right' valign='top'>7.5 </td>
+<td align='right' valign='top'>-26.764</td>
+<td align='center' valign='top'>3</td>
</tr>
<tr>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 3 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->29210.6 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->0.9 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->0.3 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->60 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3.4 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.622 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.551 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.159 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->6.7 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->7.3 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-40.272</td>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->4</td>
+<td align='center' valign='top'> 3 </td>
+<td align='right' valign='top'>29210.6 </td>
+<td align='right' valign='top'>0.9 </td>
+<td align='right' valign='top'>0.3 </td>
+<td align='right' valign='top'>60 </td>
+<td align='right' valign='top'>3.4 </td>
+<td align='right' valign='top'>1.622 </td>
+<td align='right' valign='top'>1.551 </td>
+<td align='right' valign='top'>2.159 </td>
+<td align='right' valign='top'>6.7 </td>
+<td align='right' valign='top'>7.3 </td>
+<td align='right' valign='top'>-40.272</td>
+<td align='center' valign='top'>4</td>
</tr>
<tr>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 4 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->32733.8 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-1.2<!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->c</td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.5 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->41 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->54.8 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.282 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.156 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->4.313 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->117.4 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->78.2 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-35.847</td>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->5,6</td>
+<td align='center' valign='top'> 4 </td>
+<td align='right' valign='top'>32733.8 </td>
+<td align='right' valign='top'>-1.2c</td>
+<td align='right' valign='top'>-0.5 </td>
+<td align='right' valign='top'>41 </td>
+<td align='right' valign='top'>54.8 </td>
+<td align='right' valign='top'>2.282 </td>
+<td align='right' valign='top'>2.156 </td>
+<td align='right' valign='top'>4.313 </td>
+<td align='right' valign='top'>117.4 </td>
+<td align='right' valign='top'>78.2 </td>
+<td align='right' valign='top'>-35.847</td>
+<td align='center' valign='top'>5,6</td>
</tr>
<tr>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 5 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 9607.4 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.4 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.4 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->60 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.4 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.669<!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->c</td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.574 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.343 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->8.0 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->8.9 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-33.417</td>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->7</td>
+<td align='center' valign='top'> 5 </td>
+<td align='right' valign='top'> 9607.4 </td>
+<td align='right' valign='top'>-0.4 </td>
+<td align='right' valign='top'>-0.4 </td>
+<td align='right' valign='top'>60 </td>
+<td align='right' valign='top'>1.4 </td>
+<td align='right' valign='top'>1.669c</td>
+<td align='right' valign='top'>1.574 </td>
+<td align='right' valign='top'>2.343 </td>
+<td align='right' valign='top'>8.0 </td>
+<td align='right' valign='top'>8.9 </td>
+<td align='right' valign='top'>-33.417</td>
+<td align='center' valign='top'>7</td>
</tr>
<tr>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 6 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->31638.6 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.6 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->0.1 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->39 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->315.2 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 3.433 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3.075 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->7.488 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->92.1 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->25.3 </td>
-<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-12.052 </td>
-<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->8</td>
+<td align='center' valign='top'> 6 </td>
+<td align='right' valign='top'>31638.6 </td>
+<td align='right' valign='top'>1.6 </td>
+<td align='right' valign='top'>0.1 </td>
+<td align='right' valign='top'>39 </td>
+<td align='right' valign='top'>315.2 </td>
+<td align='right' valign='top'> 3.433 </td>
+<td align='right' valign='top'>3.075 </td>
+<td align='right' valign='top'>7.488 </td>
+<td align='right' valign='top'>92.1 </td>
+<td align='right' valign='top'>25.3 </td>
+<td align='right' valign='top'>-12.052 </td>
+<td align='center' valign='top'>8</td>
</tr>
</tbody>
-<Table note>a<!-- }{ -->Sample footnote for table <xref linkend="tbl-2" /> that was generated with the LaTeX table environment</Table note>
-<Table note>b<!-- }{ -->Yet another sample footnote for table <xref linkend="tbl-2" /></Table note>
-<Table note>c<!-- }{ -->Another sample footnote for table <xref linkend="tbl-2" /></Table note>
-<TableComments>We can also attach a long-ish paragraph of explanatory material to a table. Use \tablerefs to append a list of references. The following references were from a different table: I've patched them in here to show how they look, but don't take them too seriouslyâI certainly have not.</TableComments>
-<TableRefs>(1) Barbuy, Spite, & Spite 1985; (2) Bond 1980; (3) Carbon et al. 1987; (4) Hobbs & Duncan 1987; (5) Gilroy et al. 1988: (6) Gratton & Ortolani 1986; (7) Gratton & Sneden 1987; (8) Gratton & Sneden (1988); (9) Gratton & Sneden 1991; (10) Kraft et al. 1982; (11) LCL, or Laird, 1990; (12) Leep & Wallerstein 1981; (13) Luck & Bond 1981; (14) Luck & Bond 1985; (15) Magain 1987; (16) Magain 1989; (17) Peterson 1981; (18) Peterson, Kurucz, & Carney 1990; (19) RMB; (20) Schuster & Nissen 1988; (21) Schuster & Nissen 1989b; (22) Spite et al. 1984; (23) Spite & Spite 1986; (24) Hobbs & Thorburn 1991; (25) Hobbs et al. 1991; (26) Olsen 1983.</TableRefs>
-</table>
-</section>
+<Table note>
+a<!-- }{ -->
+Sample footnote for table <xref linkend="tbl-2" /> that was generated with the LaTeX table environment
+</Table note>
+<Table note>
+b<!-- }{ -->
+Yet another sample footnote for table <xref linkend="tbl-2" />
+</Table note>
+<Table note>
+c<!-- }{ -->
+Another sample footnote for table <xref linkend="tbl-2" />
+</Table note>
+<TableComments>
+We can also attach a long-ish paragraph of explanatory material to a table. Use \tablerefs to append a list of references. The following references were from a different table: I've patched them in here to show how they look, but don't take them too seriouslyâI certainly have not.
+</TableComments>
+<TableRefs>
+(1) Barbuy, Spite, & Spite 1985; (2) Bond 1980; (3) Carbon et al. 1987; (4) Hobbs & Duncan 1987; (5) Gilroy et al. 1988: (6) Gratton & Ortolani 1986; (7) Gratton & Sneden 1987; (8) Gratton & Sneden (1988); (9) Gratton & Sneden 1991; (10) Kraft et al. 1982; (11) LCL, or Laird, 1990; (12) Leep & Wallerstein 1981; (13) Luck & Bond 1981; (14) Luck & Bond 1985; (15) Magain 1987; (16) Magain 1989; (17) Peterson 1981; (18) Peterson, Kurucz, & Carney 1990; (19) RMB; (20) Schuster & Nissen 1988; (21) Schuster & Nissen 1989b; (22) Spite et al. 1984; (23) Spite & Spite 1986; (24) Hobbs & Thorburn 1991; (25) Hobbs et al. 1991; (26) Olsen 1983.
+</TableRefs>
+</table>
</article>
\ No newline at end of file
diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout
index 74d2ab6..d79cd02 100644
--- a/lib/layouts/aastex.layout
+++ b/lib/layouts/aastex.layout
@@ -179,6 +179,7 @@ Style Affiliation
DocBookWrapperTag author
DocBookWrapperMergeWithPrevious true
DocBookItemTag orgname
+ DocBookItemTagType paragraph
DocBookInInfo always
End
@@ -207,6 +208,7 @@ Style Altaffilation
DocBookWrapperTag author
DocBookWrapperMergeWithPrevious true
DocBookItemTag orgname
+ DocBookItemTagType paragraph
DocBookInInfo always
End
@@ -228,6 +230,7 @@ Style Email
Shape Italic
EndFont
DocBookTag email
+ DocBookTagType paragraph
DocBookWrapperTag author
DocBookWrapperMergeWithPrevious true
DocBookInInfo always
commit 1f2c51d56b4a136fd5832041c070b80d9adcc8a2
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 02:30:24 2020 +0200
DocBook: adapt SimpleCV for tag types (new-line behaviour).
diff --git a/lib/layouts/simplecv.layout b/lib/layouts/simplecv.layout
index 0a69f1e..1cf6c30 100644
--- a/lib/layouts/simplecv.layout
+++ b/lib/layouts/simplecv.layout
@@ -54,6 +54,7 @@ Style Section
IsTocCaption 1
EndArgument
DocBookTag title
+ DocBookTagType paragraph
DocBookSectionTag section
End
@@ -176,6 +177,7 @@ Style Title
EndFont
HTMLTitle true
DocBookTag title
+ DocBookTagType paragraph
DocBookInInfo maybe
End
commit ec0f4885a7fd9afb007c3a4604a4e75c10ac0452
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 02:30:04 2020 +0200
DocBook: fix bibliographies (end of <bibliography> and sections).
diff --git a/autotests/export/docbook/bibliography_precooked.xml b/autotests/export/docbook/bibliography_precooked.xml
index 1f103bc..901abd4 100644
--- a/autotests/export/docbook/bibliography_precooked.xml
+++ b/autotests/export/docbook/bibliography_precooked.xml
@@ -5,11 +5,10 @@
<title>William Shakespeare</title>
<section>
<title>Publications</title>
+</section>
<bibliography>
<bibliomixed xml:id='first'>First Folio. </bibliomixed>
<bibliomixed xml:id='second'>Second Folio. </bibliomixed>
<bibliomixed xml:id='third'>Third Folio. </bibliomixed>
</bibliography>
-</section>
-
</article>
\ No newline at end of file
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index a0ac96a..19bd1d8 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -393,12 +393,9 @@ void makeBibliography(
// If this is the last paragraph in a bibliography, close the bibliography tag.
auto const end = text.paragraphs().end();
- bool endBibliography = par == end;
- if (!endBibliography) {
- auto nextpar = par;
- ++nextpar;
- endBibliography = par->layout().latextype != LATEX_BIB_ENVIRONMENT;
- }
+ auto nextpar = par;
+ ++nextpar;
+ bool endBibliography = nextpar == end || nextpar->layout().latextype != LATEX_BIB_ENVIRONMENT;
if (endBibliography) {
xs << xml::EndTag("bibliography");
@@ -1124,7 +1121,7 @@ void docbookParagraphs(Text const &text,
auto insetsLength = distance(par->insetList().begin(), par->insetList().end());
if (insetsLength > 0) {
Inset const *firstInset = par->getInset(0);
- if (firstInset && dynamic_cast<InsetBibtex const *>(firstInset)) {
+ if (firstInset && (firstInset->lyxCode() == BIBITEM_CODE || firstInset->lyxCode() == BIBTEX_CODE)) {
while (!headerLevels.empty()) {
int level = headerLevels.top().first;
docstring tag = from_utf8("</" + headerLevels.top().second + ">");
commit 642b18aad0b2add87ef746f78f77f3eb8467f693
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 01:14:44 2020 +0200
DocBook: generate <partintro> when required.
diff --git a/autotests/export/docbook/basic.xml b/autotests/export/docbook/basic.xml
index ea91d3d..49ec1f4 100644
--- a/autotests/export/docbook/basic.xml
+++ b/autotests/export/docbook/basic.xml
@@ -12,7 +12,9 @@
<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">
<title>I am the first section </title>
<para>I am the first paragraph of the first section. </para>
diff --git a/autotests/export/docbook/basic_book.xml b/autotests/export/docbook/basic_book.xml
index 18496b9..c6e9078 100644
--- a/autotests/export/docbook/basic_book.xml
+++ b/autotests/export/docbook/basic_book.xml
@@ -17,7 +17,9 @@
</chapter>
<part>
<title>First part</title>
+<partintro>
<para>Part intro. </para>
+</partintro>
<chapter>
<title>First chapter of first part</title>
<para>Paragraph. </para>
@@ -29,7 +31,9 @@
</part>
<part>
<title>Second part</title>
+<partintro>
<para>Part 2 intro. </para>
+</partintro>
<chapter>
<title>First chapter of second part</title>
<para>Paragraph. </para>
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 3e37f90..a0ac96a 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -821,7 +821,7 @@ bool hasOnlyNotes(Paragraph const & par)
for (int i = 0; i < par.size(); ++i)
// If you find something that is not an inset (like actual text) or an inset that is not a note,
// return false.
- if (!par.isInset(i) || !dynamic_cast<InsetNote *>(par.insetList().get(i)))
+ if (!par.isInset(i) || par.getInset(i)->lyxCode() != NOTE_CODE)
return false;
return true;
}
@@ -851,7 +851,7 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs,
for (; cpit < epit; ++cpit) {
// Skip paragraphs that don't generate anything in DocBook.
Paragraph const & par = paragraphs[cpit];
- if (par.empty() || par.emptyTag() || hasOnlyNotes(par))
+ if (hasOnlyNotes(par))
continue;
// There should never be any section here. (Just a sanity check: if this fails, this function could end up
@@ -869,14 +869,14 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs,
}
// Based on layout information, store this paragraph in one set: should be in <info>, must be,
- // or abstract ().
+ // or abstract (either because of layout or of position).
Layout const &style = par.layout();
if (style.docbookininfo() == "always")
mustBeInInfo.emplace(cpit);
else if (style.docbookininfo() == "maybe")
shouldBeInInfo.emplace(cpit);
- else if (!hasAbstractLayout)
+ else if (documentHasSections && !hasAbstractLayout)
abstractNoLayout.emplace(cpit);
else // This should definitely not be in <info>.
break;
@@ -993,17 +993,17 @@ void docbookSimpleAllParagraphs(
{
// Handle the given text, supposing it has no sections (i.e. a "simple" text). The input may vary in length
// between a single paragraph to a whole document.
+ pit_type const bpit = runparams.par_begin;
+ pit_type const epit = runparams.par_end;
+ ParagraphList const ¶graphs = text.paragraphs();
// First, the <info> tag.
- ParagraphList const ¶graphs = text.paragraphs();
- pit_type bpit = runparams.par_begin;
- pit_type const epit = runparams.par_end;
DocBookInfoTag info = getParagraphsWithInfo(paragraphs, bpit, epit, false);
outputDocBookInfo(text, buf, xs, runparams, paragraphs, info);
// Then, the content. It starts where the <info> ends.
- auto par = text.paragraphs().iterator_at(info.epit);
- auto end = text.paragraphs().iterator_at(epit);
+ auto par = paragraphs.iterator_at(info.epit);
+ auto end = paragraphs.iterator_at(epit);
while (par != end) {
if (!hasOnlyNotes(*par))
par = makeAny(text, buf, xs, runparams, par);
@@ -1040,7 +1040,7 @@ void docbookParagraphs(Text const &text,
tie(documentHasSections, eppit) = hasDocumentSectioning(paragraphs, bpit, epit);
// Deal with "simple" documents, i.e. those without sections.
- if (!documentHasSections){
+ if (!documentHasSections) {
docbookSimpleAllParagraphs(text, buf, xs, runparams);
return;
}
@@ -1048,7 +1048,7 @@ void docbookParagraphs(Text const &text,
// Output the first <info> tag (or just the title).
DocBookInfoTag info = getParagraphsWithInfo(paragraphs, bpit, eppit, true);
outputDocBookInfo(text, buf, xs, runparams, paragraphs, info);
- bpit = eppit;
+ bpit = info.epit;
// Then, iterate through the paragraphs of this document.
bool currentlyInAppendix = false;
@@ -1141,6 +1141,29 @@ void docbookParagraphs(Text const &text,
// Generate this paragraph.
par = makeAny(text, buf, xs, ourparams, par);
+
+ // Some special sections may require abstracts (mostly parts, in books).
+ // TODO: docbookforceabstracttag is a bit contrived here, but it does the job. Having another field just for this would be cleaner, but that's just for <part> and <partintro>, so it's probably not worth the effort.
+ if (isLayoutSectioning(style) && style.docbookforceabstracttag() != "NONE") {
+ // This abstract may be found between the next paragraph and the next title.
+ pit_type cpit = std::distance(text.paragraphs().begin(), par);
+ pit_type ppit = std::get<1>(hasDocumentSectioning(paragraphs, cpit, epit));
+
+ // Generate this abstract (this code corresponds to parts of outputDocBookInfo).
+ DocBookInfoTag secInfo = getParagraphsWithInfo(paragraphs, cpit, ppit, true);
+
+ if (!secInfo.abstract.empty()) {
+ xs << xml::StartTag(style.docbookforceabstracttag());
+ xs << xml::CR();
+ for (auto const &p : secInfo.abstract)
+ makeAny(text, buf, xs, runparams, paragraphs.iterator_at(p));
+ xs << xml::EndTag(style.docbookforceabstracttag());
+ xs << xml::CR();
+ }
+
+ // Skip all the text that just has been generated.
+ par = paragraphs.iterator_at(ppit);
+ }
}
// If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning
commit 17b06f5336241236191d7ec9eb7643669ccfbab9
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 00:58:50 2020 +0200
DocBook: streamline code to handle sections.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 38bcf05..3e37f90 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -1071,18 +1071,18 @@ void docbookParagraphs(Text const &text,
if (isLayoutSectioning(style)) {
int level = style.toclevel;
- // Need to close a previous section if it has the same level or a higher one (close <section> if opening a <h2>
- // after a <h2>, <h3>, <h4>, <h5> or <h6>). More examples:
+ // Need to close a previous section if it has the same level or a higher one (close <section> if opening a
+ // <h2> after a <h2>, <h3>, <h4>, <h5> or <h6>). More examples:
// - current: h2; back: h1; do not close any <section>
// - current: h1; back: h2; close two <section> (first the <h2>, then the <h1>, so a new <h1> can come)
while (!headerLevels.empty() && level <= headerLevels.top().first) {
+ // Output the tag only if it corresponds to a legit section.
int stackLevel = headerLevels.top().first;
- docstring stackTag = from_utf8("</" + headerLevels.top().second + ">");
+ if (stackLevel != Layout::NOT_IN_TOC) {
+ xs << xml::EndTag(headerLevels.top().second);
+ xs << xml::CR();
+ }
headerLevels.pop();
-
- // Output the tag only if it corresponds to a legit section.
- if (stackLevel != Layout::NOT_IN_TOC)
- xs << XMLStream::ESCAPE_NONE << stackTag << xml::CR();
}
// Open the new section: first push it onto the stack, then output it in DocBook.
@@ -1111,11 +1111,10 @@ void docbookParagraphs(Text const &text,
}
// Write the open tag for this section.
- docstring tag = from_utf8("<" + sectionTag);
+ docstring attrs;
if (!id.empty())
- tag += from_utf8(" ") + id;
- tag += from_utf8(">");
- xs << XMLStream::ESCAPE_NONE << tag;
+ attrs = id;
+ xs << xml::StartTag(sectionTag, attrs);
xs << xml::CR();
}
}
commit f219fe1cd7aaa68ab35ec8b3e7fef25926b77cdd
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 30 00:35:47 2020 +0200
DocBook: streamline code to handle abstracts.
diff --git a/autotests/export/docbook/basic_book.xml b/autotests/export/docbook/basic_book.xml
index c94d2fa..18496b9 100644
--- a/autotests/export/docbook/basic_book.xml
+++ b/autotests/export/docbook/basic_book.xml
@@ -1,12 +1,14 @@
<?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.1">
-
-<info><title>Book title</title>
-<author><personname>Book author</personname></author>
-
-<abstract><para>Book abstract in info. </para>
+<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>Book title</title>
+<author>
+<personname>Book author</personname>
+</author>
+<abstract>
+<para>Book abstract in info. </para>
</abstract>
</info>
<chapter>
@@ -15,9 +17,7 @@
</chapter>
<part>
<title>First part</title>
-
-<partintro><para>Part intro. </para>
-</partintro>
+<para>Part intro. </para>
<chapter>
<title>First chapter of first part</title>
<para>Paragraph. </para>
@@ -29,9 +29,7 @@
</part>
<part>
<title>Second part</title>
-
-<partintro><para>Part 2 intro. </para>
-</partintro>
+<para>Part 2 intro. </para>
<chapter>
<title>First chapter of second part</title>
<para>Paragraph. </para>
@@ -41,5 +39,4 @@
<para>Paragraph. </para>
</chapter>
</part>
-
</book>
\ No newline at end of file
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index e609f39..38bcf05 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -773,21 +773,28 @@ ParagraphList::const_iterator makeAny(Text const &text,
}
+bool isLayoutSectioning(Layout const & lay)
+{
+ return lay.category() == from_utf8("Sectioning");
+}
+
+
using DocBookDocumentSectioning = tuple<bool, pit_type>;
struct DocBookInfoTag
{
const set<pit_type> shouldBeInInfo;
- const set<pit_type> mustBeInInfo;
+ const set<pit_type> mustBeInInfo; // With the notable exception of the abstract!
const set<pit_type> abstract;
+ const bool abstractLayout;
pit_type bpit;
pit_type epit;
DocBookInfoTag(const set<pit_type> & shouldBeInInfo, const set<pit_type> & mustBeInInfo,
- const set<pit_type> & abstract, pit_type bpit, pit_type epit) :
+ const set<pit_type> & abstract, bool abstractLayout, pit_type bpit, pit_type epit) :
shouldBeInInfo(shouldBeInInfo), mustBeInInfo(mustBeInInfo), abstract(abstract),
- bpit(bpit), epit(epit) {}
+ abstractLayout(abstractLayout), bpit(bpit), epit(epit) {}
};
@@ -796,7 +803,7 @@ DocBookDocumentSectioning hasDocumentSectioning(ParagraphList const ¶graphs,
while (bpit < epit) {
Layout const &style = paragraphs[bpit].layout();
- documentHasSections |= style.category() == from_utf8("Sectioning");
+ documentHasSections |= isLayoutSectioning(style);
if (documentHasSections)
break;
@@ -820,10 +827,14 @@ bool hasOnlyNotes(Paragraph const & par)
}
-DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type bpit, pit_type const epit) {
+DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs,
+ pit_type bpit, pit_type const epit,
+ // Typically, bpit is the beginning of the document and epit the end *or* the first section.
+ bool documentHasSections) {
set<pit_type> shouldBeInInfo;
set<pit_type> mustBeInInfo;
- set<pit_type> abstract;
+ set<pit_type> abstractWithLayout;
+ set<pit_type> abstractNoLayout;
// Find the first non empty paragraph by mutating bpit.
while (bpit < epit) {
@@ -834,78 +845,48 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type b
break;
}
- // Find the last info-like paragraph.
- pit_type cpit = bpit;
+ // Traverse everything that might belong to <info>.
bool hasAbstractLayout = false;
- while (cpit < epit) {
- // Skip paragraphs only containing one note.
+ pit_type cpit = bpit;
+ for (; cpit < epit; ++cpit) {
+ // Skip paragraphs that don't generate anything in DocBook.
Paragraph const & par = paragraphs[cpit];
- if (hasOnlyNotes(par)) {
- cpit += 1;
+ if (par.empty() || par.emptyTag() || hasOnlyNotes(par))
continue;
+
+ // There should never be any section here. (Just a sanity check: if this fails, this function could end up
+ // processing the whole document.)
+ if (isLayoutSectioning(par.layout())) {
+ LYXERR0("Assertion failed: section found in potential <info> paragraphs.");
+ break;
}
- if (par.layout().docbookabstract())
+ // If this is marked as an abstract by the layout, put it in the right set.
+ if (par.layout().docbookabstract()) {
hasAbstractLayout = true;
+ abstractWithLayout.emplace(cpit);
+ continue;
+ }
- // Based on layout information, store this paragraph in one set: should be in <info>, must be.
+ // Based on layout information, store this paragraph in one set: should be in <info>, must be,
+ // or abstract ().
Layout const &style = par.layout();
- if (style.docbookininfo() == "always") {
+ if (style.docbookininfo() == "always")
mustBeInInfo.emplace(cpit);
- } else if (style.docbookininfo() == "maybe") {
+ else if (style.docbookininfo() == "maybe")
shouldBeInInfo.emplace(cpit);
- } else {
- // Hypothesis: the <info> parts should be grouped together near the beginning bpit.
- // There may be notes in between, but nothing else.
+ else if (!hasAbstractLayout)
+ abstractNoLayout.emplace(cpit);
+ else // This should definitely not be in <info>.
break;
- }
- cpit += 1;
}
- // Now, cpit points to the last paragraph that has things that could go in <info>.
+ // Now, cpit points to the first paragraph that no more has things that could go in <info>.
// bpit is the beginning of the <info> part.
- // Go once again through the list of paragraphs to find the abstract. If there is an abstract
- // layout, only consider it. Otherwise, an abstract is just a sequence of paragraphs with text.
- if (hasAbstractLayout) {
- pit_type pit = bpit;
- while (pit < cpit) { // Don't overshoot the <info> part.
- if (paragraphs[pit].layout().docbookabstract())
- abstract.emplace(pit);
- pit++;
- }
- } else {
- pit_type lastAbstract = epit + 1; // A nonsensical value.
- docstring lastAbstractLayout;
-
- pit_type pit = bpit;
- while (pit < cpit) { // Don't overshoot the <info> part.
- const Paragraph & par = paragraphs.at(pit);
- if (!par.insetList().empty()) {
- for (const auto &i : par.insetList()) {
- if (i.inset->getText(0) != nullptr) {
- if (lastAbstract == epit + 1) {
- // First paragraph that matches the heuristic definition of abstract.
- lastAbstract = pit;
- lastAbstractLayout = par.layout().name();
- } else if (pit > lastAbstract + 1 || par.layout().name() != lastAbstractLayout) {
- // This is either too far from the last abstract paragraph or doesn't
- // have the right layout name, BUT there has already been an abstract
- // in this document: done with detecting the abstract.
- goto done; // Easier to get out of two nested loops.
- }
-
- abstract.emplace(pit);
- break;
- }
- }
- }
- pit++;
- }
- }
-
- done:
- return DocBookInfoTag(shouldBeInInfo, mustBeInInfo, abstract, bpit, cpit);
+ return DocBookInfoTag(shouldBeInInfo, mustBeInInfo,
+ hasAbstractLayout ? abstractWithLayout : abstractNoLayout,
+ hasAbstractLayout, bpit, cpit);
}
} // end anonymous namespace
@@ -940,17 +921,9 @@ void outputDocBookInfo(
if (hasAbstract) {
// Generate the abstract XML into a string before further checks.
odocstringstream os2;
- {
- XMLStream xs2(os2);
- auto bpit = *std::min_element(info.abstract.begin(), info.abstract.end());
- auto epit = 1 + *std::max_element(info.abstract.begin(), info.abstract.end());
- // info.abstract is inclusive, epit is exclusive, hence +1 for looping.
-
- while (bpit < epit) {
- makeAny(text, buf, xs2, runparams, paragraphs.iterator_at(bpit));
- bpit += 1;
- }
- }
+ XMLStream xs2(os2);
+ for (auto const & p : info.abstract)
+ makeAny(text, buf, xs2, runparams, paragraphs.iterator_at(p));
// Actually output the abstract if there is something to do. Don't count line feeds or spaces in this,
// even though they must be properly output if there is some abstract.
@@ -974,27 +947,33 @@ void outputDocBookInfo(
}
// Output the elements that should go in <info>, before and after the abstract.
- for (auto pit : info.shouldBeInInfo) { // Typically, the title: these elements are so important and ubiquitous
+ for (auto pit : info.shouldBeInInfo) // Typically, the title: these elements are so important and ubiquitous
// that mandating a wrapper like <info> would repel users. Thus, generate them first.
makeAny(text, buf, xs, runparams, paragraphs.iterator_at(pit));
- }
- for (auto pit : info.mustBeInInfo) {
+ for (auto pit : info.mustBeInInfo)
if (info.abstract.find(pit) == info.abstract.end()) // The abstract must be in info, but is dealt with after.
makeAny(text, buf, xs, runparams, paragraphs.iterator_at(pit));
- }
// Always output the abstract as the last item of the <info>, as it requires special treatment (especially if
// it contains several paragraphs that are empty).
if (hasAbstract) {
-// string tag = paragraphs[*info.abstract.begin()].layout().docbookforceabstracttag();
-// if (tag == "NONE")
-// tag = "abstract";
-//
-// xs << xml::StartTag(tag);
-// xs << xml::CR();
- xs << XMLStream::ESCAPE_NONE << abstract;
-// xs << xml::EndTag(tag);
-// xs << xml::CR();
+ if (info.abstractLayout) {
+ xs << XMLStream::ESCAPE_NONE << abstract;
+ xs << xml::CR();
+ } else {
+ string tag = paragraphs[*info.abstract.begin()].layout().docbookforceabstracttag();
+ if (tag == "NONE")
+ tag = "abstract";
+
+ if (!xs.isLastTagCR())
+ xs << xml::CR();
+
+ xs << xml::StartTag(tag);
+ xs << xml::CR();
+ xs << XMLStream::ESCAPE_NONE << abstract;
+ xs << xml::EndTag(tag);
+ xs << xml::CR();
+ }
}
// End the <info> tag if it was started.
@@ -1006,23 +985,6 @@ void outputDocBookInfo(
}
-void docbookFirstParagraphs(
- Text const &text,
- Buffer const &buf,
- XMLStream &xs,
- OutputParams const &runparams,
- pit_type epit)
-{
- // Handle the beginning of the document, supposing it has sections.
- // Major role: output the first <info> tag.
-
- ParagraphList const ¶graphs = text.paragraphs();
- pit_type bpit = runparams.par_begin;
- DocBookInfoTag info = getParagraphsWithInfo(paragraphs, bpit, epit);
- outputDocBookInfo(text, buf, xs, runparams, paragraphs, info);
-}
-
-
void docbookSimpleAllParagraphs(
Text const & text,
Buffer const & buf,
@@ -1036,7 +998,7 @@ void docbookSimpleAllParagraphs(
ParagraphList const ¶graphs = text.paragraphs();
pit_type bpit = runparams.par_begin;
pit_type const epit = runparams.par_end;
- DocBookInfoTag info = getParagraphsWithInfo(paragraphs, bpit, epit);
+ DocBookInfoTag info = getParagraphsWithInfo(paragraphs, bpit, epit, false);
outputDocBookInfo(text, buf, xs, runparams, paragraphs, info);
// Then, the content. It starts where the <info> ends.
@@ -1071,20 +1033,24 @@ void docbookParagraphs(Text const &text,
std::stack<std::pair<int, string>> headerLevels; // Used to determine when to open/close sections: store the depth
// of the section and the tag that was used to open it.
- // Detect whether the document contains sections. If there are no sections, there can be no automatically
- // discovered abstract.
+ // Detect whether the document contains sections. If there are no sections, treatment is largely simplified.
+ // In particular, there can't be an abstract, unless it is manually marked.
bool documentHasSections;
pit_type eppit;
tie(documentHasSections, eppit) = hasDocumentSectioning(paragraphs, bpit, epit);
- if (documentHasSections) {
- docbookFirstParagraphs(text, buf, xs, runparams, eppit);
- bpit = eppit;
- } else {
+ // Deal with "simple" documents, i.e. those without sections.
+ if (!documentHasSections){
docbookSimpleAllParagraphs(text, buf, xs, runparams);
return;
}
+ // Output the first <info> tag (or just the title).
+ DocBookInfoTag info = getParagraphsWithInfo(paragraphs, bpit, eppit, true);
+ outputDocBookInfo(text, buf, xs, runparams, paragraphs, info);
+ bpit = eppit;
+
+ // Then, iterate through the paragraphs of this document.
bool currentlyInAppendix = false;
auto par = text.paragraphs().iterator_at(bpit);
@@ -1102,8 +1068,7 @@ void docbookParagraphs(Text const &text,
Layout const &style = par->layout();
// Think about adding <section> and/or </section>s.
- const bool isLayoutSectioning = style.category() == from_utf8("Sectioning");
- if (isLayoutSectioning) {
+ if (isLayoutSectioning(style)) {
int level = style.toclevel;
// Need to close a previous section if it has the same level or a higher one (close <section> if opening a <h2>
commit a8da31e5e0549a2b328d532c6406ea4a3bba26f2
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Aug 29 23:41:28 2020 +0200
DocBook: fix handling of index end-of-range.
diff --git a/autotests/export/docbook/basic.xml b/autotests/export/docbook/basic.xml
index a4dc276..ea91d3d 100644
--- a/autotests/export/docbook/basic.xml
+++ b/autotests/export/docbook/basic.xml
@@ -205,9 +205,9 @@ I am a second line of code.
<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"><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>
+<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 class="endofrange" startref="Term-to-index" />.</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 class="endofrange" startref="Term.to.index" />.</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 class="endofrange" startref="Term.to.index-0" />.</para>
</section>
<section>
<title>I am the eight section and I deal with star sections</title>
diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp
index 987c138..149ef65 100644
--- a/src/insets/InsetIndex.cpp
+++ b/src/insets/InsetIndex.cpp
@@ -287,14 +287,17 @@ void InsetIndex::docbook(XMLStream & xs, OutputParams const & runparams) const
// Hence the thread-local storage, as the numbers must strictly be unique, and thus cannot be shared across
// a paragraph (making the solution used for HTML worthless). This solution is very similar to the one used in
// xml::cleanID.
- docstring attrs = indexType;
- if (hasStartRange || hasEndRange) {
+ // indexType can only be used for singular and startofrange types!
+ docstring attrs;
+ if (!hasStartRange && !hasEndRange) {
+ attrs = indexType;
+ } else {
// Append an ID if uniqueness is not guaranteed across the document.
static QThreadStorage<set<docstring>> tKnownTermLists;
static QThreadStorage<int> tID;
- set<docstring> & knownTermLists = tKnownTermLists.localData();
- int & ID = tID.localData();
+ set<docstring> &knownTermLists = tKnownTermLists.localData();
+ int &ID = tID.localData();
if (!tID.hasLocalData()) {
tID.localData() = 0;
@@ -319,47 +322,51 @@ void InsetIndex::docbook(XMLStream & xs, OutputParams const & runparams) const
// Generate the attributes.
docstring id = xml::cleanID(newIndexTerms);
if (hasStartRange) {
- attrs += " class=\"startofrange\" xml:id=\"" + id + "\"";
+ attrs = indexType + " class=\"startofrange\" xml:id=\"" + id + "\"";
} else {
- attrs += " class=\"endofrange\" startref=\"" + id + "\"";
+ attrs = " class=\"endofrange\" startref=\"" + id + "\"";
}
}
// Handle the index terms (including the specific index for this entry).
- xs << xml::StartTag("indexterm", attrs);
- if (terms.size() > 0) { // hasEndRange has no content.
- xs << xml::StartTag("primary");
- xs << terms[0];
- xs << xml::EndTag("primary");
- }
- if (terms.size() > 1) {
- xs << xml::StartTag("secondary");
- xs << terms[1];
- xs << xml::EndTag("secondary");
- }
- if (terms.size() > 2) {
- xs << xml::StartTag("tertiary");
- xs << terms[2];
- xs << xml::EndTag("tertiary");
- }
+ if (hasEndRange) {
+ xs << xml::CompTag("indexterm", attrs);
+ } else {
+ xs << xml::StartTag("indexterm", attrs);
+ if (!terms.empty()) { // hasEndRange has no content.
+ xs << xml::StartTag("primary");
+ xs << terms[0];
+ xs << xml::EndTag("primary");
+ }
+ if (terms.size() > 1) {
+ xs << xml::StartTag("secondary");
+ xs << terms[1];
+ xs << xml::EndTag("secondary");
+ }
+ if (terms.size() > 2) {
+ xs << xml::StartTag("tertiary");
+ xs << terms[2];
+ xs << xml::EndTag("tertiary");
+ }
- // Handle see and see also.
- if (!see.empty()) {
- xs << xml::StartTag("see");
- xs << see;
- xs << xml::EndTag("see");
- }
+ // Handle see and see also.
+ if (!see.empty()) {
+ xs << xml::StartTag("see");
+ xs << see;
+ xs << xml::EndTag("see");
+ }
- if (!seeAlsoes.empty()) {
- for (auto & entry : seeAlsoes) {
- xs << xml::StartTag("seealso");
- xs << entry;
- xs << xml::EndTag("seealso");
+ if (!seeAlsoes.empty()) {
+ for (auto &entry : seeAlsoes) {
+ xs << xml::StartTag("seealso");
+ xs << entry;
+ xs << xml::EndTag("seealso");
+ }
}
- }
- // Close the entry.
- xs << xml::EndTag("indexterm");
+ // Close the entry.
+ xs << xml::EndTag("indexterm");
+ }
}
}
diff --git a/src/xml.cpp b/src/xml.cpp
index 0daa9d8..557bb01 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -140,11 +140,11 @@ docstring EndTag::writeEndTag() const
docstring CompTag::writeTag() const
{
- docstring output = '<' + from_utf8(tag_);
+ docstring output = '<' + tag_;
if (!attr_.empty()) {
// Erase the beginning of the attributes if it contains space characters: this function deals with that
// automatically.
- docstring attributes = escapeString(from_utf8(attr_), XMLStream::ESCAPE_NONE);
+ docstring attributes = escapeString(attr_, XMLStream::ESCAPE_NONE);
attributes.erase(attributes.begin(), std::find_if(attributes.begin(), attributes.end(),
[](int c) {return !std::isspace(c);}));
if (!attributes.empty()) {
diff --git a/src/xml.h b/src/xml.h
index 56e5d81..52eeb22 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -240,16 +240,19 @@ struct CompTag
{
///
explicit CompTag(std::string const & tag)
- : tag_(tag) {}
+ : tag_(from_utf8(tag)) {}
///
explicit CompTag(std::string const & tag, std::string const & attr)
- : tag_(tag), attr_(attr) {}
+ : tag_(from_utf8(tag)), attr_(from_utf8(attr)) {}
+ ///
+ explicit CompTag(std::string const & tag, docstring const & attr)
+ : tag_(from_utf8(tag)), attr_(attr) {}
/// <tag_ attr_ />
docstring writeTag() const;
///
- std::string tag_;
+ docstring tag_;
///
- std::string attr_;
+ docstring attr_;
};
commit 78a361778f2ca7cc18e9a5fa6deb20694a9150e5
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Aug 29 22:58:23 2020 +0200
DocBook: fix float tags (was unduly overridden).
The output was not valid for floats without title.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3aa192..9085355 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,11 @@
cmake_minimum_required(VERSION 3.1.0)
+set(CMAKE_CXX_STANDARD 20)
+set(GNUWIN32_DIR D:/LyX/lyx-unstable/lyx-windows-deps-msvc2017)
+set(LYX_USE_QT "QT5")
+set(LYX_REQUIRE_SPELLCHECK true)
+
set(LYX_PROJECT LyX)
# Instruct cmake to not use gnu extensions,
diff --git a/autotests/export/docbook/basic.xml b/autotests/export/docbook/basic.xml
index 430611e..a4dc276 100644
--- a/autotests/export/docbook/basic.xml
+++ b/autotests/export/docbook/basic.xml
@@ -164,7 +164,7 @@ I am a second line of code.
</tr>
</tbody>
</table>
-<table>
+<informaltable>
<tbody>
<tr>
<td align='center' valign='top'>Table that has no caption 1</td>
@@ -182,7 +182,7 @@ I am a second line of code.
<td align='center' valign='top'>Col 3, row 2</td>
</tr>
</tbody>
-</table>
+</informaltable>
<para>Then, one figure: </para>
<figure>
diff --git a/lib/layouts/stdfloats.inc b/lib/layouts/stdfloats.inc
index cd6614a..044fcb2 100644
--- a/lib/layouts/stdfloats.inc
+++ b/lib/layouts/stdfloats.inc
@@ -20,7 +20,6 @@ Float
UsesFloatPkg false
ListCommand listoftables
RefPrefix tab
- DocBookTag table
End
@@ -36,7 +35,6 @@ Float
UsesFloatPkg false
ListCommand listoffigures
RefPrefix fig
- DocBookTag figure
End
@@ -51,7 +49,6 @@ Float
IsPredefined false
UsesFloatPkg true
RefPrefix alg
- DocBookTag figure # TODO: No DocBook tag really corresponds...
End
diff --git a/src/Floating.cpp b/src/Floating.cpp
index d44afc3..19fbf5f 100644
--- a/src/Floating.cpp
+++ b/src/Floating.cpp
@@ -40,8 +40,7 @@ Floating::Floating(string const & type, string const & placement,
usesfloatpkg_(usesfloat), ispredefined_(ispredefined),
allowswide_(allowswide), allowssideways_(allowssideways),
html_tag_(htmlTag), html_attrib_(htmlAttrib), html_style_(htmlStyle),
- docbook_tag_(docbookTag), docbook_attr_(docbookAttr),
- docbook_tag_type_(docbookTagType)
+ docbook_attr_(docbookAttr), docbook_tag_type_(docbookTagType)
{}
@@ -89,21 +88,17 @@ string const & Floating::docbookAttr() const
}
-string const & Floating::docbookTag(bool hasTitle) const
+string Floating::docbookTag(bool hasTitle) const
{
- if (docbook_tag_.empty()) {
- docbook_tag_ = "";
- if (floattype_ == "figure") {
- docbook_tag_ = hasTitle ? "figure" : "informalfigure";
- } else if (floattype_ == "table") {
- docbook_tag_ = hasTitle ? "table" : "informaltable";
- } else if (floattype_ == "algorithm") {
- // TODO: no good translation for now! Figures are the closest match, as they can contain text.
- // Solvable as soon as https://github.com/docbook/docbook/issues/157 has a definitive answer.
- docbook_tag_ = "figure";
- }
+ if (floattype_ == "figure") {
+ return hasTitle ? "figure" : "informalfigure";
+ } else if (floattype_ == "table") {
+ return hasTitle ? "table" : "informaltable";
+ } else if (floattype_ == "algorithm") {
+ // TODO: no good translation for now! Figures are the closest match, as they can contain text.
+ // Solvable as soon as https://github.com/docbook/docbook/issues/157 has a definitive answer.
+ return "figure";
}
- return docbook_tag_;
}
diff --git a/src/Floating.h b/src/Floating.h
index 5cfea08..977958b 100644
--- a/src/Floating.h
+++ b/src/Floating.h
@@ -81,7 +81,7 @@ public:
/// tag type, defaults to "div"
std::string const & htmlTag() const;
///
- std::string const & docbookTag(bool hasTitle = false) const;
+ std::string docbookTag(bool hasTitle = false) const;
///
std::string const & docbookAttr() const;
///
@@ -129,8 +129,8 @@ private:
mutable std::string defaultcssclass_;
///
docstring html_style_;
- /// DocBook tag
- mutable std::string docbook_tag_;
+ // There is no way to override the DocBook tag based on the layouts: half of it is determined by whether the float
+ // has a title or not, an information that is not available in the layouts.
/// attribute (mostly, role)
mutable std::string docbook_caption_;
/// caption tag (mostly, either caption or title)
diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp
index 24e06b5..86bcf9d 100644
--- a/src/insets/InsetFloat.cpp
+++ b/src/insets/InsetFloat.cpp
@@ -654,7 +654,7 @@ void docbookNoSubfigures(XMLStream & xs, OutputParams const & runparams, const I
xs << xml::StartTag(ftype.docbookTag(caption != nullptr), attr);
xs << xml::CR();
- if (caption != nullptr) {
+ if (caption) {
xs << xml::StartTag(titleTag);
caption->getCaptionAsDocBook(xs, rpNoLabel);
xs << xml::EndTag(titleTag);
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 5847121..af30e8e 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -2429,7 +2429,7 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
}
// DocBook also has <equation>, but it comes with a title.
- // TODO: recognise \tag from amsmath?
+ // TODO: recognise \tag from amsmath? This would allow having <equation> with a proper title.
docstring attr;
for (row_type i = 0; i < nrows(); ++i) {
commit 39ad6e84f076cea65f140593e5b6647905219af3
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Aug 29 19:05:59 2020 +0200
DocBook: improve equation formatting (new lines for block equations).
diff --git a/autotests/export/docbook/basic.lyx b/autotests/export/docbook/basic.lyx
index 1735dc4..fa98d65 100644
--- a/autotests/export/docbook/basic.lyx
+++ b/autotests/export/docbook/basic.lyx
@@ -185,7 +185,7 @@ noprefix "false"
\begin_layout Standard
Also, a formula with an user-defined macro that outputs well in LaTeX but
- cannot in MathML (hence replaced by picture):
+ cannot in MathML:
\begin_inset Formula $\testmacro$
\end_inset
diff --git a/autotests/export/docbook/basic.xml b/autotests/export/docbook/basic.xml
index 7980289..430611e 100644
--- a/autotests/export/docbook/basic.xml
+++ b/autotests/export/docbook/basic.xml
@@ -30,7 +30,7 @@
</inlineequation>. </para>
</blockquote>
<para>Now, we're outside quotes.</para>
-<para><informalequation>
+<informalequation>
<alt role='tex'>Formula!</alt>
<m:math>
@@ -39,7 +39,8 @@
</m:mrow>
</m:mrow>
</m:math>
-</informalequation><informalequation xml:id="eq.EQ.">
+</informalequation>
+<informalequation xml:id="eq.EQ.">
<alt role='tex'>\text{I am a formula with a ref.}\label{eq:EQ.}</alt>
<m:math>
@@ -50,9 +51,9 @@
</m:mstyle>
</m:mrow>
</m:math>
-</informalequation></para>
+</informalequation>
<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>
+<para>Also, a formula with an user-defined macro that outputs well in LaTeX but cannot in MathML: <inlineequation>
<alt role='tex'>\testmacro</alt>
<mathphrase>MathML export failed. Please report this as a bug.</mathphrase>
</inlineequation>. </para>
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index e87ef88..aad1ccf 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3349,7 +3349,8 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
std::vector<docstring> generatedParagraphs;
odocstringstream os;
- auto * xs = new XMLStream(os);
+ auto * xs = new XMLStream(os); // XMLStream has no copy constructor: to create a new object, the only solution
+ // is to hold a pointer to the XMLStream (xs = XMLStream(os) is not allowed once the first object is built).
// Parsing main loop.
for (pos_type i = initial; i < size(); ++i) {
@@ -3361,7 +3362,6 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
if (getInset(i) != nullptr && getInset(i)->lyxCode() == NEWLINE_CODE) {
generatedParagraphs.push_back(os.str());
os = odocstringstream();
- // XMLStream has no copy constructor.
delete xs;
xs = new XMLStream(os);
}
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 800cbeb..5847121 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -2420,10 +2420,16 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
docstring name;
if (getType() == hullSimple)
name = from_ascii("inlineequation");
- else
+ else {
+ // This is a block equation, always have <informalequation> on its own line.
+ if (!xs.isLastTagCR())
+ xs << xml::CR();
+
name = from_ascii("informalequation");
+ }
// DocBook also has <equation>, but it comes with a title.
+ // TODO: recognise \tag from amsmath?
docstring attr;
for (row_type i = 0; i < nrows(); ++i) {
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 9d51853..e609f39 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -446,10 +446,16 @@ void makeParagraph(
special_case = true;
}
+ size_t nInsets = std::distance(par->insetList().begin(), par->insetList().end());
+
// Plain layouts must be ignored.
- if (!special_case && buf.params().documentClass().isPlainLayout(par->layout()) && !runparams.docbook_force_pars)
- special_case = true;
- // TODO: Could get rid of this with a DocBook equivalent to htmlisblock?
+ special_case |= buf.params().documentClass().isPlainLayout(par->layout()) && !runparams.docbook_force_pars;
+ // Equations do not deserve their own paragraph (DocBook allows them outside paragraphs).
+ special_case |= nInsets == par->size() && std::all_of(par->insetList().begin(), par->insetList().end(), [](InsetList::Element inset) {
+ return inset.inset && inset.inset->asInsetMath();
+ });
+
+ // TODO: Could get rid of this with a DocBook equivalent to htmlisblock? Not for all cases, unfortunately... See above for those that have been determined not to be allowable for this potential refactoring.
if (!special_case && par->size() == 1 && par->getInset(0)) {
Inset const * firstInset = par->getInset(0);
@@ -460,10 +466,6 @@ void makeParagraph(
if (!special_case && firstInset->asInsetCommand())
special_case = firstInset->asInsetCommand()->params().getCmdName() == "bibtex";
- // Equations do not deserve their own paragraph (DocBook allows them outside paragraphs).
- if (!special_case && firstInset->asInsetMath())
- special_case = true;
-
// ERTs are in comments, not paragraphs.
if (!special_case && firstInset->lyxCode() == lyx::ERT_CODE)
special_case = true;
commit 97cfabb8831ea5ab58b46f470dcecd317b26df04
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Aug 29 18:40:31 2020 +0200
DocBook: fix indentation for section titles (including stars).
diff --git a/autotests/export/docbook/basic.lyx b/autotests/export/docbook/basic.lyx
index 0bd87ce..1735dc4 100644
--- a/autotests/export/docbook/basic.lyx
+++ b/autotests/export/docbook/basic.lyx
@@ -1,5 +1,5 @@
-#LyX 2.4 created this file. For more info see http://www.lyx.org/
-\lyxformat 544
+#LyX 2.4 created this file. For more info see https://www.lyx.org/
+\lyxformat 598
\begin_document
\begin_header
\save_transient_properties true
@@ -9,11 +9,11 @@
\newcommand{\testmacro}{\ensuremath{\operatorname{testmacro}}}
\end_preamble
\use_default_options true
-\maintain_unincluded_children false
+\maintain_unincluded_children no
\language english
\language_package default
-\inputencoding auto
-\fontencoding global
+\inputencoding auto-legacy
+\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
@@ -21,7 +21,9 @@
\font_default_family default
\use_non_tex_fonts false
\font_sc false
-\font_osf 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
@@ -56,6 +58,7 @@
\justification true
\use_refstyle 1
\use_minted 0
+\use_lineno 0
\index Index
\shortcut idx
\color #008000
@@ -75,11 +78,15 @@
\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
@@ -140,6 +147,10 @@ I am a quote
\end_layout
\begin_layout Standard
+Now, we're outside quotes.
+\end_layout
+
+\begin_layout Standard
\begin_inset Formula
\[
Formula!
@@ -386,6 +397,8 @@ Now, three tables:
\begin_layout Standard
\begin_inset Float table
+placement document
+alignment document
wide false
sideways false
status open
@@ -511,6 +524,8 @@ I am a table caption below the table.
\begin_layout Standard
\begin_inset Float table
+placement document
+alignment document
wide false
sideways false
status open
@@ -636,6 +651,8 @@ Col 3, row 2
\begin_layout Standard
\begin_inset Float table
+placement document
+alignment document
wide false
sideways false
status open
@@ -753,6 +770,8 @@ Then, one figure:
\begin_layout Standard
\begin_inset Float figure
+placement document
+alignment document
wide false
sideways false
status open
diff --git a/autotests/export/docbook/basic.xml b/autotests/export/docbook/basic.xml
index 6f4a828..7980289 100644
--- a/autotests/export/docbook/basic.xml
+++ b/autotests/export/docbook/basic.xml
@@ -29,6 +29,7 @@
</m:math>
</inlineequation>. </para>
</blockquote>
+<para>Now, we're outside quotes.</para>
<para><informalequation>
<alt role='tex'>Formula!</alt>
<m:math>
@@ -72,22 +73,37 @@
</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>
-
-Sentence meaning<!-- Output Error: Closing tag `listitem' when other tags are open, namely: -->
-<!-- Output Error: varlistentry -->
-</varlistentry></listitem></variablelist>
+<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>
</section>
<section>
<title>I am the fourth section and I deal with formatting. </title>
@@ -95,9 +111,11 @@ Sentence meaning<!-- Output Error: Closing tag `listitem' when other tags are op
<para><programlisting>I am some code.
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>
+<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>On the other hand, <footnote>
+<para>this footnote</para>
<para>has multiple </para>
<para>paragraphs.</para>
</footnote>. </para>
@@ -145,7 +163,7 @@ I am a second line of code.
</tr>
</tbody>
</table>
-<informaltable>
+<table>
<tbody>
<tr>
<td align='center' valign='top'>Table that has no caption 1</td>
@@ -163,7 +181,8 @@ I am a second line of code.
<td align='center' valign='top'>Col 3, row 2</td>
</tr>
</tbody>
-</informaltable>
+</table>
+
<para>Then, one figure: </para>
<figure>
<title>Caption.</title>
@@ -334,5 +353,4 @@ I am a second line of code.
</author>
</authorgroup>
</biblioentry>
-</bibliography>
-</article>
\ No newline at end of file
+</bibliography></article>
\ No newline at end of file
diff --git a/lib/layouts/stdsections.inc b/lib/layouts/stdsections.inc
index fa42eac..30b64ea 100644
--- a/lib/layouts/stdsections.inc
+++ b/lib/layouts/stdsections.inc
@@ -7,7 +7,7 @@
# commands that are useful for article-like document classes, but not
# for letters.
-Format 82
+Format 84
Style Part
Category Sectioning
@@ -40,6 +40,7 @@ Style Part
EndFont
HTMLTag h1
DocBookTag title
+ DocBookTagType paragraph
DocBookSectionTag part
DocBookForceAbstractTag partintro
End
@@ -75,6 +76,7 @@ Style Chapter
EndFont
HTMLTag h1
DocBookTag title
+ DocBookTagType paragraph
DocBookSectionTag chapter
End
@@ -108,6 +110,7 @@ Style Section
EndFont
HTMLTag h2
DocBookTag title
+ DocBookTagType paragraph
DocBookSectionTag section
End
commit fc2c36289b5c0cd15f453c4905bb56a2b20aef25
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Thu Aug 27 00:52:06 2020 +0200
DocBook: rewrite makeListEnvironment.
diff --git a/autotests/export/docbook/lists.lyx b/autotests/export/docbook/lists.lyx
index f4a58c2..1c1e88b 100644
--- a/autotests/export/docbook/lists.lyx
+++ b/autotests/export/docbook/lists.lyx
@@ -102,11 +102,71 @@ Second item on two lines
I'm the second line
\end_layout
+\begin_layout Itemize
+Third item
+\end_layout
+
\begin_layout Standard
-\begin_inset Note Note
-status collapsed
+A simple enumerated list:
+\end_layout
+
+\begin_layout Enumerate
+First item
+\end_layout
+
+\begin_layout Enumerate
+Second item on two lines
+\begin_inset Newline newline
+\end_inset
+
+I'm the second line
+\end_layout
+
+\begin_layout Standard
+A simple description list:
+\end_layout
+
+\begin_layout Description
+Word description
+\end_layout
+
+\begin_layout Description
+Sentence meaning
+\end_layout
+
+\begin_layout Standard
+Nested lists:
+\end_layout
+
+\begin_layout Itemize
+First item
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+First first item
+\end_layout
+
+\begin_layout Itemize
+First second item
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
+Second item
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+Second first item
+\end_layout
+
+\begin_layout Itemize
+Second second item
+\end_layout
-\begin_layout Plain Layout
+\end_deeper
+\begin_layout Standard
A complex list:
\end_layout
@@ -123,7 +183,47 @@ First first item
First second item
\end_layout
-\begin_layout Plain Layout
+\begin_layout Standard
+Text after first item
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
+Second item
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+Second first item
+\end_layout
+
+\begin_layout Itemize
+Second second item
+\end_layout
+
+\begin_layout Standard
+Text after second item
+\end_layout
+
+\end_deeper
+\begin_layout Standard
+A very complex list:
+\end_layout
+
+\begin_layout Itemize
+First item
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+First first item
+\end_layout
+
+\begin_layout Itemize
+First second item
+\end_layout
+
+\begin_layout Standard
Text after first item
\end_layout
@@ -141,15 +241,32 @@ Second first item
Second second item
\end_layout
-\begin_layout Plain Layout
+\begin_layout Standard
Text after second item
\end_layout
\end_deeper
-\end_inset
+\begin_layout Standard
+Nested description lists:
+\end_layout
+\begin_layout Description
+LyX:
+\end_layout
+\begin_deeper
+\begin_layout Description
+lyx16 LyX 1.6 file format (lyx2lyx)
+\end_layout
+
+\begin_layout Description
+lyx21 LyX 2.1 file format (lyx2lyx)
\end_layout
+\begin_layout Description
+xhtml LyXHTML (native LyX HTML export)
+\end_layout
+
+\end_deeper
\end_body
\end_document
diff --git a/autotests/export/docbook/lists.xml b/autotests/export/docbook/lists.xml
index d7b24f6..6812230 100644
--- a/autotests/export/docbook/lists.xml
+++ b/autotests/export/docbook/lists.xml
@@ -12,5 +12,141 @@
<para>Second item on two lines</para>
<para>I'm the second line</para>
</listitem>
+<listitem>
+<para>Third item</para>
+</listitem>
+</itemizedlist>
+<para>A simple enumerated list: </para>
+<orderedlist>
+<listitem>
+<para>First item</para>
+</listitem>
+<listitem>
+<para>Second item on two lines</para>
+<para>I'm the second line</para>
+</listitem>
+</orderedlist>
+<para>A simple description list: </para>
+<variablelist>
+<varlistentry>
+<term>Word</term>
+<listitem>
+<para>description</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>Sentence</term>
+<listitem>
+<para>meaning</para>
+</listitem>
+</varlistentry>
+</variablelist>
+<para>Nested lists:</para>
+<itemizedlist>
+<listitem>
+<para>First item</para>
+<itemizedlist>
+<listitem>
+<para>First first item</para>
+</listitem>
+<listitem>
+<para>First second item</para>
+</listitem>
+</itemizedlist>
+</listitem>
+<listitem>
+<para>Second item</para>
+<itemizedlist>
+<listitem>
+<para>Second first item</para>
+</listitem>
+<listitem>
+<para>Second second item</para>
+</listitem>
+</itemizedlist>
+</listitem>
+</itemizedlist>
+<para>A complex list:</para>
+<itemizedlist>
+<listitem>
+<para>First item</para>
+<itemizedlist>
+<listitem>
+<para>First first item</para>
+</listitem>
+<listitem>
+<para>First second item</para>
+</listitem>
+</itemizedlist>
+<para>Text after first item</para>
+</listitem>
+<listitem>
+<para>Second item</para>
+<itemizedlist>
+<listitem>
+<para>Second first item</para>
+</listitem>
+<listitem>
+<para>Second second item</para>
+</listitem>
+</itemizedlist>
+<para>Text after second item</para>
+</listitem>
+</itemizedlist>
+<para>A very complex list:</para>
+<itemizedlist>
+<listitem>
+<para>First item</para>
+<itemizedlist>
+<listitem>
+<para>First first item</para>
+</listitem>
+<listitem>
+<para>First second item</para>
+</listitem>
</itemizedlist>
+<para>Text after first item</para>
+</listitem>
+<listitem>
+<para>Second item</para>
+<orderedlist>
+<listitem>
+<para>Second first item</para>
+</listitem>
+<listitem>
+<para>Second second item</para>
+</listitem>
+</orderedlist>
+<para>Text after second item</para>
+</listitem>
+</itemizedlist>
+<para>Nested description lists: </para>
+<variablelist>
+<varlistentry>
+<term>LyX:</term>
+<listitem>
+
+<variablelist>
+<varlistentry>
+<term>lyx16</term>
+<listitem>
+<para>LyX 1.6 file format (lyx2lyx)</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>lyx21</term>
+<listitem>
+<para>LyX 2.1 file format (lyx2lyx)</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>xhtml</term>
+<listitem>
+<para>LyXHTML (native LyX HTML export)</para>
+</listitem>
+</varlistentry>
+</variablelist>
+</listitem>
+</varlistentry>
+</variablelist>
</article>
\ No newline at end of file
diff --git a/lib/layouts/stdlists.inc b/lib/layouts/stdlists.inc
index c0b346d..d05e896 100644
--- a/lib/layouts/stdlists.inc
+++ b/lib/layouts/stdlists.inc
@@ -43,9 +43,7 @@ Style Itemize
Color latex
EndFont
EndArgument
- DocBookWrapperTag itemizedlist
- DocBookWrapperMergeWithPrevious true
- DocBookTag NONE
+ DocBookTag itemizedlist
DocBookItemTag listitem
DocBookItemInnerTag para
End
@@ -134,6 +132,7 @@ Style Description
DocBookItemTag listitem
DocBookItemInnerTag para
DocBookItemLabelTag term
+ DocBookItemLabelTagType paragraph
End
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 356de07..9d51853 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -225,7 +225,7 @@ void closeBlockTag(XMLStream & xs, const std::string & tag)
void openTag(XMLStream & xs, const std::string & tag, const std::string & attr, const std::string & tagtype)
{
- if (tag.empty() || tag == "NONE")
+ if (tag.empty() || tag == "NONE") // Common check to be performed elsewhere, if it was not here.
return;
if (tag == "para" || tagtype == "paragraph") // Special case for <para>: always considered as a paragraph.
@@ -275,7 +275,7 @@ void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar
Layout const & prevlay = prevpar->layout();
if (prevlay.docbookwrappertag() != "NONE") {
openWrapper = prevlay.docbookwrappertag() == lay.docbookwrappertag()
- && !lay.docbookwrappermergewithprevious();
+ && !lay.docbookwrappermergewithprevious();
}
}
@@ -308,32 +308,8 @@ void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpa
if (nextpar != nullptr) {
Layout const & nextlay = nextpar->layout();
if (nextlay.docbookwrappertag() != "NONE") {
- if (nextpar->getDepth() == par->getDepth()) {
- // Same depth: the basic condition applies.
- closeWrapper = nextlay.docbookwrappertag() == lay.docbookwrappertag()
- && !nextlay.docbookwrappermergewithprevious();
- } else if (nextpar->getDepth() > par->getDepth()) {
- // The next paragraph is deeper: no need to close the wrapper, only to open it (cf. openParTag).
- closeWrapper = 0;
- } else {
- // This paragraph is deeper than the next one: close the wrapper,
- // disregarding docbookwrappermergewithprevious.
- // Hypothesis: nextlay.docbookwrappertag() == lay.docbookwrappertag(). TODO: THIS IS WRONG! Loop back until a layout with the right depth is found?
- closeWrapper = 1L + (long long) par->getDepth() - (long long) nextpar->getDepth(); // > 0, as nextpar->getDepth() < par->getDepth()
- }
- } else {
- if (nextpar->getDepth() == par->getDepth()) {
- // This is not wrapped: this must be the rest of the item, still within the wrapper.
- closeWrapper = 1;
- } else if (nextpar->getDepth() > par->getDepth()) {
- // The next paragraph is deeper: no need to close the wrapper, only to open it (cf. openParTag).
- closeWrapper = 0;
- } else {
- // This paragraph is deeper than the next one: close the wrapper,
- // disregarding docbookwrappermergewithprevious.
- // Hypothesis: nextlay.docbookwrappertag() == lay.docbookwrappertag(). TODO: THIS IS WRONG! Loop back until a layout with the right depth is found?
- closeWrapper = 1L + (long long) par->getDepth() - (long long) nextpar->getDepth(); // > 0, as nextpar->getDepth() < par->getDepth()
- }
+ closeWrapper = nextlay.docbookwrappertag() == lay.docbookwrappertag()
+ && !nextlay.docbookwrappermergewithprevious();
}
}
@@ -564,9 +540,7 @@ void makeEnvironment(Text const &text,
// Usual cases: maybe there is something specified at the layout level. Highly unlikely, though.
docstring const lbl = par->params().labelString();
- if (lbl.empty()) {
- xs << xml::CR();
- } else {
+ if (!lbl.empty()) {
openLabelTag(xs, style);
xs << lbl;
closeLabelTag(xs, style);
@@ -628,7 +602,6 @@ ParagraphList::const_iterator findEndOfEnvironment(
ParagraphList::const_iterator const & pend)
{
// Copy-paste from XHTML. Should be factored out at some point...
-
ParagraphList::const_iterator p = pstart;
Layout const & bstyle = p->layout();
size_t const depth = p->params().depth();
@@ -662,95 +635,84 @@ ParagraphList::const_iterator makeListEnvironment(Text const &text,
Buffer const &buf,
XMLStream &xs,
OutputParams const &runparams,
- ParagraphList::const_iterator const & par)
+ ParagraphList::const_iterator const & begin)
{
+ auto par = begin;
auto const end = text.paragraphs().end();
+ auto const envend = findEndOfEnvironment(par, end);
- // Output the opening tag for this environment, but only if it has not been previously opened (condition
- // implemented in openParTag).
- auto prevpar = text.paragraphs().getParagraphBefore(par);
- openParTag(xs, &*par, prevpar); // TODO: switch in layout for par/block?
+ // Output the opening tag for this environment.
+ Layout const & envstyle = par->layout();
+ openTag(xs, envstyle.docbookwrappertag(), envstyle.docbookwrapperattr(), envstyle.docbookwrappertagtype());
+ openTag(xs, envstyle.docbooktag(), envstyle.docbookattr(), envstyle.docbooktagtype());
- // Generate the contents of this environment. There is a special case if this is like some environment.
- Layout const & style = par->layout();
- if (style.latextype == LATEX_COMMAND) {
- // Nothing to do (otherwise, infinite loops).
- } else if (style.latextype == LATEX_ENVIRONMENT ||
- style.latextype == LATEX_LIST_ENVIRONMENT ||
- style.latextype == LATEX_ITEM_ENVIRONMENT) {
- // Open a wrapper tag if needed.
- if (style.docbookitemwrappertag() != "NONE")
- openTag(xs, style.docbookitemwrappertag(), style.docbookitemwrapperattr(), style.docbookitemwrappertagtype());
+ // Handle the content of the list environment, item by item.
+ while (par != envend) {
+ Layout const & style = par->layout();
+
+ // Open the item wrapper.
+ 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) {
+ if (style.labeltype == LABEL_MANUAL) {
+ // Only variablelist gets here (or similar items defined as an extension in the layout).
+ openLabelTag(xs, style);
+ sep = 1 + par->firstWordDocBook(xs, runparams);
+ closeLabelTag(xs, style);
+ } else {
// Usual cases: maybe there is something specified at the layout level. Highly unlikely, though.
docstring const lbl = par->params().labelString();
- if (lbl.empty()) {
- xs << xml::CR();
- } else {
+ 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);
- auto p = pars.begin();
- while (true) {
- xs << XMLStream::ESCAPE_NONE << *p;
- ++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;
+ // Open the item (after the wrapper and the label).
+ openTag(xs, style.docbookitemtag(), style.docbookitemattr(), style.docbookitemtagtype());
+
+ // Generate the content of the item.
+ if (sep < par->size()) {
+ auto pars = par->simpleDocBookOnePar(buf, runparams,
+ text.outerFont(std::distance(text.paragraphs().begin(), par)), sep);
+ for (auto &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 {
+ // DocBook doesn't like emptiness.
+ openTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnerattr(),
+ par->layout().docbookiteminnertagtype());
+ closeTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnertagtype());
}
- } else {
- makeAny(text, buf, xs, runparams, par);
+
+ // If the next item is deeper, it must go entirely within this item (do it recursively).
+ // By construction, with findEndOfEnvironment, depth can only stay constant or increase, never decrease.
+ depth_type currentDepth = par->getDepth();
+ ++par;
+ while (par != envend && par->getDepth() != currentDepth)
+ par = makeAny(text, buf, xs, runparams, par);
+ // Usually, this loop only makes one iteration, except in complex scenarios, like an item with a paragraph,
+ // a list, and another paragraph; or an item with two types of list (itemise then enumerate, for instance).
+
+ // Close the item.
+ closeTag(xs, style.docbookitemtag(), style.docbookitemtagtype());
+ closeTag(xs, style.docbookitemwrappertag(), style.docbookitemwrappertagtype());
}
- // Close the environment.
- auto nextpar = par;
- ++nextpar;
- closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr); // TODO: switch in layout for par/block?
+ // Close this environment in exactly the same way as it was opened.
+ closeTag(xs, envstyle.docbooktag(), envstyle.docbooktagtype());
+ closeTag(xs, envstyle.docbookwrappertag(), envstyle.docbookwrappertagtype());
- return nextpar;
+ return envend;
}
diff --git a/src/xml.cpp b/src/xml.cpp
index 2f49667..0daa9d8 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -185,6 +185,12 @@ void XMLStream::writeError(docstring const &s)
}
+XMLStream::TagPtr XMLStream::getLastStackTag()
+{
+ return tag_stack_.back();
+}
+
+
bool XMLStream::closeFontTags()
{
if (isTagPending(xml::parsep_tag))
diff --git a/src/xml.h b/src/xml.h
index 45c62ab..56e5d81 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -125,7 +125,6 @@ private:
// own these pointers and how they will be deleted, so we use shared
// pointers.
///
- typedef std::shared_ptr<xml::StartTag> TagPtr;
typedef std::deque<TagPtr> TagDeque;
///
template <typename T>
commit 8656fbd520030a2879f60a55edf0dfc706a2a60b
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Aug 29 03:03:16 2020 +0200
DocBook: start splitting environment handling in two, to have proper things for lists.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 12c0089..356de07 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -370,12 +370,11 @@ void closeItemTag(XMLStream & xs, Layout const & lay)
}
-void makeAny(
- Text const &,
- Buffer const &,
- XMLStream &,
- OutputParams const &,
- ParagraphList::const_iterator);
+ParagraphList::const_iterator makeAny(Text const &,
+ Buffer const &,
+ XMLStream &,
+ OutputParams const &,
+ ParagraphList::const_iterator);
void makeBibliography(
@@ -664,7 +663,6 @@ ParagraphList::const_iterator makeListEnvironment(Text const &text,
XMLStream &xs,
OutputParams const &runparams,
ParagraphList::const_iterator const & par)
->>>>>>> be6480e59c... DocBook: same refactoring for docbookSimpleAllParagraphs.
{
auto const end = text.paragraphs().end();
@@ -751,6 +749,8 @@ ParagraphList::const_iterator makeListEnvironment(Text const &text,
auto nextpar = par;
++nextpar;
closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr); // TODO: switch in layout for par/block?
+
+ return nextpar;
}
@@ -791,10 +791,12 @@ ParagraphList::const_iterator makeAny(Text const &text,
makeCommand(text, buf, xs, runparams, par);
break;
case LATEX_ENVIRONMENT:
+ makeEnvironment(text, buf, xs, runparams, par);
+ break;
case LATEX_LIST_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
- makeEnvironment(buf, xs, ourparams, text, par);
- break;
+ // Only case when makeAny() might consume more than one paragraph.
+ return makeListEnvironment(text, buf, xs, runparams, par);
case LATEX_PARAGRAPH:
makeParagraph(text, buf, xs, runparams, par);
break;
@@ -802,6 +804,8 @@ ParagraphList::const_iterator makeAny(Text const &text,
makeBibliography(text, buf, xs, runparams, par);
break;
}
+ ++par;
+ return par;
}
@@ -1208,7 +1212,7 @@ void docbookParagraphs(Text const &text,
}
// Generate this paragraph.
- makeAny(text, buf, xs, ourparams, par);
+ par = makeAny(text, buf, xs, ourparams, par);
}
// If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning
commit 1bd49f9c39b103b2d8bbe079bc603cfa47509ae5
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Aug 29 03:46:30 2020 +0200
DocBook: make all make* functions have the same argument order.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index ff47aa6..12c0089 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -378,11 +378,11 @@ void makeAny(
ParagraphList::const_iterator);
-void makeParagraphBibliography(
+void makeBibliography(
+ Text const & text,
Buffer const & buf,
XMLStream & xs,
OutputParams const & runparams,
- Text const & text,
ParagraphList::const_iterator const & par)
{
// If this is the first paragraph in a bibliography, open the bibliography tag.
@@ -433,10 +433,10 @@ void makeParagraphBibliography(
void makeParagraph(
+ Text const & text,
Buffer const & buf,
XMLStream & xs,
OutputParams const & runparams,
- Text const & text,
ParagraphList::const_iterator const & par)
{
auto const begin = text.paragraphs().begin();
@@ -531,10 +531,10 @@ void makeParagraph(
}
-void makeEnvironment(Buffer const &buf,
+void makeEnvironment(Text const &text,
+ Buffer const &buf,
XMLStream &xs,
OutputParams const &runparams,
- Text const &text,
ParagraphList::const_iterator const & par)
{
// TODO: simplify me!
@@ -659,10 +659,10 @@ ParagraphList::const_iterator findEndOfEnvironment(
}
-ParagraphList::const_iterator makeListEnvironment(Buffer const &buf,
+ParagraphList::const_iterator makeListEnvironment(Text const &text,
+ Buffer const &buf,
XMLStream &xs,
OutputParams const &runparams,
- Text const &text,
ParagraphList::const_iterator const & par)
>>>>>>> be6480e59c... DocBook: same refactoring for docbookSimpleAllParagraphs.
{
@@ -755,10 +755,10 @@ ParagraphList::const_iterator makeListEnvironment(Buffer const &buf,
void makeCommand(
+ Text const & text,
Buffer const & buf,
XMLStream & xs,
OutputParams const & runparams,
- Text const & text,
ParagraphList::const_iterator const & par)
{
// Unlike XHTML, no need for labels, as they are handled by DocBook tags.
@@ -780,16 +780,15 @@ void makeCommand(
}
-void makeAny(
- Text const &text,
- Buffer const &buf,
- XMLStream &xs,
- OutputParams const &ourparams,
- ParagraphList::const_iterator par)
+ParagraphList::const_iterator makeAny(Text const &text,
+ Buffer const &buf,
+ XMLStream &xs,
+ OutputParams const &runparams,
+ ParagraphList::const_iterator par)
{
switch (par->layout().latextype) {
case LATEX_COMMAND:
- makeCommand(buf, xs, ourparams, text, par);
+ makeCommand(text, buf, xs, runparams, par);
break;
case LATEX_ENVIRONMENT:
case LATEX_LIST_ENVIRONMENT:
@@ -797,10 +796,10 @@ void makeAny(
makeEnvironment(buf, xs, ourparams, text, par);
break;
case LATEX_PARAGRAPH:
- makeParagraph(buf, xs, ourparams, text, par);
+ makeParagraph(text, buf, xs, runparams, par);
break;
case LATEX_BIB_ENVIRONMENT:
- makeParagraphBibliography(buf, xs, ourparams, text, par);
+ makeBibliography(text, buf, xs, runparams, par);
break;
}
}
commit fc0999a4220afb1646a5ae75ea8192b6d304ec56
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Aug 29 02:55:47 2020 +0200
DocBook: partially remove use of bpit/epit in docbookParagraphs and docbookSimpleAllParagraphs.
This will help with the next refactoring to be much cleaner (only work with iterators, don't maintain twice the same information).
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 0dc5257..ff47aa6 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -308,8 +308,32 @@ void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpa
if (nextpar != nullptr) {
Layout const & nextlay = nextpar->layout();
if (nextlay.docbookwrappertag() != "NONE") {
- closeWrapper = nextlay.docbookwrappertag() == lay.docbookwrappertag()
- && !nextlay.docbookwrappermergewithprevious();
+ if (nextpar->getDepth() == par->getDepth()) {
+ // Same depth: the basic condition applies.
+ closeWrapper = nextlay.docbookwrappertag() == lay.docbookwrappertag()
+ && !nextlay.docbookwrappermergewithprevious();
+ } else if (nextpar->getDepth() > par->getDepth()) {
+ // The next paragraph is deeper: no need to close the wrapper, only to open it (cf. openParTag).
+ closeWrapper = 0;
+ } else {
+ // This paragraph is deeper than the next one: close the wrapper,
+ // disregarding docbookwrappermergewithprevious.
+ // Hypothesis: nextlay.docbookwrappertag() == lay.docbookwrappertag(). TODO: THIS IS WRONG! Loop back until a layout with the right depth is found?
+ closeWrapper = 1L + (long long) par->getDepth() - (long long) nextpar->getDepth(); // > 0, as nextpar->getDepth() < par->getDepth()
+ }
+ } else {
+ if (nextpar->getDepth() == par->getDepth()) {
+ // This is not wrapped: this must be the rest of the item, still within the wrapper.
+ closeWrapper = 1;
+ } else if (nextpar->getDepth() > par->getDepth()) {
+ // The next paragraph is deeper: no need to close the wrapper, only to open it (cf. openParTag).
+ closeWrapper = 0;
+ } else {
+ // This paragraph is deeper than the next one: close the wrapper,
+ // disregarding docbookwrappermergewithprevious.
+ // Hypothesis: nextlay.docbookwrappertag() == lay.docbookwrappertag(). TODO: THIS IS WRONG! Loop back until a layout with the right depth is found?
+ closeWrapper = 1L + (long long) par->getDepth() - (long long) nextpar->getDepth(); // > 0, as nextpar->getDepth() < par->getDepth()
+ }
}
}
@@ -507,12 +531,140 @@ void makeParagraph(
}
-void makeEnvironment(
- Buffer const &buf,
- XMLStream &xs,
- OutputParams const &runparams,
- Text const &text,
- ParagraphList::const_iterator const & par)
+void makeEnvironment(Buffer const &buf,
+ XMLStream &xs,
+ OutputParams const &runparams,
+ Text const &text,
+ ParagraphList::const_iterator const & par)
+{
+ // TODO: simplify me!
+ auto const end = text.paragraphs().end();
+
+ // Output the opening tag for this environment, but only if it has not been previously opened (condition
+ // implemented in openParTag).
+ auto prevpar = text.paragraphs().getParagraphBefore(par);
+ openParTag(xs, &*par, prevpar); // TODO: switch in layout for par/block?
+
+ // Generate the contents of this environment. There is a special case if this is like some environment.
+ Layout const & style = par->layout();
+ 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();
+
+ if (lbl.empty()) {
+ xs << xml::CR();
+ } else {
+ 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);
+ auto p = pars.begin();
+ while (true) {
+ xs << XMLStream::ESCAPE_NONE << *p;
+ ++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;
+ }
+ }
+ } else {
+ makeAny(text, buf, xs, runparams, par);
+ }
+
+ // Close the environment.
+ auto nextpar = par;
+ ++nextpar;
+ closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr); // TODO: switch in layout for par/block?
+}
+
+
+ParagraphList::const_iterator findEndOfEnvironment(
+ ParagraphList::const_iterator const & pstart,
+ ParagraphList::const_iterator const & pend)
+{
+ // Copy-paste from XHTML. Should be factored out at some point...
+
+ ParagraphList::const_iterator p = pstart;
+ Layout const & bstyle = p->layout();
+ size_t const depth = p->params().depth();
+ for (++p; p != pend; ++p) {
+ Layout const & style = p->layout();
+ // It shouldn't happen that e.g. a section command occurs inside
+ // a quotation environment, at a higher depth, but as of 6/2009,
+ // it can happen. We pretend that it's just at lowest depth.
+ if (style.latextype == LATEX_COMMAND)
+ return p;
+
+ // If depth is down, we're done
+ if (p->params().depth() < depth)
+ return p;
+
+ // If depth is up, we're not done
+ if (p->params().depth() > depth)
+ continue;
+
+ // FIXME I am not sure about the first check.
+ // Surely we *could* have different layouts that count as
+ // LATEX_PARAGRAPH, right?
+ if (style.latextype == LATEX_PARAGRAPH || style != bstyle)
+ return p;
+ }
+ return pend;
+}
+
+
+ParagraphList::const_iterator makeListEnvironment(Buffer const &buf,
+ XMLStream &xs,
+ OutputParams const &runparams,
+ Text const &text,
+ ParagraphList::const_iterator const & par)
+>>>>>>> be6480e59c... DocBook: same refactoring for docbookSimpleAllParagraphs.
{
auto const end = text.paragraphs().end();
@@ -921,12 +1073,13 @@ void docbookSimpleAllParagraphs(
outputDocBookInfo(text, buf, xs, runparams, paragraphs, info);
// Then, the content. It starts where the <info> ends.
- bpit = info.epit;
- while (bpit < epit) {
- auto par = paragraphs.iterator_at(bpit);
+ auto par = text.paragraphs().iterator_at(info.epit);
+ auto end = text.paragraphs().iterator_at(epit);
+ while (par != end) {
if (!hasOnlyNotes(*par))
- makeAny(text, buf, xs, runparams, par);
- bpit += 1;
+ par = makeAny(text, buf, xs, runparams, par);
+ else
+ ++par;
}
}
@@ -967,21 +1120,20 @@ void docbookParagraphs(Text const &text,
bool currentlyInAppendix = false;
- while (bpit < epit) {
+ auto par = text.paragraphs().iterator_at(bpit);
+ auto end = text.paragraphs().iterator_at(epit);
+ while (par != end) {
OutputParams ourparams = runparams;
- auto par = paragraphs.iterator_at(bpit);
if (par->params().startOfAppendix())
currentlyInAppendix = true;
- Layout const &style = par->layout();
- ParagraphList::const_iterator const lastStartedPar = par;
- ParagraphList::const_iterator send;
-
if (hasOnlyNotes(*par)) {
- bpit += 1;
+ ++par;
continue;
}
+ Layout const &style = par->layout();
+
// Think about adding <section> and/or </section>s.
const bool isLayoutSectioning = style.category() == from_utf8("Sectioning");
if (isLayoutSectioning) {
@@ -1058,7 +1210,6 @@ void docbookParagraphs(Text const &text,
// Generate this paragraph.
makeAny(text, buf, xs, ourparams, par);
- bpit += 1;
}
// If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning
commit bfc67c59b44415f2dea7ad068a8ac86e2b19f488
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Aug 29 02:43:30 2020 +0200
XML: use the new mechanisms for CR detection with errors.
This helps tracking down line problems even in the presence of errors.
diff --git a/src/xml.cpp b/src/xml.cpp
index b4004af..2f49667 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -167,17 +167,21 @@ bool FontTag::operator==(StartTag const & tag) const
} // namespace xml
-void XMLStream::writeError(std::string const &s) const
+void XMLStream::writeError(std::string const &s)
{
LYXERR0(s);
- os_ << from_utf8("<!-- Output Error: " + s + " -->\n");
+ *this << ESCAPE_NONE << from_utf8("<!-- Output Error: " + s + " -->");
+ *this << xml::CR();
}
-void XMLStream::writeError(docstring const &s) const
+void XMLStream::writeError(docstring const &s)
{
LYXERR0(s);
- os_ << from_utf8("<!-- Output Error: ") << s << from_utf8(" -->\n");
+ *this << ESCAPE_NONE << from_utf8("<!-- Output Error: ");
+ *this << s;
+ *this << ESCAPE_NONE << from_utf8(" -->");
+ *this << xml::CR();
}
diff --git a/src/xml.h b/src/xml.h
index 9a7cf17..45c62ab 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -103,9 +103,13 @@ public:
/// that simplifies the logic using this code.
bool isLastTagCR() const { return is_last_tag_cr_; };
///
- void writeError(std::string const &) const;
+ void writeError(std::string const &);
///
- void writeError(docstring const &) const;
+ void writeError(docstring const &);
+ ///
+ typedef std::shared_ptr<xml::StartTag> TagPtr;
+ /// Returns the last element on the tag stack. XMLStream keeps ownership of the item.
+ TagPtr getLastStackTag();
private:
///
void clearTagDeque();
commit 52b2d3f683250f7405f0efe14c4f1ff9c064bcf5
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Wed Aug 26 21:19:38 2020 +0200
DocBook: make Paragraph::simpleDocBookOnePar return a list of paragraphs.
Before, it directly wrote to the XMLStream, but it made implementation of new lines tricky. Now, it returns the XML for each sub-paragraph (delimited by new lines) as a string, so that the caller can adopt a more precise behaviour (such as in lists).
diff --git a/autotests/export/docbook/lists.lyx b/autotests/export/docbook/lists.lyx
index f903372..f4a58c2 100644
--- a/autotests/export/docbook/lists.lyx
+++ b/autotests/export/docbook/lists.lyx
@@ -103,6 +103,10 @@ I'm the second line
\end_layout
\begin_layout Standard
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Plain Layout
A complex list:
\end_layout
@@ -119,7 +123,7 @@ First first item
First second item
\end_layout
-\begin_layout Standard
+\begin_layout Plain Layout
Text after first item
\end_layout
@@ -137,10 +141,15 @@ Second first item
Second second item
\end_layout
-\begin_layout Standard
+\begin_layout Plain Layout
Text after second item
\end_layout
\end_deeper
+\end_inset
+
+
+\end_layout
+
\end_body
\end_document
diff --git a/autotests/export/docbook/lists.xml b/autotests/export/docbook/lists.xml
index 4621e30..d7b24f6 100644
--- a/autotests/export/docbook/lists.xml
+++ b/autotests/export/docbook/lists.xml
@@ -2,61 +2,15 @@
<!-- 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 simple 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>
+<para>Second item on two lines</para>
+<para>I'm the second line</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>
-<itemizedlist>
-<listitem>
-<para>Second item</para>
-</listitem>
-</itemizedlist>
-<orderedlist><listitem>
-<para>Second first item</para>
-</listitem>
-</orderedlist>
-<orderedlist><listitem>
-<para>Second second item</para>
-</listitem>
-</orderedlist>
-<para>
-Text after second item
-</para>
-
</article>
\ No newline at end of file
diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx
index d6f5f17..357845a 100644
--- a/lib/doc/Customization.lyx
+++ b/lib/doc/Customization.lyx
@@ -27479,6 +27479,8 @@ status collapsed
\change_inserted 1075283030 1597698872
DocBookTagType
+\change_unchanged
+
\end_layout
\end_inset
@@ -27542,6 +27544,8 @@ status collapsed
\change_inserted 1075283030 1597698987
DocBook*TagType
+\change_unchanged
+
\end_layout
\end_inset
@@ -27563,6 +27567,8 @@ status collapsed
\change_inserted 1075283030 1597699012
block
+\change_unchanged
+
\end_layout
\end_inset
@@ -27621,6 +27627,8 @@ status collapsed
\change_inserted 1075283030 1597699113
paragraph
+\change_unchanged
+
\end_layout
\end_inset
@@ -27667,6 +27675,8 @@ status collapsed
\change_inserted 1075283030 1597699307
inline
+\change_unchanged
+
\end_layout
\end_inset
@@ -27702,6 +27712,8 @@ status collapsed
\change_inserted 1075283030 1597699585
block
+\change_unchanged
+
\end_layout
\end_inset
@@ -28415,8 +28427,34 @@ NONE
This parameter only makes sense when itemising layouts are used, such as
lists.
-\change_inserted 1075283030 1597699848
+\change_inserted 1075283030 1598469472
+The most likely value is
+\begin_inset Quotes eld
+\end_inset
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1598469476
+para
+\end_layout
+
+\end_inset
+
+
+\begin_inset Quotes erd
+\end_inset
+
+.
+\begin_inset Newline newline
+\end_inset
+
+When a list item is split using a new line, the item inner tag will be repeated
+ for each part of the paragraph, parts being separated by new lines.
+
\end_layout
\begin_layout Description
@@ -28429,6 +28467,8 @@ status collapsed
\change_inserted 1075283030 1597699853
DocBookItemInnerTagType
+\change_unchanged
+
\end_layout
\end_inset
@@ -28441,6 +28481,8 @@ status collapsed
\change_inserted 1075283030 1597699866
block, paragraph, inline
+\change_unchanged
+
\end_layout
\end_inset
@@ -28594,6 +28636,8 @@ status collapsed
\change_inserted 1075283030 1597699880
DocBookItemLabelTagType
+\change_unchanged
+
\end_layout
\end_inset
@@ -28606,6 +28650,8 @@ status collapsed
\change_inserted 1075283030 1597699874
block, paragraph, inline
+\change_unchanged
+
\end_layout
\end_inset
@@ -28715,6 +28761,8 @@ status collapsed
\change_inserted 1075283030 1597699890
DocBookItemTagType
+\change_unchanged
+
\end_layout
\end_inset
@@ -28727,6 +28775,8 @@ status collapsed
\change_inserted 1075283030 1597699890
block, paragraph, inline
+\change_unchanged
+
\end_layout
\end_inset
@@ -28898,6 +28948,8 @@ status collapsed
\change_inserted 1075283030 1597699900
DocBookItemWrapperTagType
+\change_unchanged
+
\end_layout
\end_inset
@@ -28910,6 +28962,8 @@ status collapsed
\change_inserted 1075283030 1597699897
block, paragraph, inline
+\change_unchanged
+
\end_layout
\end_inset
@@ -29075,6 +29129,8 @@ status collapsed
\change_inserted 1075283030 1597699904
DocBookInnerTagType
+\change_unchanged
+
\end_layout
\end_inset
@@ -29087,6 +29143,8 @@ status collapsed
\change_inserted 1075283030 1597699904
block, paragraph, inline
+\change_unchanged
+
\end_layout
\end_inset
@@ -29238,6 +29296,8 @@ status collapsed
\change_inserted 1075283030 1597699924
DocBookTagType
+\change_unchanged
+
\end_layout
\end_inset
@@ -29250,6 +29310,8 @@ status collapsed
\change_inserted 1075283030 1597699924
block, paragraph, inline
+\change_unchanged
+
\end_layout
\end_inset
@@ -29415,6 +29477,8 @@ status collapsed
\change_inserted 1075283030 1597699932
DocBookWrapperTagType
+\change_unchanged
+
\end_layout
\end_inset
@@ -29427,6 +29491,8 @@ status collapsed
\change_inserted 1075283030 1597699929
block, paragraph, inline
+\change_unchanged
+
\end_layout
\end_inset
@@ -29635,6 +29701,8 @@ status collapsed
\change_inserted 1075283030 1597700120
biblioentry
+\change_unchanged
+
\end_layout
\end_inset
@@ -29660,6 +29728,8 @@ status collapsed
\change_inserted 1075283030 1597700076
bibliomixed
+\change_unchanged
+
\end_layout
\end_inset
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 24947f8..e87ef88 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3329,19 +3329,14 @@ std::tuple<vector<xml::FontTag>, vector<xml::EndFontTag>> computeDocBookFontSwit
} // anonymous namespace
-void Paragraph::simpleDocBookOnePar(Buffer const & buf,
- XMLStream & xs,
- OutputParams const & runparams,
- Font const & outerfont,
- bool start_paragraph, bool close_paragraph,
- pos_type initial) const
+std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
+ OutputParams const & runparams,
+ Font const & outerfont,
+ pos_type initial) const
{
- // track whether we have opened these tags
+ // Track whether we have opened these tags
DocBookFontState fs;
- if (start_paragraph)
- xs.startDivision(allowEmpty());
-
Layout const & style = *d->layout_;
FontInfo font_old =
style.labeltype == LABEL_MANUAL ? style.labelfont : style.font;
@@ -3352,15 +3347,27 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
vector<xml::FontTag> tagsToOpen;
vector<xml::EndFontTag> tagsToClose;
- // parsing main loop
+ std::vector<docstring> generatedParagraphs;
+ odocstringstream os;
+ auto * xs = new XMLStream(os);
+
+ // Parsing main loop.
for (pos_type i = initial; i < size(); ++i) {
- // let's not show deleted material in the output
+ // Don't show deleted material in the output.
if (isDeleted(i))
continue;
- Font const font = getFont(buf.masterBuffer()->params(), i, outerfont);
+ // If this is an InsetNewline, generate a new paragraph.
+ if (getInset(i) != nullptr && getInset(i)->lyxCode() == NEWLINE_CODE) {
+ generatedParagraphs.push_back(os.str());
+ os = odocstringstream();
+ // XMLStream has no copy constructor.
+ delete xs;
+ xs = new XMLStream(os);
+ }
// Determine which tags should be opened or closed.
+ Font const font = getFont(buf.masterBuffer()->params(), i, outerfont);
tie(tagsToOpen, tagsToClose) = computeDocBookFontSwitch(font_old, font, default_family, fs);
// FIXME XHTML
@@ -3369,12 +3376,12 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
vector<xml::EndFontTag>::const_iterator cit = tagsToClose.begin();
vector<xml::EndFontTag>::const_iterator cen = tagsToClose.end();
for (; cit != cen; ++cit)
- xs << *cit;
+ *xs << *cit;
vector<xml::FontTag>::const_iterator sit = tagsToOpen.begin();
vector<xml::FontTag>::const_iterator sen = tagsToOpen.end();
for (; sit != sen; ++sit)
- xs << *sit;
+ *xs << *sit;
tagsToClose.clear();
tagsToOpen.clear();
@@ -3386,11 +3393,11 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
// TODO: special case will bite here.
np.docbook_in_par = true;
- inset->docbook(xs, np);
+ inset->docbook(*xs, np);
}
} else {
char_type c = getUChar(buf.masterBuffer()->params(), runparams, i);
- xs << c;
+ *xs << c;
}
font_old = font.fontInfo();
}
@@ -3398,11 +3405,15 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
// FIXME, this code is just imported from XHTML
// I'm worried about what happens if a branch, say, is itself
// wrapped in some font stuff. I think that will not work.
- xs.closeFontTags();
+ xs->closeFontTags();
if (runparams.docbook_in_listing)
- xs << xml::CR();
- if (close_paragraph)
- xs.endDivision();
+ *xs << xml::CR();
+
+ // Finalise the last (and most likely only) paragraph.
+ generatedParagraphs.push_back(os.str());
+ delete xs;
+
+ return generatedParagraphs;
}
diff --git a/src/Paragraph.h b/src/Paragraph.h
index 58b2762..ee31403 100644
--- a/src/Paragraph.h
+++ b/src/Paragraph.h
@@ -24,6 +24,7 @@
#include "support/types.h"
#include <set>
+#include <vector>
namespace lyx {
@@ -208,14 +209,11 @@ public:
/// Output the first word of a paragraph, return the position where it left.
pos_type firstWordLyXHTML(XMLStream & xs, OutputParams const & runparams) const;
- /// Writes to stream the DocBook representation
- void simpleDocBookOnePar(Buffer const & buf,
- XMLStream &,
- OutputParams const & runparams,
- Font const & outerfont,
- bool start_paragraph = true,
- bool close_paragraph = true,
- pos_type initial = 0) const;
+ /// Outputs to stream the DocBook representation, one element per paragraph.
+ std::vector<docstring> simpleDocBookOnePar(Buffer const & buf,
+ OutputParams const & runparams,
+ Font const & outerfont,
+ pos_type initial = 0) const;
/// \return any material that has had to be deferred until after the
/// paragraph has closed.
diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp
index 8e69e88..1af67e1 100644
--- a/src/insets/InsetERT.cpp
+++ b/src/insets/InsetERT.cpp
@@ -98,23 +98,33 @@ void InsetERT::docbook(XMLStream & xs, OutputParams const & runparams) const
auto par = begin;
auto const end = paragraphs().end();
- odocstringstream os2;
- XMLStream xs2(os2);
+ odocstringstream os; // No need for XML handling here.
// 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)));
+ // New line after each paragraph of the ERT, save the last one.
+ while (true) { // For each paragraph in the ERT...
+ auto pars = par->simpleDocBookOnePar(buffer(), runparams, text().outerFont(distance(begin, par)));
+ auto p = pars.begin();
+ while (true) { // For each line of this ERT paragraph...
+ os << *p;
+ ++p;
+ if (p != pars.end())
+ os << "\n";
+ else
+ break;
+ }
- // New line after each paragraph of the ERT, save the last one.
++par;
if (par != end)
- xs << "\n";
+ os << "\n";
+ else
+ break;
}
// Output the ERT as a comment with the appropriate escaping.
xs << XMLStream::ESCAPE_NONE << "<!-- ";
- xs << XMLStream::ESCAPE_COMMENTS << os2.str();
+ xs << XMLStream::ESCAPE_COMMENTS << os.str();
xs << XMLStream::ESCAPE_NONE << " -->";
xs << xml::CR();
}
diff --git a/src/insets/InsetNewline.cpp b/src/insets/InsetNewline.cpp
index 7cba0f7..b33cf00 100644
--- a/src/insets/InsetNewline.cpp
+++ b/src/insets/InsetNewline.cpp
@@ -174,20 +174,7 @@ int InsetNewline::plaintext(odocstringstream & os,
void InsetNewline::docbook(XMLStream & xs, OutputParams const & runparams) const
{
- if (runparams.docbook_in_par) {
- xs.closeFontTags();
-
- // 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.
+ // New lines are handled by Paragraph::simpleDocBookOnePar.
}
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index ce3f699..0dc5257 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -382,9 +382,11 @@ void makeParagraphBibliography(
}
xs << xml::StartTag(from_utf8("bibliomixed"), attr);
- // Generate the entry.
+ // Generate the entry. Concatenate the different parts of the paragraph if any.
auto const begin = text.paragraphs().begin();
- par->simpleDocBookOnePar(buf, xs, runparams, text.outerFont(std::distance(begin, par)), true, true, 0);
+ auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(std::distance(begin, par)), 0);
+ for (auto & parXML : pars)
+ xs << XMLStream::ESCAPE_NONE << parXML;
// End the precooked bibliography entry.
xs << xml::EndTag("bibliomixed");
@@ -488,21 +490,19 @@ void makeParagraph(
// Determine if this paragraph has some real content. Things like new pages are not caught
// by Paragraph::empty(), even though they do not generate anything useful in DocBook.
// Thus, remove all spaces (including new lines: \r, \n) before checking for emptiness.
- odocstringstream os2;
- XMLStream xs2(os2);
- par->simpleDocBookOnePar(buf, xs2, runparams, text.outerFont(distance(begin, par)), open_par, close_par, 0);
-
- docstring cleaned = os2.str();
- cleaned.erase(std::remove_if(cleaned.begin(), cleaned.end(), ::isspace), cleaned.end());
-
- if (!cleaned.empty()) {
- if (open_par)
- openParTag(xs, &*par, prevpar);
-
- xs << XMLStream::ESCAPE_NONE << os2.str();
-
- if (close_par)
- closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
+ // std::all_of allows doing this check without having to copy the string.
+ // Open and close tags around each contained paragraph.
+ auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0);
+ for (auto & parXML : pars) {
+ if (!std::all_of(parXML.begin(), parXML.end(), ::isspace)) {
+ if (open_par)
+ openParTag(xs, &*par, prevpar);
+
+ xs << XMLStream::ESCAPE_NONE << parXML;
+
+ if (close_par)
+ closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
+ }
}
}
@@ -529,10 +529,8 @@ void makeEnvironment(
style.latextype == LATEX_LIST_ENVIRONMENT ||
style.latextype == LATEX_ITEM_ENVIRONMENT) {
// Open a wrapper tag if needed.
- if (style.docbookitemwrappertag() != "NONE") {
- xs << xml::StartTag(style.docbookitemwrappertag(), style.docbookitemwrapperattr());
- xs << xml::CR();
- }
+ 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.
@@ -580,9 +578,18 @@ void makeEnvironment(
// TODO: this always worked only by magic...
xs << ' ';
} else {
- // Generate the rest of the paragraph, if need be.
- par->simpleDocBookOnePar(buf, xs, runparams, text.outerFont(std::distance(text.paragraphs().begin(), par)),
- true, true, sep);
+ // 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);
+ auto p = pars.begin();
+ while (true) {
+ xs << XMLStream::ESCAPE_NONE << *p;
+ ++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;
+ }
}
} else {
makeAny(text, buf, xs, runparams, par);
@@ -612,8 +619,10 @@ void makeCommand(
auto prevpar = text.paragraphs().getParagraphBefore(par);
openParTag(xs, &*par, prevpar);
- par->simpleDocBookOnePar(buf, xs, runparams,
- text.outerFont(distance(begin, par)));
+ auto pars = par->simpleDocBookOnePar(buf, runparams,text.outerFont(distance(begin, par)));
+ for (auto & parXML : pars)
+ // TODO: decide what to do with openParTag/closeParTag in new lines.
+ xs << XMLStream::ESCAPE_NONE << parXML;
closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
}
diff --git a/src/xml.h b/src/xml.h
index 69d582d..9a7cf17 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -132,8 +132,6 @@ private:
TagDeque tag_stack_;
///
bool is_last_tag_cr_;
-public:
- bool pending_tags_empty() { return pending_tags_.empty();};
};
namespace xml {
commit faaf780bed0e48eff34390c7c0bdb98e0f41b244
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Tue Aug 25 02:41:07 2020 +0200
DocBook: fix compilation issues.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 4e6c30e..ce3f699 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -30,8 +30,6 @@
#include "support/lassert.h"
-#include "support/regex.h"
-
#include <stack>
#include <iostream>
#include <algorithm>
@@ -166,18 +164,6 @@ string fontToAttribute(xml::FontTypes type) {
}
-xml::FontTag docbookStartFontTag(xml::FontTypes type)
-{
- return xml::FontTag(from_utf8(fontToDocBookTag(type)), from_utf8(fontToAttribute(type)), type);
-}
-
-
-xml::EndFontTag docbookEndFontTag(xml::FontTypes type)
-{
- return xml::EndFontTag(from_utf8(fontToDocBookTag(type)), type);
-}
-
-
// Convenience functions to open and close tags. First, very low-level ones to ensure a consistent new-line behaviour.
// Block style:
// Content before
@@ -501,13 +487,13 @@ void makeParagraph(
// Determine if this paragraph has some real content. Things like new pages are not caught
// by Paragraph::empty(), even though they do not generate anything useful in DocBook.
+ // Thus, remove all spaces (including new lines: \r, \n) before checking for emptiness.
odocstringstream os2;
XMLStream xs2(os2);
par->simpleDocBookOnePar(buf, xs2, runparams, text.outerFont(distance(begin, par)), open_par, close_par, 0);
docstring cleaned = os2.str();
- static const lyx::regex reg("[ \\r\\n]*");
- cleaned = from_utf8(lyx::regex_replace(to_utf8(cleaned), reg, string("")));
+ cleaned.erase(std::remove_if(cleaned.begin(), cleaned.end(), ::isspace), cleaned.end());
if (!cleaned.empty()) {
if (open_par)
@@ -658,8 +644,6 @@ void makeAny(
}
}
-} // end anonymous namespace
-
using DocBookDocumentSectioning = tuple<bool, pit_type>;
@@ -796,6 +780,20 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type b
return DocBookInfoTag(shouldBeInInfo, mustBeInInfo, abstract, bpit, cpit);
}
+} // end anonymous namespace
+
+
+xml::FontTag docbookStartFontTag(xml::FontTypes type)
+{
+ return xml::FontTag(from_utf8(fontToDocBookTag(type)), from_utf8(fontToAttribute(type)), type);
+}
+
+
+xml::EndFontTag docbookEndFontTag(xml::FontTypes type)
+{
+ return xml::EndFontTag(from_utf8(fontToDocBookTag(type)), type);
+}
+
void outputDocBookInfo(
Text const & text,
@@ -829,11 +827,11 @@ void outputDocBookInfo(
// Actually output the abstract if there is something to do. Don't count line feeds or spaces in this,
// even though they must be properly output if there is some abstract.
abstract = os2.str();
- static const lyx::regex reg("[ \\r\\n]*");
- docstring abstractContent = from_utf8(lyx::regex_replace(to_utf8(abstract), reg, string("")));
+ docstring cleaned = abstract;
+ cleaned.erase(std::remove_if(cleaned.begin(), cleaned.end(), ::isspace), cleaned.end());
// Nothing? Then there is no abstract!
- if (abstractContent.empty())
+ if (cleaned.empty())
hasAbstract = false;
}
commit 3d348818e083ceb531d916be01ef2db99392f9c3
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Tue Aug 25 02:11:08 2020 +0200
DocBook: Coverity potential problem for precooked bibliographies.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 3f6a692..4e6c30e 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -386,9 +386,10 @@ void makeParagraphBibliography(
// Don't forget the citation ID!
docstring attr;
for (auto i = 0; i < par->size(); ++i) {
- Inset const *ip = par->getInset(0);
- if (ip != nullptr && ip->lyxCode() == BIBITEM_CODE) {
- const auto * bibitem = dynamic_cast<const InsetBibitem*>(par->getInset(i));
+ Inset const *ip = par->getInset(i);
+ if (!ip)
+ continue;
+ if (const auto * bibitem = dynamic_cast<const InsetBibitem*>(ip)) {
attr = from_utf8("xml:id='") + bibitem->getParam("key") + from_utf8("'");
break;
}
commit ac46456b288c35a05f716a9e3bbf022f60b2cd9f
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Tue Aug 18 05:46:40 2020 +0200
DocBook: simplify precooked bibliography code.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 0481890..3f6a692 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -360,63 +360,59 @@ void closeItemTag(XMLStream & xs, Layout const & lay)
}
+void makeAny(
+ Text const &,
+ Buffer const &,
+ XMLStream &,
+ OutputParams const &,
+ ParagraphList::const_iterator);
+
+
void makeParagraphBibliography(
Buffer const & buf,
XMLStream & xs,
OutputParams const & runparams,
Text const & text,
- ParagraphList::const_iterator const & pbegin)
+ ParagraphList::const_iterator const & par)
{
- auto const begin = text.paragraphs().begin();
- auto const end = text.paragraphs().end();
- auto pend = pbegin;
- ++pend;
-
- // Find the paragraph *before* pbegin.
- ParagraphList::const_iterator pbegin_before = begin;
- if (pbegin != begin) {
- ParagraphList::const_iterator pbegin_before_next = begin;
- ++pbegin_before_next;
-
- while (pbegin_before_next != pbegin) {
- ++pbegin_before;
- ++pbegin_before_next;
- }
- }
-
- ParagraphList::const_iterator par = pbegin;
-
// If this is the first paragraph in a bibliography, open the bibliography tag.
- if (pbegin != begin && pbegin_before->layout().latextype != LATEX_BIB_ENVIRONMENT) {
+ auto pbegin_before = text.paragraphs().getParagraphBefore(par);
+ if (pbegin_before->layout().latextype != LATEX_BIB_ENVIRONMENT) {
xs << xml::StartTag("bibliography");
xs << xml::CR();
}
- // Generate the required paragraphs, but only if they are .
- for (; par != pend; ++par) {
- // Start the precooked bibliography entry. This is very much like opening a paragraph tag.
- // Don't forget the citation ID!
- docstring attr;
- for (auto i = 0; i < par->size(); ++i) {
- Inset const *ip = par->getInset(0);
- if (ip != nullptr && ip->lyxCode() == BIBITEM_CODE) {
- const auto * bibitem = dynamic_cast<const InsetBibitem*>(par->getInset(i));
- attr = from_utf8("xml:id='") + bibitem->getParam("key") + from_utf8("'");
- break;
- }
+ // Start the precooked bibliography entry. This is very much like opening a paragraph tag.
+ // Don't forget the citation ID!
+ docstring attr;
+ for (auto i = 0; i < par->size(); ++i) {
+ Inset const *ip = par->getInset(0);
+ if (ip != nullptr && ip->lyxCode() == BIBITEM_CODE) {
+ const auto * bibitem = dynamic_cast<const InsetBibitem*>(par->getInset(i));
+ attr = from_utf8("xml:id='") + bibitem->getParam("key") + from_utf8("'");
+ break;
}
- xs << xml::StartTag(from_utf8("bibliomixed"), attr);
+ }
+ xs << xml::StartTag(from_utf8("bibliomixed"), attr);
- // Generate the entry.
- par->simpleDocBookOnePar(buf, xs, runparams, text.outerFont(distance(begin, par)), true, true, 0);
+ // Generate the entry.
+ auto const begin = text.paragraphs().begin();
+ par->simpleDocBookOnePar(buf, xs, runparams, text.outerFont(std::distance(begin, par)), true, true, 0);
- // End the precooked bibliography entry.
- xs << xml::EndTag("bibliomixed");
- xs << xml::CR();
- }
+ // End the precooked bibliography entry.
+ xs << xml::EndTag("bibliomixed");
+ xs << xml::CR();
// If this is the last paragraph in a bibliography, close the bibliography tag.
- if (par == end || par->layout().latextype != LATEX_BIB_ENVIRONMENT) {
+ auto const end = text.paragraphs().end();
+ bool endBibliography = par == end;
+ if (!endBibliography) {
+ auto nextpar = par;
+ ++nextpar;
+ endBibliography = par->layout().latextype != LATEX_BIB_ENVIRONMENT;
+ }
+
+ if (endBibliography) {
xs << xml::EndTag("bibliography");
xs << xml::CR();
}
@@ -524,14 +520,6 @@ void makeParagraph(
}
-void makeAny(
- Text const &text,
- Buffer const &buf,
- XMLStream &xs,
- OutputParams const &ourparams,
- ParagraphList::const_iterator par);
-
-
void makeEnvironment(
Buffer const &buf,
XMLStream &xs,
commit 6a4d3dbef779c0be9a7e69f1801b2bfb4dcb86c8
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Tue Aug 18 05:40:34 2020 +0200
DocBook: remove useless includes.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 12601c5..0481890 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -16,8 +16,6 @@
#include "BufferParams.h"
#include "Font.h"
#include "InsetList.h"
-#include "Layout.h"
-#include "OutputParams.h"
#include "Paragraph.h"
#include "ParagraphList.h"
#include "ParagraphParameters.h"
@@ -30,11 +28,7 @@
#include "insets/InsetLabel.h"
#include "insets/InsetNote.h"
-#include "support/convert.h"
-#include "support/debug.h"
#include "support/lassert.h"
-#include "support/lstrings.h"
-#include "support/textutils.h"
#include "support/regex.h"
@@ -159,6 +153,7 @@ string fontToRole(xml::FontTypes type)
}
}
+
string fontToAttribute(xml::FontTypes type) {
// If there is a role (i.e. nonstandard use of a tag), output the attribute. Otherwise, the sheer tag is sufficient
// for the font.
commit d8651cc60b0e95b262baa189196817f4de26d360
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Tue Aug 18 05:39:46 2020 +0200
More functions in anonymous namespace.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index ad683c7..12601c5 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -170,8 +170,6 @@ string fontToAttribute(xml::FontTypes type) {
}
}
-} // end anonymous namespace
-
xml::FontTag docbookStartFontTag(xml::FontTypes type)
{
@@ -185,8 +183,6 @@ xml::EndFontTag docbookEndFontTag(xml::FontTypes type)
}
-namespace {
-
// Convenience functions to open and close tags. First, very low-level ones to ensure a consistent new-line behaviour.
// Block style:
// Content before
commit 25f72d392c60e93f5adb2412d5885a758fa2511a
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Tue Aug 18 05:37:46 2020 +0200
DocBook: fine tuning of new lines.
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 82fd089..2ef5768 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -2140,8 +2140,6 @@ Buffer::ExportStatus Buffer::writeDocBookSource(odocstream & os,
bool const output_body =
output == FullSource || output == OnlyBody;
- XMLStream xs(os);
-
if (output_preamble) {
// XML preamble, no doctype needed.
// Not using XMLStream for this, as the root tag would be in the tag stack and make troubles with the error
@@ -2164,16 +2162,17 @@ Buffer::ExportStatus Buffer::writeDocBookSource(odocstream & os,
}
if (output_body) {
- params().documentClass().counters().reset();
-
// Start to output the document.
+ XMLStream xs(os);
docbookParagraphs(text(), *this, xs, runparams);
}
if (output_preamble) {
- // Close the root element.
- os << "\n</" << from_ascii(tclass.docbookroot()) << ">";
+ // Close the root element. No need for a line break, as free text is never allowed
+ // in a root element, it must always be wrapped in some container.
+ os << "</" << from_ascii(tclass.docbookroot()) << ">";
}
+
return ExportSuccess;
}
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index b7b5941..ad683c7 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -239,7 +239,8 @@ void openBlockTag(XMLStream & xs, const std::string & tag, const std::string & a
void closeBlockTag(XMLStream & xs, const std::string & tag)
{
- xs << xml::CR();
+ if (!xs.isLastTagCR())
+ xs << xml::CR();
xs << xml::EndTag(tag);
xs << xml::CR();
}
commit bdea21a87e7b54747ced9f913659e0e2fe6590c6
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Tue Aug 18 04:56:25 2020 +0200
DocBook: improve comments.
diff --git a/src/xml.h b/src/xml.h
index 0948143..69d582d 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -39,7 +39,7 @@ struct CR;
class XMLStream {
public:
///
- explicit XMLStream(odocstream & os): os_(os), escape_(ESCAPE_ALL), is_last_tag_cr_(false) {}
+ explicit XMLStream(odocstream & os): os_(os), escape_(ESCAPE_ALL), is_last_tag_cr_(true) {}
///
odocstream & os() { return os_; }
///
@@ -82,7 +82,7 @@ public:
enum EscapeSettings {
ESCAPE_NONE,
ESCAPE_AND, // meaning &
- ESCAPE_ALL, // meaning <, >, &, at present
+ ESCAPE_ALL, // meaning <, >, &, at present, except things that are forbidden in comments
ESCAPE_COMMENTS // Anything that is forbidden within comments
};
/// Sets what we are going to escape on the NEXT write.
@@ -98,7 +98,9 @@ public:
bool isTagOpen(xml::EndTag const &, int maxdepth = -1) const;
///
bool isTagPending(xml::StartTag const &, int maxdepth = -1) const;
- ///
+ /// Is the last tag that was added to the stream a new line (CR)? This is mostly to known
+ /// whether a new line must be added. Therefore, consider that an empty stream just had a CR,
+ /// that simplifies the logic using this code.
bool isLastTagCR() const { return is_last_tag_cr_; };
///
void writeError(std::string const &) const;
commit 9393ca74ba93b70c2aa610e6c3c2b6aff651eb42
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Tue Aug 18 00:37:34 2020 +0200
DocBook: new logic to handle the new lines, only used in output_docbook for now.
diff --git a/lib/layouts/stdlayouts.inc b/lib/layouts/stdlayouts.inc
index 1670695..e550518 100644
--- a/lib/layouts/stdlayouts.inc
+++ b/lib/layouts/stdlayouts.inc
@@ -7,7 +7,7 @@
# quotations and such.
-Format 82
+Format 84
Style Quotation
Category MainText
diff --git a/lib/layouts/stdlists.inc b/lib/layouts/stdlists.inc
index 16a9e81..c0b346d 100644
--- a/lib/layouts/stdlists.inc
+++ b/lib/layouts/stdlists.inc
@@ -6,7 +6,7 @@
# This include files contains various standard environments for lists.
-Format 82
+Format 84
Input stdlyxlist.inc
diff --git a/lib/layouts/stdstruct.inc b/lib/layouts/stdstruct.inc
index c8b7eb4..2a81117 100644
--- a/lib/layouts/stdstruct.inc
+++ b/lib/layouts/stdstruct.inc
@@ -8,7 +8,7 @@
# a document, like abstract, bibliography and such.
-Format 82
+Format 84
Style Abstract
Margin Static
diff --git a/lib/layouts/stdtitle.inc b/lib/layouts/stdtitle.inc
index ad989a6..44b1b8e 100644
--- a/lib/layouts/stdtitle.inc
+++ b/lib/layouts/stdtitle.inc
@@ -8,7 +8,7 @@
# a document, like title, author and such.
-Format 82
+Format 84
Style Title
Margin Static
@@ -29,6 +29,7 @@ Style Title
HTMLTag h1
HTMLTitle true
DocBookTag title
+ DocBookTagType paragraph
DocBookInInfo maybe
End
@@ -50,7 +51,9 @@ Style Author
Size Large
EndFont
DocBookTag personname
+ DocBookTagType paragraph
DocBookWrapperTag author
+ DocBookWrapperTagType inline
DocBookInInfo always
End
@@ -72,5 +75,6 @@ Style Date
Size Large
EndFont
DocBookTag date
+ DocBookTagType paragraph
DocBookInInfo always
End
diff --git a/src/insets/InsetNewline.cpp b/src/insets/InsetNewline.cpp
index 00b276e..7cba0f7 100644
--- a/src/insets/InsetNewline.cpp
+++ b/src/insets/InsetNewline.cpp
@@ -181,7 +181,7 @@ void InsetNewline::docbook(XMLStream & xs, OutputParams const & runparams) const
// 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");
+ xs << XMLStream::ESCAPE_NONE << from_utf8("</para>\n<para>");
// TODO: that's a hack...
// xs << xml::EndTag("para");
// xs << xml::CR();
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index b29da56..b7b5941 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -43,8 +43,6 @@
#include <algorithm>
#include <sstream>
-// #define DOCBOOK_DEBUG_NEWLINES
-
using namespace std;
using namespace lyx::support;
@@ -189,14 +187,100 @@ xml::EndFontTag docbookEndFontTag(xml::FontTypes type)
namespace {
-// convenience functions
+// Convenience functions to open and close tags. First, very low-level ones to ensure a consistent new-line behaviour.
+// Block style:
+// Content before
+// <blocktag>
+// Contents of the block.
+// </blocktag>
+// Content after
+// Paragraph style:
+// Content before
+// <paratag>Contents of the paragraph.</paratag>
+// Content after
+// Inline style:
+// Content before<inlinetag>Contents of the paragraph.</inlinetag>Content after
+
+void openInlineTag(XMLStream & xs, const std::string & tag, const std::string & attr)
+{
+ xs << xml::StartTag(tag, attr);
+}
+
-void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
+void closeInlineTag(XMLStream & xs, const std::string & tag)
+{
+ xs << xml::EndTag(tag);
+}
+
+
+void openParTag(XMLStream & xs, const std::string & tag, const std::string & attr)
+{
+ if (!xs.isLastTagCR())
+ xs << xml::CR();
+ xs << xml::StartTag(tag, attr);
+}
+
+
+void closeParTag(XMLStream & xs, const std::string & tag)
+{
+ xs << xml::EndTag(tag);
+ xs << xml::CR();
+}
+
+
+void openBlockTag(XMLStream & xs, const std::string & tag, const std::string & attr)
+{
+ if (!xs.isLastTagCR())
+ xs << xml::CR();
+ xs << xml::StartTag(tag, attr);
+ xs << xml::CR();
+}
+
+
+void closeBlockTag(XMLStream & xs, const std::string & tag)
+{
+ xs << xml::CR();
+ xs << xml::EndTag(tag);
+ xs << xml::CR();
+}
+
+
+void openTag(XMLStream & xs, const std::string & tag, const std::string & attr, const std::string & tagtype)
+{
+ if (tag.empty() || tag == "NONE")
+ return;
+
+ if (tag == "para" || tagtype == "paragraph") // Special case for <para>: always considered as a paragraph.
+ openParTag(xs, tag, attr);
+ else if (tagtype == "block")
+ openBlockTag(xs, tag, attr);
+ else if (tagtype == "inline")
+ openInlineTag(xs, tag, attr);
+ else
+ xs.writeError("Unrecognised tag type '" + tagtype + "' for '" + tag + " " + attr + "'");
+}
+
+
+void closeTag(XMLStream & xs, const std::string & tag, const std::string & tagtype)
{
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- openParTag -->";
-#endif
+ if (tag.empty() || tag == "NONE")
+ return;
+ if (tag == "para" || tagtype == "paragraph") // Special case for <para>: always considered as a paragraph.
+ closeParTag(xs, tag);
+ else if (tagtype == "block")
+ closeBlockTag(xs, tag);
+ else if (tagtype == "inline")
+ closeInlineTag(xs, tag);
+ else
+ xs.writeError("Unrecognised tag type '" + tagtype + "' for '" + tag + "'");
+}
+
+
+// Higher-level convenience functions.
+
+void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
+{
Layout const & lay = par->layout();
if (par == prevpar)
@@ -218,38 +302,25 @@ void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar
}
// Main logic.
- if (openWrapper) {
- xs << xml::StartTag(lay.docbookwrappertag(), lay.docbookwrapperattr());
- xs << xml::CR();
- }
+ if (openWrapper)
+ openTag(xs, lay.docbookwrappertag(), lay.docbookwrapperattr(), lay.docbookwrappertagtype());
- string tag = lay.docbooktag();
+ const string & tag = lay.docbooktag();
if (tag != "NONE") {
auto xmltag = xml::ParTag(tag, lay.docbookattr());
- if (!xs.isTagOpen(xmltag, 1)) // Don't nest a paragraph directly in a paragraph. TODO: required or not?
- xs << xmltag;
- }
-
- if (lay.docbookitemtag() != "NONE") {
- xs << xml::StartTag(lay.docbookitemtag(), lay.docbookitemattr());
- xs << xml::CR();
+ if (!xs.isTagOpen(xmltag, 1)) // Don't nest a paragraph directly in a paragraph.
+ // TODO: required or not?
+ // TODO: avoid creating a ParTag object just for this query...
+ openTag(xs, lay.docbooktag(), lay.docbookattr(), lay.docbooktagtype());
}
- if (lay.docbookiteminnertag() != "NONE")
- xs << xml::StartTag(lay.docbookiteminnertag(), lay.docbookiteminnerattr());
-
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- /openParTag -->";
-#endif
+ openTag(xs, lay.docbookitemtag(), lay.docbookitemattr(), lay.docbookitemtagtype());
+ openTag(xs, lay.docbookiteminnertag(), lay.docbookiteminnerattr(), lay.docbookiteminnertagtype());
}
void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpar)
{
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- closeParTag -->";
-#endif
-
if (par == nextpar)
nextpar = nullptr;
@@ -265,119 +336,35 @@ void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpa
}
// Main logic.
- if (lay.docbookiteminnertag() != "NONE") {
- xs << xml::EndTag(lay.docbookiteminnertag());
- xs << xml::CR();
- }
-
- if (lay.docbookitemtag() != "NONE") {
- xs << xml::EndTag(lay.docbookitemtag());
- xs << xml::CR();
- }
-
- if (lay.docbooktag() != "NONE") {
- xs << xml::EndTag(lay.docbooktag());
- xs << xml::CR();
- }
-
- if (closeWrapper) {
- xs << xml::EndTag(lay.docbookwrappertag());
- xs << xml::CR();
- }
-
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- /closeParTag -->";
-#endif
-}
-
-
-void openBlockTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
-{
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- openBlockTag -->";
-#endif
-
- // Similar as openParTag, but with a line feed after.
- openParTag(xs, par, prevpar);
- xs << xml::CR();
-
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- /openBlockTag -->";
-#endif
-}
-
-
-void closeBlockTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
-{
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- closeBlockTag -->";
-#endif
-
- // Similar as closeParTag, but with a line feed before.
- xs << xml::CR();
- closeParTag(xs, par, prevpar);
-
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- /closeBlockTag -->";
-#endif
+ closeTag(xs, lay.docbookiteminnertag(), lay.docbookiteminnertagtype());
+ closeTag(xs, lay.docbookitemtag(), lay.docbookitemtagtype());
+ closeTag(xs, lay.docbooktag(), lay.docbooktagtype());
+ if (closeWrapper)
+ closeTag(xs, lay.docbookwrappertag(), lay.docbookwrappertagtype());
}
void openLabelTag(XMLStream & xs, Layout const & lay) // Mostly for definition lists.
{
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- openLabelTag -->";
-#endif
-
- xs << xml::StartTag(lay.docbookitemlabeltag(), lay.docbookitemlabelattr());
-
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- /openLabelTag -->";
-#endif
+ openTag(xs, lay.docbookitemlabeltag(), lay.docbookitemlabelattr(), lay.docbookitemlabeltagtype());
}
void closeLabelTag(XMLStream & xs, Layout const & lay)
{
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- closeLabelTag -->";
-#endif
-
- xs << xml::EndTag(lay.docbookitemlabeltag());
- xs << xml::CR();
-
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- closeLabelTag -->";
-#endif
+ closeTag(xs, lay.docbookitemlabeltag(), lay.docbookitemlabeltagtype());
}
void openItemTag(XMLStream & xs, Layout const & lay)
{
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- openItemTag -->";
-#endif
-
- xs << xml::StartTag(lay.docbookitemtag(), lay.docbookitemattr());
-
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- /openItemTag -->";
-#endif
+ openTag(xs, lay.docbookitemtag(), lay.docbookitemattr(), lay.docbookitemtagtype());
}
void closeItemTag(XMLStream & xs, Layout const & lay)
{
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- closeItemTag -->";
-#endif
-
- xs << xml::EndTag(lay.docbookitemtag());
- xs << xml::CR();
-
-#ifdef DOCBOOK_DEBUG_NEWLINES
- xs << XMLStream::ESCAPE_NONE << "<!-- /closeItemTag -->";
-#endif
+ closeTag(xs, lay.docbookitemtag(), lay.docbookitemtagtype());
}
diff --git a/src/xml.h b/src/xml.h
index 581cca5..0948143 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -100,13 +100,13 @@ public:
bool isTagPending(xml::StartTag const &, int maxdepth = -1) const;
///
bool isLastTagCR() const { return is_last_tag_cr_; };
-private:
- ///
- void clearTagDeque();
///
void writeError(std::string const &) const;
///
void writeError(docstring const &) const;
+private:
+ ///
+ void clearTagDeque();
///
odocstream & os_;
///
commit 27a44f8e4854807448e827fc473995477ac037e6
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Mon Aug 17 23:44:02 2020 +0200
XML: memorise if the last thing that is getting output is a line feed.
diff --git a/src/xml.cpp b/src/xml.cpp
index 147eadd..b4004af 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -290,6 +290,7 @@ void XMLStream::clearTagDeque()
XMLStream &XMLStream::operator<<(docstring const &d)
{
+ is_last_tag_cr_ = false;
clearTagDeque();
os_ << xml::escapeString(d, escape_);
escape_ = ESCAPE_ALL;
@@ -299,6 +300,7 @@ XMLStream &XMLStream::operator<<(docstring const &d)
XMLStream &XMLStream::operator<<(const char *s)
{
+ is_last_tag_cr_ = false;
clearTagDeque();
docstring const d = from_ascii(s);
os_ << xml::escapeString(d, escape_);
@@ -309,6 +311,7 @@ XMLStream &XMLStream::operator<<(const char *s)
XMLStream &XMLStream::operator<<(char_type c)
{
+ is_last_tag_cr_ = false;
clearTagDeque();
os_ << xml::escapeChar(c, escape_);
escape_ = ESCAPE_ALL;
@@ -318,6 +321,7 @@ XMLStream &XMLStream::operator<<(char_type c)
XMLStream &XMLStream::operator<<(char c)
{
+ is_last_tag_cr_ = false;
clearTagDeque();
os_ << xml::escapeChar(c, escape_);
escape_ = ESCAPE_ALL;
@@ -327,6 +331,7 @@ XMLStream &XMLStream::operator<<(char c)
XMLStream &XMLStream::operator<<(int i)
{
+ is_last_tag_cr_ = false;
clearTagDeque();
os_ << i;
escape_ = ESCAPE_ALL;
@@ -336,6 +341,7 @@ XMLStream &XMLStream::operator<<(int i)
XMLStream &XMLStream::operator<<(EscapeSettings e)
{
+ // Don't update is_last_tag_cr_ here, as this does not output anything.
escape_ = e;
return *this;
}
@@ -343,6 +349,7 @@ XMLStream &XMLStream::operator<<(EscapeSettings e)
XMLStream &XMLStream::operator<<(xml::StartTag const &tag)
{
+ is_last_tag_cr_ = false;
if (tag.tag_.empty())
return *this;
pending_tags_.push_back(makeTagPtr(tag));
@@ -354,6 +361,7 @@ XMLStream &XMLStream::operator<<(xml::StartTag const &tag)
XMLStream &XMLStream::operator<<(xml::ParTag const &tag)
{
+ is_last_tag_cr_ = false;
if (tag.tag_.empty())
return *this;
pending_tags_.push_back(makeTagPtr(tag));
@@ -363,6 +371,7 @@ XMLStream &XMLStream::operator<<(xml::ParTag const &tag)
XMLStream &XMLStream::operator<<(xml::CompTag const &tag)
{
+ is_last_tag_cr_ = false;
if (tag.tag_.empty())
return *this;
clearTagDeque();
@@ -373,6 +382,7 @@ XMLStream &XMLStream::operator<<(xml::CompTag const &tag)
XMLStream &XMLStream::operator<<(xml::FontTag const &tag)
{
+ is_last_tag_cr_ = false;
if (tag.tag_.empty())
return *this;
pending_tags_.push_back(makeTagPtr(tag));
@@ -382,6 +392,7 @@ XMLStream &XMLStream::operator<<(xml::FontTag const &tag)
XMLStream &XMLStream::operator<<(xml::CR const &)
{
+ is_last_tag_cr_ = true;
clearTagDeque();
os_ << from_ascii("\n");
return *this;
@@ -434,6 +445,8 @@ bool XMLStream::isTagPending(xml::StartTag const &stag, int maxdepth) const
// best to make things work.
XMLStream &XMLStream::operator<<(xml::EndTag const &etag)
{
+ is_last_tag_cr_ = false;
+
if (etag.tag_.empty())
return *this;
diff --git a/src/xml.h b/src/xml.h
index b585a48..581cca5 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -39,7 +39,7 @@ struct CR;
class XMLStream {
public:
///
- explicit XMLStream(odocstream & os): os_(os), escape_(ESCAPE_ALL) {}
+ explicit XMLStream(odocstream & os): os_(os), escape_(ESCAPE_ALL), is_last_tag_cr_(false) {}
///
odocstream & os() { return os_; }
///
@@ -98,6 +98,8 @@ public:
bool isTagOpen(xml::EndTag const &, int maxdepth = -1) const;
///
bool isTagPending(xml::StartTag const &, int maxdepth = -1) const;
+ ///
+ bool isLastTagCR() const { return is_last_tag_cr_; };
private:
///
void clearTagDeque();
@@ -126,6 +128,8 @@ private:
TagDeque pending_tags_;
///
TagDeque tag_stack_;
+ ///
+ bool is_last_tag_cr_;
public:
bool pending_tags_empty() { return pending_tags_.empty();};
};
commit 360139a0911415a9ce31137aedef760714f6e189
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Mon Aug 17 23:35:40 2020 +0200
DocBook: documentation for the new tags.
diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx
index 541e562..d6f5f17 100644
--- a/lib/doc/Customization.lyx
+++ b/lib/doc/Customization.lyx
@@ -27208,13 +27208,24 @@ Labels are rarely output, as they are redundant in DocBook: this information
\begin_layout Subsection
-\change_inserted -970929547 1496610966
+\change_inserted 1075283030 1597699417
+\begin_inset CommandInset label
+LatexCommand label
+name "subsec:Paragraph-Style-DocBook"
+
+\end_inset
+
+
+\change_deleted 1075283030 1597699417
+
\begin_inset CommandInset label
LatexCommand label
name "subsec:Paragraph-Style-XHTML-1"
\end_inset
+
+\change_inserted -970929547 1496610966
Paragraph styles
\end_layout
@@ -27454,6 +27465,252 @@ tag
in the example above.
The default is the name of the float and always needs to be changed, as
DocBook provides no generic tag.
+\change_inserted 1075283030 1597698868
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted 1075283030 1597699399
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597698872
+DocBookTagType
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597700585
+block, paragraph, inline
+\change_unchanged
+
+\end_layout
+
+\end_inset
+
+] The new-line policy for this tag, see Section
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "subsec:DocBook-New-line-policy"
+plural "false"
+caps "false"
+noprefix "false"
+
+\end_inset
+
+ for the details.
+
+\change_unchanged
+
+\end_layout
+
+\begin_layout Subsection
+
+\change_inserted 1075283030 1597699385
+New-line policy
+\begin_inset CommandInset label
+LatexCommand label
+name "subsec:DocBook-New-line-policy"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted 1075283030 1597698993
+For all tags, there are three possible policies for outputting new lines
+ (given in the
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597698987
+DocBook*TagType
+\end_layout
+
+\end_inset
+
+ attribute):
+\end_layout
+
+\begin_layout Itemize
+
+\change_inserted 1075283030 1597699279
+\begin_inset Quotes eld
+\end_inset
+
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699012
+block
+\end_layout
+
+\end_inset
+
+
+\begin_inset Quotes erd
+\end_inset
+
+: the opening and closing tags are on their own lines (i.e.
+ a line feed after and before the opening and the closing tags).
+ Typical elements are floats.
+ For instance:
+\end_layout
+
+\begin_layout LyX-Code
+
+\change_inserted 1075283030 1597699194
+Content before
+\end_layout
+
+\begin_layout LyX-Code
+
+\change_inserted 1075283030 1597699194
+<blocktag>
+\end_layout
+
+\begin_layout LyX-Code
+
+\change_inserted 1075283030 1597699098
+ Contents of the block.
+\end_layout
+
+\begin_layout LyX-Code
+
+\change_inserted 1075283030 1597699196
+</blocktag>
+\end_layout
+
+\begin_layout LyX-Code
+
+\change_inserted 1075283030 1597699198
+Content after
+\end_layout
+
+\begin_layout Itemize
+
+\change_inserted 1075283030 1597699289
+\begin_inset Quotes eld
+\end_inset
+
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699113
+paragraph
+\end_layout
+
+\end_inset
+
+
+\begin_inset Quotes erd
+\end_inset
+
+: the opening and closing tags are on the same, new line; a line feed is
+ output before the opening tag and after the closing tag.
+ Typical elements are paragraphs and list items.
+ For instance:
+\end_layout
+
+\begin_layout LyX-Code
+
+\change_inserted 1075283030 1597699186
+Content before
+\end_layout
+
+\begin_layout LyX-Code
+
+\change_inserted 1075283030 1597699357
+<paratag>Contents of the paragraph.</paratag>
+\end_layout
+
+\begin_layout LyX-Code
+
+\change_inserted 1075283030 1597699231
+Content after
+\end_layout
+
+\begin_layout Itemize
+
+\change_inserted 1075283030 1597699343
+\begin_inset Quotes eld
+\end_inset
+
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699307
+inline
+\end_layout
+
+\end_inset
+
+
+\begin_inset Quotes erd
+\end_inset
+
+: the opening and closing tags are on the same line as the rest of the content.
+ No line feeds are output.
+ Typical elements are fonts.
+ For instance:
+\end_layout
+
+\begin_layout LyX-Code
+
+\change_inserted 1075283030 1597699585
+Content before<inlinetag>Contents of the paragraph.</inlinetag>Content after
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted 1075283030 1597699585
+The default value is always
+\begin_inset Quotes eld
+\end_inset
+
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699585
+block
+\end_layout
+
+\end_inset
+
+
+\begin_inset Quotes erd
+\end_inset
+
+.
\change_unchanged
\end_layout
@@ -28158,6 +28415,52 @@ NONE
This parameter only makes sense when itemising layouts are used, such as
lists.
+\change_inserted 1075283030 1597699848
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted 1075283030 1597699866
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699853
+DocBookItemInnerTagType
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699866
+block, paragraph, inline
+\end_layout
+
+\end_inset
+
+] The new-line policy for this tag, see Section
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "subsec:DocBook-New-line-policy"
+plural "false"
+caps "false"
+noprefix "false"
+
+\end_inset
+
+ for the details.
+
\change_unchanged
\end_layout
@@ -28277,6 +28580,52 @@ itemlabeltag
This parameter only makes sense when itemising layouts are used with a
notion of labels, such as definition lists.
+\change_inserted 1075283030 1597699874
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted 1075283030 1597699874
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699880
+DocBookItemLabelTagType
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699874
+block, paragraph, inline
+\end_layout
+
+\end_inset
+
+] The new-line policy for this tag, see Section
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "subsec:DocBook-New-line-policy"
+plural "false"
+caps "false"
+noprefix "false"
+
+\end_inset
+
+ for the details.
+
\change_unchanged
\end_layout
@@ -28352,6 +28701,54 @@ NONE
This parameter only makes sense when itemising layouts are used, such as
lists.
+\change_inserted 1075283030 1597699890
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted 1075283030 1597699890
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699890
+DocBookItemTagType
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699890
+block, paragraph, inline
+\end_layout
+
+\end_inset
+
+] The new-line policy for this tag, see Section
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "subsec:DocBook-New-line-policy"
+plural "false"
+caps "false"
+noprefix "false"
+
+\end_inset
+
+ for the details.
+
+\change_unchanged
+
\end_layout
\begin_layout Description
@@ -28487,6 +28884,52 @@ NONE
This parameter only makes sense when itemising layouts are used, such as
lists.
+\change_inserted 1075283030 1597699897
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted 1075283030 1597699897
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699900
+DocBookItemWrapperTagType
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699897
+block, paragraph, inline
+\end_layout
+
+\end_inset
+
+] The new-line policy for this tag, see Section
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "subsec:DocBook-New-line-policy"
+plural "false"
+caps "false"
+noprefix "false"
+
+\end_inset
+
+ for the details.
+
\change_unchanged
\end_layout
@@ -28618,6 +29061,54 @@ NONE
, indicating that there is no inner tag: content is directly output without
it.
+\change_inserted 1075283030 1597699904
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted 1075283030 1597699904
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699904
+DocBookInnerTagType
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699904
+block, paragraph, inline
+\end_layout
+
+\end_inset
+
+] The new-line policy for this tag, see Section
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "subsec:DocBook-New-line-policy"
+plural "false"
+caps "false"
+noprefix "false"
+
+\end_inset
+
+ for the details.
+
+\change_unchanged
+
\end_layout
\begin_layout Description
@@ -28668,7 +29159,11 @@ section
\end_inset
, and is only overridden when DocBook uses something else for sectioning
- (parts and chapters of a book).
+ (
+\change_inserted 1075283030 1597699921
+typically,
+\change_inserted -970929547 1515110753
+parts and chapters of a book).
\change_unchanged
@@ -28729,6 +29224,54 @@ tag
in the example above.
The default is the name of the float and always needs to be changed, as
DocBook provides no generic inset tag.
+\change_inserted 1075283030 1597699924
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted 1075283030 1597699924
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699924
+DocBookTagType
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699924
+block, paragraph, inline
+\end_layout
+
+\end_inset
+
+] The new-line policy for this tag, see Section
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "subsec:DocBook-New-line-policy"
+plural "false"
+caps "false"
+noprefix "false"
+
+\end_inset
+
+ for the details.
+
+\change_unchanged
+
\end_layout
\begin_layout Description
@@ -28858,7 +29401,53 @@ NONE
, indicating that there is no wrapper tag: tag and content are directly
output without it.
-\change_deleted -970929547 1515111523
+\change_inserted 1075283030 1597699929
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted 1075283030 1597699929
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699932
+DocBookWrapperTagType
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597699929
+block, paragraph, inline
+\end_layout
+
+\end_inset
+
+] The new-line policy for this tag, see Section
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "subsec:DocBook-New-line-policy"
+plural "false"
+caps "false"
+noprefix "false"
+
+\end_inset
+
+ for the details.
+
+\change_unchanged
\end_layout
@@ -29024,9 +29613,59 @@ Bibliography formatting
\begin_layout Standard
+\change_deleted 1075283030 1597699984
+The
+\change_inserted 1075283030 1597699985
+Included
+\change_inserted -970929547 1515110187
+bibliograph
+\change_deleted 1075283030 1597699987
+y
+\change_inserted 1075283030 1597699987
+ies
+\change_inserted -970929547 1515110187
+ cannot be formatted: all fields are always output in the database-like
+ DocBook format (equivalent to a BibTeX file)
+\change_inserted 1075283030 1597700117
+, using the
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597700120
+biblioentry
+\end_layout
+
+\end_inset
+
+ tag
\change_inserted -970929547 1515110187
-The bibliography cannot be formatted: all fields are always output in the
- database-like DocBook format (equivalent to a BibTeX file).
+.
+\change_inserted 1075283030 1597700092
+
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted 1075283030 1597700112
+When the bibliographic entries are manually inserted into the LyX document
+ as Bibliography Items, the user deals with formatting themself: there is
+ no attempt of parsing what the user wrote, the string is directly used
+ (with the
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 1075283030 1597700076
+bibliomixed
+\end_layout
+
+\end_inset
+
+ tag).
+
\change_unchanged
\end_layout
diff --git a/lib/generate_contributions.py b/lib/generate_contributions.py
index 4e3e191..e864ebd 100755
--- a/lib/generate_contributions.py
+++ b/lib/generate_contributions.py
@@ -650,7 +650,7 @@ contributors = [
"Re: Patches to improve compatibility with modern C++ standard",
"m=158862338815864",
"4 May 2020",
- u"Windows compatibility patches, Docbook backend"),
+ u"Windows compatibility patches, DocBook backend"),
contributor(u"Matthias Kalle Dalheimer",
"kalle () kdab ! net",
commit 6998e76495d4dedbc5dc11db8e0cf39b590fd674
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Mon Aug 17 23:06:26 2020 +0200
DocBook: define new arguments in layouts to configure new-line behaviour.
diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index 2bb62e3..7cf2332 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -11,7 +11,7 @@
# This script will update a .layout file to current format
# The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 83
+currentFormat = 84
# Incremented to format 4, 6 April 2007, lasgouttes
@@ -284,6 +284,11 @@ currentFormat = 83
# Incremented to format 83, 2 August 2020 by dourouc05
# New tags DocBookWrapperMergeWithPrevious and DocBookAbstract
+# Incremented to format 84, 17 August 2020 by tcuvelier
+# New tags DocBookTagType, DocBookWrapperTagTagType,
+# DocBookItemWrapperTagTagType, DocBookItemTagTagType,
+# DocBookLabelTag
+
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
diff --git a/src/Floating.cpp b/src/Floating.cpp
index ebd1e41..d44afc3 100644
--- a/src/Floating.cpp
+++ b/src/Floating.cpp
@@ -31,8 +31,8 @@ Floating::Floating(string const & type, string const & placement,
string const & refPrefix, std::string const & allowedplacement,
string const & htmlTag, string const & htmlAttrib,
docstring const & htmlStyle, string const & docbookTag,
- string const & docbookAttr, string const & required,
- bool usesfloat, bool ispredefined,
+ string const & docbookAttr, string const & docbookTagType,
+ string const & required, bool usesfloat, bool ispredefined,
bool allowswide, bool allowssideways)
: floattype_(type), placement_(placement), ext_(ext), within_(within),
style_(style), name_(name), listname_(listName), listcommand_(listCmd),
@@ -40,7 +40,8 @@ Floating::Floating(string const & type, string const & placement,
usesfloatpkg_(usesfloat), ispredefined_(ispredefined),
allowswide_(allowswide), allowssideways_(allowssideways),
html_tag_(htmlTag), html_attrib_(htmlAttrib), html_style_(htmlStyle),
- docbook_tag_(docbookTag), docbook_attr_(docbookAttr)
+ docbook_tag_(docbookTag), docbook_attr_(docbookAttr),
+ docbook_tag_type_(docbookTagType)
{}
@@ -90,20 +91,30 @@ string const & Floating::docbookAttr() const
string const & Floating::docbookTag(bool hasTitle) const
{
- docbook_tag_ = "";
- if (floattype_ == "figure") {
- docbook_tag_ = hasTitle ? "figure" : "informalfigure";
- } else if (floattype_ == "table") {
- docbook_tag_ = hasTitle ? "table" : "informaltable";
- } else if (floattype_ == "algorithm") {
- // TODO: no good translation for now! Figures are the closest match, as they can contain text.
- // Solvable as soon as https://github.com/docbook/docbook/issues/157 has a definitive answer.
- docbook_tag_ = "figure";
+ if (docbook_tag_.empty()) {
+ docbook_tag_ = "";
+ if (floattype_ == "figure") {
+ docbook_tag_ = hasTitle ? "figure" : "informalfigure";
+ } else if (floattype_ == "table") {
+ docbook_tag_ = hasTitle ? "table" : "informaltable";
+ } else if (floattype_ == "algorithm") {
+ // TODO: no good translation for now! Figures are the closest match, as they can contain text.
+ // Solvable as soon as https://github.com/docbook/docbook/issues/157 has a definitive answer.
+ docbook_tag_ = "figure";
+ }
}
return docbook_tag_;
}
+string const & Floating::docbookTagType() const
+{
+ if (docbook_tag_type_ != "block" && docbook_tag_type_ != "paragraph" && docbook_tag_type_ != "inline")
+ docbook_tag_type_ = "block";
+ return docbook_tag_type_;
+}
+
+
string const & Floating::docbookCaption() const
{
docbook_caption_ = "";
diff --git a/src/Floating.h b/src/Floating.h
index d10694f..5cfea08 100644
--- a/src/Floating.h
+++ b/src/Floating.h
@@ -38,8 +38,9 @@ public:
std::string const & refPrefix, std::string const & allowedplacement,
std::string const & htmlType, std::string const & htmlClass,
docstring const & htmlStyle, std::string const & docbookTag,
- std::string const & docbookAttr, std::string const & required,
- bool usesfloat, bool isprefined, bool allowswide, bool allowssideways);
+ std::string const & docbookAttr, std::string const & docbookTagType,
+ std::string const & required, bool usesfloat, bool isprefined,
+ bool allowswide, bool allowssideways);
///
std::string const & floattype() const { return floattype_; }
///
@@ -84,6 +85,8 @@ public:
///
std::string const & docbookAttr() const;
///
+ std::string const & docbookTagType() const;
+ ///
std::string const & docbookCaption() const;
private:
///
@@ -115,9 +118,9 @@ private:
///
bool ispredefined_;
///
- bool allowswide_;
+ bool allowswide_;
///
- bool allowssideways_;
+ bool allowssideways_;
///
mutable std::string html_tag_;
///
@@ -132,6 +135,8 @@ private:
mutable std::string docbook_caption_;
/// caption tag (mostly, either caption or title)
std::string docbook_attr_;
+ /// DocBook tag type (block, paragraph, inline)
+ mutable std::string docbook_tag_type_;
};
diff --git a/src/Layout.cpp b/src/Layout.cpp
index 5047506..102410d 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -106,20 +106,26 @@ enum LayoutTags {
LT_HTMLFORCECSS,
LT_DOCBOOKTAG,
LT_DOCBOOKATTR,
+ LT_DOCBOOKTAGTYPE,
LT_DOCBOOKININFO,
LT_DOCBOOKABSTRACT,
LT_DOCBOOKWRAPPERTAG,
LT_DOCBOOKWRAPPERATTR,
+ LT_DOCBOOKWRAPPERTAGTYPE,
LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS,
LT_DOCBOOKSECTIONTAG,
LT_DOCBOOKITEMWRAPPERTAG,
LT_DOCBOOKITEMWRAPPERATTR,
+ LT_DOCBOOKITEMWRAPPERTAGTYPE,
LT_DOCBOOKITEMTAG,
LT_DOCBOOKITEMATTR,
+ LT_DOCBOOKITEMTAGTYPE,
LT_DOCBOOKITEMLABELTAG,
LT_DOCBOOKITEMLABELATTR,
+ LT_DOCBOOKITEMLABELTAGTYPE,
LT_DOCBOOKITEMINNERTAG,
LT_DOCBOOKITEMINNERATTR,
+ LT_DOCBOOKITEMINNERTAGTYPE,
LT_DOCBOOKFORCEABSTRACTTAG,
LT_INPREAMBLE,
LT_HTMLTITLE,
@@ -223,23 +229,29 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
{ "commanddepth", LT_COMMANDDEPTH },
{ "copystyle", LT_COPYSTYLE },
{ "dependson", LT_DEPENDSON },
- { "docbookabstract", LT_DOCBOOKABSTRACT },
- { "docbookattr", LT_DOCBOOKATTR },
- { "docbookforceabstracttag", LT_DOCBOOKFORCEABSTRACTTAG },
- { "docbookininfo", LT_DOCBOOKININFO },
- { "docbookitemattr", LT_DOCBOOKITEMATTR },
- { "docbookiteminnerattr", LT_DOCBOOKITEMINNERATTR },
- { "docbookiteminnertag", LT_DOCBOOKITEMINNERTAG },
- { "docbookitemlabelattr", LT_DOCBOOKITEMLABELATTR },
- { "docbookitemlabeltag", LT_DOCBOOKITEMLABELTAG },
- { "docbookitemtag", LT_DOCBOOKITEMTAG },
- { "docbookitemwrapperattr", LT_DOCBOOKITEMWRAPPERATTR },
- { "docbookitemwrappertag", LT_DOCBOOKITEMWRAPPERTAG },
- { "docbooksectiontag", LT_DOCBOOKSECTIONTAG },
- { "docbooktag", LT_DOCBOOKTAG },
- { "docbookwrapperattr", LT_DOCBOOKWRAPPERATTR },
+ { "docbookabstract", LT_DOCBOOKABSTRACT },
+ { "docbookattr", LT_DOCBOOKATTR },
+ { "docbookforceabstracttag", LT_DOCBOOKFORCEABSTRACTTAG },
+ { "docbookininfo", LT_DOCBOOKININFO },
+ { "docbookitemattr", LT_DOCBOOKITEMATTR },
+ { "docbookiteminnerattr", LT_DOCBOOKITEMINNERATTR },
+ { "docbookiteminnertag", LT_DOCBOOKITEMINNERTAG },
+ { "docbookiteminnertagtype", LT_DOCBOOKITEMINNERTAGTYPE },
+ { "docbookitemlabelattr", LT_DOCBOOKITEMLABELATTR },
+ { "docbookitemlabeltag", LT_DOCBOOKITEMLABELTAG },
+ { "docbookitemlabeltagtype", LT_DOCBOOKITEMLABELTAGTYPE },
+ { "docbookitemtag", LT_DOCBOOKITEMTAG },
+ { "docbookitemtagtype", LT_DOCBOOKITEMTAGTYPE },
+ { "docbookitemwrapperattr", LT_DOCBOOKITEMWRAPPERATTR },
+ { "docbookitemwrappertag", LT_DOCBOOKITEMWRAPPERTAG },
+ { "docbookitemwrappertagtype", LT_DOCBOOKITEMWRAPPERTAGTYPE },
+ { "docbooksectiontag", LT_DOCBOOKSECTIONTAG },
+ { "docbooktag", LT_DOCBOOKTAG },
+ { "docbooktagtype", LT_DOCBOOKTAGTYPE },
+ { "docbookwrapperattr", LT_DOCBOOKWRAPPERATTR },
{ "docbookwrappermergewithprevious", LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS },
- { "docbookwrappertag", LT_DOCBOOKWRAPPERTAG },
+ { "docbookwrappertag", LT_DOCBOOKWRAPPERTAG },
+ { "docbookwrappertagtype", LT_DOCBOOKWRAPPERTAGTYPE },
{ "end", LT_END },
{ "endlabelstring", LT_ENDLABELSTRING },
{ "endlabeltype", LT_ENDLABELTYPE },
@@ -733,6 +745,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
lex >> docbookattr_;
break;
+ case LT_DOCBOOKTAGTYPE:
+ lex >> docbooktagtype_;
+ break;
+
case LT_DOCBOOKFORCEABSTRACTTAG:
lex >> docbookforceabstracttag_;
break;
@@ -753,6 +769,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
lex >> docbookwrapperattr_;
break;
+ case LT_DOCBOOKWRAPPERTAGTYPE:
+ lex >> docbookwrappertagtype_;
+ break;
+
case LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS:
lex >> docbookwrappermergewithprevious_;
break;
@@ -769,6 +789,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
lex >> docbookitemwrapperattr_;
break;
+ case LT_DOCBOOKITEMWRAPPERTAGTYPE:
+ lex >> docbookitemwrappertagtype_;
+ break;
+
case LT_DOCBOOKITEMTAG:
lex >> docbookitemtag_;
break;
@@ -777,6 +801,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
lex >> docbookitemattr_;
break;
+ case LT_DOCBOOKITEMTAGTYPE:
+ lex >> docbookitemtagtype_;
+ break;
+
case LT_DOCBOOKITEMLABELTAG:
lex >> docbookitemlabeltag_;
break;
@@ -785,6 +813,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
lex >> docbookitemlabelattr_;
break;
+ case LT_DOCBOOKITEMLABELTAGTYPE:
+ lex >> docbookitemlabeltagtype_;
+ break;
+
case LT_DOCBOOKITEMINNERTAG:
lex >> docbookiteminnertag_;
break;
@@ -793,6 +825,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
lex >> docbookiteminnerattr_;
break;
+ case LT_DOCBOOKITEMINNERTAGTYPE:
+ lex >> docbookiteminnertagtype_;
+ break;
+
case LT_SPELLCHECK:
lex >> spellcheck;
break;
@@ -1608,6 +1644,8 @@ void Layout::write(ostream & os) const
os << "\tDocBookTag " << docbooktag_ << '\n';
if(!docbookattr_.empty())
os << "\tDocBookAttr " << docbookattr_ << '\n';
+ if(!docbooktagtype_.empty())
+ os << "\tDocBookTagType " << docbooktagtype_ << '\n';
if(!docbookininfo_.empty())
os << "\tDocBookInInfo " << docbookininfo_ << '\n';
os << "\tDocBookAbstract " << docbookabstract_ << '\n';
@@ -1615,25 +1653,35 @@ void Layout::write(ostream & os) const
os << "\tDocBookWrapperTag " << docbookwrappertag_ << '\n';
if(!docbookwrapperattr_.empty())
os << "\tDocBookWrapperAttr " << docbookwrapperattr_ << '\n';
+ if(!docbookwrappertagtype_.empty())
+ os << "\tDocBookWrapperTagType " << docbookwrappertagtype_ << '\n';
if(!docbooksectiontag_.empty())
os << "\tDocBookSectionTag " << docbooksectiontag_ << '\n';
if(!docbookitemtag_.empty())
os << "\tDocBookItemTag " << docbookitemtag_ << '\n';
if(!docbookitemattr_.empty())
os << "\tDocBookItemAttr " << docbookitemattr_ << '\n';
+ if(!docbookitemtagtype_.empty())
+ os << "\tDocBookItemTagType " << docbookitemtagtype_ << '\n';
if(!docbookitemwrappertag_.empty())
os << "\tDocBookItemWrapperTag " << docbookitemwrappertag_ << '\n';
if(!docbookitemwrapperattr_.empty())
os << "\tDocBookItemWrapperAttr " << docbookitemwrapperattr_ << '\n';
+ if(!docbookitemwrappertagtype_.empty())
+ os << "\tDocBookItemWrapperTagType " << docbookitemwrappertagtype_ << '\n';
os << "\tDocBookItemWrapperMergeWithPrevious " << docbookwrappermergewithprevious_ << '\n';
if(!docbookitemlabeltag_.empty())
os << "\tDocBookItemLabelTag " << docbookitemlabeltag_ << '\n';
if(!docbookitemlabelattr_.empty())
os << "\tDocBookItemLabelAttr " << docbookitemlabelattr_ << '\n';
+ if(!docbookitemlabeltagtype_.empty())
+ os << "\tDocBookItemLabelTagType " << docbookitemlabeltagtype_ << '\n';
if(!docbookiteminnertag_.empty())
os << "\tDocBookItemInnerTag " << docbookiteminnertag_ << '\n';
if(!docbookiteminnerattr_.empty())
os << "\tDocBookItemInnerAttr " << docbookiteminnerattr_ << '\n';
+ if(!docbookiteminnertagtype_.empty())
+ os << "\tDocBookItemInnerTagType " << docbookiteminnertagtype_ << '\n';
if(!docbookforceabstracttag_.empty())
os << "\tDocBookForceAbstractTag " << docbookforceabstracttag_ << '\n';
os << "\tSpellcheck " << spellcheck << "\n"
@@ -1786,9 +1834,12 @@ string Layout::defaultCSSClass() const
string const & Layout::docbooktag() const
{
- // No sensible default value, unhappily...
- if (docbooktag_.empty())
- docbooktag_ = to_utf8(name_);
+ if (docbooktag_.empty()) {
+ if (to_ascii(name_) == "Plain Layout")
+ docbooktag_ = "para";
+ else // No sensible default value, unhappily...
+ docbooktag_ = to_utf8(name_);
+ }
return docbooktag_;
}
@@ -1800,6 +1851,20 @@ string const & Layout::docbookattr() const
}
+bool isValidTagType(std::string type)
+{
+ return !(type.empty() || (type != "block" && type != "paragraph" && type != "inline"));
+}
+
+
+string const & Layout::docbooktagtype() const
+{
+ if (!isValidTagType(docbooktagtype_))
+ docbooktagtype_ = "block";
+ return docbooktagtype_;
+}
+
+
string const & Layout::docbookininfo() const
{
// Indeed, a trilean. Only titles should be "maybe": otherwise, metadata is "always", content is "never".
@@ -1823,6 +1888,14 @@ string const & Layout::docbookwrapperattr() const
}
+string const & Layout::docbookwrappertagtype() const
+{
+ if (!isValidTagType(docbookwrappertagtype_))
+ docbookwrappertagtype_ = "block";
+ return docbookwrappertagtype_;
+}
+
+
string const & Layout::docbooksectiontag() const
{
if (docbooksectiontag_.empty())
@@ -1845,9 +1918,19 @@ string const & Layout::docbookitemwrapperattr() const
}
+string const & Layout::docbookitemwrappertagtype() const
+{
+ if (!isValidTagType(docbookitemwrappertagtype_))
+ docbookitemwrappertagtype_ = "block";
+ return docbookitemwrappertagtype_;
+}
+
+
string const & Layout::docbookitemtag() const
{
- return docbookitemtag_;
+ if (docbookitemtag_.empty())
+ docbookitemtag_ = "NONE";
+ return docbookitemtag_;
}
@@ -1857,6 +1940,14 @@ string const & Layout::docbookitemattr() const
}
+string const & Layout::docbookitemtagtype() const
+{
+ if (!isValidTagType(docbookitemtagtype_))
+ docbookitemtagtype_ = "block";
+ return docbookitemtagtype_;
+}
+
+
string const & Layout::docbookitemlabeltag() const
{
if (docbookitemlabeltag_.empty())
@@ -1871,6 +1962,14 @@ string const & Layout::docbookitemlabelattr() const
}
+string const & Layout::docbookitemlabeltagtype() const
+{
+ if (!isValidTagType(docbookitemlabeltagtype_))
+ docbookitemlabeltagtype_ = "block";
+ return docbookitemlabeltagtype_;
+}
+
+
string const & Layout::docbookiteminnertag() const
{
if (docbookiteminnertag_.empty())
@@ -1885,6 +1984,14 @@ string const & Layout::docbookiteminnerattr() const
}
+string const & Layout::docbookiteminnertagtype() const
+{
+ if (!isValidTagType(docbookiteminnertagtype_))
+ docbookiteminnertagtype_ = "block";
+ return docbookiteminnertagtype_;
+}
+
+
std::string const & Layout::docbookforceabstracttag() const
{
if (docbookforceabstracttag_.empty())
diff --git a/src/Layout.h b/src/Layout.h
index a894142..14784a2 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -197,6 +197,8 @@ public:
///
std::string const & docbookattr() const;
///
+ std::string const & docbooktagtype() const;
+ ///
std::string const & docbookininfo() const;
///
bool docbookabstract() const { return docbookabstract_; }
@@ -205,6 +207,8 @@ public:
///
std::string const & docbookwrapperattr() const;
///
+ std::string const & docbookwrappertagtype() const;
+ ///
bool docbookwrappermergewithprevious() const { return docbookwrappermergewithprevious_; }
///
std::string const & docbooksectiontag() const;
@@ -213,18 +217,26 @@ public:
///
std::string const & docbookitemwrapperattr() const;
///
+ std::string const & docbookitemwrappertagtype() const;
+ ///
std::string const & docbookitemlabeltag() const;
///
std::string const & docbookitemlabelattr() const;
///
+ std::string const & docbookitemlabeltagtype() const;
+ ///
std::string const & docbookiteminnertag() const;
///
std::string const & docbookiteminnerattr() const;
///
+ std::string const & docbookiteminnertagtype() const;
+ ///
std::string const & docbookitemtag() const;
///
std::string const & docbookitemattr() const;
///
+ std::string const & docbookitemtagtype() const;
+ ///
std::string const & docbookforceabstracttag() const;
///
bool isParagraph() const { return latextype == LATEX_PARAGRAPH; }
@@ -495,27 +507,39 @@ private:
mutable std::string docbooktag_;
/// Roles to add to docbooktag_, if any (default: none).
mutable std::string docbookattr_;
+ /// DocBook tag type corresponding to this layout (block, paragraph, or inline; default: block).
+ mutable std::string docbooktagtype_;
/// DocBook tag corresponding to this item (mainly for lists).
mutable std::string docbookitemtag_;
/// Roles to add to docbookitemtag_, if any (default: none).
mutable std::string docbookitemattr_;
+ /// DocBook tag type corresponding to this item (block, paragraph, or inline; default: block).
+ mutable std::string docbookitemtagtype_;
/// DocBook tag corresponding to the wrapper around an item (mainly for lists).
mutable std::string docbookitemwrappertag_;
/// Roles to add to docbookitemwrappertag_, if any (default: none).
mutable std::string docbookitemwrapperattr_;
- /// DocBook tag corresponding to this label (only for description lists;
+ /// DocBook tag type corresponding to the wrapper around an item (block, paragraph, or inline; default: block).
+ mutable std::string docbookitemwrappertagtype_;
+ /// DocBook tag corresponding to this label (mostly for description lists;
/// labels in the common sense do not exist with DocBook).
mutable std::string docbookitemlabeltag_;
/// Roles to add to docbooklabeltag_, if any (default: none).
mutable std::string docbookitemlabelattr_;
+ /// DocBook tag corresponding to this label (block, paragraph, or inline; default: block).
+ mutable std::string docbookitemlabeltagtype_;
/// DocBook tag to add within the item, around its direct content (mainly for lists).
mutable std::string docbookiteminnertag_;
/// Roles to add to docbookiteminnertag_, if any (default: none).
mutable std::string docbookiteminnerattr_;
+ /// DocBook tag to add within the item, around its direct content (block, paragraph, or inline; default: block).
+ mutable std::string docbookiteminnertagtype_;
/// DocBook tag corresponding to this wrapper around the main tag.
mutable std::string docbookwrappertag_;
/// Roles to add to docbookwrappertag_, if any (default: none).
mutable std::string docbookwrapperattr_;
+ /// DocBook tag corresponding to this wrapper around the main tag (block, paragraph, or inline; default: block).
+ mutable std::string docbookwrappertagtype_;
/// Whether this wrapper tag may be merged with the previously opened wrapper tag.
bool docbookwrappermergewithprevious_;
/// Outer tag for this section, only if this layout represent a sectionning item, including chapters
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 469cfaf..900d6b2 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -62,7 +62,7 @@ namespace lyx {
// You should also run the development/tools/updatelayouts.py script,
// to update the format of all of our layout files.
//
-int const LAYOUT_FORMAT = 83; // tcuvelier: DocBookWrapperMergeWithPrevious.
+int const LAYOUT_FORMAT = 84; // tcuvelier: DocBook*TagType.
// Layout format for the current lyx file format. Controls which format is
@@ -1378,6 +1378,7 @@ bool TextClass::readFloat(Lexer & lexrc)
FT_HTMLTAG,
FT_DOCBOOKATTR,
FT_DOCBOOKTAG,
+ FT_DOCBOOKTAGTYPE,
FT_LISTCOMMAND,
FT_REFPREFIX,
FT_ALLOWED_PLACEMENT,
@@ -1393,6 +1394,7 @@ bool TextClass::readFloat(Lexer & lexrc)
{ "allowswide", FT_ALLOWS_WIDE },
{ "docbookattr", FT_DOCBOOKATTR },
{ "docbooktag", FT_DOCBOOKTAG },
+ { "docbooktagtype", FT_DOCBOOKTAGTYPE },
{ "end", FT_END },
{ "extension", FT_EXT },
{ "guiname", FT_NAME },
@@ -1419,6 +1421,7 @@ bool TextClass::readFloat(Lexer & lexrc)
string htmltag;
string docbookattr;
string docbooktag;
+ string docbooktagtype;
string listname;
string listcommand;
string name;
@@ -1540,6 +1543,10 @@ bool TextClass::readFloat(Lexer & lexrc)
lexrc.next();
docbooktag = lexrc.getString();
break;
+ case FT_DOCBOOKTAGTYPE:
+ lexrc.next();
+ docbooktagtype = lexrc.getString();
+ break;
case FT_END:
getout = true;
break;
@@ -1568,8 +1575,8 @@ bool TextClass::readFloat(Lexer & lexrc)
Floating fl(type, placement, ext, within, style, name,
listname, listcommand, refprefix, allowed_placement,
htmltag, htmlattr, htmlstyle, docbooktag, docbookattr,
- required, usesfloat, ispredefined, allowswide,
- allowssideways);
+ docbooktagtype, required, usesfloat, ispredefined,
+ allowswide, allowssideways);
floatlist_.newFloat(fl);
// each float has its own counter
counters_.newCounter(from_ascii(type), from_ascii(within),
commit 87dae26e4a8146c7e9b450dfff4d8711deeed933
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 16 00:59:43 2020 +0200
Simplify code to generate only one paragraph at a time.
diff --git a/autotests/export/docbook/basic.xml b/autotests/export/docbook/basic.xml
index f208ae6..6f4a828 100644
--- a/autotests/export/docbook/basic.xml
+++ b/autotests/export/docbook/basic.xml
@@ -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><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>
+<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>
+
+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>
diff --git a/autotests/export/docbook/easy.lyx b/autotests/export/docbook/easy.lyx
new file mode 100644
index 0000000..0ea08e7
--- /dev/null
+++ b/autotests/export/docbook/easy.lyx
@@ -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
diff --git a/autotests/export/docbook/easy.xml b/autotests/export/docbook/easy.xml
new file mode 100644
index 0000000..883c982
--- /dev/null
+++ b/autotests/export/docbook/easy.xml
@@ -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>
\ No newline at end of file
diff --git a/autotests/export/docbook/lists.lyx b/autotests/export/docbook/lists.lyx
index 4e46d70..f903372 100644
--- a/autotests/export/docbook/lists.lyx
+++ b/autotests/export/docbook/lists.lyx
@@ -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
diff --git a/autotests/export/docbook/lists.xml b/autotests/export/docbook/lists.xml
index a00ab4f..4621e30 100644
--- a/autotests/export/docbook/lists.xml
+++ b/autotests/export/docbook/lists.xml
@@ -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>
\ No newline at end of file
diff --git a/lib/layouts/stdlayouts.inc b/lib/layouts/stdlayouts.inc
index 3b10ff4..1670695 100644
--- a/lib/layouts/stdlayouts.inc
+++ b/lib/layouts/stdlayouts.inc
@@ -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
diff --git a/lib/layouts/stdlists.inc b/lib/layouts/stdlists.inc
index 0eef65c..16a9e81 100644
--- a/lib/layouts/stdlists.inc
+++ b/lib/layouts/stdlists.inc
@@ -43,7 +43,9 @@ Style Itemize
Color latex
EndFont
EndArgument
- DocBookTag itemizedlist
+ DocBookWrapperTag itemizedlist
+ DocBookWrapperMergeWithPrevious true
+ DocBookTag NONE
DocBookItemTag listitem
DocBookItemInnerTag para
End
diff --git a/lib/layouts/stdstarsections.inc b/lib/layouts/stdstarsections.inc
index 7d6865f..60354b1 100644
--- a/lib/layouts/stdstarsections.inc
+++ b/lib/layouts/stdstarsections.inc
@@ -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
diff --git a/lib/layouts/stdstruct.inc b/lib/layouts/stdstruct.inc
index b02499f..c8b7eb4 100644
--- a/lib/layouts/stdstruct.inc
+++ b/lib/layouts/stdstruct.inc
@@ -51,8 +51,9 @@ Style Abstract
EndHTMLStyle
DocBookAbstract true
DocBookInInfo always
- DocBookTag abstract
- DocBookItemTag para
+ DocBookWrapperTag abstract
+ DocBookWrapperMergeWithPrevious true
+ DocBookTag para
End
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 2465cc4..24947f8 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -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 {
diff --git a/src/ParagraphList.h b/src/ParagraphList.h
index a57deb4..7e5cc1a 100644
--- a/src/ParagraphList.h
+++ b/src/ParagraphList.h
@@ -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
diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp
index 34b22c1..c03a8e2 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -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;
diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp
index a023f7a..8e69e88 100644
--- a/src/insets/InsetERT.cpp
+++ b/src/insets/InsetERT.cpp
@@ -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();
}
diff --git a/src/insets/InsetNewline.cpp b/src/insets/InsetNewline.cpp
index 45d52b2..00b276e 100644
--- a/src/insets/InsetNewline.cpp
+++ b/src/insets/InsetNewline.cpp
@@ -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.
}
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index cb6cec5..800cbeb 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -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.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 4430041..b29da56 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -43,6 +43,8 @@
#include <algorithm>
#include <sstream>
+// #define DOCBOOK_DEBUG_NEWLINES
+
using namespace std;
using namespace lyx::support;
@@ -191,6 +193,10 @@ namespace {
void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
{
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- openParTag -->";
+#endif
+
Layout const & lay = par->layout();
if (par == prevpar)
@@ -212,29 +218,43 @@ void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar
}
// Main logic.
- if (openWrapper)
+ if (openWrapper) {
xs << xml::StartTag(lay.docbookwrappertag(), lay.docbookwrapperattr());
+ xs << xml::CR();
+ }
string tag = lay.docbooktag();
- if (tag == "Plain Layout")
- tag = "para";
-
- if (!xs.isTagOpen(xml::ParTag(tag, lay.docbookattr()), 1)) // Don't nest a paragraph directly in a paragraph.
- xs << xml::ParTag(tag, lay.docbookattr());
+ if (tag != "NONE") {
+ auto xmltag = xml::ParTag(tag, lay.docbookattr());
+ if (!xs.isTagOpen(xmltag, 1)) // Don't nest a paragraph directly in a paragraph. TODO: required or not?
+ xs << xmltag;
+ }
- if (lay.docbookitemtag() != "NONE")
+ if (lay.docbookitemtag() != "NONE") {
xs << xml::StartTag(lay.docbookitemtag(), lay.docbookitemattr());
+ xs << xml::CR();
+ }
+
+ if (lay.docbookiteminnertag() != "NONE")
+ xs << xml::StartTag(lay.docbookiteminnertag(), lay.docbookiteminnerattr());
+
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- /openParTag -->";
+#endif
}
-void closeTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpar)
+void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpar)
{
- Layout const & lay = par->layout();
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- closeParTag -->";
+#endif
if (par == nextpar)
nextpar = nullptr;
// See comment in openParTag.
+ Layout const & lay = par->layout();
bool closeWrapper = lay.docbookwrappertag() != "NONE";
if (nextpar != nullptr) {
Layout const & nextlay = nextpar->layout();
@@ -245,132 +265,133 @@ void closeTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpar)
}
// Main logic.
- if (lay.docbookitemtag() != "NONE")
+ if (lay.docbookiteminnertag() != "NONE") {
+ xs << xml::EndTag(lay.docbookiteminnertag());
+ xs << xml::CR();
+ }
+
+ if (lay.docbookitemtag() != "NONE") {
xs << xml::EndTag(lay.docbookitemtag());
+ xs << xml::CR();
+ }
- string tag = lay.docbooktag();
- if (tag == "Plain Layout")
- tag = "para";
+ if (lay.docbooktag() != "NONE") {
+ xs << xml::EndTag(lay.docbooktag());
+ xs << xml::CR();
+ }
- xs << xml::EndTag(tag);
- if (closeWrapper)
+ if (closeWrapper) {
xs << xml::EndTag(lay.docbookwrappertag());
-}
-
+ xs << xml::CR();
+ }
-void openLabelTag(XMLStream & xs, Layout const & lay) // Mostly for definition lists.
-{
- xs << xml::StartTag(lay.docbookitemlabeltag(), lay.docbookitemlabelattr());
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- /closeParTag -->";
+#endif
}
-void closeLabelTag(XMLStream & xs, Layout const & lay)
+void openBlockTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
{
- xs << xml::EndTag(lay.docbookitemlabeltag());
- xs << xml::CR();
-}
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- openBlockTag -->";
+#endif
+ // Similar as openParTag, but with a line feed after.
+ openParTag(xs, par, prevpar);
+ xs << xml::CR();
-void openItemTag(XMLStream & xs, Layout const & lay)
-{
- xs << xml::StartTag(lay.docbookitemtag(), lay.docbookitemattr());
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- /openBlockTag -->";
+#endif
}
-// Return true when new elements are output in a paragraph, false otherwise.
-bool openInnerItemTag(XMLStream & xs, Layout const & lay)
+void closeBlockTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
{
- if (lay.docbookiteminnertag() != "NONE") {
- xs << xml::CR();
- xs << xml::ParTag(lay.docbookiteminnertag(), lay.docbookiteminnerattr());
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- closeBlockTag -->";
+#endif
- if (lay.docbookiteminnertag() == "para") {
- return true;
- }
- }
- return false;
+ // Similar as closeParTag, but with a line feed before.
+ xs << xml::CR();
+ closeParTag(xs, par, prevpar);
+
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- /closeBlockTag -->";
+#endif
}
-void closeInnerItemTag(XMLStream & xs, Layout const & lay)
+void openLabelTag(XMLStream & xs, Layout const & lay) // Mostly for definition lists.
{
- if (lay.docbookiteminnertag()!= "NONE") {
- xs << xml::EndTag(lay.docbookiteminnertag());
- xs << xml::CR();
- }
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- openLabelTag -->";
+#endif
+
+ xs << xml::StartTag(lay.docbookitemlabeltag(), lay.docbookitemlabelattr());
+
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- /openLabelTag -->";
+#endif
}
-inline void closeItemTag(XMLStream & xs, Layout const & lay)
+void closeLabelTag(XMLStream & xs, Layout const & lay)
{
- xs << xml::EndTag(lay.docbookitemtag());
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- closeLabelTag -->";
+#endif
+
+ xs << xml::EndTag(lay.docbookitemlabeltag());
xs << xml::CR();
-}
-// end of convenience functions
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- closeLabelTag -->";
+#endif
+}
-ParagraphList::const_iterator findLast(
- ParagraphList::const_iterator p,
- ParagraphList::const_iterator const & pend,
- LatexType type) {
- for (++p; p != pend && p->layout().latextype == type; ++p);
- return p;
-}
+void openItemTag(XMLStream & xs, Layout const & lay)
+{
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- openItemTag -->";
+#endif
-ParagraphList::const_iterator findLastBibliographyParagraph(
- ParagraphList::const_iterator p,
- ParagraphList::const_iterator const & pend) {
- for (++p; p != pend && p->layout().latextype == LATEX_BIB_ENVIRONMENT; ++p);
+ xs << xml::StartTag(lay.docbookitemtag(), lay.docbookitemattr());
- return p;
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- /openItemTag -->";
+#endif
}
-ParagraphList::const_iterator findEndOfEnvironment(
- ParagraphList::const_iterator const & pstart,
- ParagraphList::const_iterator const & pend)
+void closeItemTag(XMLStream & xs, Layout const & lay)
{
- ParagraphList::const_iterator p = pstart;
- size_t const depth = p->params().depth();
-
- for (++p; p != pend; ++p) {
- Layout const &style = p->layout();
- // It shouldn't happen that e.g. a section command occurs inside
- // a quotation environment, at a higher depth, but as of 6/2009,
- // it can happen. We pretend that it's just at lowest depth.
- if (style.latextype == LATEX_COMMAND)
- return p;
-
- // If depth is down, we're done
- if (p->params().depth() < depth)
- return p;
-
- // If depth is up, we're not done
- if (p->params().depth() > depth)
- continue;
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- closeItemTag -->";
+#endif
- // FIXME I am not sure about the first check.
- // Surely we *could* have different layouts that count as
- // LATEX_PARAGRAPH, right?
- if (style.latextype == LATEX_PARAGRAPH || style != p->layout())
- return p;
- }
+ xs << xml::EndTag(lay.docbookitemtag());
+ xs << xml::CR();
- return pend;
+#ifdef DOCBOOK_DEBUG_NEWLINES
+ xs << XMLStream::ESCAPE_NONE << "<!-- /closeItemTag -->";
+#endif
}
-ParagraphList::const_iterator makeParagraphBibliography(
- Buffer const &buf,
- XMLStream &xs,
- OutputParams const &runparams,
- Text const &text,
- ParagraphList::const_iterator const & pbegin,
- ParagraphList::const_iterator const & pend)
+void makeParagraphBibliography(
+ Buffer const & buf,
+ XMLStream & xs,
+ OutputParams const & runparams,
+ Text const & text,
+ ParagraphList::const_iterator const & pbegin)
{
auto const begin = text.paragraphs().begin();
auto const end = text.paragraphs().end();
+ auto pend = pbegin;
+ ++pend;
// Find the paragraph *before* pbegin.
ParagraphList::const_iterator pbegin_before = begin;
@@ -420,322 +441,203 @@ ParagraphList::const_iterator makeParagraphBibliography(
xs << xml::EndTag("bibliography");
xs << xml::CR();
}
-
- return pend;
}
-ParagraphList::const_iterator makeParagraphs(
- Buffer const &buf,
- XMLStream &xs,
- OutputParams const &runparams,
- Text const &text,
- ParagraphList::const_iterator const & pbegin,
- ParagraphList::const_iterator const & pend)
+void makeParagraph(
+ Buffer const & buf,
+ XMLStream & xs,
+ OutputParams const & runparams,
+ Text const & text,
+ ParagraphList::const_iterator const & par)
{
auto const begin = text.paragraphs().begin();
auto const end = text.paragraphs().end();
- ParagraphList::const_iterator par = pbegin;
- ParagraphList::const_iterator prevpar = pbegin;
-
- for (; par != pend; prevpar = par, ++par) {
- // We want to open the paragraph tag if:
- // (i) the current layout permits multiple paragraphs
- // (ii) we are either not already inside a paragraph (HTMLIsBlock) OR
- // we are, but this is not the first paragraph
- //
- // But there is also a special case, and we first see whether we are in it.
- // We do not want to open the paragraph tag if this paragraph contains
- // only one item, and that item is "inline", i.e., not HTMLIsBlock (such
- // as a branch). On the other hand, if that single item has a font change
- // applied to it, then we still do need to open the paragraph.
- //
- // Obviously, this is very fragile. The main reason we need to do this is
- // because of branches, e.g., a branch that contains an entire new section.
- // We do not really want to wrap that whole thing in a <div>...</div>.
- bool special_case = false;
- Inset const *specinset = par->size() == 1 ? par->getInset(0) : nullptr;
- if (specinset && !specinset->getLayout().htmlisblock()) { // TODO: Convert htmlisblock to a DocBook parameter?
- Layout const &style = par->layout();
- FontInfo const first_font = style.labeltype == LABEL_MANUAL ?
- style.labelfont : style.font;
- FontInfo const our_font =
- par->getFont(buf.masterBuffer()->params(), 0,
- text.outerFont(distance(begin, par))).fontInfo();
-
- if (first_font == our_font)
- special_case = true;
- }
+ auto prevpar = text.paragraphs().getParagraphBefore(par);
+
+ // We want to open the paragraph tag if:
+ // (i) the current layout permits multiple paragraphs
+ // (ii) we are either not already inside a paragraph (HTMLIsBlock) OR
+ // we are, but this is not the first paragraph
+ //
+ // But there is also a special case, and we first see whether we are in it.
+ // We do not want to open the paragraph tag if this paragraph contains
+ // only one item, and that item is "inline", i.e., not HTMLIsBlock (such
+ // as a branch). On the other hand, if that single item has a font change
+ // applied to it, then we still do need to open the paragraph.
+ //
+ // Obviously, this is very fragile. The main reason we need to do this is
+ // because of branches, e.g., a branch that contains an entire new section.
+ // We do not really want to wrap that whole thing in a <div>...</div>.
+ bool special_case = false;
+ Inset const *specinset = par->size() == 1 ? par->getInset(0) : nullptr;
+ if (specinset && !specinset->getLayout().htmlisblock()) { // TODO: Convert htmlisblock to a DocBook parameter?
+ Layout const &style = par->layout();
+ FontInfo const first_font = style.labeltype == LABEL_MANUAL ?
+ style.labelfont : style.font;
+ FontInfo const our_font =
+ par->getFont(buf.masterBuffer()->params(), 0,
+ text.outerFont(std::distance(begin, par))).fontInfo();
- // Plain layouts must be ignored.
- if (!special_case && buf.params().documentClass().isPlainLayout(par->layout()) && !runparams.docbook_force_pars)
+ if (first_font == our_font)
special_case = true;
- // TODO: Could get rid of this with a DocBook equivalent to htmlisblock?
- if (!special_case && par->size() == 1 && par->getInset(0)) {
- Inset const * firstInset = par->getInset(0);
+ }
+
+ // Plain layouts must be ignored.
+ if (!special_case && buf.params().documentClass().isPlainLayout(par->layout()) && !runparams.docbook_force_pars)
+ special_case = true;
+ // TODO: Could get rid of this with a DocBook equivalent to htmlisblock?
+ if (!special_case && par->size() == 1 && par->getInset(0)) {
+ Inset const * firstInset = par->getInset(0);
- // Floats cannot be in paragraphs.
- special_case = to_utf8(firstInset->layoutName()).substr(0, 6) == "Float:";
+ // Floats cannot be in paragraphs.
+ special_case = to_utf8(firstInset->layoutName()).substr(0, 6) == "Float:";
- // Bibliographies cannot be in paragraphs.
- if (!special_case && firstInset->asInsetCommand())
- special_case = firstInset->asInsetCommand()->params().getCmdName() == "bibtex";
+ // Bibliographies cannot be in paragraphs.
+ if (!special_case && firstInset->asInsetCommand())
+ special_case = firstInset->asInsetCommand()->params().getCmdName() == "bibtex";
- // Equations do not deserve their own paragraph (DocBook allows them outside paragraphs).
- if (!special_case && firstInset->asInsetMath())
- special_case = true;
+ // Equations do not deserve their own paragraph (DocBook allows them outside paragraphs).
+ if (!special_case && firstInset->asInsetMath())
+ special_case = true;
- // ERTs are in comments, not paragraphs.
- if (!special_case && firstInset->lyxCode() == lyx::ERT_CODE)
- special_case = true;
+ // ERTs are in comments, not paragraphs.
+ if (!special_case && firstInset->lyxCode() == lyx::ERT_CODE)
+ special_case = true;
- // Listings should not get into their own paragraph.
- if (!special_case && firstInset->lyxCode() == lyx::LISTINGS_CODE)
- special_case = true;
- }
+ // Listings should not get into their own paragraph.
+ if (!special_case && firstInset->lyxCode() == lyx::LISTINGS_CODE)
+ special_case = true;
+ }
- bool const open_par = runparams.docbook_make_pars
- && (!runparams.docbook_in_par || par != pbegin)
- && !special_case;
-
- // We want to issue the closing tag if either:
- // (i) We opened it, and either docbook_in_par is false,
- // or we're not in the last paragraph, anyway.
- // (ii) We didn't open it and docbook_in_par is true,
- // but we are in the first par, and there is a next par.
- auto nextpar = par;
- ++nextpar;
- bool const close_par =
- ((open_par && (!runparams.docbook_in_par || nextpar != pend))
- || (!open_par && runparams.docbook_in_par && par == pbegin && nextpar != pend));
-
- // Determine if this paragraph has some real content. Things like new pages are not caught
- // by Paragraph::empty(), even though they do not generate anything useful in DocBook.
- odocstringstream os2;
- XMLStream xs2(os2);
- par->simpleDocBookOnePar(buf, xs2, runparams, text.outerFont(distance(begin, par)), open_par, close_par, 0);
+ bool const open_par = runparams.docbook_make_pars
+ && !runparams.docbook_in_par
+ && !special_case;
- docstring cleaned = os2.str();
- static const lyx::regex reg("[ \\r\\n]*");
- cleaned = from_utf8(lyx::regex_replace(to_utf8(cleaned), reg, string("")));
+ // We want to issue the closing tag if either:
+ // (i) We opened it, and either docbook_in_par is false,
+ // or we're not in the last paragraph, anyway.
+ // (ii) We didn't open it and docbook_in_par is true,
+ // but we are in the first par, and there is a next par.
+ auto nextpar = par;
+ ++nextpar;
+ bool const close_par = open_par && (!runparams.docbook_in_par);
- if (!cleaned.empty()) {
- if (open_par)
- openParTag(xs, &*par, &*prevpar);
+ // Determine if this paragraph has some real content. Things like new pages are not caught
+ // by Paragraph::empty(), even though they do not generate anything useful in DocBook.
+ odocstringstream os2;
+ XMLStream xs2(os2);
+ par->simpleDocBookOnePar(buf, xs2, runparams, text.outerFont(distance(begin, par)), open_par, close_par, 0);
- xs << XMLStream::ESCAPE_NONE << os2.str();
+ docstring cleaned = os2.str();
+ static const lyx::regex reg("[ \\r\\n]*");
+ cleaned = from_utf8(lyx::regex_replace(to_utf8(cleaned), reg, string("")));
- if (close_par) {
- closeTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
- xs << xml::CR();
- }
- }
+ if (!cleaned.empty()) {
+ if (open_par)
+ openParTag(xs, &*par, prevpar);
+
+ xs << XMLStream::ESCAPE_NONE << os2.str();
+
+ if (close_par)
+ closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
}
- return pend;
}
-bool isNormalEnv(Layout const &lay)
-{
- return lay.latextype == LATEX_ENVIRONMENT
- || lay.latextype == LATEX_BIB_ENVIRONMENT;
-}
+void makeAny(
+ Text const &text,
+ Buffer const &buf,
+ XMLStream &xs,
+ OutputParams const &ourparams,
+ ParagraphList::const_iterator par);
-ParagraphList::const_iterator makeEnvironment(
+void makeEnvironment(
Buffer const &buf,
XMLStream &xs,
OutputParams const &runparams,
Text const &text,
- ParagraphList::const_iterator const & pbegin,
- ParagraphList::const_iterator const & pend)
+ ParagraphList::const_iterator const & par)
{
- auto const begin = text.paragraphs().begin();
auto const end = text.paragraphs().end();
- ParagraphList::const_iterator par = pbegin;
- depth_type const origdepth = pbegin->params().depth();
-
- // Output the opening tag for this environment.
- {
- // Find the previous paragraph.
- auto prevpar = begin;
- if (prevpar != par) {
- auto prevpar_next = prevpar;
- ++prevpar_next;
-
- while (prevpar_next != par) {
- ++prevpar_next;
- ++prevpar;
- }
- }
- // Open tag for this environment.
- openParTag(xs, &*par, &*prevpar);
- xs << xml::CR();
- }
-
- // we will on occasion need to remember a layout from before.
- Layout const *lastlay = nullptr;
- auto prevpar = par;
-
- while (par != pend) {
- Layout const & style = par->layout();
- ParagraphList::const_iterator send;
-
- auto parnext = par;
- ++parnext;
-
- // Actual content of this paragraph.
- prevpar = par;
- switch (style.latextype) {
- case LATEX_ENVIRONMENT:
- case LATEX_LIST_ENVIRONMENT:
- case LATEX_ITEM_ENVIRONMENT: {
- // There are two possibilities in this case.
- // One is that we are still in the environment in which we
- // started---which we will be if the depth is the same.
- if (par->params().depth() == origdepth) {
- LATTEST(par->layout() == style);
- if (lastlay != nullptr) {
- closeItemTag(xs, *lastlay);
- if (lastlay->docbookitemwrappertag() != "NONE") {
- xs << xml::EndTag(lastlay->docbookitemwrappertag());
- xs << xml::CR();
- }
- lastlay = nullptr;
- }
-
- // this will be positive if we want to skip the
- // initial word (if it's been taken for the label).
- pos_type sep = 0;
+ // Output the opening tag for this environment, but only if it has not been previously opened (condition
+ // implemented in openParTag).
+ auto prevpar = text.paragraphs().getParagraphBefore(par);
+ openParTag(xs, &*par, prevpar); // TODO: switch in layout for par/block?
+
+ // Generate the contents of this environment. There is a special case if this is like some environment.
+ Layout const & style = par->layout();
+ if (style.latextype == LATEX_COMMAND) {
+ // Nothing to do (otherwise, infinite loops).
+ } else if (style.latextype == LATEX_ENVIRONMENT ||
+ style.latextype == LATEX_LIST_ENVIRONMENT ||
+ style.latextype == LATEX_ITEM_ENVIRONMENT) {
+ // Open a wrapper tag if needed.
+ if (style.docbookitemwrappertag() != "NONE") {
+ xs << xml::StartTag(style.docbookitemwrappertag(), style.docbookitemwrapperattr());
+ xs << xml::CR();
+ }
- // Open a wrapper tag if needed.
- if (style.docbookitemwrappertag() != "NONE") {
- xs << xml::StartTag(style.docbookitemwrappertag(), style.docbookitemwrapperattr());
+ // 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();
+
+ if (lbl.empty()) {
xs << xml::CR();
- }
-
- // label output
- if (style.labeltype != LABEL_NO_LABEL &&
- style.docbookitemlabeltag() != "NONE") {
-
- if (isNormalEnv(style)) {
- // in this case, we print the label only for the first
- // paragraph (as in a theorem or an abstract).
- if (par == pbegin) {
- docstring const lbl = pbegin->params().labelString();
- if (!lbl.empty()) {
- openLabelTag(xs, style);
- xs << lbl;
- closeLabelTag(xs, style);
- } else {
- // No new line after closeLabelTag.
- xs << xml::CR();
- }
- }
- } else { // some kind of list
- if (style.labeltype == LABEL_MANUAL) {
- // Only variablelist gets here.
-
- openLabelTag(xs, style);
- sep = par->firstWordDocBook(xs, runparams);
- closeLabelTag(xs, style);
- } else {
- openLabelTag(xs, style);
- xs << par->params().labelString();
- closeLabelTag(xs, style);
- }
- }
- } // end label output
-
- // Start generating the item.
- bool wasInParagraph = runparams.docbook_in_par;
- openItemTag(xs, style);
- bool getsIntoParagraph = openInnerItemTag(xs, style);
- OutputParams rp = runparams;
- rp.docbook_in_par = wasInParagraph | getsIntoParagraph;
-
- // 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()) {
- 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>.
- xs << ' ';
} else {
- // Generate the rest of the paragraph, if need be.
- par->simpleDocBookOnePar(buf, xs, rp, text.outerFont(distance(begin, par)), true, true, sep);
+ openLabelTag(xs, style);
+ xs << lbl;
+ closeLabelTag(xs, style);
}
-
- ++par;
- if (getsIntoParagraph)
- closeInnerItemTag(xs, style);
-
- // We may not want to close the tag yet, in particular:
- // If we're not at the end of the item...
- if (par != pend
- // and are doing items...
- && !isNormalEnv(style)
- // and if the depth has changed...
- && par->params().depth() != origdepth) {
- // then we'll save this layout for later, and close it when
- // we get another item.
- lastlay = &style;
- } else {
- closeItemTag(xs, style);
-
- // Eventually, close the item wrapper.
- if (style.docbookitemwrappertag() != "NONE") {
- xs << xml::EndTag(style.docbookitemwrappertag());
- xs << xml::CR();
- }
- }
- }
- // The other possibility is that the depth has increased.
- else {
- send = findEndOfEnvironment(par, pend);
- par = makeEnvironment(buf, xs, runparams, text, par, send);
+ } 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);
}
- break;
}
- case LATEX_PARAGRAPH:
-// send = findLast(par, pend, LATEX_PARAGRAPH);
- par = makeParagraphs(buf, xs, runparams, text, par, parnext);
- break;
- case LATEX_BIB_ENVIRONMENT:
-// send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
- makeParagraphBibliography(buf, xs, runparams, text, par, parnext);
- break;
- case LATEX_COMMAND:
- par = parnext;
- break;
+
+ // 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 (lastlay != nullptr) {
- closeItemTag(xs, *lastlay);
- if (lastlay->docbookitemwrappertag() != "NONE") {
- xs << xml::EndTag(lastlay->docbookitemwrappertag());
- xs << xml::CR();
+ 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.
+ par->simpleDocBookOnePar(buf, xs, runparams, text.outerFont(std::distance(text.paragraphs().begin(), par)),
+ true, true, sep);
}
+ } else {
+ makeAny(text, buf, xs, runparams, par);
}
-// auto nextpar = par;
-// ++nextpar;
- closeTag(xs, &*prevpar, &*par);
-// closeTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
- xs << xml::CR();
- return pend;
+
+ // Close the environment.
+ auto nextpar = par;
+ ++nextpar;
+ closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr); // TODO: switch in layout for par/block?
}
@@ -744,117 +646,48 @@ void makeCommand(
XMLStream & xs,
OutputParams const & runparams,
Text const & text,
- ParagraphList::const_iterator const & pbegin)
+ ParagraphList::const_iterator const & par)
{
- // No need for labels, as they are handled by DocBook tags.
+ // Unlike XHTML, no need for labels, as they are handled by DocBook tags.
auto const begin = text.paragraphs().begin();
auto const end = text.paragraphs().end();
- auto nextpar = pbegin;
+ auto nextpar = par;
++nextpar;
- // Find the previous paragraph.
- auto prevpar = begin;
- if (prevpar != pbegin) {
- auto prevpar_next = prevpar;
- ++prevpar_next;
-
- while (prevpar_next != pbegin) {
- ++prevpar_next;
- ++prevpar;
- }
- }
-
// Generate this command.
- openParTag(xs, &*pbegin, &*prevpar);
+ auto prevpar = text.paragraphs().getParagraphBefore(par);
+ openParTag(xs, &*par, prevpar);
- pbegin->simpleDocBookOnePar(buf, xs, runparams,
- text.outerFont(distance(begin, pbegin)));
+ par->simpleDocBookOnePar(buf, xs, runparams,
+ text.outerFont(distance(begin, par)));
- closeTag(xs, &*pbegin, (nextpar != end) ? &*nextpar : nullptr);
- xs << xml::CR();
+ closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
}
-pair<ParagraphList::const_iterator, ParagraphList::const_iterator> makeAny(
+
+void makeAny(
Text const &text,
Buffer const &buf,
XMLStream &xs,
OutputParams const &ourparams,
- ParagraphList::const_iterator par,
- ParagraphList::const_iterator send,
- ParagraphList::const_iterator pend)
+ ParagraphList::const_iterator par)
{
switch (par->layout().latextype) {
- case LATEX_COMMAND: {
- // The files with which we are working never have more than
- // one paragraph in a command structure.
- // FIXME
- // if (ourparams.docbook_in_par)
- // fix it so we don't get sections inside standard, e.g.
- // note that we may then need to make runparams not const, so we
- // can communicate that back.
- // FIXME Maybe this fix should be in the routines themselves, in case
- // they are called from elsewhere.
+ case LATEX_COMMAND:
makeCommand(buf, xs, ourparams, text, par);
- ++par;
break;
- }
case LATEX_ENVIRONMENT:
case LATEX_LIST_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
- // FIXME Same fix here.
- send = findEndOfEnvironment(par, pend);
- par = makeEnvironment(buf, xs, ourparams, text, par, send);
+ makeEnvironment(buf, xs, ourparams, text, par);
break;
case LATEX_PARAGRAPH:
- send = findLast(par, pend, LATEX_PARAGRAPH);
- par = makeParagraphs(buf, xs, ourparams, text, par, send);
+ makeParagraph(buf, xs, ourparams, text, par);
break;
case LATEX_BIB_ENVIRONMENT:
- send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
- par = makeParagraphBibliography(buf, xs, ourparams, text, par, send);
+ makeParagraphBibliography(buf, xs, ourparams, text, par);
break;
}
-
- return make_pair(par, send);
-}
-
-ParagraphList::const_iterator makeAnySimple(
- Text const &text,
- Buffer const &buf,
- XMLStream &xs,
- OutputParams const &ourparams,
- ParagraphList::const_iterator par)
-{
- auto parnext = par;
- ++parnext;
-
- switch (par->layout().latextype) {
- case LATEX_COMMAND: {
- // The files with which we are working never have more than
- // one paragraph in a command structure.
- // FIXME
- // if (ourparams.docbook_in_par)
- // fix it so we don't get sections inside standard, e.g.
- // note that we may then need to make runparams not const, so we
- // can communicate that back.
- // FIXME Maybe this fix should be in the routines themselves, in case
- // they are called from elsewhere.
- makeCommand(buf, xs, ourparams, text, par);
- return parnext;
- }
- case LATEX_ENVIRONMENT:
- case LATEX_LIST_ENVIRONMENT:
- case LATEX_ITEM_ENVIRONMENT:
- // FIXME Same fix here.
- return makeEnvironment(buf, xs, ourparams, text, par, parnext);
- case LATEX_PARAGRAPH:
- return makeParagraphs(buf, xs, ourparams, text, par, parnext);
- case LATEX_BIB_ENVIRONMENT:
- return makeParagraphBibliography(buf, xs, ourparams, text, par, parnext);
- }
-
- // This should never happen. Return the next paragraph to avoid an infinite loop.
- return parnext;
}
} // end anonymous namespace
@@ -885,9 +718,8 @@ DocBookDocumentSectioning hasDocumentSectioning(ParagraphList const ¶graphs,
Layout const &style = paragraphs[bpit].layout();
documentHasSections |= style.category() == from_utf8("Sectioning");
- if (documentHasSections) {
+ if (documentHasSections)
break;
- }
bpit += 1;
}
// Paragraphs before the first section: [ runparams.par_begin ; eppit )
@@ -898,7 +730,10 @@ DocBookDocumentSectioning hasDocumentSectioning(ParagraphList const ¶graphs,
bool hasOnlyNotes(Paragraph const & par)
{
+ // Precondition: the paragraph is not empty. Otherwise, the function will always return true...
for (int i = 0; i < par.size(); ++i)
+ // If you find something that is not an inset (like actual text) or an inset that is not a note,
+ // return false.
if (!par.isInset(i) || !dynamic_cast<InsetNote *>(par.insetList().get(i)))
return false;
return true;
@@ -994,37 +829,6 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type b
}
-pit_type generateDocBookParagraphWithoutSectioning(
- Text const & text,
- Buffer const & buf,
- XMLStream & xs,
- OutputParams const & runparams,
- ParagraphList const & paragraphs,
- DocBookInfoTag const & info)
-{
- auto bpit = info.bpit;
- auto par = paragraphs.iterator_at(bpit);
- auto lastStartedPar = par;
- ParagraphList::const_iterator send;
- auto const pend =
- (info.epit == (int) paragraphs.size()) ?
- paragraphs.end() : paragraphs.iterator_at(info.epit);
-
- while (bpit < info.epit) {
- if (info.abstract.find(bpit) != info.abstract.end()) {
- bpit += 1;
- continue;
- }
-
- tie(par, send) = makeAny(text, buf, xs, runparams, par, send, pend);
- bpit += distance(lastStartedPar, par);
- lastStartedPar = par;
- }
-
- return bpit;
-}
-
-
void outputDocBookInfo(
Text const & text,
Buffer const & buf,
@@ -1040,6 +844,7 @@ void outputDocBookInfo(
bool hasAbstract = !info.abstract.empty();
docstring abstract;
if (hasAbstract) {
+ // Generate the abstract XML into a string before further checks.
odocstringstream os2;
{
XMLStream xs2(os2);
@@ -1048,8 +853,7 @@ void outputDocBookInfo(
// info.abstract is inclusive, epit is exclusive, hence +1 for looping.
while (bpit < epit) {
- makeAnySimple(text, buf, xs2, runparams, paragraphs.iterator_at(bpit));
- xs2 << XMLStream::ESCAPE_NONE << from_ascii("<!-- " + to_string(bpit) + " -->");
+ makeAny(text, buf, xs2, runparams, paragraphs.iterator_at(bpit));
bpit += 1;
}
}
@@ -1065,7 +869,7 @@ void outputDocBookInfo(
hasAbstract = false;
}
- // The abstract must go in <info>.
+ // The abstract must go in <info>. Otherwise, decide whether to open <info> based on the layouts.
bool needInfo = !info.mustBeInInfo.empty() || hasAbstract;
// Start the <info> tag if required.
@@ -1076,16 +880,17 @@ void outputDocBookInfo(
}
// Output the elements that should go in <info>, before and after the abstract.
- xs << XMLStream::ESCAPE_NONE << "<!-- shouldBeInInfo -->";
- for (auto pit : info.shouldBeInInfo) // Typically, the title: these elements are so important and ubiquitous
- // that mandating a wrapper like <info> would repel users.
- makeAnySimple(text, buf, xs, runparams, paragraphs.iterator_at(pit));
- xs << XMLStream::ESCAPE_NONE << "<!-- mustBeInInfo -->";
- for (auto pit : info.mustBeInInfo)
+ for (auto pit : info.shouldBeInInfo) { // Typically, the title: these elements are so important and ubiquitous
+ // that mandating a wrapper like <info> would repel users. Thus, generate them first.
+ makeAny(text, buf, xs, runparams, paragraphs.iterator_at(pit));
+ }
+ for (auto pit : info.mustBeInInfo) {
if (info.abstract.find(pit) == info.abstract.end()) // The abstract must be in info, but is dealt with after.
- makeAnySimple(text, buf, xs, runparams, paragraphs.iterator_at(pit));
- xs << XMLStream::ESCAPE_NONE << "<!-- /info -->";
+ makeAny(text, buf, xs, runparams, paragraphs.iterator_at(pit));
+ }
+ // Always output the abstract as the last item of the <info>, as it requires special treatment (especially if
+ // it contains several paragraphs that are empty).
if (hasAbstract) {
// string tag = paragraphs[*info.abstract.begin()].layout().docbookforceabstracttag();
// if (tag == "NONE")
@@ -1093,9 +898,7 @@ void outputDocBookInfo(
//
// xs << xml::StartTag(tag);
// xs << xml::CR();
- xs << XMLStream::ESCAPE_NONE << "<!-- abs -->";
xs << XMLStream::ESCAPE_NONE << abstract;
- xs << XMLStream::ESCAPE_NONE << "<!-- /abs -->";
// xs << xml::EndTag(tag);
// xs << xml::CR();
}
@@ -1147,7 +950,7 @@ void docbookSimpleAllParagraphs(
while (bpit < epit) {
auto par = paragraphs.iterator_at(bpit);
if (!hasOnlyNotes(*par))
- makeAnySimple(text, buf, xs, runparams, par);
+ makeAny(text, buf, xs, runparams, par);
bpit += 1;
}
}
@@ -1170,9 +973,6 @@ void docbookParagraphs(Text const &text,
return;
});
- ParagraphList::const_iterator const pend =
- (epit == (int) paragraphs.size()) ?
- paragraphs.end() : paragraphs.iterator_at(epit);
std::stack<std::pair<int, string>> headerLevels; // Used to determine when to open/close sections: store the depth
// of the section and the tag that was used to open it.
@@ -1203,8 +1003,7 @@ void docbookParagraphs(Text const &text,
ParagraphList::const_iterator send;
if (hasOnlyNotes(*par)) {
- ++par;
- bpit += distance(lastStartedPar, par);
+ bpit += 1;
continue;
}
@@ -1283,8 +1082,8 @@ void docbookParagraphs(Text const &text,
}
// Generate this paragraph.
- tie(par, send) = makeAny(text, buf, xs, ourparams, par, send, pend);
- bpit += distance(lastStartedPar, par);
+ makeAny(text, buf, xs, ourparams, par);
+ bpit += 1;
}
// If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning
diff --git a/src/xml.cpp b/src/xml.cpp
index e16a784..147eadd 100644
--- a/src/xml.cpp
+++ b/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;
}
commit 9184ae14f0e1925cc6c63b046a65157c08d65159
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 16 19:07:14 2020 +0200
A few more constants to avoid copies
diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp
index 876adea..34b22c1 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -1216,9 +1216,9 @@ void InsetBibtex::docbook(XMLStream & xs, OutputParams const &) const
if (! delayedTags.empty()) {
unsigned long remainingTags = delayedTags.size(); // Used as a workaround. With GCC 7, when erasing all
// elements one by one, some elements may still pop in later on (even though they were deleted previously).
- auto hasTag = [&delayedTags](string key) { return delayedTags.find(key) != delayedTags.end(); };
- auto getTag = [&delayedTags](string key) { return from_utf8(delayedTags[key]); };
- auto eraseTag = [&delayedTags, &remainingTags](string key) {
+ auto hasTag = [&delayedTags](const string & key) { return delayedTags.find(key) != delayedTags.end(); };
+ auto getTag = [&delayedTags](const string & key) { return from_utf8(delayedTags[key]); };
+ auto eraseTag = [&delayedTags, &remainingTags](const string & key) {
remainingTags -= 1;
delayedTags.erase(key);
};
commit dab71087cf2954b77d3d2c0e67b868f9be82fba9
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Mon Aug 3 16:04:26 2020 +0200
DocBook: add a layout tag to tell whether an item is the abstract or not.
diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml
index e15bfdd..fe77b72 100644
--- a/autotests/export/docbook/bibliography_precooked_aastex.xml
+++ b/autotests/export/docbook/bibliography_precooked_aastex.xml
@@ -3,8 +3,8 @@
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>Collapsed Cores in Globular Clusters, Gauge-Boson Couplings, and AASTeX Examples</title>
-<author><personname>S. Djorgovski and Ivan R. King</personname>
+<!-- shouldBeInInfo --><title>Collapsed Cores in Globular Clusters, Gauge-Boson Couplings, and AASTeX Examples</title>
+<!-- mustBeInInfo --><author><personname>S. Djorgovski and Ivan R. King</personname>
<affiliation><orgname>Astronomy Department, University of California, Berkeley, CA 94720</orgname></affiliation>
<affiliation role="alternate"><orgname>Visiting Astronomer Cerro Tololo Inter-American Observatory.CTIO is operated by AURA Inc. under contract to the National Science Foundation.</orgname></affiliation>
<affiliation role="alternate"><orgname>Society of Fellows, Harvard University.</orgname></affiliation>
@@ -17,16 +17,11 @@
<author><personname>R. J. Hanisch</personname>
<affiliation><orgname>Space Telescope Science Institute, Baltimore, MD 21218</orgname></affiliation>
<affiliation role="alternate"><orgname>Patron, Alonso's Bar and Grill</orgname></affiliation></author>
-<abstract><para>
-<para>This is a preliminary report on surface photometry of the major fraction of known globular clusters, to see which of them show the signs of a collapsed core. We also explore some diversionary mathematics and recreational tables. </para>
-<!-- Output Error: Tried to close `keyword' when tag was not open. Tag discarded. -->
-<!-- Output Error: Tried to close `keywordset' when tag was not open. Tag discarded. -->
-
<keywordset><keyword>clusters: globular, peanutâbosons: bozos</keyword></keywordset>
-<!-- Output Error: Closing tag `info' when other tags are open, namely: -->
-<!-- Output Error: para -->
-</para><!-- Output Error: abstract -->
-</abstract></info>
+<!-- /info --><!-- abs --><abstract><para>
+<para>This is a preliminary report on surface photometry of the major fraction of known globular clusters, to see which of them show the signs of a collapsed core. We also explore some diversionary mathematics and recreational tables. </para>
+</para></abstract>
+<!-- 15 --><!-- /abs --></info>
<section>
<title>Introduction</title>
<para>A focal problem today in the dynamics of globular clusters is core collapse. It has been predicted by theory for decades <biblioref endterm="hen61" />, <biblioref endterm="lyn68" />, <biblioref endterm="spi85" />, but observation has been less alert to the phenomenon. For many years the central brightness peak in M15 <biblioref endterm="kin75" />, <biblioref endterm="new78" /> seemed a unique anomaly. Then <biblioref endterm="aur82" /> suggested a central peak in NGC 6397, and a limited photographic survey of ours <biblioref endterm="djo84" /> found three more cases, including NGC 6624, whose sharp center had often been remarked on <biblioref endterm="can78" />. </para>
@@ -112,7 +107,7 @@
</section>
<section>
<title>Helicity Amplitudes</title>
-<para>It has been realized that helicity amplitudes provide a convenient means for Feynman diagram<footnote><para>Footnotes can be inserted like this.</para>
+<para>It has been realized that helicity amplitudes provide a convenient means for Feynman diagram<footnote><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><para>Footnotes can be inserted like this.</para>
</footnote> evaluations. These amplitude-level techniques are particularly convenient for calculations involving many Feynman diagrams, where the usual trace techniques for the amplitude squared becomes unwieldy. Our calculations use the helicity techniques developed by other authors <biblioref endterm="hag86" />; we briefly summarize below.</para>
<section>
<title>Formalism</title>
@@ -694,8 +689,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mtable>
</m:math>
</informalequation>
-<!-- Output Error: Tried to close `title' when tag was not open. Tag discarded. -->
-
+</MathLetters>
</section>
</section>
<section>
@@ -957,7 +951,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:msub>
</m:mrow>
</m:math>
-</inlineequation>, but the assumption is that the alternate results should be less than 90° out of phase with previous values. We have no observations of <!-- \ion{Ca}{2} -->. Roughly <inlineequation>
+</inlineequation>, but the assumption is that the alternate results should be less than 90° out of phase with previous values. We have no observations of <!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><!-- \ion{Ca}{2} -->. Roughly <inlineequation>
<alt role='tex'>\nicefrac{4}{5}</alt>
<m:math>
@@ -971,14 +965,13 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation> of the electronically submitted abstracts for AAS meetings are error-free. </para>
-<acknowledgement><para>We are grateful to V. Barger, T. Han, and R. J. N. Phillips for doing the math in section <xref linkend="bozomath" />. More information on the AASTeX macros package are available at <link xlink:href="http://www.aas.org/publications/aastex">http://www.aas.org/publications/aastex</link> or the <link xlink:href="ftp://www.aas.org/pubs/AAS ftp site">AAS ftp site</link>.</para>
+<acknowledgement><para>We are grateful to V. Barger, T. Han, and R. J. N. Phillips for doing the math in section <xref linkend="bozomath" />. More information on the AASTeX macros package are available at <link xlink:href="http://www.aas.org/publications/aastex"><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->http://www.aas.org/publications/aastex</link> or the <link xlink:href="ftp://www.aas.org/pubs/AAS ftp site">AAS ftp site</link>.</para>
<application>IRAF, AIPS, Astropy, ...</application><!-- Output Error: Tried to close `para' when tag was not open. Tag discarded. -->
-<Appendix></Appendix>
<bibliography>
<bibliomixed xml:id='aur82'>Aurière, M. 1982, <!-- \aap -->, 109, 301 </bibliomixed>
<bibliomixed xml:id='can78'>Canizares, C. R., Grindlay, J. E., Hiltner, W. A., Liller, W., and McClintock, J. E. 1978, <!-- \apj -->, 224, 39 </bibliomixed>
-<bibliomixed xml:id='djo84'>Djorgovski, S., and King, I. R. 1984, <!-- \apjl -->, 277, L49 </bibliomixed>
+<bibliomixed xml:id='djo84'>Djorgovski, S., and King, I. R. 1984, <!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><!-- \apjl -->, 277, L49 </bibliomixed>
<bibliomixed xml:id='hag86'>Hagiwara, K., and Zeppenfeld, D. 1986, Nucl.Phys., 274, 1 </bibliomixed>
<bibliomixed xml:id='har84'>Harris, W. E., and van den Bergh, S. 1984, <!-- \aj -->, 89, 1816 </bibliomixed>
<bibliomixed xml:id='hen61'>Hénon, M. 1961, Ann.d'Ap., 24, 369 </bibliomixed>
@@ -986,19 +979,19 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
<bibliomixed xml:id='kin75'>King, I. R. 1975, Dynamics of Stellar Systems, A. Hayli, Dordrecht: Reidel, 1975, 99 </bibliomixed>
<bibliomixed xml:id='kin68'>King, I. R., Hedemann, E., Hodge, S. M., and White, R. E. 1968, <!-- \aj -->, 73, 456 </bibliomixed>
<bibliomixed xml:id='kro84'>Kron, G. E., Hewitt, A. V., and Wasserman, L. H. 1984, <!-- \pasp -->, 96, 198 </bibliomixed>
-<bibliomixed xml:id='lyn68'>Lynden-Bell, D., and Wood, R. 1968, <!-- \mnras -->, 138, 495 </bibliomixed>
+<bibliomixed xml:id='lyn68'>Lynden-Bell, D., and Wood, R. 1968, <!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><!-- \mnras -->, 138, 495 </bibliomixed>
<bibliomixed xml:id='new78'>Newell, E. B., and O'Neil, E. J. 1978, <!-- \apjs -->, 37, 27 </bibliomixed>
<bibliomixed xml:id='ort85'>Ortolani, S., Rosino, L., and Sandage, A. 1985, <!-- \aj -->, 90, 473 </bibliomixed>
<bibliomixed xml:id='pet76'>Peterson, C. J. 1976, <!-- \aj -->, 81, 617 </bibliomixed>
<bibliomixed xml:id='spi85'>Spitzer, L. 1985, Dynamics of Star Clusters, J. Goodman and P. Hut, Dordrecht: Reidel, 109 </bibliomixed>
</bibliography>
<table xml:id="tbl-2">
-<caption>Terribly relevant tabular information.</caption>
-<tbody>
+<caption><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->Terribly relevant tabular information.</caption>
+<!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><tbody>
<tr>
-<td align='center' valign='top'>Star </td>
-<td align='right' valign='top'> Height </td>
-<td align='right' valign='top'> <inlineequation>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->Star </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> Height </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
<alt role='tex'>d_{x}</alt>
<m:math>
@@ -1012,7 +1005,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='right' valign='top'> <inlineequation>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
<alt role='tex'>d_{y}</alt>
<m:math>
@@ -1026,7 +1019,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='right' valign='top'> <inlineequation>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
<alt role='tex'>n</alt>
<m:math>
@@ -1034,7 +1027,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='right' valign='top'> <inlineequation>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
<alt role='tex'>\chi^{2}</alt>
<m:math>
@@ -1048,7 +1041,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='right' valign='top'> <inlineequation>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
<alt role='tex'>R_{maj}</alt>
<m:math>
@@ -1064,7 +1057,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='right' valign='top'> <inlineequation>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
<alt role='tex'>R_{min}</alt>
<m:math>
@@ -1080,15 +1073,15 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='center' valign='top' colspan='1'><inlineequation>
+<td align='center' valign='top' colspan='1'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><inlineequation>
<alt role='tex'>P</alt>
<m:math>
<m:mrow><m:mi>P</m:mi>
</m:mrow>
</m:math>
-</inlineequation>a</td>
-<td align='right' valign='top'> <inlineequation>
+</inlineequation><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->a</td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
<alt role='tex'>PR_{maj}</alt>
<m:math>
@@ -1106,7 +1099,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='right' valign='top'> <inlineequation>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
<alt role='tex'>PR_{min}</alt>
<m:math>
@@ -1124,105 +1117,105 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation></td>
-<td align='center' valign='top' colspan='1'><inlineequation>
+<td align='center' valign='top' colspan='1'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><inlineequation>
<alt role='tex'>\Theta</alt>
<m:math>
<m:mrow><m:mo>Θ</m:mo>
</m:mrow>
</m:math>
-</inlineequation>b</td>
-<td align='center' valign='top'>Ref.</td>
+</inlineequation><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->b</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->Ref.</td>
</tr>
<tr>
-<td align='center' valign='top'><!-- \tableline\tableline -->1 </td>
-<td align='right' valign='top'>33472.5 </td>
-<td align='right' valign='top'>-0.1 </td>
-<td align='right' valign='top'>0.4 </td>
-<td align='right' valign='top'>53 </td>
-<td align='right' valign='top'>27.4 </td>
-<td align='right' valign='top'>2.065 </td>
-<td align='right' valign='top'>1.940 </td>
-<td align='right' valign='top'>3.900 </td>
-<td align='right' valign='top'>68.3 </td>
-<td align='right' valign='top'>116.2 </td>
-<td align='right' valign='top'>-27.639</td>
-<td align='center' valign='top'>1,2</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><!-- \tableline\tableline -->1 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->33472.5 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.1 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->0.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->53 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->27.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.065 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.940 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3.900 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->68.3 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->116.2 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-27.639</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1,2</td>
</tr>
<tr>
-<td align='center' valign='top'> 2 </td>
-<td align='right' valign='top'>27802.4 </td>
-<td align='right' valign='top'>-0.3 </td>
-<td align='right' valign='top'>-0.2 </td>
-<td align='right' valign='top'>60 </td>
-<td align='right' valign='top'>3.7 </td>
-<td align='right' valign='top'>1.628 </td>
-<td align='right' valign='top'>1.510 </td>
-<td align='right' valign='top'>2.156 </td>
-<td align='right' valign='top'>6.8 </td>
-<td align='right' valign='top'>7.5 </td>
-<td align='right' valign='top'>-26.764</td>
-<td align='center' valign='top'>3</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 2 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->27802.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.3 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.2 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->60 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3.7 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.628 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.510 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.156 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->6.8 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->7.5 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-26.764</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3</td>
</tr>
<tr>
-<td align='center' valign='top'> 3 </td>
-<td align='right' valign='top'>29210.6 </td>
-<td align='right' valign='top'>0.9 </td>
-<td align='right' valign='top'>0.3 </td>
-<td align='right' valign='top'>60 </td>
-<td align='right' valign='top'>3.4 </td>
-<td align='right' valign='top'>1.622 </td>
-<td align='right' valign='top'>1.551 </td>
-<td align='right' valign='top'>2.159 </td>
-<td align='right' valign='top'>6.7 </td>
-<td align='right' valign='top'>7.3 </td>
-<td align='right' valign='top'>-40.272</td>
-<td align='center' valign='top'>4</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 3 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->29210.6 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->0.9 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->0.3 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->60 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.622 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.551 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.159 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->6.7 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->7.3 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-40.272</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->4</td>
</tr>
<tr>
-<td align='center' valign='top'> 4 </td>
-<td align='right' valign='top'>32733.8 </td>
-<td align='right' valign='top'>-1.2c</td>
-<td align='right' valign='top'>-0.5 </td>
-<td align='right' valign='top'>41 </td>
-<td align='right' valign='top'>54.8 </td>
-<td align='right' valign='top'>2.282 </td>
-<td align='right' valign='top'>2.156 </td>
-<td align='right' valign='top'>4.313 </td>
-<td align='right' valign='top'>117.4 </td>
-<td align='right' valign='top'>78.2 </td>
-<td align='right' valign='top'>-35.847</td>
-<td align='center' valign='top'>5,6</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->32733.8 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-1.2<!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->c</td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.5 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->41 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->54.8 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.282 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.156 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->4.313 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->117.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->78.2 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-35.847</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->5,6</td>
</tr>
<tr>
-<td align='center' valign='top'> 5 </td>
-<td align='right' valign='top'> 9607.4 </td>
-<td align='right' valign='top'>-0.4 </td>
-<td align='right' valign='top'>-0.4 </td>
-<td align='right' valign='top'>60 </td>
-<td align='right' valign='top'>1.4 </td>
-<td align='right' valign='top'>1.669c</td>
-<td align='right' valign='top'>1.574 </td>
-<td align='right' valign='top'>2.343 </td>
-<td align='right' valign='top'>8.0 </td>
-<td align='right' valign='top'>8.9 </td>
-<td align='right' valign='top'>-33.417</td>
-<td align='center' valign='top'>7</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 5 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 9607.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->60 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.669<!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->c</td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.574 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.343 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->8.0 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->8.9 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-33.417</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->7</td>
</tr>
<tr>
-<td align='center' valign='top'> 6 </td>
-<td align='right' valign='top'>31638.6 </td>
-<td align='right' valign='top'>1.6 </td>
-<td align='right' valign='top'>0.1 </td>
-<td align='right' valign='top'>39 </td>
-<td align='right' valign='top'>315.2 </td>
-<td align='right' valign='top'> 3.433 </td>
-<td align='right' valign='top'>3.075 </td>
-<td align='right' valign='top'>7.488 </td>
-<td align='right' valign='top'>92.1 </td>
-<td align='right' valign='top'>25.3 </td>
-<td align='right' valign='top'>-12.052 </td>
-<td align='center' valign='top'>8</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 6 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->31638.6 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.6 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->0.1 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->39 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->315.2 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 3.433 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3.075 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->7.488 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->92.1 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->25.3 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-12.052 </td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->8</td>
</tr>
</tbody>
<Table note>a<!-- }{ -->Sample footnote for table <xref linkend="tbl-2" /> that was generated with the LaTeX table environment</Table note>
diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout
index 97c8b64..74d2ab6 100644
--- a/lib/layouts/aastex.layout
+++ b/lib/layouts/aastex.layout
@@ -282,9 +282,6 @@ Style Abstract
Series Bold
Size Normal
EndFont
- DocBookTag abstract
- DocBookItemTag para
- DocBookInInfo always
End
diff --git a/lib/layouts/stdstruct.inc b/lib/layouts/stdstruct.inc
index 83d46e9..b02499f 100644
--- a/lib/layouts/stdstruct.inc
+++ b/lib/layouts/stdstruct.inc
@@ -49,9 +49,10 @@ Style Abstract
font-weight: bold;
}
EndHTMLStyle
+ DocBookAbstract true
+ DocBookInInfo always
DocBookTag abstract
DocBookItemTag para
- DocBookInInfo always
End
diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index e69deba..2bb62e3 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -282,7 +282,7 @@ currentFormat = 83
# - Removed tag Element for flex insets
# Incremented to format 83, 2 August 2020 by dourouc05
-# New tag DocBookWrapperMergeWithPrevious
+# New tags DocBookWrapperMergeWithPrevious and DocBookAbstract
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
diff --git a/src/Layout.cpp b/src/Layout.cpp
index eeb58d0..5047506 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -107,6 +107,7 @@ enum LayoutTags {
LT_DOCBOOKTAG,
LT_DOCBOOKATTR,
LT_DOCBOOKININFO,
+ LT_DOCBOOKABSTRACT,
LT_DOCBOOKWRAPPERTAG,
LT_DOCBOOKWRAPPERATTR,
LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS,
@@ -177,6 +178,7 @@ Layout::Layout()
htmllabelfirst_ = false;
htmlforcecss_ = false;
htmltitle_ = false;
+ docbookabstract_ = false;
docbookwrappermergewithprevious_ = false;
spellcheck = true;
forcelocal = 0;
@@ -221,6 +223,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
{ "commanddepth", LT_COMMANDDEPTH },
{ "copystyle", LT_COPYSTYLE },
{ "dependson", LT_DEPENDSON },
+ { "docbookabstract", LT_DOCBOOKABSTRACT },
{ "docbookattr", LT_DOCBOOKATTR },
{ "docbookforceabstracttag", LT_DOCBOOKFORCEABSTRACTTAG },
{ "docbookininfo", LT_DOCBOOKININFO },
@@ -738,6 +741,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
lex >> docbookininfo_;
break;
+ case LT_DOCBOOKABSTRACT:
+ lex >> docbookabstract_;
+ break;
+
case LT_DOCBOOKWRAPPERTAG:
lex >> docbookwrappertag_;
break;
@@ -1603,6 +1610,7 @@ void Layout::write(ostream & os) const
os << "\tDocBookAttr " << docbookattr_ << '\n';
if(!docbookininfo_.empty())
os << "\tDocBookInInfo " << docbookininfo_ << '\n';
+ os << "\tDocBookAbstract " << docbookabstract_ << '\n';
if(!docbookwrappertag_.empty())
os << "\tDocBookWrapperTag " << docbookwrappertag_ << '\n';
if(!docbookwrapperattr_.empty())
diff --git a/src/Layout.h b/src/Layout.h
index d9eb893..a894142 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -199,6 +199,8 @@ public:
///
std::string const & docbookininfo() const;
///
+ bool docbookabstract() const { return docbookabstract_; }
+ ///
std::string const & docbookwrappertag() const;
///
std::string const & docbookwrapperattr() const;
@@ -516,11 +518,14 @@ private:
mutable std::string docbookwrapperattr_;
/// Whether this wrapper tag may be merged with the previously opened wrapper tag.
bool docbookwrappermergewithprevious_;
- /// Outer tag for this section, only if this layout represent a sectionning item, including chapters (default: section).
+ /// Outer tag for this section, only if this layout represent a sectionning item, including chapters
+ /// (default: section).
mutable std::string docbooksectiontag_;
/// Whether this tag must/can/can't go into an <info> tag (default: never, as it only makes sense for metadata).
mutable std::string docbookininfo_;
- /// whether this element (root or not) does not accept text without a section(i.e. the first text that is met
+ /// Wehther this paragraph should be considered as abstract.
+ bool docbookabstract_;
+ /// Whether this element (root or not) does not accept text without a section (i.e. the first text that is met
/// in LyX must be considered as the abstract if this is true); this text must be output with the specific tag
/// held by this attribute
mutable std::string docbookforceabstracttag_;
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index fd38940..4430041 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -219,7 +219,8 @@ void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar
if (tag == "Plain Layout")
tag = "para";
- xs << xml::ParTag(tag, lay.docbookattr());
+ if (!xs.isTagOpen(xml::ParTag(tag, lay.docbookattr()), 1)) // Don't nest a paragraph directly in a paragraph.
+ xs << xml::ParTag(tag, lay.docbookattr());
if (lay.docbookitemtag() != "NONE")
xs << xml::StartTag(lay.docbookitemtag(), lay.docbookitemattr());
@@ -554,30 +555,38 @@ ParagraphList::const_iterator makeEnvironment(
ParagraphList::const_iterator par = pbegin;
depth_type const origdepth = pbegin->params().depth();
- // Find the previous paragraph.
- auto prevpar = begin;
- if (prevpar != par) {
- auto prevpar_next = prevpar;
- ++prevpar_next;
-
- while (prevpar_next != par) {
+ // Output the opening tag for this environment.
+ {
+ // Find the previous paragraph.
+ auto prevpar = begin;
+ if (prevpar != par) {
+ auto prevpar_next = prevpar;
++prevpar_next;
- ++prevpar;
+
+ while (prevpar_next != par) {
+ ++prevpar_next;
+ ++prevpar;
+ }
}
- }
- // open tag for this environment
- openParTag(xs, &*par, &*prevpar);
- xs << xml::CR();
+ // Open tag for this environment.
+ openParTag(xs, &*par, &*prevpar);
+ xs << xml::CR();
+ }
// we will on occasion need to remember a layout from before.
Layout const *lastlay = nullptr;
+ auto prevpar = par;
while (par != pend) {
Layout const & style = par->layout();
ParagraphList::const_iterator send;
+ auto parnext = par;
+ ++parnext;
+
// Actual content of this paragraph.
+ prevpar = par;
switch (style.latextype) {
case LATEX_ENVIRONMENT:
case LATEX_LIST_ENVIRONMENT:
@@ -701,15 +710,15 @@ ParagraphList::const_iterator makeEnvironment(
break;
}
case LATEX_PARAGRAPH:
- send = findLast(par, pend, LATEX_PARAGRAPH);
- par = makeParagraphs(buf, xs, runparams, text, par, send);
+// send = findLast(par, pend, LATEX_PARAGRAPH);
+ par = makeParagraphs(buf, xs, runparams, text, par, parnext);
break;
case LATEX_BIB_ENVIRONMENT:
- send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
- par = makeParagraphBibliography(buf, xs, runparams, text, par, send);
+// send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
+ makeParagraphBibliography(buf, xs, runparams, text, par, parnext);
break;
case LATEX_COMMAND:
- ++par;
+ par = parnext;
break;
}
}
@@ -721,9 +730,10 @@ ParagraphList::const_iterator makeEnvironment(
xs << xml::CR();
}
}
- auto nextpar = par;
- ++nextpar;
- closeTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
+// auto nextpar = par;
+// ++nextpar;
+ closeTag(xs, &*prevpar, &*par);
+// closeTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
xs << xml::CR();
return pend;
}
@@ -773,43 +783,80 @@ pair<ParagraphList::const_iterator, ParagraphList::const_iterator> makeAny(
ParagraphList::const_iterator send,
ParagraphList::const_iterator pend)
{
- Layout const & style = par->layout();
-
- switch (style.latextype) {
- case LATEX_COMMAND: {
- // The files with which we are working never have more than
- // one paragraph in a command structure.
- // FIXME
- // if (ourparams.docbook_in_par)
- // fix it so we don't get sections inside standard, e.g.
- // note that we may then need to make runparams not const, so we
- // can communicate that back.
- // FIXME Maybe this fix should be in the routines themselves, in case
- // they are called from elsewhere.
- makeCommand(buf, xs, ourparams, text, par);
- ++par;
- break;
- }
- case LATEX_ENVIRONMENT:
- case LATEX_LIST_ENVIRONMENT:
- case LATEX_ITEM_ENVIRONMENT:
- // FIXME Same fix here.
- send = findEndOfEnvironment(par, pend);
- par = makeEnvironment(buf, xs, ourparams, text, par, send);
- break;
- case LATEX_PARAGRAPH:
- send = findLast(par, pend, LATEX_PARAGRAPH);
- par = makeParagraphs(buf, xs, ourparams, text, par, send);
- break;
- case LATEX_BIB_ENVIRONMENT:
- send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
- par = makeParagraphBibliography(buf, xs, ourparams, text, par, send);
- break;
+ switch (par->layout().latextype) {
+ case LATEX_COMMAND: {
+ // The files with which we are working never have more than
+ // one paragraph in a command structure.
+ // FIXME
+ // if (ourparams.docbook_in_par)
+ // fix it so we don't get sections inside standard, e.g.
+ // note that we may then need to make runparams not const, so we
+ // can communicate that back.
+ // FIXME Maybe this fix should be in the routines themselves, in case
+ // they are called from elsewhere.
+ makeCommand(buf, xs, ourparams, text, par);
+ ++par;
+ break;
+ }
+ case LATEX_ENVIRONMENT:
+ case LATEX_LIST_ENVIRONMENT:
+ case LATEX_ITEM_ENVIRONMENT:
+ // FIXME Same fix here.
+ send = findEndOfEnvironment(par, pend);
+ par = makeEnvironment(buf, xs, ourparams, text, par, send);
+ break;
+ case LATEX_PARAGRAPH:
+ send = findLast(par, pend, LATEX_PARAGRAPH);
+ par = makeParagraphs(buf, xs, ourparams, text, par, send);
+ break;
+ case LATEX_BIB_ENVIRONMENT:
+ send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
+ par = makeParagraphBibliography(buf, xs, ourparams, text, par, send);
+ break;
}
return make_pair(par, send);
}
+ParagraphList::const_iterator makeAnySimple(
+ Text const &text,
+ Buffer const &buf,
+ XMLStream &xs,
+ OutputParams const &ourparams,
+ ParagraphList::const_iterator par)
+{
+ auto parnext = par;
+ ++parnext;
+
+ switch (par->layout().latextype) {
+ case LATEX_COMMAND: {
+ // The files with which we are working never have more than
+ // one paragraph in a command structure.
+ // FIXME
+ // if (ourparams.docbook_in_par)
+ // fix it so we don't get sections inside standard, e.g.
+ // note that we may then need to make runparams not const, so we
+ // can communicate that back.
+ // FIXME Maybe this fix should be in the routines themselves, in case
+ // they are called from elsewhere.
+ makeCommand(buf, xs, ourparams, text, par);
+ return parnext;
+ }
+ case LATEX_ENVIRONMENT:
+ case LATEX_LIST_ENVIRONMENT:
+ case LATEX_ITEM_ENVIRONMENT:
+ // FIXME Same fix here.
+ return makeEnvironment(buf, xs, ourparams, text, par, parnext);
+ case LATEX_PARAGRAPH:
+ return makeParagraphs(buf, xs, ourparams, text, par, parnext);
+ case LATEX_BIB_ENVIRONMENT:
+ return makeParagraphBibliography(buf, xs, ourparams, text, par, parnext);
+ }
+
+ // This should never happen. Return the next paragraph to avoid an infinite loop.
+ return parnext;
+}
+
} // end anonymous namespace
@@ -883,7 +930,7 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type b
continue;
}
- if (par.layout().name() == from_ascii("Abstract"))
+ if (par.layout().docbookabstract())
hasAbstractLayout = true;
// Based on layout information, store this paragraph in one set: should be in <info>, must be.
@@ -908,7 +955,7 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type b
if (hasAbstractLayout) {
pit_type pit = bpit;
while (pit < cpit) { // Don't overshoot the <info> part.
- if (paragraphs[pit].layout().name() == from_ascii("Abstract"))
+ if (paragraphs[pit].layout().docbookabstract())
abstract.emplace(pit);
pit++;
}
@@ -953,17 +1000,22 @@ pit_type generateDocBookParagraphWithoutSectioning(
XMLStream & xs,
OutputParams const & runparams,
ParagraphList const & paragraphs,
- pit_type bpit,
- pit_type epit)
+ DocBookInfoTag const & info)
{
+ auto bpit = info.bpit;
auto par = paragraphs.iterator_at(bpit);
auto lastStartedPar = par;
ParagraphList::const_iterator send;
auto const pend =
- (epit == (int) paragraphs.size()) ?
- paragraphs.end() : paragraphs.iterator_at(epit);
+ (info.epit == (int) paragraphs.size()) ?
+ paragraphs.end() : paragraphs.iterator_at(info.epit);
+
+ while (bpit < info.epit) {
+ if (info.abstract.find(bpit) != info.abstract.end()) {
+ bpit += 1;
+ continue;
+ }
- while (bpit < epit) {
tie(par, send) = makeAny(text, buf, xs, runparams, par, send, pend);
bpit += distance(lastStartedPar, par);
lastStartedPar = par;
@@ -988,18 +1040,25 @@ void outputDocBookInfo(
bool hasAbstract = !info.abstract.empty();
docstring abstract;
if (hasAbstract) {
- pit_type bpitAbstract = *std::min_element(info.abstract.begin(), info.abstract.end());
- pit_type epitAbstract = *std::max_element(info.abstract.begin(), info.abstract.end());
-
odocstringstream os2;
- XMLStream xs2(os2);
- generateDocBookParagraphWithoutSectioning(text, buf, xs2, runparams, paragraphs, bpitAbstract, epitAbstract);
+ {
+ XMLStream xs2(os2);
+ auto bpit = *std::min_element(info.abstract.begin(), info.abstract.end());
+ auto epit = 1 + *std::max_element(info.abstract.begin(), info.abstract.end());
+ // info.abstract is inclusive, epit is exclusive, hence +1 for looping.
+
+ while (bpit < epit) {
+ makeAnySimple(text, buf, xs2, runparams, paragraphs.iterator_at(bpit));
+ xs2 << XMLStream::ESCAPE_NONE << from_ascii("<!-- " + to_string(bpit) + " -->");
+ bpit += 1;
+ }
+ }
// Actually output the abstract if there is something to do. Don't count line feeds or spaces in this,
// even though they must be properly output if there is some abstract.
- docstring abstractContent = os2.str();
+ abstract = os2.str();
static const lyx::regex reg("[ \\r\\n]*");
- abstractContent = from_utf8(lyx::regex_replace(to_utf8(abstractContent), reg, string("")));
+ docstring abstractContent = from_utf8(lyx::regex_replace(to_utf8(abstract), reg, string("")));
// Nothing? Then there is no abstract!
if (abstractContent.empty())
@@ -1016,19 +1075,29 @@ void outputDocBookInfo(
xs << xml::CR();
}
- // Output the elements that should go in <info>.
- generateDocBookParagraphWithoutSectioning(text, buf, xs, runparams, paragraphs, info.bpit, info.epit);
+ // Output the elements that should go in <info>, before and after the abstract.
+ xs << XMLStream::ESCAPE_NONE << "<!-- shouldBeInInfo -->";
+ for (auto pit : info.shouldBeInInfo) // Typically, the title: these elements are so important and ubiquitous
+ // that mandating a wrapper like <info> would repel users.
+ makeAnySimple(text, buf, xs, runparams, paragraphs.iterator_at(pit));
+ xs << XMLStream::ESCAPE_NONE << "<!-- mustBeInInfo -->";
+ for (auto pit : info.mustBeInInfo)
+ if (info.abstract.find(pit) == info.abstract.end()) // The abstract must be in info, but is dealt with after.
+ makeAnySimple(text, buf, xs, runparams, paragraphs.iterator_at(pit));
+ xs << XMLStream::ESCAPE_NONE << "<!-- /info -->";
- if (hasAbstract && !abstract.empty()) { // The second test is probably superfluous.
- string tag = paragraphs[*info.abstract.begin()].layout().docbookforceabstracttag();
- if (tag == "NONE")
- tag = "abstract";
-
- xs << xml::StartTag(tag);
- xs << xml::CR();
+ if (hasAbstract) {
+// string tag = paragraphs[*info.abstract.begin()].layout().docbookforceabstracttag();
+// if (tag == "NONE")
+// tag = "abstract";
+//
+// xs << xml::StartTag(tag);
+// xs << xml::CR();
+ xs << XMLStream::ESCAPE_NONE << "<!-- abs -->";
xs << XMLStream::ESCAPE_NONE << abstract;
- xs << xml::EndTag(tag);
- xs << xml::CR();
+ xs << XMLStream::ESCAPE_NONE << "<!-- /abs -->";
+// xs << xml::EndTag(tag);
+// xs << xml::CR();
}
// End the <info> tag if it was started.
@@ -1057,23 +1126,14 @@ void docbookFirstParagraphs(
}
-bool isParagraphEmpty(const Paragraph &par)
-{
- InsetList const &insets = par.insetList();
- size_t insetsLength = distance(insets.begin(), insets.end());
- bool hasParagraphOnlyNote = insetsLength == 1 && insets.get(0) && insets.get(0)->asInsetCollapsible() &&
- dynamic_cast<InsetNote *>(insets.get(0));
- return hasParagraphOnlyNote;
-}
-
-
void docbookSimpleAllParagraphs(
Text const & text,
Buffer const & buf,
XMLStream & xs,
OutputParams const & runparams)
{
- // Handle the document, supposing it has no sections (i.e. a "simple" document).
+ // Handle the given text, supposing it has no sections (i.e. a "simple" text). The input may vary in length
+ // between a single paragraph to a whole document.
// First, the <info> tag.
ParagraphList const ¶graphs = text.paragraphs();
@@ -1081,27 +1141,14 @@ void docbookSimpleAllParagraphs(
pit_type const epit = runparams.par_end;
DocBookInfoTag info = getParagraphsWithInfo(paragraphs, bpit, epit);
outputDocBookInfo(text, buf, xs, runparams, paragraphs, info);
- bpit = info.bpit;
-
- // Then, the content.
- ParagraphList::const_iterator const pend =
- (epit == (int) paragraphs.size()) ?
- paragraphs.end() : paragraphs.iterator_at(epit);
+ // Then, the content. It starts where the <info> ends.
+ bpit = info.epit;
while (bpit < epit) {
auto par = paragraphs.iterator_at(bpit);
- ParagraphList::const_iterator const lastStartedPar = par;
- ParagraphList::const_iterator send;
-
- if (isParagraphEmpty(*par)) {
- ++par;
- bpit += distance(lastStartedPar, par);
- continue;
- }
-
- // Generate this paragraph.
- tie(par, send) = makeAny(text, buf, xs, runparams, par, send, pend);
- bpit += distance(lastStartedPar, par);
+ if (!hasOnlyNotes(*par))
+ makeAnySimple(text, buf, xs, runparams, par);
+ bpit += 1;
}
}
@@ -1155,7 +1202,7 @@ void docbookParagraphs(Text const &text,
ParagraphList::const_iterator const lastStartedPar = par;
ParagraphList::const_iterator send;
- if (isParagraphEmpty(*par)) {
+ if (hasOnlyNotes(*par)) {
++par;
bpit += distance(lastStartedPar, par);
continue;
@@ -1250,4 +1297,4 @@ void docbookParagraphs(Text const &text,
}
}
-} // namespace lyx
+} // namespace lyx
\ No newline at end of file
commit 7b0f9d95248820bc70b820dd6b558de4a6713bae
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 2 20:43:39 2020 +0200
DocBook: simplify code to handle abstracts.
diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml
index 2c9f5bd..e15bfdd 100644
--- a/autotests/export/docbook/bibliography_precooked_aastex.xml
+++ b/autotests/export/docbook/bibliography_precooked_aastex.xml
@@ -19,8 +19,10 @@
<affiliation role="alternate"><orgname>Patron, Alonso's Bar and Grill</orgname></affiliation></author>
<abstract><para>
<para>This is a preliminary report on surface photometry of the major fraction of known globular clusters, to see which of them show the signs of a collapsed core. We also explore some diversionary mathematics and recreational tables. </para>
-<!-- Output Error: Tried to close `Keywords' when tag was not open. Tag discarded. -->
+<!-- Output Error: Tried to close `keyword' when tag was not open. Tag discarded. -->
+<!-- Output Error: Tried to close `keywordset' when tag was not open. Tag discarded. -->
+<keywordset><keyword>clusters: globular, peanutâbosons: bozos</keyword></keywordset>
<!-- Output Error: Closing tag `info' when other tags are open, namely: -->
<!-- Output Error: para -->
</para><!-- Output Error: abstract -->
diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout
index 445d25f..97c8b64 100644
--- a/lib/layouts/aastex.layout
+++ b/lib/layouts/aastex.layout
@@ -282,6 +282,9 @@ Style Abstract
Series Bold
Size Normal
EndFont
+ DocBookTag abstract
+ DocBookItemTag para
+ DocBookInInfo always
End
@@ -331,6 +334,9 @@ Style Keywords
Shape Italic
Size Normal
EndFont
+ DocBookTag keyword
+ DocBookWrapperTag keywordset
+ DocBookInInfo always
End
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index d0536ee..fd38940 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -50,7 +50,7 @@ namespace lyx {
namespace {
-std::string const fontToDocBookTag(xml::FontTypes type)
+std::string fontToDocBookTag(xml::FontTypes type)
{
switch (type) {
case xml::FontTypes::FT_EMPH:
@@ -90,6 +90,7 @@ std::string const fontToDocBookTag(xml::FontTypes type)
}
}
+
string fontToRole(xml::FontTypes type)
{
// Specific fonts are achieved with roles. The only common ones are "" for basic emphasis,
@@ -103,14 +104,13 @@ string fontToRole(xml::FontTypes type)
return "";
case xml::FontTypes::FT_BOLD:
return "bold";
- case xml::FontTypes::FT_NOUN:
- return ""; // Outputs a <person>
- case xml::FontTypes::FT_TYPE:
- return ""; // Outputs a <code>
+ case xml::FontTypes::FT_NOUN: // Outputs a <person>
+ case xml::FontTypes::FT_TYPE: // Outputs a <code>
+ return "";
case xml::FontTypes::FT_UBAR:
return "underline";
- // All other roles are non-standard for DocBook.
+ // All other roles are non-standard for DocBook.
case xml::FontTypes::FT_WAVE:
return "wave";
@@ -814,7 +814,21 @@ pair<ParagraphList::const_iterator, ParagraphList::const_iterator> makeAny(
using DocBookDocumentSectioning = tuple<bool, pit_type>;
-using DocBookInfoTag = tuple<set<pit_type>, set<pit_type>, pit_type, pit_type>;
+
+
+struct DocBookInfoTag
+{
+ const set<pit_type> shouldBeInInfo;
+ const set<pit_type> mustBeInInfo;
+ const set<pit_type> abstract;
+ pit_type bpit;
+ pit_type epit;
+
+ DocBookInfoTag(const set<pit_type> & shouldBeInInfo, const set<pit_type> & mustBeInInfo,
+ const set<pit_type> & abstract, pit_type bpit, pit_type epit) :
+ shouldBeInInfo(shouldBeInInfo), mustBeInInfo(mustBeInInfo), abstract(abstract),
+ bpit(bpit), epit(epit) {}
+};
DocBookDocumentSectioning hasDocumentSectioning(ParagraphList const ¶graphs, pit_type bpit, pit_type const epit) {
@@ -847,6 +861,7 @@ bool hasOnlyNotes(Paragraph const & par)
DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type bpit, pit_type const epit) {
set<pit_type> shouldBeInInfo;
set<pit_type> mustBeInInfo;
+ set<pit_type> abstract;
// Find the first non empty paragraph by mutating bpit.
while (bpit < epit) {
@@ -859,14 +874,18 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type b
// Find the last info-like paragraph.
pit_type cpit = bpit;
+ bool hasAbstractLayout = false;
while (cpit < epit) {
// Skip paragraphs only containing one note.
- Paragraph const &par = paragraphs[cpit];
+ Paragraph const & par = paragraphs[cpit];
if (hasOnlyNotes(par)) {
cpit += 1;
continue;
}
+ if (par.layout().name() == from_ascii("Abstract"))
+ hasAbstractLayout = true;
+
// Based on layout information, store this paragraph in one set: should be in <info>, must be.
Layout const &style = par.layout();
@@ -876,42 +895,55 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type b
shouldBeInInfo.emplace(cpit);
} else {
// Hypothesis: the <info> parts should be grouped together near the beginning bpit.
+ // There may be notes in between, but nothing else.
break;
}
cpit += 1;
}
// Now, cpit points to the last paragraph that has things that could go in <info>.
- // bpit is still the beginning of the <info> part.
-
- return make_tuple(shouldBeInInfo, mustBeInInfo, bpit, cpit);
-}
-
-
-bool hasAbstractBetween(ParagraphList const ¶graphs, pit_type const bpitAbstract, pit_type const epitAbstract)
-{
- // Hypothesis: the paragraphs between bpitAbstract and epitAbstract can be considered an abstract because they
- // are just after a document or part title.
- if (epitAbstract - bpitAbstract <= 0)
- return false;
-
- // If there is something between these paragraphs, check if it's compatible with an abstract (i.e. some text).
- pit_type bpit = bpitAbstract;
- while (bpit < epitAbstract) {
- const Paragraph &p = paragraphs.at(bpit);
-
- if (p.layout().name() == from_ascii("Abstract"))
- return true;
+ // bpit is the beginning of the <info> part.
+
+ // Go once again through the list of paragraphs to find the abstract. If there is an abstract
+ // layout, only consider it. Otherwise, an abstract is just a sequence of paragraphs with text.
+ if (hasAbstractLayout) {
+ pit_type pit = bpit;
+ while (pit < cpit) { // Don't overshoot the <info> part.
+ if (paragraphs[pit].layout().name() == from_ascii("Abstract"))
+ abstract.emplace(pit);
+ pit++;
+ }
+ } else {
+ pit_type lastAbstract = epit + 1; // A nonsensical value.
+ docstring lastAbstractLayout;
+
+ pit_type pit = bpit;
+ while (pit < cpit) { // Don't overshoot the <info> part.
+ const Paragraph & par = paragraphs.at(pit);
+ if (!par.insetList().empty()) {
+ for (const auto &i : par.insetList()) {
+ if (i.inset->getText(0) != nullptr) {
+ if (lastAbstract == epit + 1) {
+ // First paragraph that matches the heuristic definition of abstract.
+ lastAbstract = pit;
+ lastAbstractLayout = par.layout().name();
+ } else if (pit > lastAbstract + 1 || par.layout().name() != lastAbstractLayout) {
+ // This is either too far from the last abstract paragraph or doesn't
+ // have the right layout name, BUT there has already been an abstract
+ // in this document: done with detecting the abstract.
+ goto done; // Easier to get out of two nested loops.
+ }
- if (!p.insetList().empty()) {
- for (const auto &i : p.insetList()) {
- if (i.inset->getText(0) != nullptr) {
- return true;
+ abstract.emplace(pit);
+ break;
+ }
}
}
+ pit++;
}
- bpit++;
}
- return false;
+
+ done:
+ return DocBookInfoTag(shouldBeInInfo, mustBeInInfo, abstract, bpit, cpit);
}
@@ -947,26 +979,18 @@ void outputDocBookInfo(
XMLStream & xs,
OutputParams const & runparams,
ParagraphList const & paragraphs,
- DocBookInfoTag const & info,
- pit_type bpitAbstract,
- pit_type const epitAbstract)
+ DocBookInfoTag const & info)
{
- // Consider everything between bpitAbstract and epitAbstract (excluded) as paragraphs for the abstract.
- // Use bpitAbstract >= epitAbstract to indicate there is no abstract.
-
- set<pit_type> shouldBeInInfo;
- set<pit_type> mustBeInInfo;
- pit_type bpitInfo;
- pit_type epitInfo;
- tie(shouldBeInInfo, mustBeInInfo, bpitInfo, epitInfo) = info;
-
// Perform an additional check on the abstract. Sometimes, there are many paragraphs that should go
// into the abstract, but none generates actual content. Thus, first generate to a temporary stream,
// then only create the <abstract> tag if these paragraphs generate some content.
// This check must be performed *before* a decision on whether or not to output <info> is made.
- bool hasAbstract = hasAbstractBetween(paragraphs, bpitAbstract, epitAbstract);
+ bool hasAbstract = !info.abstract.empty();
docstring abstract;
if (hasAbstract) {
+ pit_type bpitAbstract = *std::min_element(info.abstract.begin(), info.abstract.end());
+ pit_type epitAbstract = *std::max_element(info.abstract.begin(), info.abstract.end());
+
odocstringstream os2;
XMLStream xs2(os2);
generateDocBookParagraphWithoutSectioning(text, buf, xs2, runparams, paragraphs, bpitAbstract, epitAbstract);
@@ -983,7 +1007,7 @@ void outputDocBookInfo(
}
// The abstract must go in <info>.
- bool needInfo = !mustBeInInfo.empty() || hasAbstract;
+ bool needInfo = !info.mustBeInInfo.empty() || hasAbstract;
// Start the <info> tag if required.
if (needInfo) {
@@ -993,10 +1017,10 @@ void outputDocBookInfo(
}
// Output the elements that should go in <info>.
- generateDocBookParagraphWithoutSectioning(text, buf, xs, runparams, paragraphs, bpitInfo, epitInfo);
+ generateDocBookParagraphWithoutSectioning(text, buf, xs, runparams, paragraphs, info.bpit, info.epit);
if (hasAbstract && !abstract.empty()) { // The second test is probably superfluous.
- string tag = paragraphs[bpitAbstract].layout().docbookforceabstracttag();
+ string tag = paragraphs[*info.abstract.begin()].layout().docbookforceabstracttag();
if (tag == "NONE")
tag = "abstract";
@@ -1029,7 +1053,7 @@ void docbookFirstParagraphs(
ParagraphList const ¶graphs = text.paragraphs();
pit_type bpit = runparams.par_begin;
DocBookInfoTag info = getParagraphsWithInfo(paragraphs, bpit, epit);
- outputDocBookInfo(text, buf, xs, runparams, paragraphs, info, get<3>(info), epit);
+ outputDocBookInfo(text, buf, xs, runparams, paragraphs, info);
}
@@ -1056,8 +1080,8 @@ void docbookSimpleAllParagraphs(
pit_type bpit = runparams.par_begin;
pit_type const epit = runparams.par_end;
DocBookInfoTag info = getParagraphsWithInfo(paragraphs, bpit, epit);
- outputDocBookInfo(text, buf, xs, runparams, paragraphs, info, 0, 0);
- bpit = get<3>(info); // Generate the content starting from the end of the <info> part.
+ outputDocBookInfo(text, buf, xs, runparams, paragraphs, info);
+ bpit = info.bpit;
// Then, the content.
ParagraphList::const_iterator const pend =
commit 0f145c3ef0828dc7e06ff839a3ececf66edf5be6
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 2 18:58:36 2020 +0200
DocBook: use DocBookWrapperMergeWithPrevious in the code.
diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml
index b663868..2c9f5bd 100644
--- a/autotests/export/docbook/bibliography_precooked_aastex.xml
+++ b/autotests/export/docbook/bibliography_precooked_aastex.xml
@@ -4,23 +4,27 @@
<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>Collapsed Cores in Globular Clusters, Gauge-Boson Couplings, and AASTeX Examples</title>
-<author><personname>S. Djorgovski and Ivan R. King</personname></author>
-<author><affiliation><orgname>Astronomy Department, University of California, Berkeley, CA 94720</orgname></affiliation></author>
-<author><affiliation role="alternate"><orgname>Visiting Astronomer Cerro Tololo Inter-American Observatory.CTIO is operated by AURA Inc. under contract to the National Science Foundation.</orgname></affiliation></author>
-<author><affiliation role="alternate"><orgname>Society of Fellows, Harvard University.</orgname></affiliation></author>
-<author><affiliation role="alternate"><orgname>present address: Center for Astrophysics60 Garden Street, Cambridge, MA 02138</orgname></affiliation></author>
-<author><personname>C. D. Biemesderfer</personname></author>
-<author><affiliation><orgname>National Optical Astronomy Observatories, Tucson, AZ 85719</orgname></affiliation></author>
-<author><affiliation role="alternate"><orgname>Visiting Programmer, Space Telescope Science Institute</orgname></affiliation></author>
-<author><affiliation role="alternate"><orgname>Patron, Alonso's Bar and Grill</orgname></affiliation></author>
-<author><email>aastex-help at aas.org</email></author>
-<author><personname>R. J. Hanisch</personname></author>
-<author><affiliation><orgname>Space Telescope Science Institute, Baltimore, MD 21218</orgname></affiliation></author>
-<author><affiliation role="alternate"><orgname>Patron, Alonso's Bar and Grill</orgname></affiliation></author>
+<author><personname>S. Djorgovski and Ivan R. King</personname>
+<affiliation><orgname>Astronomy Department, University of California, Berkeley, CA 94720</orgname></affiliation>
+<affiliation role="alternate"><orgname>Visiting Astronomer Cerro Tololo Inter-American Observatory.CTIO is operated by AURA Inc. under contract to the National Science Foundation.</orgname></affiliation>
+<affiliation role="alternate"><orgname>Society of Fellows, Harvard University.</orgname></affiliation>
+<affiliation role="alternate"><orgname>present address: Center for Astrophysics60 Garden Street, Cambridge, MA 02138</orgname></affiliation></author>
+<author><personname>C. D. Biemesderfer</personname>
+<affiliation><orgname>National Optical Astronomy Observatories, Tucson, AZ 85719</orgname></affiliation>
+<affiliation role="alternate"><orgname>Visiting Programmer, Space Telescope Science Institute</orgname></affiliation>
+<affiliation role="alternate"><orgname>Patron, Alonso's Bar and Grill</orgname></affiliation>
+<email>aastex-help at aas.org</email></author>
+<author><personname>R. J. Hanisch</personname>
+<affiliation><orgname>Space Telescope Science Institute, Baltimore, MD 21218</orgname></affiliation>
+<affiliation role="alternate"><orgname>Patron, Alonso's Bar and Grill</orgname></affiliation></author>
<abstract><para>
<para>This is a preliminary report on surface photometry of the major fraction of known globular clusters, to see which of them show the signs of a collapsed core. We also explore some diversionary mathematics and recreational tables. </para>
-</para></abstract>
-</info>
+<!-- Output Error: Tried to close `Keywords' when tag was not open. Tag discarded. -->
+
+<!-- Output Error: Closing tag `info' when other tags are open, namely: -->
+<!-- Output Error: para -->
+</para><!-- Output Error: abstract -->
+</abstract></info>
<section>
<title>Introduction</title>
<para>A focal problem today in the dynamics of globular clusters is core collapse. It has been predicted by theory for decades <biblioref endterm="hen61" />, <biblioref endterm="lyn68" />, <biblioref endterm="spi85" />, but observation has been less alert to the phenomenon. For many years the central brightness peak in M15 <biblioref endterm="kin75" />, <biblioref endterm="new78" /> seemed a unique anomaly. Then <biblioref endterm="aur82" /> suggested a central peak in NGC 6397, and a limited photographic survey of ours <biblioref endterm="djo84" /> found three more cases, including NGC 6624, whose sharp center had often been remarked on <biblioref endterm="can78" />. </para>
@@ -688,7 +692,8 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mtable>
</m:math>
</informalequation>
-</MathLetters>
+<!-- Output Error: Tried to close `title' when tag was not open. Tag discarded. -->
+
</section>
</section>
<section>
@@ -964,8 +969,9 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
</m:mrow>
</m:math>
</inlineequation> of the electronically submitted abstracts for AAS meetings are error-free. </para>
-<acknowledgement><para>We are grateful to V. Barger, T. Han, and R. J. N. Phillips for doing the math in section <xref linkend="bozomath" />. More information on the AASTeX macros package are available at <link xlink:href="http://www.aas.org/publications/aastex">http://www.aas.org/publications/aastex</link> or the <link xlink:href="ftp://www.aas.org/pubs/AAS ftp site">AAS ftp site</link>.</para></acknowledgement>
-<para><application>IRAF, AIPS, Astropy, ...</application></para>
+<acknowledgement><para>We are grateful to V. Barger, T. Han, and R. J. N. Phillips for doing the math in section <xref linkend="bozomath" />. More information on the AASTeX macros package are available at <link xlink:href="http://www.aas.org/publications/aastex">http://www.aas.org/publications/aastex</link> or the <link xlink:href="ftp://www.aas.org/pubs/AAS ftp site">AAS ftp site</link>.</para>
+<application>IRAF, AIPS, Astropy, ...</application><!-- Output Error: Tried to close `para' when tag was not open. Tag discarded. -->
+
<Appendix></Appendix>
<bibliography>
<bibliomixed xml:id='aur82'>Aurière, M. 1982, <!-- \aap -->, 109, 301 </bibliomixed>
diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout
index 5db7dee..445d25f 100644
--- a/lib/layouts/aastex.layout
+++ b/lib/layouts/aastex.layout
@@ -175,10 +175,11 @@ Style Affiliation
Family Roman
Size Normal
EndFont
- DocBookTag affiliation
- DocBookWrapperTag author
- DocBookItemTag orgname
- DocBookInInfo always
+ DocBookTag affiliation
+ DocBookWrapperTag author
+ DocBookWrapperMergeWithPrevious true
+ DocBookItemTag orgname
+ DocBookInInfo always
End
@@ -201,11 +202,12 @@ Style Altaffilation
LabelFont
Color green
EndFont
- DocBookTag affiliation
- DocBookAttr role="alternate"
- DocBookItemTag orgname
- DocBookWrapperTag author
- DocBookInInfo always
+ DocBookTag affiliation
+ DocBookAttr role="alternate"
+ DocBookWrapperTag author
+ DocBookWrapperMergeWithPrevious true
+ DocBookItemTag orgname
+ DocBookInInfo always
End
@@ -225,9 +227,10 @@ Style Email
Size Normal
Shape Italic
EndFont
- DocBookTag email
- DocBookWrapperTag author
- DocBookInInfo always
+ DocBookTag email
+ DocBookWrapperTag author
+ DocBookWrapperMergeWithPrevious true
+ DocBookInInfo always
End
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index a081b2d..d0536ee 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -189,11 +189,30 @@ namespace {
// convenience functions
-void openParTag(XMLStream & xs, Paragraph const & par)
+void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
{
- Layout const & lay = par.layout();
+ Layout const & lay = par->layout();
+
+ if (par == prevpar)
+ prevpar = nullptr;
+
+ // When should the wrapper be opened here? Only if the previous paragraph has the SAME wrapper tag
+ // (usually, they won't have the same layout) and the CURRENT one allows merging.
+ // The main use case is author information in several paragraphs: if the name of the author is the
+ // first paragraph of an author, then merging with the previous tag does not make sense. Say the
+ // next paragraph is the affiliation, then it should be output in the same <author> tag (different
+ // layout, same wrapper tag).
+ bool openWrapper = lay.docbookwrappertag() != "NONE";
+ if (prevpar != nullptr) {
+ Layout const & prevlay = prevpar->layout();
+ if (prevlay.docbookwrappertag() != "NONE") {
+ openWrapper = prevlay.docbookwrappertag() == lay.docbookwrappertag()
+ && !lay.docbookwrappermergewithprevious();
+ }
+ }
- if (lay.docbookwrappertag() != "NONE")
+ // Main logic.
+ if (openWrapper)
xs << xml::StartTag(lay.docbookwrappertag(), lay.docbookwrapperattr());
string tag = lay.docbooktag();
@@ -207,10 +226,24 @@ void openParTag(XMLStream & xs, Paragraph const & par)
}
-void closeTag(XMLStream & xs, Paragraph const & par)
+void closeTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpar)
{
- Layout const & lay = par.layout();
+ Layout const & lay = par->layout();
+
+ if (par == nextpar)
+ nextpar = nullptr;
+
+ // See comment in openParTag.
+ bool closeWrapper = lay.docbookwrappertag() != "NONE";
+ if (nextpar != nullptr) {
+ Layout const & nextlay = nextpar->layout();
+ if (nextlay.docbookwrappertag() != "NONE") {
+ closeWrapper = nextlay.docbookwrappertag() == lay.docbookwrappertag()
+ && !nextlay.docbookwrappermergewithprevious();
+ }
+ }
+ // Main logic.
if (lay.docbookitemtag() != "NONE")
xs << xml::EndTag(lay.docbookitemtag());
@@ -219,7 +252,7 @@ void closeTag(XMLStream & xs, Paragraph const & par)
tag = "para";
xs << xml::EndTag(tag);
- if (lay.docbookwrappertag() != "NONE")
+ if (closeWrapper)
xs << xml::EndTag(lay.docbookwrappertag());
}
@@ -399,9 +432,12 @@ ParagraphList::const_iterator makeParagraphs(
ParagraphList::const_iterator const & pbegin,
ParagraphList::const_iterator const & pend)
{
- ParagraphList::const_iterator const begin = text.paragraphs().begin();
+ auto const begin = text.paragraphs().begin();
+ auto const end = text.paragraphs().end();
ParagraphList::const_iterator par = pbegin;
- for (; par != pend; ++par) {
+ ParagraphList::const_iterator prevpar = pbegin;
+
+ for (; par != pend; prevpar = par, ++par) {
// We want to open the paragraph tag if:
// (i) the current layout permits multiple paragraphs
// (ii) we are either not already inside a paragraph (HTMLIsBlock) OR
@@ -417,7 +453,7 @@ ParagraphList::const_iterator makeParagraphs(
// because of branches, e.g., a branch that contains an entire new section.
// We do not really want to wrap that whole thing in a <div>...</div>.
bool special_case = false;
- Inset const *specinset = par->size() == 1 ? par->getInset(0) : 0;
+ Inset const *specinset = par->size() == 1 ? par->getInset(0) : nullptr;
if (specinset && !specinset->getLayout().htmlisblock()) { // TODO: Convert htmlisblock to a DocBook parameter?
Layout const &style = par->layout();
FontInfo const first_font = style.labeltype == LABEL_MANUAL ?
@@ -466,7 +502,7 @@ ParagraphList::const_iterator makeParagraphs(
// or we're not in the last paragraph, anyway.
// (ii) We didn't open it and docbook_in_par is true,
// but we are in the first par, and there is a next par.
- ParagraphList::const_iterator nextpar = par;
+ auto nextpar = par;
++nextpar;
bool const close_par =
((open_par && (!runparams.docbook_in_par || nextpar != pend))
@@ -484,12 +520,12 @@ ParagraphList::const_iterator makeParagraphs(
if (!cleaned.empty()) {
if (open_par)
- openParTag(xs, *par);
+ openParTag(xs, &*par, &*prevpar);
xs << XMLStream::ESCAPE_NONE << os2.str();
if (close_par) {
- closeTag(xs, *par);
+ closeTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
xs << xml::CR();
}
}
@@ -514,11 +550,24 @@ ParagraphList::const_iterator makeEnvironment(
ParagraphList::const_iterator const & pend)
{
auto const begin = text.paragraphs().begin();
+ auto const end = text.paragraphs().end();
ParagraphList::const_iterator par = pbegin;
depth_type const origdepth = pbegin->params().depth();
+ // Find the previous paragraph.
+ auto prevpar = begin;
+ if (prevpar != par) {
+ auto prevpar_next = prevpar;
+ ++prevpar_next;
+
+ while (prevpar_next != par) {
+ ++prevpar_next;
+ ++prevpar;
+ }
+ }
+
// open tag for this environment
- openParTag(xs, *par);
+ openParTag(xs, &*par, &*prevpar);
xs << xml::CR();
// we will on occasion need to remember a layout from before.
@@ -672,7 +721,9 @@ ParagraphList::const_iterator makeEnvironment(
xs << xml::CR();
}
}
- closeTag(xs, *par);
+ auto nextpar = par;
+ ++nextpar;
+ closeTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
xs << xml::CR();
return pend;
}
@@ -686,14 +737,30 @@ void makeCommand(
ParagraphList::const_iterator const & pbegin)
{
// No need for labels, as they are handled by DocBook tags.
+ auto const begin = text.paragraphs().begin();
+ auto const end = text.paragraphs().end();
+ auto nextpar = pbegin;
+ ++nextpar;
+
+ // Find the previous paragraph.
+ auto prevpar = begin;
+ if (prevpar != pbegin) {
+ auto prevpar_next = prevpar;
+ ++prevpar_next;
+
+ while (prevpar_next != pbegin) {
+ ++prevpar_next;
+ ++prevpar;
+ }
+ }
- openParTag(xs, *pbegin);
+ // Generate this command.
+ openParTag(xs, &*pbegin, &*prevpar);
- auto const begin = text.paragraphs().begin();
pbegin->simpleDocBookOnePar(buf, xs, runparams,
text.outerFont(distance(begin, pbegin)));
- closeTag(xs, *pbegin);
+ closeTag(xs, &*pbegin, (nextpar != end) ? &*nextpar : nullptr);
xs << xml::CR();
}
commit c92e0bc5e7b275e599caa50b40a3038ca27bff87
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 2 18:07:07 2020 +0200
DocBook: fix for ordering.
diff --git a/src/Layout.cpp b/src/Layout.cpp
index a7e80ea..eeb58d0 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -235,8 +235,8 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
{ "docbooksectiontag", LT_DOCBOOKSECTIONTAG },
{ "docbooktag", LT_DOCBOOKTAG },
{ "docbookwrapperattr", LT_DOCBOOKWRAPPERATTR },
- { "docbookwrappertag", LT_DOCBOOKWRAPPERTAG },
{ "docbookwrappermergewithprevious", LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS },
+ { "docbookwrappertag", LT_DOCBOOKWRAPPERTAG },
{ "end", LT_END },
{ "endlabelstring", LT_ENDLABELSTRING },
{ "endlabeltype", LT_ENDLABELTYPE },
commit 72c304a6297311086d8fe1a17622f7b79623d3bd
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 2 17:35:16 2020 +0200
DocBook: make openParTag/closeTag use paragraphs instead of layouts.
Not useful per se, but will be next with checking whether the wrapper tags should be opened/closed.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 2e7b637..a081b2d 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -189,8 +189,10 @@ namespace {
// convenience functions
-void openParTag(XMLStream & xs, Layout const & lay)
+void openParTag(XMLStream & xs, Paragraph const & par)
{
+ Layout const & lay = par.layout();
+
if (lay.docbookwrappertag() != "NONE")
xs << xml::StartTag(lay.docbookwrappertag(), lay.docbookwrapperattr());
@@ -205,8 +207,10 @@ void openParTag(XMLStream & xs, Layout const & lay)
}
-void closeTag(XMLStream & xs, Layout const & lay)
+void closeTag(XMLStream & xs, Paragraph const & par)
{
+ Layout const & lay = par.layout();
+
if (lay.docbookitemtag() != "NONE")
xs << xml::EndTag(lay.docbookitemtag());
@@ -294,8 +298,8 @@ ParagraphList::const_iterator findEndOfEnvironment(
ParagraphList::const_iterator const & pend)
{
ParagraphList::const_iterator p = pstart;
- Layout const &bstyle = p->layout();
size_t const depth = p->params().depth();
+
for (++p; p != pend; ++p) {
Layout const &style = p->layout();
// It shouldn't happen that e.g. a section command occurs inside
@@ -315,9 +319,10 @@ ParagraphList::const_iterator findEndOfEnvironment(
// FIXME I am not sure about the first check.
// Surely we *could* have different layouts that count as
// LATEX_PARAGRAPH, right?
- if (style.latextype == LATEX_PARAGRAPH || style != bstyle)
+ if (style.latextype == LATEX_PARAGRAPH || style != p->layout())
return p;
}
+
return pend;
}
@@ -397,8 +402,6 @@ ParagraphList::const_iterator makeParagraphs(
ParagraphList::const_iterator const begin = text.paragraphs().begin();
ParagraphList::const_iterator par = pbegin;
for (; par != pend; ++par) {
- Layout const &lay = par->layout();
-
// We want to open the paragraph tag if:
// (i) the current layout permits multiple paragraphs
// (ii) we are either not already inside a paragraph (HTMLIsBlock) OR
@@ -428,7 +431,7 @@ ParagraphList::const_iterator makeParagraphs(
}
// Plain layouts must be ignored.
- if (!special_case && buf.params().documentClass().isPlainLayout(lay) && !runparams.docbook_force_pars)
+ if (!special_case && buf.params().documentClass().isPlainLayout(par->layout()) && !runparams.docbook_force_pars)
special_case = true;
// TODO: Could get rid of this with a DocBook equivalent to htmlisblock?
if (!special_case && par->size() == 1 && par->getInset(0)) {
@@ -481,12 +484,12 @@ ParagraphList::const_iterator makeParagraphs(
if (!cleaned.empty()) {
if (open_par)
- openParTag(xs, lay);
+ openParTag(xs, *par);
xs << XMLStream::ESCAPE_NONE << os2.str();
if (close_par) {
- closeTag(xs, lay);
+ closeTag(xs, *par);
xs << xml::CR();
}
}
@@ -510,13 +513,12 @@ ParagraphList::const_iterator makeEnvironment(
ParagraphList::const_iterator const & pbegin,
ParagraphList::const_iterator const & pend)
{
- ParagraphList::const_iterator const begin = text.paragraphs().begin();
+ auto const begin = text.paragraphs().begin();
ParagraphList::const_iterator par = pbegin;
- Layout const &bstyle = par->layout();
depth_type const origdepth = pbegin->params().depth();
// open tag for this environment
- openParTag(xs, bstyle);
+ openParTag(xs, *par);
xs << xml::CR();
// we will on occasion need to remember a layout from before.
@@ -535,7 +537,7 @@ ParagraphList::const_iterator makeEnvironment(
// One is that we are still in the environment in which we
// started---which we will be if the depth is the same.
if (par->params().depth() == origdepth) {
- LATTEST(bstyle == style);
+ LATTEST(par->layout() == style);
if (lastlay != nullptr) {
closeItemTag(xs, *lastlay);
if (lastlay->docbookitemwrappertag() != "NONE") {
@@ -670,7 +672,7 @@ ParagraphList::const_iterator makeEnvironment(
xs << xml::CR();
}
}
- closeTag(xs, bstyle);
+ closeTag(xs, *par);
xs << xml::CR();
return pend;
}
@@ -683,16 +685,15 @@ void makeCommand(
Text const & text,
ParagraphList::const_iterator const & pbegin)
{
- Layout const &style = pbegin->layout();
-
// No need for labels, as they are handled by DocBook tags.
- openParTag(xs, style);
+ openParTag(xs, *pbegin);
- ParagraphList::const_iterator const begin = text.paragraphs().begin();
+ auto const begin = text.paragraphs().begin();
pbegin->simpleDocBookOnePar(buf, xs, runparams,
text.outerFont(distance(begin, pbegin)));
- closeTag(xs, style);
+
+ closeTag(xs, *pbegin);
xs << xml::CR();
}
commit c417253d0b07ba8d908a88351301fd6748977aee
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 2 17:28:50 2020 +0200
DocBook: use DocBookItemTag within paragraphs.
This is at least helpful for AAS, even though it slightly resembles a repurposition of that parameter.
diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml
index 37dada8..b663868 100644
--- a/autotests/export/docbook/bibliography_precooked_aastex.xml
+++ b/autotests/export/docbook/bibliography_precooked_aastex.xml
@@ -5,21 +5,21 @@
<info>
<title>Collapsed Cores in Globular Clusters, Gauge-Boson Couplings, and AASTeX Examples</title>
<author><personname>S. Djorgovski and Ivan R. King</personname></author>
-<author><affiliation>Astronomy Department, University of California, Berkeley, CA 94720</affiliation></author>
-<author><affiliation role="alternate">Visiting Astronomer Cerro Tololo Inter-American Observatory.CTIO is operated by AURA Inc. under contract to the National Science Foundation.</affiliation></author>
-<author><affiliation role="alternate">Society of Fellows, Harvard University.</affiliation></author>
-<author><affiliation role="alternate">present address: Center for Astrophysics60 Garden Street, Cambridge, MA 02138</affiliation></author>
+<author><affiliation><orgname>Astronomy Department, University of California, Berkeley, CA 94720</orgname></affiliation></author>
+<author><affiliation role="alternate"><orgname>Visiting Astronomer Cerro Tololo Inter-American Observatory.CTIO is operated by AURA Inc. under contract to the National Science Foundation.</orgname></affiliation></author>
+<author><affiliation role="alternate"><orgname>Society of Fellows, Harvard University.</orgname></affiliation></author>
+<author><affiliation role="alternate"><orgname>present address: Center for Astrophysics60 Garden Street, Cambridge, MA 02138</orgname></affiliation></author>
<author><personname>C. D. Biemesderfer</personname></author>
-<author><affiliation>National Optical Astronomy Observatories, Tucson, AZ 85719</affiliation></author>
-<author><affiliation role="alternate">Visiting Programmer, Space Telescope Science Institute</affiliation></author>
-<author><affiliation role="alternate">Patron, Alonso's Bar and Grill</affiliation></author>
+<author><affiliation><orgname>National Optical Astronomy Observatories, Tucson, AZ 85719</orgname></affiliation></author>
+<author><affiliation role="alternate"><orgname>Visiting Programmer, Space Telescope Science Institute</orgname></affiliation></author>
+<author><affiliation role="alternate"><orgname>Patron, Alonso's Bar and Grill</orgname></affiliation></author>
<author><email>aastex-help at aas.org</email></author>
<author><personname>R. J. Hanisch</personname></author>
-<author><affiliation>Space Telescope Science Institute, Baltimore, MD 21218</affiliation></author>
-<author><affiliation role="alternate">Patron, Alonso's Bar and Grill</affiliation></author>
-<abstract>
+<author><affiliation><orgname>Space Telescope Science Institute, Baltimore, MD 21218</orgname></affiliation></author>
+<author><affiliation role="alternate"><orgname>Patron, Alonso's Bar and Grill</orgname></affiliation></author>
+<abstract><para>
<para>This is a preliminary report on surface photometry of the major fraction of known globular clusters, to see which of them show the signs of a collapsed core. We also explore some diversionary mathematics and recreational tables. </para>
-</abstract>
+</para></abstract>
</info>
<section>
<title>Introduction</title>
diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout
index 275018a..5db7dee 100644
--- a/lib/layouts/aastex.layout
+++ b/lib/layouts/aastex.layout
@@ -155,6 +155,9 @@ Style Author
Series Medium
Shape SmallCaps
EndFont
+ DocBookTag personname
+ DocBookWrapperTag author
+ DocBookInInfo always
End
@@ -172,6 +175,10 @@ Style Affiliation
Family Roman
Size Normal
EndFont
+ DocBookTag affiliation
+ DocBookWrapperTag author
+ DocBookItemTag orgname
+ DocBookInInfo always
End
@@ -194,6 +201,11 @@ Style Altaffilation
LabelFont
Color green
EndFont
+ DocBookTag affiliation
+ DocBookAttr role="alternate"
+ DocBookItemTag orgname
+ DocBookWrapperTag author
+ DocBookInInfo always
End
@@ -213,6 +225,9 @@ Style Email
Size Normal
Shape Italic
EndFont
+ DocBookTag email
+ DocBookWrapperTag author
+ DocBookInInfo always
End
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 434148b..2e7b637 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -191,20 +191,25 @@ namespace {
void openParTag(XMLStream & xs, Layout const & lay)
{
- if (lay.docbookwrappertag() != "NONE") {
+ if (lay.docbookwrappertag() != "NONE")
xs << xml::StartTag(lay.docbookwrappertag(), lay.docbookwrapperattr());
- }
string tag = lay.docbooktag();
if (tag == "Plain Layout")
tag = "para";
xs << xml::ParTag(tag, lay.docbookattr());
+
+ if (lay.docbookitemtag() != "NONE")
+ xs << xml::StartTag(lay.docbookitemtag(), lay.docbookitemattr());
}
void closeTag(XMLStream & xs, Layout const & lay)
{
+ if (lay.docbookitemtag() != "NONE")
+ xs << xml::EndTag(lay.docbookitemtag());
+
string tag = lay.docbooktag();
if (tag == "Plain Layout")
tag = "para";
commit 1a09086ec2a1e83e29437f8ba7d4115ce60eac10
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 2 17:23:37 2020 +0200
Merge findLastParagraph and findLastBibliographyParagraph to lower code duplication.
Maybe these functions should move to ParagraphList.h/cpp?
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 5b788f3..434148b 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -266,10 +266,11 @@ inline void closeItemTag(XMLStream & xs, Layout const & lay)
// end of convenience functions
-ParagraphList::const_iterator findLastParagraph(
+ParagraphList::const_iterator findLast(
ParagraphList::const_iterator p,
- ParagraphList::const_iterator const & pend) {
- for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p);
+ ParagraphList::const_iterator const & pend,
+ LatexType type) {
+ for (++p; p != pend && p->layout().latextype == type; ++p);
return p;
}
@@ -644,11 +645,11 @@ ParagraphList::const_iterator makeEnvironment(
break;
}
case LATEX_PARAGRAPH:
- send = findLastParagraph(par, pend);
+ send = findLast(par, pend, LATEX_PARAGRAPH);
par = makeParagraphs(buf, xs, runparams, text, par, send);
break;
case LATEX_BIB_ENVIRONMENT:
- send = findLastBibliographyParagraph(par, pend);
+ send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
par = makeParagraphBibliography(buf, xs, runparams, text, par, send);
break;
case LATEX_COMMAND:
@@ -718,22 +719,19 @@ pair<ParagraphList::const_iterator, ParagraphList::const_iterator> makeAny(
}
case LATEX_ENVIRONMENT:
case LATEX_LIST_ENVIRONMENT:
- case LATEX_ITEM_ENVIRONMENT: {
+ case LATEX_ITEM_ENVIRONMENT:
// FIXME Same fix here.
send = findEndOfEnvironment(par, pend);
par = makeEnvironment(buf, xs, ourparams, text, par, send);
break;
- }
- case LATEX_BIB_ENVIRONMENT: {
- send = findLastBibliographyParagraph(par, pend);
- par = makeParagraphBibliography(buf, xs, ourparams, text, par, send);
- break;
- }
- case LATEX_PARAGRAPH: {
- send = findLastParagraph(par, pend);
+ case LATEX_PARAGRAPH:
+ send = findLast(par, pend, LATEX_PARAGRAPH);
par = makeParagraphs(buf, xs, ourparams, text, par, send);
break;
- }
+ case LATEX_BIB_ENVIRONMENT:
+ send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
+ par = makeParagraphBibliography(buf, xs, ourparams, text, par, send);
+ break;
}
return make_pair(par, send);
commit 4d78fe59577ab1f0aee03b4fe38bb76cdfec41be
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 2 17:17:25 2020 +0200
Slight code-consistency improvements.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 2199239..5b788f3 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -189,7 +189,7 @@ namespace {
// convenience functions
-void openParTag(XMLStream &xs, Layout const &lay)
+void openParTag(XMLStream & xs, Layout const & lay)
{
if (lay.docbookwrappertag() != "NONE") {
xs << xml::StartTag(lay.docbookwrappertag(), lay.docbookwrapperattr());
@@ -203,7 +203,7 @@ void openParTag(XMLStream &xs, Layout const &lay)
}
-void closeTag(XMLStream &xs, Layout const &lay)
+void closeTag(XMLStream & xs, Layout const & lay)
{
string tag = lay.docbooktag();
if (tag == "Plain Layout")
@@ -228,14 +228,14 @@ void closeLabelTag(XMLStream & xs, Layout const & lay)
}
-void openItemTag(XMLStream &xs, Layout const &lay)
+void openItemTag(XMLStream & xs, Layout const & lay)
{
xs << xml::StartTag(lay.docbookitemtag(), lay.docbookitemattr());
}
// Return true when new elements are output in a paragraph, false otherwise.
-bool openInnerItemTag(XMLStream &xs, Layout const &lay)
+bool openInnerItemTag(XMLStream & xs, Layout const & lay)
{
if (lay.docbookiteminnertag() != "NONE") {
xs << xml::CR();
@@ -249,7 +249,7 @@ bool openInnerItemTag(XMLStream &xs, Layout const &lay)
}
-void closeInnerItemTag(XMLStream &xs, Layout const &lay)
+void closeInnerItemTag(XMLStream & xs, Layout const & lay)
{
if (lay.docbookiteminnertag()!= "NONE") {
xs << xml::EndTag(lay.docbookiteminnertag());
@@ -258,7 +258,7 @@ void closeInnerItemTag(XMLStream &xs, Layout const &lay)
}
-inline void closeItemTag(XMLStream &xs, Layout const &lay)
+inline void closeItemTag(XMLStream & xs, Layout const & lay)
{
xs << xml::EndTag(lay.docbookitemtag());
xs << xml::CR();
commit ad18c194920fe8ed8f339ee5fc755e8f3473db51
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 2 17:07:38 2020 +0200
DocBook: add new layout parameter DocBookWrapperMergeWithPrevious.
diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index 60d4593..e69deba 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -11,7 +11,7 @@
# This script will update a .layout file to current format
# The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 82
+currentFormat = 83
# Incremented to format 4, 6 April 2007, lasgouttes
@@ -281,6 +281,9 @@ currentFormat = 82
# - Removed tag Header from ClassOptionsClassOptions
# - Removed tag Element for flex insets
+# Incremented to format 83, 2 August 2020 by dourouc05
+# New tag DocBookWrapperMergeWithPrevious
+
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
diff --git a/src/Layout.cpp b/src/Layout.cpp
index c45fd5c..a7e80ea 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -109,6 +109,7 @@ enum LayoutTags {
LT_DOCBOOKININFO,
LT_DOCBOOKWRAPPERTAG,
LT_DOCBOOKWRAPPERATTR,
+ LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS,
LT_DOCBOOKSECTIONTAG,
LT_DOCBOOKITEMWRAPPERTAG,
LT_DOCBOOKITEMWRAPPERATTR,
@@ -176,6 +177,7 @@ Layout::Layout()
htmllabelfirst_ = false;
htmlforcecss_ = false;
htmltitle_ = false;
+ docbookwrappermergewithprevious_ = false;
spellcheck = true;
forcelocal = 0;
itemcommand_ = "item";
@@ -234,6 +236,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
{ "docbooktag", LT_DOCBOOKTAG },
{ "docbookwrapperattr", LT_DOCBOOKWRAPPERATTR },
{ "docbookwrappertag", LT_DOCBOOKWRAPPERTAG },
+ { "docbookwrappermergewithprevious", LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS },
{ "end", LT_END },
{ "endlabelstring", LT_ENDLABELSTRING },
{ "endlabeltype", LT_ENDLABELTYPE },
@@ -743,6 +746,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
lex >> docbookwrapperattr_;
break;
+ case LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS:
+ lex >> docbookwrappermergewithprevious_;
+ break;
+
case LT_DOCBOOKSECTIONTAG:
lex >> docbooksectiontag_;
break;
@@ -1610,6 +1617,7 @@ void Layout::write(ostream & os) const
os << "\tDocBookItemWrapperTag " << docbookitemwrappertag_ << '\n';
if(!docbookitemwrapperattr_.empty())
os << "\tDocBookItemWrapperAttr " << docbookitemwrapperattr_ << '\n';
+ os << "\tDocBookItemWrapperMergeWithPrevious " << docbookwrappermergewithprevious_ << '\n';
if(!docbookitemlabeltag_.empty())
os << "\tDocBookItemLabelTag " << docbookitemlabeltag_ << '\n';
if(!docbookitemlabelattr_.empty())
diff --git a/src/Layout.h b/src/Layout.h
index 7e9409a..d9eb893 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -203,6 +203,8 @@ public:
///
std::string const & docbookwrapperattr() const;
///
+ bool docbookwrappermergewithprevious() const { return docbookwrappermergewithprevious_; }
+ ///
std::string const & docbooksectiontag() const;
///
std::string const & docbookitemwrappertag() const;
@@ -512,6 +514,8 @@ private:
mutable std::string docbookwrappertag_;
/// Roles to add to docbookwrappertag_, if any (default: none).
mutable std::string docbookwrapperattr_;
+ /// Whether this wrapper tag may be merged with the previously opened wrapper tag.
+ bool docbookwrappermergewithprevious_;
/// Outer tag for this section, only if this layout represent a sectionning item, including chapters (default: section).
mutable std::string docbooksectiontag_;
/// Whether this tag must/can/can't go into an <info> tag (default: never, as it only makes sense for metadata).
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 4cc5eba..469cfaf 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -62,7 +62,7 @@ namespace lyx {
// You should also run the development/tools/updatelayouts.py script,
// to update the format of all of our layout files.
//
-int const LAYOUT_FORMAT = 82; // dourouc05: DocBook additions.
+int const LAYOUT_FORMAT = 83; // tcuvelier: DocBookWrapperMergeWithPrevious.
// Layout format for the current lyx file format. Controls which format is
commit a852706bf07d9ee265754c639560a4346de623d8
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Aug 2 16:52:33 2020 +0200
DocBook: allow empty paragraphs before the <info> section.
diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml
index 89b1714..37dada8 100644
--- a/autotests/export/docbook/bibliography_precooked_aastex.xml
+++ b/autotests/export/docbook/bibliography_precooked_aastex.xml
@@ -3,6 +3,23 @@
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>Collapsed Cores in Globular Clusters, Gauge-Boson Couplings, and AASTeX Examples</title>
+<author><personname>S. Djorgovski and Ivan R. King</personname></author>
+<author><affiliation>Astronomy Department, University of California, Berkeley, CA 94720</affiliation></author>
+<author><affiliation role="alternate">Visiting Astronomer Cerro Tololo Inter-American Observatory.CTIO is operated by AURA Inc. under contract to the National Science Foundation.</affiliation></author>
+<author><affiliation role="alternate">Society of Fellows, Harvard University.</affiliation></author>
+<author><affiliation role="alternate">present address: Center for Astrophysics60 Garden Street, Cambridge, MA 02138</affiliation></author>
+<author><personname>C. D. Biemesderfer</personname></author>
+<author><affiliation>National Optical Astronomy Observatories, Tucson, AZ 85719</affiliation></author>
+<author><affiliation role="alternate">Visiting Programmer, Space Telescope Science Institute</affiliation></author>
+<author><affiliation role="alternate">Patron, Alonso's Bar and Grill</affiliation></author>
+<author><email>aastex-help at aas.org</email></author>
+<author><personname>R. J. Hanisch</personname></author>
+<author><affiliation>Space Telescope Science Institute, Baltimore, MD 21218</affiliation></author>
+<author><affiliation role="alternate">Patron, Alonso's Bar and Grill</affiliation></author>
+<abstract>
+<para>This is a preliminary report on surface photometry of the major fraction of known globular clusters, to see which of them show the signs of a collapsed core. We also explore some diversionary mathematics and recreational tables. </para>
+</abstract>
</info>
<section>
<title>Introduction</title>
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 5e15edc..2199239 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -764,15 +764,34 @@ DocBookDocumentSectioning hasDocumentSectioning(ParagraphList const ¶graphs,
}
-DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type const bpit, pit_type const epit) {
+bool hasOnlyNotes(Paragraph const & par)
+{
+ for (int i = 0; i < par.size(); ++i)
+ if (!par.isInset(i) || !dynamic_cast<InsetNote *>(par.insetList().get(i)))
+ return false;
+ return true;
+}
+
+
+DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type bpit, pit_type const epit) {
set<pit_type> shouldBeInInfo;
set<pit_type> mustBeInInfo;
+ // Find the first non empty paragraph by mutating bpit.
+ while (bpit < epit) {
+ Paragraph const &par = paragraphs[bpit];
+ if (par.empty() || hasOnlyNotes(par))
+ bpit += 1;
+ else
+ break;
+ }
+
+ // Find the last info-like paragraph.
pit_type cpit = bpit;
while (cpit < epit) {
// Skip paragraphs only containing one note.
Paragraph const &par = paragraphs[cpit];
- if (par.size() == 1 && dynamic_cast<InsetNote*>(paragraphs[cpit].insetList().get(0))) {
+ if (hasOnlyNotes(par)) {
cpit += 1;
continue;
}
commit 7470305720d7733a27e9c6e5ef13a0774f5d0f77
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Sat Sep 19 08:58:35 2020 +0200
de.po
diff --git a/po/de.po b/po/de.po
index 8128523..caaf17d 100644
--- a/po/de.po
+++ b/po/de.po
@@ -94,8 +94,8 @@ msgid ""
msgstr ""
"Project-Id-Version: LyX 2.4git\n"
"Report-Msgid-Bugs-To: lyx-devel at lists.lyx.org\n"
-"POT-Creation-Date: 2020-09-03 08:52+0200\n"
-"PO-Revision-Date: 2020-09-03 08:53+0200\n"
+"POT-Creation-Date: 2020-09-19 08:54+0200\n"
+"PO-Revision-Date: 2020-09-19 08:58+0200\n"
"Last-Translator: Jürgen Spitzmüller <spitz at lyx.org>\n"
"Language-Team: Deutsch <lyx-docs at lists.lyx.org>\n"
"Language: de\n"
@@ -2365,8 +2365,8 @@ msgstr "Input"
msgid "Verbatim"
msgstr "Unformatiert"
-#: src/frontends/qt/ui/IncludeUi.ui:61 src/insets/InsetInclude.cpp:1420
-#: src/insets/InsetInclude.cpp:1426
+#: src/frontends/qt/ui/IncludeUi.ui:61 src/insets/InsetInclude.cpp:1422
+#: src/insets/InsetInclude.cpp:1428
msgid "Program Listing"
msgstr "Programmlisting"
@@ -3607,7 +3607,7 @@ msgstr "&Doppelseitiges Dokument"
msgid "Line &spacing"
msgstr "Zeilen&abstand"
-#: src/frontends/qt/ui/ParagraphUi.ui:60 src/Text.cpp:1990
+#: src/frontends/qt/ui/ParagraphUi.ui:60 src/Text.cpp:2035
#: src/frontends/qt/GuiDocument.cpp:870
msgid "Single"
msgstr "Einfach"
@@ -3616,7 +3616,7 @@ msgstr "Einfach"
msgid "1.5"
msgstr "1,5"
-#: src/frontends/qt/ui/ParagraphUi.ui:70 src/Text.cpp:1996
+#: src/frontends/qt/ui/ParagraphUi.ui:70 src/Text.cpp:2041
#: src/frontends/qt/GuiDocument.cpp:874
msgid "Double"
msgstr "Doppelt"
@@ -4152,16 +4152,16 @@ msgstr ""
msgid "Search &drive for cited files"
msgstr "Suche auf &Festplatte nach zitierten Dateien"
-#: src/frontends/qt/ui/PrefEditUi.ui:128
+#: src/frontends/qt/ui/PrefEditUi.ui:144
msgid "Patte&rn:"
msgstr "&Suchmuster:"
-#: src/frontends/qt/ui/PrefEditUi.ui:138
+#: src/frontends/qt/ui/PrefEditUi.ui:154
msgid "Define search pattern (see UserGuide for syntax)"
msgstr ""
"Definiert das Suchmuster (die Syntax ist im Benutzerhandbuch erläutert)"
-#: src/frontends/qt/ui/PrefEditUi.ui:151 src/LyXRC.cpp:3090
+#: src/frontends/qt/ui/PrefEditUi.ui:167 src/LyXRC.cpp:3098
msgid ""
"Configure the width of the text cursor. Automatic zoom-controlled cursor "
"width used when set to 0."
@@ -4170,55 +4170,55 @@ msgstr ""
"wird die Cursorbreite automatisch und in Abhängigkeit vom Zoom-Faktor "
"eingestellt."
-#: src/frontends/qt/ui/PrefEditUi.ui:154
+#: src/frontends/qt/ui/PrefEditUi.ui:170
msgid "Cursor width (&pixels):"
msgstr "Dicke des Cursors (&Pixel):"
-#: src/frontends/qt/ui/PrefEditUi.ui:182
+#: src/frontends/qt/ui/PrefEditUi.ui:198
msgid "Skip trailing non-word characters"
msgstr ""
"Ãberspringe Zeichen, die nicht zu einem Wort gehören (Interpunktion etc.)"
-#: src/frontends/qt/ui/PrefEditUi.ui:185
+#: src/frontends/qt/ui/PrefEditUi.ui:201
msgid "Use M&ac-style cursor movement"
msgstr "Cursor-Navigation im &Mac-Stil"
-#: src/frontends/qt/ui/PrefEditUi.ui:192
+#: src/frontends/qt/ui/PrefEditUi.ui:208
msgid "&Group environments by their category"
msgstr "Absatzlayouts nach &Kategorien gruppieren"
-#: src/frontends/qt/ui/PrefEditUi.ui:202
+#: src/frontends/qt/ui/PrefEditUi.ui:218
msgid "Fullscreen"
msgstr "Vollbild"
-#: src/frontends/qt/ui/PrefEditUi.ui:220
-msgid "&Hide toolbars"
-msgstr "&Werkzeugleisten verstecken"
-
-#: src/frontends/qt/ui/PrefEditUi.ui:227
+#: src/frontends/qt/ui/PrefEditUi.ui:230
msgid "Hide &menubar"
msgstr "Menüleiste &verstecken"
-#: src/frontends/qt/ui/PrefEditUi.ui:234
+#: src/frontends/qt/ui/PrefEditUi.ui:237
msgid "Hide scr&ollbar"
msgstr "S&crollbar verstecken"
-#: src/frontends/qt/ui/PrefEditUi.ui:254
+#: src/frontends/qt/ui/PrefEditUi.ui:260
msgid "Hide sta&tusbar"
msgstr "Sta&tusleiste verstecken"
-#: src/frontends/qt/ui/PrefEditUi.ui:261
+#: src/frontends/qt/ui/PrefEditUi.ui:267
msgid "H&ide tabbar"
msgstr "&Unterfensterleiste verstecken"
-#: src/frontends/qt/ui/PrefEditUi.ui:270
+#: src/frontends/qt/ui/PrefEditUi.ui:305
msgid "&Limit text width"
msgstr "Begrenze Te&xtbreite"
-#: src/frontends/qt/ui/PrefEditUi.ui:277
+#: src/frontends/qt/ui/PrefEditUi.ui:328
msgid "Screen used (pi&xels):"
msgstr "Benutzter &Bildschirmbereich (Pixel):"
+#: src/frontends/qt/ui/PrefEditUi.ui:375
+msgid "&Hide toolbars"
+msgstr "&Werkzeugleisten verstecken"
+
#: src/frontends/qt/ui/PrefFileformatsUi.ui:46
msgid "&New..."
msgstr "&Neu..."
@@ -4541,7 +4541,7 @@ msgstr ""
msgid "&Mark additional languages"
msgstr "Z&usätzliche Sprachen markieren"
-#: src/frontends/qt/ui/PrefLanguageUi.ui:199 src/LyXRC.cpp:3218
+#: src/frontends/qt/ui/PrefLanguageUi.ui:199 src/LyXRC.cpp:3226
msgid ""
"Select to use the current keyboard language, as set from the operating "
"system, as default input language."
@@ -4741,7 +4741,7 @@ msgstr "Weitere Optionen"
msgid "Output &line length:"
msgstr "&Zeilenlänge der Ausgabe:"
-#: src/frontends/qt/ui/PrefOutputUi.ui:186 src/LyXRC.cpp:3029
+#: src/frontends/qt/ui/PrefOutputUi.ui:186 src/LyXRC.cpp:3037
msgid ""
"The maximum line length of exported plain text/LaTeX/SGML files. If set to "
"0, paragraphs are output in a single line; if the line length is > 0, "
@@ -7301,8 +7301,7 @@ msgstr "IEEE Transactions"
#: lib/layouts/simplecv.layout:18 lib/layouts/slides.layout:61
#: lib/layouts/stdclass.inc:28 lib/layouts/stdinsets.inc:649
#: lib/layouts/stdletter.inc:12 lib/layouts/svcommon.inc:26
-#: lib/layouts/tufte-book.layout:35 lib/ui/stdtoolbars.inc:75
-#: src/insets/InsetRef.cpp:578
+#: lib/layouts/tufte-book.layout:35 src/insets/InsetRef.cpp:586
msgid "Standard"
msgstr "Standard"
@@ -12074,7 +12073,7 @@ msgstr ""
"Gleichungsnummer die Abschnittsnummer voran, bspw. '(2.1)'."
#: lib/layouts/eqs-within-sections.module:17 lib/layouts/scrbook.layout:27
-#: lib/layouts/stdcounters.inc:81 src/insets/InsetRef.cpp:579
+#: lib/layouts/stdcounters.inc:81 src/insets/InsetRef.cpp:587
#: src/mathed/InsetMathRef.cpp:246
msgid "Equation"
msgstr "Gleichung"
@@ -19502,19 +19501,19 @@ msgid "Copy as Reference|R"
msgstr "Als Querverweis kopieren|k"
#: lib/ui/stdcontext.inc:61 lib/ui/stdcontext.inc:354 lib/ui/stdmenus.inc:108
-#: lib/ui/stdtoolbars.inc:86 src/Text3.cpp:1536
+#: lib/ui/stdtoolbars.inc:86 src/Text3.cpp:1544
#: src/mathed/InsetMathNest.cpp:560
msgid "Cut"
msgstr "Ausschneiden"
#: lib/ui/stdcontext.inc:62 lib/ui/stdcontext.inc:355 lib/ui/stdmenus.inc:109
-#: lib/ui/stdtoolbars.inc:87 src/Text3.cpp:1541
+#: lib/ui/stdtoolbars.inc:87 src/Text3.cpp:1549
#: src/mathed/InsetMathNest.cpp:569
msgid "Copy"
msgstr "Kopieren"
#: lib/ui/stdcontext.inc:63 lib/ui/stdcontext.inc:356 lib/ui/stdmenus.inc:110
-#: lib/ui/stdtoolbars.inc:88 src/Text3.cpp:1481
+#: lib/ui/stdtoolbars.inc:88 src/Text3.cpp:1489
#: src/frontends/qt/GuiToolbar.cpp:420 src/mathed/InsetMathGrid.cpp:1586
#: src/mathed/InsetMathNest.cpp:539
msgid "Paste"
@@ -21405,6 +21404,10 @@ msgstr "Sweave|S"
msgid "XY-pic|X"
msgstr "XY-Pic|X"
+#: lib/ui/stdtoolbars.inc:75
+msgid "Standard[[toolbar]]"
+msgstr "Standard"
+
#: lib/ui/stdtoolbars.inc:77
msgid "New document"
msgstr "Neues Dokument"
@@ -27103,7 +27106,7 @@ msgstr ""
"Bitte installieren Sie beide Pakete oder definieren Sie \\lyxadded und "
"\\lyxdeleted im LaTeX-Vorspann neu."
-#: src/Buffer.cpp:1089 src/BufferParams.cpp:469 src/frontends/qt/GuiLog.cpp:247
+#: src/Buffer.cpp:1089 src/BufferParams.cpp:471 src/frontends/qt/GuiLog.cpp:247
#: src/insets/InsetIndex.cpp:642
msgid "Index"
msgstr "Stichwortverzeichnis"
@@ -27709,7 +27712,7 @@ msgstr "Dokument %1$s neu geladen."
msgid "Could not reload document %1$s."
msgstr "Kann Dokument %1$s nicht neu laden."
-#: src/BufferParams.cpp:524
+#: src/BufferParams.cpp:526
msgid ""
"The LaTeX package amsmath is only used if AMS formula types or symbols from "
"the AMS math toolbars are inserted into formulas"
@@ -27717,7 +27720,7 @@ msgstr ""
"Die AMS-LaTeX-Pakete werden nur verwendet, wenn Symbole der AMS-"
"Werkzeugleisten in Formeln eingefügt werden"
-#: src/BufferParams.cpp:526
+#: src/BufferParams.cpp:528
msgid ""
"The LaTeX package amssymb is only used if symbols from the AMS math toolbars "
"are inserted into formulas"
@@ -27725,7 +27728,7 @@ msgstr ""
"Das AMS-Symb-Paket wird nur verwendet, wenn Symbole der AMS-Werkzeugleisten "
"in Formeln eingefügt werden"
-#: src/BufferParams.cpp:528
+#: src/BufferParams.cpp:530
msgid ""
"The LaTeX package cancel is only used if \\cancel commands are used in "
"formulas"
@@ -27733,7 +27736,7 @@ msgstr ""
"Das LaTeX-Paket 'cancel' wird nur verwendet, wenn der Befehl \\cancel in "
"Formeln eingefügt wird"
-#: src/BufferParams.cpp:530
+#: src/BufferParams.cpp:532
msgid ""
"The LaTeX package esint is only used if special integral symbols are "
"inserted into formulas"
@@ -27741,7 +27744,7 @@ msgstr ""
"Das LaTeX-Paket 'esint' wird nur verwendet, wenn spezielle Integralzeichen "
"in Formeln eingefügt werden"
-#: src/BufferParams.cpp:532
+#: src/BufferParams.cpp:534
msgid ""
"The LaTeX package mathdots is only used if the command \\iddots is inserted "
"into formulas"
@@ -27749,7 +27752,7 @@ msgstr ""
"Das LaTeX-Paket 'mathdots' wird nur verwendet, wenn der Befehl \\iddots in "
"Formeln eingefügt wird"
-#: src/BufferParams.cpp:534
+#: src/BufferParams.cpp:536
msgid ""
"The LaTeX package mathtools is only used if some mathematical relations are "
"inserted into formulas"
@@ -27757,7 +27760,7 @@ msgstr ""
"Das LaTeX-Paket mathtools wird nur verwendet, wenn mathematische Relationen "
"in Formeln eingefügt werden"
-#: src/BufferParams.cpp:536
+#: src/BufferParams.cpp:538
msgid ""
"The LaTeX package mhchem is only used if either the command \\ce or \\cf is "
"inserted into formulas"
@@ -27765,7 +27768,7 @@ msgstr ""
"Das LaTeX-Paket 'mhchem' wird nur verwendet, wenn entweder der Befehl \\ce "
"oder \\cf in Formeln eingefügt wird"
-#: src/BufferParams.cpp:538
+#: src/BufferParams.cpp:540
msgid ""
"The LaTeX package stackrel is only used if the command \\stackrel with "
"subscript is inserted into formulas"
@@ -27773,7 +27776,7 @@ msgstr ""
"Das LaTeX-Paket 'stackrel' wird nur verwendet, wenn der Befehl \\stackrel "
"mit Tiefstellung in Formeln eingefügt wird"
-#: src/BufferParams.cpp:540
+#: src/BufferParams.cpp:542
msgid ""
"The LaTeX package stmaryrd is only used if symbols from the St Mary's Road "
"symbol font for theoretical computer science are inserted into formulas"
@@ -27781,7 +27784,7 @@ msgstr ""
"Das Stmaryrd-Paket wird nur verwendet, wenn Symbole des St.-Mary's-Road-"
"Symbolzeichensatzes für theoretische Informatik in Formeln eingefügt werden"
-#: src/BufferParams.cpp:542
+#: src/BufferParams.cpp:544
msgid ""
"The LaTeX package undertilde is only used if you use the math frame "
"decoration 'utilde'"
@@ -27789,7 +27792,7 @@ msgstr ""
"Das LaTeX-Paket undertilde wird nur verwendet, wenn die Mathe Rahmen-"
"Verzierung 'utilde' verwendet wird"
-#: src/BufferParams.cpp:747
+#: src/BufferParams.cpp:749
#, c-format
msgid ""
"The selected document class\n"
@@ -27812,11 +27815,11 @@ msgstr ""
"In Abschnitt 3.1.2.2 des Benutzerhandbuchs\n"
"finden Sie weitere Hilfe."
-#: src/BufferParams.cpp:756
+#: src/BufferParams.cpp:758
msgid "Document class not available"
msgstr "Die Dokumentklasse ist nicht verfügbar"
-#: src/BufferParams.cpp:1751 src/BufferParams.cpp:2194 src/Encoding.cpp:253
+#: src/BufferParams.cpp:1753 src/BufferParams.cpp:2196 src/Encoding.cpp:253
#: src/Paragraph.cpp:2870 src/frontends/qt/LaTeXHighlighter.cpp:122
#: src/insets/InsetCommandParams.cpp:510 src/insets/InsetCommandParams.cpp:518
#: src/insets/InsetGraphics.cpp:885 src/insets/InsetGraphics.cpp:893
@@ -27826,7 +27829,7 @@ msgstr "Die Dokumentklasse ist nicht verfügbar"
msgid "LyX Warning: "
msgstr "LyX-Warnung: "
-#: src/BufferParams.cpp:1752 src/BufferParams.cpp:2195 src/Encoding.cpp:254
+#: src/BufferParam