Module:Search: Difference between revisions

Content deleted Content added
No edit summary
 
(12 intermediate revisions by 6 users not shown)
Line 1:
-- This module implements {{search}}
local p = {}
 
local ll = ''
 
local function urlencode(text)
Line 12 ⟶ 9:
end
 
local function addlinkmake_link(purl, uexpansion, adisplay_text, t, safter)
return mw.ustring.format(
local item = ll:tag('li'):css('display', 'inline')
'[%s <abbr title="%s">%s</abbr>]%s',
item:wikitext(p .. '[' .. u .. ' ')
url,
item:tag('abbr')
expansion,
:attr('title', a)
display_text,
:css('border-bottom', 'none')
after or ''
:css('text-decoration', 'none')
)
:css('cursor', 'inherit')
:wikitext(t)
item:wikitext(']' .. s)
end
 
Line 28 ⟶ 23:
wrappers = 'Template:Search'
})
 
local ss = args[1] or 'example phrase'
local ssencsearch_phrase_encoded = urlencode(ssargs[1] or 'example phrase')
local short_module_args = {
class = 'template-search plainlinks',
local ret = mw.html.create('div')
make_link('https://en.wikipedia.org/w/index.php?title=Special:Search&search=' .. search_phrase_encoded, 'Wikipedia', 'wp'),
:addClass('plainlist')
make_link('https://www.google.com/search?q=' .. search_phrase_encoded, 'Google', 'g'),
:addClass('plainlinks')
make_link('https://www.bing.com/search?q=' .. search_phrase_encoded, 'Bing', 'b'),
:css('display', 'inline')
}
ll = ret:tag('ul'):css('display', 'inline')
local long_module_args = {
class = 'template-search plainlinks',
addlink('(', frame:preprocess('{{fullurl:Special:Search|search=' .. ssenc .. '}}'), 'Wikipedia', 'wp', '')
addlink make_link('', 'https://wwwen.googlewikipedia.comorg/searchw/index.php?qtitle=Special:Search&search=site%3Awikipedia.org+' .. ssencsearch_phrase_encoded, 'Wikipedia over Google', 'gwpwp'), '')
addlink make_link('', 'https://www.google.com/search?q=site%3Awikipedia.org+' .. ssencsearch_phrase_encoded, 'Wikipedia over Google', 'ggwp'), '')
addlink make_link('', 'https://www.binggoogle.com/search?q=site%3Awikipedia.org+' .. ssencsearch_phrase_encoded, 'Wikipedia over BingGoogle', 'bwpg'), '')
addlink make_link('', 'https://www.bing.com/search?q=site%3Awikipedia.org+' .. ssencsearch_phrase_encoded, 'Wikipedia over Bing', 'bbwp'), ' | ')
addlink make_link('', 'https://www.britannicabing.com/search?queryq=' .. ssencsearch_phrase_encoded, 'Encyclopaedia BritannicaBing', 'ebb', ' |'),
addlink make_link('', 'httphttps://www.bartlebybritannica.com/cgi-bin/texis/webinator/65searchsearch?nop&query=' .. ssencsearch_phrase_encoded, 'ColumbiaEncyclopaedia EncyclopediaBritannica', 'coeb'), '')
addlink make_link('', 'https://www.googlebartleby.com/searchcgi-bin/texis/webinator/65search?qquery=site%3Ahttp%3A%2F%2Fwww.pcmag.com%2Fencyclopedia_term%2F+' .. ssencsearch_phrase_encoded, 'PC MagazineColumbia Encyclopedia over Google', 'gctco'), '')
make_link('https://www.google.com/search?q=site%3Ahttp%3A%2F%2Fwww.pcmag.com%2Fencyclopedia_term%2F+' .. search_phrase_encoded, 'PC Magazine Encyclopedia over Google', 'gct'),
addlink('', 'http://scienceworld.wolfram.com/search/index.cgi?as_q=' .. ssenc, 'World of Science', 'sw', '')
addlink make_link('', 'https://archivescienceworld.orgwolfram.com/search/index.phpcgi?queryas_q=' .. ssencsearch_phrase_encoded, 'InternetWorld Archive',of 'arcScience', 'sw'),
addlink make_link('', 'https://babel.hathitrustarchive.org/cgi/lssearch.php?field1=ocr;q1query=' .. ssenc .. ';a=srchls;lmt=ft'search_phrase_encoded, 'HathiTrust',Internet 'htArchive', ')arc'),
make_link('https://babel.hathitrust.org/cgi/ls?field1=ocr;q1=' .. search_phrase_encoded .. ';a=srchls;lmt=ft', 'HathiTrust', 'ht'),
}
local sslong = (args[1].long or 'example') phrase~= ''
return ret
local ubl = require('Module:List').unbulleted
local list = ubl(long and long_module_args or short_module_args)
return frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:Search/styles.css' }
item:wikitext(p} .. '[(' .. ulist .. ' )')
end