computable-pandoc/scripts/make_dist.lua

49 lines
1.5 KiB
Lua

-- Makes bundle distribution
-- Adds Lua custom extensions
require "src.extensions"
-- Makes distribution
local function make_dist()
-- Chomps file
local function chomp(str, without)
local without = without or false
str = string.read_text(str):strip()
if without then
return str:gsub("\n[^\n]+$", "")
end
return "\n" .. str .. "\n"
end
-- Variables
local name = "lin.lua"
local dist = pandoc.path.join({"dist", name})
local ext = chomp("src/extensions.lua")
local pan = chomp("src/pandoc.lua")
local fnl = chomp("opt/fennel.lua", true)
local nat = chomp("src/natural.lua", true)
local lit = chomp("src/literate.lua", true)
local license = string.strip([[
Computable Pandoc & Fennel Bundle:
A Pandoc filter for literate and natural programming
Computable Pandoc:
(C) 2023 perro hi@perrotuerto.blog
License: GPLv3 https://git.cuates.net/perro/computable-pandoc/src/branch/no-masters/LICENSE.txt
Source: https://git.cuates.net/perro/computable-pandoc
Fennel:
(C) 2016-2023 Calvin Rose and contributors
License: MIT License https://git.sr.ht/~technomancy/fennel/tree/main/item/LICENSE
Source: https://sr.ht/~technomancy/fennel or https://github.com/bakpakin/Fennel/issues
Website: https://fennel-lang.org
]])
-- Bundles Fennel and Computable Pandoc
file = io.open(dist, "w")
file:write("--[[\n", license, "\n]]--\n")
file:write(fnl, "\nlocal fnl = mod\n", ext, nat, lit, pan)
file:close()
end
make_dist()