Lisp-like html as a replacement to bbcode/markup/textile
94.249.190.129
94.249.190.129
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.
If you have a WYSIWYG editor then who cares whether this is used... and as the embed stuff isn't compatible why pick this over BBCode?
If you don't have a WYSIWYG editor, and assuming you're in a web page and a textfield, then markdown works superbly well (ignoring the ugly image syntax).
I struggle to see, given the title and mention of BBCode, how the linked article overcomes any of the issues of the existing methods or offers any benefit.
Not to say that there isn't a place for this... but BBCode isn't it.
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.
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.
In hiccup, you model html to be rendered as nested vectors and maps, such that
<span class="foo">bar</span>
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.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.
class TweetWidget
def initialize(tweet)
@tweet = tweet
end
def content; … end
endLua'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"} [a => {href=>url, name=>'next'}, 'Go to the', [i => 'next'], 'element']; # perl5
[a => {:href(url), :name<next>}, 'Go to the', [:i<next>], '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; a { ... }
and i "next"
are not table elements, they are function applications.All of your examples use more magic characters than the Lua example I gave.
The first set of examples are just to show that you can model HTML data within common Hash/Array literals available in most languages.
re: magic characters - The perl6 example does use some extra shortcut niceties :) However the perl5 example will actually work unchanged in perl6. The Ruby example is only slightly different to perl5 because it uses symbol sigil (Perl like Lua allows barewords on LHS of a table/hash key assignment).
[1] - The only difference is the Lua a() function receives all its content via a single Table. Whereas HTML::AsSubs a() is a variadic function and uses the Hash literal {} for assigning HTML attributes.
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 foobar {u {b %s}}}
TeX-like (yes I'm making up the keywords): {\b {\i This is in italics and bold.}}
{\font {Henny+Penny} We can use google fonts anywhere if we just import them first with the google-font code}
{\macro {foobar} {\u {\b #1}}}
I would definitely prefer the first alternative over the TeX-like. The analogy also suggests though that instead of HTML "<br />" you could have a TeX-like atom "\br" instead of "{br}"; saves only one character, but easy to see inside a block of text.E.g. How do I use relative links? Is {subdir Hello world} a relative link, a font-name, or a new and yet unsupported tag?
Html handles this: <a href='subdir'> versus <font name='subdir'> versus <subdir>...
Oh, and why support font names and colors directly in tags in 2012? He should support class names instead!
Why is "fontname from URL" hardcoded for Google fonts? Why not a generic syntax that handles whatever site you might want to use.
Why support simple macros without any support for formatting numbers and currency? Your server-site language should support this, so why send it to the browser?
Image (pic) elements are missing height/width, so we're back to the relayout flashes that the NCSA_Mosaic browser had whenever it loaded an image.
Exercise for the reader: let your editor remove one } by random. Figure out yourself where it's missing by just reading the source.
<!doctype html>
<tex>
Hello, World
\bye
</tex>There's an issue with curly braces { }. When typing in Russian (and in other Cyrillic languages) you need to switch keyboard layout before and after each curly brace. It quickly becomes tiresome to do: type-in-russian, switch-layout, type-{, switch-layout, type-in-russian etc.
This problem also exist in Markdown too: square brackets [ ] and curly braces { } both live on the same keys as Russian 'Х' and 'Ъ'. Typing Russian Markdown with links is tiresome. Curiously, the only easy to type characters in Cyrillic layout are parens ( ).
Update. I wrote about JCUKEN layout above: http://en.wikipedia.org/wiki/JCUKEN. But on some keyboards the layout is extended. E.g. Mac keyboard allows you to enter square brackets [ ] with `~ key in default Russian layout [1, 2]
[1]: http://store.storeimages.cdn-apple.com/2544/as-images.apple....
[2]: http://store.apple.com/ie-business/product/MC184RS/B/apple-w...
Hence, many many developers use a US layout instead of their native one, even if their native one is somewhat similar to the US one. This is true for pretty much all European layouts and certainly for more foreign ones.
Its a mess, basically.
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. They are on a key with tilde ~ and backtick `. Before this very comment I didn't know I could type square brackets in Cyrillic layout... This should make Markdown much easier!
@hemlock runs in the editor process and interacts with other Lisp processes
called @i[eval servers]. A user's Lisp program normally runs in an eval
server process. The separation between editor and eval server has several
advantages:
@begin[itemize]
The editor is protected from any bad things which may happen while debugging a
Lisp program.
Editing may occur while running a Lisp program.
The eval server may be on a different machine, removing the load from the
editing machine.
Multiple eval servers allow the use of several distinct Lisp environments.
@end[itemize]
To make things italic, you would write @i[some text here]. Longer commands would be like in the itemize example. Each paragraph would be an item in this simple version.http://cairnarvon.rotahall.org/2010/05/25/towards-a-better-b...
It's fun to play around with for a minute, but unless you really like /prog/, you're rarely going to want that kind of flexibility in basic text formatting. Still, a sexpcode parser would make for a decent board gimmick, so I'm kind of surprised that no one (that I can remember, anyways) used it for that.
Other than that it looks like a good alternative.
I like it, but comes a little bit late. 8 years ago probably was nicer.
* 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.}}"
divs. How to write something like <div class="text" id="lore">Test lore ipsum</div> ? Does this have a chicken scheme style named parameters?
Inline HTML, especially useful for macros. {html <i>i</i>} should become <i>i</i>
A unification <script> <img> <video> <audio> and <iframe>. It's not that easy to translate to html, but i felt there should be one mechanism, since they all just embed a another medium. The sematics would make more sense IMO.
The macro expression takes a argument (the macro name). Can my macro aswell do this aswell? Any why doesn't the colour use it?
Other languages also have similar solutions - http://stackoverflow.com/questions/671572/cl-who-like-html-t...
It's still a bit line-noisy compared against markdown and, well, I've yet to see a forum using bbcode properly.
Not sure whether that's a good demographic to aim at. Basically everything is better than bbcode, yet it's quite firmly entrenched after all these years (with a bit of tag-limited HTML and WYSIWYG as alternatives).
http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual029.ht...
So I just wanted to ask: is it intended to be open-source? I couldn't find the link to the source on the site and as mentioned I didn't read through comments yet.
EDIT: I skimmed all the comments but still haven't found any mention about source code. Also, I remembered YAJET[1] as something at least equally interesting.
[1]: Home page is here: http://www.yajet.net/ and docs here: http://www.yajet.net/yajet/doc/yajet.html
I was suspecting this and it's one of the main reasons I'd like to see the source :-) Please don't hesitate to post it when you think it's ready!
{defmacro foo [bar] {li {i {bar}}}}As for the idea in the title, isn't this more or less what Viaweb did?
Create a DSL for generating HTML elements and structure that can itself be embedded in an HTML page. Then let users POST commands along with their data to your custom interpeter (that you built from Lisp/Scheme).
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 <i> or <h3> or whatever.
Also, the page itself uses markup in HTML (not CSS)... wow.. back in 1995 again, are we?
Either you say "ok, i want to get rid of HTML and make it really easy to build a website" or not. This approach is neither, in my opinion.
In my opinion, that's a problem of most of those "fancy" markup languages. Why should i bother using this (or haml for that matter), if it only adds another layer of complexity and yet another "language" to learn (for me and far more important for every other person that may join a project in the future)? It may look prettier but it introduces overhead and potential other problems. Is it worth it? For me, it's not.
it's the bees knees as a bbcode replacement.
Is the source available?
I would prefer the element name in front of the brackets. Like this:
h3{We can use google fonts easily}
This separates the element name more from the content.
[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 (<br />) 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/
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).
If you call it lispy it's gotta use parens.
The curlies immediately suggest some broken json or perl hash.
I can see the lispy spirit in applying the car to the cdr, and I like it!
One first bug report (or feature removal request):
makes it to the output, but is replaced with the U+00A0 character in the input textarea.
{p like so}
What's the concern with a real lisp syntax?
I for one like it!