% Package odsfile. Author Michal Hoftich <michal.h21@gmail.com>
% This package is subject of LPPL license, version 1.3 
\ProvidesPackage{tex4ebook}[2016/03/31 version 0.1d]
\RequirePackage{etoolbox}
\RequirePackage{kvoptions}
\RequirePackage{graphicx}
% Command for generating NCX file. Hard work is odne in the file
% tex4ebook.4ht
\def\ncxtable{}
% Command for generating OPF file 
\def\opftable{}

%Declare RFC3066 language code for babel language name
\def\DeclareLanguage#1#2{%
\csgdef{rfclang#1}{#2}%
}
\def\GetLanguage{%
\ifx\bbl@main@language\@undefined en-US%  
\else%
\ifcsdef{rfclang\bbl@main@language}{\csuse{rfclang\bbl@main@language}}{}%
\fi%
}

\DeclareLanguage{english}{en-US}
\DeclareLanguage{czech}{cs-CZ}
\DeclareLanguage{french}{fr}
\DeclareLanguage{polish}{pl-PL}
\DeclareLanguage{german}{de}
\DeclareLanguage{bulgarian}{bg}
\DeclareLanguage{catalan}{ca}
\DeclareLanguage{croatian}{hr}
\DeclareLanguage{danish}{da}
\DeclareLanguage{dutch}{nl}
\DeclareLanguage{USenglish}{en-US}
\DeclareLanguage{american}{en-US}
\DeclareLanguage{UKenglish}{en-GB}
\DeclareLanguage{british}{en-GB}
\DeclareLanguage{canadian}{en-US}
\DeclareLanguage{australian}{en-US}
\DeclareLanguage{newzealand}{en-US}
\DeclareLanguage{esperanto}{eo}
\DeclareLanguage{estonian}{et}
\DeclareLanguage{finnish}{f\/i}
\DeclareLanguage{francais}{fr}
\DeclareLanguage{canadien}{fr}
\DeclareLanguage{acadian}{fr}
\DeclareLanguage{galician}{gl}
\DeclareLanguage{austrian}{de}
\DeclareLanguage{german}{de}
\DeclareLanguage{germanb}{de}
\DeclareLanguage{ngerman}{de}
\DeclareLanguage{naustrian}{de}
\DeclareLanguage{greek}{el}
\DeclareLanguage{polutonikogreek}{el}
\DeclareLanguage{hebrew}{he}
\DeclareLanguage{magyar}{hu}
\DeclareLanguage{hungarian}{hu}
\DeclareLanguage{icelandic}{is}
\DeclareLanguage{interlingua}{ie}
\DeclareLanguage{irish}{ga}
\DeclareLanguage{italian}{it}
\DeclareLanguage{latin}{la}
\DeclareLanguage{lowersorbian}{dsb}
\DeclareLanguage{samin}{se}
\DeclareLanguage{norsk}{no}
\DeclareLanguage{nynorsk}{no}
\DeclareLanguage{portuges}{pt}
\DeclareLanguage{portuguese}{pt}
\DeclareLanguage{brazilian}{pt}
\DeclareLanguage{brazil}{pt}
\DeclareLanguage{romanian}{ro}
\DeclareLanguage{russian}{ru}
\DeclareLanguage{scottish}{gd}
\DeclareLanguage{spanish}{es}
\DeclareLanguage{slovak}{sk}
\DeclareLanguage{slovene}{sl}
\DeclareLanguage{swedish}{sv}
\DeclareLanguage{serbian}{sr}
\DeclareLanguage{turkish}{tr}
\DeclareLanguage{ukrainian}{uk}
\DeclareLanguage{uppersorbian}{hsb}
\DeclareLanguage{welsh}{cy}

\AtEndDocument{%
\ncxtable
\opftable
}

% Default empty values
\def\Title{Unnamed}
\def\Author{Anonymous}

% We need to save values of title, author etc.
%\AtBeginDocument{
\let\origtitle\title
\renewcommand\title[1]{%
  \origtitle{#1}
  \let\Title\@title
}

\let\origauthor\author
\renewcommand\author[1]{%
  \origauthor{#1}%
  \let\Author\@author
}
%\let\Author\@author
\let\Date\today
\let\origdate\date
\renewcommand\date[1]{%
  \origdate{#1}%
  \let\Date\@date%
}
%}

\newcommand\coverimage[2][]{\includegraphics[#1]{#2}}
