Live data from Hacker News

Lisp-like html as a replacement to bbcode/markup/textile

94.249.190.129

51–60 of 83 posts

Re: Lisp-like html as a replacement to bbcode/markup/textile

#51

I think that this is an interesting experiment, and reminds me of Clojure's hiccup[1] library. In hiccup, you model html to be rendered as nested vectors and maps, such that bar becomes (html [:span {:class "foo"} "bar"]) Where this is a real win is when you realize that it's just data: (html [:ol (for [x (range 1 4)] [:li x])]) Lisps are well suited to model html. [1] https://github.com/weavejester/hiccup

The table and lists parsers are exactly that. Syntax transformations after I have a list made of dom nodes and binary elements. I can make a DSL parser attached to any tag I make. I just don't know what else would be useful.

Re: Lisp-like html as a replacement to bbcode/markup/textile

#52

I think that this is an interesting experiment, and reminds me of Clojure's hiccup[1] library. In hiccup, you model html to be rendered as nested vectors and maps, such that bar becomes (html [:span {:class "foo"} "bar"]) Where this is a real win is when you realize that it's just data: (html [:ol (for [x (range 1 4)] [:li x])]) Lisps are well suited to model html. [1] https://github.com/weavejester/hiccup

Ruby has had these type of libraries for years. The original is probably Markaby, but today there are alternatives that are both faster (https://github.com/camping/mab/) and has more features (http://erector.rubyforge.org/).

It's an interesting concept, but I find that (1) it's hard to work on it together with designers and (2) for larger templates I don't find it that elegant.

Re: Lisp-like html as a replacement to bbcode/markup/textile

#53
post #21

No. How does it replace markup?! It's still writing html but (more or less) using {} instead of . That's just silly, imo. Markup (and restructured text) are so much more concise because you don't need to know what's or or whatever. Also, the page itself uses markup in HTML (not CSS)... wow.. back in 1995 again, are we?

Line by line parsers are extremely limited and markdown makes use of everyday characters we use in text for their formatting. The page itself uses style tags at the top so not sure what you mean. This is just showing off my progress so far of something I plan to use. Not an announcement telling you this is the future.

Ah well, not saying you shouldn't use that. Just saying i wouldn't ;)

Re: Lisp-like html as a replacement to bbcode/markup/textile

#54
post #19
post #2

Looks a lot like TeX, which is a good thing. In fact this might even be better. I'm tired so I might be missing an obvious weakness but to take the analogy a bit further here are some comparisons between this suggestion and a more TeX-like version. The author's suggestion: {b {i This is in italics and bold.}} {Henny+Penny We can use google fonts anywhere if we just import them first with the google-font code} {macro…

Why don't browsers support TeX anyway? Maybe it could even be embedded in a HTML page, like SVG. Hello, World \bye

There is actually an XML version of TeX: http://getfo.org/texml/

Re: Lisp-like html as a replacement to bbcode/markup/textile

#55

I don't get how people likes Lisp syntax so much, for me it looks horrible. I would prefer markdown as a replacement for BBCode

Line by line parsers are much much more limited. This can support syntax transformations and html attributes. This is more of an html-alternative in terms of capability. Markdown links are ugly and you need double space instead of single space for every space you input. I could do something like replace things nested in as italics but I'd rather have normal characters not turned into formatting. Lisp might look ugly…

What's wrong with Markdown links [1]? I'd have a hard time coming up with a better syntax than this:

    [Google][]
      [google]: http://www.google.com/
    [Google][1]
      [1]: http://www.google.com/
    [Google](http://www.google.com)
I'm not sure what you mean about double-spacing either. Line breaks () are made by adding two spaces to the end of a line. If you don't like that, try GitHub-flavored Markdown [2].

[1]: http://daringfireball.net/projects/markdown/syntax#links [2]: http://github.github.com/github-flavored-markdown/

Re: Lisp-like html as a replacement to bbcode/markup/textile

#57
post #17

Hmm, an awful lot of s in the generated code. Never mind that I'm not a big fan of explicit 's, either, as s-expression like formatting isn't that helpful once your actual content pushes the starting tag beyond the screen. SGML is actually not a bad idea if your markup content is pretty low ( It's still a bit line-noisy compared against markdown and, well, I've yet to see a forum using bbcode properly.

A new BR for every enter I press. The goal was to make the text in the textarea readable. Maybe that's why markdown uses 2 line breaks for every but I'm not sure I want to do that.

I still don't see a reason for manual linebreaks here, which would mostly be useful for things like poems etc, where you explicitely need to mandate a certain structure. For everything else paragraphs seem a better solution, especially compared to pervasive use for to simulate post-paragraph spacing.

Re: Lisp-like html as a replacement to bbcode/markup/textile

#58

I think that this is an interesting experiment, and reminds me of Clojure's hiccup[1] library. In hiccup, you model html to be rendered as nested vectors and maps, such that bar becomes (html [:span {:class "foo"} "bar"]) Where this is a real win is when you realize that it's just data: (html [:ol (for [x (range 1 4)] [:li x])]) Lisps are well suited to model html. [1] https://github.com/weavejester/hiccup

Oleg Kiselyov has done some nice work where he defines SXML, a representation of XML in Scheme, and parsers/ pretty printers between XML and Scheme. This allows you to use hygienic macros (hygiene becomes important in the absence of namespaces). See http://www.okmij.org/ftp/Scheme/xml.html#SXML-spec

Lua's table syntax is well-suited to this style of embedding html/xml syntax in a programming language, e.g., if you define the appropriate functions a and i to represent anchors and italics, then you can define an anchor element:

    a {href=url, name="next",
       "Go to the",
       i "next",
       "element"}

Re: Lisp-like html as a replacement to bbcode/markup/textile

#59
post #18

This would never replace bbcode. The best thing to replace that is markdown. People don't really grok tags very well at all. BBCode only works because of WYSIWYG editors that do the work for the user. That and the wide acceptance meaning that sites like Flickr produce BBCode embed statements. Markdown works well for people just typing in plain text but still getting something formatted without trying to tag things. I…

> BBCode only works because [...]

Any board out there is full of posts with broken quotes and markup. I don't think BBCode works. It's widespread but it doesn't mean it works.

I otherwise agree with your points.

Re: Lisp-like html as a replacement to bbcode/markup/textile

#60
post #57

Earlier quoted context omitted.

A new BR for every enter I press. The goal was to make the text in the textarea readable. Maybe that's why markdown uses 2 line breaks for every but I'm not sure I want to do that.

I still don't see a reason for manual linebreaks here, which would mostly be useful for things like poems etc, where you explicitely need to mandate a certain structure. For everything else paragraphs seem a better solution, especially compared to pervasive use for to simulate post-paragraph spacing.

For developers that's right but when normal people are chatting hit enter they expect a new line. I can't assume they mean the new text to be a paragraph unless they specify it. I supposed I could add escaping for newlines but I'm not going to auto

either.

Post reply on HN