Jump to content
Main menu
Main menu
move to sidebar
hide
Demo tour
Main page
Museum collection
ACME Inc
Research catalog
People and life events
Features
Subjects on a page
Schemas
Subject views
RDF and ontology mappings
SPARQL queries
Developers hub
About NeoWiki
NeoWiki website
Issue tracker
This wiki
Recent changes
NeoWiki Demo
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
View source for Module:NeoWikiDemo
Module
Discussion
English
Read
View source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
View source
View history
General
What links here
Related changes
Special pages
Page information
RedHerb
Find a subject
Appearance
move to sidebar
hide
←
Module:NeoWikiDemo
local p = {} local nw = require( 'mw.neowiki' ) function p.value( frame ) local property = frame.args[1] local page = frame.args['page'] local options = nil if page then options = { page = page } end local v = nw.getValue( property, options ) return tostring( v or '' ) end function p.values( frame ) local property = frame.args[1] local page = frame.args['page'] local separator = frame.args['separator'] or ', ' local options = nil if page then options = { page = page } end local all = nw.getAll( property, options ) if not all then return '' end local parts = {} for _, item in ipairs( all ) do parts[#parts + 1] = tostring( item ) end return table.concat( parts, separator ) end function p.subject( frame ) local page = frame.args[1] local s = nw.getMainSubject( page ) if not s then return 'No subject found' end local rows = {} rows[#rows + 1] = '{| class="wikitable"' rows[#rows + 1] = '! Property !! Type !! Value(s)' for name, stmt in pairs( s.statements ) do local vals = {} for _, v in ipairs( stmt.values ) do if type( v ) == 'table' then vals[#vals + 1] = v.label or v.target or tostring( v ) else vals[#vals + 1] = tostring( v ) end end rows[#rows + 1] = '|-' rows[#rows + 1] = '| ' .. name .. ' || ' .. stmt.type .. ' || ' .. table.concat( vals, ', ' ) end rows[#rows + 1] = '|}' return table.concat( rows, '\n' ) end function p.children( frame ) local page = frame.args[1] local children = nw.getChildSubjects( page ) if not children or #children == 0 then return 'No child subjects' end local parts = {} for _, child in ipairs( children ) do parts[#parts + 1] = "'''" .. child.label .. "''' (" .. child.schema .. ")" end return table.concat( parts, ', ' ) end return p
Template used on this page:
Module:NeoWikiDemo/doc
(
view source
)
Return to
Module:NeoWikiDemo
.