Make a HTML parser in regex.
Deadline: before the thread is deleted by the mods
Name:
Anonymous2013-08-17 13:15
THIS THREAD HAS CHANGED TOPIC
New title: /prog/ challenge #4363
Redefine the web completely by replacing HTML with S-exps and Javashit with Scheme.
Deadline: before the report advocate realizes his futile efforts are futile
I'd make a regex to parse html, but unfortunately some people think it's a good idea to write things like <br> instead of <br />, or <img> instead of <img />. Really, these people are the worst.
>>25
XML and HTML are both terrible in different ways. XHTML, at least, had the benefit of removing many of the terrible parts of HTML at only the cost of adding the terrible parts of XML, which were already there for the most part. And at least with XHTML you get the ability to point expat at the thing and not worry about whether someone closed their tags or not.
>>30
Paredit makes S-Expressions work entirely on you favor, the only people who complain are the ones who haven't tried it in earnest.
Now, the only downside I can see is if you for some reason have to read Lisp code in a shitty editor or printed, so you can't actually trust the indentation, or follow it easily, but that's rare.
Name:
Anonymous2013-08-18 20:30
>>30
One point of XML is so humans don't require a software editor to parse the code. If you really like Lisp so much, it won't take you any time to write some Lisp macros that write proper XML and XHTML.
>>29
How is this
(anchor
(list
(item "1")
(item "2")
(item "3")))
any worse than
<anchor>
<list>
<item>1</item>
<item>2</item>
<item>3</item>
</list>
</anchor> [/code]
Do a character count, a line count, try to type both of these manually, and tell me which one is worse. If you have parens so much, you could use S-exprs with angular/curly braces, a specific byte outside of ASCII, SJIS emoticons, little Unicode penises or whatever you want, and they will still be better than the markup languages shat by the W3shit.
Name:
Anonymous2013-08-18 20:49
(anchor
$ list
(item "1")
(item "2")
$ item "3")
Name:
Anonymous2013-08-18 20:49
>>34
Now try writing an Lisp parens example for a front page like Yahoo.
Name:
Anonymous2013-08-18 20:51
>>29
A modification of >>34-san's post: Forced-indentation S-expressions.
anchor
list
item "1"
item "2"
item "3"
which sort of reminds me of YAML, known to be fully parsable both by humans and machines. Not that I'm suggesting YAML or FIS-exprs, but anything will always be better than XML based markup languages.
>>30
XML has never been easy to parse by humans. Try opening an Ant configuration file or any of those TURNKEY SOLUTIONS and tell me if you could read it after pasting it on Notepad or printing it.
Name:
Anonymous2013-08-18 20:55
>>36
Still would turn out to be better than HTML. Did you even read my post? Yes, there would be ))))))))))))), but if you don't like them and you like languages with C-like syntax so much, then you could do
(anchor
(list
(item "1")
(item "2")
(item "3")
)
)
and the ``closing tags'' still take less space than [code]</list></anchor></body></html></document></program></end></eof></really-end-this-time>[code].
Name:
Anonymous2013-08-18 20:57
>>38
If you want to get rid of ))))))))), see >>35
>>39
I don't get it. Why is that $ before the third item? It doesn't seem to open or close anything specific, it seems to be randomly added inside the list.