Merge branch 'main' of ssh://git.wlankabel.at:1516/aqoaba/md2tex
This commit is contained in:
commit
73e6ecc137
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.venv
|
30
README.md
30
README.md
@ -1,6 +1,11 @@
|
|||||||
# README
|
# README
|
||||||
|
|
||||||
All names are temporary and happy about suggestions of improvement.
|
All names are temporary and happy about suggestions of improvement.
|
||||||
|
Dependencies:
|
||||||
|
- bash
|
||||||
|
- python3
|
||||||
|
- pypdf (e.g. `python3 -m venv .venv && . .venv/bin/activate && pip install pypdf`)
|
||||||
|
- xelatex (e.g. `apt install texlive-xetex`)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -69,13 +74,26 @@ s=4: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 -> 16,01.02,15 14,03.04,13 12,05.06,
|
|||||||
|
|
||||||
### TODO
|
### TODO
|
||||||
- [x] create md2verse.sh
|
- [x] create md2verse.sh
|
||||||
- [ ] create mk2parallel.sh
|
- [ ] improve mkverse.sh
|
||||||
- [ ] fix geometry bug
|
- [x] write into folder instead of giving back only pdf
|
||||||
- [ ] fix multi-word string chapter bug
|
- [ ] insert cleaning step (html to md)
|
||||||
- [ ] create md2tex.sh
|
- [ ] md2html -> sed pertubation -> html2md
|
||||||
- [ ] create pdf2sig.sh /pdf2book.py -s/--sigsize [0,3,4,5]
|
- [X] create mkparallel.sh
|
||||||
|
- [X] fix geometry bug
|
||||||
|
- [X] fix multi-word string chapter bug
|
||||||
|
- [ ] improve mkparallel.sh
|
||||||
|
- [/] colophon
|
||||||
|
- [ ] dictionary
|
||||||
|
- [ ] include pics into title and colophon
|
||||||
- [ ] insert cleaning step (html to md)
|
- [ ] insert cleaning step (html to md)
|
||||||
- [ ] md2html -> sed pertubation -> html2md
|
- [X] create pdf2sig.sh /pdf2book.py -s/--sigsize [0,3,4,5]
|
||||||
|
- [ ] move conf files to templates
|
||||||
|
- [ ] make config a needed argument
|
||||||
|
- [ ] think of better names for scripts
|
||||||
|
- [ ] unify scripts
|
||||||
|
- [ ] python rewrite of md2verse and md2parallel
|
||||||
|
- [ ] insert cleaning step (html to md)
|
||||||
|
- [ ] md2html -> sed pertubation -> html2md
|
||||||
- [ ] create a script that does: parallel-md -> bilingual word pair list
|
- [ ] create a script that does: parallel-md -> bilingual word pair list
|
||||||
- [ ] 1. word list
|
- [ ] 1. word list
|
||||||
- [ ] 2. translate (with gpt?) sowas von python
|
- [ ] 2. translate (with gpt?) sowas von python
|
||||||
|
@ -23,16 +23,24 @@ KEEP_TMP_FILES=0
|
|||||||
# convert md to html
|
# convert md to html
|
||||||
pandoc --wrap=none -f markdown $DIRNAME/${BASENAME}.md -t html -o ${BASENAME}.html
|
pandoc --wrap=none -f markdown $DIRNAME/${BASENAME}.md -t html -o ${BASENAME}.html
|
||||||
# convert html to tex
|
# convert html to tex
|
||||||
#sed -i '' 's@<p>@\n\\pstart\n@' ${BASENAME}.html
|
# check if on linux or macos
|
||||||
#sed -i '' 's@</p>@\n\\pend@' ${BASENAME}.html
|
if [[ $(uname) == "Linux" ]]
|
||||||
sed -i '' 's@<p>@\n\\pend\\pstart\n@' ${BASENAME}.html
|
then
|
||||||
sed -i '' 's@</p>@@' ${BASENAME}.html
|
SED_CMD="sed -i"
|
||||||
sed -i '' 's@“@\\enquote{@g' ${BASENAME}.html
|
elif [[ $(uname) == "Darwin" ]]
|
||||||
sed -i '' 's@”@}@g' ${BASENAME}.html
|
then
|
||||||
sed -i '' 's@<h1.*">@\\section[@' ${BASENAME}.html
|
SED_CMD="sed -i ''"
|
||||||
sed -i '' 's@</h1>@]@' ${BASENAME}.html
|
fi
|
||||||
sed -i '' 's@<h2.*">@{@' ${BASENAME}.html
|
#$SED_CMD 's@<p>@\n\\pstart\n@' ${BASENAME}.html
|
||||||
sed -i '' 's@</h2>@}@' ${BASENAME}.html
|
#$SED_CMD 's@</p>@\n\\pend@' ${BASENAME}.html
|
||||||
sed -i '' "s@’@'@g" ${BASENAME}.html
|
$SED_CMD 's@<p>@\n\\pend\\pstart\n@' ${BASENAME}.html
|
||||||
|
$SED_CMD 's@</p>@@' ${BASENAME}.html
|
||||||
|
$SED_CMD 's@“@\\enquote{@g' ${BASENAME}.html
|
||||||
|
$SED_CMD 's@”@}@g' ${BASENAME}.html
|
||||||
|
$SED_CMD 's@<h1.*">@\\section[@' ${BASENAME}.html
|
||||||
|
$SED_CMD 's@</h1>@]@' ${BASENAME}.html
|
||||||
|
$SED_CMD 's@<h2.*">@{@' ${BASENAME}.html
|
||||||
|
$SED_CMD 's@</h2>@}@' ${BASENAME}.html
|
||||||
|
$SED_CMD "s@’@'@g" ${BASENAME}.html
|
||||||
mv ${BASENAME}.html ${BASENAME}.tex
|
mv ${BASENAME}.html ${BASENAME}.tex
|
||||||
cat ${BASENAME}.tex && rm ${BASENAME}.tex
|
cat ${BASENAME}.tex && rm ${BASENAME}.tex
|
||||||
|
@ -26,8 +26,6 @@ PATH=$PATH:$WD
|
|||||||
pushd $TMPDIR > /dev/null
|
pushd $TMPDIR > /dev/null
|
||||||
|
|
||||||
# CONVERT MD TO TEX
|
# CONVERT MD TO TEX
|
||||||
#IFS_OLD=$IFS
|
|
||||||
#IFS="\n"
|
|
||||||
for tex in $( echo "$INFILES" | grep '.md$' )
|
for tex in $( echo "$INFILES" | grep '.md$' )
|
||||||
do
|
do
|
||||||
if [[ -f $WD/$tex ]]
|
if [[ -f $WD/$tex ]]
|
||||||
@ -42,21 +40,21 @@ do
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
#IFS=$IFS_OLD
|
|
||||||
|
|
||||||
# CREATE WRAPPER
|
# CREATE WRAPPER
|
||||||
WRAPPER="""
|
WRAPPER="""
|
||||||
%\documentclass[twoside]{$DOCCLASS}
|
\documentclass[twoside,${PAGESIZE}paper]{$DOCCLASS}
|
||||||
\documentclass[twoside]{$DOCCLASS}
|
|
||||||
\usepackage[fontsize=${FONTSIZE}pt]{fontsize}
|
\usepackage[fontsize=${FONTSIZE}pt]{fontsize}
|
||||||
\usepackage[${PAGESIZE}paper]{geometry}
|
|
||||||
\usepackage{libertine} % also loads fontspec which is needed for ɔ and ɛ
|
\usepackage{libertine} % also loads fontspec which is needed for ɔ and ɛ
|
||||||
%\usepackage{minitoc} % make mini table of content for each chapter
|
%\usepackage{minitoc} % make mini table of content for each chapter
|
||||||
\usepackage{graphicx} % include graphics
|
\usepackage{graphicx} % include graphics
|
||||||
|
\usepackage{tcolorbox} % https://en.wikipedia.org/wiki/Colophon_(publishing)
|
||||||
\usepackage{placeins} % https://tex.stackexchange.com/a/88659/264579
|
\usepackage{placeins} % https://tex.stackexchange.com/a/88659/264579
|
||||||
\usepackage{csquotes} % \enquote
|
\usepackage{csquotes} % \enquote
|
||||||
\usepackage{reledmac} % needed for repedpar
|
\usepackage{reledmac} % needed for repedpar
|
||||||
\usepackage{reledpar} % parallel text
|
\usepackage{reledpar} % parallel text
|
||||||
|
\firstlinenum*{1000}
|
||||||
|
\linenumincrement*{1000}
|
||||||
\newcommand{\pagesinclude}[2]{
|
\newcommand{\pagesinclude}[2]{
|
||||||
\begin{pages}
|
\begin{pages}
|
||||||
\begin{Leftside}
|
\begin{Leftside}
|
||||||
@ -75,7 +73,67 @@ WRAPPER="""
|
|||||||
\title{$TITLE}
|
\title{$TITLE}
|
||||||
\author{$AUTHOR}
|
\author{$AUTHOR}
|
||||||
\begin{document}
|
\begin{document}
|
||||||
\maketitle
|
"""
|
||||||
|
TITLE_PAGE="""
|
||||||
|
%\date{}
|
||||||
|
%\maketitle
|
||||||
|
%%%
|
||||||
|
\begin{titlingpage} %This starts the title page
|
||||||
|
\begin{center}
|
||||||
|
% ~
|
||||||
|
\vspace{2cm} %put the distance you need.
|
||||||
|
% ~
|
||||||
|
\begin{HUGE}
|
||||||
|
\thetitle \\
|
||||||
|
\end{HUGE}
|
||||||
|
\vspace{3cm} %put the distance you need.
|
||||||
|
\begin{large}
|
||||||
|
\theauthor\\
|
||||||
|
\end{large}
|
||||||
|
%\thedate
|
||||||
|
\begin{figure}[hb]
|
||||||
|
\centering
|
||||||
|
% \includegraphics[width=\adinkrawidth]{img/sankofa.jpeg}
|
||||||
|
\end{figure}
|
||||||
|
% \vspace{3cm} %put the distance you need.
|
||||||
|
% \begin{figure}[hb]
|
||||||
|
% \centering
|
||||||
|
%% \includegraphics[width=.2\textwidth]{img/ghana_flag.jpeg}
|
||||||
|
% \end{figure}
|
||||||
|
\end{center}
|
||||||
|
\end{titlingpage}
|
||||||
|
%%%
|
||||||
|
"""
|
||||||
|
COLOPHON="""
|
||||||
|
\cleardoublepage
|
||||||
|
\thispagestyle{empty}
|
||||||
|
\begin{vplace}[0.7]
|
||||||
|
\begin{centering}
|
||||||
|
\begin{huge}
|
||||||
|
\thetitle
|
||||||
|
\end{huge}
|
||||||
|
\\
|
||||||
|
\vspace{3cm}
|
||||||
|
\begin{LARGE}
|
||||||
|
\begin{tcolorbox}[width=.5\textwidth]
|
||||||
|
\centering
|
||||||
|
% \texttt{AQO}\\
|
||||||
|
% \texttt{ABA}\\
|
||||||
|
% \texttt{~\newline AQO\newline ABA\newline}%\\
|
||||||
|
\texttt{$PUBLISHER}
|
||||||
|
\end{tcolorbox}
|
||||||
|
\end{LARGE}
|
||||||
|
% \includegraphics[width=.3\textwidth]{img/onipa_logo.png}
|
||||||
|
\vspace{2cm}
|
||||||
|
\par\noindent\rule{\textwidth}{0.4pt}
|
||||||
|
\large { \the\year{} }\\
|
||||||
|
$EDITION\\
|
||||||
|
\end{centering}
|
||||||
|
\end{vplace}
|
||||||
|
\clearpage
|
||||||
|
"""
|
||||||
|
TOC="""
|
||||||
|
\cleardoublepage
|
||||||
\tableofcontents
|
\tableofcontents
|
||||||
"""
|
"""
|
||||||
WRAPPER_END="""
|
WRAPPER_END="""
|
||||||
@ -83,8 +141,13 @@ WRAPPER_END="""
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
echo "$WRAPPER" > $PROJECT.tex
|
echo "$WRAPPER" > $PROJECT.tex
|
||||||
|
echo "$TITLE_PAGE" >> $PROJECT.tex
|
||||||
|
echo "$COLOPHON" >> $PROJECT.tex
|
||||||
|
echo "$TOC" >> $PROJECT.tex
|
||||||
# INCLUDE INDIVIDUAL TEX FILE
|
# INCLUDE INDIVIDUAL TEX FILE
|
||||||
first_lang="true"
|
first_lang="true"
|
||||||
|
IFS_OLD=$IFS
|
||||||
|
IFS=$'\n'
|
||||||
for input in $INFILES
|
for input in $INFILES
|
||||||
do
|
do
|
||||||
if [[ $input == *.md ]]
|
if [[ $input == *.md ]]
|
||||||
@ -101,6 +164,7 @@ do
|
|||||||
echo '\chapter' " { $input }" >> $PROJECT.tex
|
echo '\chapter' " { $input }" >> $PROJECT.tex
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
IFS=$IFS_OLD
|
||||||
echo "$WRAPPER_END" >> $PROJECT.tex
|
echo "$WRAPPER_END" >> $PROJECT.tex
|
||||||
|
|
||||||
# CREATE PDF
|
# CREATE PDF
|
||||||
|
@ -84,10 +84,8 @@ echo "$WRAPPER_END" >> $PROJECT.tex
|
|||||||
# CREATE PDF
|
# CREATE PDF
|
||||||
$LATEX_ENGINE $PROJECT.tex 2&> /dev/null
|
$LATEX_ENGINE $PROJECT.tex 2&> /dev/null
|
||||||
$LATEX_ENGINE $PROJECT.tex 2&> /dev/null
|
$LATEX_ENGINE $PROJECT.tex 2&> /dev/null
|
||||||
# $LATEX_ENGINE $PROJECT.tex
|
|
||||||
cp $PROJECT.pdf $WD
|
|
||||||
echo "File $PROJECT.pdf created at $WD"
|
|
||||||
#cp $PROJECT.tex $WD
|
|
||||||
echo "File $PROJECT.tex created at $WD"
|
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
if [[ -d $WD/$PROJECT ]] ; then rm -rf $WD/$PROJECT ; fi
|
||||||
|
cp -r $TMPDIR $WD/$PROJECT
|
||||||
|
echo "File $PROJECT.pdf created at $WD/$PROJECT"
|
||||||
rm -rf $TMPDIR
|
rm -rf $TMPDIR
|
||||||
|
@ -4,10 +4,12 @@ DOCCLASS_EXTRA="twoside"
|
|||||||
FONTSIZE="10"
|
FONTSIZE="10"
|
||||||
PAGESIZE="a5"
|
PAGESIZE="a5"
|
||||||
PROJECT="asem"
|
PROJECT="asem"
|
||||||
TITLE="Nsɛm wɔ Twi ne Brɔfo\\\LARGE Texts in Twi and English"
|
TITLE="Nsɛm wɔ Twi ne Brɔfo\\\\ \\LARGE Texts in Twi and English"
|
||||||
AUTHOR=""
|
AUTHOR=""
|
||||||
INFILES="""
|
INFILES="""
|
||||||
'Anansesem - Ghanaian Folk Tales'
|
Anansesem - Ghanaian Folk Tales
|
||||||
testfiles/parallel-ak.md
|
testfiles/parallel-ak.md
|
||||||
testfiles/parallel-en.md
|
testfiles/parallel-en.md
|
||||||
"""
|
"""
|
||||||
|
PUBLISHER="AQO\\\\ABA"
|
||||||
|
EDITION="First Edition"
|
||||||
|
Loading…
Reference in New Issue
Block a user