Last modified: 2007-03-24 17:44:14 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T10802, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 8802 - Custom format
Custom format
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on: 8828
Blocks:
  Show dependency treegraph
 
Reported: 2007-01-28 07:39 UTC by Emilien ARNAUD
Modified: 2007-03-24 17:44 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
The patch to include this feature (2.94 KB, patch)
2007-01-28 08:28 UTC, Emilien ARNAUD
Details
The new version (0.2) of this patch wich generates automatically query links (3.63 KB, patch)
2007-01-30 09:48 UTC, Emilien ARNAUD
Details

Description Emilien ARNAUD 2007-01-28 07:39:18 UTC
It would be interessting to have the possibility to enter a "custom format".

Something like <ask format="custom" myformat="$0 ($1) [[$2]]">...</ask>.

It would give more flexibility to the extension :)

E.

P.S. I'm on it. I would send a patch when functionnal
Comment 1 Emilien ARNAUD 2007-01-28 08:28:02 UTC
Created attachment 3151 [details]
The patch to include this feature

To test it make a ask this form: <ask format="custom" myformat="%0
(%1)">...</ask> where %0, %1, ..., %X are the "fields" where to put values
Comment 2 Emilien ARNAUD 2007-01-30 09:35:07 UTC
I changed things:

The custom format is in fact used to generate a "complex search link":

I've got a list of year and a list of university. Each student is classified in
a year and in a university.

I would like, on each year page, a list of search link that can make a cross
search. Search queries would be in form like: "[[User:+]] [[Year::Year:MYYEAR]]
[[University::University:MYUNIVERSITY]]"

The major problem was to generate all of this links... That's why I used this
new custom Query Printer...

Now the syntax is:

<ask format="custom" myformat="THE QUERY TEMPLATE" mylabel="The label
produced">QUERY THAT GENERATE LINKS</ask>

Exemple, in the year template (which its name is passed as argument 1):
<ask format="custom" myformat="[[User:+]] [[Year::Year:{{{1}}}]]
[[University::University:%0]]" mylabel="Search students in {{{1}}} in university
%0">[[University:+]]</ask>

would produce:

In the D1 year, if it exists 3 universities:
* [[User:+]] [[Year::Year:D1]] [[University::University:University1]]
* [[User:+]] [[Year::Year:D1]] [[University::University:University2]]
* [[User:+]] [[Year::Year:D1]] [[University::University:University3]]

What's the main feature ? If you later add a new university in the "University:"
namespace, all years would have a 4th link to make cross search.

Technically , I had to change the parser because the template arguments
"{{{1}}}" were not replaced in the <ask ...> hook. Then, I unstriped on each
call of template.

I think it's quite functionnal. Please review my code... It improves SMW and
make it capable to create easily database with no configuration ...
Comment 3 Emilien ARNAUD 2007-01-30 09:48:11 UTC
Created attachment 3160 [details]
The new version (0.2) of this patch wich generates automatically query links

The patch to activate it on SMW. See #8828 on how to hack MediaWiki to activate
parameters passed to hooks
Comment 4 Markus Krötzsch 2007-03-24 17:44:14 UTC
This has now been implemented in the new format="template" which is very similar
to what was suggested above. It takes one parameter template="ArticleName" that
allows you to provide a template. This template gets the query outputs for each
result "row" as numbered parameters and can format them in any way (including
advanced ways based on the parser-hook extension). 

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links