ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
-- Pandoc Lua filter: wrap Hungarian experiment and thought-question sections
|
||||
-- in the PDF edition's tcolorbox environments.
|
||||
|
||||
function Pandoc(doc)
|
||||
local new_blocks = {}
|
||||
local in_box = false
|
||||
local box_type = ""
|
||||
local box_level = 0
|
||||
|
||||
local function open_box(name)
|
||||
table.insert(new_blocks, pandoc.RawBlock("latex", "\\begin{" .. name .. "}"))
|
||||
in_box = true
|
||||
box_type = name
|
||||
end
|
||||
|
||||
local function close_box()
|
||||
table.insert(new_blocks, pandoc.RawBlock("latex", "\\end{" .. box_type .. "}"))
|
||||
in_box = false
|
||||
box_type = ""
|
||||
end
|
||||
|
||||
for _, block in ipairs(doc.blocks) do
|
||||
if block.t == "Header" then
|
||||
local heading = pandoc.utils.stringify(block)
|
||||
local is_experiment =
|
||||
heading:match("^%d+%-%d+%.? [Kk]ísérlet") or
|
||||
heading:match("^[Kk]ísérlet %d+%-%d+")
|
||||
local is_questions = heading:match("[Kk]érdések")
|
||||
|
||||
if is_experiment then
|
||||
if in_box then close_box() end
|
||||
box_level = block.level
|
||||
block.classes:insert("unnumbered")
|
||||
open_box("experimentbox")
|
||||
table.insert(new_blocks, block)
|
||||
|
||||
elseif is_questions then
|
||||
if in_box then close_box() end
|
||||
box_level = block.level
|
||||
block.classes:insert("unnumbered")
|
||||
open_box("questionbox")
|
||||
table.insert(new_blocks, block)
|
||||
|
||||
elseif in_box then
|
||||
if box_type == "experimentbox" or block.level <= box_level then
|
||||
close_box()
|
||||
end
|
||||
table.insert(new_blocks, block)
|
||||
|
||||
else
|
||||
table.insert(new_blocks, block)
|
||||
end
|
||||
else
|
||||
table.insert(new_blocks, block)
|
||||
end
|
||||
end
|
||||
|
||||
if in_box then close_box() end
|
||||
doc.blocks = new_blocks
|
||||
return doc
|
||||
end
|
||||
Reference in New Issue
Block a user