Editing
Module:Test processing of plainlist table
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} --p stands for package --set up plainlist table as if it had been generated within this module from plainlist input query_table = {} query_table["Source:Source n39"] = {["Newspaper Item Number"] = "n39", ["Newspaper Title"] = "St. Helena Star", ["Newspaper Page"] = "2", ["Newspaper Column"] = "4", ["Publication Date"] = "1894-10-05", ["Newspaper Full Text"] = "Miss Nellie Boston of Livermore spent several days in St. Helena the first of the week the guest of Mrs. W. F. Mixon. Miss Boston attended school in St. Helena for several months five years ago, making her home with Mr. and Mrs. J. H. Dungan. She is now a teacher in the Livermore public school.", ["Newspaper Excerpt"] = "\"\"", ["Newspaper Summary"] = "\"\"", ["Newspaper Online Source"] = "https://www.newspapers.com/article/the-st-helena-star/181533425/"} query_table["Source:Source 49"] = {["Newspaper Item Number"] = "n49", ["Newspaper Title"] = "Woodland Daily Democrat", ["Newspaper Page"] = "3", ["Newspaper Column"] = "6", ["Publication Date"] = "1896-06-30", ["Newspaper Full Text"] = "Miss Nellie Boston, of Livermore, is the guest of her aunt, Mrs. J. H. Dungan.", ["Newspaper Online Source"] = "https://www.newspapers.com/article/woodland-daily-democrat/181534143/"} query_table["Source:Source n475"] = {["Newspaper Item Number"] = "n475", ["Newspaper Title"] = "Oakland Tribune", ["Newspaper Page"] = "12", ["Newspaper Column"] = "4", ["Publication Date"] = "1902-10-25", ["Newspaper Excerpt"] = "The Haywards Public School has been greatly overcrowded this term and the condition was not relieved until recently, when a number of pupils from each room were placed in another room, and an extra teacher employed. The new class has been installed in the laboratory, with Miss N. Boston of Livermore, as teacher.", ["Newspaper Online Source"] = "https://www.newspapers.com/article/oakland-tribune/182504599/"} query_table["Source:Source n14"] = {["Newspaper Item Number"] = "n14", ["Newspaper Title"] = "Genoa Weekly Courier", ["Newspaper Page"] = "3", ["Newspaper Column"] = "3", ["Publication Date"] = "1886-05-21", ["Newspaper Summary"] = "List of students at Mottsville school who passed their yearly examination. Nellie Boston is in 1st Division. She also received the prize for excellent spelling.", ["Newspaper Online Source"] = "https://douglascounty.advantage-preservation.com/viewer/?i=f&d=01011875-12312023&e=nellie%20boston&m=between&ord=e1&fn=genoa_weekly_courier_usa_nevada_genoa_18860521_english_3&df=1&dt=10"} --[[Many of the property names, e.g. "Newspaper Item Number" are not valid field names because they contain spaces. So the bracket and quote notation has to be used in the table constructors. Note that the query result has interpreted "" in the property field as two quotation marks (two characters), not an empty string.]] property_names = {"Newspaper Item Number", "Newspaper Title", "Newspaper Page", "Newspaper Column", "Publication Date", "Newspaper Full Text", "Newspaper Excerpt", "Newspaper Summary","Newspaper Online Source"} function p.process_plainlist( frame ) for source_item, properties_table in pairs(query_table) do row1 = frame:expandTemplate{ title = 'cited item citation row', args = {newspaper_title = properties_table["Newspaper Title"], publication_date = properties_table["Publication Date"], newspaper_page = properties_table["Newspaper Page"], newspaper_column = properties_table["Newspaper Column"]} } row2 = frame:expandTemplate{ title = 'cited item property row', args = {property = 'Item Number', value = properties_table["Newspaper Item Number"]} } if properties_table["Newspaper Full Text"] ~= nil then row3 = frame:expandTemplate{ title = 'cited item property row', args = {property = 'Full Text', value = properties_table["Newspaper Full Text"]} } else row3 = "" end if properties_table["Newspaper Summary"] ~= nil then row4 = frame:expandTemplate{ title = 'cited item property row', args = {property = 'Summary', value = properties_table["Newspaper Summary"]} } else row4 = "" end if properties_table["Newspaper Excerpt"] ~= nil then row5 = frame:expandTemplate{ title = 'cited item property row', args = {property = 'Excerpt', value = properties_table["Newspaper Excerpt"]} } else row5 = "" end row6 = frame:expandTemplate{ title = 'cited item property row', args = {property = 'Source', value = properties_table["Newspaper Online Source"]} } end --[[ local properties_table = query_table["Source:Source n39"] local frame_expanded = frame:expandTemplate{ title = 'cited item citation row', args = {newspaper_title = properties_table["Newspaper Title"], publication_date = properties_table["Publication Date"], newspaper_page = properties_table["Newspaper Page"], newspaper_column = properties_table["Newspaper Column"]} } ]] return "<ul>" .. row1 .. row2 .. row3 .. row4 .. row5 .. row6 .. "</ul>" end return p
Summary:
Please note that all contributions to Livermore History Collaborative may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Livermore History Collaborative:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Test processing of plainlist table/doc
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Module
Discussion
English
Views
Read
Edit source
View history
More
Refresh
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Tools
What links here
Related changes
Page information