Følg

The world really, really does not need more markup languages, so of course I wrote another one: repare.re/hcml/README.xhtml Source code and tooling is available in repare.re/hcml/

@Steinar That's quite a nice approach, to be honest.

I think there's lots of scope for people to have their own personal markup languages; while there is a use-case for a more "universal" language like a markdown, one that's focused on the work that you actually want to do is great.

The aim of course is to allow you to focus on the content, with enough expressiveness to allow meaningful output. Separating the metadata from the data is always a struggle, and where you've used > and < to provide literal } and { (because they're your metadata indicators) I would be feeling the loss of the angle brackets more than you, because I tend to talk about things like email@address more often.

Which makes me think: perhaps a declaration line at the beginning of the document could name the exact characters being used for metadata in the document ... ?
You could use

# HCML {}

and I could use

# HCML <>

... ?

@yojimbo Good idea for flexibility, but I guess the docs weren't clear: The < and > are command names, like H and T, a literal < not enclosed in curly brackets will pass straight through (and be quoted as necessary for XHTML). So mail addresses, typical URL notation and all that works straight out of the box. As the < and > are simply allocated as command names, they are really handled exactly the same way as ordinary letters.

> → &gt;
<a@b.com> → &lt;a@b.com&gt;
{ > } → }

1/3

@yojimbo Given this example fragment:

{ | this url <https://a.b> and this character { < } and this character < }

You will get:

2/3

@yojimbo XHTML fragment:

<p>
this url &lt;https://a.b&gt; and this character { and this character &lt;
</p>

So, I think it already works as you need for email and similar stuff?

3/3

@yojimbo I have updated the docs a little, trying to be more explicit. Comparing README.xhtml and README.hcml is probably clearer than my prose. :)

@yojimbo Two more examples for why the need for quoting is contra-intuitively low:

" { " lexes as " ", "{", " "
" ab{ " lexes as " ", "ab{", " "

So, it's only in the first case any quoting is needed, as everything except backspace escaping is space delimited.

But, yeah, “skinable” syntax for elegant writing in different domains, is an interesting idea in general. Then the backspace might be exchangeable as well, to avoid extreme forests of backspace when writing about e.g. regexps.

@yojimbo That should have backslash, not backspace, obviously. :D

@Steinar It looks like I may have confused { < }with text < text...

I will read a bit more, and probably install a copy to play with.

(I still haven't figured out the markdown in this mastodon/glitch either!)

@Steinar At the moment I'm describing { a b c d } in my head as "block, command 'a', arguments 'b c d'". This seems nice. Extending the code with my own 'commands' would be very good too.

I'm a great fan of having text-based documentation call out to tools like graphviz, so I can have diagrams included and edited at the same time as the text around them. I appreciate that this is talking about doing much more than transforming into XHTML, but as part of a wider workflow I can invoke pre- and post- processing to do this, as long as I can get id values passed around ...

@yojimbo Sure, I know and share the workflow. Small, straightforward, plain-text-based tooling. Classic UN*X, basically. Since I discovered somebody was interested in HCML, I simplified the structure so that each tool is just a single file now. Feel free to change, extend, and use as you like. Especially just extending with new commands should be very straightforward. Just remember I wrote it for fun.

(And the way you read the blocks is pretty much the way I was thinking when writing the tool.)

@Steinar Documents must have a Title block - this isn't documented as mandatory.

echo '{ | paragraph }' | hcml2xhtml fails.
echo '{ T title } { | paragraph }' | hcml2xhtml works.
echo '{ | paragraph } { T title }' | hcml2xhtml works.

@yojimbo My mistake forgetting to document that. It's because title is mandatory for XHTML documents.

@Steinar Overall I'm impressed with how concise your code is :-) Just thought I should say that!

@yojimbo Thanks, that's appreciated!

I'll fix the doc tomorrow, btw. (It's late in my timezone. :) )

Logg på for å delta i samtalen
Snabelen.no

Eit norskt podium for den desentraliserte sosiale media plattformen Mastodon.