add md2parallel.sh

This commit is contained in:
uni@bor.mac 2024-10-01 17:42:18 +02:00
parent b88673bfc3
commit e794e64eb0
3 changed files with 230 additions and 0 deletions

33
md2parallel.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
# converts aqoaba markdown into tex
# TODO
# - [ ] formatting scripture https://tex.stackexchange.com/a/652451/264579
# - [ ] do I even need mutliple verse environments?
USAGE="""USAGE:
$(basename $0) markdown-file"""
if [ $# -ne 1 ] ; then echo "$USAGE" && exit 1; fi
INFILE=$1
# remove any suffix https://stackoverflow.com/a/36341390
BASENAME=$(basename "${INFILE%.*}")
KEEP_TMP_FILES=0
#set -x
#set -e
#
# TODO
# check if same number of paragraphs?
# convert md to html
pandoc -f markdown ${BASENAME}.md -t html -o ${BASENAME}.html
# convert html to tex
sed -i '' 's@<p>@\n\\pstart\n@' ${BASENAME}.html
sed -i '' 's@</p>@\n\\pend@' ${BASENAME}.html
sed -i '' 's@“@\\enquote{@g' ${BASENAME}.html
sed -i '' 's@”@}@g' ${BASENAME}.html
sed -i '' 's@<h1.*">@\\section[@' ${BASENAME}.html
sed -i '' 's@</h1>@]@' ${BASENAME}.html
sed -i '' 's@<h2.*">@{@' ${BASENAME}.html
sed -i '' 's@</h2>@}@' ${BASENAME}.html
sed -i '' "s@@'@g" ${BASENAME}.html
mv ${BASENAME}.html ${BASENAME}.tex
cat ${BASENAME}.tex && rm ${BASENAME}.tex

98
testfiles/parallel-ak.md Normal file
View File

@ -0,0 +1,98 @@
# Anyankosɛm bɛyɛ Anansesɛm
## Sɛ yoyɛ a anyankonsɛm yɛ bɛ frɛ no anansesɛm
Kwaku Ananse na ɔkɔɔ Nyankonpɔn ho sɛ ɔmfa 'Nyankonsɛm mma no ntɔ.
Nyame see, "Wo bɛtumi atɔ?"
Ananse see, "Ei! Mɛtumi."
Nymae see, "Akuro akantinka bɛ yɛ sɛ Kokofu, Bekwai, Asumengya aba, yɛ'antumi antɔ, na wo Kwafwiaban na wo bɛtumi?"
Ananse see, "Ahe na yɛbɛtɔ no?"
Nyame see, "Yɛ ntɔ mma hwee gye sɛ, Aboa Onini, Ɔsebɔ, Mmoatia, Mmoboro."
Ananse see, "Me de nnooma yi nnyina bi bɛba, me de m'aberewa, Nsia, mɛka ho."
Nyame see, "Kɔ fa bra ɛ."
Ananse baye, na ɔbɔɔ ɔni amanie sɛ, "Nyankonsɛm me pɛ sɛ me tɔ, na Nyame se me mfa Onini, Ɔsebɔ, Mmoatia, Mmoboro mmera, me see, me de wo bɛ ka ho ma kɔ ma Nyankopɔn."
Na Ananse bisaa ne yere Aso sɛ, "Ɛbɛyɛ deɛn na yɛ'anya Onini?"
Na Aso ka kyerɛɛ no sɛ, "Wodie kɔ twa tonton na twa demere ka ho, na fa bra."
Na Ananse de baye.
Na Aso see, "Fa kɔ asuom'."
Na Ananse de ekoro no, ɔsee, "Esene no, esene no; woboa, esene no."
Ananse see, "Ɔno na oda doo no."
Onini see, "Adɛn?"
Ananse see, "Nyɛ Aso na ɔgye me akyinnyie, sɛ tonton yi kyen wo tenten, na me se ɔboa."
Onini see, "Fa bra, bɛ susu me."
Ɔde tonton no too Onini ho.
Ɔsee, "Twe wo mu."
Na Onini twe no mu, na Ananse de demere no too no so, nwenene! nwenene! nwenene! na ɛsii tire.
Ananse see, "Kwasea, me de wo kɔ gye Anyankonsɛm."
Ananse de no kɔ maa Nyame.
Nyame see, "Me nsa aka, aka dee aka."
Ananse san baye bɛ bɔɔ ne yɛ' amanie sɛ, "Aka Mmoboro."
Ne yere see, "Pɛ towa, fa nsuo gum', na fa kɔ."
Ananse kɔɔ wuram' ɔbɛhwɛ sɛ Mmoboro sen hɔ, na ɔhwiee nsuo no bi na ɔpete guu Mmoboro no so.
Efei na ɔka kyerɛɛ Mmoboro no sɛ, "Ɔsuo ɛba yi, ankra mo ba na mo bɛ hyee me toa yim'a s'ankra osuo yi emmo mo, mo nfwe sɛ me de brodeɛ ahahan akata me soo?"
Ena Mmoboro no see, "Ye'da w'ase Aku, ye'da w'ase Aku."
Mmoboro no nnyina tuo toa nom', fom!
Agya Ananse tuaa ano.
Ɔsee, "Nkwaseafuo m'anya mo, me de mo kɔ gye Anyankonsɛm."
Ode Mmoboro kɔ maa Nyame.
Nyame see, "Me nsa aka, aka dee aka."
Ananse baa bio, bɛ ka kyerɛɛ ne yere see, "Aka Ɔsebɔ."
Aso see, "Kɔ tu amana."
Ananse see, "Gyae na mahu."
Enie Ananse kɔ pɛɛ Ɔsebɔ kyeneno na otu amana tententen, na ɔkataa so, na ɔbaa 'fie.
Adeekyeye anopa, Ananse sɛ ɔko, ɔbɛkoro, Ɔsebɔ na oda amanam'.
Ananse see, "Agyawa 'ba! Enawa 'ba! sɛ maka akyerɛ wo sɛ nnom nsa, sese wo nokwa wako nom abo, nti na w'abe to amanam'; sɛ me kaase me beyi wo a, addekye wo kɔ hu me a, sɛ nso me 'ba biara a, na wo kɔ kye no."
Ɔsebɔ sɛ, "O! me ntumi."
Ananse kɔ twaa nnua mmienu, de baako too ha, de baako too ha.
Ɔsee, "Fa wo nsa baako to ha, na fa wo nsa baako soso to ha."
Na Ɔsebɔ de totoye.
Ɔse ɔfo' na Ananse ama sekan so, na wa ma n'anyam, ne tirim' gao!
Ɔsebɔ gyee amanam' fom!
Ananse faa atwedeɛ de sii amanam' kɔ yii Ɔsebɔ.
Ɔko yii Ɔsebɔ de no baye, ɔsee, "Kwasea me de wo kɔ gye Anyankonsɛm."
Omaa Ɔsebɔ so, kɔ maa Nyame.
Nyame see, "Me nsa aka, aka dee aka."
Ananse baye na ɔsenee Akua Ba, na ɔbɔɔ amane de tetaree Akua Ba no ho; na ɔfufuu to, na ɔde bi hyee Akua Ba no nsam', na ɔfufuu bi de guu ayowam'; ɔde homa soo Akua Ba asen, na ɔde no kosii odum ase babi a mmoatia bɛdi agoro.
Na mmoatia baako baye.
Ɔsee, "Akua, me nni eto yi bi?"
Na Ananse atwe homa no, na Akua Ba no abɔ ne tiri nko.
Mmoatia ka kyeree ɔnua baako sɛ, "Ɔse me nni bi."
Ɔsee, "Di bi ɛ."
Na ɔdi aduane no wieye, na ɔdaa n'ase.
Oda n'ase ɔmmua.
Na Mmoatia no ka kyerɛɛ ɔnua sɛ, "Me da n'ase a, ɔmmua."
Mmoatia no nua ka kyerɛɛ no sɛ, "Bɔ no sum."
Na wabɔ, pa!
Na ne nsa aka hɔ.
Ɔka kyerɛɛ ɔnua sɛ, "Me nsa aka hɔ."
Ɔsee, "Fa baako a aka, bɔ no sum bio."
Na ɔde bɔɔ no pa! na 'yi no so aka hɔ.
Na Mmoatia ka kyerɛɛ ɔnua sɛ, "Me nsa mmienu aka hɔ."
Ɔsee, "Fa w'afu sum no."
Ode sum no, na n'afu aka hɔ.
Na Ananse baye na obe kyekyeree no; osee, "Kwasea m'anya wo, me de wo kɔ gye Anyankonsɛm."
Na ode kɔɔ 'fie.
Na Ananse ka kyerɛɛ ɔni, Ya Nsia sɛ, "Sɔre, ma yɛn kɔ, me mfa wo nka Mmoatia yi ho nkɔ gye Anyankonsɛm."
Ɔmaa yɛn so, kɔɔ Nyame hɔ.
Ɔsee, "Nyame, Mmoatia ni, m'aberewa a me kaye no, nso ni."
Nyame so frɛɛ Ko'ntire ne Akwam', ne Adonten, ne Gyase, ne Oyoko, ne Ankobea, ne Kyidom.
Na ode tɔɔ yɛ'anim sɛ, "Ahene akesie akesie aba, ye'antumi antɔ Anyankonsɛm, Kwaku Ananse dee watumi atɔ; m'agye no Mmoboro; m'agye no Mmoatia; m'agye no Ɔsebɔ; m'agye no Onini; ɔno ara Ananse de oni ato so; nnooma no nnyina na egu hɔ yi."
Ɔsee, "Mo mpene no."
Ye see, "Eee!"
Nyankonpon see, "Kwaku Ananse, ɛfiri nne ɛkoro yi, me de Anyankonsɛm me kye wo, kose! kose! kose!
Yɛ'mmfrɛ no Anyankonsem bio, na yɛ'mfrɛ no Anansesɛm."
M'anansesɛm a metooye yi, sɛ ɛyɛ dɛ o, sɛ ɛnnyɛ dɛ o, momfa bi nkɔ, na momfa bi mmera.

99
testfiles/parallel-en.md Normal file
View File

@ -0,0 +1,99 @@
# Sky-god's stories become Spider-stories
## How it came about that the sky-god's stories came to be known as "spider-stories"
Kwaku Ananse, the Spider, once went to Nyankonpon, the Sky-god, in order to buy the Sky-god's stories.
The Sky-god said, "Will you be able to buy them?"
The Spider said, "Rather, I shall be able."
The Sky-god said, "Great and powerful towns like Kokofu, Bekwai, Asumengya have come, but they were unable to purchase them, and you who are but a mere masterless man, (you say) you will be able?"
The Spider said, "What is the price of (the stories)?"
The Sky-god said, "They cannot be bought for anything except the Onini creature the Python; Osebo, the Leopard; Mmoatia, the Fairy; and Mmoboro, the Hornets."
The Spider said, "I will bring some of all these things, and (what is more), I'll add my old woman, Nsia (The Sixth-Child), to the lot."
The Sky-god said, "Go and bring them then."
The Spider came, and told his mother all about it, saying, "I wish to buy the stories of the Sky-god, and the Sky-god says I must bring Onini, the Python; Osebo, the Leopard; Mmoatia, a Fairy; and Mmoboro, Hornets; and I said I would add you to the lot and go and give the Sky-god."
Now the Spider consulted his wife Aso, saying, "What is to be done that we may get Onini, the Python?"
And Aso said to him, "You go off and cut a branch of a palm-tree, and cut some string creeper as well, and bring them."
And the Spider came back with them.
And Aso said, "Take them to the stream."
And Ananse took them; as he was going along he said, "It's longer than he is, it's not so long as he; you lie, it's longer than he."
The Spider said, "There he is, lying yonder."
The Python (who had overheard this imaginary conversation) said, "What's it all about."
The Spider said, "Is it not (my wife) Aso, who is arguing with me that this palmbranch is longer than you, and I say she is a liar."
And Onini, the Python, said, "Bring it, and come and measure me."
He took the palm-branch and laid it along the Python's body.
He said, "Stretch yourself out."
And the Python stretched himself out, and Ananse took the rope-creeper and wound it (and the sound of the tying was nwenene! nwenene! nwenene! until he came to the head.
Ananse, the Spider, said, "Fool, I shall take you to the Sky-god and receive the Sky-god's tales (in exchange)."
Ananse took him off to Nyame (the Sky-god).
The Sky-god said, "My hand has touched (i. e. I have received it), there remains what still remains."
The Spider returned, and came and told his wife what had happened, saying, "There remain the Hornets."
His wife said, "Look for a gourd, and fill it with water, and go off with it."
%
The Spider went along through the bush, when he saw (a swarm of) Hornets hanging there, and he poured out some of the water and sprinkled it on the Hornets.
The Spider then poured the remainder upon himself, and cut a leaf of the plantain and covered his head with it.
And now he addressed the Hornets, saying, "As the rain has come, had you not better come and enter this, my gourd, so that the rain will not beat you; don't you see that I have taken a plantain leaf to cover myself?"
Then the Hornets said, "We thank you Aku, we thank you Aku."
All the Hornets flew, disappearing into the gourd, fom!
Father Spider covered the mouth, and he said, "Fools, I have got you, and I am taking you to receive the tales of the Sky-god (in exchange)."
And he took the Hornets to the Sky-god.
The Sky-god said, "My hand has touched, what remains (still) remains."
The Spider came back once more, and told his wife, and said, "There remains Osebo, the Leopard."
Aso said, "Go and dig a hole."
Ananse said, "That's enough, I understand."
Then the Spider went off to look for the Leopard's tracks, and (having found them) he dug a very deep pit, and covered it over, and came back home.
Very early next day, when objects began to be visible, the Spider said he would go off, and when he went, (lo) a Leopard is lying in the pit.
Ananse said: "Little father's child, little mother's child, I have told you not to get drunk, and now, just as one would expect of you, you have become intoxicated, and that's why you have fallen into the pit; if I were to say I would get you out, next day, if you saw me, or likewise any of my children, you would go and catch them."
The Leopard said, "O! I could not do such a thing."
Ananse went and cut two sticks, put one here, and one there.
He said, "Put one of your paws here, and one also of your paws here."
And the Leopard placed them (where he was told).
As he was about to climb up, Ananse lifted up his knife, and in a flash it descended on his head, gao! (was the sound it made).
The pit received the Leopard (and) fom! (was the sound of his falling).
Ananse got a ladder to descend into the pit to go and get the Leopard out.
He got the Leopard out and came with it; he said, "Fool, I am taking you to exchange for the stories of the Sky-god."
He lifted up the Leopard to go and give to Nyame, the Sky-god.
The Sky-god said, "My hands have touched, what remains still remains."
The Spider came, and he carved an Akua's child (a black flat-faced wooden doll), and he tapped some sticky latex (from a tree) and plastered the doll's body with it, and he pounded eto (mashed yams), and put some in the doll's hand, and he pounded some more and placed it in a brass basin; he tied string round the doll's waist, and went with it and placed it at the foot of an odum-tree, the place where the Fairies come to play.
And a Fairy came along.
She said, "Akua, may I eat a little of this mash?"
Ananse tugged at the string, and the doll nodded her head.
The Fairy told one of her sisters, saying, "She says I may eat some."
She said, "Eat some, then."
And she finished eating, and thanked her (the doll).
But when she thanked her, she did not answer.
So the Fairy said to her sister, "When I thank her, she does not reply."
The sister of the (first) Fairy said, "Slap her crying-place."
And she slapped it, pa!
And her hand stuck there.
She said to her sister, "My hand has stuck there."
She said, "Take the one that remains and slap her crying-place again."
And she took it and slapped her, pa! and this one, too, stuck fast.
And the Fairy told her sister, saying, "My two hands have stuck fast."
She said, "Push it with your stomach."
She pushed it, and her stomach stuck to it.
And Ananse came and tied her up, and he said, "Fool, I have got you, I shall take you to the Sky-god (in exchange) for his stories."
And he went off home with her.
And Ananse told his mother, Ya Nsia (the sixth child), saying, "Rise up, let us go, for I am taking you along with the Fairy to go and give the Sky-god (in exchange) for his stories."
He lifted them up, and went off there to where the Sky-god was.
He said, "Sky-god, here is a Fairy, and my old woman whom I spoke about, here she is, too."
Now the Sky-god called (his elders), the Kontire and Akwam chiefs, the Adonten (leader of the main body of the army), the Gyase (major-domo); the Oyoko, Ankobea, and Kyidom (leader of the rear-guard).
And he put the matter before them, saying, "Very great kings have come, and were not able to buy the Sky-god's stories, but Kwaku Ananse, the Spider, has been able to pay the price;
I have received from him Mmoboro, the Hornets; I have received from him Mmoatia, the Fairy; I have received from him Osebo, the Leopard; I have received from him Onini, the Python; and of his own accord, Ananse has added his mother to the lot; all these things lie here."
He said, "Sing his praise." "Eee!" (they shouted).
The Sky-god said, "Kwaku Ananse, from to-day and going on for ever, I take my Sky-god's stories and I present them to you, kose! kose! kose! my blessing, blessing, blessing.
No more we shall call them the stories of the Sky-god, but we shall call them Spider-stories."
This, my story, which I have related, if it be sweet, (or) if it be not sweet, take some elsewhere, and let some come back to me.