Resume verified preambles while preparing desktop bibliographies
This commit is contained in:
1 parent
32cfd6240a
commit
fd16e9a740
8 files changed
+270
-48
No files matched your search
@@ -25,11 +25,12 @@ pub(super) fn read_with_date(path: &Path) -> io::Result<(Vec<u8>, Option<SystemT
|
||||
#[derive(Default)]
|
||||
pub(super) struct PackageDiscovery {
|
||||
expansions: u8,
|
||||
prepare_ctex: bool,
|
||||
}
|
||||
|
||||
impl PackageDiscovery {
|
||||
pub(super) fn needs_preparation(&self) -> bool {
|
||||
self.expansions >= 2
|
||||
self.prepare_ctex || self.expansions >= 2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +80,7 @@ impl ResourceCapture {
|
||||
let mut added = BTreeMap::new();
|
||||
let mut dates = BTreeMap::new();
|
||||
let mut added_package_file = false;
|
||||
let mut added_ctex = false;
|
||||
for lookup in trace
|
||||
.lookups
|
||||
.iter()
|
||||
@@ -107,6 +109,12 @@ impl ResourceCapture {
|
||||
["sty", "cls", "clo", "def", "cfg", "fd", "ldf"]
|
||||
.iter().any(|known| extension.eq_ignore_ascii_case(known))
|
||||
});
|
||||
added_ctex |= lookup.kind == ResourceKind::Tex
|
||||
&& lookup.error.is_none()
|
||||
&& Path::new(&lookup.name).file_name().and_then(|name| name.to_str())
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case("ctex.sty"))
|
||||
&& path.file_name().and_then(|name| name.to_str())
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case("ctex.sty"));
|
||||
added.insert(path, Arc::from(bytes));
|
||||
}
|
||||
}
|
||||
@@ -117,8 +125,9 @@ impl ResourceCapture {
|
||||
if let Some(discovery) = package_discovery
|
||||
&& added_package_file
|
||||
{
|
||||
// A single missing input can be captured in place. Another
|
||||
// package-file miss after a retry can indicate a new package tree.
|
||||
// CTeX brings a package tree. Other packages can first retry
|
||||
// with a single capture before preparing a new tree.
|
||||
discovery.prepare_ctex |= added_ctex;
|
||||
discovery.expansions += 1;
|
||||
if discovery.needs_preparation() {
|
||||
return None;
|
||||
|
||||
Reference in new issue
Block a user