[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to tame compiler?
From: |
Jean Louis |
Subject: |
Re: How to tame compiler? |
Date: |
Sat, 1 May 2021 19:19:48 +0300 |
User-agent: |
Mutt/2.0.6 (2021-03-06) |
* Stefan Monnier <monnier@iro.umontreal.ca> [2021-05-01 16:39]:
> > I have to understand it in this example:
> >
> > The HTML template is following and it is string:
> >
> > <html>
> > <head>
> > <title>⟦ xml-escape title ⟧</title>
> > </head>
> > <body>
> > <p>Today is one US dollar this many euros: ⟦ usd-eur 1 ⟧</p>
> > </body>
> > </html>
>
> I think the way I'd attack this is similar to what was suggested
> recently. I think I'd introduce a macro (call it `xml-template`) which
> you'd use maybe as follows:
>
> (xml-template
> (html
> (head (title ,title))
> (body (p "Today is one US dollar this many euros: " ,@(usd-eur 1)))))
>
> where `,` is used to insert a random chunk of plain text,
> whereas `,@` is used to insert a chunk of XML.
Approach is known to me from, is it Scribilo?
https://www.nongnu.org/skribilo/ and Skribe
https://www.nongnu.org/skribilo/#self
I use similar approach for CGI document generation.
My system does allow such inclusion as I can introduce any type of
document.
But let me think:
- HTML template would need to be converted into sex-pressions; (don't
stone me); it would increase the startup time of preparing the
template, there are just 127 templates in the database;
- then Markdown documents, what I do with it? Maybe all of 4057 should
be converted into sex-pressions... with very careful attention to
detail;
- then Markdown is not any more Markdown, it would still need to be
expanded by Emacs Lisp;
- then everything expanded embedded into HTML as Emacs Lisp;
Problems with the process:
- it is not readable any more;
- becomes tiresome, much more work is involved to write simple text;
HTML template preparation alone involves programming skills; not
easily scalable;
- it becomes very much error prone, one mistake and all page will not
interpolate;
- author, who only slighly was thinking about the markup, has now to
go back into thinking harder about the markup, instead of just
writing text, author has to mark it up with (p "something") or
similar; author is not any more in the "lightweight" markup as
described here:
https://en.wikipedia.org/wiki/Lightweight_markup_language
That approach would be definitely usable for:
- specific pages where large need arise for interpolation;
- with complex code where a lot of interpolation is taking place
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
- Re: How to tame compiler?, (continued)
- Re: How to tame compiler?, Jean Louis, 2021/05/01
- Re: How to tame compiler?, Michael Heerdegen, 2021/05/01
- Re: How to tame compiler?, Jean Louis, 2021/05/01
- Re: How to tame compiler?, Jean Louis, 2021/05/01
- Re: How to tame compiler?, Michael Heerdegen, 2021/05/02
- Stages of WWW development compared to Emacs Lisp development, Jean Louis, 2021/05/02
- Re: Stages of WWW development compared to Emacs Lisp development, Emanuel Berg, 2021/05/02
- Re: Stages of WWW development compared to Emacs Lisp development, Jean Louis, 2021/05/02