Actions

PubNight Extensions

From PubNight

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 and was CAMRA National Club of the Year in 2013, 2017 and 2020 - a testament to the effort put in by Neil behind the bar (and in the cellar). Was Branch Club of the Year 2019 and was Regional Club of the year 2018 Wednesday 8th January 2020
The Adam and EveAELong standing Local for several members of Pub NightTuesday 7th January 2014


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
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
The Kings Head, BledingtonKIN/ACotswold Way, Hook Norton Bitter and SlatersN/A
Tunnel House, CoatesTUN/AHookey Bitter, Budding and Uley BitterN/A
White Hart, FyfieldWHFN/ABlack Swan, Life Of Riley, Old Hooky and Doom BarN/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 Three Kings3KSuperbConnemara Gold, Hobsons Best, Butcombe Bitter and Market Street Special
The Adam and EveAEMoolight and Noel... And A Mix Of Other Beers From Arkells And Donnington
Beehive Inn, Bouncers LaneBBN/AProper Job and Tribute
The Bakers ArmsBCSuperb
The Brandy CaskBCPN/AWhistling Joe, Brandy Snapper and John BakerN/A
The Bayshill InnBHN/AHenry IPA, JCB, 6X and Bishops TippleN/A
The Bank HouseBNN/ANOT Meerkat Mild , Mad Goose, Doombar, Fourtyniner and Filly DriftN/A
Bag O Nails, BristolBNBN/ABroad Acres and BestN/A
The Bath TavernBTDoom Bar, Brigstow Bitter and 6x
The Blue Bell InnBUN/AN/A
Cheltenham Beer FestivalC4N/ALots!N/A
Beeston Castle HotelCBN/AN/A
Cafe ReneCET
The VineCJN/ASession IPA and IlluminationN/A
The Crown Hotel, Market DraytonCMN/AN/A
Cornubia, BristolCOBN/AHidden Pint, Hidden Quest, Hidden Spring, Hidden Pleasure and SiberiaN/A
The Cape of Good HopeCPN/AN/A
The CotswoldCWN/AHenry IPA, 6X and HorizonN/A
Colston Yard, BristolCYBN/AN/A
The Dragon InnDIN/AN/A
Dick Whittington, GloucesterDWGGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
The Five Mile HouseFMDBB, Landlord and Youngs Bitter
Fountain, GloucesterFOGGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
Grain Barge, BristolGBBN/ASunrise, Stout, Red and ExhibitionN/A
George HotelGGN/A
The GreyhoundGHN/AAbbot and Best Mate
The Golden BallGLN/AN/A
The Hewlett ArmsHLN/AGem, Windrush Ale and Butcombe BitterN/A
The Jolly BrewmasterJBGold, Tom Long and Butty Bach
Salopian StarJMN/AGoldN/A
The Kemble Brewery InnKBN/AHereford Pale Ale and Gloucestershires Glory
The Kings HeadKHN/ALandlord, London Pride and HobGolbinN/A
The Linden Tree, GloucesterLTG
Laze DazeLZN/ASaxon and JousterN/A
The Market TavernMAN/AGolden Bear, Lady Godiva, Kingmaker, Shakespear's County, Churchyard Bob and FalstaffN/A
Coach and Horses, Market DraytonMCN/ATheakstons Best and Theakstons MildN/A
Malvern Hills HotelMHBN/AHereford Pale Ale, Wye Valley Bitter, Black Pear, Gold and MagnetN/A
Kings Arms, Market DraytonMKN/AThin Ice, 6X and Ice QueenN/A
Moon Under WaterMUN/AN/A
New InnNIGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
NelsonNSGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
Ye Olde Anchor InnOAN/AN/A
The SwanOHVery good365
The Old PloughOPBN/AN/A
The Old Spot, DursleyOSDN/AN/A
The Old White LionOWN/AN/A
The ParrotPAN/AN/A
The Plough InnPIN/AN/A
The Plough, PrestburyPLN/ADizzy Blonde, 6X and AtlanticN/A
The Plaisterers ArmsPSN/AN/A
The Royal Oak,PrestburyRKN/ALandlord, Gem and JHBN/A
The Red Lion, CrickladeRLCN/AN/A
The Red Lion Inn, Market DraytonRMPale, Slumbering Monk, Blonde and Green Monkey
The Rotunda TavernROBombadier, Tetley Cask and Bass
The RestorationRRN/AHaka and [[]]
The Stags Head Inn, Market DraytonSEN/ABitterN/A
The Suffolk ArmsSFGoodJouster, Abbot and Bitter
St. Georges VaultsSGN/ABrakspear and Old Speckled HenN/A
The Sun InnSIN/AN/A
The Star Inn & HotelSTUN/AN/A
The Sudeley ArmsSUN/ADeuchars IPA, Otter Bitter and London Pride
The SwanSWN/AN/A
TailorsTAN/AHorizon, 6X and JCBN/A
Twelve Bells, CirencesterTBCGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
The Feet Inn, TwyningTFN/AOriginal, Landlord and BombardierN/A
The Talbot Head HotelTHN/AN/A
The Talbot, Market DraytonTMN/ABitter, Porter, Best and Oxford GoldN/A
The Little Upton MuggeryUMN/AN/A
The William ChesterWC
The Whitesmiths ArmsWG3B and Moonlight
The White LionWLN/ABB, SB, Abbott and HoldensN/A
The White Lion, BristolWLBN/AN/A
Watershed, BristolWSBN/AOyster Stout, Beech Blonde and Honey BeerN/A
The White HartWWN/AN/A
ZeroDegrees BristolZDBN/AN/A


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
Axiom Arts CentreACN/A
The Adam and EveAEMoolight and Noel... And A Mix Of Other Beers From Arkells And Donnington
The Bath TavernBTDoom Bar, Brigstow Bitter and 6x
Cafe ReneCET
Cheltenham Motor ClubCNJHB, Gloucester Gold and Old Slug Porter
Dick Whittington, GloucesterDWGGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
The Five Mile HouseFMDBB, Landlord and Youngs Bitter
Fountain, GloucesterFOGGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
The Jolly BrewmasterJBGold, Tom Long and Butty Bach
The Linden Tree, GloucesterLTG
New InnNIGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
NelsonNSGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
The Rotunda TavernROBombadier, Tetley Cask and Bass
The RestorationRRN/AHaka and [[]]
Twelve Bells, CirencesterTBCGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
The Whitesmiths ArmsWG3B and Moonlight


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 Three Kings3KSuperbConnemara Gold, Hobsons Best, Butcombe Bitter and Market Street Special
The Adam and EveAEMoolight and Noel... And A Mix Of Other Beers From Arkells And Donnington
Anchor, BirminghamANBN/AVariousN/A
Beehive Inn, Bouncers LaneBBN/AProper Job and Tribute
The Bakers ArmsBCSuperb
The Brandy CaskBCPN/AWhistling Joe, Brandy Snapper and John BakerN/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/ANOT Meerkat Mild , Mad Goose, Doombar, Fourtyniner and Filly DriftN/A
Bag O Nails, BristolBNBN/ABroad Acres and BestN/A
The Bath TavernBTDoom Bar, Brigstow Bitter and 6x
The Blue Bell InnBUN/AN/A
Cheltenham Beer FestivalC4N/ALots!N/A
Beeston Castle HotelCBN/AN/A
Cafe ReneCET
The VineCJN/ASession IPA and IlluminationN/A
The Crown Hotel, Market DraytonCMN/AN/A
Cheltenham Motor ClubCNJHB, Gloucester Gold and Old Slug Porter
Cornubia, BristolCOBN/AHidden Pint, Hidden Quest, Hidden Spring, Hidden Pleasure and SiberiaN/A
The Cape of Good HopeCPN/AN/A
The CotswoldCWN/AHenry IPA, 6X and HorizonN/A
Cheltenham Cricket ClubCXN/AVariousN/A
Colston Yard, BristolCYBN/AN/A
The Dragon InnDIN/AN/A
Dick Whittington, GloucesterDWGGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
The Five Mile HouseFMDBB, Landlord and Youngs Bitter
Fountain, GloucesterFOGGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
Grain Barge, BristolGBBN/ASunrise, Stout, Red and ExhibitionN/A
George HotelGGN/A
The GreyhoundGHN/AAbbot and Best Mate
The Golden BallGLN/AN/A
The Hewlett ArmsHLN/AGem, Windrush Ale and Butcombe BitterN/A
The Jolly BrewmasterJBGold, Tom Long and Butty Bach
Salopian StarJMN/AGoldN/A
The Kemble Brewery InnKBN/AHereford Pale Ale and Gloucestershires Glory
The Kings HeadKHN/ALandlord, London Pride and HobGolbinN/A
Lamp Tavern, BirminghamLTBN/AVariousN/A
The Linden Tree, GloucesterLTG
Laze DazeLZN/ASaxon and JousterN/A
The Market TavernMAN/AGolden Bear, Lady Godiva, Kingmaker, Shakespear's County, Churchyard Bob and FalstaffN/A
Coach and Horses, Market DraytonMCN/ATheakstons Best and Theakstons MildN/A
Malvern Hills HotelMHBN/AHereford Pale Ale, Wye Valley Bitter, Black Pear, Gold and MagnetN/A
Kings Arms, Market DraytonMKN/AThin Ice, 6X and Ice QueenN/A
Morpeth ArmsMON/AN/A
The SwanMPN/AOriginal, Dark, Entire and BumbleholeN/A
Moon Under WaterMUN/AN/A
New InnNIGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
NelsonNSGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
Ye Olde Anchor InnOAN/AN/A
The SwanOHVery good365
Old Joint Stock, BirminghamOJBN/AChiswick, Discovery, London Pride and ESB And MoreN/A
The Old PloughOPBN/AN/A
The Old Spot, DursleyOSDN/AN/A
The Old White LionOWN/AN/A
The ParrotPAN/AN/A
The Plough InnPIN/AN/A
The Plough, PrestburyPLN/ADizzy Blonde, 6X and AtlanticN/A
The Plaisterers ArmsPSN/AN/A
The Royal Oak,PrestburyRKN/ALandlord, Gem and JHBN/A
The Red Lion, CrickladeRLCN/AN/A
The Red Lion Inn, Market DraytonRMPale, Slumbering Monk, Blonde and Green Monkey
The Rotunda TavernROBombadier, Tetley Cask and Bass
The RestorationRRN/AHaka and [[]]
The RetreatRTN/AGolden
The Stags Head Inn, Market DraytonSEN/ABitterN/A
The Suffolk ArmsSFGoodJouster, Abbot and Bitter
St. Georges VaultsSGN/ABrakspear and Old Speckled HenN/A
The Sun InnSIN/AN/A
The Star Inn & HotelSTUN/AN/A
The Sudeley ArmsSUN/ADeuchars IPA, Otter Bitter and London Pride
The SwanSWN/AN/A
TailorsTAN/AHorizon, 6X and JCBN/A
Twelve Bells, CirencesterTBCGolden Spring, Dark Star, Iron Horse, Best Bitter and McConnell's Irish Stout
The Feet Inn, TwyningTFN/AOriginal, Landlord and BombardierN/A
The Talbot Head HotelTHN/AN/A
The Talbot, Market DraytonTMN/ABitter, Porter, Best and Oxford GoldN/A
The Little Upton MuggeryUMN/AN/A
The VolunteerVON/AN/A
The William ChesterWC
The Whitesmiths ArmsWG3B and Moonlight
The White LionWLN/ABB, SB, Abbott and HoldensN/A
The White Lion, BristolWLBN/AN/A
Wellington, BirminghamWNBN/ABFG, Pig On The Wall and VariousN/A
Watershed, BristolWSBN/AOyster Stout, Beech Blonde and Honey BeerN/A
White Swan, BirminghamWTBN/ACocker HoopN/A
The White HartWWN/AN/A
White Horse and BowerXHN/AN/A
ZeroDegrees BristolZDBN/AN/A


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
Exmouth ArmsEXN/AN/ABath Road
Cheltenham
Gloucestershire
GL53 7LX
Five AllsFAN/ABath Road
Cheltenham
Gloucestershire
GL53 7ND

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> NP 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