Open vabene1111 opened 2 years ago
ok @supaeasy i think we have moved to the stage where this is sophisticated enough to transfer it to its own issue.
I get the basics of your setup but it is rather complicated and it is very custom tailored to your recipe database/preferences. I think in order for this to make sense there needs to be one .tex
file per recipe or maybe even one large one so that someone using this who has a basic understanding of latex can use it (i myself would say i am somewhat familar with latex but dont understand how your files work).
We need to create that template and a more or less standard capable solution that can work for everyone. In the end we will likely make this some kind of templating solution anyway so if you want to change it back to your latex template after we created the upstream implementation you can still easily do this by forking of if i create a second variant of the exporter.
So the base of what I was working with is the xkookybooky Package. It is both possible to include all the single tex recipes in one file as in the packages example or to have them one by one which I prefer personally.
I have imported a recipe from my Paprika base to your demo. (Didn't work very flawlessly as some Ingredients weren't recognised but I edited it to be correct.) in ID 6610 I tried out steps.
On a first glance the export file from tandoor looks a LOT easier to work with than what I was used to from Paprika. 2/3 of the work was finding things correctly and your output is very neat and clean. If you want me to, I can adapt my substitutor to this if it helps, but I guess you should find it very easy to do so now. It really is just very important to stick to strict rules when entering the recipe, such as entering every step on it's own or stick to my -Schritt 1-, etc. spelling rule . One thing that will not work is to handle per-step ingrediences as there just is no concept for that in xcookybooky.
Let me know if you need anything. I have also included my custom cfg (remove txt extension) in case that raised any questions. I don't remember to what extend I have customized it, it has been some time since I last worked on this.
thanks for the research. I am not sure if i have missed this in any of the previous posts but i am still missing a "tempalte" text file. Maybe i just think wrong but i would expect something like this
% all the packages
\begin{document}
..
<INSERT RECIPE NAME HERE>
...
<INSERT INGREDIENTS HERE>
...
..
\end{document}
if i have something like that its easy to just dump out a whole bunch or one single tex file
That is in the file "Ausgabe in TeX.txt" from the discussion section. Look into my last reply.
thanks, but that doesn't really cut it. To be honest the latex exporter wont be used by many peopel (if any besides you) so i need to keep the amount of work to a somewhat acceptable level. The file you provided is minified and in a strange format i dont know, i have also no idea where to place my data into that file.
Only with understanding the structure and formatting it so that i can somewhat read and understand it would take me hours which i then would not have to work on very important topics like the new importer and so on.
I need
sorry for being so picky but building and figuring all this stuff out would take me days and i currently am happy when i have a few hours to work on the most important issues.
No problem, i will provide a commented file.
Can't we generalise it in a way, that it is a "templated export"? User defined template, using markers and then generate the text using maybe jinja?
thats likely possible, probably also how i would implement latex. But i think i would keep it on a PR basis, people can write templates, make a PR and i will add that to tandoor, at least at first.
Sorry btw that I didnt deliver the file yet but I am too busy at the moment. Will provide it eventually but I dont know when yet.
no worries, we all have a lot on our plates, things come when they are ready. But @m42e idea is good, if we have an example template file other people can easily adapt it.
After some "busy moments" of over two years I am finally able to start over with this topic. I think I will simply write something in python that converts an export of any recipe to a latex file in a mannered and commented structure. Ist that fine for further implementation or should I start with a different initial approach to make implementation easier for you?
sounds good to me! just take a recipe export, load it into python in an object called recipe and print out the latex.
You could look into using jina for templating, not sure if that makes sense or if just plain old string concats are the best.
Once you are done post the latex here and I will either implement it myself or build the surrounding structurue for you to implement it into
Thank you for suggesting jinja to me. I wasn't aware this existed. Learning this has been an eyeopening experience for me. I am already very far and have a 99% working example that generates a .tex file, I only have to fix minor things now. Will probably post results in the next few days. I use an API call so there is no need for an export first. The only thing I cannot deliver is the actual LaTeX implementation/pdf creation. Is this something you could do? This will be single recipe export first. Later I will maybe provide support for cooking books.
The latex implementation should just be any normal Tex engine right? Since you got it working trough the API I suggest you just create a small GitHub repo for it that you link here. I can then at some point implement it directly into tandoor (with your permission)
Here you go, I hope you like it: https://github.com/supaeasy/Tandoor2xcookybooky. You have my permission to integrate it wherever you want.
Discussed in https://github.com/TandoorRecipes/recipes/discussions/1462