fix: DOCX carries the citation style and an all-off table look

The b:Sources part is also the citation style's only carrier, so a document
whose bibliography index sets a non-default style writes it even with no
source cited. The importer keeps a declared all-off w:tblLook ('') instead
of dropping it back to the default look.
This commit is contained in:
Steffen Becker committed 2026-08-16 13:17:47 +02:00
1 parent 6a36b89c18
commit 6789377b48
2 files changed
+5 -2

No files matched your search

+3 -1
View File
@@ -1258,7 +1258,9 @@ function bibSourceXml(s: BibSource): string {
// part of their own, which needs its properties part, two relationships and a content
// type — none of which the package knows about, so all four are minted here.
function applyBibliographyDocx(bytes: Uint8Array, sources: BibSource[], cite: CitationStyle): Uint8Array {
if (!sources.length) return bytes;
// The part is also the citation style's only carrier (its StyleName attribute), so a
// non-default style still writes it with no sources in it.
if (!sources.length && cite === 'key') return bytes;
const files = unzipSync(bytes);
const relsPath = 'word/_rels/document.xml.rels';
const rels = files[relsPath] ? strFromU8(files[relsPath]) : '';
+2 -1
View File
@@ -2359,8 +2359,9 @@ function buildTable(tbl: Element, ctx: Ctx): Node | null {
if (hdr && onOff(hdr)) attrs.repeatHeader = true;
if (named) {
attrs.tableStyle = named;
// '' is a declared all-off look — dropping it would revert to the default look.
const look = docxTableLook(fc(tbl, 'tblPr'));
if (look) attrs.tableLook = look;
if (look != null) attrs.tableLook = look;
}
return Object.keys(attrs).length ? { type: 'table', attrs, content: rows } : { type: 'table', content: rows };
}