Revert "DocBook: use DocBookWrapperMergeWithPrevious in the code."

This reverts commit 62c9f4332d.
This commit is contained in:
Thibaut Cuvelier 2020-08-03 22:56:25 +02:00
parent c2be69187c
commit 4c01ab9ecf
3 changed files with 48 additions and 132 deletions

View File

@ -4,27 +4,23 @@
<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>
<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@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>
<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@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>
<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: Closing tag `info' when other tags are open, namely: -->
<!-- Output Error: para -->
</para><!-- Output Error: abstract -->
</abstract></info>
</para></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>
@ -692,8 +688,7 @@ v(p,\lambda)_{\pm} &amp; = &amp; \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>
@ -969,9 +964,8 @@ v(p,\lambda)_{\pm} &amp; = &amp; \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&#xA0;<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. -->
<acknowledgement><para>We are grateful to V. Barger, T. Han, and R. J. N. Phillips for doing the math in section&#xA0;<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>
<Appendix></Appendix>
<bibliography>
<bibliomixed xml:id='aur82'>Aurière, M. 1982, <!-- \aap -->, 109, 301 </bibliomixed>

View File

@ -175,11 +175,10 @@ Style Affiliation
Family Roman
Size Normal
EndFont
DocBookTag affiliation
DocBookWrapperTag author
DocBookWrapperMergeWithPrevious true
DocBookItemTag orgname
DocBookInInfo always
DocBookTag affiliation
DocBookWrapperTag author
DocBookItemTag orgname
DocBookInInfo always
End
@ -202,12 +201,11 @@ Style Altaffilation
LabelFont
Color green
EndFont
DocBookTag affiliation
DocBookAttr role="alternate"
DocBookWrapperTag author
DocBookWrapperMergeWithPrevious true
DocBookItemTag orgname
DocBookInInfo always
DocBookTag affiliation
DocBookAttr role="alternate"
DocBookItemTag orgname
DocBookWrapperTag author
DocBookInInfo always
End
@ -227,10 +225,9 @@ Style Email
Size Normal
Shape Italic
EndFont
DocBookTag email
DocBookWrapperTag author
DocBookWrapperMergeWithPrevious true
DocBookInInfo always
DocBookTag email
DocBookWrapperTag author
DocBookInInfo always
End

View File

@ -189,34 +189,11 @@ namespace {
// convenience functions
void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
void openParTag(XMLStream & xs, Paragraph const & par)
{
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 = false;
if (prevpar == nullptr) {
openWrapper = lay.docbookwrappertag() != "NONE";
} else {
Layout const & prevlay = prevpar->layout();
if (prevlay.docbookwrappertag() == "NONE") {
openWrapper = lay.docbookwrappertag() != "NONE";
} else {
openWrapper = prevlay.docbookwrappertag() == lay.docbookwrappertag()
&& !lay.docbookwrappermergewithprevious();
}
}
// Main logic.
if (openWrapper)
if (lay.docbookwrappertag() != "NONE")
xs << xml::StartTag(lay.docbookwrappertag(), lay.docbookwrapperattr());
string tag = lay.docbooktag();
@ -230,28 +207,10 @@ void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar
}
void closeTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpar)
void closeTag(XMLStream & xs, Paragraph const & par)
{
Layout const & lay = par->layout();
Layout const & lay = par.layout();
if (par == nextpar)
nextpar = nullptr;
// See comment in openParTag.
bool closeWrapper = false;
if (nextpar == nullptr) {
closeWrapper = lay.docbookwrappertag() != "NONE";
} else {
Layout const & nextlay = nextpar->layout();
if (nextlay.docbookwrappertag() == "NONE") {
closeWrapper = lay.docbookwrappertag() != "NONE";
} else {
closeWrapper = nextlay.docbookwrappertag() == lay.docbookwrappertag()
&& !nextlay.docbookwrappermergewithprevious();
}
}
// Main logic.
if (lay.docbookitemtag() != "NONE")
xs << xml::EndTag(lay.docbookitemtag());
@ -260,7 +219,7 @@ void closeTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpar)
tag = "para";
xs << xml::EndTag(tag);
if (closeWrapper)
if (lay.docbookwrappertag() != "NONE")
xs << xml::EndTag(lay.docbookwrappertag());
}
@ -440,12 +399,9 @@ ParagraphList::const_iterator makeParagraphs(
ParagraphList::const_iterator const & pbegin,
ParagraphList::const_iterator const & pend)
{
auto const begin = text.paragraphs().begin();
auto const end = text.paragraphs().end();
ParagraphList::const_iterator const begin = text.paragraphs().begin();
ParagraphList::const_iterator par = pbegin;
ParagraphList::const_iterator prevpar = pbegin;
for (; par != pend; prevpar = par, ++par) {
for (; par != pend; ++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
@ -461,7 +417,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) : nullptr;
Inset const *specinset = par->size() == 1 ? par->getInset(0) : 0;
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 ?
@ -510,7 +466,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.
auto nextpar = par;
ParagraphList::const_iterator nextpar = par;
++nextpar;
bool const close_par =
((open_par && (!runparams.docbook_in_par || nextpar != pend))
@ -528,12 +484,12 @@ ParagraphList::const_iterator makeParagraphs(
if (!cleaned.empty()) {
if (open_par)
openParTag(xs, &*par, &*prevpar);
openParTag(xs, *par);
xs << XMLStream::ESCAPE_NONE << os2.str();
if (close_par) {
closeTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
closeTag(xs, *par);
xs << xml::CR();
}
}
@ -558,24 +514,11 @@ 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, &*prevpar);
openParTag(xs, *par);
xs << xml::CR();
// we will on occasion need to remember a layout from before.
@ -729,9 +672,7 @@ ParagraphList::const_iterator makeEnvironment(
xs << xml::CR();
}
}
auto nextpar = par;
++nextpar;
closeTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
closeTag(xs, *par);
xs << xml::CR();
return pend;
}
@ -745,30 +686,14 @@ void makeCommand(
ParagraphList::const_iterator const & pbegin)
{
// No need for labels, as they are handled by DocBook tags.
openParTag(xs, *pbegin);
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;
}
}
// Generate this command.
openParTag(xs, &*pbegin, &*prevpar);
pbegin->simpleDocBookOnePar(buf, xs, runparams,
text.outerFont(distance(begin, pbegin)));
closeTag(xs, &*pbegin, (nextpar != end) ? &*nextpar : nullptr);
closeTag(xs, *pbegin);
xs << xml::CR();
}