Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Wikitech
Lua: parser interface
 

Index | Next | Previous | View Flat


tstarling at wikimedia

May 1, 2012, 12:15 AM


Views: 259
Permalink
Lua: parser interface

I've written up a proposed interface between the MediaWiki parser and Lua:

<https://www.mediawiki.org/wiki/Extension:Scribunto/Parser_interface_design>

In summary: the Lua function is called with a single argument, which
is an object representing the parser interface. The object is roughly
equivalent to a PPFrame.

The object would have a property called "args", which is a table with
its "index" metamethod overridden to provide lazy-initialised access
to the parser function arguments with a brief syntax:

{{#invoke:module|func|name=value}}

function p.func(frame)
return frame.args.name --- returns "value"
end

There would be two methods for recursive preprocessing:

* preprocess() provides basic expansion of wikitext
* callTemplate() provides an API for template invocation, since I
imagine that would otherwise be a common use case for preprocess().
Using preprocess() to expand a template with arbitrary arguments would
be difficult.

Like a normal parser function, the Lua function returns text which is
not modified any further by the preprocessor.

Please see the wiki page for a more detailed description, including
rationale.

Any comments would be greatly appreciated.

-- Tim Starling


_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Subject User Time
Lua: parser interface tstarling at wikimedia May 1, 2012, 12:15 AM
    Re: Lua: parser interface vasilvv at gmail May 1, 2012, 10:24 AM
    Re: Lua: parser interface wicke at wikidev May 1, 2012, 11:51 AM
        Re: Lua: parser interface tstarling at wikimedia May 1, 2012, 7:01 PM
            Re: Lua: parser interface Platonides at gmail May 2, 2012, 3:28 AM
                Re: Lua: parser interface vasilvv at gmail May 2, 2012, 4:04 AM
            Re: Lua: parser interface wicke at wikidev May 2, 2012, 5:55 AM
    Re: Lua: parser interface tstarling at wikimedia May 1, 2012, 5:21 PM
        Re: Lua: parser interface vasilvv at gmail May 1, 2012, 6:28 PM
    Re: Lua: parser interface tstarling at wikimedia May 1, 2012, 7:23 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.