From b0f3c5dbdee94cfa9a26b96c6d2f41370392df64 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 5 Jul 2015 22:09:45 +0000 Subject: tex4ebook (5jul15) git-svn-id: svn://tug.org/texlive/trunk@37771 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/texk/texlive/linked_scripts/Makefile.am | 21 +-- .../source/texk/texlive/linked_scripts/Makefile.in | 21 +-- .../source/texk/texlive/linked_scripts/scripts.lst | 21 +-- .../texlive/linked_scripts/tex4ebook/tex4ebook | 154 +++++++++++++++++++++ 4 files changed, 187 insertions(+), 30 deletions(-) create mode 100755 Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook (limited to 'Build') diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index be0cbe8cbc1..17a15f0eac7 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -113,16 +113,16 @@ texmf_other_scripts = \ fragmaster/fragmaster.pl \ getmap/getmapdl.lua \ glossaries/makeglossaries \ - jfontmaps/kanji-fontmap-creator.pl \ - jfontmaps/kanji-config-updmap.pl \ jfontmaps/kanji-config-updmap-sys.sh \ + jfontmaps/kanji-config-updmap.pl \ + jfontmaps/kanji-fontmap-creator.pl \ kotex-utils/jamo-normalize.pl \ kotex-utils/komkindex.pl \ kotex-utils/ttf2kotexfont.pl \ latex-git-log/latex-git-log \ latex2man/latex2man \ - latexdiff/latexdiff.pl \ latexdiff/latexdiff-vc.pl \ + latexdiff/latexdiff.pl \ latexdiff/latexrevise.pl \ latexindent/latexindent.pl \ latexmk/latexmk.pl \ @@ -137,8 +137,8 @@ texmf_other_scripts = \ match_parens/match_parens \ mathspic/mathspic.pl \ mf2pt1/mf2pt1.pl \ - mkjobtexmf/mkjobtexmf.pl \ mkgrkindex/mkgrkindex \ + mkjobtexmf/mkjobtexmf.pl \ mkpic/mkpic \ multibibliography/multibibliography.pl \ musixtex/musixflx.lua \ @@ -148,34 +148,35 @@ texmf_other_scripts = \ pdfcrop/pdfcrop.pl \ pedigree-perl/pedigree.pl \ perltex/perltex.pl \ - pfarrei/pfarrei.tlu \ pfarrei/a5toa4.tlu \ - pkfix/pkfix.pl \ + pfarrei/pfarrei.tlu \ pkfix-helper/pkfix-helper \ + pkfix/pkfix.pl \ pmx/pmx2pdf.lua \ pmxchords/pmxchords.lua \ pst2pdf/pst2pdf.pl \ ptex2pdf/ptex2pdf.lua \ purifyeps/purifyeps \ pygmentex/pygmentex.py \ - pythontex/pythontex.py \ pythontex/depythontex.py \ + pythontex/pythontex.py \ rubik/rubikrotation.pl \ splitindex/splitindex.pl \ sty2dtx/sty2dtx.pl \ svn-multi/svn-multi.pl \ - texdoc/texdoc.tlu \ + tex4ebook/tex4ebook \ texcount/texcount.pl \ texdef/texdef.pl \ texdiff/texdiff \ texdirflatten/texdirflatten \ + texdoc/texdoc.tlu \ texfot/texfot.pl \ - texlive/fmtutil.pl \ texlive/fmtutil-sys.sh \ + texlive/fmtutil.pl \ texlive/rungs.tlu \ texlive/tlmgr.pl \ - texlive/updmap.pl \ texlive/updmap-sys.sh \ + texlive/updmap.pl \ texliveonfly/texliveonfly.py \ texloganalyser/texloganalyser \ thumbpdf/thumbpdf.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index e5b3b051163..572170f8982 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -329,16 +329,16 @@ texmf_other_scripts = \ fragmaster/fragmaster.pl \ getmap/getmapdl.lua \ glossaries/makeglossaries \ - jfontmaps/kanji-fontmap-creator.pl \ - jfontmaps/kanji-config-updmap.pl \ jfontmaps/kanji-config-updmap-sys.sh \ + jfontmaps/kanji-config-updmap.pl \ + jfontmaps/kanji-fontmap-creator.pl \ kotex-utils/jamo-normalize.pl \ kotex-utils/komkindex.pl \ kotex-utils/ttf2kotexfont.pl \ latex-git-log/latex-git-log \ latex2man/latex2man \ - latexdiff/latexdiff.pl \ latexdiff/latexdiff-vc.pl \ + latexdiff/latexdiff.pl \ latexdiff/latexrevise.pl \ latexindent/latexindent.pl \ latexmk/latexmk.pl \ @@ -353,8 +353,8 @@ texmf_other_scripts = \ match_parens/match_parens \ mathspic/mathspic.pl \ mf2pt1/mf2pt1.pl \ - mkjobtexmf/mkjobtexmf.pl \ mkgrkindex/mkgrkindex \ + mkjobtexmf/mkjobtexmf.pl \ mkpic/mkpic \ multibibliography/multibibliography.pl \ musixtex/musixflx.lua \ @@ -364,34 +364,35 @@ texmf_other_scripts = \ pdfcrop/pdfcrop.pl \ pedigree-perl/pedigree.pl \ perltex/perltex.pl \ - pfarrei/pfarrei.tlu \ pfarrei/a5toa4.tlu \ - pkfix/pkfix.pl \ + pfarrei/pfarrei.tlu \ pkfix-helper/pkfix-helper \ + pkfix/pkfix.pl \ pmx/pmx2pdf.lua \ pmxchords/pmxchords.lua \ pst2pdf/pst2pdf.pl \ ptex2pdf/ptex2pdf.lua \ purifyeps/purifyeps \ pygmentex/pygmentex.py \ - pythontex/pythontex.py \ pythontex/depythontex.py \ + pythontex/pythontex.py \ rubik/rubikrotation.pl \ splitindex/splitindex.pl \ sty2dtx/sty2dtx.pl \ svn-multi/svn-multi.pl \ - texdoc/texdoc.tlu \ + tex4ebook/tex4ebook \ texcount/texcount.pl \ texdef/texdef.pl \ texdiff/texdiff \ texdirflatten/texdirflatten \ + texdoc/texdoc.tlu \ texfot/texfot.pl \ - texlive/fmtutil.pl \ texlive/fmtutil-sys.sh \ + texlive/fmtutil.pl \ texlive/rungs.tlu \ texlive/tlmgr.pl \ - texlive/updmap.pl \ texlive/updmap-sys.sh \ + texlive/updmap.pl \ texliveonfly/texliveonfly.py \ texloganalyser/texloganalyser \ thumbpdf/thumbpdf.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/scripts.lst b/Build/source/texk/texlive/linked_scripts/scripts.lst index b8682c41f9a..881374bee1d 100644 --- a/Build/source/texk/texlive/linked_scripts/scripts.lst +++ b/Build/source/texk/texlive/linked_scripts/scripts.lst @@ -59,16 +59,16 @@ fontools/ot2kpx fragmaster/fragmaster.pl getmap/getmapdl.lua glossaries/makeglossaries -jfontmaps/kanji-fontmap-creator.pl -jfontmaps/kanji-config-updmap.pl jfontmaps/kanji-config-updmap-sys.sh +jfontmaps/kanji-config-updmap.pl +jfontmaps/kanji-fontmap-creator.pl kotex-utils/jamo-normalize.pl kotex-utils/komkindex.pl kotex-utils/ttf2kotexfont.pl latex-git-log/latex-git-log latex2man/latex2man -latexdiff/latexdiff.pl latexdiff/latexdiff-vc.pl +latexdiff/latexdiff.pl latexdiff/latexrevise.pl latexindent/latexindent.pl latexmk/latexmk.pl @@ -83,8 +83,8 @@ make4ht/make4ht match_parens/match_parens mathspic/mathspic.pl mf2pt1/mf2pt1.pl -mkjobtexmf/mkjobtexmf.pl mkgrkindex/mkgrkindex +mkjobtexmf/mkjobtexmf.pl mkpic/mkpic multibibliography/multibibliography.pl musixtex/musixflx.lua @@ -94,34 +94,35 @@ pax/pdfannotextractor.pl pdfcrop/pdfcrop.pl pedigree-perl/pedigree.pl perltex/perltex.pl -pfarrei/pfarrei.tlu pfarrei/a5toa4.tlu -pkfix/pkfix.pl +pfarrei/pfarrei.tlu pkfix-helper/pkfix-helper +pkfix/pkfix.pl pmx/pmx2pdf.lua pmxchords/pmxchords.lua pst2pdf/pst2pdf.pl ptex2pdf/ptex2pdf.lua purifyeps/purifyeps pygmentex/pygmentex.py -pythontex/pythontex.py pythontex/depythontex.py +pythontex/pythontex.py rubik/rubikrotation.pl splitindex/splitindex.pl sty2dtx/sty2dtx.pl svn-multi/svn-multi.pl -texdoc/texdoc.tlu +tex4ebook/tex4ebook texcount/texcount.pl texdef/texdef.pl texdiff/texdiff texdirflatten/texdirflatten +texdoc/texdoc.tlu texfot/texfot.pl -texlive/fmtutil.pl texlive/fmtutil-sys.sh +texlive/fmtutil.pl texlive/rungs.tlu texlive/tlmgr.pl -texlive/updmap.pl texlive/updmap-sys.sh +texlive/updmap.pl texliveonfly/texliveonfly.py texloganalyser/texloganalyser thumbpdf/thumbpdf.pl diff --git a/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook b/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook new file mode 100755 index 00000000000..c43bc330583 --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook @@ -0,0 +1,154 @@ +#!/usr/bin/env texlua +kpse.set_program_name("luatex") +require("lapp-mk4") +-- require("ebookutils") +local ebookutils = require "mkutils" + +-- Setting +local latex_cmd="latex" +local copy_cmd="copy" +local move_cmd="move" +local env_param="%%" +local htlatex_call="" +-- These correspond to htlatex parameters +local tex4ht_sty_par="" +local tex4ht_par="" +local t4ht_par="" +local latex_par="" +local output_formats={epub=true,mobi=true,epub3=true} +local executor=nil +local tidy = false +local include_fonts = false +local arg_message = [[ +tex4ebook - ebook generation support for LaTeX +Usage: +tex4ebook [switches] inputfile ["tex4ht.sty op." "tex4ht op." "t4ht op" "latex op"] +-c,--config (default xhtml) Custom config file +-e,--build-file (default nil) If build file is different than `filename`.mk4 +-f,--format (default epub) Output format. Supported values: epub, epub3, mobi +-l,--lua Runs htlualatex instead of htlatex +-m,--mode (default default) Switch which can be used in the makefile +-r,--resolution (default 167) +-s,--shell-escape Enable shell escape in htlatex run +-t,--tidy Run html tidy on html output. May result in wrong spacing! +]] + +-- This option is no longer available, all files must be unicode +-- -u,--utf8 +local args=lapp(arg_message) + +if args[1] == nil then + print(arg_message) + return +else + input_file=args[1] +end + +if args.lua then + print("Mame lua") + latex_cmd="dvilualatex" +end + +--if args.utf8 then +tex4ht_sty_par=tex4ht_sty_par .. ", charset=utf-8" +tex4ht_par=tex4ht_par .. " -cmozhtf -utf8" +--end + +if args["shell-escape"] then + latex_par = latex_par .. " -shell-escape" +end + +if args["include-fonts"] then + include_fonts = true +end + +-- local mathml = "," +-- if args["mathml"] then +-- -- mathml = ",mathml," +-- tex4ht_sty_par = tex4ht_sty_par .. ",mathml" +-- end +local mode = args.mode or "default" + +if os.type=="unix" then + env_param="$" + copy_cmd="cp" + move_cmd="mv" + t4ht_dir_format="%s/" +else + env_param="%%" + copy_cmd="copy" + move_cmd="move" + t4ht_dir_format="%s" +end + +if args.tidy then + tidy = true +else + tidy = false +end +-- Env file copying + +--[[if not ebookutils.file_exists("tex4ht.env") then +local env_file = kpse.find_file("epub2.env") +ebookutils.copy_filter(env_file,"tex4ht.env",function(s) return s % { +move = move_cmd, +copy = copy_cmd, +resolution = args.resolution +} end) +end--]] + +--print ("nazdar ${world}" % {world="svete"}) +--print(args.config) + +local input = ebookutils.remove_extension(input_file) +local config=ebookutils.remove_extension(args.config) +local tex4ht_sty_par = config ..tex4ht_sty_par..","+args.format +--local sty_args = args[2] and ", " .. args[2] or "" +local sty_args = "" +if args[2] then + sty_args = "," .. args[2] +end +local tex4ht_sty_par = tex4ht_sty_par + sty_args --args[2] +local tex4ht_par = tex4ht_par +args[3] +local t4ht_par = t4ht_par + args[4] +local latex_par = latex_par + args[5] +local params = { + htlatex=latex_cmd + ,input=input + ,format=args.format + ,latex_par=latex_par + ,tex4ht_sty_par=tex4ht_sty_par + ,tex4ht_par=tex4ht_par + ,t4ht_par=t4ht_par + ,mode = mode + ,t4ht_dir_format=t4ht_dir_format + ,tidy = tidy + ,include_fonts = include_fonts + ,resolution=args.resolution + ,mathml=mathml + ,packages="\\RequirePackage{tex4ebook}" +} + +if output_formats[args.format] then + executor=require("exec_"..args.format) + params=executor.prepare(params) +else + print("Unknown output format: "..args.format) + return +end + +local build_file = input.. ".mk4" + +if args["build-file"] and args["build-file"] ~= "nil" then + build_file = args["build-file"] +end + +local config_file = ebookutils.load_config(nil, build_file) + +params["config_file"] = config_file +--config_file.Make:run() +print("${htlatex} ${input} \"${tex4ht_sty_par}\" \"${tex4ht_par}\" \"${t4ht_par}\" \"${latex_par}\"" % params) +executor.run(input,params) +executor.writeContainer() +executor.clean() +--print(args[1]) -- cgit v1.2.3