Wikisource
mswikisource
https://ms.wikisource.org/wiki/Laman_Utama
MediaWiki 1.43.0-wmf.3
first-letter
Media
Khas
Perbincangan
Pengguna
Perbincangan pengguna
Wikisource
Perbincangan Wikisource
Fail
Perbincangan fail
MediaWiki
Perbincangan MediaWiki
Templat
Perbincangan templat
Bantuan
Perbincangan bantuan
Kategori
Perbincangan kategori
Page
Page talk
Index
Index talk
TimedText
TimedText talk
Modul
Perbincangan modul
Index:Hikayat Abdullah (1849).pdf
252
210
6450
750
2024-05-03T04:53:23Z
Hakimi97
9
Memulakan percubaan suntingan laman
proofread-index
text/x-wiki
{{:MediaWiki:Proofreadpage_index_template
|Pengarang=Abdullah Abdul Kadir Munshi
|Judul=Hikayat Abdullah
|Tahun=1849
|Penerbit=
|Sumber=
|Imej=
|Jumlah halaman=
|Catatan=
}}
[[Kategori:Indeks]]
f9msqit375mnfpl6f2ywuv9lyb14ztp
6451
6450
2024-05-03T04:53:54Z
Hakimi97
9
Membatalkan semakan [[Special:Diff/6450|6450]] oleh [[Special:Contributions/Hakimi97|Hakimi97]] ([[User talk:Hakimi97|perbincangan]])
proofread-index
text/x-wiki
{{:MediaWiki:Proofreadpage_index_template
|Pengarang=
|Judul=
|Tahun=
|Penerbit=
|Sumber=
|Imej=
|Jumlah halaman=
|Catatan=
}}
[[Kategori:Bahasa Melayu]]
[[Kategori:Index]]
oecwx91lsfrafr41b75e3laqhe1sm0i
6452
6451
2024-05-03T06:22:08Z
Hakimi97
9
Membatalkan semakan [[Special:Diff/6451|6451]] oleh [[Special:Contributions/Hakimi97|Hakimi97]] ([[User talk:Hakimi97|perbincangan]])
proofread-index
text/x-wiki
{{:MediaWiki:Proofreadpage_index_template
|Pengarang=Abdullah Abdul Kadir Munshi
|Judul=Hikayat Abdullah
|Tahun=1849
|Penerbit=
|Sumber=
|Imej=
|Jumlah halaman=
|Catatan=
}}
[[Kategori:Indeks]]
f9msqit375mnfpl6f2ywuv9lyb14ztp
Modul:Template translation
828
1115
6453
2024-05-03T06:24:30Z
Hakimi97
9
Mencipta laman baru dengan kandungan 'local this = {} function this.checkLanguage(subpage, default) --[[Check first if there's an any invalid character that would cause the mw.language.isKnownLanguageTag function() to throw an exception: - all ASCII controls in [\000-\031\127], - double quote ("), sharp sign (#), ampersand (&), apostrophe ('), - slash (/), colon (:), semicolon (;), lower than (<), greater than (>), - brackets and braces ([, ], {...'
Scribunto
text/plain
local this = {}
function this.checkLanguage(subpage, default)
--[[Check first if there's an any invalid character that would cause the
mw.language.isKnownLanguageTag function() to throw an exception:
- all ASCII controls in [\000-\031\127],
- double quote ("), sharp sign (#), ampersand (&), apostrophe ('),
- slash (/), colon (:), semicolon (;), lower than (<), greater than (>),
- brackets and braces ([, ], {, }), pipe (|), backslash (\\)
All other characters are accepted, including space and all non-ASCII
characters (including \192, which is invalid in UTF-8).
--]]
if mw.language.isValidCode(subpage) and mw.language.isKnownLanguageTag(subpage)
--[[However "SupportedLanguages" are too restrictive, as they discard many
valid BCP47 script variants (only because MediaWiki still does not
define automatic transliterators for them, e.g. "en-dsrt" or
"fr-brai" for French transliteration in Braille), and country variants,
(useful in localized data, even if they are no longer used for
translations, such as zh-cn, also useful for legacy codes).
We want to avoid matching subpagenames containing any uppercase letter,
(even if they are considered valid in BCP 47, in which they are
case-insensitive; they are not "SupportedLanguages" for MediaWiki, so
they are not "KnownLanguageTags" for MediaWiki).
To be more restrictive, we exclude tags
* for specific uses in template subpages and unusable as language tags;
* that is not ASCII and not a lowercase letter, minus-hyphen, or digit,
or does not start by a letter or does not finish by a letter or digit;
* or that has subtags with more than 8 characters between hyphens;
* or that has two hyphens.
--]]
or subpage ~= "doc"
and subpage ~= "layout"
and subpage ~= "button"
and subpage ~= "buttons"
and subpage ~= "sandbox"
and subpage ~= "testcase"
and subpage ~= "testcases"
and string.find(subpage, "^[%l][%-%d%l]*[%d%l]$") ~= nil
and string.find(subpage, "[%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l]") == nil
and string.find(subpage, "%-%-") == nil then
return subpage
end
-- Otherwise there's currently no known language subpage
return default
end
--[[Get the last subpage of an arbitrary page if it is a translation.
To be used from templates.
]]
function this.getLanguageSubpage(frame)
local title = frame and frame.args[1]
if not title or title == '' then
title = mw.title.getCurrentTitle()
end
return this._getLanguageSubpage(title)
end
--[[Get the last subpage of an arbitrary page if it is a translation.
To be used from Lua.
]]
function this._getLanguageSubpage(title)
if type(title) == 'string' then
title = mw.title.new(title)
end
if not title then
-- invalid title
return nil
end
--[[This code does not work in all namespaces where the Translate tool works.
-- It works in the main namespace on Meta because it allows subpages there
-- It would not work in the main namespace of English Wikipedia (but the
-- articles are monolignual on that wiki).
-- On Meta-Wiki the main space uses subpages and its pages are translated.
-- The Translate tool allows translatng pages in all namespaces, even if
-- the namespace officially does not have subpages.
-- On Meta-Wiki the Category namespace still does not have subpages enabled,
-- even if they would be very useful for categorizing templates, that DO have
-- subpages (for documentatio and tstboxes pages). This is a misconfiguration
-- bug of Meta-Wiki. The work-around is to split the full title and then
-- get the last titlepart.
local subpage = title.subpageText
--]]
local titleparts = mw.text.split(title.fullText, '/')
local subpage = titleparts[#titleparts]
return this.checkLanguage(subpage, '')
end
--[[Get the last subpage of the current page if it is a translation.
]]
function this.getCurrentLanguageSubpage()
return this._getLanguageSubpage(mw.title.getCurrentTitle())
end
--[[Get the first part of the language code of the subpage, before the '-'.
--]]
function this.getMainLanguageSubpage()
parts = mw.text.split(this.getCurrentLanguageSubpage(), '-')
return parts[1]
end
--[[Get the last subpage of the current frame if it is a translation.
Not used locally.
--]]
function this.getFrameLanguageSubpage(frame)
return this._getLanguageSubpage(frame:getParent():getTitle())
end
--[[Get the language of the current page. Not used locally.
--]]
function this.getLanguage()
local subpage = mw.title.getCurrentTitle().subpageText
return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())
end
--[[Get the language of the current frame. Not used locally.
--]]
function this.getFrameLanguage(frame)
local titleparts = mw.text.split(frame:getParent():getTitle(), '/')
local subpage = titleparts[#titleparts]
return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())
end
function this.title(namespace, basepagename, subpage)
local message, title
local pagename = basepagename
if (subpage or '') ~= '' then
pagename = pagename .. '/' .. subpage
end
local valid, title = xpcall(function()
return mw.title.new(pagename, namespace) -- costly
end, function(msg) -- catch undocumented exception (!?)
-- thrown when namespace does not exist. The doc still
-- says it should return a title, even in that case...
message = msg
end)
if valid and title ~= nil and (title.id or 0) ~= 0 then
return title
end
return { -- "pseudo" mw.title object with id = nil in case of error
prefixedText = pagename, -- the only property we need below
message = message -- only for debugging
}
end
--[[If on a translation subpage (like Foobar/de), this function returns
a given template in the same language, if the translation is available.
Otherwise, the template is returned in its default language, without
modification.
This is aimed at replacing the current implementation of Template:TNTN.
This version does not expand the returned template name: this solves the
problem of self-recursion in TNT when translatable templates need themselves
to transclude other translable templates (such as Tnavbar).
--]]
function this.getTranslatedTemplate(frame, withStatus)
local args = frame.args
local pagename = args['template']
--[[Check whether the pagename is actually in the Template namespace, or
if we're transcluding a main-namespace page.
(added for backward compatibility of Template:TNT)
]]
local namespace, title = args['tntns'] or ''
if namespace ~= '' then -- Checks for tntns parameter for custom ns.
title = this.title(namespace, pagename) -- Costly
else -- Supposes that set page is in ns10.
namespace = 'Template'
title = this.title(namespace, pagename) -- Costly
if title.id == nil then -- not found in the Template namespace, assume the main namespace (for backward compatibility)
namespace = ''
title = this.title(namespace, pagename) -- Costly
end
end
-- Get the last subpage and check if it matches a known language code.
local subpage = args['uselang'] or ''
if subpage == '' then
subpage = this.getCurrentLanguageSubpage()
end
if subpage == '' then
-- Check if a translation of the pagename exists in English
local newtitle = this.title(namespace, pagename, 'en') -- Costly
-- Use the translation when it exists
if newtitle.id ~= nil then
title = newtitle
end
else
-- Check if a translation of the pagename exists in that language
local newtitle = this.title(namespace, pagename, subpage) -- Costly
if newtitle.id == nil then
-- Check if a translation of the pagename exists in English
newtitle = this.title(namespace, pagename, 'en') -- Costly
end
-- Use the translation when it exists
if newtitle.id ~= nil then
title = newtitle
end
end
-- At this point the title should exist
if withStatus then
-- status returned to Lua function below
return title.prefixedText, title.id ~= nil
else
-- returned directly to MediaWiki
return title.prefixedText
end
end
--[[If on a translation subpage (like Foobar/de), this function renders
a given template in the same language, if the translation is available.
Otherwise, the template is rendered in its default language, without
modification.
This is aimed at replacing the current implementation of Template:TNT.
Note that translatable templates cannot transclude themselves other
translatable templates, as it will recurse on TNT. Use TNTN instead
to return only the effective template name to expand externally, with
template parameters also provided externally.
--]]
function this.renderTranslatedTemplate(frame)
local title, found = this.getTranslatedTemplate(frame, true)
-- At this point the title should exist prior to performing the expansion
-- of the template, otherwise render a red link to the missing page
-- (resolved in its assumed namespace). If we don't tet this here, a
-- script error would be thrown. Returning a red link is consistant with
-- MediaWiki behavior when attempting to transclude inexistant templates.
if not found then
return '[[' .. title .. ']]'
end
-- Copy args pseudo-table to a proper table so we can feed it to expandTemplate.
-- Then render the pagename.
local args = frame.args
local pargs = (frame:getParent() or {}).args
local arguments = {}
if (args['noshift'] or '') == '' then
for k, v in pairs(pargs) do
local n = tonumber(k) or 0
if n <= 0 then -- unnumbered args
arguments[k] = v
elseif n >= 2 then -- numbered args >= 2 need to be shifted
arguments[n - 1] = v
end
end
else -- special case where TNT is used as autotranslate
-- (don't shift again what is shifted in the invokation)
for k, v in pairs(pargs) do
arguments[k] = v
end
end
arguments['template'] = title -- override the existing parameter of the base template name supplied with the full name of the actual template expanded
arguments['tntns'] = nil -- discard the specified namespace override
arguments['uselang'] = args['uselang'] -- argument forwarded into parent frame
arguments['noshift'] = args['noshift'] -- argument forwarded into parent frame
return frame:expandTemplate{title = ':' .. title, args = arguments}
end
--[[A helper for mocking TNT in Special:TemplateSandbox. TNT breaks
TemplateSandbox; mocking it with this method means templates won't be
localized but at least TemplateSandbox substitutions will work properly.
Won't work with complex uses.
--]]
function this.mockTNT(frame)
local pargs = (frame:getParent() or {}).args
local arguments = {}
for k, v in pairs(pargs) do
local n = tonumber(k) or 0
if n <= 0 then -- unnumbered args
arguments[k] = v
elseif n >= 2 then -- numbered args >= 2 need to be shifted
arguments[n - 1] = v
end
end
if not pargs[1] then
return ''
end
return frame:expandTemplate{title = 'Template:' .. pargs[1], args = arguments}
end
return this
awvcrmp8lemwq049tlq1p4ae9mbphim
Templat:Translatable template name
10
1116
6454
2024-05-03T06:24:57Z
Hakimi97
9
Mencipta laman baru dengan kandungan '<includeonly>{{#invoke:Template translation{{{sandbox|}}}|getTranslatedTemplate|uselang={{{uselang|}}}|tntns={{{namespace|{{{tntns|}}}}}}|template={{#if:{{{noshift|}}}|{{{template}}}|{{{1}}}}}|noshift={{{noshift|}}}<!-- there are no other parameters here -->}}</includeonly><noinclude>{{documentation}}</noinclude>'
wikitext
text/x-wiki
<includeonly>{{#invoke:Template translation{{{sandbox|}}}|getTranslatedTemplate|uselang={{{uselang|}}}|tntns={{{namespace|{{{tntns|}}}}}}|template={{#if:{{{noshift|}}}|{{{template}}}|{{{1}}}}}|noshift={{{noshift|}}}<!-- there are no other parameters here -->}}</includeonly><noinclude>{{documentation}}</noinclude>
8p5a80y433n276tku1mnryzehacbs8u
Templat:TCT
10
1117
6455
2024-05-03T06:25:31Z
Hakimi97
9
Mencipta laman baru dengan kandungan '{{ {{Translatable template name|{{{1|{{{page}}}}}}/Content | uselang = {{{uselang|}}} }} |1={{{2|{{{key}}}}}} |v1={{{v1|}}} |v2={{{v2|}}} |v3={{{v3|}}} }}<noinclude>{{Documentation}}</noinclude>'
wikitext
text/x-wiki
{{ {{Translatable template name|{{{1|{{{page}}}}}}/Content | uselang = {{{uselang|}}} }} |1={{{2|{{{key}}}}}} |v1={{{v1|}}} |v2={{{v2|}}} |v3={{{v3|}}} }}<noinclude>{{Documentation}}</noinclude>
ktf7m8h20ozt7tn4i3ekbo3a2es863k
Modul:Proofreadpage index template
828
1118
6456
2024-05-03T07:04:00Z
Hakimi97
9
Mencipta laman baru dengan kandungan '--[=[ This is a module to implement logic for [[MediaWiki:Proofreadpage index template]] It doesn't do everything yet, but over time it can accrete functions from the template, which will become simpler and simpler until it's just an invoke. Implemented so far: * Status categorisation and field * Some auxiliary data fields ]=] local getArgs = require('Module:Arguments').getArgs local messageBox = require('Module:Message box') local ISO_639 = requi...'
Scribunto
text/plain
--[=[
This is a module to implement logic for [[MediaWiki:Proofreadpage index template]]
It doesn't do everything yet, but over time it can accrete functions from
the template, which will become simpler and simpler until it's just an invoke.
Implemented so far:
* Status categorisation and field
* Some auxiliary data fields
]=]
local getArgs = require('Module:Arguments').getArgs
local messageBox = require('Module:Message box')
local ISO_639 = require('Module:ISO 639')
local p = {} --p stands for package
local DEFAULTS = {
Source = '_empty_',
}
-- mapping of field ID to field properties
local headings = {
title = {
txt = 'Title',
},
progress = {
txt = 'Progress',
},
oclc = {
txt = 'OCLC',
},
transclusion = {
txt = 'Transclusion',
},
validation_date = {
txt = 'Validated in',
},
source = {
txt = 'Source'
},
place = {
txt = 'Location'
},
year = {
txt = 'Year'
},
publisher = {
txt = 'Publisher'
},
author = {
txt = 'Author'
},
editor = {
txt = 'Editor'
},
translator = {
txt = 'Translator'
},
illustrator = {
txt = 'Illustrator'
},
doi = {
txt = 'DOI'
},
volumes = {
txt = 'Volumes'
}
}
local indicators = {
pagegame = {
name = "WS Page Game",
image = "File:OOjs UI icon page number.svg",
link = "{{fullurl:toolforge:ws-page-game|wikisource=en&index={{PAGENAMEE}}&lang=en}}",
caption = "Wikisource Page Game (step-by-step pagelist builder)"
},
purge = {
name = "purge file",
image = "File:OOjs UI icon reload.svg",
link = "{{fullurl:commons:File:{{PAGENAME}}|action=purge}}",
caption = "Purge file"
},
book2scroll = {
name = "book2scroll",
image = "File:Library-logo-blue-outline.png",
link = "{{fullurl:toolforge:book2scroll|lang=en&file={{PAGENAMEE}}}}",
caption = "Open in Book2Scroll"
},
bookreader = {
name = "bookreader",
image = "File:BookReader-favicon.svg",
link = "{{fullurl:toolforge:bookreader/en/{{PAGENAMEE}}}}",
caption = "Open file in BookReader"
},
}
local function get_heading(id)
if headings[id] then
return headings[id]['txt']
end
error( "Can't find heading for ID: " .. id )
end
-- mapping from status code to category and status text
local index_status_data = {
T = {
cat = 'Index Validated',
txt = 'Done—All pages of the work proper are validated',
},
V = {
cat = 'Index Proofread',
txt = 'Proofread—All pages of the work proper are proofread, but not all are validated',
},
C = {
cat = 'Index Not-Proofread',
txt = 'To be proofread',
},
MS = {
cat = 'Index - Ready for Match and Split',
txt = 'Ready for Match and Split',
},
OCR = {
cat = 'Index - Text Layer Requested',
txt = 'Source file needs an OCR text layer',
},
L = {
cat = 'Index - File to fix',
txt = 'Source file must be fixed before proofreading',
error = true,
},
X = {
cat = 'Index - File to check',
txt = 'Create a pagelist for the source file before commencing proofreading (to verify file is correct)',
error = true
},
_default = {
cat = 'Index - Unknown progress',
txt = 'Unknown progress (template error)',
error = true,
}
}
-- construct a basic "field" row
local function construct_field(id, content)
if id == nil or content == nil then
return ''
end
local title = get_heading( id )
local s = ''
s = s .. mw.ustring.format('<tr id="ws-index-%s-row" class="ws-index-row">\n', id)
s = s .. mw.ustring.format('<th id="ws-index-%s-label" class="ws-index-label" scope="row">%s</th>\n', id, title)
s = s .. mw.ustring.format('<td id="ws-index-%s-value" class="ws-index-value">%s</td>\n', id, content)
s = s .. '</tr>\n'
return s
end
local function construct_link(url, text)
return '[' .. url .. ' ' .. text .. ']'
end
local function int_link(target, text)
return '[' .. '[' .. target .. '|' .. text .. ']]'
end
-- handy URL generators (remember to use mw.uri.encode on the bits you need to)
local url_gens = {
oclc = function(id)
return 'https://www.worldcat.org/oclc/' .. id
end,
ark = function(id)
return 'https://n2t.net/' .. mw.uri.encode(id)
end,
doi = function(id)
return 'https://doi.org/' .. id
end
}
-- construct a span which might be classed "error"
local function maybe_error_span(text, error)
local span = mw.html.create('span')
:wikitext(text)
if error then
span:addClass('error')
end
return span
end
-- Construct the Title field (includes Vol. after Title if present)
local function construct_title_field(id, title, volume)
local content = title or ""
if volume ~= nil and volume ~= "" then
content = content .. ", " .. volume
end
return construct_field(id, content)
end
-- construct the source field:
-- - if a file exists, link it
-- - else just the text
local function construct_source_field(source)
local value
local file = mw.title.new( mw.title.getCurrentTitle().text, 'File' )
if file.file.exists then
value = int_link( ':' .. file.fullText, source )
else
value = source
end
local out = construct_field( 'source', value )
return out
end
local function construct_location_field( loc )
return construct_field('place', loc)
end
-- construct the status (proofread/validated/...) field
local function construct_status_field(status)
local out = ''
local sd = index_status_data[status]
if not sd then
sd = index_status_data['_default']
end
out = out .. '[[Category:' .. sd['cat'] .. ']]'
local link_text = tostring(maybe_error_span(sd['txt'], sd['error']))
local catlink = '[[:Category:' .. sd['cat'] .. '|' .. link_text .. ']]'
out = out .. construct_field("progress", catlink)
return out
end
local transclusion_data = {
yes = {
cat = 'Fully transcluded',
text = 'Fully transcluded',
help = 'The work is fully transcluded, including front and end matter and images'
},
notimg = {
cat = 'Images not fully transcluded',
text = 'Images not fully transcluded',
help = 'The work is fully transcluded, but that some images are still missing or need improvement',
},
notadv = {
cat = 'Advertising not transcluded',
text = 'Advertising not transcluded',
help = 'The main body of the work is properly transcluded, though front- or end-matter advertising material is not'
},
held = {
cat = 'Transclusion on hold',
text = 'Transclusion on hold',
help = 'There is a problem with transcluding the work (which should be explained on the talk page)'
},
check = {
cat = 'Transclusion check required',
text = 'Transclusion check required',
help = ' The transclusion of the work is incomplete or needs checking'
},
no = {
cat = 'Index not transcluded',
text = 'Index not transcluded or unreviewed',
help = ' This work is not transcluded or has not been reviewed for transclusion'
}
}
local function construct_cat(cat)
return "[[Category:" .. cat .. "]]"
end
-- construct the transclusion status
local function construct_transclusion_status(status, date)
-- handle templates with no explicit status
if status == nil then
status = "no"
end
local td = transclusion_data[status]
if td == nil then
error("Unknown index status: " .. status)
end
local catlink = '[[:Category:' .. td['cat'] .. '|' .. td['text'] .. ']]'
local out = construct_field("transclusion", catlink)
out = out .. construct_cat( td['cat'])
return out
end
local function construct_validated_date(date)
local cat = 'Indexes validated in ' .. date
local indicator_text = 'Validated in ' .. date
local out = '[[Category:' .. cat .. ']]'
local catlink = '[[:Category:' .. cat .. '|' .. date .. ']]'
out = out .. construct_field("validation_date", catlink)
out = out .. '<indicator name="validated-index-date">[[File:Yes Check Circle.svg|15px|link=Category:' .. cat .. '|' .. indicator_text .. '|alt=Validated index page.]]</indicator>'
return out
end
local function getLanguageCat(l)
-- get the name or nil
local lang = ISO_639.language_name(l)
if lang then
return "Index pages of works originally in " .. lang
end
end
function p.fields(frame)
local args = getArgs(frame)
-- set any defaults
for k, v in pairs( DEFAULTS ) do
if args[ k ] == nil then
args[ k ] = DEFAULTS[ k ]
end
end
local s = ""
s = s .. construct_title_field('title', args['Title'], args['Volume'])
s = s .. construct_field('author', args['Author'])
s = s .. construct_field('translator', args['Translator'])
s = s .. construct_field('editor', args['Editor'])
s = s .. construct_field('illustrator', args['Illustrator'])
s = s .. construct_field('year', args['Year'])
s = s .. construct_field('publisher', args['Publisher'])
s = s .. construct_location_field(args['Address'])
s = s .. construct_source_field(args['Source'])
s = s .. construct_status_field(args['Progress'])
-- always do this, even if the arg is not set
s = s .. construct_transclusion_status(args["Transclusion"], args['Transclusion_date'])
if args["Validation_date"] then
s = s .. construct_validated_date(args["Validation_date"])
end
if args["OCLC"] then
local link = construct_link(url_gens['oclc'](args["OCLC"]), args['OCLC'])
s = s .. construct_field("oclc", link)
end
if args["DOI"] then
local link = construct_link(url_gens['doi'](args["DOI"]), args['DOI'])
s = s .. construct_field("doi", link)
end
s = s .. construct_field('volumes', args['Volumes'])
-- language categorisations
if args.Language then
local langs = mw.text.split( args.Language, ',%s?', false)
for _, lang in pairs(langs) do
local cat = getLanguageCat(lang)
if cat then
s = s .. construct_cat(cat)
else
s = s .. construct_cat('Index pages of works originally in an unknown language')
end
end
if #langs > 1 then
s = s .. construct_cat('Index pages of works originally in multiple languages')
end
end
return s
end
function p.talkremarks(frame)
return _talkremarks(frame)
end
local function _talkremarks(frame)
local talkTitle = mw.title.getCurrentTitle().talkPageTitle
local talkText = talkTitle.prefixedText
if talkTitle.exists then
local notes = frame:callParserFunction("#lsth", talkText, "Quick notes")
return frame:expandTemplate{
title = "Index talk remarks",
args = {
notes = "\n" .. notes
}
}
end
return ''
end
function p.indicators(frame)
return _indicators(frame)
end
local function _indicators(frame)
local s = ''
for k, v in pairs(indicators) do
local link = frame:preprocess(v.link)
local img = mw.ustring.format("[[%s|20px|link=%s|%s]]", v.image, link, v.caption)
s = s .. frame:extensionTag{
name = "indicator",
content = img,
args = {
name = v.name
}
}
end
return s
end
function p.cover(frame)
local args = getArgs(frame)
-- Workaround for pagelist preview that tries to parse this template
-- without any context and with missing parameters via the API.
if args['Image'] == nil then
return ""
end
-- If Image param is not a (page) number then this is an image-based
-- Index, so use the provided image as the cover image.
if tonumber(args['Image']) == nil then
local s = ""
if mw.ustring.find(args['Image'], '^%[%[') ~= nil then
-- It's a full image specification
s = s .. args['Image']
else
-- Assume it's a filename with or without File: prefix
local file = mw.ustring.gsub(args['Image'], "^[Ff]ile:", "")
s = s .. "[[" .. "File:" .. file .. "|250px|class=ws-cover]]"
end
-- Add a tracking category
s = s .. "[[" .. "Category:Image based indexes" .. "]]"
return s
end
-- Otherwise it's a DjVu/PDF-backed index, in which case we fetch the
-- cover image from a page in the (multipage) file.
local indexTitle = mw.title.getCurrentTitle()
local fileTitle = mw.title.makeTitle('File', indexTitle.text)
if not fileTitle.file.exists then
-- Our associated file doesn't exist so use a placeholder
local s = "[[File:Placeholder book.svg|250px|link="
s = s .. fileTitle.prefixedText .. "|class=ws-cover]]"
s = s .. "[[" .. "Category:Indexes with missing files" .. "]]"
return s
end
-- File exists and we have page number for the cover
local s = "[[" .. fileTitle.prefixedText .. "|250px"
s = s .. "|page=" .. tonumber(args['Image']) .. "|class=ws-cover]]"
return s
end
function p.remarks(frame)
local args = getArgs(frame)
if args['Remarks'] ~= nil and args['Remarks'] ~= "" then
return '<td id="ws-index-remarks">' .. args['Remarks'] .. '</td>'
else
return '<td id="ws-index-remarks-empty"></td>'
end
end
function p.sortkey(frame)
local args = getArgs(frame)
local sortkey = ""
if args['Key'] ~= nil and args['Key'] ~= "" then
sortkey = args['Key']
else
sortkey = mw.title.getCurrentTitle().text
end
return frame:preprocess{text = "{{" .. "DEFAULTSORT:" .. sortkey .. "}}"}
end
-- Wrapper to output .fields with containing html table element.
function p.metadata(frame)
local metadatatable = mw.html.create("table")
metadatatable:attr("id", "ws-index-metadata")
local rows = p.fields(frame)
metadatatable:node(rows)
return tostring(metadatatable)
end
--
-- NEW EXPERIMENTAL CODE BELOW THIS LINE --
--
local cfg = mw.loadData("Module:Proofreadpage index template/config")
local CATS = {
categories = {}
}
function CATS:addCat(cat)
table.insert(self.categories, cat)
end
function CATS:getCats()
local cats = ""
for _, cat in ipairs(self.categories) do
cats = cats .. "[[" .. "Category:" .. cat .. "]]"
end
return cats
end
function CATS:makeCatLink(cat, label)
if label ~= nil and label ~= "" then
return "[[:" .. "Category:" .. cat .. "|" .. label .. "]]"
end
return "[[:" .. "Category:" .. cat .. "]]"
end
-- construct a basic "field" row
local function __makeRow(id, content)
if id == nil or id == "" or content == nil then
return ''
end
local row = mw.html.create("tr")
row
:attr("id", "ws-index-" .. id .. "-row")
:addClass("ws-index-row")
:tag("th")
:attr("scope", "row")
:attr("id", "ws-index-" .. id .. "-label")
:addClass("ws-index-label")
:wikitext(cfg.headings[id].txt)
:done()
:tag("td")
:attr("id", "ws-index-" .. id .. "-value")
:addClass("ws-index-value")
:wikitext(content)
:allDone()
return tostring(row)
end
-- Create indicator markup based on config
--
-- Loads the config module and creates indicator extension tags after pattern
-- <indicator name="foo">[[File:Foo.png|20px|link=bar]]</indcator>
-- The link is preprocessed as wikitext so it can contain parser functions etc.
local function __getIndicators(frame)
local indicators = mw.loadData('Module:Proofreadpage index template/indicators')
local s = ''
for _, v in pairs(indicators) do
local link = frame:preprocess(v.link)
local img = mw.ustring.format("[[%s|20px|link=%s|%s]]", v.image, link, v.caption)
s = s .. frame:extensionTag{
name = "indicator",
content = img,
args = {
name = v.name
}
}
end
return s
end
-- Get talk page notice if present
--
-- If the talk page associated with the current page exists, we use Labelled
-- Section Transclusion to transclude the section titled "Quick notes" and if
-- the result contains any text, return a message box with its contents.
local function __getTalkNotice(frame)
local talkTitle = mw.title.getCurrentTitle().talkPageTitle
local talkText = talkTitle.prefixedText
if talkTitle.exists then
local notes = frame:callParserFunction("#lsth", talkText, "Quick notes")
local s = "Formatting guidelines specific to this work may have "
s = s .. "already been established. Please check "
s = s .. "[[" .. talkText .. "|the talk page]] for details."
local box = messageBox.main("ombox", {
type = "content",
text = s .. notes
})
return box
end
return ''
end
-- Get the image to use as the cover image for this index
--
-- If the Image parameter contains an integer it refers to a page in a DjVu/PDF
-- and can be used directly. Otherwise it may be a full image specification
-- that we can use directly, or just an image filename that we can construct
-- an image specification for.
local function __getCoverImage(args)
local s = ""
-- If Image param is not a (page) number then this is an image-based
-- Index, so use the provided image as the cover image.
if tonumber(args['Image']) == nil then
if mw.ustring.find(args['Image'], '^%[%[') ~= nil then
s = s .. args['Image'] -- It's a full image specification
else
-- Assume it's a filename with or without File: prefix
local file = mw.ustring.gsub(args['Image'], "^[Ff]ile:", "")
s = s .. "[[" .. "File:" .. file .. "|250px|class=ws-cover ws-index-cover]]"
end
-- Add a tracking category
CATS:addCat("Image based indexes")
return s
end
-- Otherwise it's a DjVu/PDF-backed index, in which case we fetch the
-- cover image from a page in the (multipage) file.
local indexTitle = mw.title.getCurrentTitle()
local fileTitle = mw.title.makeTitle('File', indexTitle.text)
if not fileTitle.file.exists then
-- Our associated file doesn't exist so use a placeholder
s = s .. "[[File:Placeholder book.svg|250px|link="
s = s .. fileTitle.prefixedText .. "|class=ws-cover ws-index-cover]]"
CATS:addCat("Indexes with missing files")
return s
end
-- File exists and we have page number for the cover
s = s .. "[[" .. fileTitle.prefixedText .. "|250px"
s = s .. "|page=" .. tonumber(args['Image']) .. "|class=ws-cover ws-index-cover]]"
return s
end
-- Get the pagelist provided by PRP
--
-- PRP furnished a finished rendered pagelist, so we just need to wrap it in a
-- suitable container, add a legend, etc.
local function __getPagelist(args)
-- Main container
local plcontainer = mw.html.create("div")
plcontainer
:addClass("ws-index-pagelist-container")
:addClass("mw-collapsible") -- make it collapsible
:tag("div") -- The heading/legend
:addClass("ws-index-pagelist-heading")
:wikitext("Pages")
:wikitext(" ") -- Force a space between heading and legend.
:tag("span")
:addClass("ws-index-pagelist-heading-legend")
:wikitext("(key to [[Help:Page Status|Page Status]])")
:done()
:done()
:tag("div") -- The pagelist itself
:addClass("ws-index-pagelist")
:addClass("index-pagelist") -- legacy support
:addClass("mw-collapsible-content") -- make it collapsible
:wikitext('\n' .. mw.text.trim(args["Pages"]) .. '\n')
return tostring(plcontainer)
end
-- Get the metadata fields.
local function __getMetadata(frame, args)
-- set any defaults
for key, _ in pairs(cfg.defaults) do
if args[key] == nil then
args[key] = cfg.defaults[key]
end
end
local s = ""
-- Construct the Title field (includes Vol. after Title if present)
local title = args['Title'] or ""
if args['Volume'] ~= nil and args['Volume'] ~= "" then
title = title .. ", " .. args['Volume']
end
s = s .. __makeRow('title', title)
s = s .. __makeRow('author', args['Author'])
s = s .. __makeRow('translator', args['Translator'])
s = s .. __makeRow('editor', args['Editor'])
s = s .. __makeRow('illustrator', args['Illustrator'])
s = s .. __makeRow('year', args['Year'])
s = s .. __makeRow('publisher', args['Publisher'])
s = s .. __makeRow('place', args['Address'])
local location = args["Source"]
local file = mw.title.new(mw.title.getCurrentTitle().text, 'File')
if file.exists then
location = "[[:" .. file.fullText .. "|" .. args["Source"] .. "]]"
end
s = s .. __makeRow('source', location)
local status = cfg.status[args['Progress']] or cfg.status['_default']
CATS:addCat(status.cat) -- Add this index to that cat
local linktext = mw.html.create('span'):wikitext(status.txt)
if status.error then
linktext:addClass('error')
end
local statuslink = CATS:makeCatLink(status.cat, tostring(linktext))
s = s .. __makeRow('progress', statuslink)
local transclusion = cfg.transclusion[args["Transclusion"] or "no"] -- always do this, even if the arg is not set
CATS:addCat(transclusion.cat)
local transclusionlink = CATS:makeCatLink(transclusion.cat, transclusion.txt)
s = s .. __makeRow("transclusion", transclusionlink)
if args["Validation_date"] then
local valcat = 'Indexes validated in ' .. args["Validation_date"]
local valtxt = 'Validated in ' .. args["Validation_date"]
CATS:addCat(valcat)
local valcatlink = CATS:makeCatLink(valcat, args["Validation_date"])
s = s .. __makeRow("validation_date", valcatlink)
s = s .. frame:extensionTag{ -- FIXME: need the frame here!
name = "indicator",
content = '[[File:Yes Check Circle.svg|15px|link=Category:' .. valcat .. '|' .. valtxt .. '|alt=Validated index page.]]',
args = {
name = "validated-index-date"
}
}
end
if args["OCLC"] then
local link = construct_link(url_gens['oclc'](args["OCLC"]), args['OCLC'])
s = s .. __makeRow("oclc", link)
end
if args["DOI"] then
local link = construct_link(url_gens['doi'](args["DOI"]), args['DOI'])
s = s .. __makeRow("doi", link)
end
s = s .. __makeRow('volumes', args['Volumes'])
-- language categorisations
if args["Language"] then
local langs = mw.text.split(args["Language"], ',%s?', false)
for _, lang in pairs(langs) do
local langcat = "Index pages of works originally in "
langcat = langcat .. ISO_639.language_name(lang) or "an unknown language"
CATS:addCat(langcat)
end
if #langs > 1 then
CATS:addCat('Index pages of works originally in multiple languages')
end
end
local metadatatable = mw.html.create("table")
:addClass("ws-index-metadata")
:wikitext(s)
return tostring(metadatatable)
end
local function __main(frame)
local args = getArgs(frame)
local s = "" -- Where we collect all the bits and bobs to return
-- The overall html structure in which each component is inserted
local indexcontainer = mw.html.create("div")
:addClass("ws-index-container")
if tonumber(args["tmplver"]) == 42 then
indexcontainer:addClass("ws-tng") -- Tag for "TNG" mode i asked for.
end
-- Get the indicators (NB! Needs access to the frame!)
s = s .. __getIndicators(frame)
-- Get talk page notice if present (NB! Needs access to the frame!)
s = s .. __getTalkNotice(frame)
-- Get the image to use as the cover image for this index
local cover = __getCoverImage(args)
indexcontainer:tag("div")
:addClass("ws-index-cover-container")
:wikitext(cover)
-- Get metadata table (NB! Needs access to the frame!)
local metadata = __getMetadata(frame, args)
indexcontainer:tag("div")
:addClass("ws-index-metadata-container")
:wikitext(metadata)
-- Get the pagelist for the index
local pagelist = __getPagelist(args)
indexcontainer:wikitext(pagelist)
-- Add the remarks field (toc)
local remarks = indexcontainer:tag("div")
:addClass("ws-index-remarks-container")
if args['Remarks'] == nil or args['Remarks'] == "" then
remarks:addClass("ws-index-remarks-empty")
end
remarks:wikitext(args['Remarks'])
-- Return the HTML structure and the accumulated categories.
return tostring(indexcontainer) .. CATS:getCats()
end
function p.main(frame)
local args = getArgs(frame)
local s = "" -- Where we collect all the bits and bobs to return
if args["tmplver"] ~= nil and args["tmplver"] ~= "" then
return __main(frame)
end
-- First, the talk remarks notes (nb! needs frame object!)
s = s .. _talkremarks(frame)
-- Then the indicators (nb! needs frame object!)
s = s .. _indicators(frame)
-- Construct the table
local outertable = mw.html.create("table")
outertable:attr("id", "ws-index-container")
local outertr = outertable:tag("tr")
local maincell = outertr:tag("td")
maincell:attr("id", "ws-index-main-cell")
local maintable = maincell:tag("table")
maintable:attr("id", "ws-index-main-table")
local firstrow = maintable:tag("tr")
local maincell = firstrow:tag("td")
local coverdiv = maincell:tag("div")
coverdiv:attr("id", "ws-index-cover-container")
coverdiv:wikitext(p.cover(frame))
maincell:wikitext(p.metadata(frame))
local secondrow = maintable:tag("tr")
local plcell = secondrow:tag("td")
local pldiv = plcell:tag("div")
pldiv:attr("id", "ws-index-pagelist-container")
pldiv:addClass("mw-collapsible")
pldiv:wikitext('<em>Pages</em> <span id="ws-index-pagelist-legend">(key to [[Help:Page Status{{!}}Page Status]])</span>')
local plinner = pldiv:tag("div")
plinner:attr("id", "ws-index-pagelist")
plinner:addClass("index-pagelist mw-collapsible-content")
plinner:wikitext('\n' .. mw.text.trim(args["Pages"]) .. '\n')
outertr:wikitext(p.remarks(frame))
s = s .. tostring(outertable)
s = s .. p.sortkey(frame)
return s
end
return p
efn92g1stzrysutrw9c7xlcdgkcwe3q
Modul:Proofreadpage index template/styles.css
828
1119
6457
2024-05-03T07:09:06Z
Hakimi97
9
Mencipta laman baru dengan kandungan '/* Styles for Index: namespace pages */ #ws-index-container { display: table; border-spacing: 1px 1px; box-sizing: border-box; width: 100%; } #ws-index-main-cell { padding: 0; vertical-align: top; } #ws-index-main-table { display: inline-table; border-collapse: collapse; border-spacing: 0 0; box-sizing: border-box; width: 100%; } #ws-index-cover-container { float: left; margin: .5em .25em .5em 0; } #ws-index-metadata { border-collaps...'
sanitized-css
text/css
/* Styles for Index: namespace pages */
#ws-index-container {
display: table;
border-spacing: 1px 1px;
box-sizing: border-box;
width: 100%;
}
#ws-index-main-cell {
padding: 0;
vertical-align: top;
}
#ws-index-main-table {
display: inline-table;
border-collapse: collapse;
border-spacing: 0 0;
box-sizing: border-box;
width: 100%;
}
#ws-index-cover-container {
float: left;
margin: .5em .25em .5em 0;
}
#ws-index-metadata {
border-collapse: separate;
border-spacing: 2px 2px;
box-sizing: border-box;
empty-cells: show;
}
.ws-index-label {
padding-right: .5em;
text-align: right;
vertical-align: top;
}
.ws-index-value {
vertical-align: top;
}
#ws-index-pagelist-container {
margin-right: .75em;
}
#ws-index-pagelist {
text-align: justify;
}
#ws-index-pagelist-container em {
font-weight: bold;
font-style: normal;
}
#ws-index-pagelist-legend {
font-size: 83%;
white-space: nowrap;
}
#ws-index-remarks {
padding: 0 .25em;
vertical-align: top;
width: 30%;
}
#ws-index-remarks-empty {
display: none;
padding: 0;
vertical-align: top;
}
/* Experimental new-style index markup below this line. */
/*
* Normal index styling mimicing the old layout.
*/
/* The main container */
.ws-index-container {
display: grid;
box-sizing: border-box;
max-width: 100%;
grid-template-areas:
"cover metadata remarks"
"pagelist pagelist remarks"
". . remarks";
grid-template-columns: 250px 1fr 30%;
grid-gap: 1em;
}
.ws-index-cover-container {
grid-area: cover;
}
.ws-index-metadata-container {
grid-area: metadata;
}
.ws-index-pagelist-container {
grid-area: pagelist;
}
.ws-index-pagelist-heading {
padding-bottom: .5em;
white-space: pre-wrap;
font-weight: bold;
}
.ws-index-pagelist-heading-legend {
font-size: 83%;
font-weight: normal;
}
.ws-index-remarks-container {
grid-area: remarks;
}
/*
* Demo index styling demonstrating some possibilities.
*/
/* The main container */
.ws-tng.ws-index-container {
display: grid;
box-sizing: border-box;
max-width: 100%;
grid-template-areas:
"cover"
"metadata"
"pagelist"
"remarks";
grid-template-columns: 100%;
grid-gap: 1em;
background: #fafafa;
}
.ws-tng .ws-index-cover-container {
grid-area: cover;
}
.ws-tng .ws-index-metadata-container {
grid-area: metadata;
}
.ws-tng .ws-index-metadata {
width: 100%;
}
.ws-tng .ws-index-pagelist-container {
grid-area: pagelist;
}
.ws-tng .ws-index-pagelist-heading {
padding-bottom: .5em;
white-space: pre-wrap;
font-weight: bold;
}
.ws-tng .ws-index-pagelist-heading-legend {
font-size: 83%;
font-weight: normal;
}
.ws-tng .ws-index-remarks-container {
grid-area: remarks;
background: white;
}
@media (min-width: 700px) {
.ws-tng.ws-index-container {
grid-template-areas:
"metadata cover"
"pagelist pagelist"
"remarks remarks";
grid-template-columns: 1fr fit-content(250px);
grid-gap: 2em;
}
}
@media (min-width: 1000px) {
.ws-tng.ws-index-container {
grid-template-areas:
"metadata cover remarks"
"pagelist pagelist remarks"
". . remarks";
grid-template-columns: 1fr fit-content(250px) fit-content(30%);
grid-gap: 3em;
/* box-shadow: rgba(50, 50, 93, 0.25) 0 6px 12px -2px, rgba(0, 0, 0, 0.3) 0 3px 7px -3px; */
/* filter: drop-shadow(0.6rem 0.6rem 1rem rgba(20, 20, 180, 0.8)); */
padding: 6em;
background-image: url(//upload.wikimedia.org/wikipedia/commons/e/eb/Pinckney_Marcius-Simons%2C_endleaf_1_verso--endleaf_2_recto%2C_extra-illustrated_copy_of_A_Midsummer_Night%27s_Dream.png);
background-origin: border-box;
background-size: 100% 100%;
}
.ws-tng .ws-index-remarks-container {
box-shadow: inset rgba(50, 50, 93, 0.25) 0 10px 10px -5px;
background-color: white;
padding: .5em;
}
.ws-tng .ws-index-pagelist-container {
background-color: rgba(255, 255, 255, 0.9);
}
.ws-tng .ws-index-metadata {
/* background-image:
linear-gradient(180deg, white 3rem, #F0A4A4 calc(3rem), #F0A4A4 calc(3rem + 2px), transparent 1px),
repeating-linear-gradient(0deg, transparent, transparent 1.5rem, #DDD 1px, #DDD calc(1.5rem + 1px)); */
/* box-shadow: 1px 1px 3px rgba(0, 0, 0, .25); */
border-collapse: collapse;
}
.ws-tng .ws-index-row {
border-bottom: 1px solid #DDD;
}
.ws-tng .ws-index-row:first-child {
border-bottom: 2px solid #F0A4A4;
}
.ws-tng .ws-index-metadata-container {
height: fit-content(250px);
width: fit-content(400px);
justify-self: center;
align-self: center;
box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);
background: white;
}
.ws-tng .ws-index-cover-container {
width: 300px;
}
.ws-tng .ws-index-cover-container img {
margin: 0 auto;
filter: drop-shadow(10px 10px 5px #000);
}
}
jit8viu70aizfk1042nsf53vme9m71t