Vorlagenprogrammierung | Diskussionen | Lua | Unterseiten | |||
Modul | Deutsch | English
|
Modul: | Dokumentation |
JSTOR
– Module for generation of formatted external links to resources in JSTOR system.
Functions for templates
Bearbeiten- f
- Format resource link
- Parameters from template transclusion; all optional (but need to result in an identifier):
- 1
- Identifier: article ID, ISSN etc.
- mandatory
- show
- Link title
- default: generated from ID
- suite
- Archive type
stable
– stable article ID (default)journals
– ISSN
- demo
1
– suppress all hiding of error messages, e.g. in context of documentations; also do not issue any maintenance category.
- Parameters with
#invoke
for project specific adaption; all optional:- errCat
- Title of a maintenance category on invalid parameter value etc.
- errClasses
- Classes, to be assigned to error messages, like
error
- errHide
1
– hide error messages by default- errNS
- Space separated list of namespace numbers where to use errCat
- default: all pages, all namespaces, if errCat defined
- showArticle
- Page name for
JSTOR
explanation link target – default:JSTOR
- empty value: do not link explanation
- Returns: links and perhaps error messages with
class="error"
. - failsafe
- Version management
The Failsafe interface is heading for version management of globally distributed Lua modules. It enables modules equipped with this interface to
- ensure, that a library module required by a template or another module available as local copy does support certain functionality, or complain if not.
- administrate global updating and linking of module codes via Wikidata.
The Failsafe interface is present both at template level and for direct Lua access.
The functions in detail are (not all supported yet completely by every library):
Value | Result | current |
---|---|---|
nothingfalse
|
local version ID | »2024-09-22« |
Minimal version | version ID required at least date in ISO format It will be compared whether the current local implementation matches this version or later.
|
|
wikidata
|
version ID of global upstream
|
»2024-09-22« |
item
|
ID of the Wikidata item
|
Q71782977
|
~
|
Corresponding version ID locally and registered at Wikidata
|
»« |
@
|
Is the current (module) page linked correctly with Wikidata item?
|
|
The return value is in template programming empty or under Lua false , otherwis a non-empty string as described.
|
Functions for Lua modules (API)
BearbeitenSome of the functions as dokumented above can be used by other modules per require()
:
local lucky, JSTOR = pcall( require, "Module:JSTOR" )
if type( JSTOR ) == "table" then
JSTOR = JSTOR()
else
-- failure; JSTOR is the error message
return "<span class=\"error\">" .. JSTOR .. "</span>"
end
Then there is available:
- JSTOR.feasible( article, area, auxilary )
- Check code, normalize
- article
string, with JSTOR ID - area
string, with with"stable"
,"journals"
, orfalse
- auxilary
table, URIutil library, orfalse
- article
- Returns: string with improved ID, or
false
- JSTOR.format( article, area, appear, auxilary )
- Analyze code, create URL, format like f
- article
string, with JSTOR ID - area
string, with with"stable"
,"journals"
, orfalse
- appear
string, with link title, orfalse
- auxilary
table, URIutil library, orfalse
- article
- Returns: string with links and error messages
- JSTOR.failsafe( atleast )
- Version management
- Returns: string oder
false
If the interface is not initialized, one more function might be used:
- p.main( argsF, argsT )
- Invocation
- argsF
table, with #invoke parameters, orfalse
- argsT
table, with template parameters, orfalse
- argsF
- Returns: string with formatting etc.