Skip to content

Commit 9590de5

Browse files
committed
WIP fix build
1 parent a462403 commit 9590de5

File tree

2 files changed

+41
-33
lines changed

2 files changed

+41
-33
lines changed

docs/soar_manual/build.sh

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -41,37 +41,43 @@ pandoc \
4141

4242
echo "Generated initial PDF with index commands"
4343

44-
# Run makeindex to generate the index file
45-
echo "Running makeindex on SoarManual.idx"
46-
cd output && makeindex SoarManual.idx && cd ..
47-
echo "Makeindex completed"
44+
# Check if index file was generated and run makeindex if needed
45+
if [ -f "output/SoarManual.idx" ]; then
46+
echo "Index entries found, running makeindex..."
47+
cd output && makeindex SoarManual.idx && cd ..
48+
echo "Makeindex completed"
4849

49-
echo "Starting second pandoc run to include index"
50+
echo "Starting second pandoc run to include index"
5051

51-
# Run pandoc again to include the index in the final PDF
52-
pandoc \
53-
--pdf-engine=lualatex \
54-
--resource-path=docs/soar_manual/ \
55-
--template=docs/soar_manual/template.tex \
56-
--listings \
57-
--number-sections \
58-
--lua-filter=docs/soar_manual/path_filter.lua \
59-
--lua-filter=docs/soar_manual/index_filter.lua \
60-
-V geometry:"left=3cm, top=2.5cm, right=3cm, bottom=3cm" \
61-
-V has-index \
62-
docs/soar_manual/01_Introduction.md \
63-
docs/soar_manual/02_TheSoarArchitecture.md \
64-
docs/soar_manual/03_SyntaxOfSoarPrograms.md \
65-
docs/soar_manual/04_ProceduralKnowledgeLearning.md \
66-
docs/soar_manual/05_ReinforcementLearning.md \
67-
docs/soar_manual/06_SemanticMemory.md \
68-
docs/soar_manual/07_EpisodicMemory.md \
69-
docs/soar_manual/08_SpatialVisualSystem.md \
70-
docs/soar_manual/09_SoarUserInterface.md \
71-
output/cli.tex \
72-
-o output/SoarManual.pdf
52+
# Run pandoc again to include the index in the final PDF
53+
pandoc \
54+
--pdf-engine=lualatex \
55+
--resource-path=docs/soar_manual/ \
56+
--template=docs/soar_manual/template.tex \
57+
--listings \
58+
--number-sections \
59+
--lua-filter=docs/soar_manual/path_filter.lua \
60+
--lua-filter=docs/soar_manual/index_filter.lua \
61+
-V geometry:"left=3cm, top=2.5cm, right=3cm, bottom=3cm" \
62+
-V has-index \
63+
docs/soar_manual/01_Introduction.md \
64+
docs/soar_manual/02_TheSoarArchitecture.md \
65+
docs/soar_manual/03_SyntaxOfSoarPrograms.md \
66+
docs/soar_manual/04_ProceduralKnowledgeLearning.md \
67+
docs/soar_manual/05_ReinforcementLearning.md \
68+
docs/soar_manual/06_SemanticMemory.md \
69+
docs/soar_manual/07_EpisodicMemory.md \
70+
docs/soar_manual/08_SpatialVisualSystem.md \
71+
docs/soar_manual/09_SoarUserInterface.md \
72+
output/cli.tex \
73+
-o output/SoarManual.pdf
74+
75+
echo "Generated final PDF with index"
76+
else
77+
echo "No index entries found, skipping makeindex and second pandoc run"
78+
fi
7379

74-
echo "Generated PDF successfully"
80+
echo "PDF generation completed"
7581

7682
# Clean up the temporary CLI file
7783
if [ -f "output/cli.tex" ]; then

docs/soar_manual/index_filter.lua

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
-- This allows index entries to be hidden from MkDocs while being processed for PDF output
33

44
function extractIndexFromComments(elem)
5-
if elem.tag == "RawInline" and elem.format == "html" then
5+
-- Handle both RawInline and RawBlock elements
6+
if (elem.tag == "RawInline" or elem.tag == "RawBlock") and elem.format == "html" then
67
local comment = elem.text
78
-- Match HTML comments containing \index commands
8-
local index_cmd = comment:match("<!%-%-.-%\\index{(.-)}.-->")
9+
local index_cmd = comment:match("<!%-%-%s*\\index{(.-)}.-->")
910
if index_cmd then
1011
-- Return LaTeX raw inline instead of HTML comment
1112
return pandoc.RawInline("latex", "\\index{" .. index_cmd .. "}")
1213
end
13-
-- Match full \index{...} commands in comments
14-
local full_index = comment:match("<!%-%-.-(%\\index{.-}).--->")
14+
-- Match full \index{...} commands in comments (allowing spaces)
15+
local full_index = comment:match("<!%-%-%s*(%\\index{.-})%s*-->")
1516
if full_index then
1617
return pandoc.RawInline("latex", full_index)
1718
end
@@ -21,6 +22,7 @@ end
2122

2223
return {
2324
{
24-
RawInline = extractIndexFromComments
25+
RawInline = extractIndexFromComments,
26+
RawBlock = extractIndexFromComments
2527
}
2628
}

0 commit comments

Comments
 (0)