mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
DocBook: in InsetInfo, ensure that no db:date is inserted within a db:date.
This commit is contained in:
parent
78b157b61e
commit
43921861b9
@ -91,6 +91,17 @@ Test:
|
|||||||
InsetInfo
|
InsetInfo
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
|
\begin_layout Date
|
||||||
|
|
||||||
|
\lang japanese-cjk
|
||||||
|
\begin_inset Info
|
||||||
|
type "moddate"
|
||||||
|
arg "long"
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\lang spanish
|
\lang spanish
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
<!-- This DocBook file was created by LyX 2.4.0~RC1.devel
|
<!-- This DocBook file was created by LyX 2.4.0~RC1.devel
|
||||||
See https://www.lyx.org/ for more information -->
|
See https://www.lyx.org/ for more information -->
|
||||||
<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">
|
<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>Test: InsetInfo</title>
|
<title>Test: InsetInfo</title>
|
||||||
|
<date>2023-10-08</date>
|
||||||
|
</info>
|
||||||
<para>Véase la <emphasis><phrase role="localized">User's Guide</phrase></emphasis> o <emphasis><phrase role="localized">Additional Features</phrase></emphasis> para más detalles.</para>
|
<para>Véase la <emphasis><phrase role="localized">User's Guide</phrase></emphasis> o <emphasis><phrase role="localized">Additional Features</phrase></emphasis> para más detalles.</para>
|
||||||
</article>
|
</article>
|
@ -3635,11 +3635,11 @@ std::tuple<vector<xml::FontTag>, vector<xml::EndFontTag>> computeDocBookFontSwit
|
|||||||
|
|
||||||
std::tuple<std::vector<docstring>, std::vector<docstring>, std::vector<docstring>>
|
std::tuple<std::vector<docstring>, std::vector<docstring>, std::vector<docstring>>
|
||||||
Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||||
OutputParams const & runparams,
|
OutputParams const & runparams,
|
||||||
Font const & outerfont,
|
Font const & outerfont,
|
||||||
pos_type initial,
|
pos_type initial,
|
||||||
bool is_last_par,
|
bool is_last_par,
|
||||||
bool ignore_fonts) const
|
bool ignore_fonts) const
|
||||||
{
|
{
|
||||||
// Return values: segregation of the content of this paragraph.
|
// Return values: segregation of the content of this paragraph.
|
||||||
std::vector<docstring> prependedParagraphs; // Anything that must be output before the main tag of this paragraph.
|
std::vector<docstring> prependedParagraphs; // Anything that must be output before the main tag of this paragraph.
|
||||||
@ -3669,6 +3669,7 @@ std::tuple<std::vector<docstring>, std::vector<docstring>, std::vector<docstring
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rp.lastid = id();
|
||||||
|
|
||||||
// State variables for the main loop.
|
// State variables for the main loop.
|
||||||
auto xs = new XMLStream(os); // XMLStream has no copy constructor: to create a new object, the only solution
|
auto xs = new XMLStream(os); // XMLStream has no copy constructor: to create a new object, the only solution
|
||||||
|
@ -1726,9 +1726,20 @@ void InsetInfo::docbook(XMLStream & xs, OutputParams const & rp) const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
xml::openTag(xs, "date", "role=\"" + role + "\"", "inline");
|
// A db:date cannot be nested within a db:date. This case typically happens when the document class defines a
|
||||||
|
// Date layout. In this case, avoid outputting a new db:date. This means that InsetInfo cannot add a role on top
|
||||||
|
// of the previous db:date, hence add it as a comment. (Another solution would be an XML processing instruction,
|
||||||
|
// but this case is not common enough.) Adding the role to the already output tag might have consequences for
|
||||||
|
// some document classes where the layout already has a role or uses the same role for another purpose.
|
||||||
|
const bool isWithinDate = buffer().getParFromID(rp.lastid).top().paragraph().layout().docbooktag() == "date";
|
||||||
|
|
||||||
|
if (!isWithinDate)
|
||||||
|
xml::openTag(xs, "date", "role=\"" + role + "\"", "inline");
|
||||||
|
else
|
||||||
|
xs << XMLStream::ESCAPE_NONE << from_ascii(std::string("<!-- ") + role + " -->");
|
||||||
xs << qstring_to_ucs4(parseDate(buffer(), params_).toString(Qt::ISODate));
|
xs << qstring_to_ucs4(parseDate(buffer(), params_).toString(Qt::ISODate));
|
||||||
xml::closeTag(xs, "date", "inline");
|
if (!isWithinDate)
|
||||||
|
xml::closeTag(xs, "date", "inline");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1752,9 +1763,17 @@ void InsetInfo::docbook(XMLStream & xs, OutputParams const & rp) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DocBook has no specific element for time, so use a date.
|
// DocBook has no specific element for time, so use a date.
|
||||||
xml::openTag(xs, "date", "(role=\"" + role + "\"", "inline");
|
// See the discussion above (DATE_INFO, MODDATE_INFO, and FIXDATE_INFO) for a discussion about the choices that
|
||||||
|
// have been made.
|
||||||
|
const bool isWithinDate = buffer().getParFromID(rp.lastid).top().paragraph().layout().docbooktag() == "date";
|
||||||
|
|
||||||
|
if (!isWithinDate)
|
||||||
|
xml::openTag(xs, "date", "role=\"" + role + "\"", "inline");
|
||||||
|
else
|
||||||
|
xs << XMLStream::ESCAPE_NONE << from_ascii(std::string("<!-- ") + role + " -->");
|
||||||
xs << qstring_to_ucs4(parseTime(buffer(), params_).toString(Qt::ISODate));
|
xs << qstring_to_ucs4(parseTime(buffer(), params_).toString(Qt::ISODate));
|
||||||
xml::closeTag(xs, "date", "inline");
|
if (!isWithinDate)
|
||||||
|
xml::closeTag(xs, "date", "inline");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user