summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/tex4ebook
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-09-25 23:14:06 +0000
committerKarl Berry <karl@freefriends.org>2015-09-25 23:14:06 +0000
commitcda0d28e6e36d691ee107b39a64ebfca1f22ba6d (patch)
treee496f6a2efd6d6e5636dd330d7cdea4481279539 /Master/texmf-dist/scripts/tex4ebook
parent3b7cf30fa31187f5d624753e77da7864f97f309b (diff)
tex4ebook (25sep15)
git-svn-id: svn://tug.org/texlive/trunk@38463 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/tex4ebook')
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/exec_epub.lua18
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/exec_epub3.lua10
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/tex4ebook3
3 files changed, 23 insertions, 8 deletions
diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua b/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua
index 45977c2ee2f..ff5784bcdb3 100755
--- a/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua
+++ b/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua
@@ -258,13 +258,25 @@ function make_opf()
end
function pack_container()
+ local ncxfilename = outputdir .. "/" .. outputfilename .. ".ncx"
if os.execute("tidy -v") > 0 then
- print("Warning:\n tidy command seems missing, you need to install it" ..
+ print("Warning:\n tidy command seems missing, you should install it" ..
" in order\n to make valid epub file")
+ print("Using regexp based cleaning")
+ local lines = {}
+ for line in io.lines(ncxfilename) do
+ local content = line:gsub("[ ]*<","<")
+ if content:len() > 0 then
+ table.insert(lines, content)
+ end
+ end
+ table.insert(lines,"")
+ local ncxfile = io.open(ncxfilename,"w")
+ ncxfile:write(table.concat(lines,"\n"))
+ ncxfile:close()
else
print("Tidy ncx "..
- os.execute("tidy -xml -i -q -utf8 -m " ..
- outputdir .. "/" .. outputfilename .. ".ncx"))
+ os.execute("tidy -xml -i -q -utf8 -m " .. ncxfilename))
print("Tidy opf "..
os.execute("tidy -xml -i -q -utf8 -m " ..
outputdir .. "/" .. "content.opf"))
diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua b/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua
index 55f7f71c309..e51746e7773 100755
--- a/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua
+++ b/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua
@@ -1,6 +1,7 @@
module(...,package.seeall)
local eb = require("exec_epub")
+local ext = "xhtml"
local outputdir = nil
local input = nil
function prepare(params)
@@ -8,7 +9,8 @@ function prepare(params)
local outputdir_name="OEBPS"
outputdir= basedir.."/"..outputdir_name
input = params.input
- params.packages = params.packages .. "\\Configure{ext}{xhtml}"
+ params.ext = ext
+ params.packages = params.packages .. string.format("\\Configure{ext}{%s}",ext)
return eb.prepare(params)
end
@@ -54,12 +56,10 @@ local function cleanOPF()
print "TOC nav found"
else
print "no TOC, using generic one"
- local pattern = input.."(%..?html)"
- local ext = content:match(pattern)
- local inputfile = input .. ext
+ local inputfile = input .. "." .. ext
print("Main file name", inputfile)
-- write toc file
- local toc_name = "generic_toc" ..ext
+ local toc_name = "generic_toc" .."."..ext
local f = io.open(outputdir .. "/" .. toc_name, "w")
f:write(makeTOC(inputfile))
f:close()
diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook b/Master/texmf-dist/scripts/tex4ebook/tex4ebook
index c43bc330583..7c677b00d56 100755
--- a/Master/texmf-dist/scripts/tex4ebook/tex4ebook
+++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook
@@ -1,4 +1,7 @@
#!/usr/bin/env texlua
+-- Package tex4ebook. Author Michal Hoftich <michal.h21@gmail.com>
+-- This package is subject of LPPL license, version 1.3
+--
kpse.set_program_name("luatex")
require("lapp-mk4")
-- require("ebookutils")