News for hackers. Stuff that matters.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by Crinus on Wednesday April 10, 2019 @05:01AM (#19622982)
I do not have anything online at the moment to show, but a small document processor i wrote some time ago used a @-based syntax which was essentially a tree of named nodes with attributes - essentially the same thing as XML, but with a simpler syntax that was something like:

    @Foo; is a standalone empty node named Foo
    @Foo[aa] has a "aa" attribute without a value
    @Foo[bb=cc] has a "bb" attribute with "cc" value
    @Foo[dd="hello, world",ee] has "dd" attribute with "hello, world" value and "ee" attribute without value
    @Foo{blah} has a "blah" text child
    @Foo{blah @Bar;} has "blah" and Bar children
    @Foo Bar shortcut for @Foo{Bar}
    @Foo{!{...}!} has ... as unprocessed content
So you can type something like @P{This is a @I nice @Link[target=foo]{example} of @TT{code} @Smile;.} which would be sort of equivalent to XML <P>This is a <I>nice</I> <Link target="foo">example</Link> of <TT>code</TT> <Smile/></P> (but with less repetition, especially for longer documents).

In my processor the tree is passed to a script that does the actual handling by going through the nodes, children, etc and creating the output text (HTML or whatever) - the processor itself has no knowledge of specific node names, any meaning lies in the scripts.

My biggest issue with the above though is that i do not like editing markup by hand, so at some point i want to replace all the above with a GUI tool that does the same job but in a more graphical way without the need for (visible to the user) markup syntax (so the above example would be edited as just text but with the "nice", "example" and "code" bits having representational styling).

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by smartmic on Wednesday April 10, 2019 @06:36AM (#19623366)
Looks a little bit like the Lout typesetting system on a first glance.

https://en.wikipedia.org/wiki/Lout_(software)

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by Crinus on Wednesday April 10, 2019 @06:55AM (#19623447)
Yes, it was mainly inspired by Lout (although i think there is a much older system that used a similar syntax - and GNU TexInfo also uses something similar, but i didn't knew about that at the time), however IIRC Lout doesn't use a generic syntax.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by neilv on Wednesday April 10, 2019 @08:02AM (#19623768)
In a case of great minds think alike (you, Eli Barzilay, and Matthew Flatt), this (especially the square brackets and curly braces purposes) is remarkably similar to what Racket ended up using, for the @-reader syntax that's used by Scribble document processing: https://docs.racket-lang.org/scribble/reader.html#%28part._....

I made an Emacs mode for it: https://www.neilvandyke.org/scribble-emacs/

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by enriquto on Wednesday April 10, 2019 @06:25AM (#19623311)
having to close paragraphs is useless. It moves to the user of the markup a concern that is only of interest to the implementor. That should we exactly the other way round.

I prefer html5, where you can leave tags open as if there's no tomorrow.

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by Crinus on Wednesday April 10, 2019 @06:59AM (#19623458)
This is just the way i have the scripts setup since it makes more sense for me for paragraphs to be full nodes that contain their children content, but it is trivial to make empty P nodes act as paragraph separators.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by enriquto on Wednesday April 10, 2019 @08:42AM (#19624023)
It is not a trivial matter when you are writing the markup manually. If you require to open and close paragraphs it becomes very cumbersome for no real gain (just a tiny amount of convenience for the programmer of the parser).

The ideal case is TeX, where paragraphs are separated by a blank line.

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by Crinus on Wednesday April 10, 2019 @10:18AM (#19624861)
With trivial i meant that it is trivial to have a script that makes @P; a separator (or start marker) if you prefer to work that way. I made the system script-driven with a generic syntax exactly because i didn't want to hardcode any specific way of working with the nodes.

As for TeX, i personally dislike markup languages where whitespace is treated in a special way since this is source code, which often needs some style of its own and sometimes that depends on context.

To me seeing where a paragraph - or any other "long" element - begins and ends can be helpful and if anything, i consider the lack of syntax for this in my markup as a negative (but i couldn't come up with a clean and unambiguous syntax for adding an optional "closing" bit). I compensate for that using comments (which look like @# Blah until the end of line), but it is a workaround.

And also FWIW i prefer to have the markup map to the underlying tree of nodes clearly than introduce "magic" that in some cases can make things harder even for writers.

Keep in mind though that this is for long(ish) documents, like a large tutorial, guide, manual, etc not short comments like this one here. For anything that is around the size of a common blog post or shorter, something more adhoc like Markdown is probably better.

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by enriquto on Wednesday April 10, 2019 @10:26AM (#19624950)
> As for TeX, i personally dislike markup languages where whitespace is treated in a special way since this is source code

just to nitpick: except for APL, white space is treated in a special way in all programming languages to separate tokens :)

Using it to separate text (words and paragraphs) makes perfect sense in this context.

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by Crinus on Wednesday April 10, 2019 @10:55AM (#19625292)
Perhaps i used a wrong description, but i meant having special cases/multiple uses and specifically about text markup languages. If every other element of the document tree, like sections, links, emphasis, references, images, figures, etc is marked using explicit syntax then using whitespace for paragraphs is inconsistent and can often be misleading since this will also need to be context sensitive as you do not want paragraphs to be inserted in every node that can have children.

But this is obviously a stylistic preference as to me that sounds too much trouble for no gain at all - which is basically your response above :-P.

But as i wrote in my original message, i'm not a big fan of these plaintext formats and i'd rather work using a "WYSIWYM" editor that uses these nodes behind the scenes instead of having the user write the markup by hand. But that is obviously much harder to implement (and if the tool handles the nodes for you the syntax doesn't matter at all anyway). Still, to me that is the ideal:-).

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by enriquto on Wednesday April 10, 2019 @11:13AM (#19625490)
> But as i wrote in my original message, i'm not a big fan of these plaintext formats and i'd rather work using a "WYSIWYM" editor

you will pry plain text editors from my cold, dead hands!