mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
DocBook: ensure to have paragraphs in <sidebar>.
This commit is contained in:
parent
30572880ba
commit
6843bc5a38
196
autotests/export/docbook/boxes_para.lyx
Normal file
196
autotests/export/docbook/boxes_para.lyx
Normal file
@ -0,0 +1,196 @@
|
||||
#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 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@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 Chapter
|
||||
Introduction
|
||||
\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
|
||||
|
||||
\begin_layout Standard
|
||||
It is possible to set up cross-references between the different files.
|
||||
First, open all the files in question: let's call them A and B in a two
|
||||
file example, where B is included in A.
|
||||
Let's say you insert a label in A, then want to reference it in B.
|
||||
Open the cross-reference dialog whilst in document B, and you can select
|
||||
the
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
buffer
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
to use.
|
||||
\end_layout
|
||||
|
||||
\end_body
|
||||
\end_document
|
17
autotests/export/docbook/boxes_para.xml
Normal file
17
autotests/export/docbook/boxes_para.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?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>Additional LyX Features</title>
|
||||
<chapter>
|
||||
<title>Introduction</title>
|
||||
<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>
|
||||
|
||||
<para>It is possible to set up cross-references between the different files. First, open all the files in question: let's call them A and B in a two file example, where B is included in A. Let's say you insert a label in A, then want to reference it in B. Open the cross-reference dialog whilst in document B, and you can select the “buffer” to use.</para>
|
||||
</section>
|
||||
</chapter>
|
||||
</book>
|
@ -718,14 +718,24 @@ int InsetBox::plaintext(odocstringstream & os,
|
||||
|
||||
void InsetBox::docbook(XMLStream & xs, OutputParams const & runparams) const
|
||||
{
|
||||
if (!getLayout().docbookwrappertag().empty()) {
|
||||
// There really should be a wrapper tag for this layout.
|
||||
bool hasBoxTag = !getLayout().docbookwrappertag().empty();
|
||||
if (!hasBoxTag)
|
||||
LYXERR0("Assertion failed: box layout " + getLayout().name() + " missing DocBookWrapperTag.");
|
||||
|
||||
// Avoid nesting boxes in DocBook, it's not allowed. Only make the check for <sidebar> to avoid destroying
|
||||
// tags if this is not the wrapper tag for this layout (unlikely).
|
||||
bool isAlreadyInBox = hasBoxTag && xs.isTagOpen(xml::StartTag(getLayout().docbookwrappertag()));
|
||||
|
||||
bool outputBoxTag = hasBoxTag && !isAlreadyInBox;
|
||||
|
||||
// Generate the box tag (typically, <sidebar>).
|
||||
if (outputBoxTag) {
|
||||
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.");
|
||||
}
|
||||
|
||||
// If the box starts with a sectioning item, use as box title.
|
||||
@ -735,16 +745,22 @@ void InsetBox::docbook(XMLStream & xs, OutputParams const & runparams) const
|
||||
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.
|
||||
// Elements in the box must keep their paragraphs.
|
||||
auto rp = runparams;
|
||||
rp.docbook_in_par = false;
|
||||
rp.docbook_force_pars = true;
|
||||
|
||||
xs.startDivision(false);
|
||||
while (current_par != paragraphs().end())
|
||||
current_par = makeAny(text(), buffer(), xs, runparams, current_par);
|
||||
current_par = makeAny(text(), buffer(), xs, rp, current_par);
|
||||
xs.endDivision();
|
||||
|
||||
if (!getLayout().docbookwrappertag().empty()) {
|
||||
// Close the box.
|
||||
if (outputBoxTag) {
|
||||
if (!xs.isLastTagCR())
|
||||
xs << xml::CR();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user