1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2024-10-27 20:34:16 +00:00
gnosygnu_xowa/home/wiki/Options/Scribunto.html
2017-03-16 12:04:22 -04:00

463 lines
23 KiB
HTML

<!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Options/Scribunto - XOWA</title>
<link rel="shortcut icon" href="https://gnosygnu.github.io/xowa/xowa_logo.png" />
<link rel="stylesheet" href="https://gnosygnu.github.io/xowa/xowa_common.css" type="text/css">
</head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject skin-vector action-submit vector-animateLayout" spellcheck="false">
<div id="mw-page-base" class="noprint"></div>
<div id="mw-head-base" class="noprint"></div>
<div id="content" class="mw-body">
<h1 id="firstHeading" class="firstHeading"><span>Options/Scribunto</span></h1>
<div id="bodyContent" class="mw-body-content">
<div id="siteSub">From XOWA: the free, open-source, offline wiki application</div>
<div id="contentSub"></div>
<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">
<div id='xocfg_body'>
<div id='xocfg_err'>
</div>
<div>
<span class='xoimg_btn_x16 xoimg_help_tip' href='javascript:void(0)' onclick='return xo.cfg_edit.help__toggle_all()' title='toggle all help'>&nbsp;</span> <select id='xocfg_nav_select' onchange='xo.cfg_edit.select__send(this);' onkeyup='xo.cfg_edit.select__by_keypress(event, this);' accesskey='l'>
<option value='xowa.app.security'>
App - Security
</option>
<option value='xowa.app.startup'>
App - Startup
</option>
<option value='xowa.app.update'>
App - Update
</option>
<option value='xowa.gui.general'>
Gui - General
</option>
<option value='xowa.gui.tabs'>
Gui - Tabs
</option>
<option value='xowa.gui.url_bar'>
Gui - Address bar
</option>
<option value='xowa.gui.menus'>
Gui - Menus
</option>
<option value='xowa.gui.shortcuts'>
Gui - Shortcuts
</option>
<option value='xowa.wiki.hdumps'>
Wiki - HTML Databases
</option>
<option value='xowa.wiki.edit'>
Wiki - Editing
</option>
<option value='xowa.bldr.general'>
Import - General
</option>
<option value='xowa.bldr.db'>
Import - Database
</option>
<option value='xowa.bldr.page_sync'>
Import - Page sync
</option>
<option value='xowa.bldr.dansguardian'>
Import - Dansguardian
</option>
<option value='xowa.html.css'>
HTML - CSS
</option>
<option value='xowa.html.page'>
HTML - Page
</option>
<option value='xowa.html.tidy'>
HTML - Tidy
</option>
<option value='xowa.html.scripting'>
HTML - Scripting
</option>
<option value='xowa.files.general'>
Files - General
</option>
<option value='xowa.files.apps'>
Files - Apps
</option>
<option value='xowa.addon.search'>
Addon - Search
</option>
<option value='xowa.addon.category'>
Addon - Category
</option>
<option value='xowa.addon.http_server'>
Addon - HTTP Server
</option>
<option value='xowa.addon.scribunto' selected='selected'>
Addon - Scribunto
</option>
<option value='xowa.addon.math'>
Addon - Math
</option>
<option value='xowa.addon.score'>
Addon - Score
</option>
<option value='xowa.addon.popups'>
Addon - Popups
</option>
<option value='xowa.addon.wikibase'>
Addon - Wikidata
</option>
<option value='xowa.dev.general'>
Dev - General
</option>
<option value='xowa.gui.nightmode'>
Gui - Night mode
</option>
<option value='xowa.addon.search.fulltext'>
Addon - Full text search
</option>
</select>
</div>
<div id='cfg_grps'>
<div>
<p id='page_help_para'>
</p>
</div>
<h2>
General
</h2>
<div class="xocfg_row flex_div">
<div class='xocfg_itm_help'>
<span class='xoimg_btn_x16 xoimg_help_tip' href='javascript:void(0)' onclick='return xo.help.toggle("xowa.addon.scribunto.enabled")' title='view more info'>&nbsp;</span>
</div>
<div id='xowa.addon.scribunto.enabled__name' class='xocfg_itm_name'>
Enabled
</div>
<div id='xowa.addon.scribunto.enabled__undo' data-xocfg-type='bool' class='xocfg_itm_delete xocfg_itm_hide'>
<span class='xoimg_btn_x16 xoimg_list_undo' onclick='return xo.cfg_edit.delete__send("xowa.addon.scribunto.enabled")' title="reset to &quot;y&quot;">&nbsp;</span>
</div>
<div class='xocfg_itm_data'>
<input id="xowa.addon.scribunto.enabled" data-xocfg-key="xowa.addon.scribunto.enabled" data-xocfg-type="bool" accesskey="d" class="xocfg_data__bool" type="checkbox" checked="checked">
</div><input type='hidden' id='xowa.addon.scribunto.enabled__key_box' value='xowa.addon.scribunto.enabled'> <input type='hidden' id='xowa.addon.scribunto.enabled__ctx_box' value='app'>
</div>
<div id='xowa.addon.scribunto.enabled_help_div' class='xohelp_div'>
<div id='xowa.addon.scribunto.enabled_help_msg' class='xohelp_msg'>
<p>
Handles {{#invoke:Module:Module_name|Function_name|Arguments}}
</p>
<ul>
<li>
<b>checked</b> to process #invoke statements
</li>
<li>
<b>unchecked</b> to render #invoke as text only
</li>
</ul>
</div>
</div>
<div class="xocfg_row flex_div">
<div class='xocfg_itm_help'>
<span class='xoimg_btn_x16 xoimg_help_tip' href='javascript:void(0)' onclick='return xo.help.toggle("xowa.addon.scribunto.engine")' title='view more info'>&nbsp;</span>
</div>
<div id='xowa.addon.scribunto.engine__name' class='xocfg_itm_name'>
Lua engine
</div>
<div id='xowa.addon.scribunto.engine__undo' data-xocfg-type='list:xowa.addon.scribunto.engine' class='xocfg_itm_delete xocfg_itm_hide'>
<span class='xoimg_btn_x16 xoimg_list_undo' onclick='return xo.cfg_edit.delete__send("xowa.addon.scribunto.engine")' title="reset to &quot;luaj&quot;">&nbsp;</span>
</div>
<div class='xocfg_itm_data'>
<select id="xowa.addon.scribunto.engine" data-xocfg-key="xowa.addon.scribunto.engine" data-xocfg-type="list:xowa.addon.scribunto.engine" accesskey="d" class="xocfg_data__list" size="2">
<option value="luaj" selected="selected">
luaj
</option>
<option value="lua">
lua
</option>
</select>
</div><input type='hidden' id='xowa.addon.scribunto.engine__key_box' value='xowa.addon.scribunto.engine'> <input type='hidden' id='xowa.addon.scribunto.engine__ctx_box' value='app'>
</div>
<div id='xowa.addon.scribunto.engine_help_div' class='xohelp_div'>
<div id='xowa.addon.scribunto.engine_help_msg' class='xohelp_msg'>
<p>
Select lua engine. See <a tabindex="-1" href="/wiki/App/Xtn/Mediawiki/Scribunto#Engines" id="xolnki_29" title="App/Xtn/Mediawiki/Scribunto">App/Xtn/Mediawiki/Scribunto#Engines</a>
</p>
<ul>
<li>
<b>luaj</b>: lua code will be processed through the <a tabindex="-1" href="http://luaj.org/luaj/README.html" rel="nofollow" class="external text">luaj</a> jar at /bin/any/java/luaj/.
</li>
<li>
<b>lua</b> : lua code will be processed through the <a tabindex="-1" href="http://lua.org/about" rel="nofollow" class="external text">lua</a> binary at /bin/os_name/lua/.
</li>
</ul>
<p>
<b>Note for Lua engine users:</b>
</p>
<ul>
<li>
<b>executable permissions</b>: Linux / Mac OS X users may need to grant execute permission to the Lua binary. To ensure proper setup, please do the following:
<ul>
<li>
Open <a tabindex="-1" href="/wiki/Diagnostics/Scribunto/All" id="xolnki_30" title="Diagnostics/Scribunto/All" class="xowa-visited">Diagnostics/Scribunto/All</a>
</li>
<li>
If the page fails, then see <a tabindex="-1" href="/wiki/App/Xtn/Mediawiki/Scribunto#Permissions" id="xolnki_31" title="App/Xtn/Mediawiki/Scribunto">App/Xtn/Mediawiki/Scribunto#Permissions</a>
</li>
</ul>
</li>
<li>
<b>NTFS partitions</b>: Linux users with NTFS partitions will need to run a command like the following:
</li>
</ul>
<dl>
<dd>
<code>sudo mount -t ntfs -o rw,auto,user,fmask=0022,dmask=0000 /dev/whatever /mnt/whatever</code>
</dd>
<dd>
See <a tabindex="-1" href="http://askubuntu.com/questions/11840/how-do-i-use-chmod-on-an-ntfs-or-fat32-partition" rel="nofollow" class="external free">http://askubuntu.com/questions/11840/how-do-i-use-chmod-on-an-ntfs-or-fat32-partition</a> (Thanks to Anselm)
</dd>
</dl>
</div>
</div>
<h2>
Lua options
</h2>
<div class="xocfg_row flex_div">
<div class='xocfg_itm_help'>
<span class='xoimg_btn_x16 xoimg_help_tip' href='javascript:void(0)' onclick='return xo.help.toggle("xowa.addon.scribunto.lua.cmd")' title='view more info'>&nbsp;</span>
</div>
<div id='xowa.addon.scribunto.lua.cmd__name' class='xocfg_itm_name'>
Lua path
</div>
<div id='xowa.addon.scribunto.lua.cmd__undo' data-xocfg-type='io.cmd' class='xocfg_itm_delete xocfg_itm_hide'>
<span class='xoimg_btn_x16 xoimg_list_undo' onclick='return xo.cfg_edit.delete__send("xowa.addon.scribunto.lua.cmd")' title="reset to &quot;~{&lt;&gt;bin_plat_dir&lt;&gt;}lua\lua5.1.exe|&quot;">&nbsp;</span>
</div>
<div class='xocfg_itm_data'>
<input class="xocfg_data__io_cmd__exe__txt" id="xowa.addon.scribunto.lua.cmd-exe" data-xocfg-key="xowa.addon.scribunto.lua.cmd" data-xocfg-type="io.cmd-exe" accesskey="d" type="text" value="~{&lt;&gt;bin_plat_dir&lt;&gt;}lua\lua5.1.exe"> <span class="xoimg_btn_x16 xoimg_app_configure" onclick='xo.cfg_edit.io_cmd__select("file", "xowa.addon.scribunto.lua.cmd-exe", "Please select a file.");'>&nbsp;</span><br>
<input class="xocfg_data__io_cmd__arg__txt" id="xowa.addon.scribunto.lua.cmd-arg" data-xocfg-key="xowa.addon.scribunto.lua.cmd" data-xocfg-type="io.cmd-arg" accesskey="d" type="text" value="">
</div><input type='hidden' id='xowa.addon.scribunto.lua.cmd__key_box' value='xowa.addon.scribunto.lua.cmd'> <input type='hidden' id='xowa.addon.scribunto.lua.cmd__ctx_box' value='app'>
</div>
<div id='xowa.addon.scribunto.lua.cmd_help_div' class='xohelp_div'>
<div id='xowa.addon.scribunto.lua.cmd_help_msg' class='xohelp_msg'>
<p>
Path to Lua binary. Only applies to the <code>lua</code>engine.
</p>
</div>
</div>
<div class="xocfg_row flex_div">
<div class='xocfg_itm_help'>
<span class='xoimg_btn_x16 xoimg_help_tip' href='javascript:void(0)' onclick='return xo.help.toggle("xowa.addon.scribunto.lua.timeout")' title='view more info'>&nbsp;</span>
</div>
<div id='xowa.addon.scribunto.lua.timeout__name' class='xocfg_itm_name'>
Lua timeout
</div>
<div id='xowa.addon.scribunto.lua.timeout__undo' data-xocfg-type='int' class='xocfg_itm_delete xocfg_itm_hide'>
<span class='xoimg_btn_x16 xoimg_list_undo' onclick='return xo.cfg_edit.delete__send("xowa.addon.scribunto.lua.timeout")' title="reset to &quot;4000&quot;">&nbsp;</span>
</div>
<div class='xocfg_itm_data'>
<input id="xowa.addon.scribunto.lua.timeout" data-xocfg-key="xowa.addon.scribunto.lua.timeout" data-xocfg-type="int" accesskey="d" class="xocfg_data__int" type="text" value="4000">
</div><input type='hidden' id='xowa.addon.scribunto.lua.timeout__key_box' value='xowa.addon.scribunto.lua.timeout'> <input type='hidden' id='xowa.addon.scribunto.lua.timeout__ctx_box' value='app'>
</div>
<div id='xowa.addon.scribunto.lua.timeout_help_div' class='xohelp_div'>
<div id='xowa.addon.scribunto.lua.timeout_help_msg' class='xohelp_msg'>
<p>
# of milliseconds before canceling Lua call
</p>
</div>
</div>
<div class="xocfg_row flex_div">
<div class='xocfg_itm_help'>
<span class='xoimg_btn_x16 xoimg_help_tip' href='javascript:void(0)' onclick='return xo.help.toggle("xowa.addon.scribunto.lua.timeout_polling")' title='view more info'>&nbsp;</span>
</div>
<div id='xowa.addon.scribunto.lua.timeout_polling__name' class='xocfg_itm_name'>
Lua timeout polling
</div>
<div id='xowa.addon.scribunto.lua.timeout_polling__undo' data-xocfg-type='int' class='xocfg_itm_delete xocfg_itm_hide'>
<span class='xoimg_btn_x16 xoimg_list_undo' onclick='return xo.cfg_edit.delete__send("xowa.addon.scribunto.lua.timeout_polling")' title="reset to &quot;1&quot;">&nbsp;</span>
</div>
<div class='xocfg_itm_data'>
<input id="xowa.addon.scribunto.lua.timeout_polling" data-xocfg-key="xowa.addon.scribunto.lua.timeout_polling" data-xocfg-type="int" accesskey="d" class="xocfg_data__int" type="text" value="1">
</div><input type='hidden' id='xowa.addon.scribunto.lua.timeout_polling__key_box' value='xowa.addon.scribunto.lua.timeout_polling'> <input type='hidden' id='xowa.addon.scribunto.lua.timeout_polling__ctx_box' value='app'>
</div>
<div id='xowa.addon.scribunto.lua.timeout_polling_help_div' class='xohelp_div'>
<div id='xowa.addon.scribunto.lua.timeout_polling_help_msg' class='xohelp_msg'>
<p>
# of milliseconds before checking for timeout. For example, with a timeout of 4000:
</p>
<dl>
<dd>
A timeout polling of 1 will check roughly 4000 times before timing out.
</dd>
<dd>
A timeout polling of 1000 will check roughly 4 times before timing out.
</dd>
</dl>
<p>
This setting should be left at 1. It is meant to "tweak" certain outlier situations should they arise.
</p>
</div>
</div>
<div class="xocfg_row flex_div">
<div class='xocfg_itm_help'>
<span class='xoimg_btn_x16 xoimg_help_tip' href='javascript:void(0)' onclick='return xo.help.toggle("xowa.addon.scribunto.lua.timeout_busy_wait")' title='view more info'>&nbsp;</span>
</div>
<div id='xowa.addon.scribunto.lua.timeout_busy_wait__name' class='xocfg_itm_name'>
Lua timeout busy wait
</div>
<div id='xowa.addon.scribunto.lua.timeout_busy_wait__undo' data-xocfg-type='int' class='xocfg_itm_delete xocfg_itm_hide'>
<span class='xoimg_btn_x16 xoimg_list_undo' onclick='return xo.cfg_edit.delete__send("xowa.addon.scribunto.lua.timeout_busy_wait")' title="reset to &quot;250&quot;">&nbsp;</span>
</div>
<div class='xocfg_itm_data'>
<input id="xowa.addon.scribunto.lua.timeout_busy_wait" data-xocfg-key="xowa.addon.scribunto.lua.timeout_busy_wait" data-xocfg-type="int" accesskey="d" class="xocfg_data__int" type="text" value="250">
</div><input type='hidden' id='xowa.addon.scribunto.lua.timeout_busy_wait__key_box' value='xowa.addon.scribunto.lua.timeout_busy_wait'> <input type='hidden' id='xowa.addon.scribunto.lua.timeout_busy_wait__ctx_box' value='app'>
</div>
<div id='xowa.addon.scribunto.lua.timeout_busy_wait_help_div' class='xohelp_div'>
<div id='xowa.addon.scribunto.lua.timeout_busy_wait_help_msg' class='xohelp_msg'>
<p>
# of milliseconds before entering timeout poll This setting should be left at 250 (or higher). It is also meant to "tweak" certain outlier situations.<br>
Background:
</p>
<ul>
<li>
On Windows, a sleep call can take 15 ms. This could potentially cause each Lua call to take 15 ms.
</li>
<li>
Some pages / templates will call Lua hundreds of times. (For example: the Weather Box on <a tabindex="-1" href="/site/en.wikipedia.org/wiki/Aruba">http://en.wikipedia.org/wiki/Aruba</a> or the Citations on <a tabindex="-1" href="/site/en.wikipedia.org/wiki/Earth">http://en.wikipedia.org/wiki/Earth</a> )
</li>
<li>
The busy wait is a primitive way to limit a wait to 1 ms (or less) before entering a more expensive sleep
</li>
<li>
A higher timeout busy wait value is more performant, but the disadvantage is that the UI will be locked up for longer
</li>
</ul>
<dl>
<dd>
For example, a busy wait of 250 means that the code will loop for 250 milliseconds before entering a sleep.
</dd>
<dd>
For sub-second values, this freezing will be unnoticeable
</dd>
</dl>
<p>
For reference, here is the corresponding code
</p>
<pre style="overflow:auto;">
long time_bgn = System.currentTimeMillis();
long time_woke = time_bgn;
while (true) {
byte[] rv = stream_read.Data();
if (rv != null) return rv;
long time_now = System.currentTimeMillis();
if (time_now &gt; time_woke + server_timeout_busy_wait) {
if (time_now &gt; time_bgn + server_timeout) throw Xoa_xtn_scribunto.err_("lua_timeout: timeout={0} cmd={1}", server_timeout, String_.new_utf8_(cmd_last));
ThreadAdp_.Sleep(server_timeout_polling);
time_woke = System.currentTimeMillis();
}
}
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="mw-head" class="noprint">
<div id="left-navigation">
<div id="p-namespaces" class="vectorTabs">
<h3>Namespaces</h3>
<ul>
<li id="ca-nstab-main" class="selected"><span><a id="ca-nstab-main-href" href="index.html">Page</a></span></li>
</ul>
</div>
</div>
</div>
<div id='mw-panel' class='noprint'>
<div id='p-logo'>
<a style="background-image: url(https://gnosygnu.github.io/xowa/xowa_logo.png);" href="http://xowa.org/" title="Visit the main page"></a>
</div>
<div class="portal" id='xowa-portal-home'>
<h3>XOWA</h3>
<div class="body">
<ul>
<li><a href="http://xowa.org/index.html" title='Visit the main page'>Main page</a></li>
<li><a href="http://xowa.org/screenshots.html" title='See screenshots of XOWA'>Screenshots</a></li>
<li><a href="https://www.youtube.com/watch?v=q0qbXYXEH6M" title="See a video of XOWA Desktop in action">Video</a></li>
<li><a href="http://xowa.org/home/wiki/Help/Download_XOWA.html" title='Download the XOWA application'>Download XOWA</a></li>
<li><a href="http://xowa.org/home/wiki/Dashboard/Image_databases.html" title='Download offline wikis and image databases'>Download wikis</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-started'>
<h3>Getting started</h3>
<div class="body">
<ul>
<li><a href="http://xowa.org/home/wiki/App/Setup/System_requirements.html" title='Get XOWA&apos;s system requirements'>Requirements</a></li>
<li><a href="http://xowa.org/home/wiki/App/Setup/Installation.html" title='Get instructions for installing XOWA'>Installation</a></li>
<li><a href="http://xowa.org/home/wiki/App/Import/Simple_Wikipedia.html" title='Learn how to set up Simple Wikipedia'>Simple Wikipedia</a></li>
<li><a href="http://xowa.org/home/wiki/App/Import/English_Wikipedia.html" title='Learn how to set up English Wikipedia'>English Wikipedia</a></li>
<li><a href="http://xowa.org/home/wiki/App/Import/Other_wikis.html" title='Learn how to set up other Wikipedias'>Other Wikipedias</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-android'>
<h3>Android</h3>
<div class="body">
<ul>
<li><a href="http://xowa.org/home/wiki/Android/Setup.html" title='Setup XOWA on your Android device'>Setup</a></li>
<li><a href="https://www.youtube.com/watch?v=jsMTBxGweUw" title="See a video of XOWA Android in action">Video</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-help'>
<h3>Help</h3>
<div class="body">
<ul>
<li><a href="http://xowa.org/home/wiki/Help/About.html" title='Get more information about XOWA'>About</a></li>
<li><a href="http://xowa.org/home/wiki/Help/Contents.html" title='View a list of help topics'>Contents</a></li>
<li><a href="http://xowa.org/home/wiki/Help/Media.html" title='Read what others have written about XOWA'>Media</a></li>
<li><a href="http://xowa.org/home/wiki/Help/Feedback.html" title='Questions? Comments? Leave feedback for XOWA'>Feedback</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-blog'>
<h3>Blog</h3>
<div class="body">
<ul>
<li><a href="http://xowa.org/home/wiki/Blog.html" title='Follow XOWA''s development process'>Current</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-links'>
<h3>Links</h3>
<div class="body">
<ul>
<li><a href="http://dumps.wikimedia.org/backup-index.html" title="Get wiki datababase dumps directly from Wikimedia">Wikimedia dumps</a></li>
<li><a href="https://archive.org/search.php?query=xowa" title="Search archive.org for XOWA files">XOWA @ archive.org</a></li>
<li><a href="http://en.wikipedia.org" title="Visit Wikipedia (and compare to XOWA!)">English Wikipedia</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-donate'>
<h3>Donate</h3>
<div class="body">
<ul>
<li><a href="https://archive.org/donate/index.php" title="Support archive.org!">archive.org</a></li><!-- listed first due to recent fire damages: http://blog.archive.org/2013/11/06/scanning-center-fire-please-help-rebuild/ -->
<li><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector" title="Support Wikipedia!">Wikipedia</a></li>
<li><a href="http://xowa.org/home/wiki/Help/Donate.html" title="Support XOWA!">XOWA</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>