Jump to content

Module:Folger Shakespeare/configuration

From Wikipedia, the free encyclopedia

-- This module's function lookup table, used by the calling context
local folger_config = {};

-- printf()-like format string for the Folger play URLs.
local url_pattern = 'http://www.folgerdigitaltexts.org/?chapter=5&play=%s&loc=%s'

-- printf()-like format string for the act, scene, line display.
local location_format = '[%s %s.%s.%s].'

-- printf()-like format string for the FTLN display.
local ftln_format = '<abbr title="Folger Through-Line Number">ftln</abbr> [%s %s].'


-- TODO: Need some way to specify things like Prologue, Epilogue, Scene Direction, etc.


-- Aliases by which plays can be specified in the wrapping template.
-- Every entry is (and must be) an associative array because we loop over it
-- later in order to extract the aliases. The key is the play code from Folger.
local _aliases = {
  ['AWW'] = {'All\'s Well That Ends Well'},
  ['Ant'] = {'Antony and Cleopatra'},
  ['AYL'] = {'As You Like It'},
  ['Err'] = {'The Comedy of Errors'},
  ['Cor'] = {'Coriolanus'},
  ['Cym'] = {'Cymbeline'},
  ['Ham'] = {'Hamlet'},
  ['1H4'] = {'Henry IV, Part 1', '1H4'},
  ['2H4'] = {'Henry IV, Part 2', '2H4'},
  ['H5']  = {'Henry V', 'H5'},
  ['1H6'] = {'Henry VI, Part 1', '1H6'},
  ['2H6'] = {'Henry VI, Part 2', '2H6'},
  ['3H6'] = {'Henry VI, Part 3', '3H6'},
  ['H8']  = {'Henry VIII', 'H8'},
  ['JC']  = {'Julius Caesar'},
  ['Jn']  = {'King John'},
  ['Lr']  = {'King Lear'},
  ['LLL'] = {'Love\'s Labour\'s Lost'},
  ['Mac'] = {'Macbeth'},
  ['MM']  = {'Measure for Measure'},
  ['MV']  = {'The Merchant of Venice'},
  ['Wiv'] = {'The Merry Wives of Windsor'},
  ['MND'] = {'A Midsummer Night\'s Dream'},
  ['Ado'] = {'Much Ado About Nothing'},
  ['Oth'] = {'Othello'},
  ['Per'] = {'Pericles'},
  ['R2']  = {'Richard II', 'R2'},
  ['R3']  = {'Richard III', 'R3'},
  ['Rom'] = {'Romeo and Juliet', 'RJ', 'R&J'},
  ['Shr'] = {'The Taming of the Shrew'},
  ['Tmp'] = {'The Tempest'},
  ['Tim'] = {'Timon of Athens'},
  ['Tit'] = {'Titus Andronicus'},
  ['Tro'] = {'Troilus and Cressida'},
  ['TN']  = {'Twelfth Night'},
  ['TGV'] = {'Two Gentlemen of Verona'},
  ['TNK'] = {'Two Noble Kinsmen'},
  ['WT']  = {'The Winter\'s Tale'},
}

-- Turn the table inside out, so looking up an alias will return the play code.
local aliases = {}
for play_id, alias_list in pairs(_aliases) do
  for iterator, alias in ipairs(alias_list) do
    aliases[alias] = play_id
  end
end


-- Canonical names and Wikipedia article name for plays for display in output.
-- A map from Folger play code to a canonical name for in-article display.
-- All aliases are mapped to play code above, and here we map back to the
-- canonical name and Wikipedia article about that play.
local names = {
  ['AWW'] = {title = 'All\'s Well That Ends Well', article = 'All\'s Well That Ends Well'},
  ['Ant'] = {title = 'Antony and Cleopatra', article = 'Antony and Cleopatra'},
  ['AYL'] = {title = 'As You Like It', article = 'As You Like It'},
  ['Err'] = {title = 'The Comedy of Errors', article = 'The Comedy of Errors'},
  ['Cor'] = {title = 'Coriolanus', article = 'Coriolanus'},
  ['Cym'] = {title = 'Cymbeline', article = 'Cymbeline'},
  ['Ham'] = {title = 'Hamlet', article = 'Hamlet'},
  ['1H4'] = {title = 'Henry IV, Part 1', article = 'Henry IV, Part 1'},
  ['2H4'] = {title = 'Henry IV, Part 2', article = 'Henry IV, Part 2'},
  ['H5']  = {title = 'Henry V', article = 'Henry V (play)'},
  ['1H6'] = {title = 'Henry VI, Part 1', article = 'Henry VI, Part 1'},
  ['2H6'] = {title = 'Henry VI, Part 2', article = 'Henry VI, Part 2'},
  ['3H6'] = {title = 'Henry VI, Part 3', article = 'Henry VI, Part 3'},
  ['H8']  = {title = 'Henry VIII', article = 'Henry VIII (play)'},
  ['JC']  = {title = 'Julius Caesar', article = 'Julius Caesar (play)'},
  ['Jn']  = {title = 'King John', article = 'King John (play)'},
  ['Lr']  = {title = 'King Lear', article = 'King Lear'},
  ['LLL'] = {title = 'Love\'s Labor\'s Lost', article = 'Love\'s Labor\'s Lost'},
  ['Mac'] = {title = 'Macbeth', article = 'Macbeth'},
  ['MM']  = {title = 'Measure for Measure', article = 'Measure for Measure'},
  ['MV']  = {title = 'The Merchant of Venice', article = 'The Merchant of Venice'},
  ['Wiv'] = {title = 'The Merry Wives of Windsor', article = 'The Merry Wives of Windsor'},
  ['MND'] = {title = 'A Midsummer Night\'s Dream', article = 'A Midsummer Night\'s Dream'},
  ['Ado'] = {title = 'Much Ado About Nothing', article = 'Much Ado About Nothing'},
  ['Oth'] = {title = 'Othello', article = 'Othello'},
  ['Per'] = {title = 'Pericles', article = 'Pericles, Prince of Tyre'},
  ['R2']  = {title = 'Richard II', article = 'Richard II (play)'},
  ['R3']  = {title = 'Richard III', article = 'Richard III (play)'},
  ['Rom'] = {title = 'Romeo and Juliet', article = 'Romeo and Juliet'},
  ['Shr'] = {title = 'The Taming of the Shrew', article = 'The Taming of the Shrew'},
  ['Tmp'] = {title = 'The Tempest', article = 'The Tempest'},
  ['Tim'] = {title = 'Timon of Athens', article = 'Timon of Athens'},
  ['Tit'] = {title = 'Titus Andronicus', article = 'Titus Andronicus'},
  ['Tro'] = {title = 'Troilus and Cressida', article = 'Troilus and Cressida'},
  ['TN']  = {title = 'Twelfth Night', article = 'Twelfth Night'},
  ['TGV'] = {title = 'The Two Gentlemen of Verona', article = 'The Two Gentlemen of Verona'},
  ['TNK'] = {title = 'The Two Noble Kinsmen', article = 'The Two Noble Kinsmen'},
  ['WT']  = {title = 'The Winter\'s Tale', article = 'The Winter\'s Tale'},
}


return {
  aliases = aliases,
  names = names,
  url_pattern = url_pattern,
  location_format = location_format,
  ftln_format = ftln_format,
}