Wikipedia:Lua/Modul/JSTOR/en
| 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
- 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
#invokefor 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
JSTORexplanation 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)
Some 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.
Dependencies
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.