diff options
author | Karl Berry <karl@freefriends.org> | 2015-12-11 23:15:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-12-11 23:15:40 +0000 |
commit | 9edfaa6ebaa5d0e7e3df5a822c675bbe565b96e4 (patch) | |
tree | a7aa4739b367af3dcacc6fecfd6b3013af23c93a | |
parent | 7b226b60f1c5dce3911375f82c4711dc6ff30fc3 (diff) |
tex4ebook (11dec15)
git-svn-id: svn://tug.org/texlive/trunk@39076 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook | 47 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/tex4ebook/README | 13 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/tex4ebook/changelog.tex | 31 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/tex4ebook/readme.tex | 14 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf | bin | 65558 -> 67026 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex | 2 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/tex4ebook | 47 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht | 5 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty | 10 |
9 files changed, 137 insertions, 32 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook b/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook index 7c677b00d56..64dcd0d7e1d 100755 --- a/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook +++ b/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook @@ -6,6 +6,7 @@ kpse.set_program_name("luatex") require("lapp-mk4") -- require("ebookutils") local ebookutils = require "mkutils" +local mkparams = require "mkparams" -- Setting local latex_cmd="latex" @@ -25,26 +26,34 @@ 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"] +tex4ebook [switches] filename ["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 +-h,--help Display help message -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! +-v,--version Display version number +<filename> (string) Input file name ]] -- This option is no longer available, all files must be unicode -- -u,--utf8 local args=lapp(arg_message) -if args[1] == nil then +if args["filename"] == nil and args["version"] == false then print(arg_message) return else - input_file=args[1] + input_file=args["filename"] +end + +if args.version then + print "tex4ebook version 0.1c" + return end if args.lua then @@ -115,15 +124,23 @@ 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 + +-- use default parameter processing from make4ht +-- add some needed args +args.filename=input_file +local params = mkparams.process_args(args) + +-- but also support tex4ebook!s own parameters +local oldparams = { + -- htlatex=latex_cmd + -- ,input=input + -- ,tex_file = tex_file + 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 @@ -132,6 +149,12 @@ local params = { ,packages="\\RequirePackage{tex4ebook}" } +-- extend params +for k,v in pairs(oldparams) do + params[k] = v +end + + if output_formats[args.format] then executor=require("exec_"..args.format) params=executor.prepare(params) diff --git a/Master/texmf-dist/doc/support/tex4ebook/README b/Master/texmf-dist/doc/support/tex4ebook/README index 55ab0a0f7d2..2514a630aca 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/README +++ b/Master/texmf-dist/doc/support/tex4ebook/README @@ -99,11 +99,15 @@ but it is optional. You shouldn't need to modify your \TeX\ files : Enable shell escape in htlatex run. This may be needed if you run external commands from your source files. -t,--tidy +-t,--tidy : process output html files with `HTML tidy` command^[It needs to be installed separately]. +-v,--version +: print version number + + # Configuration `tex4ebook` uses `tex4ht`^[\url{http://www.tug.org/tex4ht/}] for conversion from LaTeX @@ -147,6 +151,13 @@ Default identifier is URI, with value `http://example.com/\jobname`. Type of unique identifier, default type is URI. It is used only in epub, it is deprecated for `epub3` + \Configure{DocumentLanguage}{language code} + +Each epub must declare the document language. It is inferred from `babel` main +language by default, but you can configure it when it doesn't work correctly. +The `language code` should be in [ISO +639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) form. + \Configure{CoverImage}{before cover image}{after cover image} By default, cover image is inserted in `<div class="cover-image">` element, diff --git a/Master/texmf-dist/doc/support/tex4ebook/changelog.tex b/Master/texmf-dist/doc/support/tex4ebook/changelog.tex index 40c7e0afc40..eb45a1fd524 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/changelog.tex +++ b/Master/texmf-dist/doc/support/tex4ebook/changelog.tex @@ -2,6 +2,37 @@ \begin{itemize} \item + 06/12/2015 Version 0.1c + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + added \texttt{-{}-help} and \texttt{-{}-version} command line + options + \end{itemize} +\item + 25/11/2015 + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + added missing language codes + \item + added \texttt{\textbackslash{}Configure\{DocumentLanguage\}} for the + cases when document language inferencing doesn't work + \end{itemize} +\item + 17/11/2015 + + \begin{itemize} + \itemsep1pt\parskip0pt\parsep0pt + \item + use mkparams for cli arguments handling. + \item + fixed inconsistencies between recent changes in make4ht and + tex4ebook + \end{itemize} +\item 24/09/2015 Version 0.1b \begin{itemize} diff --git a/Master/texmf-dist/doc/support/tex4ebook/readme.tex b/Master/texmf-dist/doc/support/tex4ebook/readme.tex index 3dc7b94e96d..01ea98348c3 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/readme.tex +++ b/Master/texmf-dist/doc/support/tex4ebook/readme.tex @@ -106,9 +106,11 @@ resolution of target devices, which is usually about 167 ppi. \item[-s,--shell-escape] Enable shell escape in htlatex run. This may be needed if you run external commands from your source files. -\item[t,--tidy] +\item[-t,--tidy] process output html files with \texttt{HTML tidy} command\footnote{It needs to be installed separately}. +\item[-v,--version] +print version number \end{description} \section{Configuration}\label{configuration} @@ -163,6 +165,16 @@ Type of unique identifier, default type is URI. It is used only in epub, it is deprecated for \texttt{epub3} \begin{verbatim} +\Configure{DocumentLanguage}{language code} +\end{verbatim} + +Each epub must declare the document language. It is inferred from +\texttt{babel} main language by default, but you can configure it when +it doesn't work correctly. The \texttt{language code} should be in +\href{https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes}{ISO 639-1} +form. + +\begin{verbatim} \Configure{CoverImage}{before cover image}{after cover image} \end{verbatim} diff --git a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf Binary files differindex ab8150d2e06..89000dc6dad 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf +++ b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.pdf diff --git a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex index a5f75c7122d..f2437dd4907 100644 --- a/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex +++ b/Master/texmf-dist/doc/support/tex4ebook/tex4ebook-doc.tex @@ -14,7 +14,7 @@ \title{The \texttt{tex4ebook} package} \author{Michal Hoftich\footnote{\url{michal.h21@gmail.com}}} -\date{Version 0.1a\\05/07/2015} +\date{Version 0.1c\\12/11/2015} \begin{document} \maketitle \tableofcontents diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook b/Master/texmf-dist/scripts/tex4ebook/tex4ebook index 7c677b00d56..64dcd0d7e1d 100755 --- a/Master/texmf-dist/scripts/tex4ebook/tex4ebook +++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook @@ -6,6 +6,7 @@ kpse.set_program_name("luatex") require("lapp-mk4") -- require("ebookutils") local ebookutils = require "mkutils" +local mkparams = require "mkparams" -- Setting local latex_cmd="latex" @@ -25,26 +26,34 @@ 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"] +tex4ebook [switches] filename ["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 +-h,--help Display help message -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! +-v,--version Display version number +<filename> (string) Input file name ]] -- This option is no longer available, all files must be unicode -- -u,--utf8 local args=lapp(arg_message) -if args[1] == nil then +if args["filename"] == nil and args["version"] == false then print(arg_message) return else - input_file=args[1] + input_file=args["filename"] +end + +if args.version then + print "tex4ebook version 0.1c" + return end if args.lua then @@ -115,15 +124,23 @@ 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 + +-- use default parameter processing from make4ht +-- add some needed args +args.filename=input_file +local params = mkparams.process_args(args) + +-- but also support tex4ebook!s own parameters +local oldparams = { + -- htlatex=latex_cmd + -- ,input=input + -- ,tex_file = tex_file + 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 @@ -132,6 +149,12 @@ local params = { ,packages="\\RequirePackage{tex4ebook}" } +-- extend params +for k,v in pairs(oldparams) do + params[k] = v +end + + if output_formats[args.format] then executor=require("exec_"..args.format) params=executor.prepare(params) diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht index add25d2f075..8c7c51903b4 100644 --- a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht +++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.4ht @@ -25,6 +25,11 @@ \Configure{UniqueIdentifier}{http://example.com/\jobname} +% allow configuration of the document language. babel's main language is used by default +% use this only if it doesn't work +\NewConfigure{DocumentLanguage}[1]{\def\GetLanguage{#1}} + + \NewConfigure{OpfScheme}{1} \Configure{OpfScheme}{URI} diff --git a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty index 4804710e864..b8fbfaf4d39 100644 --- a/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty +++ b/Master/texmf-dist/tex/latex/tex4ebook/tex4ebook.sty @@ -1,6 +1,6 @@ % Package odsfile. Author Michal Hoftich <michal.h21@gmail.com> % This package is subject of LPPL license, version 1.3 -\ProvidesPackage{tex4ebook}[2015/09/24 version 0.1b] +\ProvidesPackage{tex4ebook}[2015/12/11 version 0.1c] \RequirePackage{etoolbox} \RequirePackage{kvoptions} \RequirePackage{graphicx} @@ -60,8 +60,8 @@ \DeclareLanguage{irish}{ga} \DeclareLanguage{italian}{it} \DeclareLanguage{latin}{la} -%\DeclareLanguage{lowersorbian}{no code?} -%\DeclareLanguage{samin}{no code?} +\DeclareLanguage{lowersorbian}{dsb} +\DeclareLanguage{samin}{se} \DeclareLanguage{norsk}{no} \DeclareLanguage{nynorsk}{no} \DeclareLanguage{portuges}{pt} @@ -70,7 +70,7 @@ \DeclareLanguage{brazil}{pt} \DeclareLanguage{romanian}{ro} \DeclareLanguage{russian}{ru} -%\DeclareLanguage{scottish}{no code?} +\DeclareLanguage{scottish}{gd} \DeclareLanguage{spanish}{es} \DeclareLanguage{slovak}{sk} \DeclareLanguage{slovene}{sl} @@ -78,7 +78,7 @@ \DeclareLanguage{serbian}{sr} \DeclareLanguage{turkish}{tr} \DeclareLanguage{ukrainian}{uk} -%\DeclareLanguage{uppersorbian}{no code?} +\DeclareLanguage{uppersorbian}{hsb} \DeclareLanguage{welsh}{cy} \AtEndDocument{% |