قالب:Evalx

خطأ: لا توجد وحدة بهذا الاسم "Wikilisp".

[edit] Template-info.svg Template documentation
[{{fullurl:

Usage

Returns the name of the non-documentation page presumably associated with the transcluding page: returns {{FULLPAGENAME}} with a /doc suffix, if any, stripped off.

Use on a documentation subpage names the documented page (the object of the documentation) both when viewing the subpage directly and when transcluding it on the documented page.

An optional unnamed parameter specifies a name to use in place of {{FULLPAGENAME}}.

This template can be substituted (via subst:) as well as transcluded.

Examples

page where called result
Template:Assistant/dwim {{تم كشف حلقة قالب: قالب:OBJECTPAGENAME|Template:Assistant/dwim}}
Template:Assistant/dwim/doc {{تم كشف حلقة قالب: قالب:OBJECTPAGENAME|Template:Assistant/dwim/doc}}
أخبار المعرفة:Assistant/dwim {{تم كشف حلقة قالب: قالب:OBJECTPAGENAME|أخبار المعرفة:Assistant/dwim}}
أخبار المعرفة:Assistant/dwim/doc {{تم كشف حلقة قالب: قالب:OBJECTPAGENAME|أخبار المعرفة:Assistant/dwim/doc}}

See also

/doc/use-count/doc|action=edit&editintro=Template:Possible-risk/editintro&preload=Template:Possible-risk/preload&summary=create}} create use count]

Usage

This template evaluates an expression sequence using Module:Wikilisp. Pass the expression sequence as the first unnamed template parameter; all parameters to the template are also passed to the the module. For example,

{{evalx|(get-substring (get-arg 2) 2 3)|abcd}}

would expand to

خطأ: لا توجد وحدة بهذا الاسم "Wikilisp".

Here's a nontrivial example, made to work in concert with dialog verb edit. It modifies the entire content of a wiki page (provided through template parameter SUBJECT-CONTENT) to submit the article for review‍ on Wikinews, by removing calls to templates قالب:(*developخطأ: لا توجد وحدة بهذا الاسم "Rptchars". and قالب:(*tasksخطأ: لا توجد وحدة بهذا الاسم "Rptchars". and adding a call at the top of the page to template قالب:(*reviewخطأ: لا توجد وحدة بهذا الاسم "Rptchars"..

{{evalx|(define s (get-arg 2))
        (define t (filter (parse s)
                          call?
                          (\x (member? (ucfirst (trim (get-substring s (nth (get-parts x) 1))))
                                       (list "Dialog/submit" "Develop" "Developing" "Development" "Draft" "Tasks")))))
        (set-substring s (+ (list (list 1 0)) t)
                         (+ (list "{{(*}}{{(*}}review{{*)}}{{*)}}") (map (\x "") t)))
       |{{{SUBJECT-CONTENT|}}}}}
A different module, to use instead of Module:Wikilisp, may be specified by non-blank template parameter test-eval.

Internals

When Module:Wikilisp is #invoked directly, rather than through an intermediary template such as {{evalx}}, the module point of entry is Lua function rep, and the invocation parameters are accessible through Wikilisp functions get-arg and get-arg-expr. However, the intermediary template cannot explicitly pass its arbitrary template parameters to the invocation since it doesn't know their names in advance. To compensate, an alternative point of entry is provided through Lua function trep, that feeds get-arg and get-arg-expr the parameters to the intermediary template instead of the parameters to #invoke.

See also