Module:Sandbox/trappist the monk/layurl

require ('strict');

local data=mw.loadData ('Module:Sandbox/trappist the monk/layurl/data');

local articles_using_layurl_t = data.articles_using_layurl;

local wp_med_articles_t = data.wp_med_articles;

local wp_med_articles_using_layurl_t = {};

local get_args = require ('Module:Arguments').getArgs;

--[[--------------------------< M A I N >----------------------------------------------------------------------

For each article title in articles_using_layurl_t look for that article title in the selected wp:med articles list.

If found add the article title to wp_med_articles_using_layurl_t sequence table.

There are three wp:med article lists:

all wp:med articles (Category:All WikiProject Medicine articles)

all wp:med fa articles (Category:FA-Class medicine articles)

all wp:med ga articles (Category:GA-Class medicine articles)

{{#invoke:Sandbox/trappist_the_monk/layurl|main|list=|fa=|ga=}}

|list=yes – return an unordered list of wikilinked articles from the selected wp:med list that use |lay-url=

|fa=yes – target list is wp_med_fa_articles

|ga=yes – target list is wp_med_ga_articles

when neither |fa=yes not |ga=yes then target list is wp_med_articles

]]

local function main (frame)

local args_t = get_args (frame);

local list_t; -- holds the chosen wp:med article list

if 'yes' == args_t.fa then

list_t = data.wp_med_fa_articles; -- use the featured articles list

elseif 'yes' == args_t.ga then

list_t = data.wp_med_ga_articles; -- use the good articles list

else

list_t = data.wp_med_articles; -- use the list of all wp:med articles

end

for title, _ in pairs (articles_using_layurl_t) do -- get next title from

if list_t[title] then -- is in selected wp:med <list_t>?</p> <p>title = '*<a href='?title=%27_.._title_.._%27'>' .. title .. '</a>'; -- yes, make a wikilink with unordered=list markup</p> <p>table.insert (wp_med_articles_using_layurl_t, title); -- add wikilinked <title> to <wp_med_articles_using_layurl_t></p> <p>end</p> <p>end</p> <p>if 'yes' == args_t['list'] then</p> <p>table.sort (wp_med_articles_using_layurl_t); -- sort the results</p> <p>return table.concat (wp_med_articles_using_layurl_t, '\n'); -- return an unordered list of article titles</p> <p>end</p> <p>return #wp_med_articles_using_layurl_t; -- return the total number of titles found</p> <p>end</p> <p>--[[--------------------------< E X P O R T >------------------------------------------------------------------</p> <p>]]</p> <p>return {</p> <p>main = main,</p> <p>}</p></div></section></div></main> <footer class="site-footer"> <div class="footer-container"> <div class="footer-links"> <a href="/about.php">About</a> <a href="/help.php">Help</a> <a href="/updates.php">Updates</a> <a href="/contact.php">Contact</a> <a href="/privacy.php">Privacy</a> <a href="/terms.php">Terms</a> <a href="https://github.com/yourusername/friendly-wiki" target="_blank" rel="noopener">GitHub</a> </div> <div class="footer-copy"> © 2025 Friendly Wiki. All rights reserved. </div> </div> </footer> <script> const toggle = document.getElementById('mobileMenuToggle'); const menu = document.getElementById('mobileMenu'); toggle.addEventListener('click', () => { menu.classList.toggle('active'); }); </script> <!-- Collapsible toggle --> <script> document.addEventListener("DOMContentLoaded", function () { const toggles = document.querySelectorAll('.section-toggle'); toggles.forEach(toggle => { toggle.addEventListener('click', function () { const section = toggle.closest('.collapsible'); const body = section.querySelector('.wiki-body'); body.classList.toggle('collapsed'); }); }); }); </script>