Live data from Hacker News

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

94.249.190.129

61–70 of 83 posts

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

#61
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

I always thought it was an obvious chose given the people who started this (academics).

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

#62

I've found HAML ( http://haml.info/ ) to be my ideal reduced HTML syntax, strange not to see it mentioned here.

HAML is fantastic overall, but there are two ways in which I don't think it's addressing the same problem as something like this:

* Whitespace-sensitive means I don't want to use it in a text-field in a browser -- in an editor I can have guide lines to show me the indentation levels and what lines up with what, and keyboard shortcuts for indenting/unindenting blocks quickly.

* Nesting and inline stuff just doesn't work well since you'd end up with stuff like a %b on one line and then an %i on the next line unless you just went plain-HTML for the line. HAML is much more suited for page structure, and not so great for inline content.

Something like the following line is really cool with a quasi-TeX feel: "Using multiple tags: {b {i This is italics and bold.}}"

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

#63

Earlier quoted context omitted.

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://daringfir…

I was only aware of the last one. This has the capability to be used as a replacement to html, not just a limited subset. It can also do syntax transformations like the table, which also accepts other syntax transforms and tags. Markdown can't take html attributes either.

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

#64

Earlier quoted context omitted.

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://daringfir…

[deleted]

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

#65

Years trying to move the style to the css and be semantic in the html. I like it, but comes a little bit late. 8 years ago probably was nicer.

Cgi.tcl (http://expect.sourceforge.net/cgi.tcl/) has been around since the mid-nineties. Also, htmlgen (http://tclxml.sourceforge.net/xmlgen/htmlgen.html).

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

#66
post #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 de…

Most languages will have literals that can be used to easily represent HTML data:

  [a => {href=>url, name=>'next'}, 'Go to the', [i => 'next'], 'element'];    # perl5

  [a => {:href(url), :name}, 'Go to the', [:i], 'element'];       # perl6

  [:a => {:href=>url, :name=>'next'}, 'Go to the', [:i => 'next'], 'element'] # ruby
  
Your Lua example is very similar to the HTML::AsSubs CPAN module (https://metacpan.org/module/HTML::AsSubs). Here is your example using this module:

    use HTML::AsSubs;

    sub url { 'http://www.anythingfornow.com' }

    my $h = html(
        a( {href=>url, name=>'next'},
           'Go to the',
           i('next'),
           'element',
        ),
    );

    say $h->as_HTML;

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

#67

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

I used to think the same thing about Lisp syntax. I wondered how anyone could like it at all. For the last several years I've done a lot of coding in Scheme, and I have to admit, I've grown to really like it. I think the primary reason people dislike Lisp/Scheme-style syntax is that it is so very different than what they are used to. For years we've been programming in Algol-like syntaxes (C, C++, Java, etc) -- and when you're used to that, Lisp-like languages look so foreign that the natural response is often "ew! that looks awful!".

I know it's probably been said here multiple times before, but you really do get used to the parentheses, and eventually I think you'll even appreciate them (if you decide to really give Lisp or Scheme a chance).

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

#68
post #33

Earlier quoted context omitted.

Out of curiosity, do Russian developers permanently use an English layout, or just map these keys elsewhere?

Switching layout is not an issue when typing code. You just type in English because keywords and API are obviously in English. The problem exist only for markup languages where you type prose. Still (in addition to English letters) these are hard to type in Russian layout: { } ' @ # $ ` (and more - depends on a keyboard and operating system). Update. I've just noticed square brackets [ ] on my (Cyrillic) Mac keyboard…

Actually on Mac with a combination of alt/option key and the letter you should be able to right {} in cyrillic without switching layout. Search a little, and openthe "keyboard viewer" tool.

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

#69
post #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.

his underlying point, and he as much as said it, is that bbcode IS successful because it WAS successful.

when it was born, it was convenient because it looked and acted like html while limiting the users ability fuck things up. at the same time it didn't go confusing the machine that was going to process it. it was clearly never designed for anything but bridging that gap... some 15+ years ago.

Flickr produces bbcode embeds, but imgur produces like 8 different embeds. existing adoption is not the sole mark of success for anything digital. facebook anyone?

the wysiwyg editors make it easier to generate "human usable code that limits fucking up". It matters because users can still fuck things up but for some reason they need to be able to read it.

THAT is why this type of thing should be used (on the developer level) as a replacement. It's easy to read, it's easy to grasp, it's consistent and it's no more difficult to parse (for erlang or haskell or php) at the server level than bbcode.

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

#70
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.

you forgot to say that you weren't intending to use it to replace your use of html, but for replacing your use of bbcode-likes.

it's the bees knees as a bbcode replacement.

Post reply on HN