mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Do not write empty destination name tree root (#5066)
This commit is contained in:
parent
022f34c43a
commit
66147979ba
@ -139,16 +139,15 @@ pub fn write_catalog(
|
||||
catalog.viewer_preferences().direction(dir);
|
||||
catalog.metadata(meta_ref);
|
||||
|
||||
// Write the named destination tree.
|
||||
let mut name_dict = catalog.names();
|
||||
let mut dests_name_tree = name_dict.destinations();
|
||||
let mut names = dests_name_tree.names();
|
||||
for &(name, dest_ref, ..) in &ctx.references.named_destinations.dests {
|
||||
names.insert(Str(name.as_str().as_bytes()), dest_ref);
|
||||
// Write the named destination tree if there are any entries.
|
||||
if !ctx.references.named_destinations.dests.is_empty() {
|
||||
let mut name_dict = catalog.names();
|
||||
let mut dests_name_tree = name_dict.destinations();
|
||||
let mut names = dests_name_tree.names();
|
||||
for &(name, dest_ref, ..) in &ctx.references.named_destinations.dests {
|
||||
names.insert(Str(name.as_str().as_bytes()), dest_ref);
|
||||
}
|
||||
}
|
||||
names.finish();
|
||||
dests_name_tree.finish();
|
||||
name_dict.finish();
|
||||
|
||||
// Insert the page labels.
|
||||
if !page_labels.is_empty() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user