Skip to content

Commit c8533a3

Browse files
committed
WIP fix build
1 parent 5b43b3b commit c8533a3

File tree

2 files changed

+29
-41
lines changed

2 files changed

+29
-41
lines changed

docs/soar_manual/04_ProceduralKnowledgeLearning.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<!-- markdownlint-disable-next-line -->
22
# Procedural Knowledge Learning
33

4-
\index{chunking}\index{chunk}\index{result}\index{subgoal}
4+
<!-- \index{chunking} -->
5+
<!-- \index{chunk} -->
6+
<!-- \index{result} -->
7+
<!-- \index{subgoal} -->
58

69
## Chunking
710

docs/soar_manual/index_filter.lua

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,35 @@
1-
-- Pandoc Lua filter to extract LaTeX index commands
2-
-- This allows index entries to be included in PDF output while being invisible in MkDocs
1+
-- Simple Pandoc Lua filter to add index entries
2+
-- For now, let's just add some basic index entries manually
33

4-
function processIndexCommands(elem)
5-
-- Handle RawInline and RawBlock elements with LaTeX format
6-
if elem.tag == "RawInline" and elem.format == "latex" then
7-
local text = elem.text or ""
8-
-- If it contains \index commands, pass them through
9-
if text:match("\\index{.-}") then
10-
return elem -- Pass through as-is
11-
end
12-
end
13-
return elem
4+
function addIndexEntries(meta)
5+
-- This function runs once per document
6+
return meta
147
end
158

16-
-- Convert standalone \index{} commands in text to raw LaTeX
17-
function convertIndexToRaw(elem)
18-
if elem.tag == "Str" then
19-
local text = elem.text or ""
20-
-- If the entire string is just \index commands, convert to raw LaTeX
21-
if text:match("^\\index{.-}+$") then
22-
return pandoc.RawInline("latex", text)
23-
end
24-
-- If it contains \index commands mixed with other text, extract them
25-
if text:match("\\index{.-}") then
26-
local parts = {}
27-
local last_end = 1
28-
for index_cmd in text:gmatch("(\\index{.-})") do
29-
local start_pos, end_pos = text:find(index_cmd, last_end, true)
30-
if start_pos > last_end then
31-
table.insert(parts, pandoc.Str(text:sub(last_end, start_pos - 1)))
32-
end
33-
table.insert(parts, pandoc.RawInline("latex", index_cmd))
34-
last_end = end_pos + 1
35-
end
36-
if last_end <= #text then
37-
table.insert(parts, pandoc.Str(text:sub(last_end)))
38-
end
39-
return parts
40-
end
9+
function processDocument(doc)
10+
-- Add some basic index entries at the beginning of the document
11+
local index_entries = {
12+
pandoc.RawBlock("latex", "\\index{chunking}"),
13+
pandoc.RawBlock("latex", "\\index{chunk}"),
14+
pandoc.RawBlock("latex", "\\index{result}"),
15+
pandoc.RawBlock("latex", "\\index{subgoal}"),
16+
pandoc.RawBlock("latex", "\\index{instantiation}"),
17+
pandoc.RawBlock("latex", "\\index{chunking!backtracing}"),
18+
pandoc.RawBlock("latex", "\\index{singleton}"),
19+
pandoc.RawBlock("latex", "\\index{chunking!explanation-based behavior summarization}")
20+
}
21+
22+
-- Insert index entries at the beginning
23+
for i = #index_entries, 1, -1 do
24+
table.insert(doc.blocks, 1, index_entries[i])
4125
end
42-
return elem
26+
27+
return doc
4328
end
4429

4530
return {
4631
{
47-
RawInline = processIndexCommands,
48-
Str = convertIndexToRaw
32+
Meta = addIndexEntries,
33+
Pandoc = processDocument
4934
}
5035
}

0 commit comments

Comments
 (0)