Word count for references.

This is different from the version in master, since JMarc rewrote the
stats code.
This commit is contained in:
Richard Kimberly Heck 2024-12-05 17:41:36 -05:00
parent 480ae7f22e
commit 5041d74052
4 changed files with 16 additions and 1 deletions

View File

@ -5496,7 +5496,7 @@ void Buffer::Impl::updateStatistics(DocIterator & from, DocIterator & to, bool s
char_count_ = 0;
blank_count_ = 0;
for (DocIterator dit = from ; dit != to && !dit.atEnd(); ) {
for (DocIterator dit = from; dit != to && !dit.atEnd(); ) {
if (!dit.inTexted()) {
dit.forwardPos();
continue;

View File

@ -668,4 +668,15 @@ docstring InsetRef::getTOCString() const
return (broken_ ? _("BROKEN: ") : docstring()) + toc_string_;
}
pair<int, int> InsetRef::isWords() const
{
docstring const & ref = getParam("reference");
string const & cmd = params().getCmdName();
// best we can do here
string const & lang = buffer().params().language->lang();
docstring const refstring = displayString(ref, cmd, lang);
return pair<int, int>(refstring.size(), wordCount(refstring));
}
} // namespace lyx

View File

@ -79,6 +79,8 @@ public:
UpdateType utype, TocBackend & backend) const override;
///
bool forceLTR(OutputParams const &) const override;
///
std::pair<int, int> isWords() const override;
//@}
/// \name Static public methods obligated for InsetCommand derived classes

View File

@ -33,6 +33,8 @@ What's new
the outliner, even of they do not have a label yet. In the latter
case, a label is autonatically inserted.
- Approximate word count for cross-references.
- Document PDF settings allow color links and frames around them.
These two settings are mutually exclusive by default and we signal
that within UI now. Workarounds can be found our and hyperref manual.