273 karma · joined September 15, 2013
<?php
$foo = array();
echo $foo['a']['b']['c']; // not an errorOne feature I personally needed and missed was to generate a table of contents with page numbers for each heading. I ended up exporting the doc to Word to do it, and in the process discovered that the exported document had a messed up layout in a few places.
https://phabricator.wikimedia.org/T34618 https://www.mediawiki.org/wiki/Requests_for_comment/Partial_...
Personally I doubt that it would help much – there are hardly any non-dynamic parts of the page in MediaWiki. (Everything is customizable using server-side configuration, modifying magical pages, or both; or dependent on user permissions or preferences; or both.)
(English Wikipedians in general are very "territorial" in my experience, so to speak, and rarely appreciate efforts that put some piece of "their" articles beyond their "jurisdiction", like Wikidata does. Editors from other language versions are a lot more welcoming.)
Eh, I can't really agree with this. VisualEditor rollout was indeed premature (critical features like template editing were developed literally days before it), but a year has passed and it's gone a long way since then. Haters still hate it, but personally I find it more pleasant to use than wikitext for many tasks.
This was a really interesting read, though. I still this there's value in the WYSIWYG paradigm, even if we have to fall back to "IDE mode" for infoboxes and such (right now if you double-click a template, you're shown a key-value table to fill in; there's no live preview…). After all, most of the content of Wikipedia is text with some light formatting.
Yes, and Parsoid works around this by preserving some metadata about wikitext in HTML (such as information about whitespace around syntax elements) and, since this preservation isn't perfect, only reserializing HTML→wikitext where the content was changed during editing.
> Second, apparently the template language is Turing-complete. Let's say I write a prime sieve in order to generate a page that lists the first 100 prime numbers. What would it then mean to edit "31" to change it to "30"?
Assuming we're talking about VisualEditor, you currently just can't do that (you can only delete the entire template inclusion and replace it with normal text, or edit template parameters).
(As a nitpick, wikitext is not Turing-complete (there is no loop or recursion construct, recursion is explicitly checked for and causes an error), you can only write complicated algorithms by manually unrolling enough loops. However, for some time now you can also write templates in Lua, which is a proper Turing-complete programming language, see <https://www.mediawiki.org/wiki/Extension:Scribunto>.)
I'm pretty sure every Unicode character will (unless somebody missed any). There are Unicode character charts on Wikipedia too, and they're fully linkified, e.g. https://en.wikipedia.org/wiki/Arrows_(Unicode_block)
Here's a comparison of code to do the same thing written in Ruby:
Dir['**/*.py'].map{|f| File.readlines(f).length }.inject(:+)
find . -name '*.py' | xargs cat | wc -l
That's 60 characters versus 39 (most of these are just because the "commands" are longer – and I don't think anyone would even try to argue that 'cat' or 'wc' is more readable than 'File.readlines' or 'length').I ran them on Python 2.7's library directory and my version counted four lines more – I didn't investigate, but I think yours missed lines when cating files without trailing newline. I'd argue that's a bug in your code :)