mirror of
https://github.com/moparisthebest/xeps
synced 2025-01-30 15:00:09 -05:00
xep2md: Warn if lua-yaml is missing
Since this does not carry the full metadata needed to roundtrip the document, which can be fine if you're using the markdown for something else.
This commit is contained in:
parent
e6afb36d92
commit
297511b1cd
@ -172,6 +172,7 @@ end);
|
||||
local lxp = require "lxp";
|
||||
local lom = require "lxp.lom";
|
||||
local events = require"util.events".new();
|
||||
local have_yaml, yaml = pcall(require, "lyaml");
|
||||
|
||||
local handler = {};
|
||||
local stack = {};
|
||||
@ -350,7 +351,6 @@ events.add_handler("header/", function (event)
|
||||
if meta.title and meta.number then
|
||||
meta.title = "XEP-"..meta.number..": "..meta.title;
|
||||
end
|
||||
local have_yaml, yaml = pcall(require, "lyaml");
|
||||
if have_yaml and yaml.dump then
|
||||
output(yaml.dump({meta}));
|
||||
else
|
||||
@ -612,6 +612,9 @@ local function chunks(file, size)
|
||||
end
|
||||
end
|
||||
|
||||
if not have_yaml then
|
||||
io.stderr:write("lua-yaml missing, header metadata will be incomplete\n");
|
||||
end
|
||||
for chunk in chunks(io.stdin, 4096) do
|
||||
local ok, err, line, col = parser:parse(chunk);
|
||||
if not ok then
|
||||
|
Loading…
Reference in New Issue
Block a user