diff --git a/autotests/export/docbook/Development.xml b/autotests/export/docbook/Development.xml index 85834595c8..9f3f3e990d 100644 --- a/autotests/export/docbook/Development.xml +++ b/autotests/export/docbook/Development.xml @@ -50,6 +50,7 @@ + New inset @@ -71,9 +72,7 @@ If a style or inset layout is removed in any layout file or module shipped with LyX, a new file format is required. - - - + However, new layouts and modules do not require a file format update (changed 03/16). If you are still unsure, please ask on the development list.
@@ -109,6 +108,7 @@ + LyX + LaTeX: @@ -173,6 +173,7 @@ + LyX + LaTeX + postprocessing: @@ -195,6 +196,7 @@ + not tested: @@ -303,9 +305,6 @@ - - -
diff --git a/autotests/export/docbook/description_list_nested.xml b/autotests/export/docbook/description_list_nested.xml index c08bec4a06..fc50c2cf6f 100644 --- a/autotests/export/docbook/description_list_nested.xml +++ b/autotests/export/docbook/description_list_nested.xml @@ -25,8 +25,8 @@ - - + + New inset diff --git a/autotests/export/docbook/labeling_list_nested.lyx b/autotests/export/docbook/labeling_list_nested.lyx new file mode 100644 index 0000000000..b948fee6b0 --- /dev/null +++ b/autotests/export/docbook/labeling_list_nested.lyx @@ -0,0 +1,150 @@ +#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 scrartcl +\options BCOR8mm,captions=tableheading +\use_default_options false +\begin_modules +logicalmkup +\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 1 +\bibtex_command default +\index_command default +\paperfontsize 12 +\spacing single +\use_hyperref true +\pdf_title "LyX's Development manual" +\pdf_author "LyX Team" +\pdf_subject "LyX's development documentation" +\pdf_keywords "LyX, Documentation, Development" +\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 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 4 +\tocdepth 4 +\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 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 +Developing \SpecialChar LyX + +\end_layout + +\begin_layout Standard +The following output formats are currently tested for each sample document: +\end_layout + +\begin_layout Labeling +\labelwidthstring 00.00.0000 +LyX: +\end_layout + +\begin_deeper +\begin_layout Labeling +\labelwidthstring 00.00.0000 +lyx16 LyX 1.6 file format (lyx2lyx) +\end_layout + +\begin_layout Labeling +\labelwidthstring 00.00.0000 +lyx21 +\end_layout + +\end_deeper +\begin_layout Labeling +\labelwidthstring 00.00.0000 +LyX: +\end_layout + +\begin_deeper +\begin_layout Labeling +\labelwidthstring 00.00.0000 +lyx16 LyX 1.6 file format (lyx2lyx) +\end_layout + +\begin_layout Labeling +\labelwidthstring 00.00.0000 +lyx21 +\end_layout + +\end_deeper +\end_body +\end_document diff --git a/autotests/export/docbook/labeling_list_nested.xml b/autotests/export/docbook/labeling_list_nested.xml new file mode 100644 index 0000000000..261605c4d9 --- /dev/null +++ b/autotests/export/docbook/labeling_list_nested.xml @@ -0,0 +1,56 @@ + + +
+Developing LyX +The following output formats are currently tested for each sample document: + + +LyX: + + + + + +lyx16 + + + LyX 1.6 file format (lyx2lyx) + + + +lyx21 + + + + + + + + + +LyX: + + + + + +lyx16 + + + LyX 1.6 file format (lyx2lyx) + + + +lyx21 + + + + + + + + + + +
\ No newline at end of file diff --git a/autotests/export/docbook/lists.xml b/autotests/export/docbook/lists.xml index ae956c54f8..a00ab4f633 100644 --- a/autotests/export/docbook/lists.xml +++ b/autotests/export/docbook/lists.xml @@ -30,4 +30,5 @@ Text after second item + \ No newline at end of file diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index 9c34115f00..489230d5cc 100644 --- a/src/output_docbook.cpp +++ b/src/output_docbook.cpp @@ -508,10 +508,8 @@ ParagraphList::const_iterator makeEnvironment( if (par->params().depth() == origdepth) { LATTEST(bstyle == style); if (lastlay != nullptr) { - xs << XMLStream::ESCAPE_NONE << (""); closeItemTag(xs, *lastlay); if (lastlay->docbookitemwrappertag() != "NONE") { - xs << XMLStream::ESCAPE_NONE << ""; xs << xml::EndTag(lastlay->docbookitemwrappertag()); xs << xml::CR(); } @@ -561,13 +559,35 @@ ParagraphList::const_iterator makeEnvironment( } } // 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; - par->simpleDocBookOnePar(buf, xs, rp, text.outerFont(distance(begin, par)), true, true, sep); + // 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. + 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 . + xs << ' '; + } else { + // Generate the rest of the paragraph, if need be. + par->simpleDocBookOnePar(buf, xs, rp, text.outerFont(distance(begin, par)), true, true, sep); + } + ++par; if (getsIntoParagraph) closeInnerItemTag(xs, style); @@ -613,8 +633,13 @@ ParagraphList::const_iterator makeEnvironment( } } - if (lastlay != 0) + if (lastlay != nullptr) { closeItemTag(xs, *lastlay); + if (lastlay->docbookitemwrappertag() != "NONE") { + xs << xml::EndTag(lastlay->docbookitemwrappertag()); + xs << xml::CR(); + } + } closeTag(xs, bstyle); xs << xml::CR(); return pend; @@ -731,10 +756,6 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type c // Based on layout information, store this paragraph in one set: should be in , must be. Layout const &style = par.layout(); - std::cout << "Name: " << to_utf8(style.name()) << std::endl; - std::cout << " DocBook tag: " << style.docbooktag() << std::endl; - std::cout << " In info: " << style.docbookininfo() << std::endl; - if (style.docbookininfo() == "always") { mustBeInInfo.emplace(cpit); } else if (style.docbookininfo() == "maybe") { @@ -796,14 +817,11 @@ pit_type generateDocBookParagraphWithoutSectioning( (epit == (int) paragraphs.size()) ? paragraphs.end() : paragraphs.iterator_at(epit); - std::cout << "generateDocBookParagraphWithoutSectioning" << std::endl; while (bpit < epit) { - std::cout << "iteration; bpit: " << bpit << std::endl; tie(par, send) = makeAny(text, buf, xs, runparams, par, send, pend); bpit += distance(lastStartedPar, par); lastStartedPar = par; } - std::cout << "generateDocBookParagraphWithoutSectioning has looped; bpit: " << bpit << std::endl; return bpit; }