/You know... Expandtemplates would be useful for debugging
templates... Well onto my actual point.../
Awhile back I proposed my WikiCode idea. The idea wasn't meant for
making WikiText a programming language, the idea was to improve
readability and functionality of templates (in both code and usage) and
also make them use less resources to be parsed.
I actually have a bit of an example of how extensive a set of templates
can currently get to allow intuitive inputs into templates.
One of the proposed functions was one I called #splice, but would
probably be best called #split-and-merge.
The idea was to allow manipulation of a string similar to what would
require the use of a large number of #explodes and end up still being
limited. Basically it would split something by a separator, and then
apply a custom wrapper to that (also special wrappers for special cases
like first/last/only/dual/dual-second) to do something like turning each
of those items into a link.
An example would be for a genre input in an infobox.
The infobox could allow for input such as:
| genre = Science fiction, Thriller, Horror
And output a comma separated list where each of the item is linked, and
also turned into a category (Or even a semantic attribute when SMW is
installed globally).
So that list, would output those three genre with links to the genre
pages, and also categorize them inside of that genre.
Now, I actually have something like this currently in place. However,
it's not exactly ideal.
It's part of the iBox system I was working on (basically the idea is to
allow intuitive templates like {{iBox/Row|....}} rather than the ugly
kludge of WikiCode we currently use, to allow for easy to read infobox
code that even a template newbie could edit and add extra rows to)
http://anime.wikia.com/wiki/Template:IBox/Mutation/Split-and-Merge
You can see some example usage of it at the bottom half of:
http://anime.wikia.com/wiki/Animepedia:Sandbox
The calling of it doesn't look as great as it would if we had
#split-and-merge, but that's alright for something done using pure
templates ParserFunctions, and StringFunctions. It's actually been
optimized as much as possible, but that actually isn't enough.
Let us begin explaining the evil of it all:
Well I don't actually need to explain much for you to understand from
looking at it, that it needs to make use of a large number of
#explode's, #if's, and also I need use of #ifexpr, and #expr to do a lot to.
To cut down on a certain kind of load the template is actually split
into two, there's a /Call template which does the bulk of common cases
without needing to repeat the use of an extremely evil template I had to
create.
What's this template? I call it {{count
<http://anime.wikia.com/wiki/Template:Count>}}:
http://anime.wikia.com/wiki/Template:Count
Quite simply, StringFunctions never included a simple #count function
despite the use of #explode. Why do we need count? Cause if you find the
number of times a substring occurs inside of a string, then you know
that the number of items #explode will pull out is +1 to that number...
And that is far less intensive than making use of #explode dozens of
times to find out. Especially since that never actually tells you if you
have a "Foo, , Bar" in the string which will end up terminating the list
preemptively.
Now, what's so bad about the Count template? Quite simply, since there's
no ParserFunction which nicely deals with this I had to go about it in
an extremely hacky method.
To sum it up, I used good old algebra. That and a little string
replacement. The foundation, if you replace you're needle, with a bit of
text that is double the characters, and then minus the length of the new
string from the length of the old and divide by the length of the needle
(Think that was the base) you will get a number which tells how many
times it occurs in the string.
How do we do this in WikiText? Well, to do it in the most supportive
method (making sure that we support multi-character needles, and the
possibility of the string having extra characters of the thing we're
trying to count which would skew the numbers) we end up making use of
#expr 2 times, #replace 2 times, #pad 3 times, and #len 6 times.
Now of course, this is completely insane on how inefficient it is, but
that's because StringFunctions doesn't include the ability to use it.
Which as a php function is actually an extremely lightweight task.
That's kinda my reasons for wanting the WikiCode structure to clean it
all up.
Now of course, if you want an example of a point for something like
this, take a look at the code of:
http://anime.wikia.com/wiki/Negima/Negima%21:_Magister_Negi_Magi
If you'll notice, the | genre = input takes a mere comma separated list
which any human could understand. However, despite a lack of category
tags, the article is categorized into a category for each one of those
genre.
^_^ Now, if you want off the technical stuff, and want to know why I
intend to replace most of my categories on this kind of stuff with
Semantic Attributes, my I point you to:
http://anime.wikia.com/wiki/Okusama_wa_Joshikousei/Okusama_wa_Joshikousei
((Just take a look at the automatically generated categories... Rofl...
That would be much cleaner with SMW))
My general idea is to try and allow for anime to be semantically
browsed... Through series, but also searching through characters in
series. And also allow a little more intuitive input for editing (more
understandable by those who don't know to much about the syntax). And
also automate some stuff which can get tedious in editing and really has
no need for all the duplication that is likely to end up with something
missing or left un-updated.
--
~Daniel Friesen(Dantman) of:
-The Gaiapedia (http://gaia.wikia.com)
-Wikia ACG on Wikia.com (http://wikia.com/wiki/Wikia_ACG)
-and Wiki-Tools.com (http://wiki-tools.com)
_______________________________________________
Wikia-tech-l mailing list
[email protected]
http://lists.wikia.com/mailman/listinfo/wikia-tech-l