Compare commits

...

2 Commits

Author SHA1 Message Date
Richard Kimberly Heck
5041d74052 Word count for references.
This is different from the version in master, since JMarc rewrote the
stats code.
2024-12-05 17:42:31 -05:00
Enrico Forestieri
480ae7f22e Account for extensions when creating a LyX archive
LyX archives created after importing a LaTeX document may not
include bibliography style and catalog files. This is because
tex2lyx does not remove extensions, but the lyxpak script
expects files without extensions. So, teach lyxpak to also take
possible extensions into account.

Fixes #13129
2024-12-05 22:01:01 +01:00
5 changed files with 29 additions and 6 deletions

View File

@ -191,8 +191,11 @@ def gather_files(curfile, incfiles, lyx2lyx):
file = match.group(3).strip(b'"')
if file.startswith(b"bibtotoc,"):
file = file[9:]
ext = os.path.splitext(file)[-1]
if ext != b'.bst':
file = file + b'.bst'
if not os.path.isabs(file):
file = os.path.join(curdir, file + b'.bst')
file = os.path.join(curdir, file)
if os.path.exists(unicode(file, 'utf-8')):
incfiles.append(abspath(file))
i += 1
@ -204,10 +207,12 @@ def gather_files(curfile, incfiles, lyx2lyx):
bibfiles = match.group(3).strip(b'"').split(b',')
j = 0
while j < len(bibfiles):
if os.path.isabs(bibfiles[j]):
file = bibfiles[j] + b'.bib'
else:
file = os.path.join(curdir, bibfiles[j] + b'.bib')
file = bibfiles[j]
ext = os.path.splitext(file)[-1]
if ext != b'.bib':
file = file + b'.bib'
if not os.path.isabs(file):
file = os.path.join(curdir, file)
if os.path.exists(unicode(file, 'utf-8')):
incfiles.append(abspath(file))
j += 1

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.
@ -79,6 +81,9 @@ What's new
- Fix tabular styles on systems with blanks in system directory path.
- Fix inclusion of bibliography files in a LyX archive when the document
was imported from a LaTeX source (bug 13129).
* USER INTERFACE