From 86fe831c80597c578b9691f0622f2727ec51c876 Mon Sep 17 00:00:00 2001 From: jowodo Date: Thu, 3 Oct 2024 20:13:15 +0200 Subject: [PATCH 1/8] fix paper size bug --- mkparallel.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkparallel.sh b/mkparallel.sh index 33f3c6f..247509b 100755 --- a/mkparallel.sh +++ b/mkparallel.sh @@ -47,9 +47,9 @@ done # CREATE WRAPPER WRAPPER=""" %\documentclass[twoside]{$DOCCLASS} -\documentclass[twoside]{$DOCCLASS} +\documentclass[twoside,${PAGESIZE}paper]{$DOCCLASS} \usepackage[fontsize=${FONTSIZE}pt]{fontsize} -\usepackage[${PAGESIZE}paper]{geometry} +%\usepackage[${PAGESIZE}paper]{geometry} \usepackage{libertine} % also loads fontspec which is needed for ɔ and ɛ %\usepackage{minitoc} % make mini table of content for each chapter \usepackage{graphicx} % include graphics From 522bf736ca9e369106cd3e33ef00abd7f734ccfd Mon Sep 17 00:00:00 2001 From: jowodo Date: Thu, 3 Oct 2024 20:13:48 +0200 Subject: [PATCH 2/8] adjust md2parallel for linux --- md2parallel.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/md2parallel.sh b/md2parallel.sh index 3f225a8..34565e1 100755 --- a/md2parallel.sh +++ b/md2parallel.sh @@ -23,16 +23,24 @@ KEEP_TMP_FILES=0 # convert md to html pandoc --wrap=none -f markdown $DIRNAME/${BASENAME}.md -t html -o ${BASENAME}.html # convert html to tex -#sed -i '' 's@

@\n\\pstart\n@' ${BASENAME}.html -#sed -i '' 's@

@\n\\pend@' ${BASENAME}.html -sed -i '' 's@

@\n\\pend\\pstart\n@' ${BASENAME}.html -sed -i '' 's@

@@' ${BASENAME}.html -sed -i '' 's@“@\\enquote{@g' ${BASENAME}.html -sed -i '' 's@”@}@g' ${BASENAME}.html -sed -i '' 's@@\\section[@' ${BASENAME}.html -sed -i '' 's@@]@' ${BASENAME}.html -sed -i '' 's@@{@' ${BASENAME}.html -sed -i '' 's@@}@' ${BASENAME}.html -sed -i '' "s@’@'@g" ${BASENAME}.html +# check if on linux or macos +if [[ $(uname) == "Linux" ]] +then + SED_CMD="sed -i" +elif [[ $(uname) == "Darwin" ]] +then + SED_CMD="sed -i ''" +fi +#$SED_CMD 's@

@\n\\pstart\n@' ${BASENAME}.html +#$SED_CMD 's@

@\n\\pend@' ${BASENAME}.html +$SED_CMD 's@

@\n\\pend\\pstart\n@' ${BASENAME}.html +$SED_CMD 's@

@@' ${BASENAME}.html +$SED_CMD 's@“@\\enquote{@g' ${BASENAME}.html +$SED_CMD 's@”@}@g' ${BASENAME}.html +$SED_CMD 's@@\\section[@' ${BASENAME}.html +$SED_CMD 's@@]@' ${BASENAME}.html +$SED_CMD 's@@{@' ${BASENAME}.html +$SED_CMD 's@@}@' ${BASENAME}.html +$SED_CMD "s@’@'@g" ${BASENAME}.html mv ${BASENAME}.html ${BASENAME}.tex cat ${BASENAME}.tex && rm ${BASENAME}.tex From 8095d9410349f92cf55129e3883dad5483be6477 Mon Sep 17 00:00:00 2001 From: jowodo Date: Thu, 3 Oct 2024 20:23:20 +0200 Subject: [PATCH 3/8] fix multi word chapter bug --- README.md | 11 +++++------ mkparallel.sh | 6 +++--- parallel.conf | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b60e5e5..6d35b2a 100644 --- a/README.md +++ b/README.md @@ -69,10 +69,9 @@ 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 - [x] create md2verse.sh -- [ ] create mk2parallel.sh - - [ ] fix geometry bug - - [ ] fix multi-word string chapter bug -- [ ] create md2tex.sh -- [ ] create pdf2sig.sh /pdf2book.py -s/--sigsize [0,3,4,5] +- [X] create mk2parallel.sh + - [X] fix geometry bug + - [X] fix multi-word string chapter bug +- [X] create pdf2sig.sh /pdf2book.py -s/--sigsize [0,3,4,5] - [ ] insert cleaning step (html to md) -- [ ] md2html -> sed pertubation -> html2md + - [ ] md2html -> sed pertubation -> html2md diff --git a/mkparallel.sh b/mkparallel.sh index 247509b..21e8b61 100755 --- a/mkparallel.sh +++ b/mkparallel.sh @@ -26,8 +26,6 @@ PATH=$PATH:$WD pushd $TMPDIR > /dev/null # CONVERT MD TO TEX -#IFS_OLD=$IFS -#IFS="\n" for tex in $( echo "$INFILES" | grep '.md$' ) do if [[ -f $WD/$tex ]] @@ -42,7 +40,6 @@ do fi fi done -#IFS=$IFS_OLD # CREATE WRAPPER WRAPPER=""" @@ -85,6 +82,8 @@ WRAPPER_END=""" echo "$WRAPPER" > $PROJECT.tex # INCLUDE INDIVIDUAL TEX FILE first_lang="true" +IFS_OLD=$IFS +IFS=$'\n' for input in $INFILES do if [[ $input == *.md ]] @@ -101,6 +100,7 @@ do echo '\chapter' " { $input }" >> $PROJECT.tex fi done +IFS=$IFS_OLD echo "$WRAPPER_END" >> $PROJECT.tex # CREATE PDF diff --git a/parallel.conf b/parallel.conf index dc6134a..e68f5e3 100644 --- a/parallel.conf +++ b/parallel.conf @@ -7,7 +7,7 @@ PROJECT="asem" TITLE="Nsɛm wɔ Twi ne Brɔfo\\\LARGE Texts in Twi and English" AUTHOR="" INFILES=""" -'Anansesem - Ghanaian Folk Tales' +Anansesem - Ghanaian Folk Tales testfiles/parallel-ak.md testfiles/parallel-en.md """ From 32c5988a624b253df84f98d27b401d876590413b Mon Sep 17 00:00:00 2001 From: jowodo Date: Thu, 3 Oct 2024 20:23:39 +0200 Subject: [PATCH 4/8] add gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d17dae --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.venv From 6388be32a4683cb9becd71d63ae9861a762b42df Mon Sep 17 00:00:00 2001 From: jowodo Date: Thu, 3 Oct 2024 21:31:41 +0200 Subject: [PATCH 5/8] first colophon draft --- mkparallel.sh | 72 ++++++++++++++++++++++++++++++++++++++++++++++++--- parallel.conf | 4 ++- 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/mkparallel.sh b/mkparallel.sh index 21e8b61..b850a0e 100755 --- a/mkparallel.sh +++ b/mkparallel.sh @@ -43,17 +43,18 @@ done # CREATE WRAPPER WRAPPER=""" -%\documentclass[twoside]{$DOCCLASS} \documentclass[twoside,${PAGESIZE}paper]{$DOCCLASS} \usepackage[fontsize=${FONTSIZE}pt]{fontsize} -%\usepackage[${PAGESIZE}paper]{geometry} \usepackage{libertine} % also loads fontspec which is needed for ɔ and ɛ %\usepackage{minitoc} % make mini table of content for each chapter \usepackage{graphicx} % include graphics +\usepackage{tcolorbox} % https://en.wikipedia.org/wiki/Colophon_(publishing) \usepackage{placeins} % https://tex.stackexchange.com/a/88659/264579 \usepackage{csquotes} % \enquote \usepackage{reledmac} % needed for repedpar \usepackage{reledpar} % parallel text +\firstlinenum*{1000} +\linenumincrement*{1000} \newcommand{\pagesinclude}[2]{ \begin{pages} \begin{Leftside} @@ -72,14 +73,77 @@ WRAPPER=""" \title{$TITLE} \author{$AUTHOR} \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{$PRINTER} + \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 """ WRAPPER_END=""" \end{document} """ -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 first_lang="true" IFS_OLD=$IFS diff --git a/parallel.conf b/parallel.conf index e68f5e3..930784f 100644 --- a/parallel.conf +++ b/parallel.conf @@ -4,10 +4,12 @@ DOCCLASS_EXTRA="twoside" FONTSIZE="10" PAGESIZE="a5" 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="" INFILES=""" Anansesem - Ghanaian Folk Tales testfiles/parallel-ak.md testfiles/parallel-en.md """ +PRINTER="AQO\\\\ABA" +EDITION="First Edition" From 1fc76754f2377b6424f43eb483ff939d2c5a741e Mon Sep 17 00:00:00 2001 From: jowodo Date: Thu, 3 Oct 2024 21:38:07 +0200 Subject: [PATCH 6/8] change printer to publisher --- mkparallel.sh | 2 +- parallel.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mkparallel.sh b/mkparallel.sh index b850a0e..f552e16 100755 --- a/mkparallel.sh +++ b/mkparallel.sh @@ -120,7 +120,7 @@ COLOPHON=""" % \texttt{AQO}\\ % \texttt{ABA}\\ % \texttt{~\newline AQO\newline ABA\newline}%\\ - \texttt{$PRINTER} + \texttt{$PUBLISHER} \end{tcolorbox} \end{LARGE} % \includegraphics[width=.3\textwidth]{img/onipa_logo.png} diff --git a/parallel.conf b/parallel.conf index 930784f..fe15373 100644 --- a/parallel.conf +++ b/parallel.conf @@ -11,5 +11,5 @@ Anansesem - Ghanaian Folk Tales testfiles/parallel-ak.md testfiles/parallel-en.md """ -PRINTER="AQO\\\\ABA" +PUBLISHER="AQO\\\\ABA" EDITION="First Edition" From 097bfbe13986bc011078a7901fee2b9922812977 Mon Sep 17 00:00:00 2001 From: jowodo Date: Thu, 3 Oct 2024 21:38:37 +0200 Subject: [PATCH 7/8] add todos and dependencies --- README.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6d35b2a..5a97d34 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # README 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,9 +74,23 @@ 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 - [x] create md2verse.sh -- [X] create mk2parallel.sh +- [ ] improve mkverse.sh + - [ ] write into folder instead of giving back only pdf + - [ ] insert cleaning step (html to md) + - [ ] md2html -> sed pertubation -> html2md + - [ ] +- [X] create mkparallel.sh - [X] fix geometry bug - [X] fix multi-word string chapter bug +- [ ] improve mkparallel.sh + - [ ] insert cleaning step (html to md) + - [ ] md2html -> sed pertubation -> html2md + - [/] colophon + - [ ] dictionary + - [ ] include pics into title and colophon - [X] create pdf2sig.sh /pdf2book.py -s/--sigsize [0,3,4,5] -- [ ] insert cleaning step (html to md) - - [ ] md2html -> sed pertubation -> html2md +- [ ] move conf files to templates + - [ ] make config a needed argument +- [ ] think of better names for scripts +- [ ] unify scripts +- [ ] convert to python scripts? From 50ba57eedef2ac04db83ce29497d8f7abc87fc3e Mon Sep 17 00:00:00 2001 From: jowodo Date: Thu, 3 Oct 2024 21:39:27 +0200 Subject: [PATCH 8/8] cp projdir instead of pdf only --- mkverse.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mkverse.sh b/mkverse.sh index f31aaaa..4356bbf 100755 --- a/mkverse.sh +++ b/mkverse.sh @@ -84,10 +84,8 @@ echo "$WRAPPER_END" >> $PROJECT.tex # CREATE PDF $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 +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