mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
DocBook: use DocBookWrapperMergeWithPrevious in the code.
This commit is contained in:
parent
7852582d9c
commit
62c9f4332d
@ -4,23 +4,27 @@
|
||||
<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></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>
|
||||
<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>
|
||||
<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>
|
||||
</para></abstract>
|
||||
</info>
|
||||
<!-- 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>
|
||||
<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>
|
||||
@ -688,7 +692,8 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
|
||||
</m:mtable>
|
||||
</m:math>
|
||||
</informalequation>
|
||||
</MathLetters>
|
||||
<!-- Output Error: Tried to close `title' when tag was not open. Tag discarded. -->
|
||||
|
||||
</section>
|
||||
</section>
|
||||
<section>
|
||||
@ -964,8 +969,9 @@ v(p,\lambda)_{\pm} & = & \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 <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>
|
||||
<acknowledgement><para>We are grateful to V. Barger, T. Han, and R. J. N. Phillips for doing the math in section <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. -->
|
||||
|
||||
<Appendix></Appendix>
|
||||
<bibliography>
|
||||
<bibliomixed xml:id='aur82'>Aurière, M. 1982, <!-- \aap -->, 109, 301 </bibliomixed>
|
||||
|
@ -175,10 +175,11 @@ Style Affiliation
|
||||
Family Roman
|
||||
Size Normal
|
||||
EndFont
|
||||
DocBookTag affiliation
|
||||
DocBookWrapperTag author
|
||||
DocBookItemTag orgname
|
||||
DocBookInInfo always
|
||||
DocBookTag affiliation
|
||||
DocBookWrapperTag author
|
||||
DocBookWrapperMergeWithPrevious true
|
||||
DocBookItemTag orgname
|
||||
DocBookInInfo always
|
||||
End
|
||||
|
||||
|
||||
@ -201,11 +202,12 @@ Style Altaffilation
|
||||
LabelFont
|
||||
Color green
|
||||
EndFont
|
||||
DocBookTag affiliation
|
||||
DocBookAttr role="alternate"
|
||||
DocBookItemTag orgname
|
||||
DocBookWrapperTag author
|
||||
DocBookInInfo always
|
||||
DocBookTag affiliation
|
||||
DocBookAttr role="alternate"
|
||||
DocBookWrapperTag author
|
||||
DocBookWrapperMergeWithPrevious true
|
||||
DocBookItemTag orgname
|
||||
DocBookInInfo always
|
||||
End
|
||||
|
||||
|
||||
@ -225,9 +227,10 @@ Style Email
|
||||
Size Normal
|
||||
Shape Italic
|
||||
EndFont
|
||||
DocBookTag email
|
||||
DocBookWrapperTag author
|
||||
DocBookInInfo always
|
||||
DocBookTag email
|
||||
DocBookWrapperTag author
|
||||
DocBookWrapperMergeWithPrevious true
|
||||
DocBookInInfo always
|
||||
End
|
||||
|
||||
|
||||
|
@ -189,11 +189,34 @@ namespace {
|
||||
|
||||
// convenience functions
|
||||
|
||||
void openParTag(XMLStream & xs, Paragraph const & par)
|
||||
void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
|
||||
{
|
||||
Layout const & lay = par.layout();
|
||||
Layout const & lay = par->layout();
|
||||
|
||||
if (lay.docbookwrappertag() != "NONE")
|
||||
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)
|
||||
xs << xml::StartTag(lay.docbookwrappertag(), lay.docbookwrapperattr());
|
||||
|
||||
string tag = lay.docbooktag();
|
||||
@ -207,10 +230,28 @@ void openParTag(XMLStream & xs, Paragraph const & par)
|
||||
}
|
||||
|
||||
|
||||
void closeTag(XMLStream & xs, Paragraph const & par)
|
||||
void closeTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpar)
|
||||
{
|
||||
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());
|
||||
|
||||
@ -219,7 +260,7 @@ void closeTag(XMLStream & xs, Paragraph const & par)
|
||||
tag = "para";
|
||||
|
||||
xs << xml::EndTag(tag);
|
||||
if (lay.docbookwrappertag() != "NONE")
|
||||
if (closeWrapper)
|
||||
xs << xml::EndTag(lay.docbookwrappertag());
|
||||
}
|
||||
|
||||
@ -399,9 +440,12 @@ ParagraphList::const_iterator makeParagraphs(
|
||||
ParagraphList::const_iterator const & pbegin,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
{
|
||||
ParagraphList::const_iterator const begin = text.paragraphs().begin();
|
||||
auto const begin = text.paragraphs().begin();
|
||||
auto const end = text.paragraphs().end();
|
||||
ParagraphList::const_iterator par = pbegin;
|
||||
for (; par != pend; ++par) {
|
||||
ParagraphList::const_iterator prevpar = pbegin;
|
||||
|
||||
for (; par != pend; prevpar = par, ++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
|
||||
@ -417,7 +461,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) : 0;
|
||||
Inset const *specinset = par->size() == 1 ? par->getInset(0) : nullptr;
|
||||
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 ?
|
||||
@ -466,7 +510,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.
|
||||
ParagraphList::const_iterator nextpar = par;
|
||||
auto nextpar = par;
|
||||
++nextpar;
|
||||
bool const close_par =
|
||||
((open_par && (!runparams.docbook_in_par || nextpar != pend))
|
||||
@ -484,12 +528,12 @@ ParagraphList::const_iterator makeParagraphs(
|
||||
|
||||
if (!cleaned.empty()) {
|
||||
if (open_par)
|
||||
openParTag(xs, *par);
|
||||
openParTag(xs, &*par, &*prevpar);
|
||||
|
||||
xs << XMLStream::ESCAPE_NONE << os2.str();
|
||||
|
||||
if (close_par) {
|
||||
closeTag(xs, *par);
|
||||
closeTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
|
||||
xs << xml::CR();
|
||||
}
|
||||
}
|
||||
@ -514,11 +558,24 @@ 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);
|
||||
openParTag(xs, &*par, &*prevpar);
|
||||
xs << xml::CR();
|
||||
|
||||
// we will on occasion need to remember a layout from before.
|
||||
@ -672,7 +729,9 @@ ParagraphList::const_iterator makeEnvironment(
|
||||
xs << xml::CR();
|
||||
}
|
||||
}
|
||||
closeTag(xs, *par);
|
||||
auto nextpar = par;
|
||||
++nextpar;
|
||||
closeTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
|
||||
xs << xml::CR();
|
||||
return pend;
|
||||
}
|
||||
@ -686,14 +745,30 @@ 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);
|
||||
closeTag(xs, &*pbegin, (nextpar != end) ? &*nextpar : nullptr);
|
||||
xs << xml::CR();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user