From c6937cece975ddfbe6b30f1cc85f3aa891d07dad Mon Sep 17 00:00:00 2001 From: Thibaut Cuvelier Date: Sun, 2 Aug 2020 16:52:33 +0200 Subject: [PATCH] DocBook: allow empty paragraphs before the section. --- .../docbook/bibliography_precooked_aastex.xml | 17 ++++++++++++++ src/output_docbook.cpp | 23 +++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml index 89b1714bfe..37dada807b 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 -->
+Collapsed Cores in Globular Clusters, Gauge-Boson Couplings, and AASTeX Examples +S. Djorgovski and Ivan R. King +Astronomy Department, University of California, Berkeley, CA 94720 +Visiting Astronomer Cerro Tololo Inter-American Observatory.CTIO is operated by AURA Inc. under contract to the National Science Foundation. +Society of Fellows, Harvard University. +present address: Center for Astrophysics60 Garden Street, Cambridge, MA 02138 +C. D. Biemesderfer +National Optical Astronomy Observatories, Tucson, AZ 85719 +Visiting Programmer, Space Telescope Science Institute +Patron, Alonso's Bar and Grill +aastex-help@aas.org +R. J. Hanisch +Space Telescope Science Institute, Baltimore, MD 21218 +Patron, Alonso's Bar and Grill + +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. +
Introduction diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index 5e15edcee9..2199239f89 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(par.insetList().get(i))) + return false; + return true; +} + + +DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs, pit_type bpit, pit_type const epit) { set shouldBeInInfo; set 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(paragraphs[cpit].insetList().get(0))) { + if (hasOnlyNotes(par)) { cpit += 1; continue; } -- 2.39.5