PubNight Extensions

From PubNight
Jump to: navigation, search

The complete and utter guide to Pub Night Wiki Extensions

PNC Wiki Extensions can be grouped into two main categories:

  • Formatting
  • Data

Formatting

dateform

A simple little extension that formats dates for you.

<dateform dateformat=full>12/12/2005</dateform> produces " Monday 12th December 2005 "


If a partial date is provided then the output changes in a rather clever way

<dateform dateformat=full>00/12/2005</dateform> produces " sometime in December 2005 "

<dateform dateformat=full>00/00/2005</dateform> produces " sometime in 2005 "

<dateform>00/12/2005</dateform> produces " 12/2005 "

<dateform>00/00/2005</dateform> produces " 2005 "


See nicedate for a shorter fixed format version

left, centre, right, justify

These simply align the text between the open and close tags


Data

The Pub Night Wiki uses a lot of formatted data to build consistent looking pages. The Wiki way of using cascading templates was, to put it mildly, horrendous so we coded our own extensions.


PNDATA

This is the main Pub Night Data extension and takes several parameters:

  • DG
  • field
  • formatting options

Digraphs

The Digraph is the Key to accessing Pub Night data. Each pub has its own unique Digraph and by using this you can access the data held for each pub - for example dg=AE would return information associated with the Pub Data page AE.

Multiple digraphs can be entered and data will be returned for each digraph in turn, so dg=MB,AE,3K will return the selected fields for those three pubs.

You can also specify dg=* which returns ALL digraphs from the PNPD namespace.

Fields

Each Pub Data page contains several fields (see PNPD:Data Fields for details on the current set of fields.)

Specifying a field returns the data associated with that field for the supplied digraph. So dg=AE field=address will return the address for the pub identified by the digraph AE.

Multiple fields can be specified. Fields will be returned in the order specified so field=who,beers,lastvisit will put those fields out with NO spaces (See the notes on formatting ).

There is also special field called user_content. This tells the extension to return the text between the start and end tags as part of the output. This allows you to control where in the formatted page the user generated stuff goes See Mabels Tavern, St Pancras for an example of this

If you specify NO fields apart from the digraph then the following fields are automatically returned: header, user_content, footer

Formatting

Some of the Pub Data fields support different styles of formatting. The fields that support formatting options are:

  • lastvisit
  • rating
  • beer_rating.

Each of these fields has its own keyword associated with it :

The lastvisit field (and by extrapolation the DATEFORM extension) uses dateformat to control how its output is displayed.


The rating and beer_ratings use ratingformat and beerratingformat accordingly which take a descriptive word. Not supplying the parameter makes them return the number value. The descriptive words that can be used by these two rating fields are defined on PNPD:Rating Words which contains sets of words to be used as ratings descriptions. There are currently two sorts of ratings - beer ratings which comprise of 6 words (numerically 0-5) and pub ratings which comprise of 11 words (numerically 0-10). Simply add a new line with a unique "keyword" and then those rating words will be available for use. If the rating field in the DG page is empty then N/A is returned, if its NOT numeric then the contents of the field are returned

Additional Parameters

There is a formatting parameter which is associated with multiple DG and multiple data fields. The parameter is style and it can either be table, space or line.

If its table then each field appears in a td section within a table row with one row for each DG specified. The column headers are specified in the space between the start and end tags.

If it is space then each field is put out with a space separating them. If there are mulitple DGs then each set of fields appears on a new line. If it is line then each field is put out a new line.

There is also a new parameter associated with the DG field. This is the edit parameter and can be yes or no. This makes the DG an click to edit style link.


So lets roll up all these features into an example:

<pndata dg=CN,AE field=page,dg,notes,lastvisit,rating,beer_rating style=table dateformat=full edit=yes ratingformat=formal beerratingformat=camra > Name,[[PDDG]],Notes,Last PNC Visit,Rating,Beer Rating</pndata>

This retrieves the pub name as a Wiki clickable link to the name page for the pub. This allows us to have multiple pubs of the same name but linking back to differen name pages, the DiGraph, the notes, the last visit date, the pub rating and the beer rating fields (field=page,dg,notes,lastvisit,rating,beer_rating) for the PNPD data pages for CN and AE (dg=CN,AE ) .

It places these field items into a table (style=table) with the following column headers : Name,[[PDDG]],Notes,Last PNC Visit,Rating,Beer Rating (Note that the PDDG column header is a Wiki Link) and populates it with the data.

The Digraphs for the Pubs are represented as click to edit links (because we specified edit=yes) to the associated PNPD namespace pages.

The last visit date is formatted using the full styling, The pub rating is described using the formal wordings and the beer is rated using the camra ratings.


And this is what it looks like:


NamePDDGNotesLast PNC VisitRatingBeer Rating
Cheltenham Motor ClubCNOrginally The Crown, and accesible via Crown Passage from the London Rd. Winner of CAMRA SW Club of the Year 2006, 2007, 2008 through to 2012 - a testament to the effort put in by Neil behind the bar (and in the cellar).Tuesday 27th January 2009 Largely acceptableExcellent
The Adam and EveAELong standing Local for several members of Pub NightTuesday 7th January 2014 Extremely acceptableExcellent


PNQUERY

This allows very basic querying of pubnight data fields

The extension takes the same parameters as the pndata extension but adds "what" and "where" to it. The what field contains what you want to search for. If you want to search for a phrase then enclose it in quotes - so to search for Hook Norton you would put "Hook Norton". The where field contains the pndata field that you want to search in.

NOTES

  • Basic OR logic has been implemented so it is possible to search for more than one term BUT only in 1 data field.


Some examples:

Return a list of pubs that list "Hook Norton" as a brewer. This could be used on each breweries page to show which pubs are selling their beers.
<pnquery field=page,dg,rating,beers,beer_rating what="Hook Norton" where=brewery style=table> Pub Name,Digraph,Rating,Beers, Beer Rating </pnquery>

Pub NameDigraphRatingBeers Beer Rating
White Hart, FyfieldWHFN/ABlack Swan, Life Of Riley, Old Hooky and Doom BarN/A
Tunnel House, CoatesTUN/AHookey Bitter, Budding and Uley BitterN/A
The Kings Head, BledingtonKIN/ACotswold Way, Hook Norton Bitter and SlatersN/A
Fleece Inn, BretfortonFIBN/AShepherds Delight and Hooky BitterN/A
Falcon, ThameFNTN/AHooky Bitter, Steaming On and Twelve DaysN/A
The Green Dragon, CocklefordGDCN/AButcombe Traditional Bitter, Hookey Bitter and DirectorsN/A


Return a list of pubs that list "Old Hooky" as a beer
<pnquery field=page,dg,rating,beers,beer_rating what="Old Hooky" where=beers style=table> Pub Name,Digraph,Rating,Beers, Beer Rating </pnquery>

Pub NameDigraphRatingBeers Beer Rating
White Hart, FyfieldWHFN/ABlack Swan, Life Of Riley, Old Hooky and Doom BarN/A


Returns a list of pubs that have Steve listed as a who attended
<pnquery field=page,dg,rating,beers,beer_rating what=steve where=who style=table> Pub Name,Digraph,Rating,Beers, Beer Rating </pnquery>

Pub NameDigraphRatingBeers Beer Rating
The Plough InnPIN/AN/A
The Plough, PrestburyPLN/ABest, Broadside and BombardierN/A
The Plaisterers ArmsPSN/AN/A
The Red Lion, CrickladeRLCN/AN/A
The Royal Oak,PrestburyRKN/ALandlord, Gem and JHBN/A
The Red Lion Inn, Market DraytonRM9Shropshire Gold, Darwin's Origin and Worthington Draught9
The Rotunda TavernRO8Bombadier, Tetley Cask and Bass4
The RestorationRRN/ATribute, Butty Bach, Bitter and Bombardier5
Moon Under WaterMUN/AN/A
New InnNI9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
Coach and Horses, Market DraytonMCN/ATheakstons Best and Theakstons MildN/A
Kings Arms, Market DraytonMKN/AThin Ice, 6X and Ice QueenN/A
Malvern Hills HotelMHBN/AHereford Pale Ale, Wye Valley Bitter, Black Pear, Gold and MagnetN/A
The Old Spot, DursleyOSDN/AN/A
The Old PloughOPBN/AN/A
The Old White LionOWN/AN/A
The ParrotPAN/AN/A
Ye Olde Anchor InnOAN/AN/A
NelsonNS9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
The SwanOHVery goodBig Fat Liar and Lancaster BomberN/A
The Stags Head Inn, Market DraytonSEN/ABitterN/A
The Whitesmiths ArmsWG93B and Moonlight4
The Little Upton MuggeryUMN/AN/A
The White HartWWN/AN/A
ZeroDegrees BristolZDBN/AN/A
Watershed, BristolWSBN/AOyster Stout, Beech Blonde and Honey BeerN/A
The White Lion, BristolWLBN/AN/A
The White LionWLN/ABB, SB, Abbott and HoldensN/A
St. Georges VaultsSGN/ABrakspear and Old Speckled HenN/A
The Suffolk ArmsSFGoodJouster, Abbot and BitterN/A
The Sun InnSIN/AN/A
The Talbot Head HotelTHN/AN/A
The Feet Inn, TwyningTFN/AOriginal, Landlord and BombardierN/A
The Talbot, Market DraytonTMN/ABitter, Porter, Best and Oxford GoldN/A
The SwanSWN/AN/A
The Sudeley ArmsSUN/ADeuchars IPA, Otter Bitter and London Pride8
The Star Inn & HotelSTUN/AN/A
TailorsTAN/AHorizon, 6X and JCBN/A
Twelve Bells, CirencesterTBC9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
Cafe ReneCE9T4
Beeston Castle HotelCBN/AN/A
The Bath TavernBT10Doom Bar, Brigstow Bitter and 6x4
The Blue Bell InnBUN/AN/A
Cheltenham Beer FestivalC4N/ALots!N/A
The CotswoldCWN/AHenry IPA and 6XN/A
Colston Yard, BristolCYBN/AN/A
The Crown Hotel, Market DraytonCMN/AN/A
The Cape of Good HopeCPN/AN/A
Cornubia, BristolCOBN/AHidden Pint, Hidden Quest, Hidden Spring, Hidden Pleasure and SiberiaN/A
The Bakers ArmsBCSuperbN/A
The Brandy CaskBCPN/AWhistling Joe, Brandy Snapper and John BakerN/A
Beehive Inn, Bouncers LaneBBN/AProper Job and Tribute-1
The Adam and EveAE10Moolight and Noel... And A Mix Of Other Beers From Arkells And Donnington5
The Three Kings3KSuperbConnemara Gold, Hobsons Best, Butcombe Bitter and Market Street SpecialN/A
The Bayshill InnBHN/AHenry IPA, JCB, 6X and Bishops TippleN/A
The Bank HouseBNN/A NOT Meerkat Mild , Mad Goose, Doombar, Fourtyniner and Filly DriftN/A
Bag O Nails, BristolBNBN/ABroad Acres and BestN/A
The Jolly BrewmasterJB8Gold, Tom Long and Butty Bach4
Salopian StarJMN/AGoldN/A
The Hewlett ArmsHLN/AGem, Windrush Ale and Butcombe BitterN/A
The Kemble Brewery InnKBN/AHereford Pale Ale and Gloucestershires GloryN/A
The Market TavernMAN/AGolden Bear, Lady Godiva, Kingmaker, Shakespear's County, Churchyard Bob and FalstaffN/A
Laze DazeLZN/ASaxon and JousterN/A
The Linden Tree, GloucesterLTG94
The Kings HeadKHN/ALandlord, London Pride and HobGolbinN/A
Fountain, GloucesterFOG9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
The Five Mile HouseFMD8BB, Landlord and Youngs Bitter5
The Dragon InnDIN/AN/A
Dick Whittington, GloucesterDWG9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
The Golden BallGLN/AN/A
Grain Barge, BristolGBBN/ASunrise, Stout, Red and ExhibitionN/A
The GreyhoundGHN/AAbbot and Best Mate8
George HotelGGN/A-1


Returns a list of pubs that have a beer rating of 3,4 or 5
<pnquery field=page,dg,rating,beers,beer_rating what=3,4,5 where=beer_rating style=table edit=yes> Pub Name,Digraph,Rating,Beers, Beer Rating </pnquery>

Pub NameDigraphRatingBeers Beer Rating
The Rotunda TavernRO8Bombadier, Tetley Cask and Bass4
The RestorationRRN/ATribute, Butty Bach, Bitter and Bombardier5
New InnNI9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
NelsonNS9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
The Whitesmiths ArmsWG93B and Moonlight4
Twelve Bells, CirencesterTBC9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
Cafe ReneCE9T4
The Bath TavernBT10Doom Bar, Brigstow Bitter and 6x4
Cheltenham Motor ClubCN9JHB, Gloucester Gold and Old Slug Porter5
The Adam and EveAE10Moolight and Noel... And A Mix Of Other Beers From Arkells And Donnington5
Axiom Arts CentreAC-14
The Jolly BrewmasterJB8Gold, Tom Long and Butty Bach4
The Linden Tree, GloucesterLTG94
Fountain, GloucesterFOG9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
The Five Mile HouseFMD8BB, Landlord and Youngs Bitter5
Dick Whittington, GloucesterDWG9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4


Returns a list of pubs that have Steve OR nick listed as a who attended
<pnquery field=page,dg,rating,beers,beer_rating what=steve,nick where=who style=table> Pub Name,Digraph,Rating,Beers, Beer Rating </pnquery>

Pub NameDigraphRatingBeers Beer Rating
The Plough InnPIN/AN/A
The Plough, PrestburyPLN/ABest, Broadside and BombardierN/A
The Plaisterers ArmsPSN/AN/A
The RetreatRTN/AGoldenN/A
The Red Lion, CrickladeRLCN/AN/A
The Royal Oak,PrestburyRKN/ALandlord, Gem and JHBN/A
The Red Lion Inn, Market DraytonRM9Shropshire Gold, Darwin's Origin and Worthington Draught9
The Rotunda TavernRO8Bombadier, Tetley Cask and Bass4
The RestorationRRN/ATribute, Butty Bach, Bitter and Bombardier5
Moon Under WaterMUN/AN/A
New InnNI9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
The SwanMPN/AOriginal, Dark, Entire and BumbleholeN/A
Coach and Horses, Market DraytonMCN/ATheakstons Best and Theakstons MildN/A
Morpeth ArmsMON/AN/A
Kings Arms, Market DraytonMKN/AThin Ice, 6X and Ice QueenN/A
Malvern Hills HotelMHBN/AHereford Pale Ale, Wye Valley Bitter, Black Pear, Gold and MagnetN/A
The Old Spot, DursleyOSDN/AN/A
The Old PloughOPBN/AN/A
The Old White LionOWN/AN/A
The ParrotPAN/AN/A
Old Joint Stock, BirminghamOJBN/AChiswick, Discovery, London Pride and ESB And MoreN/A
Ye Olde Anchor InnOAN/AN/A
NelsonNS9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
The SwanOHVery goodBig Fat Liar and Lancaster BomberN/A
The Stags Head Inn, Market DraytonSEN/ABitterN/A
The Whitesmiths ArmsWG93B and Moonlight4
The Little Upton MuggeryUMN/AN/A
The VolunteerVON/AN/A
The White HartWWN/AN/A
White Swan, BirminghamWTBN/ACocker HoopN/A
White Horse and BowerXHN/AN/A
ZeroDegrees BristolZDBN/AN/A
Watershed, BristolWSBN/AOyster Stout, Beech Blonde and Honey BeerN/A
The White Lion, BristolWLBN/AN/A
The White LionWLN/ABB, SB, Abbott and HoldensN/A
Wellington, BirminghamWNBN/ABFG, Pig On The Wall and VariousN/A
St. Georges VaultsSGN/ABrakspear and Old Speckled HenN/A
The Suffolk ArmsSFGoodJouster, Abbot and BitterN/A
The Sun InnSIN/AN/A
The Talbot Head HotelTHN/AN/A
The Feet Inn, TwyningTFN/AOriginal, Landlord and BombardierN/A
The Talbot, Market DraytonTMN/ABitter, Porter, Best and Oxford GoldN/A
The SwanSWN/AN/A
The Sudeley ArmsSUN/ADeuchars IPA, Otter Bitter and London Pride8
The Star Inn & HotelSTUN/AN/A
TailorsTAN/AHorizon, 6X and JCBN/A
Twelve Bells, CirencesterTBC9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
Cafe ReneCE9T4
Beeston Castle HotelCBN/AN/A
The Bath TavernBT10Doom Bar, Brigstow Bitter and 6x4
The Blue Bell InnBUN/AN/A
Cheltenham Beer FestivalC4N/ALots!N/A
The CotswoldCWN/AHenry IPA and 6XN/A
Colston Yard, BristolCYBN/AN/A
Cheltenham Cricket ClubCXN/AVariousN/A
The Crown Hotel, Market DraytonCMN/AN/A
Cheltenham Motor ClubCN9JHB, Gloucester Gold and Old Slug Porter5
The Cape of Good HopeCPN/AN/A
Cornubia, BristolCOBN/AHidden Pint, Hidden Quest, Hidden Spring, Hidden Pleasure and SiberiaN/A
The Bakers ArmsBCSuperbN/A
The Brandy CaskBCPN/AWhistling Joe, Brandy Snapper and John BakerN/A
Beehive Inn, Bouncers LaneBBN/AProper Job and Tribute-1
The Adam and EveAE10Moolight and Noel... And A Mix Of Other Beers From Arkells And Donnington5
The Three Kings3KSuperbConnemara Gold, Hobsons Best, Butcombe Bitter and Market Street SpecialN/A
Anchor, BirminghamANBN/AVariousN/A
The Bayshill InnBHN/AHenry IPA, JCB, 6X and Bishops TippleN/A
Barton Arms, BirminghamBMBN/ABishops Farewell, Asylum and Blackhole PorterN/A
The Bank HouseBNN/A NOT Meerkat Mild , Mad Goose, Doombar, Fourtyniner and Filly DriftN/A
Bag O Nails, BristolBNBN/ABroad Acres and BestN/A
The Jolly BrewmasterJB8Gold, Tom Long and Butty Bach4
Salopian StarJMN/AGoldN/A
The Hewlett ArmsHLN/AGem, Windrush Ale and Butcombe BitterN/A
The Kemble Brewery InnKBN/AHereford Pale Ale and Gloucestershires GloryN/A
Lamp Tavern, BirminghamLTBN/AVariousN/A
The Market TavernMAN/AGolden Bear, Lady Godiva, Kingmaker, Shakespear's County, Churchyard Bob and FalstaffN/A
Laze DazeLZN/ASaxon and JousterN/A
The Linden Tree, GloucesterLTG94
The Kings HeadKHN/ALandlord, London Pride and HobGolbinN/A
Fountain, GloucesterFOG9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
The Five Mile HouseFMD8BB, Landlord and Youngs Bitter5
The Dragon InnDIN/AN/A
Dick Whittington, GloucesterDWG9Golden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout4
The Golden BallGLN/AN/A
Grain Barge, BristolGBBN/ASunrise, Stout, Red and ExhibitionN/A
The GreyhoundGHN/AAbbot and Best Mate8
George HotelGGN/A-1


Returns a list of pubs that have Bath Road in their address
<pnquery field=page,dg,rating,beers,beer_rating what="Bath Road" where=address style=table> Pub Name,Digraph,Rating,Beers, Beer Rating </pnquery>

Pub NameDigraphRatingBeers Beer Ratingaddress
Five AllsFAN/A-1Bath Road
Cheltenham
Gloucestershire
GL53 7ND
Exmouth ArmsEXN/AN/ABath Road
Cheltenham
Gloucestershire
GL53 7LX

GOOGLEMAP

This displays a googlemap when you use this tag. There can be multiple googlemaps per page as long as each map/dataset is identified using the mapid tag.


<googlemap lat="latitude" lon="longitude"></googlemap>

Legal attributes are:

  • width. Defaults to 300
  • height. Defaults to 300
  • lat (the center latitude on the map)
  • lon (the center longitude on the map)
  • zoom (the zoom level; 0 is the furthest away, 17 is the closest in). Defaults to 12
  • type (legal values are normal (or, equivalently, map), hybrid, and satellite. Defaults to map
  • controls (small creates +/- zoom buttons, medium has zoom buttons and pan buttons, and large has pan buttons with a sliding scale for zoom). Defaults to medium
  • gmarker. This can be text,link or number or icon. Text puts the pub name out, link puts a clicky link, number puts out a number by the side of the marker, icon puts out a numbered icon (1-99)
  • edit. If this is set (=yes) then the markers become draggable.. When you let go a pop up appears with the new Lat and Lon of the marker. You can then cut and paste these and use them to update the lat and lon in the pub data page!

Of course this only displays a map - it does not actually put anything on it. To add markers to the map you need to use the pndata tag with the addmarker field.

PNBREWERY

This tag brings back a link to an external web page with link text for a specified brewery

For example

<pnbrewery>arkells</pnbrewery>

Returns a link to the Arkell Brewery home page:

Arkells

PNBEER

This tag brings back a link to an external web page with link text for a specified brewery.

For example

<pnbeer>purity pure ubu</pnbeer>

Returns a link to the web page for Purity Pure UBU

Pure UBU


Shortened Tags

Obviously the PNC wiki extensions allow lots of complicated and clever things. But in a large number of cases we only want to do something simple so several shortened tags have been implemented:

NOTE: Since the Introduction of Wiki 1.6.6 some of these short versions can have odd effects. If in doubt please use the full length versions.

  • nicedate
  • pnlink
  • pngmap
  • addmarker

All shortened tags have the digraph placed between the open and close tags

nicedate

This is a shortened form of the dateform extension - it always returns the date in "full" format. So <nicedate>01/04/2006</nicedate> returns Saturday 1st April 2006 .

pnlink

This is a shortened form of the pndata extension - it returns the name of the pub as a WIKI link to the page associated with it. So <pnlink>AE</pnlink> returns The Adam and Eve

pngmap

This is a shortened version of the pndata googlemap extension - it returns a googlemap centered on the pub (assuming the lat and lon data field are populated). Clicking on the marker pin brings up a bubble with a clickable wiki link to the pub page. This shortened version also supports the gmarker keyword.

So <pngmap gmarker=text>AE</pngmap> would return.

addmarker

This is a shortened version of the pndata addmarker extension - it places a marker on the map (specified using the optional mapid field).

So if we create a mpa using pngmap centered on The Adam and Eve and then add a marker for the New Penny


<pngmap gmarker=text mapid=2>AE</pngmap> <addmarker mapid=2 gmarker=text>NP</addmarker> would return.



thumb

This is a shortened version of the pndata thumb extension. It displays a thumbnail of the image for the specified digraph

So <thumb>PL</thumb> would produce:

The Plough, taken from its rather pleasant garden


picture

This is a shortened version of the pndata picture extension. It displays the image for the specified digraph nicely framed with the caption text beneath it

So

<picture>PL</picture> would produce:

The Plough, taken from its rather pleasant garden