Walt Mankowski via plug on 28 Jan 2023 04:25:57 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] My Holy Quest for a WYSIWYG HTML Word Processor


On Sat, Jan 28, 2023 at 04:30:32AM -0500, Steve Litt via plug wrote:
> Soren Harward via plug said on Thu, 26 Jan 2023 11:48:32 -0500
> 
> 
> >Yeah, Markdown was originally conceived to be easy enough to parse
> >visually and write that you don't really need WYSIWYG. But it's easily
> >rendered to HTML+CSS. So if you need something with more formatting
> >than plain text, but easier to read/write than raw HTML+CSS or
> >XML+XSLT, Markdown hits that sweet spot.
> 
> Welllll, sort of. Markdown is easily converted to HTML+CSS, but AFAIK
> *onlY* for the few styles supported by Markdown. However:
> 
> 1) You can include HTML within a Markdown document.
> 
> 2) You can make your own tokens which, after conversion to HTML, can be
>    converted to HTML.
> 
> IMHO #2 is the real key to productive authoring, if the author is
> willing to live with the insertion of a few tags within his Markdown
> document. I've been trying to make something like this for the better
> part of a decade. When I finally do it, I'm going to do it in Python
> because Python is the language most likely to complete a started
> project. If anyone wants to help me either on the specs or the coding,
> please let me know.

I had a very similar problem when I was preparing weekly quizzes for a
class I was teaching. Here's how I solved it.

First, I had a master template for the quiz in LaTeX. It had
placeholders for things like the chapter and the date, plus one for
the main body which had all the questions.

I wrote the questions in Markdown. Markdown (or, at least, pandoc's
Markdown parser) ignores anything that isn't Markdown syntax, so I was
free to insert LaTeX for things I couldn't figure out how to format
nicely just in Markdown. I could also call some LaTeX macros I had in
the template, the main one being `\answer`, which would format the
answer in either white (i.e. invisible) for the students, but black
for my master key.

This was all tied together with a small Perl script which expanded the
template using the `Text::Template` module from CPAN. I also had a
simple Makefile to automate running it every week.

I'd be happy to share a sample with you if you're looking for some
inspiration.

Walt
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug