From 81af2237c1ac039e9099a98e05b42530dbb6a4f3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 17 Mar 2026 12:59:17 +0100 Subject: [PATCH] Allow overriding bibliography style Add scaffold.bibstyle option and pass it through to the generated GAPDoc bibliography element so package manuals can choose a LaTeX bibliography style such as alphaurl. This commit was prepared with Codex, which assisted with implementation, testing, and documentation updates. Resolves #352 Co-authored-by: Codex --- CHANGES.md | 1 + gap/AutoDocMainFunction.gi | 6 +++++- gap/Magic.gd | 9 +++++++++ tst/AutoDocTest/makedoc-entities-list.g | 1 + tst/AutoDocTest/makedoc-entities-record.g | 1 + tst/AutoDocTest/makedoc.g | 1 + .../tst/manual-entities-list.expected/AutoDocTest.xml | 2 +- .../tst/manual-entities-record.expected/AutoDocTest.xml | 2 +- tst/AutoDocTest/tst/manual.expected/AutoDocTest.xml | 2 +- tst/manual.expected/_Chapter_Reference.xml | 8 ++++++++ 10 files changed, 29 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8efa6a35..62a73afc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -30,6 +30,7 @@ This file describes changes in the AutoDoc package. Markdown-like text; `@listing`, `@example`, and `@log` info strings select the corresponding GAPDoc element - Add `@Index` command for generating index entries + - Allow overriding the LaTeX bibliography style via `scaffold.bibstyle` - In Markdown-like inline backtick code spans, emit `...` for GAP keywords (as returned by `ALL_KEYWORDS()`), otherwise as before `...` diff --git a/gap/AutoDocMainFunction.gi b/gap/AutoDocMainFunction.gi index e0195957..13856adf 100644 --- a/gap/AutoDocMainFunction.gi +++ b/gap/AutoDocMainFunction.gi @@ -134,7 +134,11 @@ InstallGlobalFunction( CreateMainPage, fi; if IsBound( opt.bib ) and opt.bib <> false then - AppendTo( filestream, "\n" ); + AppendTo( filestream, "\n" ); fi; if IsBound( opt.index ) and opt.index = true then diff --git a/gap/Magic.gd b/gap/Magic.gd index 45ba650a..4b5ceb3a 100644 --- a/gap/Magic.gd +++ b/gap/Magic.gd @@ -148,6 +148,15 @@ #! then it is assumed that you want to use this as your bibliography. #! #! +#! bibstyle +#! +#! Overrides the bibliography style used for LaTeX output. +#! This is written as the Style attribute of the generated +#! <Bibliography .../> element, so valid values are the +#! bibliography style names understood by &GAPDoc; and BibTeX, such +#! as alpha, alphaurl, or plain. +#! +#! #! entities #! #! A record whose keys are taken as entity names, set to the corresponding diff --git a/tst/AutoDocTest/makedoc-entities-list.g b/tst/AutoDocTest/makedoc-entities-list.g index 2a5a0839..7254af48 100644 --- a/tst/AutoDocTest/makedoc-entities-list.g +++ b/tst/AutoDocTest/makedoc-entities-list.g @@ -11,6 +11,7 @@ AutoDoc(rec( includes := [ "chapter1.xml" ], appendix := [ "appendix1.xml" ], bib := "AutoDocTest.bib", + bibstyle := "alphaurl", entities := [ "Legacy Package", [ "Package", "LegacyListEntity" ], diff --git a/tst/AutoDocTest/makedoc-entities-record.g b/tst/AutoDocTest/makedoc-entities-record.g index 2e1593f2..c8497691 100644 --- a/tst/AutoDocTest/makedoc-entities-record.g +++ b/tst/AutoDocTest/makedoc-entities-record.g @@ -11,6 +11,7 @@ AutoDoc(rec( includes := [ "chapter1.xml" ], appendix := [ "appendix1.xml" ], bib := "AutoDocTest.bib", + bibstyle := "alphaurl", entities := rec( AutoDocTestTag := "RecordEntity", RECORDNOTE := "record entity", diff --git a/tst/AutoDocTest/makedoc.g b/tst/AutoDocTest/makedoc.g index fbee1fe7..1e606dbd 100644 --- a/tst/AutoDocTest/makedoc.g +++ b/tst/AutoDocTest/makedoc.g @@ -11,5 +11,6 @@ AutoDoc(rec( includes := [ "chapter1.xml" ], appendix := [ "appendix1.xml" ], bib := "AutoDocTest.bib", + bibstyle := "alphaurl", ), )); diff --git a/tst/AutoDocTest/tst/manual-entities-list.expected/AutoDocTest.xml b/tst/AutoDocTest/tst/manual-entities-list.expected/AutoDocTest.xml index 48f0b743..ee13c4a6 100644 --- a/tst/AutoDocTest/tst/manual-entities-list.expected/AutoDocTest.xml +++ b/tst/AutoDocTest/tst/manual-entities-list.expected/AutoDocTest.xml @@ -15,6 +15,6 @@ <#Include SYSTEM "appendix1.xml"> <#Include SYSTEM "_AutoDocAppendicesMainFile.xml"> - + diff --git a/tst/AutoDocTest/tst/manual-entities-record.expected/AutoDocTest.xml b/tst/AutoDocTest/tst/manual-entities-record.expected/AutoDocTest.xml index 48f0b743..ee13c4a6 100644 --- a/tst/AutoDocTest/tst/manual-entities-record.expected/AutoDocTest.xml +++ b/tst/AutoDocTest/tst/manual-entities-record.expected/AutoDocTest.xml @@ -15,6 +15,6 @@ <#Include SYSTEM "appendix1.xml"> <#Include SYSTEM "_AutoDocAppendicesMainFile.xml"> - + diff --git a/tst/AutoDocTest/tst/manual.expected/AutoDocTest.xml b/tst/AutoDocTest/tst/manual.expected/AutoDocTest.xml index 48f0b743..ee13c4a6 100644 --- a/tst/AutoDocTest/tst/manual.expected/AutoDocTest.xml +++ b/tst/AutoDocTest/tst/manual.expected/AutoDocTest.xml @@ -15,6 +15,6 @@ <#Include SYSTEM "appendix1.xml"> <#Include SYSTEM "_AutoDocAppendicesMainFile.xml"> - + diff --git a/tst/manual.expected/_Chapter_Reference.xml b/tst/manual.expected/_Chapter_Reference.xml index dc0a3a47..c0821166 100644 --- a/tst/manual.expected/_Chapter_Reference.xml +++ b/tst/manual.expected/_Chapter_Reference.xml @@ -171,6 +171,14 @@ If this key is not set, but there is a file doc/PACKAGENAME.bib then it is assumed that you want to use this as your bibliography. + bibstyle + + Overrides the bibliography style used for LaTeX output. + This is written as the Style attribute of the generated + <Bibliography .../> element, so valid values are the + bibliography style names understood by &GAPDoc; and BibTeX, such + as alpha, alphaurl, or plain. + entities A record whose keys are taken as entity names, set to the corresponding