Module:SOM.File.Public Record
From SunshinePPS Wiki
Documentation for this module may be created at Module:SOM.File.Public Record/doc
require("Module:No globals")
local File = require("Module:SOM.meta.File")
local StringBuffer = require("Module:SOM.util.StringBuffer")
local util = require("Module:SOM.util")
local FreeWikitext = require("Module:SOM.Simple.FreeWikitext")
local HasMediaLicense = require("Module:SOM.Simple.HasMediaLicense")
local HasRetrievedTimestamp = require("Module:SOM.Simple.HasRetrievedTimestamp")
local HasSourceOrganization = require("Module:SOM.Simple.HasSourceOrganization")
local HasSourceUrl = require("Module:SOM.Simple.HasSourceUrl")
local HasArchivedSourceUrl = require("Module:SOM.Simple.HasArchivedSourceUrl")
return File.generate{
class_name = "Public Record",
parent_categories = {},
category_description = [==[
A ''Public Record'' is a document/file produced by a public body and made available
to the public via public records statutes or practices.
]==],
attributes = {
license = {
arg = "license",
class = HasMediaLicense,
label = "License",
},
timestamp = {
arg = "timestamp",
class = HasRetrievedTimestamp,
label = "Retrieved Timestamp",
},
source_organization = {
arg = "source_organization",
class = HasSourceOrganization,
label = "Source Organization",
},
source_url = {
arg = "source_url",
class = HasSourceUrl,
label = "Source URL",
},
archived_source_url = {
arg = "archived_source_url",
class = HasArchivedSourceUrl,
label = "Archived Source URL",
},
free_text = {
arg = "free_text",
class = FreeWikitext,
label = "Article Text"
},
},
form_layout = {
{ section2 = "Source" },
{ table = {
{ attribute = "source_organization" },
{ attribute = "source_url" },
{ attribute = "license" },
{ attribute = "timestamp" },
{ attribute = "archived_source_url" },
}
},
{ section2 = "Article Text" },
{ attribute = "free_text" },
},
page_layout = {
---- { wikitext = "" },
{ attribute = "free_text" },
{ section2 = "Source" },
{ renderer = function (data, buffer)
buffer
:add_uformat(
"* %s",
util.show_nil_as_missing(util.show_url_as_external_link(data["source_url"]))):nl()
:add_uformat(
"* Published by %s under license %s",
util.show_nil_as_missing(util.show_as_link(data["source_organization"])),
util.show_nil_as_missing(util.show_as_link(data["license"]))):nl()
:add_uformat("* Retrieved %s", util.show_nil_as_missing(data["timestamp"])):nl()
-- TODO(maddog) Do something nicer for missing archive URL, than 'missing'.
:add_uformat(
"* Archived at %s",
util.show_nil_as_missing(util.show_url_as_external_link(data["archived_source_url"]))):nl()
:nl()
end },
}
}