LuaCommon.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <!DOCTYPE html>
  2. <html dir="ltr">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  5. <title>Diagnostics/Scribunto/LuaCommon - XOWA</title>
  6. <link rel="shortcut icon" href="https://gnosygnu.github.io/xowa/xowa_logo.png" />
  7. <link rel="stylesheet" href="https://gnosygnu.github.io/xowa/xowa_common.css" type="text/css">
  8. </head>
  9. <body class="mediawiki ltr sitedir-ltr ns-0 ns-subject skin-vector action-submit vector-animateLayout" spellcheck="false">
  10. <div id="mw-page-base" class="noprint"></div>
  11. <div id="mw-head-base" class="noprint"></div>
  12. <div id="content" class="mw-body">
  13. <h1 id="firstHeading" class="firstHeading"><span>Diagnostics/Scribunto/LuaCommon</span></h1>
  14. <div id="bodyContent" class="mw-body-content">
  15. <div id="siteSub">From XOWA: the free, open-source, offline wiki application</div>
  16. <div id="contentSub"></div>
  17. <div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">
  18. <h2>
  19. <span class="mw-headline" id="Lua_Common">Lua Common</span>
  20. </h2>
  21. <ul>
  22. <li>
  23. Calls code in
  24. <ul>
  25. <li>
  26. <a href="/wiki/Module:Diagnostics/LuaCommon" id="xolnki_2" title="Module:Diagnostics/LuaCommon">Module:Diagnostics/LuaCommon</a>
  27. </li>
  28. <li>
  29. <a href="/wiki/Template:Diagnostics/LuaCommon/getFrameTitle_parent" id="xolnki_3" title="Template:Diagnostics/LuaCommon/getFrameTitle parent">Template:Diagnostics/LuaCommon/getFrameTitle parent</a>
  30. </li>
  31. <li>
  32. <a href="/wiki/Template:Diagnostics/LuaCommon/preprocess_args_parent" id="xolnki_4" title="Template:Diagnostics/LuaCommon/preprocess args parent">Template:Diagnostics/LuaCommon/preprocess args parent</a>
  33. </li>
  34. </ul>
  35. </li>
  36. <li>
  37. Tests compatibility for <b>LuaCommon.php</b> and <b>mw.lua</b>
  38. </li>
  39. </ul>
  40. <table class="wikitable">
  41. <tr>
  42. <th>
  43. name
  44. </th>
  45. <th>
  46. code
  47. </th>
  48. <th>
  49. actl
  50. </th>
  51. <th>
  52. rslt
  53. </th>
  54. </tr>
  55. <tr>
  56. <td>
  57. <span style='color: green;'>pass</span>
  58. </td>
  59. <td>
  60. getExpandedArgument
  61. </td>
  62. <td>
  63. {{#invoke:Diagnostics/LuaCommon|getExpandedArgument_number_2 |val_1|val_2}}
  64. </td>
  65. <td>
  66. arg_1 is 'val_1'; arg_2 is 'val_2'
  67. <p>
  68. <br>
  69. </p>
  70. </td>
  71. </tr>
  72. <tr>
  73. <td>
  74. <span style='color: green;'>pass</span>
  75. </td>
  76. <td>
  77. getExpandedArgument_byOrdinal
  78. </td>
  79. <td>
  80. {{#invoke:Diagnostics/LuaCommon|getExpandedArgument_by_ordinal |key_1=val_1|val_2}}
  81. </td>
  82. <td>
  83. [1] is 'val_2'
  84. <p>
  85. <br>
  86. </p>
  87. </td>
  88. </tr>
  89. <tr>
  90. <td>
  91. <span style='color: green;'>pass</span>
  92. </td>
  93. <td>
  94. getAllExpandedArguments
  95. </td>
  96. <td>
  97. {{#invoke:Diagnostics/LuaCommon|getAllExpandedArguments |val_1|val_2|val_3}}
  98. </td>
  99. <td>
  100. 1:val_1;2:val_2;3:val_3;
  101. <p>
  102. <br>
  103. </p>
  104. </td>
  105. </tr>
  106. <tr>
  107. <td>
  108. <span style='color: green;'>pass</span>
  109. </td>
  110. <td>
  111. getAllExpandedArgs;key_is_int
  112. </td>
  113. <td>
  114. {{#invoke:Diagnostics/LuaCommon|getAllExpandedArguments_int_key|1=a}}
  115. </td>
  116. <td>
  117. a
  118. <p>
  119. <br>
  120. </p>
  121. </td>
  122. </tr>
  123. <tr>
  124. <td>
  125. <span style='color: green;'>pass</span>
  126. </td>
  127. <td>
  128. preprocess;redundant_keys
  129. </td>
  130. <td>
  131. {{#invoke:Diagnostics/LuaCommon|preprocess_ifeq_as_yn |val_1|val_1|when_true_val=y1|when_false_val=n1|when_true_val=y2}}
  132. </td>
  133. <td>
  134. y2
  135. <p>
  136. <br>
  137. </p>
  138. </td>
  139. </tr>
  140. <tr>
  141. <td>
  142. <span style='color: green;'>pass</span>
  143. </td>
  144. <td>
  145. expandTemplate
  146. </td>
  147. <td>
  148. {{#invoke:Diagnostics/LuaCommon|expandTemplate|val_1|val_2}}
  149. </td>
  150. <td>
  151. arg_1 is val_1; arg_2 is val_2
  152. <p>
  153. <br>
  154. </p>
  155. </td>
  156. </tr>
  157. <tr>
  158. <td>
  159. <span style='color: green;'>pass</span>
  160. </td>
  161. <td>
  162. expandTemplate; PHP bool; true -&gt; 1 false -&gt; ""
  163. </td>
  164. <td>
  165. {{#invoke:Diagnostics/LuaCommon|expandTemplate_bool}}
  166. </td>
  167. <td>
  168. bool_true is "1"; bool_false is "";
  169. <p>
  170. <br>
  171. </p>
  172. </td>
  173. </tr>
  174. <tr>
  175. <td>
  176. <span style='color: green;'>pass</span>
  177. </td>
  178. <td>
  179. callParserFunction
  180. </td>
  181. <td>
  182. {{#invoke:Diagnostics/LuaCommon|callParserFunction|urlencode|abc}}
  183. </td>
  184. <td>
  185. abc
  186. <p>
  187. <br>
  188. </p>
  189. </td>
  190. </tr>
  191. <tr>
  192. <td>
  193. <span style='color: green;'>pass</span>
  194. </td>
  195. <td>
  196. isSubsting;false
  197. </td>
  198. <td>
  199. {{#invoke:Diagnostics/LuaCommon|isSubsting}}
  200. </td>
  201. <td>
  202. false
  203. <p>
  204. <br>
  205. </p>
  206. </td>
  207. </tr>
  208. <tr>
  209. <td>
  210. <span style='color: green;'>pass</span>
  211. </td>
  212. <td>
  213. isSubsting;true
  214. </td>
  215. <td>
  216. {{safesubst:#invoke:Diagnostics/LuaCommon|isSubsting}}
  217. </td>
  218. <td>
  219. true
  220. <p>
  221. <br>
  222. </p>
  223. </td>
  224. </tr>
  225. <tr>
  226. <td>
  227. <span style='color: green;'>pass</span>
  228. </td>
  229. <td>
  230. getFrameTitle_current
  231. </td>
  232. <td>
  233. {{#invoke:Diagnostics/LuaCommon|getFrameTitle_current}}
  234. </td>
  235. <td>
  236. Module:Diagnostics/LuaCommon
  237. <p>
  238. <br>
  239. </p>
  240. </td>
  241. </tr>
  242. <tr>
  243. <td>
  244. <span style='color: green;'>pass</span>
  245. </td>
  246. <td>
  247. getFrameTitle_parent
  248. </td>
  249. <td>
  250. {{Diagnostics/LuaCommon/getFrameTitle_parent}}
  251. </td>
  252. <td>
  253. Template:Diagnostics/LuaCommon/getFrameTitle parent
  254. <p>
  255. <br>
  256. </p>
  257. </td>
  258. </tr>
  259. <tr>
  260. <td>
  261. <span style='color: green;'>pass</span>
  262. </td>
  263. <td>
  264. getFrameTitle_parent.upper
  265. </td>
  266. <td>
  267. {{diagnostics/LuaCommon/getFrameTitle_parent}}
  268. </td>
  269. <td>
  270. Template:Diagnostics/LuaCommon/getFrameTitle parent
  271. <p>
  272. <br>
  273. </p>
  274. </td>
  275. </tr>
  276. <tr>
  277. <td>
  278. <span style='color: green;'>pass</span>
  279. </td>
  280. <td>
  281. newChildFrame.title
  282. </td>
  283. <td>
  284. {{#invoke:Diagnostics/LuaCommon|newChildFrame_titled}}
  285. </td>
  286. <td>
  287. title:Title0; arg1:v1
  288. <p>
  289. <br>
  290. </p>
  291. </td>
  292. </tr>
  293. <tr>
  294. <td>
  295. <span style='color: green;'>pass</span>
  296. </td>
  297. <td>
  298. newChildFrame.title
  299. </td>
  300. <td>
  301. {{#invoke:Diagnostics/LuaCommon|newChildFrame_untitled}}
  302. </td>
  303. <td>
  304. title:Module:Diagnostics/LuaCommon; arg1:v1
  305. <p>
  306. <br>
  307. </p>
  308. </td>
  309. </tr>
  310. <tr>
  311. <td>
  312. <span style='color: green;'>pass</span>
  313. </td>
  314. <td>
  315. preprocess_args;frame is current
  316. </td>
  317. <td>
  318. {{#invoke:Diagnostics/LuaCommon|preprocess_args_current|match|y|n}}
  319. </td>
  320. <td>
  321. y
  322. <p>
  323. <br>
  324. </p>
  325. </td>
  326. </tr>
  327. <tr>
  328. <td>
  329. <span style='color: green;'>pass</span>
  330. </td>
  331. <td>
  332. preprocess_args;frame is parent
  333. </td>
  334. <td>
  335. {{Diagnostics/LuaCommon/preprocess_args_parent|match|y|n}}
  336. </td>
  337. <td>
  338. y
  339. <p>
  340. <br>
  341. </p>
  342. </td>
  343. </tr>
  344. <tr>
  345. <td>
  346. <span style='color: green;'>pass</span>
  347. </td>
  348. <td>
  349. preprocess calling Module functions should not call them twice; fails if onceonce
  350. </td>
  351. <td>
  352. {{#invoke:Diagnostics/LuaCommon|preprocess_nested_main}}
  353. </td>
  354. <td>
  355. once
  356. <p>
  357. <br>
  358. </p>
  359. </td>
  360. </tr>
  361. </table>
  362. </div>
  363. </div>
  364. </div>
  365. <div id="mw-head" class="noprint">
  366. <div id="left-navigation">
  367. <div id="p-namespaces" class="vectorTabs">
  368. <h3>Namespaces</h3>
  369. <ul>
  370. <li id="ca-nstab-main" class="selected"><span><a id="ca-nstab-main-href" href="index.html">Page</a></span></li>
  371. </ul>
  372. </div>
  373. </div>
  374. </div>
  375. <div id='mw-panel' class='noprint'>
  376. <div id='p-logo'>
  377. <a style="background-image: url(https://gnosygnu.github.io/xowa/xowa_logo.png);" href="http://xowa.org/" title="Visit the main page"></a>
  378. </div>
  379. <div class="portal" id='xowa-portal-home'>
  380. <h3>XOWA</h3>
  381. <div class="body">
  382. <ul>
  383. <li><a href="http://xowa.org/index.html" title='Visit the main page'>Main page</a></li>
  384. <li><a href="http://xowa.org/screenshots.html" title='See screenshots of XOWA'>Screenshots</a></li>
  385. <li><a href="https://www.youtube.com/watch?v=q0qbXYXEH6M" title="See a video of XOWA Desktop in action">Video</a></li>
  386. <li><a href="http://xowa.org/home/wiki/Help/Download_XOWA.html" title='Download the XOWA application'>Download XOWA</a></li>
  387. <li><a href="http://xowa.org/home/wiki/Dashboard/Image_databases.html" title='Download offline wikis and image databases'>Download wikis</a></li>
  388. </ul>
  389. </div>
  390. </div>
  391. <div class="portal" id='xowa-portal-started'>
  392. <h3>Getting started</h3>
  393. <div class="body">
  394. <ul>
  395. <li><a href="http://xowa.org/home/wiki/App/Setup/System_requirements.html" title='Get XOWA&apos;s system requirements'>Requirements</a></li>
  396. <li><a href="http://xowa.org/home/wiki/App/Setup/Installation.html" title='Get instructions for installing XOWA'>Installation</a></li>
  397. <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>
  398. <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>
  399. <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>
  400. </ul>
  401. </div>
  402. </div>
  403. <div class="portal" id='xowa-portal-android'>
  404. <h3>Android</h3>
  405. <div class="body">
  406. <ul>
  407. <li><a href="http://xowa.org/home/wiki/Android/Setup.html" title='Setup XOWA on your Android device'>Setup</a></li>
  408. <li><a href="https://www.youtube.com/watch?v=jsMTBxGweUw" title="See a video of XOWA Android in action">Video</a></li>
  409. </ul>
  410. </div>
  411. </div>
  412. <div class="portal" id='xowa-portal-help'>
  413. <h3>Help</h3>
  414. <div class="body">
  415. <ul>
  416. <li><a href="http://xowa.org/home/wiki/Help/About.html" title='Get more information about XOWA'>About</a></li>
  417. <li><a href="http://xowa.org/home/wiki/Help/Contents.html" title='View a list of help topics'>Contents</a></li>
  418. <li><a href="http://xowa.org/home/wiki/Help/Media.html" title='Read what others have written about XOWA'>Media</a></li>
  419. <li><a href="http://xowa.org/home/wiki/Help/Feedback.html" title='Questions? Comments? Leave feedback for XOWA'>Feedback</a></li>
  420. </ul>
  421. </div>
  422. </div>
  423. <div class="portal" id='xowa-portal-blog'>
  424. <h3>Blog</h3>
  425. <div class="body">
  426. <ul>
  427. <li><a href="http://xowa.org/home/wiki/Blog.html" title='Follow XOWA''s development process'>Current</a></li>
  428. </ul>
  429. </div>
  430. </div>
  431. <div class="portal" id='xowa-portal-links'>
  432. <h3>Links</h3>
  433. <div class="body">
  434. <ul>
  435. <li><a href="http://dumps.wikimedia.org/backup-index.html" title="Get wiki datababase dumps directly from Wikimedia">Wikimedia dumps</a></li>
  436. <li><a href="https://archive.org/search.php?query=xowa" title="Search archive.org for XOWA files">XOWA @ archive.org</a></li>
  437. <li><a href="http://en.wikipedia.org" title="Visit Wikipedia (and compare to XOWA!)">English Wikipedia</a></li>
  438. </ul>
  439. </div>
  440. </div>
  441. <div class="portal" id='xowa-portal-donate'>
  442. <h3>Donate</h3>
  443. <div class="body">
  444. <ul>
  445. <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/ -->
  446. <li><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector" title="Support Wikipedia!">Wikipedia</a></li>
  447. <li><a href="http://xowa.org/home/wiki/Help/Donate.html" title="Support XOWA!">XOWA</a></li>
  448. </ul>
  449. </div>
  450. </div>
  451. </div>
  452. </body>
  453. </html>