2007 Pittsburgh Pirates season

2007 Pittsburgh Pirates season

2007 Pittsburgh Pirates
Major League affiliations
Location
Results
Record 68–94 (.420)
Divisional place 6th
Other information
Owner(s) Robert Nutting
Kevin McClatchy
General manager(s) Dave Littlefield
Neal Huntington
Manager(s) Jim Tracy
Local television FSN Pittsburgh
Steve Blass
Lanny Frattare
Greg Brown
Bob Walk
John Wehner
Local radio WPGB-FM
Steve Blass
Lanny Frattare
Greg Brown
Bob Walk
John Wehner
 < Previous season     Next season  >

The Pittsburgh Pirates' 2007 season marked the 126th season of the franchise.

Contents

  • Overview 1
  • Regular season 2
    • Fans protest 2.1
    • Season standings 2.2
      • National League Central 2.2.1
      • Record vs. opponents 2.2.2
    • Roster 2.3
      • Opening day lineup 2.3.1
    • Game log 2.4
  • Statistics 3
  • Awards and honors 4
  • Farm system 5
  • References 6

Overview

The Pirates began 2007 with a new majority owner, Robert Nutting, and the dreary fact that they could surpass the Philadelphia Phillies as owners of the longest consecutive losing seasons record in baseball, having last had a winning season in 1992. However, in spite of finishing 5th in the NL Central, the Pirates were hoping that their 2nd half momentum from 2006 would carry over into 2007.

In addition to NL batting champion Freddy Sanchez and slugger Jason Bay, the Bucs acquired Adam LaRoche from Atlanta in January, hoping to boost offensive power. In addition, they re-signed pitcher Shawn Chacón, acquired from the Yankees last summer, and signed Tony Armas, Jr. to help bolster their starting rotation, led by Ian Snell and Tom Gorzelanny.

Just before the

Regular season

The Pirates' season started well, as they swept the Houston Astros in Houston for the first time since 1991, when the Astros played in the Astrodome. However, that initial success didn't carry for very long, as the Bucs proceeded to lose 11 of their next 13 games. The Pirates pulled out of their early slump to post a 12-12 record at the end of April. May, however, would to be quite tumultuous, as Tony Armas was sent to the bullpen for poor performance, Zach Duke struggled mightily, the bullpen blew several late leads, and closer Salomón Torres was stripped of his closer's duties, in favor of youngster Matt Capps after Torres blew a 2-run ninth-inning lead against the San Diego Padres on May 31.

After the All-Star Break, the Pirates started off by losing 7 games in a row, and 8 out of 9 overall. Paul "Big Poison" Waner's number 11 was retired in a pregame ceremony at PNC Park July 21, 2007, conducted in part by members of his family and Pirate greats Bill Mazeroski and Ralph Kiner.

Fans protest

Frustrated by the consistent losing, poor drafting, and the ownership's inability to retain players due to payroll constraints, fans led by Pittsburgh Business Executive Andrew Chomos organized a much-publicized walkout for June 30.[2] There were also a pre-game protest rally outside the stadium, including the appearance and speaking of former Pirate Doc Ellis, who stated he has been "embarrassed to be called a Pirate over the last 15 years". Despite the best efforts by the Pirates to downplay the protest, it became so publicized that management was forced to acknowledge its existence. Then Pirate CEO Kevin McClatchy resigned 2 days after the protest. The protest periodically appeared in news articles as it did in the August 2010 issue of Sports Illustrated and was also a topical conversation on ESPN and CNN programs.

Season standings

National League Central

NL Central W L Pct. GB Home Road
Chicago Cubs 85 77 0.525 44–37 41–40
Milwaukee Brewers 83 79 0.512 2 51–30 32–49
St. Louis Cardinals 78 84 0.481 7 43–38 35–46
Houston Astros 73 89 0.451 12 42–39 31–50
Cincinnati Reds 72 90 0.444 13 39–42 33–48
Pittsburgh Pirates 68 94 0.420 17 37–44 31–50


Record vs. opponents

2007 National League Records

Source: [1]
Team ARI ATL CHC CIN COL FLA HOU LAD MIL NYM PHI PIT SD SF STL WSH AL
Arizona 4–2 4–2 2–4 8–10 6–1 5–2 8–10 2–5 3–4 5–1 5–4 10–8 10–8 4–3 6–1 8–7
Atlanta 2–4 5–4 1–6 4–2 10–8 3–3 4–3 5–2 9–9 9–9 5–1 5–2 4–3 3–4 11–7 4–11
Chicago 2–4 4–5 9–9 5–2 0–6 8–7 2–5 9–6 2–5 3–4 8–7 3–5 5–2 11–5 6–1 8–4
Cincinnati 4–2 6–1 9–9 2–4 4–3 4–11 2–4 8–7 2–5 2–4 9–7 2–4 4–3 6–9 1–6 7-11
Colorado 10–8 2–4 2–5 4–2 3–3 3–4 12–6 4–2 4–2 4–3 4–3 11–8 10–8 3–4 4–3 10–8
Florida 1–6 8–10 6–0 3–4 3–3 2–3 4–3 2–5 7–11 9–9 3–4 3–4 1–6 2–4 8–10 9–9
Houston 2–5 3–3 7–8 11–4 4–3 3-2 4–3 5–13 2–5 3–3 5–10 4–3 2–4 7–9 2–5 9–9
Los Angeles 10–8 3–4 5–2 4–2 6–12 3–4 3–4 3–3 5–5 4–2 5–2 8–10 10–8 3–3 5–1 5–10
Milwaukee 5–2 2–5 6–9 7–8 2–4 5–2 13–5 3–3 2–4 3–4 10–6 2–5 4–5 7–8 4–2 8–7
New York 4–3 9–9 5–2 5–2 2–4 11–7 5–2 5–5 4–2 6–12 4–2 2–4 4–2 5–2 9–9 8–7
Philadelphia 1-5 9–9 4–3 4–2 3–4 9–9 3–3 2–4 4–3 12–6 4–2 4–3 4–4 6–3 12–6 8–7
Pittsburgh 4–5 1–5 7–8 7–9 3–4 4–3 10–5 2–5 6–10 2–4 2–4 1–6 4–2 6–12 4–2 5–10
San Diego 8–10 2–5 5–3 4–2 8–11 4–3 3–4 10–8 5–2 4–2 3–4 6–1 14–4 3–4 4–2 6–9
San Francisco 8–10 3–4 2–5 3–4 8–10 6–1 4–2 8–10 5–4 2–4 4–4 2–4 4–14 4–1 3–4 5–10
St. Louis 3–4 4–3 5–11 9–6 4–3 4-2 9–7 3–3 8–7 2–5 3–6 12–6 4–3 1–4 1–5 6–9
Washington 1–6 7–11 1–6 6–1 3–4 10-8 5–2 1–5 2–4 9–9 6–12 2–4 2–4 4–3 5–1 9–9


Roster

Opening day lineup

Game log

Statistics

Hitting
Pitching

Awards and honors

2007 Major League Baseball All-Star Game

Farm system

Level Team League Manager
AAA Indianapolis Indians International League Trent Jewett
AA Altoona Curve Eastern League Tim Leiper
A Lynchburg Hillcats Carolina League Jeff Branson
A Hickory Crawdads South Atlantic League Gary Green
Short-Season A State College Spikes New York–Penn League Turner Ward
Rookie GCL Pirates Gulf Coast League Tom Prince
Rookie DSL Pirates Dominican Summer League N/A
Rookie VSL Pirates Venezuelan Summer League N/A

References

  • Game Logs:
1st Half: Pittsburgh Pirates Game Log on ESPN.com
2nd Half: Pittsburgh Pirates Game Log on ESPN.com
  • Batting Statistics: Pittsburgh Pirates Batting Stats on ESPN.com
  • Pitching Statistics: Pittsburgh Pirates Pitching Stats on ESPN.com
  • Fans Protest / Walkout:'

-- Module:Hatnote -- -- -- -- This module produces hatnote links and links to related articles. It -- -- implements the and meta-templates and includes -- -- helper functions for other Lua hatnote modules. --


local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local mArguments -- lazily initialise Module:Arguments local yesno -- lazily initialise Module:Yesno

local p = {}


-- Helper functions


local function getArgs(frame) -- Fetches the arguments from the parent frame. Whitespace is trimmed and -- blanks are removed. mArguments = require('Module:Arguments') return mArguments.getArgs(frame, {parentOnly = true}) end

local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end

function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to true. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end

function p.formatPages(...) -- Formats a list of pages using formatLink and returns it as an array. Nil -- values are not allowed. local pages = {...} local ret = {} for i, page in ipairs(pages) do ret[i] = p._formatLink(page) end return ret end

function p.formatPageTables(...) -- Takes a list of page/display tables and returns it as a list of -- formatted links. Nil values are not allowed. local pages = {...} local links = {} for i, t in ipairs(pages) do checkType('formatPageTables', i, t, 'table') local link = t[1] local display = t[2] links[i] = p._formatLink(link, display) end return links end

function p.makeWikitextError(msg, helpLink, addTrackingCategory) -- Formats an error message to be returned to wikitext. If -- addTrackingCategory is not false after being returned from -- Module:Yesno, and if we are not on a talk page, a tracking category -- is added. checkType('makeWikitextError', 1, msg, 'string') checkType('makeWikitextError', 2, helpLink, 'string', true) yesno = require('Module:Yesno') local title = mw.title.getCurrentTitle() -- Make the help link text. local helpText if helpLink then helpText = ' (help)' else helpText = end -- Make the category text. local category if not title.isTalkPage and yesno(addTrackingCategory) ~= false then category = 'Hatnote templates with errors' category = string.format( '%s:%s', mw.site.namespaces[14].name, category ) else category = end return string.format( '%s', msg, helpText, category ) end


-- Format link -- -- Makes a wikilink from the given link and display values. Links are escaped -- with colons if necessary, and links to sections are detected and displayed -- with " § " as a separator rather than the standard MediaWiki "#". Used in -- the template.


function p.formatLink(frame) local args = getArgs(frame) local link = args[1] local display = args[2] if not link then return p.makeWikitextError( 'no link specified', 'Template:Format hatnote link#Errors', args.category ) end return p._formatLink(link, display) end

function p._formatLink(link, display) -- Find whether we need to use the colon trick or not. We need to use the -- colon trick for categories and files, as otherwise category links -- categorise the page and file links display the file. checkType('_formatLink', 1, link, 'string') checkType('_formatLink', 2, display, 'string', true) link = removeInitialColon(link) local namespace = p.findNamespaceId(link, false) local colon if namespace == 6 or namespace == 14 then colon = ':' else colon = end -- Find whether a faux display value has been added with the | magic -- word. if not display then local prePipe, postPipe = link:match('^(.-)|(.*)$') link = prePipe or link display = postPipe end -- Find the display value. if not display then local page, section = link:match('^(.-)#(.*)$') if page then display = page .. ' § ' .. section end end -- Assemble the link. if display then return string.format('%s', colon, link, display) else return string.format('%s%s', colon, link) end end


-- Hatnote -- -- Produces standard hatnote text. Implements the template.


function p.hatnote(frame) local args = getArgs(frame) local s = args[1] local options = {} if not s then return p.makeWikitextError( 'no text specified', 'Template:Hatnote#Errors', args.category ) end options.extraclasses = args.extraclasses options.selfref = args.selfref return p._hatnote(s, options) end

function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) local classes = {'hatnote'} local extraclasses = options.extraclasses local selfref = options.selfref if type(extraclasses) == 'string' then classes[#classes + 1] = extraclasses end if selfref then classes[#classes + 1] = 'selfref' end return string.format( '
%s
', table.concat(classes, ' '), s )

end

return p-------------------------------------------------------------------------------- -- Module:Hatnote -- -- -- -- This module produces hatnote links and links to related articles. It -- -- implements the and meta-templates and includes -- -- helper functions for other Lua hatnote modules. --


local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local mArguments -- lazily initialise Module:Arguments local yesno -- lazily initialise Module:Yesno

local p = {}


-- Helper functions


local function getArgs(frame) -- Fetches the arguments from the parent frame. Whitespace is trimmed and -- blanks are removed. mArguments = require('Module:Arguments') return mArguments.getArgs(frame, {parentOnly = true}) end

local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end

function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to true. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end

function p.formatPages(...) -- Formats a list of pages using formatLink and returns it as an array. Nil -- values are not allowed. local pages = {...} local ret = {} for i, page in ipairs(pages) do ret[i] = p._formatLink(page) end return ret end

function p.formatPageTables(...) -- Takes a list of page/display tables and returns it as a list of -- formatted links. Nil values are not allowed. local pages = {...} local links = {} for i, t in ipairs(pages) do checkType('formatPageTables', i, t, 'table') local link = t[1] local display = t[2] links[i] = p._formatLink(link, display) end return links end

function p.makeWikitextError(msg, helpLink, addTrackingCategory) -- Formats an error message to be returned to wikitext. If -- addTrackingCategory is not false after being returned from -- Module:Yesno, and if we are not on a talk page, a tracking category -- is added. checkType('makeWikitextError', 1, msg, 'string') checkType('makeWikitextError', 2, helpLink, 'string', true) yesno = require('Module:Yesno') local title = mw.title.getCurrentTitle() -- Make the help link text. local helpText if helpLink then helpText = ' (help)' else helpText = end -- Make the category text. local category if not title.isTalkPage and yesno(addTrackingCategory) ~= false then category = 'Hatnote templates with errors' category = string.format( '%s:%s', mw.site.namespaces[14].name, category ) else category = end return string.format( '%s', msg, helpText, category ) end


-- Format link -- -- Makes a wikilink from the given link and display values. Links are escaped -- with colons if necessary, and links to sections are detected and displayed -- with " § " as a separator rather than the standard MediaWiki "#". Used in -- the template.


function p.formatLink(frame) local args = getArgs(frame) local link = args[1] local display = args[2] if not link then return p.makeWikitextError( 'no link specified', 'Template:Format hatnote link#Errors', args.category ) end return p._formatLink(link, display) end

function p._formatLink(link, display) -- Find whether we need to use the colon trick or not. We need to use the -- colon trick for categories and files, as otherwise category links -- categorise the page and file links display the file. checkType('_formatLink', 1, link, 'string') checkType('_formatLink', 2, display, 'string', true) link = removeInitialColon(link) local namespace = p.findNamespaceId(link, false) local colon if namespace == 6 or namespace == 14 then colon = ':' else colon = end -- Find whether a faux display value has been added with the | magic -- word. if not display then local prePipe, postPipe = link:match('^(.-)|(.*)$') link = prePipe or link display = postPipe end -- Find the display value. if not display then local page, section = link:match('^(.-)#(.*)$') if page then display = page .. ' § ' .. section end end -- Assemble the link. if display then return string.format('%s', colon, link, display) else return string.format('%s%s', colon, link) end end


-- Hatnote -- -- Produces standard hatnote text. Implements the template.


function p.hatnote(frame) local args = getArgs(frame) local s = args[1] local options = {} if not s then return p.makeWikitextError( 'no text specified', 'Template:Hatnote#Errors', args.category ) end options.extraclasses = args.extraclasses options.selfref = args.selfref return p._hatnote(s, options) end

function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) local classes = {'hatnote'} local extraclasses = options.extraclasses local selfref = options.selfref if type(extraclasses) == 'string' then classes[#classes + 1] = extraclasses end if selfref then classes[#classes + 1] = 'selfref' end return string.format( '
%s
', table.concat(classes, ' '), s )

end

return p
  1. ^ From 1882-1906, the team played in Allegheny, Pennsylvania, which became annexed by Pittsburgh as the North Shore in 1907.
  2. ^ Fans Protest / Walkout:
  3. ^
  4. ^
Walkout by Pirates fans gets blacked out [2]
Pirates Fan Protest, Walkout Still On For Weekend [3]
Pirates fans group pushing in-game walkout Saturday [4]
'Fans for Change' ready for Pirates protest [5]

-- Module:Hatnote -- -- -- -- This module produces hatnote links and links to related articles. It -- -- implements the and meta-templates and includes -- -- helper functions for other Lua hatnote modules. --


local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local mArguments -- lazily initialise Module:Arguments local yesno -- lazily initialise Module:Yesno

local p = {}


-- Helper functions


local function getArgs(frame) -- Fetches the arguments from the parent frame. Whitespace is trimmed and -- blanks are removed. mArguments = require('Module:Arguments') return mArguments.getArgs(frame, {parentOnly = true}) end

local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end

function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to true. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end

function p.formatPages(...) -- Formats a list of pages using formatLink and returns it as an array. Nil -- values are not allowed. local pages = {...} local ret = {} for i, page in ipairs(pages) do ret[i] = p._formatLink(page) end return ret end

function p.formatPageTables(...) -- Takes a list of page/display tables and returns it as a list of -- formatted links. Nil values are not allowed. local pages = {...} local links = {} for i, t in ipairs(pages) do checkType('formatPageTables', i, t, 'table') local link = t[1] local display = t[2] links[i] = p._formatLink(link, display) end return links end

function p.makeWikitextError(msg, helpLink, addTrackingCategory) -- Formats an error message to be returned to wikitext. If -- addTrackingCategory is not false after being returned from -- Module:Yesno, and if we are not on a talk page, a tracking category -- is added. checkType('makeWikitextError', 1, msg, 'string') checkType('makeWikitextError', 2, helpLink, 'string', true) yesno = require('Module:Yesno') local title = mw.title.getCurrentTitle() -- Make the help link text. local helpText if helpLink then helpText = ' (help)' else helpText = end -- Make the category text. local category if not title.isTalkPage and yesno(addTrackingCategory) ~= false then category = 'Hatnote templates with errors' category = string.format( '%s:%s', mw.site.namespaces[14].name, category ) else category = end return string.format( '%s', msg, helpText, category ) end


-- Format link -- -- Makes a wikilink from the given link and display values. Links are escaped -- with colons if necessary, and links to sections are detected and displayed -- with " § " as a separator rather than the standard MediaWiki "#". Used in -- the template.


function p.formatLink(frame) local args = getArgs(frame) local link = args[1] local display = args[2] if not link then return p.makeWikitextError( 'no link specified', 'Template:Format hatnote link#Errors', args.category ) end return p._formatLink(link, display) end

function p._formatLink(link, display) -- Find whether we need to use the colon trick or not. We need to use the -- colon trick for categories and files, as otherwise category links -- categorise the page and file links display the file. checkType('_formatLink', 1, link, 'string') checkType('_formatLink', 2, display, 'string', true) link = removeInitialColon(link) local namespace = p.findNamespaceId(link, false) local colon if namespace == 6 or namespace == 14 then colon = ':' else colon = end -- Find whether a faux display value has been added with the | magic -- word. if not display then local prePipe, postPipe = link:match('^(.-)|(.*)$') link = prePipe or link display = postPipe end -- Find the display value. if not display then local page, section = link:match('^(.-)#(.*)$') if page then display = page .. ' § ' .. section end end -- Assemble the link. if display then return string.format('%s', colon, link, display) else return string.format('%s%s', colon, link) end end


-- Hatnote -- -- Produces standard hatnote text. Implements the template.


function p.hatnote(frame) local args = getArgs(frame) local s = args[1] local options = {} if not s then return p.makeWikitextError( 'no text specified', 'Template:Hatnote#Errors', args.category ) end options.extraclasses = args.extraclasses options.selfref = args.selfref return p._hatnote(s, options) end

function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) local classes = {'hatnote'} local extraclasses = options.extraclasses local selfref = options.selfref if type(extraclasses) == 'string' then classes[#classes + 1] = extraclasses end if selfref then classes[#classes + 1] = 'selfref' end return string.format( '
%s
', table.concat(classes, ' '), s )

end

return p-------------------------------------------------------------------------------- -- Module:Hatnote -- -- -- -- This module produces hatnote links and links to related articles. It -- -- implements the and meta-templates and includes -- -- helper functions for other Lua hatnote modules. --


local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local mArguments -- lazily initialise Module:Arguments local yesno -- lazily initialise Module:Yesno

local p = {}


-- Helper functions


local function getArgs(frame) -- Fetches the arguments from the parent frame. Whitespace is trimmed and -- blanks are removed. mArguments = require('Module:Arguments') return mArguments.getArgs(frame, {parentOnly = true}) end

local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end

function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to true. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end

function p.formatPages(...) -- Formats a list of pages using formatLink and returns it as an array. Nil -- values are not allowed. local pages = {...} local ret = {} for i, page in ipairs(pages) do ret[i] = p._formatLink(page) end return ret end

function p.formatPageTables(...) -- Takes a list of page/display tables and returns it as a list of -- formatted links. Nil values are not allowed. local pages = {...} local links = {} for i, t in ipairs(pages) do checkType('formatPageTables', i, t, 'table') local link = t[1] local display = t[2] links[i] = p._formatLink(link, display) end return links end

function p.makeWikitextError(msg, helpLink, addTrackingCategory) -- Formats an error message to be returned to wikitext. If -- addTrackingCategory is not false after being returned from -- Module:Yesno, and if we are not on a talk page, a tracking category -- is added. checkType('makeWikitextError', 1, msg, 'string') checkType('makeWikitextError', 2, helpLink, 'string', true) yesno = require('Module:Yesno') local title = mw.title.getCurrentTitle() -- Make the help link text. local helpText if helpLink then helpText = ' (help)' else helpText = end -- Make the category text. local category if not title.isTalkPage and yesno(addTrackingCategory) ~= false then category = 'Hatnote templates with errors' category = string.format( '%s:%s', mw.site.namespaces[14].name, category ) else category = end return string.format( '%s', msg, helpText, category ) end


-- Format link -- -- Makes a wikilink from the given link and display values. Links are escaped -- with colons if necessary, and links to sections are detected and displayed -- with " § " as a separator rather than the standard MediaWiki "#". Used in -- the template.


function p.formatLink(frame) local args = getArgs(frame) local link = args[1] local display = args[2] if not link then return p.makeWikitextError( 'no link specified', 'Template:Format hatnote link#Errors', args.category ) end return p._formatLink(link, display) end

function p._formatLink(link, display) -- Find whether we need to use the colon trick or not. We need to use the -- colon trick for categories and files, as otherwise category links -- categorise the page and file links display the file. checkType('_formatLink', 1, link, 'string') checkType('_formatLink', 2, display, 'string', true) link = removeInitialColon(link) local namespace = p.findNamespaceId(link, false) local colon if namespace == 6 or namespace == 14 then colon = ':' else colon = end -- Find whether a faux display value has been added with the | magic -- word. if not display then local prePipe, postPipe = link:match('^(.-)|(.*)$') link = prePipe or link display = postPipe end -- Find the display value. if not display then local page, section = link:match('^(.-)#(.*)$') if page then display = page .. ' § ' .. section end end -- Assemble the link. if display then return string.format('%s', colon, link, display) else return string.format('%s%s', colon, link) end end


-- Hatnote -- -- Produces standard hatnote text. Implements the template.


function p.hatnote(frame) local args = getArgs(frame) local s = args[1] local options = {} if not s then return p.makeWikitextError( 'no text specified', 'Template:Hatnote#Errors', args.category ) end options.extraclasses = args.extraclasses options.selfref = args.selfref return p._hatnote(s, options) end

function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) local classes = {'hatnote'} local extraclasses = options.extraclasses local selfref = options.selfref if type(extraclasses) == 'string' then classes[#classes + 1] = extraclasses end if selfref then classes[#classes + 1] = 'selfref' end return string.format( '
%s
', table.concat(classes, ' '), s )

end

return p