Document Construction
Gavin-Holt opened this issue · 2 comments
Hi,
I am enjoying exploring djot, many thanks for providing several implementations and a great help file (works well off-line). I have used djot as a pure Lua library to call from CivetWeb/Scite/Micro - where finding compatible DLLs is hell. Also I have downloaded the compiled rust version jotdown.exe
to process local files.
Previously, I have used MultiMarkdown.exe
, which adds transclusion for document construction. This is useful, but causes the inevitable problems with local/absolute paths.
Upon reflection, I would support leaving djot as a markup syntax, following the oft mentioned UNIX philosophy - "write programs that do one thing and do it well".
Perhaps a dedicated preprocessor is the better home for file transclusion? I am preprocessing with upp.exe as I like scripting in Lua:
REM Windows Batch File - associated with my djot files
REM Check %1 in not null
if [%1]==[] (
echo No parameters passed
goto End
)
REM Change to parameter file location
cd /D "%~dp1"
REM Pipe file through upp and jotdown
upp.exe -p . "%1" | jotdown.exe - > %~dpnx1.html
REM Finesse with sed
sed.exe -i "s/>\s*£/ style=""text-align:right""&/g" %~dpnx1.html
sed.exe -i "s/<table>/<table class='sortable'>/g" %~dpnx1.html
REM Launch in default browser
shelexec.exe %~dpnx1.html
:End
Kind Regards Gavin Holt
Yes, I think this is an important question to consider. The drawback of a preprocessor is that it's ignorant of the djot syntax context. For example, if your symbol to include a file is %%myfile.txt
, then the preprocessor will include it even if it occurs inside a djot code block or comment.
Hi,
The upp.exe
preprocessor only uses two identifiers:
- The :() syntax is used to add Lua code, which I think is rolled together before execution.
- The $() syntax is used to insert text or variables.
I don't use JQuery, or I would be in deep trouble!
So as long as there are no sadness emojis :( in my markdown, I should be safe!
Kind Regards Gavin Holt