Module:EzTumblr: Difference between revisions

From MTG Wiki
Jump to navigation Jump to search
>Corveroth
(Let's see if we can't make this easier)
 
>Corveroth
No edit summary
Line 15: Line 15:


-- Match the bit between the double-slash and the first period in the given URL
-- Match the bit between the double-slash and the first period in the given URL
function Ez.getAuthor(tumblrAddress)
function Ez.getAuthor(frame)
  local tumblrAddress = frame.args[1]
   local subdomain = tumblrAddress:match("^%w+://([^%.]+)")
   local subdomain = tumblrAddress:match("^%w+://([^%.]+)")
   return tumblrs[subdomain].author
   return tumblrs[subdomain].author
end
end


function Ez.getTitle(tumblrAddress)
function Ez.getTitle(frame)
  local tumblrAddress = frame.args[1]
   local subdomain = tumblrAddress:match("^%w+://([^%.]+)")
   local subdomain = tumblrAddress:match("^%w+://([^%.]+)")
   return tumblrs[subdomain].title
   return tumblrs[subdomain].title

Revision as of 04:21, 28 June 2017

This is a module documentation subpage for Module:EzTumblr.
It contains usage information, categories, interlanguage links and other content that is not part of the original module page.

This module stores information about commonly referenced Tumblr accounts, and retrieves that information when provided a URL from a known Tumblr account.

You should not need to use this module directly. {{EzTumblr}} uses this module to simplify {{TumblrRef}}.

If you find that you are often referencing a Tumblr not known by this module, feel free to edit the table at the top. Please be careful to match the syntax used.


local Ez = {}

-- Editors: make sure to carefully copy syntax, including the comma at the end of any new entry
local tumblrs = {
  -- WotC staff
  ["blogatog"] = { author = "Mark Rosewater", title = "Blogatog" },
  ["dougbeyermtg"] = { author = "Doug Beyer", title = "A Voice for Vorthos" },
  ["tabakrules"] = { author = "Matt Tabak", title = "Snarkham Asylum" },
  ["wizardsmagic"] = { author = "WotCStaff", title = "The Official Magic: The Gathering Tumblr" },

  -- Other notable MtG tumblrs
  ["vorthosjay"] = { author = "Jay Annelli", title = "Archive Trap Mini" },

}

-- Match the bit between the double-slash and the first period in the given URL
function Ez.getAuthor(frame)
  local tumblrAddress = frame.args[1]
  local subdomain = tumblrAddress:match("^%w+://([^%.]+)")
  return tumblrs[subdomain].author
end

function Ez.getTitle(frame)
  local tumblrAddress = frame.args[1]
  local subdomain = tumblrAddress:match("^%w+://([^%.]+)")
  return tumblrs[subdomain].title
end

return Ez