Windows support is not good, but I kinda don't care.
It has been about four months of work at this point and I would finally call ptts done. I have a tendency to stop working on projects, so I'm happy that I managed to finish at least this one.
It has everything I wanted it to (except tables, I decided not to bother with those) It has a bunch of useful instructions, simple syntax, nice TUI and can export to PDF. The PDF even has a dark mode, which I would consider a nice feature...
I think it's ready for writing some texts to school in which I use up to 20% of it's features. But hey, I'm not known for making good live decisions.
I should also probably talk about how I finished it.
There is a list of the stuff I wanted to implement in the last b-log:
Let's go over it.
They work a lot like footnotes, but I added a variable to the 'Footnote' object to indicate what it actually is. In LaTeX, you can actually make it a clickable link, so that's nice. In text-only mode, it's still just a text. As far as images go, if you link to a image in text mode, substitution text will be inserted and you will get url like normal. In pdf, I just insert the image and no footnote is added.
They are still a type of footnote. You define a 'label' that you can then link to. In Text mode, I just say the label, but in PDF, they are clickable again.
There you have all the 'labels' and either their corresponding line number, if in text mode or, page number, if in PDF. It' very similar to metadata. You can open it in the TUI by pressing 'i' and select a label to go to. You can also add a flag to write it either at the start or the end of the document. The links are of course clickable in LaTeX.
I just call the file-handling function again. I did however add a function to generate a line that resets everything to the state it was in before the source, if that is what you want. You can source via '@source' and '@sourceclear'.
I wrote a nice user manual in ptts itself, embedded in the sourcecode. You can either invoke it via 'h', '?' and 'F1', or you can generate it into a file with the '-H' or '--manual' flag. It's nice for testing.
I just use the '-m' and '-M' flags like with stdout mode.
Just a simple shell script that compiles the code, copies executable and font and warns you, if you don't have xelatex installed. Nothing fancy.
The Windows port is incomplete. The tui refuses to read input so I just disabled it and I did not manage to do fonts, as they lack any consistent naming convention. You can still use it to generate text files and PDFs however.
I do not plan to port any of my future projects to Windows unless I have a good reason to, as I find it to be poorly designed software not worthy of the effort. Most people who would be interested in using my software probably use some *nix OS, and if not, they know how to use WSL.
Some troubles I met:
Powershell is ugly and getting system variables takes entire line of code.
You cannot run scripts as regular user by default. WHY‽
You cannot create symlinks as regular user by default. why?
No package manager to be found. MS store sucks and I did not manage to find winget in it.
Edge has problems downloading .exe files and needs you to click on a very well hidden button in order to do so. How am I supposed to download the software then?
Windows terminal sucks. It takes way too long to write something so the TUI would be glitchy, even if I managed to make it read input.
Powershell takes ages to load.
This one needs a bit of explaining. To install software under Linux, you copy the executable to /usr/local/bin/ or ~/.local/bin/ if installing locally. Any extra program files go to /usr/local/share/ or ~/.local/share/. It just works, as they are already in $PATH. In Windows however, you have C:\Program Files\ and ~\AppData\Local\. Yes, there is a space in the file name, I don't know which heretic wrote it.
It does not end here tho, as you are expected to make a new folder there and then add that folder to the $PATH. $PATH is not a shell variable, but an entry in the registry, and there are actually two. One for the entire system and one for each user.
Needless to say that I don't want to deal with this OS anymore and I won't be porting to it again.
I like the final product.
Crystal is a nice language, but it is maybe a bit too OOP for my taste. I might use it again if I encounter a problem for which it would seem like a good fit, but it won't replace D as my goto compiled, garbage-collected language.
I won't do Windows anymore.
Nice!
Feel free to visit the repo.
I even provided precompiled binaries for both Linux and Windows.
As a little behind the scenes, here you can see the testing files I used: test.txt and test-short.txt together with the outcome pdf file in both dark and light versions.
What now tho?
Well, one big project is done and I think I will take some rest from projecting for a moment. Then I want to play with FORTH a bit. Just some small programs, nothing big.
It is however a while since I attempted to make some full-fledged graphical thing (the gforth tetris doesn't really count), so it's just a matter of time until I pick up raylib again.