Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does #5 get around my worries about a "stringy-marcro-framework"? I.e. when things get too complicated, you can break out to a Heavy Duty (TM) language (aka Lua).



Depends a bit on what you mean by "string-macro-framework". The thing with ConTeXt is that it has a well defined API, so even when you are processing data using macros, it does not feel awkward.

Let me give a few examples of how I use ConTeXt (not necessary with ConTeXt Lua Documents)

1. Create a simple key-value driven interface for "complex" layouts https://adityam.github.io/context-blog/post/exam-coverpage/ This is still a "string-macro-framework", but ConTeXt has enough (and well named!) macros that it almost appears to be a "normal" template language. The code in ERB or other template languages would not be too different.

2. Generate Lab assignments for an undergraduate linear control systems course where the students learn how to interface MATLAB with real-time hardware. We create the lab in Matlab (`.m` file) and convert it to Matlab live script (which is Matlab's version of jupyter notebooks) which the students have to fill in. But, the live script notebooks are not convenient for browsing (say, for students who want to view the lab on their phone). Matlab offers a PDF as well as LaTeX export, which look ugly IMHO. So, we convert the `.m` to XML (Matlab does an XML export), and then use context to convert XML to PDF. The code is written using "stringy-macro-framework" but again the interface is nice enough that it would have looked similar in any other XSLT framework in any high-level language.

3. As an academic, I need to generate various versions of my CV (full publication record, pubs in the last `n` years for various values of `n`, etc.). I store my pubs in an XML file, use the XML parsing lib in ConTeXt to convert the data to Lua tables, and then use ConTeXt Lua Document syntax to generate different versions of my CV (depending on the command line flags to the `context` compiler. Once the data is converted to a Lua table, it is trivial to do things like group pubs by year, group pubs by research areas, etc.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: