DocBook: add DocBookSection parameter for styles that define new sections and implement argument parameters; improve Springer support.

For elements that should behave like sections (for now, mostly prefaces).

A second paragraph of PartBacktext can only wreak havok: it should start a section, and nothing else (otherwise, it's a real nightmare to implement).
This commit is contained in:
Thibaut Cuvelier 2020-10-21 14:54:25 +02:00
parent cc1d3b78c9
commit 149e1ccc02
15 changed files with 586 additions and 37 deletions

View File

@ -12,6 +12,8 @@
<dedication>
<para>A quotation or a dedication<indexterm><primary>dedication</primary></indexterm> at the very beginning of your book.</para>
</dedication>
</abstract>
</info>
<para>The foreword covers introductory remarks preceding the text of a book that are written by a <emphasis>person other than the author or editor of the book. If applicable, the foreword precedes the preface which is written by the author or editor of the book.</emphasis></para>
<!-- \vspace{\baselineskip} -->
@ -51,30 +53,6 @@
</listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry>
<term>BABI</term>
<listitem>
<para>Spelled-out abbreviation and definition</para>
</listitem>
</varlistentry>
<varlistentry>
<term>CABR</term>
<listitem>
<para>Spelled-out abbreviation and definition</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry>
<term>CABR</term>
<listitem>
<para>Spelled-out abbreviation and definition</para>
</listitem>
</varlistentry>
</variablelist>
</abstract>
</info>
<section>
<PartBacktext>
Part title page and, if desired, a short introductory text (maximum one page) on its verso page

View File

@ -0,0 +1,401 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 599
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass svmono
\begin_preamble
\usepackage{type1cm}
\usepackage{multicol} % used for the two-column index
\usepackage[bottom]{footmisc} % places footnotes at page bottom
%\makeindex % used for the subject index
% please use the style svind.ist with
% your makeindex program
\end_preamble
\options graybox,envcountchap,sectrefs
\use_default_options false
\maintain_unincluded_children no
\language english
\language_package default
\inputencoding utf8
\fontencoding auto
\font_roman "times" "default"
\font_sans "helvet" "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 true
\pdf_bookmarks true
\pdf_bookmarksnumbered true
\pdf_bookmarksopen true
\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 Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 2
\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 Author
Author name(s)
\end_layout
\begin_layout Title
Book title
\end_layout
\begin_layout Front Matter
\end_layout
\begin_layout Standard
\begin_inset Note Note
status open
\begin_layout Preface
\end_layout
\begin_layout Plain Layout
A preface
\begin_inset Index idx
status open
\begin_layout Plain Layout
preface
\end_layout
\end_inset
is a book's preliminary statement, usually written by the
\shape italic
author or editor
\shape default
of a work, which states its origin, scope, purpose, plan, and intended
audience, and which sometimes includes afterthoughts and acknowledgments
of assistance.
\end_layout
\end_inset
\end_layout
\begin_layout Main Matter
\end_layout
\begin_layout Standard
\end_layout
\begin_layout PartBacktext
\noindent
\begin_inset Argument 1
status open
\begin_layout Plain Layout
Part Title
\end_layout
\end_inset
Part title page and, if desired, a short introductory text (maximum one
page) on its verso page.
\end_layout
\begin_layout Chapter
Chapter Heading
\begin_inset CommandInset label
LatexCommand label
name "chap:intro"
\end_inset
\end_layout
\begin_layout Running Chapter
chapter heading in the running head
\begin_inset Note Note
status open
\begin_layout Plain Layout
optional
\end_layout
\end_inset
\end_layout
\begin_layout Abstract*
Each chapter should be preceded by an abstract (1015 lines long) that summarize
s the content.
The abstract will appear
\shape italic
online
\shape default
at
\begin_inset Flex URL
status collapsed
\begin_layout Plain Layout
www.SpringerLink.com
\end_layout
\end_inset
and be available with unrestricted access.
This allows unregistered users to read the abstract as a teaser for the
complete chapter.
As a general rule the abstracts will not appear in the printed version
of your book unless it is the style of your particular book or that of
the series to which your book belongs.
\begin_inset Newline newline
\end_inset
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
indent
\end_layout
\end_inset
Please use the 'starred' version of the
\family typewriter
abstract
\family default
environment for typesetting the text of the online abstracts.
Use the plain
\family typewriter
abstract
\family default
if the abstract is also to appear in the printed version of the book.
\end_layout
\begin_layout Abstract
Each chapter should be preceded by an abstract (1015 lines long) that summarize
s the content.
The abstract will appear
\shape italic
online
\shape default
at
\begin_inset Flex URL
status collapsed
\begin_layout Plain Layout
www.SpringerLink.com
\end_layout
\end_inset
and be available with unrestricted access.
This allows unregistered users to read the abstract as a teaser for the
complete chapter.
As a general rule the abstracts will not appear in the printed version
of your book unless it is the style of your particular book or that of
the series to which your book belongs.
\begin_inset Newline newline
\end_inset
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
indent
\end_layout
\end_inset
Please use the 'starred' version of the
\family typewriter
abstract
\family default
environment for typesetting the text of the online abstracts.
Use the plain
\family typewriter
abstract
\family default
if the abstract is also to appear in the printed version of the book.
\end_layout
\begin_layout Section
Section Heading
\begin_inset CommandInset label
LatexCommand label
name "sec:Section-Heading"
\end_inset
\end_layout
\begin_layout Running Section
section heading in the running head
\begin_inset Note Note
status open
\begin_layout Plain Layout
optional
\end_layout
\end_inset
\end_layout
\begin_layout Standard
bla
\end_layout
\begin_layout Section
Section Heading 2
\begin_inset CommandInset label
LatexCommand label
name "sec:Section-Heading-2"
\end_inset
\end_layout
\begin_layout Standard
Instead of simply listing headings of different levels we recommend to let
every heading be followed by at least a short passage of text.
\end_layout
\begin_layout Standard
Use the standard
\family sans
equation
\family default
environment to typeset your equations, e.g.
\begin_inset Formula
\begin{equation}
a\times b=c\;,
\end{equation}
\end_inset
however, for multiline equations we recommend to use the
\family sans
eqnarray
\family default
environment
\begin_inset Foot
status open
\begin_layout Plain Layout
In physics texts please activate the class option
\family typewriter
vecphys
\family default
to depict your vectors in
\series bold
\shape italic
boldface-italic
\series default
type - as is customary for a wide range of physical subjects.
\end_layout
\end_inset
.
\begin_inset Formula
\begin{eqnarray}
a\times b & = & c\nonumber \\
\vec{a}\cdot\vec{b} & = & c\label{eq:01}
\end{eqnarray}
\end_inset
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,88 @@
<?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>Book title</title>
<author>
<personname>Author name(s)</personname>
</author>
</info>
<part>
<!-- par --><title>Part Title</title>
Part title page and, if desired, a short introductory text (maximum one page) on its verso page.</part>
<chapter xml:id="chap.intro">
<title>Chapter Heading</title>
</chapter>
<titleabbrev>chapter heading in the running head</titleabbrev>
<abstract role='not-printed'>
<para>Each chapter should be preceded by an abstract (1015 lines long) that summarizes the content. The abstract will appear <emphasis>online at <link xlink:href="www.SpringerLink.com">www.SpringerLink.com</link> and be available with unrestricted access. This allows unregistered users to read the abstract as a teaser for the complete chapter. As a general rule the abstracts will not appear in the printed version of your book unless it is the style of your particular book or that of the series to which your book belongs.</emphasis><!-- \indent -->
Please use the 'starred' version of the <code>abstract</code> environment for typesetting the text of the online abstracts. Use the plain <code>abstract</code> if the abstract is also to appear in the printed version of the book.</para>
</abstract>
<abstract>
<para>Each chapter should be preceded by an abstract (1015 lines long) that summarizes the content. The abstract will appear <emphasis>online at <link xlink:href="www.SpringerLink.com">www.SpringerLink.com</link> and be available with unrestricted access. This allows unregistered users to read the abstract as a teaser for the complete chapter. As a general rule the abstracts will not appear in the printed version of your book unless it is the style of your particular book or that of the series to which your book belongs.</emphasis><!-- \indent -->
Please use the 'starred' version of the <code>abstract</code> environment for typesetting the text of the online abstracts. Use the plain <code>abstract</code> if the abstract is also to appear in the printed version of the book.</para>
</abstract>
<section xml:id="sec.Section-Heading">
<title>Section Heading</title>
</section>
<titleabbrev>section heading in the running head</titleabbrev>
<para>bla</para>
<section xml:id="sec.Section-Heading-2">
<title>Section Heading 2</title>
<para>Instead of simply listing headings of different levels we recommend to let every heading be followed by at least a short passage of text.</para>
<para>Use the standard <emphasis role='sans'>equation</emphasis> environment to typeset your equations, e.g.
<informalequation>
<alt role='tex'>a\times b=c\;,</alt>
<m:math>
<m:mrow>
<m:mrow><m:mi>a</m:mi><m:mo>&#x00D7;</m:mo><m:mi>b</m:mi><m:mo>=</m:mo><m:mi>c</m:mi><m:mspace width="10px" /><m:mo>,</m:mo>
</m:mrow>
</m:mrow>
</m:math>
</informalequation>
however, for multiline equations we recommend to use the <emphasis role='sans'>eqnarray</emphasis> environment<footnote>
<para>In physics texts please activate the class option <code>vecphys</code> to depict your vectors in <emphasis role='bold'><emphasis>boldface-italic</emphasis> type - as is customary for a wide range of physical subjects.</emphasis></para>
</footnote>.
<informalequation xml:id="eq.01">
<alt role='tex'>a\times b &amp; = &amp; c\nonumber \\
\vec{a}\cdot\vec{b} &amp; = &amp; c\label{eq:01}
</alt>
<m:math>
<m:mtable>
<m:mtr>
<m:mtd>
<m:mrow><m:mi>a</m:mi><m:mo>&#x00D7;</m:mo><m:mi>b</m:mi>
</m:mrow>
</m:mtd>
<m:mtd><m:mo>=</m:mo>
</m:mtd>
<m:mtd><m:mi>c</m:mi>
</m:mtd>
</m:mtr>
<m:mtr>
<m:mtd>
<m:mrow>
<m:mover>
<m:mrow><m:mi>a</m:mi>
</m:mrow><m:mo stretchy="true">&#x2192;</m:mo>
</m:mover><m:mo>&#x22C5;</m:mo>
<m:mover>
<m:mrow><m:mi>b</m:mi>
</m:mrow><m:mo stretchy="true">&#x2192;</m:mo>
</m:mover>
</m:mrow>
</m:mtd>
<m:mtd><m:mo>=</m:mo>
</m:mtd>
<m:mtd><m:mi>c</m:mi>
</m:mtd>
</m:mtr>
</m:mtable>
</m:math>
</informalequation>
</para>
</section>
</book>

View File

@ -19,7 +19,7 @@
# see http://www.springer.com/authors for class files and further instructions
Format 85
Format 86
PageStyle Plain
@ -147,14 +147,19 @@ Style PartBacktext
Argument 1
Mandatory 1
LabelString "Part Title"
Tooltip "Title of this part"
Tooltip "Title of this part"
IsTocCaption 1
DocBookTag title
EndArgument
Preamble
\newenvironment{svmultpartbacktext}[1]{\begin{partbacktext}
\part{#1}}{\end{partbacktext}}
EndPreamble
HTMLTag h1
DocBookTag NONE
DocBookSection true
DocBookSectionTag part
# A second paragraph of PartBacktext can only wreak havok: it should start a section, and nothing else (otherwise, it's a real nightmare to implement). This ought to be enough for now, even though the document cannot be valid.
End
Style Chapter
@ -426,12 +431,15 @@ Style Running_Title
LatexName titlerunning
InTitle 1
LabelString "Running title:"
DocBookTag titleabbrev
DocBookTagType paragraph
End
Style Running_Author
CopyStyle Running_Title
LatexName authorrunning
LabelString "Running author:"
DocBookTag NONE # Still TODO
End
Style Running_Chapter
@ -440,12 +448,17 @@ Style Running_Chapter
InTitle 0
LatexName chaptermark
LabelString "Running chapter:"
DocBookTag titleabbrev
DocBookTagType paragraph
DocBookSection false
End
Style Running_Section
CopyStyle Running_Chapter
LatexName sectionmark
LabelString "Running section:"
DocBookTag titleabbrev
DocBookTagType paragraph
End
Style Abstract
@ -567,12 +580,10 @@ Style Foreword
Series Bold
Size Huge
EndFont
HTMLTag h1
DocBookTag para
DocBookTag title
DocBookTagType paragraph
DocBookWrapperTag preface
DocBookWrapperTagType block
DocBookWrapperMergeWithPrevious true
DocBookSection true
DocBookSectionTag preface
End
Style Preface
@ -587,6 +598,10 @@ Style Preface
LabelString "Preface"
LabelSep xx
Align Left
DocBookTag title
DocBookTagType paragraph
DocBookSection true
DocBookSectionTag preface
End
Style Acknowledgement

View File

@ -8,10 +8,11 @@
# Class and style files and templates are found at:
# http://wiki.lyx.org/Examples/Springer
#
Format 85
Format 86
Input svcommon.inc
TocDepth 2
DocBookRoot book
ClassOptions
FontSize 10

View File

@ -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 = 85
currentFormat = 86
# Incremented to format 4, 6 April 2007, lasgouttes
@ -292,6 +292,10 @@ currentFormat = 85
# Incremented to format 85, 7 October 2020 by tcuvelier
# New tags DocBookInnerTag, DocBookInnerAttr,
# DocBookInnerTagType
# Incremented to format 86, 20 October 2020 by tcuvelier
# New tag DocBookSection.
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").

View File

@ -117,6 +117,7 @@ enum LayoutTags {
LT_DOCBOOKWRAPPERATTR,
LT_DOCBOOKWRAPPERTAGTYPE,
LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS,
LT_DOCBOOKSECTION,
LT_DOCBOOKSECTIONTAG,
LT_DOCBOOKITEMWRAPPERTAG,
LT_DOCBOOKITEMWRAPPERATTR,
@ -190,6 +191,7 @@ Layout::Layout()
htmltitle_ = false;
docbookabstract_ = false;
docbookwrappermergewithprevious_ = false;
docbooksection_ = false;
spellcheck = true;
forcelocal = 0;
itemcommand_ = "item";
@ -253,6 +255,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
{ "docbookitemwrapperattr", LT_DOCBOOKITEMWRAPPERATTR },
{ "docbookitemwrappertag", LT_DOCBOOKITEMWRAPPERTAG },
{ "docbookitemwrappertagtype", LT_DOCBOOKITEMWRAPPERTAGTYPE },
{ "docbooksection", LT_DOCBOOKSECTION },
{ "docbooksectiontag", LT_DOCBOOKSECTIONTAG },
{ "docbooktag", LT_DOCBOOKTAG },
{ "docbooktagtype", LT_DOCBOOKTAGTYPE },
@ -797,6 +800,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
lex >> docbookwrappermergewithprevious_;
break;
case LT_DOCBOOKSECTION:
lex >> docbooksection_;
break;
case LT_DOCBOOKSECTIONTAG:
lex >> docbooksectiontag_;
break;
@ -1261,6 +1268,15 @@ void Layout::readArgument(Lexer & lex, bool validating)
} else if (tok == "freespacing") {
lex.next();
arg.free_spacing = lex.getBool();
} else if (tok == "docbooktag") {
lex.next();
arg.docbooktag = lex.getDocString();
} else if (tok == "docbookattr") {
lex.next();
arg.docbookattr = lex.getDocString();
} else if (tok == "docbooktagtype") {
lex.next();
arg.docbooktagtype = lex.getDocString();
} else {
lex.printError("Unknown tag");
error = true;
@ -1672,6 +1688,7 @@ void Layout::write(ostream & os) const
os << "\tDocBookWrapperAttr " << docbookwrapperattr_ << '\n';
if(!docbookwrappertagtype_.empty())
os << "\tDocBookWrapperTagType " << docbookwrappertagtype_ << '\n';
os << "\tDocBookSection " << docbooksection_ << '\n';
if(!docbooksectiontag_.empty())
os << "\tDocBookSectionTag " << docbooksectiontag_ << '\n';
if(!docbookitemtag_.empty())

View File

@ -112,6 +112,9 @@ public:
bool is_toc_caption = false;
bool free_spacing = false;
std::string newlinecmd;
docstring docbooktag;
docstring docbooktagtype;
docstring docbookattr;
};
///
typedef std::map<std::string, latexarg> LaTeXArgMap;
@ -219,6 +222,8 @@ public:
///
std::string const & docbooksectiontag() const;
///
bool docbooksection() const { return docbooksection_; }
///
std::string const & docbookitemwrappertag() const;
///
std::string const & docbookitemwrapperattr() const;
@ -557,6 +562,8 @@ private:
/// Outer tag for this section, only if this layout represent a sectionning item, including chapters
/// (default: section).
mutable std::string docbooksectiontag_;
/// Whether this element should be considered as a section-level element in DocBook.
bool docbooksection_;
/// 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_;
/// Wehther this paragraph should be considered as abstract.

View File

@ -59,7 +59,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 = 85; // tcuvelier: DocBookInnerTag.
int const LAYOUT_FORMAT = 86; // tcuvelier: DocBookSection.
// Layout format for the current lyx file format. Controls which format is

View File

@ -27,6 +27,7 @@
#include "TexRow.h"
#include "texstream.h"
#include "TocBackend.h"
#include "xml.h"
#include "support/convert.h"
#include "support/debug.h"
@ -122,6 +123,9 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype, bool
pass_thru_chars_ = (*lait).second.pass_thru_chars;
newline_cmd_ = (*lait).second.newlinecmd;
free_spacing_ = (*lait).second.free_spacing;
docbooktag_ = (*lait).second.docbooktag;
docbooktagtype_ = (*lait).second.docbooktagtype;
docbookattr_ = (*lait).second.docbookattr;
pass_thru_local_ = false;
if (lait->second.is_toc_caption) {
is_toc_caption_ = true;
@ -307,6 +311,17 @@ InsetLayout::InsetDecoration InsetArgument::decoration() const
}
void InsetArgument::docbook(XMLStream & xs, OutputParams const & rp) const {
if (docbooktag_ != from_ascii("NONE")) {
// TODO: implement docbooktagtype_.
xs << xml::StartTag(docbooktag_, docbookattr_);
InsetText::docbook(xs, rp);
xs << xml::EndTag(docbooktag_);
xs << xml::CR();
}
}
void InsetArgument::latexArgument(otexstream & os,
OutputParams const & runparams_in, docstring const & ldelim,
docstring const & rdelim, docstring const & presetarg) const

View File

@ -54,7 +54,7 @@ public:
///
int plaintext(odocstringstream &, OutputParams const &, size_t) const override { return 0; }
///
void docbook(XMLStream &, OutputParams const &) const override { return; }
void docbook(XMLStream & xs, OutputParams const &) const override;
///
docstring xhtml(XMLStream &, OutputParams const &) const override
{ return docstring(); }
@ -125,6 +125,12 @@ private:
std::string caption_of_toc_;
/// Specific line break macro
std::string newline_cmd_;
/// DocBook tag for this argument, if any (otherwise, NONE).
docstring docbooktag_;
/// Type of DocBook tag (controls how new lines are inserted around this argument).
docstring docbooktagtype_;
/// DocBook attributes.
docstring docbookattr_;
protected:
/// \name Protected functions inherited from Inset class

View File

@ -1103,6 +1103,7 @@ void InsetInclude::docbook(XMLStream & xs, OutputParams const & rp) const
op.par_begin = 0;
op.par_end = 0;
op.inInclude = true;
op.docbook_in_par = false;
ibuf->writeDocBookSource(xs.os(), op, Buffer::IncludedFile);
} else {
xs << XMLStream::ESCAPE_NONE << "<!-- Included file: ";

View File

@ -44,7 +44,8 @@ InsetLayout::InsetLayout() :
forceownlines_(false), needprotect_(false), needcprotect_(false),
needmboxprotect_(false), intoc_(false), spellcheck_(true),
resetsfont_(false), display_(true), forcelocalfontswitch_(false),
add_to_toc_(false), is_toc_caption_(false), edit_external_(false)
add_to_toc_(false), is_toc_caption_(false), edit_external_(false),
docbooksection_(false)
{
labelfont_.setColor(Color_error);
}
@ -111,6 +112,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass,
IL_DOCBOOKTAG,
IL_DOCBOOKTAGTYPE,
IL_DOCBOOKATTR,
IL_DOCBOOKSECTION,
IL_DOCBOOKWRAPPERTAG,
IL_DOCBOOKWRAPPERTAGTYPE,
IL_DOCBOOKWRAPPERATTR,
@ -159,6 +161,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass,
{ "decoration", IL_DECORATION },
{ "display", IL_DISPLAY },
{ "docbookattr", IL_DOCBOOKATTR },
{ "docbooksection", IL_DOCBOOKSECTION },
{ "docbooktag", IL_DOCBOOKTAG },
{ "docbooktagtype", IL_DOCBOOKTAGTYPE },
{ "docbookwrapperattr", IL_DOCBOOKWRAPPERATTR },
@ -513,6 +516,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass,
case IL_DOCBOOKATTR:
lex >> docbookattr_;
break;
case IL_DOCBOOKSECTION:
lex >> docbooksection_;
break;
case IL_DOCBOOKWRAPPERTAG:
lex >> docbookwrappertag_;
break;

View File

@ -154,6 +154,8 @@ public:
///
std::string docbookattr() const { return docbookattr_; }
///
bool docbooksection() const { return docbooksection_; }
///
std::string docbookwrappertag() const { return docbookwrappertag_; }
///
std::string docbookwrappertagtype() const { return docbookwrappertagtype_; }
@ -293,6 +295,8 @@ private:
///
std::string docbookattr_;
///
bool docbooksection_;
///
std::string docbookwrappertag_;
///
std::string docbookwrappertagtype_;

View File

@ -718,7 +718,7 @@ void makeCommand(
bool isLayoutSectioning(Layout const & lay)
{
return lay.category() == from_utf8("Sectioning");
return lay.docbooksection() || lay.category() == from_utf8("Sectioning");
}
@ -766,6 +766,12 @@ bool hasOnlyNotes(Paragraph const & par)
// return false.
if (!par.isInset(i) || par.getInset(i)->lyxCode() != NOTE_CODE)
return false;
// An empty paragraph may still require some output.
if (par.layout().docbooksection())
return false;
// There should be really no content here.
return true;
}