/
githubmirror
/
pandoc
Обзор
Документация
Войти
/
githubmirror
/
pandoc
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
3.8
tools/update-readme.lua
27 строк
735 B
John MacFarlane
Fix README.md so that relative links from manual become absolute.
11 дек 2019, 01:46
11 дек 2019, 01:46
a0df2f6
Код
Авторство
О чём код?
-- update README.md based on MANUAL.txt -- inserts contents of input-formats and output-formats local f = assert(io.open("MANUAL.txt", "r")) local manual = f:read("*all") mdoc = pandoc.read(manual, "markdown") f:close() result = {} function Div(elem) local ident = elem.identifier or "" local fixrel = function(el) if el.target:match("^#") then el.target = "https://pandoc.org/MANUAL.html" .. el.target end return el end local get = function(el) if el.identifier == ident then result = pandoc.walk_block(el, { Link = fixrel }) end end if ident == 'input-formats' or ident == 'output-formats' then pandoc.walk_block(pandoc.Div(mdoc.blocks), { Div = get }) return result end end