diff options
22 files changed, 279 insertions, 209 deletions
diff --git a/doc/context/manuals/allkind/mkiv-publications.pdf b/doc/context/manuals/allkind/mkiv-publications.pdf Binary files differindex 18444e4f0..8134fd2d3 100644 --- a/doc/context/manuals/allkind/mkiv-publications.pdf +++ b/doc/context/manuals/allkind/mkiv-publications.pdf diff --git a/doc/context/scripts/mkiv/context.html b/doc/context/scripts/mkiv/context.html index fa640d7c8..e71b8a943 100644 --- a/doc/context/scripts/mkiv/context.html +++ b/doc/context/scripts/mkiv/context.html @@ -95,7 +95,8 @@ <tr><th>--update</th><td></td><td>update context from website (not to be confused with contextgarden)</td></tr> <tr><th>--profile</th><td></td><td>profile job (use: mtxrun --script profile --analyze)</td></tr> <tr><th>--timing</th><td></td><td>generate timing and statistics overview</td></tr> - <tr><th>--keeptuc</th><td></td><td>keep previous tuc files (numbered by run)</td></tr> + <tr><th>--keeptuc</th><td></td><td>keep previous tuc files (jobname-tuc-[run].tmp)</td></tr> + <tr><th>--keeplog</th><td></td><td>keep previous log files (jobname-log-[run].tmp)</td></tr> <tr><th/><td/><td/></tr> <tr><th>--extra=name</th><td></td><td>process extra (mtx-context-... in distribution)</td></tr> <tr><th>--extras</th><td></td><td>show extras</td></tr> diff --git a/doc/context/scripts/mkiv/context.man b/doc/context/scripts/mkiv/context.man index 163ad4392..c563dfb5e 100644 --- a/doc/context/scripts/mkiv/context.man +++ b/doc/context/scripts/mkiv/context.man @@ -142,7 +142,10 @@ profile job (use: mtxrun --script profile --analyze) generate timing and statistics overview .TP .B --keeptuc -keep previous tuc files (numbered by run) +keep previous tuc files (jobname-tuc-[run].tmp) +.TP +.B --keeplog +keep previous log files (jobname-log-[run].tmp) .TP .B --extra=name process extra (mtx-context-... in distribution) diff --git a/doc/context/scripts/mkiv/context.xml b/doc/context/scripts/mkiv/context.xml index 009a87740..4525908d6 100644 --- a/doc/context/scripts/mkiv/context.xml +++ b/doc/context/scripts/mkiv/context.xml @@ -142,7 +142,7 @@ <short>assume given file present elsewhere</short> </flag> <flag name="nofile"> - <short>use dummy file as jobname</short> + <short>use dummy file as jobname</short> </flag> </subcategory> </category> @@ -155,7 +155,7 @@ <short>omit runtime statistics at the end of the run</short> </flag> <flag name="update"> - <short>update context from website (not to be confused with contextgarden)</short> + <short>update context from website (not to be confused with contextgarden)</short> </flag> <flag name="profile"> <short>profile job (use: mtxrun <ref name="script"/> profile <ref name="analyze"/>)</short> @@ -164,7 +164,10 @@ <short>generate timing and statistics overview</short> </flag> <flag name="keeptuc"> - <short>keep previous tuc files (numbered by run)</short> + <short>keep previous tuc files (jobname-tuc-[run].tmp)</short> + </flag> + <flag name="keeplog"> + <short>keep previous log files (jobname-log-[run].tmp)</short> </flag> </subcategory> <subcategory> diff --git a/doc/context/scripts/mkiv/mtx-context.html b/doc/context/scripts/mkiv/mtx-context.html index fa640d7c8..e71b8a943 100644 --- a/doc/context/scripts/mkiv/mtx-context.html +++ b/doc/context/scripts/mkiv/mtx-context.html @@ -95,7 +95,8 @@ <tr><th>--update</th><td></td><td>update context from website (not to be confused with contextgarden)</td></tr> <tr><th>--profile</th><td></td><td>profile job (use: mtxrun --script profile --analyze)</td></tr> <tr><th>--timing</th><td></td><td>generate timing and statistics overview</td></tr> - <tr><th>--keeptuc</th><td></td><td>keep previous tuc files (numbered by run)</td></tr> + <tr><th>--keeptuc</th><td></td><td>keep previous tuc files (jobname-tuc-[run].tmp)</td></tr> + <tr><th>--keeplog</th><td></td><td>keep previous log files (jobname-log-[run].tmp)</td></tr> <tr><th/><td/><td/></tr> <tr><th>--extra=name</th><td></td><td>process extra (mtx-context-... in distribution)</td></tr> <tr><th>--extras</th><td></td><td>show extras</td></tr> diff --git a/doc/context/scripts/mkiv/mtx-context.man b/doc/context/scripts/mkiv/mtx-context.man index 163ad4392..c563dfb5e 100644 --- a/doc/context/scripts/mkiv/mtx-context.man +++ b/doc/context/scripts/mkiv/mtx-context.man @@ -142,7 +142,10 @@ profile job (use: mtxrun --script profile --analyze) generate timing and statistics overview .TP .B --keeptuc -keep previous tuc files (numbered by run) +keep previous tuc files (jobname-tuc-[run].tmp) +.TP +.B --keeplog +keep previous log files (jobname-log-[run].tmp) .TP .B --extra=name process extra (mtx-context-... in distribution) diff --git a/doc/context/scripts/mkiv/mtx-context.xml b/doc/context/scripts/mkiv/mtx-context.xml index 009a87740..4525908d6 100644 --- a/doc/context/scripts/mkiv/mtx-context.xml +++ b/doc/context/scripts/mkiv/mtx-context.xml @@ -142,7 +142,7 @@ <short>assume given file present elsewhere</short> </flag> <flag name="nofile"> - <short>use dummy file as jobname</short> + <short>use dummy file as jobname</short> </flag> </subcategory> </category> @@ -155,7 +155,7 @@ <short>omit runtime statistics at the end of the run</short> </flag> <flag name="update"> - <short>update context from website (not to be confused with contextgarden)</short> + <short>update context from website (not to be confused with contextgarden)</short> </flag> <flag name="profile"> <short>profile job (use: mtxrun <ref name="script"/> profile <ref name="analyze"/>)</short> @@ -164,7 +164,10 @@ <short>generate timing and statistics overview</short> </flag> <flag name="keeptuc"> - <short>keep previous tuc files (numbered by run)</short> + <short>keep previous tuc files (jobname-tuc-[run].tmp)</short> + </flag> + <flag name="keeplog"> + <short>keep previous log files (jobname-log-[run].tmp)</short> </flag> </subcategory> <subcategory> diff --git a/doc/context/scripts/mkiv/mtx-epub.html b/doc/context/scripts/mkiv/mtx-epub.html index 45015a34e..69d927b1d 100644 --- a/doc/context/scripts/mkiv/mtx-epub.html +++ b/doc/context/scripts/mkiv/mtx-epub.html @@ -14,7 +14,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> - <title>ConTeXt EPUB Helpers 0.12</title> + <title>ConTeXt EPUB Helpers 1.00</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <style type="text/css"> body { color: #FFFFFF; background-color: #808080; font-family: optima, verdana, futura, "lucida sans", arial, geneva, helvetica, sans; font-size: 12px; line-height: 18px; } a:link, a:active, a:visited { color: #FFFFFF; } a.dir-view:link, a.dir-view:active, a.dir-view:visited { color: #FFFFFF; text-decoration: underline; } .valid { color: #00FF00; } .invalid { color: #FF0000; } button, .commonlink, .smallbutton { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; border-color: #7F7F7F; border-style: solid; border-width: .125ex; background-color: #FFFFFF; padding: .5ex; } .smallbutton { width: 1em; } a.commonlink:link, a.commonlink:active, a.commonlink:visited, a.smalllink:link, a.smalllink:active, a.smalllink:visited { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; } h1, .title { font-style: normal; font-weight: normal; font-size: 18px; line-height: 18px; margin-bottom: 20px; } h2, .subtitle { font-style: normal; font-weight: normal; font-size: 12px; margin-top: 18px; margin-bottom: 18px; } table { line-height: 18px; font-size: 12px; margin: 0; } th { font-weight: bold; text-align: left; padding-bottom: 6px; } .tc { font-weight: bold; text-align: left; } p, li { max-width: 60em; } .empty-line { margin-top: 4px; } .more-room { margin-right: 1.5em; } .much-more-room { margin-right: 3em; } #main { position: absolute; left: 10%; top: 10%; right: 10%; bottom: 10%; z-index: 2; width: 80%; height: 80%; padding: 0%; margin: 0%; overflow: auto; border-style: none; border-width: 0; background-color: #3F3F3F; } #main-settings { margin: 12px; x_max-width: 60em; line-height: 18px; font-size: 12px; } #left { position: absolute; top : 10%; left: 0%; bottom: 0%; right: 90%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; } #right { position: absolute; top : 0%; left: 90%; bottom: 10%; right: 0%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; _margin-left: -15px; } #bottom { position: absolute; left: 10%; right: 0%; top: 90%; bottom: 0%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top { position: absolute; left: 0%; right: 10%; top: 0%; bottom: 90%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #top-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: right; vertical-align: middle; } #bottom-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #bottom-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: left; vertical-align: middle; } #left-one { position: absolute; width: 100%; buggedheight: 100%; } #left-two { position: relative; margin-top: 12px; line-height: 18px; text-align: center; vertical-align: top; } #right-one { display: table; height: 100%; width: 100%; } #right-two { display: table-row; height: 100%; width: 100%; } #right-three { display: table-cell; width: 100%; vertical-align: bottom; _position: absolute; _top: 100%; } #right-four { text-align: center; margin-bottom: 2ex; _position: relative; _top: -100%; } #more-top { position: absolute; top: 0%; left: 90%; bottom: 90%; right: 0%; z-index: 3; width: 10%; height: 10%; padding: 0%; margin: 0%; border-style: none; border-width: 0; } #more-top-settings { text-align: center; } #more-right-settings { margin-right: 12px; margin-left: 12px; line-height: 18px; font-size: 10px; text-align: center; } #right-safari { _display: table; width: 100%; height: 100%; } @@ -24,7 +24,7 @@ </head> <body> <div id="top"> <div id="top-one"> - <div id="top-two">ConTeXt EPUB Helpers 0.12 </div> + <div id="top-two">ConTeXt EPUB Helpers 1.00 </div> </div> </div> <div id="bottom"> <div id="bottom-one"> diff --git a/doc/context/scripts/mkiv/mtx-epub.man b/doc/context/scripts/mkiv/mtx-epub.man index 52bcd1d88..4d42523fe 100644 --- a/doc/context/scripts/mkiv/mtx-epub.man +++ b/doc/context/scripts/mkiv/mtx-epub.man @@ -1,4 +1,4 @@ -.TH "mtx-epub" "1" "01-01-2014" "version 0.12" "ConTeXt EPUB Helpers" +.TH "mtx-epub" "1" "01-01-2014" "version 1.00" "ConTeXt EPUB Helpers" .SH NAME .B mtx-epub .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtx-epub.xml b/doc/context/scripts/mkiv/mtx-epub.xml index 5ef5dc81b..4a9160fbc 100644 --- a/doc/context/scripts/mkiv/mtx-epub.xml +++ b/doc/context/scripts/mkiv/mtx-epub.xml @@ -3,7 +3,7 @@ <metadata> <entry name="name">mtx-epub</entry> <entry name="detail">ConTeXt EPUB Helpers</entry> - <entry name="version">0.12</entry> + <entry name="version">1.00</entry> </metadata> <flags> <category name="basic"> diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index caf7e2f2a..2e60a629b 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -30,6 +30,7 @@ local removesuffix = file.removesuffix local validfile = lfs.isfile local removefile = os.remove local renamefile = os.rename +local formatters = string.formatters local application = logs.application { name = "mtx-context", @@ -281,26 +282,32 @@ local function multipass_changed(oldhash, newhash) return false end +local f_tempfile = formatters["%s-%s-%02d.tmp"] + +local function backup(run,kind,filename) + if run == 1 then + for i=1,10 do + local tmpname = f_tempfile(jobname,kind,i) + if validfile(tmpname) then + removefile(tmpname) + report("removing %a",tmpname) + end + end + end + if validfile(filename) then + local tmpname = f_tempfile(jobname,kind,run or 1) + report("copying %a into %a",filename,tmpname) + file.copy(filename,tmpname) + else + report("no file %a, nothing kept",filename) + end +end + local function multipass_copyluafile(jobname,run) local tuaname, tucname = jobname..".tua", jobname..".tuc" if validfile(tuaname) then if run then - if run == 1 then - for i=1,10 do - local tmpname = format("%s-tuc-%02d.tmp",jobname,i) - if validfile(tmpname) then - removefile(tmpname) - report("removing %a",tmpname) - end - end - end - if validfile(tucname) then - local tmpname = format("%s-tuc-%02d.tmp",jobname,run or 1) - report("copying %a into %a",tucname,tmpname) - file.copy(tucname,tmpname) - else - report("no file %a, nothing kept",filename) - end + backup(run,"tuc",tucname) report("copying %a into %a",tuaname,tucname) report() end @@ -309,6 +316,16 @@ local function multipass_copyluafile(jobname,run) end end +local function multipass_copylogfile(jobname,run) + local logname = jobname..".log" + if validfile(logname) then + if run then + backup(run,"log",logname) + report() + end + end +end + -- local pattern = lpegpatterns.utfbom^-1 * (P("%% ") + P("% ")) * Cs((1-lpegpatterns.newline)^1) @@ -572,6 +589,7 @@ function scripts.context.run(ctxdata,filename) local a_jithash = getargument("jithash") local a_texformat = getargument("texformat") local a_keeptuc = getargument("keeptuc") + local a_keeplog = getargument("keeplog") -- a_batchmode = (a_batchmode and "batchmode") or (a_nonstopmode and "nonstopmode") or (a_scrollmode and "scrollmode") or nil a_synctex = check_synctex(a_synctex) @@ -739,6 +757,7 @@ function scripts.context.run(ctxdata,filename) break elseif returncode == 0 then multipass_copyluafile(jobname,a_keeptuc and currentrun) + multipass_copylogfile(jobname,a_keeplog and currentrun) if not multipass_forcedruns then newhash = multipass_hashfiles(jobname) if multipass_changed(oldhash,newhash) then diff --git a/scripts/context/lua/mtx-context.xml b/scripts/context/lua/mtx-context.xml index 009a87740..4525908d6 100644 --- a/scripts/context/lua/mtx-context.xml +++ b/scripts/context/lua/mtx-context.xml @@ -142,7 +142,7 @@ <short>assume given file present elsewhere</short> </flag> <flag name="nofile"> - <short>use dummy file as jobname</short> + <short>use dummy file as jobname</short> </flag> </subcategory> </category> @@ -155,7 +155,7 @@ <short>omit runtime statistics at the end of the run</short> </flag> <flag name="update"> - <short>update context from website (not to be confused with contextgarden)</short> + <short>update context from website (not to be confused with contextgarden)</short> </flag> <flag name="profile"> <short>profile job (use: mtxrun <ref name="script"/> profile <ref name="analyze"/>)</short> @@ -164,7 +164,10 @@ <short>generate timing and statistics overview</short> </flag> <flag name="keeptuc"> - <short>keep previous tuc files (numbered by run)</short> + <short>keep previous tuc files (jobname-tuc-[run].tmp)</short> + </flag> + <flag name="keeplog"> + <short>keep previous log files (jobname-log-[run].tmp)</short> </flag> </subcategory> <subcategory> diff --git a/scripts/context/lua/mtx-epub.lua b/scripts/context/lua/mtx-epub.lua index e9a4140a2..2af21990d 100644 --- a/scripts/context/lua/mtx-epub.lua +++ b/scripts/context/lua/mtx-epub.lua @@ -38,7 +38,7 @@ local helpinfo = [[ <metadata> <entry name="name">mtx-epub</entry> <entry name="detail">ConTeXt EPUB Helpers</entry> - <entry name="version">0.12</entry> + <entry name="version">1.00</entry> </metadata> <flags> <category name="basic"> @@ -60,7 +60,7 @@ local helpinfo = [[ local application = logs.application { name = "mtx-epub", - banner = "ConTeXt EPUB Helpers 0.12", + banner = "ConTeXt EPUB Helpers 1.00", helpinfo = helpinfo, } @@ -277,202 +277,226 @@ function scripts.epub.make() local filename = environment.files[1] - if filename and filename ~= "" and type(filename) == "string" then - - filename = file.basename(filename) - local specfile = file.replacesuffix(filename,"specification") - local specification = lfs.isfile(specfile) and dofile(specfile) or { } - - local name = specification.name or file.removesuffix(filename) - local identifier = specification.identifier or "" - local files = specification.files or { file.addsuffix(filename,"xhtml") } - local images = specification.images or { } - local root = specification.root or files[1] - local language = specification.language or "en" - local creator = specification.author or "context" - local title = specification.title or name - local firstpage = specification.firstpage or "" - local lastpage = specification.lastpage or "" - - -- identifier = gsub(identifier,"[^a-zA-z0-9]","") - - if firstpage == "" then - -- firstpage = "firstpage.jpg" -- dummy - else - images[firstpage] = firstpage - end - if lastpage == "" then - -- lastpage = "lastpage.jpg" -- dummy - else - images[lastpage] = lastpage - end + if not filename or filename == "" or type(filename) ~= "string" then + application.report("provide filename") + return + end - local uuid = format("urn:uuid:%s",os.uuid(true)) -- os.uuid() - - identifier = "bookid" -- for now - - local epubname = name - local epubpath = file.replacesuffix(name,"tree") - local epubfile = file.replacesuffix(name,"epub") - local epubroot = file.replacesuffix(name,"opf") - local epubtoc = "toc.ncx" - local epubcover = "cover.xhtml" - - application.report("creating paths in tree %s",epubpath) - lfs.mkdir(epubpath) - lfs.mkdir(file.join(epubpath,"META-INF")) - lfs.mkdir(file.join(epubpath,"OEBPS")) - - local used = { } - - local function registerone(filename) - local suffix = file.suffix(filename) - local mime = mimetypes[suffix] - if mime then - local idmaker = idmakers[suffix] or idmakers.default - used[#used+1] = replace(t_item, { - id = idmaker(filename), - filename = filename, - mime = mime, - } ) - return true - end - end + filename = file.basename(filename) - local function copyone(filename,alternative) - if registerone(filename) then - local target = file.join(epubpath,"OEBPS",file.basename(filename)) - local source = alternative or filename - file.copy(source,target) - application.report("copying %s to %s",source,target) - end + local specfile = file.replacesuffix(filename,"specification") + + if not lfs.isfile(specfile) then + application.report("unknown specificaton file %a",specfile) + return + end + + local specification = dofile(specfile) + + if not specification or not next(specification) then + application.report("invalid specificaton file %a",specfile) + return + end + + local name = specification.name or file.removesuffix(filename) + local identifier = specification.identifier or "" + local files = specification.files or { file.addsuffix(filename,"xhtml") } + local images = specification.images or { } + local root = specification.root or files[1] + local language = specification.language or "en" + local creator = specification.author or "context" + local title = specification.title or name + local firstpage = specification.firstpage or "" + local lastpage = specification.lastpage or "" + + -- identifier = gsub(identifier,"[^a-zA-z0-9]","") + + if firstpage == "" then + -- firstpage = "firstpage.jpg" -- dummy + else + images[firstpage] = firstpage + end + if lastpage == "" then + -- lastpage = "lastpage.jpg" -- dummy + else + images[lastpage] = lastpage + end + + local uuid = format("urn:uuid:%s",os.uuid(true)) -- os.uuid() + + identifier = "bookid" -- for now + + local epubname = name + local epubpath = file.replacesuffix(name,"tree") + local epubfile = file.replacesuffix(name,"epub") + local epubroot = file.replacesuffix(name,"opf") + local epubtoc = "toc.ncx" + local epubcover = "cover.xhtml" + + application.report("creating paths in tree %a",epubpath) + lfs.mkdir(epubpath) + lfs.mkdir(file.join(epubpath,"META-INF")) + lfs.mkdir(file.join(epubpath,"OEBPS")) + + local used = { } + + local function registerone(filename) + local suffix = file.suffix(filename) + local mime = mimetypes[suffix] + if mime then + local idmaker = idmakers[suffix] or idmakers.default + used[#used+1] = replace(t_item, { + id = idmaker(filename), + filename = filename, + mime = mime, + } ) + return true end + end - if lfs.isfile(epubcover) then - copyone(epubcover) - epubcover = false - else - registerone(epubcover) + local function copyone(filename,alternative) + if registerone(filename) then + local target = file.join(epubpath,"OEBPS",file.basename(filename)) + local source = alternative or filename + file.copy(source,target) + application.report("copying %a to %a",source,target) end + end + + if lfs.isfile(epubcover) then + copyone(epubcover) + epubcover = false + else + registerone(epubcover) + end - copyone("toc.ncx") - - local function copythem(files) - for i=1,#files do - local filename = files[i] - if type(filename) == "string" then - local suffix = file.suffix(filename) - if suffix == "xhtml" then - local alternative = file.replacesuffix(filename,"html") - if lfs.isfile(alternative) then - copyone(filename,alternative) + copyone("toc.ncx") + + local function copythem(files) + for i=1,#files do + local filename = files[i] + if type(filename) == "string" then + local suffix = file.suffix(filename) + if suffix == "xhtml" then + local alternative = file.replacesuffix(filename,"html") + if lfs.isfile(alternative) then + copyone(filename,alternative) + else + copyone(filename) + end + elseif suffix == "css" then + if filename == "export-example.css" then + if lfs.isfile(filename) then + os.remove(filename) + local original = resolvers.findfile(filename) + application.report("updating local copy of %a from %a",filename,original) + file.copy(original,filename) else - copyone(filename) - end - elseif suffix == "css" then - if not lfs.isfile(filename) then filename = resolvers.findfile(filename) end - copyone(filename) + elseif not lfs.isfile(filename) then + filename = resolvers.findfile(filename) else - copyone(filename) + -- use specific local one end + copyone(filename) + else + copyone(filename) end end end + end - copythem(files) + copythem(files) - local theimages = { } + local theimages = { } - for k, v in table.sortedpairs(images) do - theimages[#theimages+1] = k - if not lfs.isfile(k) and file.suffix(k) == "svg" and file.suffix(v) == "pdf" then - local command = format("inkscape --export-plain-svg=%s %s",k,v) - application.report("running command '%s'\n\n",command) - os.execute(command) - end + for k, v in table.sortedpairs(images) do + theimages[#theimages+1] = k + if not lfs.isfile(k) and file.suffix(k) == "svg" and file.suffix(v) == "pdf" then + local command = format("inkscape --export-plain-svg=%s %s",k,v) + application.report("running command %a\n\n",command) + os.execute(command) end + end - used[#used+1] = replace(t_nav, { - id = "nav", - filename = "nav.xhtml", - properties = "nav", - mime = "application/xhtml+xml", - }) + used[#used+1] = replace(t_nav, { + id = "nav", + filename = "nav.xhtml", + properties = "nav", + mime = "application/xhtml+xml", + }) - io.savedata(file.join(epubpath,"OEBPS","nav.xhtml"),replace(t_navtoc, { -- version 3.0 - root = root, - } ) ) + io.savedata(file.join(epubpath,"OEBPS","nav.xhtml"),replace(t_navtoc, { -- version 3.0 + root = root, + } ) ) - copythem(theimages) + copythem(theimages) - local idmaker = idmakers[file.suffix(root)] or idmakers.default + local idmaker = idmakers[file.suffix(root)] or idmakers.default - io.savedata(file.join(epubpath,"mimetype"),mimetype) + io.savedata(file.join(epubpath,"mimetype"),mimetype) - io.savedata(file.join(epubpath,"META-INF","container.xml"),replace(t_container, { -- version 2.0 - rootfile = epubroot - } ) ) + io.savedata(file.join(epubpath,"META-INF","container.xml"),replace(t_container, { -- version 2.0 + rootfile = epubroot + } ) ) - io.savedata(file.join(epubpath,"OEBPS",epubroot),replace(t_package, { - identifier = identifier, - title = title, - language = language, - uuid = uuid, - creator = creator, - date = os.date("!%Y-%m-%dT%H:%M:%SZ"), - firstpage = idmaker(firstpage), - manifest = concat(used,"\n"), - rootfile = idmaker(root) - } ) ) + io.savedata(file.join(epubpath,"OEBPS",epubroot),replace(t_package, { + identifier = identifier, + title = title, + language = language, + uuid = uuid, + creator = creator, + date = os.date("!%Y-%m-%dT%H:%M:%SZ"), + firstpage = idmaker(firstpage), + manifest = concat(used,"\n"), + rootfile = idmaker(root) + } ) ) - -- t_toc is replaced by t_navtoc in >= 3 + -- t_toc is replaced by t_navtoc in >= 3 - io.savedata(file.join(epubpath,"OEBPS",epubtoc), replace(t_toc, { - identifier = uuid, -- identifier, - title = title, - author = author, - root = root, - } ) ) + io.savedata(file.join(epubpath,"OEBPS",epubtoc), replace(t_toc, { + identifier = uuid, -- identifier, + title = title, + author = author, + root = root, + } ) ) - if epubcover then + if epubcover then - io.savedata(file.join(epubpath,"OEBPS",epubcover), replace(t_coverxhtml, { - content = firstpage ~= "" and replace(t_coverimg, { image = firstpage }) or "no cover page defined", - } ) ) + io.savedata(file.join(epubpath,"OEBPS",epubcover), replace(t_coverxhtml, { + content = firstpage ~= "" and replace(t_coverimg, { image = firstpage }) or "no cover page defined", + } ) ) - end + end - application.report("creating archive\n\n") + application.report("creating archive\n\n") - lfs.chdir(epubpath) - os.remove(epubfile) + lfs.chdir(epubpath) + os.remove(epubfile) - local done = false + local done = false - for i=1,#zippers do - local zipper = zippers[i] - if os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then - os.execute(format(zipper.compressed,epubfile,"META-INF")) - os.execute(format(zipper.compressed,epubfile,"OEBPS")) - done = zipper.name - break - end + for i=1,#zippers do + local zipper = zippers[i] + if os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then + os.execute(format(zipper.compressed,epubfile,"META-INF")) + os.execute(format(zipper.compressed,epubfile,"OEBPS")) + done = zipper.name + break end + end - lfs.chdir("..") + lfs.chdir("..") - if done then - application.report("epub archive made using %s: %s",done,file.join(epubpath,epubfile)) - else - local list = { } - for i=1,#zippers do - list[#list+1] = zipper.name - end - application.report("no epub archive made, install one of: %s",concat(list," ")) + if done then + application.report("epub archive made using %s: %s",done,file.join(epubpath,epubfile)) + else + local list = { } + for i=1,#zippers do + list[#list+1] = zipper.name end - + application.report("no epub archive made, install one of: %s",concat(list," ")) end end diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 85d6c5ef3..364949a1a 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -2875,7 +2875,7 @@ local htmltemplate = [[ firstpage = validstring(finetuning.firstpage), lastpage = validstring(finetuning.lastpage), } - report_export("saving specification in %a (mtxrun --script epub --make %s)",specificationfilename,specificationfilename) + report_export("saving specification in %a",specificationfilename,specificationfilename) io.savedata(specificationfilename,table.serialize(specification,true)) -- bonus local resultfile = file.replacesuffix(xmlfile,"html") @@ -2889,7 +2889,7 @@ local htmltemplate = [[ } io.savedata(resultfile,utilities.templates.replace(htmltemplate,variables,"xml")) report_export("") - report_export("create epub with: mtxrun --script epub --make %a",file.basename(resultfile)) + report_export([[create epub with: mtxrun --script epub --make "%s"]],file.nameonly(resultfile)) report_export("") end stoptiming(treehash) diff --git a/tex/context/base/back-exp.mkiv b/tex/context/base/back-exp.mkiv index a7f8e0040..7cae68f0e 100644 --- a/tex/context/base/back-exp.mkiv +++ b/tex/context/base/back-exp.mkiv @@ -166,6 +166,9 @@ \c!properties=\v!no, % no: ignore, yes: as attribute, otherwise: use as prefix \c!hyphen=\v!no] +\setupbackend + [css=export-example.css] + \def\dosynchronizeexport {\let\currentexport\empty \ctxcommand{setupexport{ diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 3a91d18a9..4e786749f 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2014.09.06 13:38} +\newcontextversion{2014.09.06 15:41} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 76ffe4c7f..b6841d7f4 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index f8a7f3db4..878d9d2a7 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.09.06 13:38} +\edef\contextversion{2014.09.06 15:41} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/export-example.css b/tex/context/base/export-example.css index 41b262ac4..2dfadb701 100644 --- a/tex/context/base/export-example.css +++ b/tex/context/base/export-example.css @@ -120,26 +120,31 @@ sectioncontent, div.sectioncontent { section[detail="chapter"], section[detail="title"], div.section.detail-chapter, div.section.detail-title { - margin-top : 3em ; - margin-bottom : 2em ; + page-break-before : always ; + page-break-after : avoid ; + margin-top : 3em ; + margin-bottom : 2em ; } section[detail="section"], section[detail="subject"], div.section.detail-section, div.section.detail-subject { - margin-top : 2.5em ; - margin-bottom : 2.5em ; + page-break-after : avoid ; + margin-top : 2.5em ; + margin-bottom : 2.5em ; } section[detail="subsection"], section[detail="subsubject"], div.section.detail-subsection, div.section.detail-subsubject { - margin-top : 2em ; - margin-bottom : 2em ; + page-break-after : avoid ; + margin-top : 2em ; + margin-bottom : 2em ; } section[detail="subsubsection"], section[detail="subsubsubject"], div.section.detail-subsubsection, div.section.detail-subsubsubject { - margin-top : 1em ; - margin-bottom : 0em ; + page-break-after : avoid ; + margin-top : 1em ; + margin-bottom : 0em ; } section[detail="summary"], section[detail="subsummary"], @@ -725,16 +730,18 @@ quantity>number, div.quantity div.number { /* subsup : inline */ sup, div.sup { - display : inline ; + display : inline-block ; font-size : xx-small ; line-height : 0 ; + padding-top : 0.5ex ; vertical-align : top ; } sub, div.sub { - display : inline ; + display : inline-block ; font-size : xx-small ; line-height : 0 ; + padding-bottom : 0.5ex ; vertical-align : bottom ; } @@ -748,7 +755,7 @@ subsup>sub, div.subsup div.sub { vertical-align : bottom ; } -/* xhtml */ +/* xhtml ... not used any more */ a[href] { text-decoration : none ; diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 13f8e3462..78277fcf4 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 3487a0b94..e49b9a37d 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 523febd78..c3863daf3 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 09/06/14 13:38:59 +-- merge date : 09/06/14 15:41:01 do -- begin closure to overcome local limits and interference |