<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}
.readOnly {background:[[ColorPalette::TertiaryPale]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity=60)';}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 0.3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0 0; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0;}
.wizardFooter .status {padding:0 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0 0 0.5em;}
.tab {margin:0 0 0 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0 0.25em; padding:0 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none !important;}
#displayArea {margin: 1em 1em 0em;}
noscript {display:none;} /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
}
/*}}}*/
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
<!--}}}-->
To get started with this blank [[TiddlyWiki]], you'll need to modify the following tiddlers:
* [[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* [[MainMenu]]: The menu (usually on the left)
* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
These [[InterfaceOptions]] for customising [[TiddlyWiki]] are saved in your browser

Your username for signing your edits. Write it as a [[WikiWord]] (eg [[JoeBloggs]])

<<option txtUserName>>
<<option chkSaveBackups>> [[SaveBackups]]
<<option chkAutoSave>> [[AutoSave]]
<<option chkRegExpSearch>> [[RegExpSearch]]
<<option chkCaseSensitiveSearch>> [[CaseSensitiveSearch]]
<<option chkAnimate>> [[EnableAnimations]]

----
Also see [[AdvancedOptions]]
<<importTiddlers>>
TiddlyTrains
a personal non-linear notebook about UK preserved railways
/*{{{*/
body { font-size: 100% }
.tagging { float: right }
.subtitle { font-size:0.75em; padding:0.4em 0; border-bottom:solid 1px #eee;}
.tiddler {margin-bottom: 1.8em;}
.tiddler .toolbar a { color:transparent; }
.selected .toolbar a { color:[[ColorPalette::TertiaryLight]]; }
#sidebar { background: [[ColorPalette::TertiaryPale]]; }
#sidebar .button { background: [[ColorPalette::TertiaryPale]]; 
	border: 1px solid [[ColorPalette::TertiaryPale]]; }
#sidebarTabs { background: [[ColorPalette::TertiaryPale]]; }
#sidebarOptions .sliderPanel {background:[[ColorPalette::TertiaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::TertiaryMid]];}
/*}}}*/
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='map' macro='staticMap zoom:14 size:512x512 maptype:hybrid'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<label>geo.lat:</label>
<div class='editor' macro='edit geo.lat'></div>
<label>geo.long:</label>
<div class='editor' macro='edit geo.long'></div>
<label>length:</label>
<div class='editor' macro='edit length'></div>
<label>year:</label>
<div class='editor' macro='edit year'></div>
<label>gauge:</label>
<div class='editor' macro='edit gauge'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
<!--}}}-->
Welcome to a personal notebook about UK Heritage Railways
[[Welcome]]
Welcome
/***
|''Name:''|AdaptorCommandsPlugin|
|''Description:''|Commands to access hosted TiddlyWiki data|
|''Author:''|Martin Budden (mjbudden (at) gmail (dot) com)|
|''Source:''|http://www.martinswiki.com/#AdaptorCommandsPlugin |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/MartinBudden/adaptors/AdaptorCommandsPlugin.js |
|''Version:''|0.5.15|
|''Date:''|Aug 23, 2007|
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]] |
|''~CoreVersion:''|2.2.0|
***/

//{{{
// Ensure that the plugin is only installed once.
if(!version.extensions.AdaptorCommandsPlugin) {
version.extensions.AdaptorCommandsPlugin = {installed:true};
function getServerType(fields)
{
	if(!fields)
		return null;
	var serverType = fields['server.type'];
	if(!serverType)
		serverType = fields['wikiformat'];
	if(!serverType)
		serverType = config.defaultCustomFields['server.type'];
	if(!serverType && typeof RevisionAdaptor != 'undefined' && fields.uuid)
		serverType = RevisionAdaptor.serverType;
	return serverType;
}

function invokeAdaptor(fnName,param1,param2,context,userParams,callback,fields)
{
	var serverType = getServerType(fields);
	if(!serverType)
		return null;
	var adaptor = new config.adaptors[serverType];
	if(!adaptor)
		return false;
	if(!config.adaptors[serverType].prototype[fnName])
		return false;
	adaptor.openHost(fields['server.host']);
	adaptor.openWorkspace(fields['server.workspace']);
	var ret = false;
	if(param1)
		ret = param2 ? adaptor[fnName](param1,param2,context,userParams,callback) : adaptor[fnName](param1,context,userParams,callback);
	else
		ret = adaptor[fnName](context,userParams,callback);
	
	//adaptor.close();
	//delete adaptor;
	return ret;
}

function isAdaptorFunctionSupported(fnName,fields)
{
	var serverType = getServerType(fields);
	if(!serverType || !config.adaptors[serverType])
		return false;
	if(!config.adaptors[serverType].isLocal && !fields['server.host'])
		return false;
	var fn = config.adaptors[serverType].prototype[fnName];
	return fn ? true : false;
}

config.commands.getTiddler = {};
merge(config.commands.getTiddler,{
	text: "get",
	tooltip:"Download this tiddler",
	readOnlyText: "get",
	readOnlyTooltip: "Download this tiddler",
	done: "Tiddler downloaded"
	});

config.commands.getTiddler.isEnabled = function(tiddler)
{
	return isAdaptorFunctionSupported('getTiddler',tiddler.fields);
};

config.commands.getTiddler.handler = function(event,src,title)
{
	var tiddler = store.fetchTiddler(title);
	if(tiddler) {
		var fields = tiddler.fields;
	} else {
		fields = String(document.getElementById(story.idPrefix + title).getAttribute("tiddlyFields"));
		fields = fields ? fields.decodeHashMap() : null;
	}
	return invokeAdaptor('getTiddler',title,null,null,null,config.commands.getTiddler.callback,fields);
};

config.commands.getTiddler.callback = function(context,userParams)
{
	if(context.status) {
		var tiddler = context.tiddler;
		store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields,true);
		story.refreshTiddler(tiddler.title,1,true);
		displayMessage(config.commands.getTiddler.done);
	} else {
		displayMessage(context.statusText);
	}
};

config.commands.putTiddler = {};
merge(config.commands.putTiddler,{
	text: "put",
	tooltip: "Upload this tiddler",
	hideReadOnly: true,
	done: "Tiddler uploaded"
	});

config.commands.putTiddler.isEnabled = function(tiddler)
{
	return tiddler && tiddler.isTouched() && isAdaptorFunctionSupported('putTiddler',tiddler.fields);
};

config.commands.putTiddler.handler = function(event,src,title)
{
	var tiddler = store.fetchTiddler(title);
	if(!tiddler)
		return false;
	return invokeAdaptor('putTiddler',tiddler,null,null,null,config.commands.putTiddler.callback,tiddler.fields);
};

config.commands.putTiddler.callback = function(context,userParams)
{
	if(context.status) {
		store.fetchTiddler(context.title).clearChangeCount();
		displayMessage(config.commands.putTiddler.done);
	} else {
		displayMessage(context.statusText);
	}
};

config.commands.revisions = {};
merge(config.commands.revisions,{
	text: "revisions",
	tooltip: "View another revision of this tiddler",
	loading: "loading...",
	done: "Revision downloaded",
	revisionTooltip: "View this revision",
	popupNone: "No revisions",
	revisionTemplate: "%0 r:%1"
	});

config.commands.revisions.isEnabled = function(tiddler)
{
	return isAdaptorFunctionSupported('getTiddlerRevisionList',tiddler.fields);
};

config.commands.revisions.handler = function(event,src,title)
{
	var tiddler = store.fetchTiddler(title);
	var userParams = {};
	userParams.tiddler = tiddler;
	userParams.src = src;
	userParams.dateFormat = 'YYYY mmm 0DD 0hh:0mm';
	var revisionLimit = 10;
	if(!invokeAdaptor('getTiddlerRevisionList',title,revisionLimit,null,userParams,config.commands.revisions.callback,tiddler.fields))
		return false;
	event.cancelBubble = true;
	if(event.stopPropagation)
		event.stopPropagation();
	return true;
};

config.commands.revisions.callback = function(context,userParams)
// The revisions are returned as tiddlers in the context.revisions array
{
	var revisions = context.revisions;
	popup = Popup.create(userParams.src);
	Popup.show(popup,false);
	if(revisions.length==0) {
		createTiddlyText(createTiddlyElement(popup,'li',null,'disabled'),config.commands.revisions.popupNone);
	} else {
		revisions.sort(function(a,b) {return a.modified < b.modified ? +1 : -1;});
		for(var i=0; i<revisions.length; i++) {
			var tiddler = revisions[i];
			var modified = tiddler.modified.formatString(context.dateFormat||userParams.dateFormat);
			var revision = tiddler.fields['server.page.revision'];
			var btn = createTiddlyButton(createTiddlyElement(popup,'li'),
					config.commands.revisions.revisionTemplate.format([modified,revision,tiddler.modifier]),
					tiddler.text||config.commands.revisions.revisionTooltip,
					function() {
						config.commands.revisions.getTiddlerRevision(this.getAttribute('tiddlerTitle'),this.getAttribute('tiddlerModified'),this.getAttribute('tiddlerRevision'));
						return false;
						},
					'tiddlyLinkExisting tiddlyLink');
			btn.setAttribute('tiddlerTitle',userParams.tiddler.title);
			btn.setAttribute('tiddlerRevision',revision);
			btn.setAttribute('tiddlerModified',tiddler.modified.convertToYYYYMMDDHHMM());
			if(userParams.tiddler.fields['server.page.revision'] == revision || (!userParams.tiddler.fields['server.page.revision'] && i==0))
				btn.className = 'revisionCurrent';
		}
	}
};

config.commands.revisions.getTiddlerRevision = function(title,modified,revision)
{
	var tiddler = store.fetchTiddler(title);
	var context = {modified:modified};
	return invokeAdaptor('getTiddlerRevision',title,revision,context,null,config.commands.revisions.getTiddlerRevisionCallback,tiddler.fields);
};

config.commands.revisions.getTiddlerRevisionCallback = function(context,userParams)
{
	if(context.status) {
		var tiddler = context.tiddler;
		//store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
		store.addTiddler(tiddler);
		store.notify(tiddler.title,true);
		story.refreshTiddler(tiddler.title,1,true);
		displayMessage(config.commands.revisions.done);
	} else {
		displayMessage(context.statusText);
	}
};

config.commands.saveTiddlerAndPut = {};
merge(config.commands.saveTiddlerAndPut,{
	text: "done",
	tooltip: "Save this tiddler and upload",
	hideReadOnly: true,
	done: "Tiddler uploaded"
	});

config.commands.saveTiddlerAndPut.handler = function(event,src,title)
{
	config.commands.putTiddlerRevision.handler(event,src,title);// save the old tiddler as a revision
	var newTitle = story.saveTiddler(title,event.shiftKey);
	if(newTitle)
		story.displayTiddler(null,newTitle);
	return config.commands.putTiddler.handler(event,src,newTitle);
};

config.commands.saveTiddlerHosted = {};
merge(config.commands.saveTiddlerHosted,{
	text: "done",
	tooltip: "Save changes to this tiddler",
	hideReadOnly: true,
	done: "done"
	});
	
config.commands.saveTiddlerHosted.handler = function(event,src,title)
{
	var tiddler = store.fetchTiddler(title);
	if(!tiddler)
		return false;
	return invokeAdaptor('saveTiddlerHosted',tiddler,null,null,null,config.commands.saveTiddlerHosted.callback,tiddler.fields);
};

config.commands.saveTiddlerHosted.callback = function(context,userParams)
{
	if(context.status) {
		displayMessage(config.commands.saveTiddlerHosted.done);
	} else {
		displayMessage(context.statusText);
	}
};

config.commands.deleteTiddlerHosted = {};
merge(config.commands.deleteTiddlerHosted,{
	text: "delete",
	tooltip: "Delete this tiddler",
	warning: "Are you sure you want to delete '%0'?",
	hideReadOnly: true,
	done: "done"
	});
	
config.commands.deleteTiddlerHosted.handler = function(event,src,title)
{
	var tiddler = store.fetchTiddler(title);
	if(!tiddler)
		return false;
	return invokeAdaptor('deleteTiddler',title,null,null,null,config.commands.deleteTiddlerHosted.callback,tiddler.fields);
};

config.commands.deleteTiddlerHosted.callback = function(context,userParams)
{
	if(context.status) {
		displayMessage(config.commands.saveTiddlerHosted.done);
	} else {
		displayMessage(context.statusText);
	}
};

config.commands.diff = {};
merge(config.commands.diff,{
	text: "diff",
	tooltip: "View tiddler changes",
	done: "done",
	diffTooltip: "View this diff",
	popupNone: "No changes",
	diffTemplate: "%0 r:%1"
	});

config.commands.diff.isEnabled = function(tiddler)
{
	return isAdaptorFunctionSupported('getTiddlerDiff',tiddler.fields);
};

config.commands.diff.handler = function(event,src,title)
{
	var tiddler = store.fetchTiddler(title);
	var userParams = {tiddler:tiddler,src:src,dateFormat:'YYYY mmm 0DD 0hh:0mm'};
	var revisionLimit = 10;
	if(!invokeAdaptor('getTiddlerRevisionList',title,revisionLimit,null,userParams,config.commands.diff.callback,tiddler.fields))
		return false;
	event.cancelBubble = true;
	if(event.stopPropagation)
		event.stopPropagation();
	return true;
};

config.commands.diff.callback = function(context,userParams)
// The revisions are returned as tiddlers in the context.revisions array
{
	var revisions = context.revisions;
	popup = Popup.create(userParams.src);
	Popup.show(popup,false);
	if(revisions.length==0) {
		createTiddlyText(createTiddlyElement(popup,'li',null,'disabled'),config.commands.revisions.popupNone);
	} else {
		revisions.sort(function(a,b) {return a.modified < b.modified ? +1 : -1;});
		for(var i=0; i<revisions.length; i++) {
			var tiddler = revisions[i];
			var modified = tiddler.modified.formatString(context.dateFormat||userParams.dateFormat);
			var revision = tiddler.fields['server.page.revision'];
			var btn = createTiddlyButton(createTiddlyElement(popup,'li'),
					config.commands.diff.diffTemplate.format([modified,revision,tiddler.modifier]),
					tiddler.text||config.commands.diff.diffTooltip,
					function() {
						config.commands.diff.getTiddlerDiff(this.getAttribute('tiddlerTitle'),userParams.src,this.getAttribute('tiddlerRevision'),null);
						return false;
						},
					'tiddlyLinkExisting tiddlyLink');
			btn.setAttribute('tiddlerTitle',userParams.tiddler.title);
			btn.setAttribute('tiddlerRevision',revision);
			btn.setAttribute('tiddlerModified',tiddler.modified.convertToYYYYMMDDHHMM());
			if(userParams.tiddler.fields['server.page.revision'] == revision || (!userParams.tiddler.fields['server.page.revision'] && i==0))
				btn.className = 'revisionCurrent';
		}
	}
};

config.commands.diff.getTiddlerDiff = function(title,src,rev1,rev2)
{
	var tiddler = store.fetchTiddler(title);
	var userParams = {src:src};
	var context = {rev1:rev1,rev2:rev2};
//	var context = {};
	return invokeAdaptor('getTiddlerDiff',title,null,context,userParams,config.commands.diff.getTiddlerDiffCallback,tiddler.fields);
};

config.commands.diff.getTiddlerDiffCallback = function(context,userParams)
{
	console.log("config.commands.diff.getTiddlerDiffCallback:"+context.diff);
	var diff = context.diff;
	popup = Popup.create(userParams.src);
	Popup.show(popup,false);
	if(diff.length==0) {
		createTiddlyText(createTiddlyElement(popup,'li',null,'disabled'),config.commands.diff.popupNone);
	} else {
		for(var i=0; i<diff.length; i++) {
			createTiddlyText(createTiddlyElement(popup,'li'),diff[i]);
		}
	}
};

}//# end of 'install only once'
//}}}
/***
|''Name:''|AdaptorMacrosPlugin|
|''Description:''|Commands to access hosted TiddlyWiki data|
|''Author:''|Martin Budden (mjbudden (at) gmail (dot) com)|
|''Source:''|http://www.martinswiki.com/#AdaptorMacrosPlugin |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/MartinBudden/adaptors/AdaptorMacrosPlugin.js |
|''Version:''|0.3.8|
|''Date:''|Aug 23, 2007|
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]] |
|''~CoreVersion:''|2.2.0|
***/

//{{{
// Ensure that the plugin is only installed once.
if(!version.extensions.AdaptorMacrosPlugin) {
version.extensions.AdaptorMacrosPlugin = {installed:true};

// Return an array of tiddler titles that are in the given workspace on the host
TiddlyWiki.prototype.getHostedTiddlers = function(host,workspace)
{
	var results = [];
	if(!this.hostedTiddlers || !this.hostedTiddlers[host])
		return results;
	var tiddlers = this.hostedTiddlers[host][workspace];
	if(tiddlers) {
		for(var i=0; i<tiddlers.length; i++) {
			results.push(tiddlers[i].title);
		}
	}
	return results;
};

config.macros.viewTiddlerFields = {};
config.macros.viewTiddlerFields.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	if(tiddler instanceof Tiddler) {
		var value = '';
		var comma = '';
		for(i in tiddler.fields) {
			if (!i.match(/^temp[\._]/)) {
				value += comma + i + '=' + tiddler.fields[i];
				comma = ', ';
			}
		}
		if(tiddler.created)
			value += comma + 'created=' + tiddler.created.convertToYYYYMMDDHHMM();
		if(tiddler.modified)
			value += ', modified=' + tiddler.modified.convertToYYYYMMDDHHMM();
		if(tiddler.modifier)
			value += ', modifier=' + tiddler.modifier;
		value += ', touched=' + (tiddler.isTouched() ? 'true' : 'false');
		highlightify(value,place,highlightHack,tiddler);
	}
};

config.macros.list.updatedOffline = {};
config.macros.list.updatedOffline.handler = function(params)
{
	var results = [];
	store.forEachTiddler(function(title,tiddler) {
		if(tiddler.fields['server.host'] && tiddler.isTouched())
			results.push(tiddler);
		});
	results.sort();
	return results;
};

config.macros.list.workspaceTiddlers = {};
config.macros.list.workspaceTiddlers.prompt = "List Tiddlers in the workspace";
config.macros.list.workspaceTiddlers.handler = function(params,wikifier,paramString,tiddler)
{
	var customFields = getParam(params,'fields',false);
	if(!customFields)
		customFields = config.defaultCustomFields;
	return store.getHostedTiddlers(customFields['server.host'],customFields['server.workspace']);
};

config.macros.updateWorkspaceTiddlerList = {};
merge(config.macros.updateWorkspaceTiddlerList,{
	label: "update tiddler list",
	prompt: "Update list of tiddlers in workspace",
	done: "List updated"});

config.macros.updateWorkspaceTiddlerList.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	params = paramString.parseParams('anon',null,true,false,false);
	var customFields = getParam(params,'fields',false);
	if(!customFields)
		customFields = String.encodeHashMap(config.defaultCustomFields);
	var btn = createTiddlyButton(place,this.label,this.prompt,this.onClick);
	btn.setAttribute('customFields',customFields);
	btn.setAttribute('title',tiddler.title);
};

config.macros.updateWorkspaceTiddlerList.onClick = function(e)
{
	clearMessage();
	var customFields = this.getAttribute("customFields");
	var fields = customFields.decodeHashMap();
	var userParams = {host:fields['server.host'],workspace:fields['server.workspace'],title:this.getAttribute("title")};
	return invokeAdaptor('getTiddlerList',null,null,null,userParams,config.macros.updateWorkspaceTiddlerList.callback,fields);
};

config.macros.updateWorkspaceTiddlerList.callback = function(context,userParams)
{
	if(context.status) {
		if(!store.hostedTiddlers)
			store.hostedTiddlers = {};
		if(!store.hostedTiddlers[userParams.host])
			store.hostedTiddlers[userParams.host] = {};
		store.hostedTiddlers[userParams.host][userParams.workspace] = context.tiddlers;
		displayMessage(config.macros.updateWorkspaceTiddlerList.done);
		story.displayTiddler(null,userParams.title);
		story.refreshTiddler(userParams.title,1,true);
	} else {
		displayMessage(context.statusText);
	}
};


config.macros.updateWorkspaceList = {};
merge(config.macros.updateWorkspaceList,{
	label: "update workspace list",
	prompt: "Update list of workspaces",
	done: "List updated"});

config.macros.updateWorkspaceList.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	params = paramString.parseParams('anon',null,true,false,false);
	var customFields = getParam(params,'fields',false);
	if(!customFields)
		customFields = String.encodeHashMap(config.defaultCustomFields);
	var btn = createTiddlyButton(place,this.label,this.prompt,this.onClick);
	btn.setAttribute('customFields',customFields);
	btn.setAttribute('title',tiddler.title);
};

config.macros.updateWorkspaceList.onClick = function(e)
{
	clearMessage();
	var customFields = this.getAttribute("customFields");
	var fields = customFields.decodeHashMap();
	var userParams = {host:fields['server.host'],callback:config.macros.updateWorkspaceList.callback};
	return invokeAdaptor('getWorkspaceList',context,fields);
};

config.macros.updateWorkspaceList.callback = function(context,userParams)
{
	if(context.status) {
		displayMessage(config.macros.updateWorkspaceList.done);
		for(var i=0; i<context.workspaces.length; i++) {
			displayMessage("workspace:"+context.workspaces[i]);
		}
	} else {
		displayMessage(context.statusText);
	}
};

} // end of 'install only once'
//}}}
/***
|''Name:''|DisableWikiLinksPlugin|
|''Description:''|Allows you to disable TiddlyWiki's automatic linking of WikiWords|
|''Author:''|Martin Budden (mjbudden (at) gmail (dot) com)|
|''Source:''|http://www.martinswiki.com/#DisableWikiLinksPlugin |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/MartinBudden/plugins/DisableWikiLinksPlugin.js |
|''Version:''|0.1.3|
|''Date:''|Aug 5, 2006|
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]] |
|''~CoreVersion:''|2.1.0|

|''Disable WikiLinks''|<<option chkDisableWikiLinks>>|

***/

//{{{
// Ensure that the DisableWikiLinksPlugin is only installed once.
if(!version.extensions.DisableWikiLinksPlugin) {
version.extensions.DisableWikiLinksPlugin = {installed:true};

if(version.major < 2 || (version.major == 2 && version.minor < 1))
	{alertAndThrow('DisableWikiLinksPlugin requires TiddlyWiki 2.1 or newer.');}

if (config.options.chkDisableWikiLinks==undefined)
	{config.options.chkDisableWikiLinks = false;}

Tiddler.prototype.autoLinkWikiWords = function()
{
	if(config.options.chkDisableWikiLinks==true)
		{return false;}
	return !this.isTagged('systemConfig') && !this.isTagged('excludeMissing');
};

} // end of 'install only once'
//}}}
/***
|''Name:''|FadingMessagesPlugin|
|''Description:''|Automatically clear a displayed message after an interval |
|''Author:''|PaulDowney (psd (at) osmosoft (dot) com) |
|''Source:''|http://whatfettle.com/2008/07/FadingMessagesPlugin/ |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/PaulDowney/plugins/FadingMessagesPlugin/ |
|''Version:''|0.2|
|''License:''|[[BSD License|http://www.opensource.org/licenses/bsd-license.php]] |
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''~CoreVersion:''|2.4|
|''Overrides:''|displayMessage|
|''Requires:''|WikifiedMessagesPlugin|
!!Documentation
Displayed messages automatically fade away after a short interval. 
!!Options
|<<option txtFadingMessagesTimeout>>|<<message config.optionsDesc.txtFadingMessagesTimeout>>|
|<<option chkAnimate>>|<<message config.optionsDesc.chkAnimate>>|
!!Code
***/
//{{{
if(!version.extensions.FadingMessagesPlugin) {
version.extensions.FadingMessagesPlugin = {installed:true};

	config.options.txtFadingMessagesTimeout = 5;
	config.optionsDesc.txtFadingMessagesTimeout = "seconds before a displayed message clears itself";

	config.animDurationFade = 900;

	config.extensions.FadingMessages = {
		Fader: function(e,done)
		{
			e.style.overflow = 'hidden';
			e.style.display = 'block';
			var p = [];
			p.push({style: 'display', atEnd: 'none'});
			p.push({style: 'opacity', start: 1, end: 0, template: '%0'});
			p.push({style: 'filter', start: 100, end: 0, template: 'alpha(opacity:%0)'});
			return new Morpher(e,config.animDurationFade,p,done);
		},  
		clearMessageBox: function(e)
		{
			try { removeNode(e); } catch(ex) {}
			var msgArea = document.getElementById("messageArea");
			var n = msgArea.getElementsByTagName('div');
			if(!(n&&n.length)){
				msgArea.style.display = "none";
			}
		},
		fadeMessageBox: function(e)
		{
			var me = config.extensions.FadingMessages;
			if(config.options.chkAnimate && anim){
				anim.startAnimating(new me.Fader(e,me.clearMessageBox));
			}else{
				me.clearMessageBox(e);
			}
		},
		createClearAllButton: function(e)
		{
			return null;
		},
		createClearMessageButton: function(e)
		{
			var me = config.extensions.FadingMessages;
			return createTiddlyButton(createTiddlyElement(e,"span",null,"messageClear"),
				"×","",
				function(){me.clearMessageBox(e);});
		},
		_displayMessage: displayMessage,
		displayMessage: function(text,linkText)
		{
			var me = config.extensions.FadingMessages;
			var e = me._displayMessage(text,linkText);
			if(e){
				window.setTimeout(function(){me.fadeMessageBox(e);},config.options.txtFadingMessagesTimeout*1000);
			}
			return e;
		}
	};

	displayMessage = config.extensions.FadingMessages.displayMessage;
	config.extensions.WikifiedMessages.createClearMessageButton = config.extensions.FadingMessages.createClearMessageButton;
	config.extensions.WikifiedMessages.createClearAllButton = config.extensions.FadingMessages.createClearAllButton;
}
//}}}
/***
|''Name:''|FieldsEditorPlugin|
|''Description:''|//create//, //edit//, //view// and //delete// commands in toolbar <<toolbar fields>>.|
|''Version:''|1.0.2|
|''Date:''|Dec 21,2007|
|''Source:''|http://visualtw.ouvaton.org/VisualTW.html|
|''Author:''|Pascal Collin|
|''License:''|[[BSD open source license|License]]|
|''~CoreVersion:''|2.2.0|
|''Browser:''|Firefox 2.0; InternetExplorer 6.0, others|
!Demo:
On [[homepage|http://visualtw.ouvaton.org/VisualTW.html]], see [[FieldEditor example]]
!Installation:
*import this tiddler from [[homepage|http://visualtw.ouvaton.org/VisualTW.html]] (tagged as systemConfig)
*save and reload
*optionnaly : add the following css text in your StyleSheet : {{{#popup tr.fieldTableRow td {padding:1px 3px 1px 3px;}}}}
!Code
***/

//{{{

config.commands.fields.handlePopup = function(popup,title) {
	var tiddler = store.fetchTiddler(title);
	if(!tiddler)
		return;
	var fields = {};
	store.forEachField(tiddler,function(tiddler,fieldName,value) {fields[fieldName] = value;},true);
	var items = [];
	for(var t in fields) {
		var editCommand = "<<untiddledCall editFieldDialog "+escape(title)+" "+escape(t)+">>";
		var deleteCommand = "<<untiddledCall deleteField "+escape(title)+" "+escape(t)+">>";
		var renameCommand = "<<untiddledCall renameField "+escape(title)+" "+escape(t)+">>";
		items.push({field: t,value: fields[t], actions: editCommand+renameCommand+deleteCommand});
	}
	items.sort(function(a,b) {return a.field < b.field ? -1 : (a.field == b.field ? 0 : +1);});
	var createNewCommand = "<<untiddledCall createField "+escape(title)+">>";
	items.push({field : "", value : "", actions:createNewCommand });
	if(items.length > 0)
		ListView.create(popup,items,this.listViewTemplate);
	else
		createTiddlyElement(popup,"div",null,null,this.emptyText);
}

config.commands.fields.listViewTemplate = {
	columns: [
		{name: 'Field', field: 'field', title: "Field", type: 'String'},
		{name: 'Actions', field: 'actions', title: "Actions", type: 'WikiText'},
		{name: 'Value', field: 'value', title: "Value", type: 'WikiText'}
	],
	rowClasses: [
			{className: 'fieldTableRow', field: 'actions'}
	],
	buttons: [	//can't use button for selected then delete, because click on checkbox will hide the popup
	]
}

config.macros.untiddledCall = {  // when called from listview, tiddler is unset, so we need to pass tiddler as parameter
	handler : function(place,macroName,params,wikifier,paramString) {
		var macroName = params.shift();
		if (macroName) var macro = config.macros[macroName];
		var title = params.shift();
		if (title) var tiddler = store.getTiddler(unescape(title));
		if (macro) macro.handler(place,macroName,params,wikifier,paramString,tiddler);		
	}
}

config.macros.deleteField = {
	handler : function(place,macroName,params,wikifier,paramString,tiddler) {
		if(!readOnly && params[0]) {
			fieldName = unescape(params[0]);
			var btn = createTiddlyButton(place,"delete", "delete "+fieldName,this.onClickDeleteField);
			btn.setAttribute("title",tiddler.title);
			btn.setAttribute("fieldName", fieldName);
		}
	},
	onClickDeleteField : function() {
		var title=this.getAttribute("title");
		var fieldName=this.getAttribute("fieldName");
		var tiddler = store.getTiddler(title);
		if (tiddler && fieldName && confirm("delete field " + fieldName+" from " + title +" tiddler ?")) {
			delete tiddler.fields[fieldName];
			store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
			story.refreshTiddler(title,"ViewTemplate",true);
		}
		return false;
	}
}

config.macros.createField = {
	handler : function(place,macroName,params,wikifier,paramString,tiddler) {
		if(!readOnly) {
			var btn = createTiddlyButton(place,"create new", "create a new field",this.onClickCreateField);
			btn.setAttribute("title",tiddler.title);
		}
	},
	onClickCreateField : function() {
		var title=this.getAttribute("title");
		var tiddler = store.getTiddler(title);
		if (tiddler) {
			var fieldName = prompt("Field name","");
			if (store.getValue(tiddler,fieldName)) {
				window.alert("This field already exists.");
			}
			else if (fieldName) {
				var v = prompt("Field value","");
				tiddler.fields[fieldName]=v;
				store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
				story.refreshTiddler(title,"ViewTemplate",true);
			}
		}
		return false;
	}
}

config.macros.editFieldDialog = {
	handler : function(place,macroName,params,wikifier,paramString,tiddler) {
		if(!readOnly && params[0]) {
			fieldName = unescape(params[0]);
			var btn = createTiddlyButton(place,"edit", "edit this field",this.onClickEditFieldDialog);
			btn.setAttribute("title",tiddler.title);
			btn.setAttribute("fieldName", fieldName);
		}
	},
	onClickEditFieldDialog : function() {
		var title=this.getAttribute("title");
		var tiddler = store.getTiddler(title);
		var fieldName=this.getAttribute("fieldName");
		if (tiddler && fieldName) {
			var value = tiddler.fields[fieldName];
			value = value ? value : "";
			var lines = value.match(/\n/mg);
			lines = lines ? true : false;
			if (!lines || confirm("This field contains more than one line. Only the first line will be kept if you edit it here. Proceed ?")) {
				var v = prompt("Field value",value);
				tiddler.fields[fieldName]=v;
				store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
				story.refreshTiddler(title,"ViewTemplate",true);
			}
		}
		return false;
	}
}

config.macros.renameField = {
	handler : function(place,macroName,params,wikifier,paramString,tiddler) {
		if(!readOnly && params[0]) {
			fieldName = unescape(params[0]);
			var btn = createTiddlyButton(place,"rename", "rename "+fieldName,this.onClickRenameField);
			btn.setAttribute("title",tiddler.title);
			btn.setAttribute("fieldName", fieldName);
		}
	},
	onClickRenameField : function() {
		var title=this.getAttribute("title");
		var fieldName=this.getAttribute("fieldName");
		var tiddler = store.getTiddler(title);
		if (tiddler && fieldName) {
			var newName = prompt("Rename " + fieldName + " as ?", fieldName);
			if (newName) {
				tiddler.fields[newName]=tiddler.fields[fieldName];
				delete tiddler.fields[fieldName];
				store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
				story.refreshTiddler(title,"ViewTemplate",true);
			}
		}
		return false;
	}
}

config.shadowTiddlers.StyleSheetFieldsEditor = "/*{{{*/\n";
config.shadowTiddlers.StyleSheetFieldsEditor += ".fieldTableRow td {padding : 1px 3px}\n";
config.shadowTiddlers.StyleSheetFieldsEditor += ".fieldTableRow .button {border:0; padding : 0 0.2em}\n";
config.shadowTiddlers.StyleSheetFieldsEditor +="/*}}}*/";
store.addNotification("StyleSheetFieldsEditor", refreshStyles);

//}}}
/***
|''Name:''|MediaWikiAdaptorPlugin|
|''Description:''|Adaptor for moving and converting data from MediaWikis|
|''Author:''|Martin Budden (mjbudden (at) gmail (dot) com)|
|''Source:''|http://www.martinswiki.com/#MediaWikiAdaptorPlugin |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/MartinBudden/adaptors/MediaWikiAdaptorPlugin.js |
|''Version:''|0.8.14|
|''Date:''|Jul 27, 2007|
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]] |
|''~CoreVersion:''|2.4.1|

|''Max number of tiddlers to download''|<<option txtMediaWikiAdaptorLimit>>|


MediaWiki REST documentation is at:
http://meta.wikimedia.org/w/api.php
http://meta.wikimedia.org/w/query.php

''For debug:''
|''Default MediaWiki username''|<<option txtMediaWikiUsername>>|
|''Default MediaWiki password''|<<option txtMediaWikiPassword>>|

***/
//{{{
if(!config.options.txtMediaWikiUsername)
	{config.options.txtMediaWikiUsername = '';}
if(!config.options.txtMediaWikiPassword)
	{config.options.txtMediaWikiPassword = '';}
//}}}

//{{{
if(!config.adaptors.mediawiki) {

if(config.options.txtMediaWikiAdaptorLimit == undefined)
	{config.options.txtMediaWikiAdaptorLimit = '500';}


config.adaptors.mediawiki = function() {};

(function(adaptor) {

adaptor.prototype = new AdaptorBase();

adaptor.serverType = 'mediawiki';
adaptor.serverParsingErrorMessage = "Error parsing result from server";
adaptor.errorInFunctionMessage = "Error in function MediaWikiAdaptor.%0";

adaptor.doHttpGET = function(uri,callback,params,headers,data,contentType,username,password)
{
	return httpReq('GET',uri,callback,params,headers,data,contentType,username,password);
};

adaptor.doHttpPOST = function(uri,callback,params,headers,data,contentType,username,password)
{
	return httpReq('POST',uri,callback,params,headers,data,contentType,username,password);
};

adaptor.minHostName = function(host)
{
	return host ? host.replace(/^http:\/\//,'').replace(/\/$/,'') : '';
};

adaptor.normalizedTitle = function(title)
{
	var n = title.charAt(0).toUpperCase() + title.substr(1);
	return n.replace(/\s/g,'_');
};

adaptor.dateFromTimestamp = function(timestamp)
// Convert a MediaWiki timestamp in ISO 8601 (YYYY-MM-DDThh:mm:ssZ)  format into a JavaScript Date object
{
	var dt = timestamp;
	return new Date(Date.UTC(dt.substr(0,4),dt.substr(5,2)-1,dt.substr(8,2),dt.substr(11,2),dt.substr(14,2)));
};

adaptor.anyChild = function(obj)
{
	for(var key in obj) {
		if(typeof obj[key]!='function')
			return obj[key];
	}
	return null;
};


adaptor.prototype.complete = function(context,fn)
{
	context.complete = fn;
	var ret;
	if(context.sessionToken) {
		ret = context.complete(context,context.userParams);
	} else {
		ret = this.login(context);
	}
	return ret;
};

adaptor.prototype.login = function(context)
{
	var host = this.fullHostName(context.host);
	var uriTemplate = '%0/api.php?action=login&format=json&lgname=%1&lgpassword=%2';
	var uri = uriTemplate.format([host,escape(config.options.txtMediaWikiUsername),escape(config.options.txtMediaWikiPassword)]);

	var req = adaptor.doHttpPOST(uri,adaptor.loginCallback,context,{"Content-Length":"1"}," ");
	return typeof req == 'string' ? req : true;
};


adaptor.loginCallback = function(status,context,responseText,uri,xhr)
{
	if(status) {
		try {
			eval('var info=' + responseText);
		} catch (ex) {
			context.statusText = exceptionText(ex,adaptor.serverParsingErrorMessage);
			if(context.complete)
				context.complete(context,context.userParams);
			return;
		}
		context.status = true;
		context.sessionToken = info.login.lgtoken;
		if(context.complete)
			context.complete(context,context.userParams);
	} else {
		context.status = false;
		context.statusText = xhr.statusText;
		if(context.callback)
			context.callback(context,context.userParams);
	}
};

adaptor.getWorkspaceId = function(workspace)
{
	var workspaces = {
		"media": -2, "special":-1,
		"":0, "talk":1,"user":2,"user talk":3,"meta":4,"meta talk":5,"image":6,"image talk":7,
		"mediawiki":8,"mediawiki talk":9,"template":10,"template talk":11,"help":12,"help talk":13,
		"category":14,"category talk":15};
	workspace = workspace.toLowerCase();
	var id = workspaces[workspace];
	if(!id) {
		if(workspace=="" || workspace=="main")
			id = 0;
		else if(workspace.lastIndexOf("talk") != -1)
			id = 5;
		else
			id = 4;
	}
	return id;
};

adaptor.prototype.openWorkspace = function(workspace,context,userParams,callback)
{
	if(!workspace)
		workspace = "";
	this.workspace = workspace;
	this.workspaceId = null;
	context = this.setContext(context,userParams,callback);
	if(workspace) {
		if(context.workspaces) {
			for(var i=0;i<context.workspaces.length;i++) {
				if(context.workspaces[i].name == workspace) {
					this.workspaceId = context.workspaces[i].id;
					break;
				}
			}
		} else {
			workspace = workspace.toLowerCase();
			this.workspaceId = adaptor.getWorkspaceId(workspace);
		}
	}
	if(!this.workspaceId) {
		if(workspace=="" || workspace.toLowerCase()=="main")
			this.workspaceId = 0;
		else if(workspace.lastIndexOf("talk") != -1)
			this.workspaceId = 5;
		else
			this.workspaceId = 4;
	}
	if(context.callback) {
		context.status = true;
		window.setTimeout(function() {callback(context,userParams);},0);
	}
	return true;
};

adaptor.prototype.getWorkspaceList = function(context,userParams,callback)
{
	context = this.setContext(context,userParams,callback);
	if(context.workspace) {
		context.status = true;
		context.workspaces = [{name:context.workspace,title:context.workspace}];
		if(context.callback)
			window.setTimeout(function() {callback(context,userParams);},0);
		return true;
	}
	var uriTemplate = '%0/api.php?format=json&action=query&meta=siteinfo&siprop=namespaces';
	var uri = uriTemplate.format([context.host]);
	var req = adaptor.doHttpGET(uri,adaptor.getWorkspaceListCallback,context);
	return typeof req == 'string' ? req : true;
};


adaptor.getWorkspaceListCallback = function(status,context,responseText,uri,xhr)
{
	context.status = false;
	if(status) {
		try {
			eval('var info=' + responseText);
		} catch (ex) {
			context.statusText = exceptionText(ex,adaptor.serverParsingErrorMessage);
			if(context.callback)
				context.callback(context,context.userParams);
			return;
		}
		var namespaces = info.query.namespaces;
		var list = [];
		for(var i in namespaces) {
			var item = {};
			item.id = namespaces[i]['id'];
			item.title = namespaces[i]['*'];
			item.name = item.title;
			list.push(item);
		}
		context.workspaces = list;
		context.status = true;
	} else {
		context.statusText = xhr.statusText;
		context.statusCode = xhr.status;
	}
	if(context.callback)
		context.callback(context,context.userParams);
};

adaptor.prototype.getTiddlerList = function(context,userParams,callback,filter)
// get a list of the tiddlers in the current workspace
{
	context = this.setContext(context,userParams,callback);
	if(!context.filter)
		context.filter = filter;

	context.tiddlers = [];
	context.uri = null;
	var host = this.fullHostName(context.host);
	if(!context.tiddlerLimit)
		context.tiddlerLimit = !config.options.txtMediaWikiAdaptorLimit ? config.maxTiddlerImportCount : config.options.txtMediaWikiAdaptorLimit;
	context.tiddlerLimit = parseInt(context.tiddlerLimit,10);
	var limit = context.tiddlerLimit;
	if(limit>500)
		limit = 500;
	filter = context.filter;
	if(host.indexOf('wikipedia.org')!=-1) {
		if(!filter) {
			filter = '[template[Featured_article]]';
		}
	}
	if(filter) {
		var re = /\[(\w+)\[([ \w\.\:]+)\]\]/;
		var match = re.exec(filter);
		if(match) {
			var filterParams = adaptor.normalizedTitle(match[2]);
			switch(match[1]) {
			case 'tag':
				context.responseType = 'query.categorymembers';
				var uriTemplate = '%0/api.php?format=json&action=query&list=categorymembers&cmnamespace=%1&cmlimit=%2&cmtitle=Category:%3';
				break;
			case 'template':
				context.responseType = 'query.embeddedin';
				uriTemplate = '%0/api.php?format=json&action=query&list=embeddedin&einamespace=%1&eititle=Template:%3';
				if(limit)
					uriTemplate += '&eilimit=%2';
				break;
			case 'wikipedia':
				context.responseType = 'query.embeddedin';
				uriTemplate = '%0/api.php?format=json&action=query&list=embeddedin&einamespace=1&eititle=Wikipedia:%3';
				if(limit)
					uriTemplate += '&eilimit=%2';
				break;
			default:
				break;
			}
		} else {
			var params = filter.parseParams('anon',null,false);
			for(var i=1; i<params.length; i++) {
				var tiddler = new Tiddler(params[i].value);
				tiddler.fields.workspaceId = this.workspaceId;
				context.tiddlers.push(tiddler);
			}
			context.status = true;
			if(context.callback)
				window.setTimeout(function() {callback(context,userParams);},0);
			return true;
		}
	} else {
		context.responseType = 'query.pages';
		uriTemplate = '%0/api.php?format=json&action=query&generator=allpages&gapfilterredir=nonredirects&gapfrom=%4&prop=info';
		if(this.workspaceId != 0)
			uriTemplate += '&gapnamespace=%1';
		if(limit) {
			uriTemplate += '&gaplimit=%2';
			context.gaplimit = limit;
		}
		context.count = 0;
		context.uri = uriTemplate.format([host,this.workspaceId,limit,filterParams,'%0']);
		context.urifrom = 'gapfrom';
	}
	var from = '0';
	var uri = uriTemplate.format([host,this.workspaceId,limit,filterParams,from]);
	var req = adaptor.doHttpGET(uri,adaptor.getTiddlerListCallback,context);
	return typeof req == 'string' ? req : true;
};

adaptor.getTiddlerListCallback = function(status,context,responseText,uri,xhr)
{
	context.status = false;
	context.statusText = adaptor.errorInFunctionMessage.format(['getTiddlerListCallback']);
	if(status) {
		try {
			eval('var info=' + responseText);
			var pages;
			if(context.responseType == 'query.embeddedin')
				pages = info.query.embeddedin;
			else if(context.responseType == 'query.categorymembers')
				pages = info.query.categorymembers;
			else if(context.responseType == 'query.allpages')
				pages = info.query.allpages;
			else if(context.responseType == 'query.pages')
				pages = info.query.pages;
			else
				pages = info.pages;
			var c = null;
			if(info['query-continue']) {
				if(info['query-continue'].allpages) {
					c = adaptor.normalizedTitle(info['query-continue'].allpages[context.urifrom]);
					context.count += context.gaplimit;
					if(context.count>=context.tiddlerLimit)
						c = null;
				}
			}
			var useMain = false;
			if(context.workspace=="Talk" && context.filter)
				useMain = true;
			for(i in pages) {
				var title = pages[i].title;
				if(useMain&&title)
					title = title.replace(/^Talk:/g,"");
				if(title && !store.isShadowTiddler(title)) {
					tiddler = new Tiddler(title);
					tiddler.fields.workspaceId = useMain ? 0 : pages[i].ns;
					if(!useMain)
						tiddler.fields['temp.size'] = pages[i].length;
					context.tiddlers.push(tiddler);
				}
			}
		} catch (ex) {
			context.statusText = exceptionText(ex,adaptor.serverParsingErrorMessage);
			if(context.callback)
				context.callback(context,context.userParams);
			return;
		}
		context.status = true;
	} else {
		context.statusText = xhr.statusText;
	}
	if(context.uri && c) {
		var u = context.uri.format([c]);
		var req = adaptor.doHttpGET(u,adaptor.getTiddlerListCallback,context);
	} else {
		if(context.callback)
			context.callback(context,context.userParams);
	}
};

adaptor.prototype.generateTiddlerInfo = function(tiddler)
{
	var info = {};
	var host = this && this.host ? this.host : tiddler.fields['server.host'];
	host = this.fullHostName(host);
	if(host.match(/w\/$/)) {
		host = host.replace(/w\/$/,'');
		var uriTemplate = '%0wiki/%2';
	} else {
		uriTemplate = '%0/index.php?title=%2';
	}
	info.uri = uriTemplate.format([host,this.workspace,tiddler.title]);
	return info;
};

adaptor.prototype.getTiddlerRevision = function(title,revision,context,userParams,callback)
{
	context = this.setContext(context,userParams,callback);
	context.revision = revision;
	return this.getTiddler(title,context,userParams,callback);
};

adaptor.prototype.getTiddler = function(title,context,userParams,callback)
{
	context = this.setContext(context,userParams,callback);
	context.title = title;
	var host = this.fullHostName(context.host);
	var uriTemplate = '%0/api.php?format=json&action=query&prop=revisions&titles=%1&rvprop=content|timestamp|user|ids';
	if(context.revision)
		uriTemplate += '&rvstartid=%2&rvlimit=1';
	var uri = uriTemplate.format([host,adaptor.normalizedTitle(context.title),context.revision]);
	context.tiddler = new Tiddler(context.title);
	context.tiddler.fields.wikiformat = 'mediawiki';
	context.tiddler.fields['server'] = null;
	context.tiddler.fields['server.host'] = adaptor.minHostName(host);
	var req = adaptor.doHttpGET(uri,adaptor.getTiddlerCallback,context);
	return typeof req == 'string' ? req : true;
};



adaptor.prototype.getTiddlerPostProcess = function(context)
{
	return context.tiddler;
};

adaptor.getTiddlerCallback = function(status,context,responseText,uri,xhr)
{
	context.status = false;
	if(status) {
		var content = null;
		try {
			eval('var info=' + responseText);
			var page = adaptor.anyChild(info.query.pages);
			var revision = adaptor.anyChild(page.revisions);
			var text = revision['*'];
			context.tiddler.fields['server.page.revision'] = String(revision['revid']);
			context.tiddler.fields['server.page.timestamp'] = String(revision['timestamp']);
			var host = context.tiddler.fields['server.host'];
			if(host.indexOf('wikipedia')==-1) {
				context.tiddler.modified = adaptor.dateFromTimestamp(revision['timestamp']);
				context.tiddler.modifier = revision.user;
			} else {
				// content is from wikipedia
				context.tiddler.created = version.date;
				context.tiddler.modified= version.date;
				// remove links to other language articles
				text = text.replace(/\[\[[a-z\-]{2,12}:(?:.*?)\]\](?:\r?)(?:\n?)/g,'');
			}
			context.tiddler.text = text;
			var catRegExp = /\[\[(Category:[^|\]]*?)\]\]/mg;
			var tags = '';
			var delim = '';
			catRegExp.lastIndex = 0;
			var match = catRegExp.exec(text);
			while(match) {
				tags += delim;
				if(match[1].indexOf(' ')==-1)
					tags += match[1];
				else
					tags += '[[' + match[1] + ']]';
				delim = ' ';
				match = catRegExp.exec(text);
			}
			context.tiddler.tags = tags.readBracketedList();
			context.tiddler = context.adaptor.getTiddlerPostProcess.call(context.adaptor,context);
		} catch (ex) {
			context.statusText = exceptionText(ex,adaptor.serverParsingErrorMessage);
			if(context.callback)
				context.callback(context,context.userParams);
			return;
		}
		context.status = true;
	} else {
		context.statusText = xhr.statusText;
	}
	if(context.callback)
		context.callback(context,context.userParams);
};


adaptor.prototype.getTiddlerRevisionList = function(title,limit,context,userParams,callback)
// get a list of the revisions for a tiddler
{
	context = this.setContext(context,userParams,callback);

	var uriTemplate = '%0/api.php?format=json&action=query&prop=revisions&titles=%1&rvlimit=%2&rvprop=ids|flags|timestamp|user|comment';
	if(!limit)
		limit = 5;
	var host = this.fullHostName(context.host);
	var uri = uriTemplate.format([host,adaptor.normalizedTitle(title),limit]);
	var req = adaptor.doHttpGET(uri,adaptor.getTiddlerRevisionListCallback,context);
	return typeof req == 'string' ? req : true;
};

adaptor.getTiddlerRevisionListCallback = function(status,context,responseText,uri,xhr)
{
	context.status = false;
	if(status) {
		var content = null;
		try {
			eval('var info=' + responseText);
			var page = adaptor.anyChild(info.query.pages);
			var title = page.title;
			var revisions = page.revisions;
			var list = [];
			for(var i=0;i<revisions.length;i++) {
				var tiddler = new Tiddler(title);
				tiddler.modified = adaptor.dateFromTimestamp(revisions[i].timestamp);
				tiddler.modifier = revisions[i].user;
				tiddler.fields.comment = revisions[i].comment;
				tiddler.fields['server.page.id'] = adaptor.normalizedTitle(title);
				tiddler.fields['server.page.name'] = title;
				tiddler.fields['server.page.revision'] = String(revisions[i].revid);
				list.push(tiddler);
			}
			context.revisions = list;
		} catch (ex) {
			context.statusText = exceptionText(ex,adaptor.serverParsingErrorMessage);
			if(context.callback)
				context.callback(context,context.userParams);
			return;
		}
		context.status = true;
	} else {
		context.statusText = xhr.statusText;
	}
	if(context.callback)
		context.callback(context,context.userParams);
};



adaptor.prototype.putTiddler = function(tiddler,context,userParams,callback)
{
	context = this.setContext(context,userParams,callback);
	context.tiddler = tiddler;
	context.title = tiddler.title;
	return this.complete(context,adaptor.putTiddlerComplete);
};


adaptor.putTiddlerComplete = function(context,userParams)
{
	var uriTemplate = '%0/api.php?format=json&action=query&prop=info|revisions&intoken=edit&titles=%1';
	var uri = uriTemplate.format([context.host,escape(adaptor.normalizedTitle(context.tiddler.title))]);

	var req = adaptor.doHttpGET(uri,adaptor.putTiddlerCallback,context);
	return typeof req == 'string' ? req : true;
};

adaptor.putTiddlerCallback = function(status,context,responseText,uri,xhr)
{
	if(status) {
		try {
			eval('var info=' + responseText);
			var page = adaptor.anyChild(info.query.pages);
			var token = page.edittoken;
			token = token.substr(0,token.length-2) + '%2B%5C';
		} catch (ex) {
			context.statusText = exceptionText(ex,adaptor.serverParsingErrorMessage);
			if(context.callback)
				context.callback(context,context.userParams);
			return;
		}
		context.status = true;
		var uriTemplate = '%0/api.php?format=json&action=edit&title=%1&text=%2&basetimestamp=%3&token=%4';
		var tiddler = context.tiddler;
		var timestamp = tiddler.fields['server.page.timestamp'];
		uri = uriTemplate.format([context.host,escape(adaptor.normalizedTitle(tiddler.title)),escape(tiddler.text),timestamp,token]);
		var req = adaptor.doHttpPOST(uri,adaptor.putTiddlerCallback2,context,{"Content-Length":"1"}," ","application/x-www-form-urlencoded");
	} else {
		context.status = false;
		context.statusText = xhr.statusText;
		if(context.callback)
			context.callback(context,context.userParams);
	}
};

adaptor.putTiddlerCallback2 = function(status,context,responseText,uri,xhr)
{
	var info;
	context.statusText = xhr.statusText;
	try {
		eval('info=' + responseText + ';');
	} catch(ex) {
		status = false;
		context.status = false;
		context.statusText = 'putTiddler exception';
	}
	if(status) {
		context.status = true;
	} else {
		context.status = false;
	}
	if(info && info.error) {
		context.status = false;
		context.statusText = info.error.info;
	}
	if(context.callback)
		context.callback(context,context.userParams);
};

/*adaptor.prototype.deleteTiddler = function(tiddler,context,userParams,callback)
{
	context = this.setContext(context,userParams,callback);
	context.title = tiddler.title;
	return this.complete(context,adaptor.deleteTiddlerComplete);
};*/

adaptor.deleteTiddlerComplete = function(context,userParams)
{
	var uriTemplate = '%0/api.php?format=json&action=query&prop=intoken=edit&titles=%1';
	var uri = uriTemplate.format([context.host,escape(adaptor.normalizedTitle(context.tiddler.title))]);

	var req = adaptor.doHttpGET(uri,adaptor.deleteTiddlerCallback,context);
	return typeof req == 'string' ? req : true;
};

adaptor.deleteTiddlerCallback = function(context,userParams)
{
	if(status) {
		try {
			eval('var info=' + responseText);
			var page = adaptor.anyChild(info.query.pages);
			var token = page.edittoken;
			token = token.substr(0,token.length-2) + '%2B%5C';
		} catch (ex) {
			context.statusText = exceptionText(ex,adaptor.serverParsingErrorMessage);
			if(context.callback)
				context.callback(context,context.userParams);
			return;
		}
		context.status = true;
		var uriTemplate = '%0/api.php?action=delete&title=%1&token=%2';
		var uri = uriTemplate.format([context.host,context.workspace,escape(adaptor.normalizedTitle(context.title)),token]);
		var req = adaptor.doHttpPOST(uri,adaptor.deleteTiddlerCallback,context,{"Content-Length":"1"}," ");
	} else {
		context.status = false;
		context.statusText = xhr.statusText;
		if(context.callback)
			context.callback(context,context.userParams);
	}
};

adaptor.deleteTiddlerCallback2 = function(status,context,responseText,uri,xhr)
{
	if(status) {
		context.status = true;
	} else {
		context.status = false;
		context.statusText = xhr.statusText;
	}
	if(context.callback)
		context.callback(context,context.userParams);
};

})(config.adaptors.mediawiki);

} // end of 'install only once'
//}}}
/***
|''Name:''|MediaWikiFormatterPlugin|
|''Description:''|Allows Tiddlers to use [[MediaWiki|http://meta.wikimedia.org/wiki/Help:Wikitext]] ([[WikiPedia|http://meta.wikipedia.org/]]) text formatting|
|''Author:''|Martin Budden (mjbudden (at) gmail (dot) com)|
|''Source:''|http://www.martinswiki.com/#MediaWikiFormatterPlugin |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/MartinBudden/formatters/MediaWikiFormatterPlugin.js |
|''Version:''|0.5.14|
|''Date:''|Jul 27, 2007|
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/3.0/]] |
|''~CoreVersion:''|2.1.0|

|''Display instrumentation''|<<option chkDisplayInstrumentation>>|
|''Allow zooming of thumbnail images''|<<option chkMediaWikiDisplayEnableThumbZoom>>|
|''List references''|<<option chkMediaWikiListReferences>>|
|''Display unsupported magic words''|<<option chkDisplayMediaWikiMagicWords>>|
|''Use host images''|<<option chkUseHostImages>>|

This is the MediaWikiFormatterPlugin, which allows you to insert MediaWiki formated text into a TiddlyWiki.

The aim is not to fully emulate MediaWiki, but to allow you to work with MediaWiki content off-line and then resync the content with your MediaWiki later on, with the expectation that only minor edits will be required.

To use MediaWiki format in a Tiddler, tag the Tiddler with MediaWikiFormat or set the tiddler's {{{wikiformat}}} extended field to {{{mediawiki}}}.

!!!Issues
There are (at least) the following known issues:
# Not all styles from http://meta.wikimedia.org/wiki/MediaWiki:Common.css incorporated
## Styles for tables don't yet match Wikipedia styles.
## Styles for image galleries don't yet match Wikipedia styles.
# Anchors not yet supported.

!!!Not supported
# Template parser functions (also called colon functions) http://meta.wikimedia.org/wiki/ParserFunctions eg &#123;&#123; #functionname: argument 1 | argument 2 | argument 3... &#125;&#125;
# Magic words and variables http://meta.wikimedia.org/wiki/Help:Magic_words eg {{{__TOC__}}}, &#123;&#123;CURRENTDAY&#125;&#125;, &#123;&#123;PAGENAME&#125;&#125;
# {{{^''}}} (italic at start of line) indents, makes italic and quotes with guilmot quote

!!!No plans to support
# Template substitution on save http://meta.wikimedia.org/wiki/Help:Substitution eg &#123;&#123; subst: templatename &#125;&#125;

***/

//{{{
// Ensure that the MediaWikiFormatter Plugin is only installed once.
if(!version.extensions.MediaWikiFormatterPlugin) {
version.extensions.MediaWikiFormatterPlugin = {installed:true};

if(version.major < 2 || (version.major == 2 && version.minor < 1))
	{alertAndThrow('MediaWikiFormatterPlugin requires TiddlyWiki 2.1 or later.');}

if(config.options.chkDisplayInstrumentation == undefined)
	{config.options.chkDisplayInstrumentation = false;}

if(config.options.chkMediaWikiDisplayEnableThumbZoom == undefined)
	{config.options.chkMediaWikiDisplayEnableThumbZoom = false;}
if(config.options.chkMediaWikiListReferences == undefined)
	{config.options.chkMediaWikiListReferences = false;}
if(config.options.chkDisplayMediaWikiMagicWords == undefined)
	{config.options.chkDisplayMediaWikiMagicWords = false;}
if(config.options.chkUseHostImages == undefined)
	{config.options.chkUseHostImages = false;}


//<div class='viewer' macro='view text wikified'></div>;

config.macros.include = {};
config.macros.include.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	if((tiddler instanceof Tiddler) && params[0]) {
		var host = store.getValue(tiddler,'server.host');
		if(host && host.indexOf('wikipedia')!=-1) {
			var t = store.fetchTiddler(params[0]);
			var text = store.getValue(t,'text');
			wikify(text,place,highlightHack,tiddler);
		}
	}
};


MediaWikiFormatter = {}; // 'namespace' for local functions

mwDebug = function(out,str)
{
	createTiddlyText(out,str.replace(/\n/mg,'\\n').replace(/\r/mg,'RR'));
	createTiddlyElement2(out,'br');
};

MediaWikiFormatter.Tiddler_changed = Tiddler.prototype.changed;
Tiddler.prototype.changed = function()
{
	if((this.fields.wikiformat==config.parsers.mediawikiFormatter.format) || this.isTagged(config.parsers.mediawikiFormatter.formatTag)) {
		this.links = [];
		var tiddlerLinkRegExp = /\[\[(?::?([A-Za-z]{2,}:)?)(#?)([^\|\]]*?)(?:(\]\])|(\|(.*?)\]\]))/mg;
		tiddlerLinkRegExp.lastIndex = 0;
		var match = tiddlerLinkRegExp.exec(this.text);
		while(match) {
			if(!match[1] && !match[2])
				this.links.pushUnique(match[3]);
			match = tiddlerLinkRegExp.exec(this.text);
		}
	} else if(!this.isTagged('systemConfig')) {
		MediaWikiFormatter.Tiddler_changed.apply(this,arguments);
		return;
	}
	this.linksUpdated = true;
};

TiddlyWiki.prototype.getMediaWikiPagesInNamespace = function(namespace)
{
	var results = [];
	this.forEachTiddler(function(title,tiddler) {
		if(tiddler.title.indexOf(namespace)==0)
			results.push(tiddler);
		});
	results.sort(function(a,b) {return a.title < b.title ? -1 : +1;});
	return results;
};

TiddlyWiki.prototype.getMediaWikiPages = function()
{
	var results = [];
	this.forEachTiddler(function(title,tiddler) {
		if(!tiddler.isTagged('excludeLists') && tiddler.title.indexOf(':')==-1)
			results.push(tiddler);
		});
	results.sort(function(a,b) {return a.title < b.title ? -1 : +1;});
	return results;
};

TiddlyWiki.prototype.getMediaWikiOtherPages = function()
{
	var results = [];
	this.forEachTiddler(function(title,tiddler) {
		if(!tiddler.isTagged('excludeLists') && tiddler.title.indexOf(':')!=-1)
			results.push(tiddler);
		});
	results.sort(function(a,b) {return a.title < b.title ? -1 : +1;});
	return results;
};

config.macros.list.otherpages = {};
config.macros.list.otherpages.handler = function(params)
{
	return store.getMediaWikiOtherPages();
};

config.macros.list.templates = {};
config.macros.list.templates.handler = function(params)
{
	return store.getMediaWikiPagesInNamespace('Template:');
};

config.macros.list.categories = {};
config.macros.list.categories.handler = function(params)
{
	return store.getMediaWikiPagesInNamespace('Category:');
};

function createTiddlyElement2(parent,element)
{
	return parent.appendChild(document.createElement(element));
}

config.formatterHelpers.createElementAndWikify = function(w)
{
	w.subWikifyTerm(createTiddlyElement2(w.output,this.element),this.termRegExp);
};

MediaWikiFormatter.hijackListAll = function ()
{
	MediaWikiFormatter.oldListAll = config.macros.list.all.handler;
	config.macros.list.all.handler = function(params) {
		return store.getMediaWikiPages();
	};
};
MediaWikiFormatter.hijackListAll();

MediaWikiFormatter.fullHostName = function(host)
{
	if(!host)
		return '';
	host = host.trim();
	if(!host.match(/:\/\//))
		host = 'http://' + host;
	if(host.substr(host.length-1) != '/')
		host = host + '/';
	return host;
};

MediaWikiFormatter.normalizedTitle = function(title)
{
	title = title.trim();
	var n = title.charAt(0).toUpperCase() + title.substr(1);
	return n.replace(/\s/g,'_');
};

MediaWikiFormatter.readToDelim = function(w)
//!!! this is a bit rubish, needs doing properly.
{
	var dRegExp = /\|/mg;
	var sRegExp = /\[\[/mg;
	var tRegExp = /\]\]/mg;

	dRegExp.lastIndex = w.startMatch;
	var dMatch = dRegExp.exec(w.source);
	sRegExp.lastIndex = w.startMatch;
	var sMatch = sRegExp.exec(w.source);
	tRegExp.lastIndex = w.startMatch;
	var tMatch = tRegExp.exec(w.source);
	if(!tMatch) {
		return false;
	}

	while(sMatch && sMatch.index<tMatch.index) {
		if(dMatch && dMatch.index<sMatch.index) {
			w.nextMatch = dRegExp.lastIndex;
			w.matchLength = dMatch.index - w.startMatch;
			return true;
		}
		tRegExp.lastIndex = sRegExp.lastIndex;
		tMatch = tRegExp.exec(w.source);
		
		w.nextMatch = tRegExp.lastIndex;
		dRegExp.lastIndex = w.nextMatch;
		dMatch = dRegExp.exec(w.source);
		sRegExp.lastIndex = w.nextMatch;
		sMatch = sRegExp.exec(w.source);
		tRegExp.lastIndex = w.nextMatch;
		tMatch = tRegExp.exec(w.source);
	}
		
	if(dMatch && dMatch.index<tMatch.index) {
		w.nextMatch = dRegExp.lastIndex;
		w.matchLength = dMatch.index - w.startMatch;
		return true;
	}
	if(tMatch) {
		w.nextMatch = tRegExp.lastIndex;
		w.matchLength = tMatch.index - w.startMatch;
		return false;
	}
	w.nextMatch = tRegExp.lastIndex;
	w.matchLength = -1;
	return false;
};

MediaWikiFormatter.getParams = function(w)
{
	var params = [];
	var i = 1;
	w.startMatch = w.nextMatch;
	var read = MediaWikiFormatter.readToDelim(w);
	if(w.matchLength!=-1) {
		params[i] = w.source.substr(w.startMatch,w.matchLength);
	}
	while(read) {
		i++;
		w.startMatch = w.nextMatch;
		read = MediaWikiFormatter.readToDelim(w);
		if(w.matchLength!=-1) {
			params[i] = w.source.substr(w.startMatch,w.matchLength);
		}
	}
	return params;
};

MediaWikiFormatter.setFromParams = function(w,p)
{
	var r = {};
	var re = /\s*(.*?)=(?:(?:"(.*?)")|(?:'(.*?)')|((?:\w|%|#)*))/mg;
	var match = re.exec(p);
	while(match)
		{
		var s = match[1].unDash();
		if(match[2]) {
			r[s] = match[2];
		} else if(match[3]) {
			r[s] = match[3];
		} else {
			r[s] = match[4];
		}
		match = re.exec(p);
	}
	return r;
};

MediaWikiFormatter.setAttributesFromParams = function(e,p)
{
	var re = /\s*(.*?)=(?:(?:"(.*?)")|(?:'(.*?)')|((?:\w|%|#)*))/mg;
	var match = re.exec(p);
	while(match) {
		var s = match[1].unDash();
		if(s == 'bgcolor') {
			s = 'backgroundColor';
		}
		try {
			if(match[2]) {
				e.setAttribute(s,match[2]);
			} else if(match[3]) {
				e.setAttribute(s,match[3]);
			} else {
				e.setAttribute(s,match[4]);
			}
		}
		catch(ex) {}
		match = re.exec(p);
	}
};

config.mediawiki = {};
config.mediawiki.formatters = [
{
	name: 'mediaWikiHeading',
	match: '^={1,6}(?!=) *\\n?',
	termRegExp: /(={1,6} *\n)/mg,
	handler: function(w)
	{
		var output = w.output;
		var e = createTiddlyElement2(output,'h' + w.matchLength);
		var a = createTiddlyElement2(e,'a');
		var t = w.tiddler ? MediaWikiFormatter.normalizedTitle(w.tiddler.title) + ':' : '';
		var len = w.source.substr(w.nextMatch).indexOf('=\n');
		while(w.source.substr(w.nextMatch+len-1,1)=='=') {
			len--;
		}
		a.setAttribute('name',t+MediaWikiFormatter.normalizedTitle(w.source.substr(w.nextMatch,len)));
		w.subWikifyTerm(e,this.termRegExp);
	}
},

{
	name: 'mediaWikiTable',
	match: '^\\{\\|', // ^{|
	handler: function(w)
	{
		var pair = MediaWikiTemplate.findTableBracePair(w.source,w.matchStart);
		if(pair.start==w.matchStart) {
			w.nextMatch = w.matchStart;
			var table = createTiddlyElement2(w.output,'table');
			var tbody = createTiddlyElement2(table,'tbody');// needed for IE
			var mwt = new MediaWikiTemplate();
			mwt.wikifyTable(tbody,w,pair);
		}
	}
},

{
	name: 'mediaWikiList',
	match: '^[\\*#;:]+',
	lookaheadRegExp: /(?:(?:(\*)|(#)|(;)|(:))+)(?: ?)/mg,
	termRegExp: /(\n)/mg,
	handler: function(w)
	{
		var stack = [w.output];
		var currLevel = 0, currType = null;
		var listType, itemType;
		w.nextMatch = w.matchStart;
		this.lookaheadRegExp.lastIndex = w.nextMatch;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		while(lookaheadMatch && lookaheadMatch.index == w.nextMatch) {
			if(lookaheadMatch[1]) {
				listType = 'ul';
				itemType = 'li';
			} else if(lookaheadMatch[2]) {
				listType = 'ol';
				itemType = 'li';
			} else if(lookaheadMatch[3]) {
				listType = 'dl';
				itemType = 'dt';
			} else if(lookaheadMatch[4]) {
				listType = 'dl';
				itemType = 'dd';
			}
			var listLevel = lookaheadMatch[0].length;
			w.nextMatch += listLevel;
			if(listLevel > currLevel) {
				for(var i=currLevel; i<listLevel; i++) {
					stack.push(createTiddlyElement2(stack[stack.length-1],listType));
				}
			} else if(listLevel < currLevel) {
				for(i=currLevel; i>listLevel; i--) {
					stack.pop();
				}
			} else if(listLevel == currLevel && listType != currType) {
				stack.pop();
				stack.push(createTiddlyElement2(stack[stack.length-1],listType));
			}
			currLevel = listLevel;
			currType = listType;
			var e = createTiddlyElement2(stack[stack.length-1],itemType);
			var ci = w.source.indexOf(':',w.nextMatch);
			var ni = w.source.indexOf('\n',w.nextMatch);
			if(itemType=='dt' && (ni==-1 || (ci!=-1 && ci<ni))) {
				w.subWikifyTerm(e,/(:)/mg);
				w.nextMatch--;
			} else {
				w.subWikifyTerm(e,this.termRegExp);
			}
			this.lookaheadRegExp.lastIndex = w.nextMatch;
			lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		}
	}
},

{
	name: 'mediaWikiRule',
	match: '^----+$\\n?',
	handler: function(w)
	{
		createTiddlyElement2(w.output,'hr');
	}
},

/*{
	name: 'mediaWikiLeadingSpaces',
	match: '^ ',
	lookaheadRegExp: /^ /mg,
	termRegExp: /(\n)/mg,
	handler: function(w)
	{
		var e = createTiddlyElement2(w.output,'pre');
		while(true) {
			w.subWikifyTerm(e,this.termRegExp);
			createTiddlyElement2(e,'br');
			this.lookaheadRegExp.lastIndex = w.nextMatch;
			var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
			if(lookaheadMatch && lookaheadMatch.index == w.nextMatch) {
				w.nextMatch += lookaheadMatch[0].length;
			} else {
				break;
			}
		}
	}
},*/


{
	name: 'mediaWikiImage',
	match: '\\[\\[(?:[Ii]mage|Bild):',
	lookaheadRegExp: /\[\[(?:[Ii]mage|Bild):/mg,
	defaultPx: 180,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var params = MediaWikiFormatter.getParams(w);
			var src = params[1];
			src = src.trim().replace(/ /mg,'_');
			src = src.substr(0,1).toUpperCase() + src.substring(1);
			var palign = null;
			var ptitle = '';
			var psrc = false;
			var px = null;
			var pthumb = false;
			var pframed = false;
			for(var i=2;i<params.length;i++) {
				var p = params[i];
				if(p=='right'||p=='left'||p=='center'||p=='none') {
					palign = p;
				} else if(p=='thumbnail'||p=='thumb') {
					pthumb = true;
				} else if(p=='framed') {
					pframed = true;
				} else if(/\d{1,4} ?px/.exec(p)) {
					px = p.substr(0,p.length-2).trim();
				} else {
					ptitle = p;
				}
			}//#end for
			if(pthumb) {
				var output = w.output;
				if(!palign) {
					palign = 'right';
				}
				if(!px) {
					px = 180;
				}
				psrc = px + 'px-' + src;
				var t = createTiddlyElement(output,'div',null,'thumb'+(palign?' t'+palign:''));
				var s = createTiddlyElement2(t,'div');
				s.style['width'] = Number(px) + 2 + 'px';
				var a = createTiddlyElement(s,'a',null,'internal');
				if(config.options.chkMediaWikiDisplayEnableThumbZoom) {
					a.href = src;
				}
				a.title = ptitle;
				var img = createTiddlyElement2(a,'img');
				img.src = 'images/' + psrc;
				if(config.options.chkUseHostImages && Crypto.hexMd5Str) {
					var md5 = Crypto.hexMd5Str(src);
					var md5dir = '/' + (md5.substr(0,1) + '/' + md5.substr(0,2)).toLowerCase();
					img.src = MediaWikiFormatter.fullHostName(w.tiddler.fields['server.host']||config.defaultCustomFields['server.host']);
					var imgDir = 'images';
					//if(img.src=='http://en.wikipedia.org/w/') {
					if(img.src.indexOf('wikipedia.org/')!=-1) {
						//imgDir = 'wikipedia/en';
						imgDir = 'wikipedia/commons';
						img.src = 'http://upload.wikimedia.org/';
					}	
					img.src += imgDir;
					img.src += '/thumb' + md5dir + '/' + src + '/' + psrc;
				}

				img.width = px;
				img.longdesc = 'Image:' + src;
				img.alt = ptitle;

				var tc = createTiddlyElement(s,'div',null,'thumbcaption');
				var oldSource = w.source; var oldMatch = w.nextMatch;
				w.source = ptitle; w.nextMatch = 0;
				w.subWikifyUnterm(tc);
				w.source = oldSource; w.nextMatch = oldMatch;

				if(config.options.chkMediaWikiDisplayEnableThumbZoom) {
					var tm = createTiddlyElement(tc,'div',null,'magnify');
					tm.style['float'] = 'right';
					var ta = createTiddlyElement(tm,'a',null,'internal');
					ta.title = 'Enlarge';
					timg = createTiddlyElement2(ta,'img'); timg.src = 'magnify-clip.png'; timg.alt = 'Enlarge'; timg.width = '15'; timg.height = '11';
					ta.href = src;
				}
			} else {
				a = createTiddlyElement(w.output,'a',null,'image');
				a.title = ptitle;
				img = createTiddlyElement2(a,'img');
				if(palign) {img.align = palign;}
				if(px) {img.width = px;}
				img.longdesc = 'Image:' + src;
				img.alt = ptitle;
				if(config.options.chkUseHostImages) {
					md5dir = '';
					if(Crypto.hexMd5Str) {
						md5 = Crypto.hexMd5Str(src);
						md5dir = '/'+ (md5.substr(0,1) + '/' + md5.substr(0,2)).toLowerCase();
					}
					img.src = MediaWikiFormatter.fullHostName(w.tiddler.fields['server.host']||config.defaultCustomFields['server.host']);
					imgDir = 'images';
					if(img.src.indexOf('wikipedia.org/')!=-1) {
						imgDir = 'wikipedia/commons';
						img.src = 'http://upload.wikimedia.org/';
					}	
					img.src += imgDir + md5dir + '/' + src;
				} else {
					img.src = px ? 'images/' + px + 'px-' + src : 'images/' + src;
				}
			}
		}
	}//#end image handler
},

{
	name: 'mediaWikiExplicitLink',
	match: '\\[\\[',
	lookaheadRegExp: /\[\[(?:([a-z]{2,3}:)?)(#?)([^\|\]]*?)(?:(\]\](\w*))|(\|(.*?)\]\]))/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			if(!lookaheadMatch[1]) {
				var e;
				var link = lookaheadMatch[3];
				var text = link;
				link = link.substr(0,1).toUpperCase() + link.substring(1);
				if(link.substr(0,1)=='/') {
					link = w.tiddler.title + link;
				} else if(link=='../') {
					link = w.tiddler.title.substr(0,w.tiddler.title.lastIndexOf('/'));
				} else if(link.substr(0,3)=='../') {
					var pos = w.tiddler.title.lastIndexOf('/');
					link = w.tiddler.title.substr(0,pos) + link.substr(2);
				}
				if(lookaheadMatch[4]) {
					if(lookaheadMatch[2]) {
						var a = createTiddlyElement(w.output,'a');
						var t = w.tiddler ? MediaWikiFormatter.normalizedTitle(w.tiddler.title) + ':' : '';
						t = '#' + t + MediaWikiFormatter.normalizedTitle(link);
						a.setAttribute('href',t);
						a.title = '#' + MediaWikiFormatter.normalizedTitle(link);
						createTiddlyText(a,'#'+link);
					} else {
						e = createTiddlyLink(w.output,link,false,null,w.isStatic,w.tiddler);
						if(lookaheadMatch[5]) {
							text += lookaheadMatch[5];
						}
						createTiddlyText(e,text);
					}
				} else if(lookaheadMatch[6]) {
					while(link.charAt(0)==':')
						link = link.substring(1);
					link = MediaWikiFormatter.normalizedTitle(link);
					var i = link.indexOf('#');
					if(i==-1) {
						e = createTiddlyLink(w.output,link,false,null,w.isStatic,w.tiddler);
					} else {
						e = createTiddlyLink(w.output,link.substr(0,i),false,null,w.isStatic,w.tiddler);
					}
					var oldSource = w.source; var oldMatch = w.nextMatch;
					w.source = lookaheadMatch[7].trim(); w.nextMatch = 0;
					w.subWikifyUnterm(e);
					w.source = oldSource; w.nextMatch = oldMatch;
				}
			}
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: 'mediaWikiParagraph',
	match: '\\n{2,}',
	handler: function(w)
	{
		w.output = createTiddlyElement2(w.output,'p');
	}
},

{
	name: 'mediaWikiExplicitLineBreak',
	match: '<br ?/?>',
	handler: function(w)
	{
		createTiddlyElement2(w.output,'br');
	}
},

{
	name: 'mediaWikiExplicitLineBreakWithParams',
	match: "<br(?:\\s*(?:(?:.*?)=[\"']?(?:.*?)[\"']?))*?\\s*/?>",
	lookaheadRegExp: /<br((?:\s+(?:.*?)=["']?(?:.*?)["']?)*?)?\s*\/?>/mg, //'
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var e =createTiddlyElement2(w.output,'br');
			if(lookaheadMatch[1]) {
				MediaWikiFormatter.setAttributesFromParams(e,lookaheadMatch[1]);
			}
			w.nextMatch = this.lookaheadRegExp.lastIndex;// empty tag
		}
	}
},

{
	name: 'mediaWikiTitledUrlLink',
	match: '\\[' + config.textPrimitives.urlPattern + '(?:\\s+[^\\]]+)?' + '\\]', //'
	handler: function(w)
	{
		var lookaheadRegExp = new RegExp('\\[(' + config.textPrimitives.urlPattern + ')(?:\\s+([^\[]+))?' + '\\]','mg');
		lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index==w.matchStart) {
			var link = lookaheadMatch[1];
			if(lookaheadMatch[2]) {
				var e = createExternalLink(w.output,link);
				var oldSource = w.source; var oldMatch = w.nextMatch;
				w.source = lookaheadMatch[2].trim(); w.nextMatch = 0;
				w.subWikifyUnterm(e);
				w.source = oldSource; w.nextMatch = oldMatch;
			} else {
				e = createExternalLink(createTiddlyElement2(w.output,'sup'),link);
				if(w.linkCount===undefined)
					w.linkCount = 0;
				w.linkCount++;
				createTiddlyText(e,'['+w.linkCount+']');
			}
			w.nextMatch = lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: 'mediaWikiUrlLink',
	match: config.textPrimitives.urlPattern,
	handler: function(w)
	{
		w.outputText(createExternalLink(w.output,w.matchText),w.matchStart,w.nextMatch);
	}
},

{
	name: "mediaWikiCharacterFormat",
	match: "'{2,5}|(?:<[usbi]>)",
	handler: function(w)
	{
		switch(w.matchText) {
		case "'''''":
			var e = createTiddlyElement(w.output,'strong');
			w.subWikifyTerm(createTiddlyElement(e,'em'),/('''''|(?=\n))/mg);
			break;
		case "'''":
			w.subWikifyTerm(createTiddlyElement(w.output,'strong'),/('''|(?=\n))/mg);
			break;
		case "''":
			w.subWikifyTerm(createTiddlyElement(w.output,'em'),/((?:''(?!'))|(?=\n))/mg);
			break;
		case '<u>':
			w.subWikifyTerm(createTiddlyElement(w.output,'u'),/(<\/u>|(?=\n))/mg);
			break;
		case '<s>':
			w.subWikifyTerm(createTiddlyElement(w.output,'del'),/(<\/s>|(?=\n))/mg);
			break;
		case '<b>':
			w.subWikifyTerm(createTiddlyElement(w.output,'b'),/(<\/b>|(?=\n))/mg);
			break;
		case '<i>':
			w.subWikifyTerm(createTiddlyElement(w.output,'i'),/(<\/i>|(?=\n))/mg);
			break;
		}
	}
},

/*{
	name: 'mediaWikiTemplateParam',
	match: '\\{\\{\\{',
	lookaheadRegExp: /(\{\{\{(?:.|\n)*?\}\}\})/mg,
	element: 'span',
	handler: config.formatterHelpers.enclosedTextHelper
},
*/

{
	name: 'mediaWikiInsertReference',
	match: '<ref[^/]*>',
	lookaheadRegExp: /<ref(\s+(?:.*?)=["']?(?:.*?)["']?)?>([^<]*?)<\/ref>/mg,
	handler: function(w)
	{
		if(config.browser.isIE) {
			refRegExp = /<ref[^\/]*>((?:.|\n)*?)<\/ref>/mg;
			refRegExp.lastIndex = w.matchStart;
			var refMatch = refRegExp.exec(w.source);
			if(refMatch && refMatch.index == w.matchStart) {
				w.nextMatch = refRegExp.lastIndex;
				return;
			}
		}
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var x = {id:'',value:''};
			w.nextMatch = this.lookaheadRegExp.lastIndex;
			if(!w.referenceCount) {
				w.referenceCount = 0;
				w.references = {};
			}
			var s = createTiddlyElement(w.output,'sup',null,'reference');
			var a = createTiddlyElement2(s,'a');
			var prefix = w.tiddler ? w.tiddler.title + ':' : '';
			var name;
			if(lookaheadMatch[1]) {
				var r = MediaWikiFormatter.setFromParams(w,lookaheadMatch[1]);
				name = r.name ? r.name.trim() : '';
				name = name.replace(/ /g,'_');
				s.id = prefix + '_ref-' + name;// + '_' + nameCount;(w.referenceCount+1);
				if(!w.references[name]) {
					w.references[name] = x;
					w.references[name].id = w.referenceCount;
					w.references[name].value = lookaheadMatch[2].trim();
				}
			} else {
				w.references[w.referenceCount] = x;
				w.references[w.referenceCount].id = w.referenceCount;
				w.references[w.referenceCount].value = lookaheadMatch[2].trim();
				name = w.referenceCount;
				s.id = prefix + '_ref-' + w.referenceCount;
			}
			w.referenceCount++;
			a.title = lookaheadMatch[2].trim();//mb, extra to wikipedia
			a.href = '#' + prefix + '_note-' + name;
			a.innerHTML = '['+w.referenceCount+']';
		}
	}
},

{
	name: 'mediaWikiListReferences',
	match: '<references ?/>',
	lookaheadRegExp: /<references ?\/>/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(config.options.chkMediaWikiListReferences && w.referenceCount) {
			var ol = createTiddlyElement(w.output,'ol',null,'references');
			var oldSource = w.source;
			if(w.referenceCount>0) {
				for(var i in w.references) {
					var li = createTiddlyElement2(ol,'li');
					var prefix = w.tiddler ? w.tiddler.title + ':' : '';
					var b = createTiddlyElement2(li,'b');
					var a = createTiddlyElement2(b,'a');
					li.id = prefix + '_note-' + i;
					a.href = '#' + prefix + '_ref-' + i;
					a.innerHTML = '^';
					w.source = w.references[i].value;
					w.nextMatch = 0;
					w.subWikifyUnterm(li);
				}
			}
			w.source = oldSource;
		}
		w.nextMatch = this.lookaheadRegExp.lastIndex;
	}
},

{
	name: 'mediaWikiRepeatReference',
	match: '<ref[^/]*/>',
	lookaheadRegExp: /<ref(\s+(?:.*?)=["'](?:.*?)["'])?\s*\/>/mg, //'
	handler: function(w)
	{
		if(config.browser.isIE) {
			refRegExp = /<ref.*?\/>/mg;
			refRegExp.lastIndex = w.matchStart;
			var refMatch = refRegExp.exec(w.source);
			if(refMatch && refMatch.index == w.matchStart) {
				w.nextMatch = refRegExp.lastIndex;
				return;
			}
		}
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var x = {id:'',value:''};
			w.nextMatch = this.lookaheadRegExp.lastIndex;
			var s = createTiddlyElement(w.output,"sup",null,"reference");
			var a = createTiddlyElement2(s,"a");
			var prefix = w.tiddler ? w.tiddler.title : '';
			if(lookaheadMatch[1]) {
				var r = {};
				r = MediaWikiFormatter.setFromParams(w,lookaheadMatch[1]);
				var name = r.name ? r.name.trim() : '';
				name = name.replace(/ /g,'_');
				s.id = prefix + '_ref-' + name +'_' + (w.referenceCount+1);
				var count = w.references && w.references[name] ? (w.references[name].id+1) : '?';
			}
			a.href = '#' + prefix + '_note-' + name;
			a.innerHTML = '['+count+']';
			a.title = name;
		}
	}//# end handler
},

{
	name: 'mediaWikiHtmlEntitiesEncoding',
	match: '&#?[a-zA-Z0-9]{2,8};',
	handler: function(w)
	{
		if(!config.browser.isIE)
			createTiddlyElement(w.output,"span").innerHTML = w.matchText;
	}
},

{
	name: 'mediaWikiComment',
	match: '<!\\-\\-',
	lookaheadRegExp: /<!\-\-((?:.|\n)*?)\-\->/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: 'mediaWikiIncludeOnly',
	match: '<includeonly>',
	lookaheadRegExp: /<includeonly>((?:.|\n)*?)<\/includeonly>/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: 'mediaWikiNoWiki',
	match: '<nowiki>',
	lookaheadRegExp: /<nowiki>((?:.|\n)*?)<\/nowiki>/mg,
	element: 'span',
	handler: config.formatterHelpers.enclosedTextHelper
},

{
	name: 'mediaWikiPreNoWiki',
	match: '<pre>\s*<nowiki>',
	lookaheadRegExp: /<pre>\s*<nowiki>((?:.|\n)*?)<\/nowiki>\s*<\/pre>/mg,
	element: 'pre',
	handler: config.formatterHelpers.enclosedTextHelper
},

{
	name: 'mediaWikiPre',
	match: '<pre>',
	lookaheadRegExp: /<pre>((?:.|\n)*?)<\/pre>/mg,
	element: 'pre',
	handler: config.formatterHelpers.enclosedTextHelper
},

{
	name: 'mediaWikiMagicWords',
	match: '__',
	lookaheadRegExp: /__([A-Z]*?)__/mg,
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			switch(lookaheadMatch[1]) {
			case 'NOTOC':
				break;
			default:
				if(config.options.chkDisplayMediaWikiMagicWords) {
					w.outputText(w.output,w.matchStart,w.nextMatch);
				}
				break;
			}
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
},

{
	name: 'mediaWikiGallery',
	match: '<gallery>',
	lookaheadRegExp: /[Ii]mage:(.*?)\n/mg,
	handler: function(w)
	{
		var table = createTiddlyElement(w.output,'table',null,'gallery');
		table.cellspacing = '0';
		table.cellpadding = '0';
		var rowElem = createTiddlyElement2(table,'tr');
		var col = 0;
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var nM = w.nextMatch;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		var oldSource = w.source;
		while(lookaheadMatch) {
			nM += lookaheadMatch[1].length;
			w.source = lookaheadMatch[1] +']]';//!! ]] is hack until getParams is working
			w.nextMatch = 0;
			var params = MediaWikiFormatter.getParams(w);
			var src = params[1]||'';
			src = src.trim().replace(/ /mg,'_');
			src = src.substr(0,1).toUpperCase() + src.substring(1);
			var palign = 'right'; 
			var psrc = '120px-'+src;
			var px = 120;
			var pframed = false;
			ptitle = null;
			for(var i=2;i<params.length;i++) {
				var p = params[i];
				if(p=='right'||p=='left'||p=='center'||p=='none') {
					palign = p;
				} else if(p=='framed') {
					pframed = true;
				} else if(/\d{1,4}px/.exec(p)) {
					px = p.substr(0,p.length-2).trim();
					psrc = px + 'px-' + src;
				} else {
					ptitle = p;
				}
			}//#end for
			var td = createTiddlyElement2(rowElem,'td');
			var gb = createTiddlyElement(td,'div',null,'gallerybox');
			var t = createTiddlyElement(gb,'div',null,'thumb');
			t.style['padding'] = '26px 0';

			var a = createTiddlyElement2(t,'a');
			if(config.options.chkMediaWikiDisplayEnableThumbZoom) {
				a.href = src;
			}
			a.title = ptitle;
			var img = createTiddlyElement2(a,'img');
			img.src = psrc;
			img.width = px;
			img.alt = '';

			var gt = createTiddlyElement(gb,'div',null,'gallerytext');
			p = createTiddlyElement2(gt,'p');
			var oldSource2 = w.source; var oldMatch = w.nextMatch;
			w.source = ptitle; w.nextMatch = 0;
			w.subWikifyUnterm(p);
			w.source = oldSource2; w.nextMatch = oldMatch;

			col++;
			if(col>3) {
				rowElem = createTiddlyElement2(table,'tr');
				col = 0;
			}
			w.source = oldSource;
			lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		}
		w.nextMatch = nM + '<gallery>'.length*2+1+'Image:'.length;//!! hack
	}
},

{
	name: 'mediaWikiHtmlTag',
	match: "<[a-zA-Z0-9]{2,}(?:.*?)>",
	//match: "<[a-zA-Z]{2,}(?:\\s*(?:(?:.*?)=[\"']?(?:.*?)[\"']?))*?>",
	lookaheadRegExp: /<([a-zA-Z0-9]{2,})((?:\s+(?:.*?)=(["']?)(?:.*?)\3?)*?)?\s*(\/)?>/mg, //'
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var e =createTiddlyElement2(w.output,lookaheadMatch[1]);
			if(lookaheadMatch[2]) {
				MediaWikiFormatter.setAttributesFromParams(e,lookaheadMatch[2]);
			}
			if(lookaheadMatch[4]) {
				w.nextMatch = this.lookaheadRegExp.lastIndex;
			} else {
				w.subWikify(e,'</'+lookaheadMatch[1]+'>');
			}
		}
	}
}
];

config.parsers.mediawikiFormatter = new Formatter(config.mediawiki.formatters);
config.parsers.mediawikiFormatter.format = 'mediawiki';
config.parsers.mediawikiFormatter.formatTag = 'MediaWikiFormat';

MediaWikiTemplate = function()
{
	this.stack = [];
	this.error = false;
	this.tiddler = null;
};

MediaWikiTemplate.findRawDelimiter = function(delimiter,text,start)
{
	var d = text.indexOf(delimiter,start);
	if(d==-1)
		return -1;
	var b = {start:-1,end:-1};
	var bs = text.indexOf('[[',start);
	var bi = text.indexOf('{{',start);
	if((bi==-1 || bi > d) && (bs==-1 || bs >d))
		return d;
	var s1 = -1;
	if(bs!=-1 && bs <d) {
		var be = text.indexOf(']]',bs);
		if(be!=-1) {
			b.start = bs;
			b.end = be;
		}
	}
	if(b.start!=-1 && d>b.start)
		s1 = b.end+2;
	var db = MediaWikiTemplate.findDBP(text,start);
	if(db.end!=-1 && d>db.start) {
		if(db.end+2>s1)
			s1 = db.end+2;
	}
	var tb = MediaWikiTemplate.findTBP(text,start);
	if(tb.end!=-1 && d>tb.start) {
		if(tb.end+3>s1)
			s1 = tb.end+3;
	}
	return s1==-1 ? d : MediaWikiTemplate.findRawDelimiter(delimiter,text,s1);
};

/*
* Matched sets of four consecutive braces are interpreted as a parameter surrounded by single braces:
	{{{{foo}}}} is equivalent to { {{{foo}}} }.
* Unmatched sets of four braces are interpreted as nested template calls:
	{{{{TEx1}} }} is parsed as a call to a template, the name of which is dependent on the output of TEx1.
In this example, {{{{TEx1}} }} results in Template:Hello world!, as the Hello world! template does not exist.
* Matched sets of five consecutive braces are interpreted as a template call surrounding a parameter:
	{{{{{foo}}}}} is equivalent to {{ {{{foo}}} }}.
* Unmatched sets of five braces are interpreted using the standard rules:
	{{{{{TEx1}} }}} is interpreted as a named parameter with the name dependent on the result of Template:TEx1,
	which in this case is equivalent to {{{Hello world!}}}.
*/
//	dbrTest('{{ {{{a}}} b }} {{c}}',0,0,13);
MediaWikiTemplate.findDBP = function(text,start,end)
// findDoubleBracePair
{
	var ret = {start:-1,end:-1};
	var s = text.indexOf('{{',start);
	if(s==-1) {
		return ret;
	}
	if(end && s>end)
		return ret;
	if(text.substr(s+2,1)!='{') {
		var e = text.indexOf('}}',s+2);
		if(e==-1)
			return ret;
		var s2 = text.indexOf('{{',s+2);
		if(s2==-1 || s2 > e)
			return {start:s,end:e};
		var si = s+2;
		var db = MediaWikiTemplate.findDBP(text,si,e);
		var tb = MediaWikiTemplate.findTBP(text,si,e);
		while((db.end!=-1 && e>db.start && e<=db.end) || (tb.end!=-1 && e>tb.start && e<=tb.end)) {
			if(db.end!=-1 && e>db.start && e<=db.end) {
				si = db.end+2;
				if(tb.end!=-1 && e>tb.start && e<=tb.end) {
					if(tb.end>db.end)
						si = tb.end+3;
				}
			} else {
				si = tb.end+3;
			}			
			e = text.indexOf('}}',si);
			db = MediaWikiTemplate.findDBP(text,si,e);
			tb = MediaWikiTemplate.findTBP(text,si,e);
			if(e==-1) {
				return ret;
			}
		}
		return {start:s,end:e};
	}
	var c = 2;
	while(text.substr(s+c,1)=='{') {
		c++;
	}
	if(c==3) {
		//tb = MediaWikiTemplate.findTBP(text,s);
		//return tb.end==-1 ? ret : MediaWikiTemplate.findDBP(text,tb.end+3);
		return MediaWikiTemplate.findDBP(text,s+3);
	} else if(c==4) {
		db = MediaWikiTemplate.findDBP(text,s+2);
		if(db.end==-1)
			return ret;
		if(text.substr(db.end+2,2)=='}}') {
			return MediaWikiTemplate.findDBP(text,db.end+4);
		} else {
			e = text.indexOf('}}',db.end+2);
			return e==-1 ? ret : {start:s,end:e};
		}
	} else if(c==5) {
		db = MediaWikiTemplate.findDBP(text,s+3);
		if(db.end==-1)
			return ret;
		if(text.substr(db.end+2,3)=='}}}') {
			// it's matched
			return {start:s,end:db.end+3};
		} else if(text.substr(db.end+2,1)!='}') {
			// it's not matched
			// {{{{{x}} }}}
			return {start:s+3,end:db.end};
		} else {
			// }}} }}
			e = text.indexOf('}}',db.end+3);
			return e==-1 ? ret : {start:s,end:e};
		}
	} else {
		return MediaWikiTemplate.findDBP(text,s+6);
	}
};

MediaWikiTemplate.findTBP = function(text,start,end)
// findTripleBracePair
{
	var ret = {start:-1,end:-1};
	var s = text.indexOf('{{{',start);
	if(s==-1)
		return ret;
	if(end && s>end)
		return ret;
	if(text.substr(s+3,1)!='{' || text.substr(s+3,3)=='{{{') {
		var si = s+3;
		var e = text.indexOf('}}}',si);
		if(e==-1)
			return ret;
		var s2 = text.indexOf('{{',si);
		if(s2==-1 || s2 > e)
			return {start:s,end:e};
		var db = MediaWikiTemplate.findDBP(text,si,e);
		var tb = MediaWikiTemplate.findTBP(text,si,e);
//	console.log('t:'+text.substr(s,100));
		while((db.end!=-1 && e>=db.end) || (tb.end!=-1 && e>=tb.end)) {
			if(db.end!=-1 && e>=db.end) {
				si = db.end+2;
				if(tb.end!=-1 && e>=tb.end) {
					if(tb.end>=db.end)
						si = tb.end+3;
				}
			} else {
				si = tb.end+3;
			}
			db = MediaWikiTemplate.findDBP(text,si,e);
			tb = MediaWikiTemplate.findTBP(text,si,e);
			e = text.indexOf('}}}',si);
			if(e==-1)
				return ret;
		}
		return {start:s,end:e};
	}
	var c = 3;
	while(text.substr(s+c,1)=='{') {
		c++;
	}
	if(c==4) {
		tb = MediaWikiTemplate.findTBP(text,s+1);
		if(tb.end==-1)
			return ret;
		if(text.substr(tb.end+1,1)=='}') {
			return {start:s+1,end:tb.end};
		} else {
			return MediaWikiTemplate.findTBP(text,tb.end+4);
		}
	} else if(c==5) {
		db = MediaWikiTemplate.findDBP(text,s+3);
		if(db.end==-1)
			return ret;
		if(text.substr(db.end+2,3)=='}}}') {
			return {start:s+2,end:db.end};
		} else if(text.substr(db.end+2,1)!='}') {
			e = text.indexOf('}}}',db.end+2);
			return e==-1 ? ret : {start:s,end:e};
		} else {
			return {start:s+2,end:db.end};
		}
	}
};

MediaWikiTemplate.findTableBracePair = function(text,start)
{
	var ret = {start:-1,end:-1};
	var s = text.indexOf('{|',start);
	if(s==-1)
		return ret;
	var e = text.indexOf('\n|}',s+2);
	if(e==-1)
		return ret;
	e++;
	var s2 = text.indexOf('{|',s+2);
	if(s2==-1 || s2 > e)
		return {start:s,end:e};
	var tp = MediaWikiTemplate.findTableBracePair(text,s+2);
	while(tp.end!=-1 && e>tp.start && e<=tp.end) {
		e = tp.end+2;
		tp = MediaWikiTemplate.findTableBracePair(text,e);
		e = text.indexOf('\n|}',e);
		if(e==-1)
			return ret;
		e++;
	}
	return {start:s,end:e};
};

MediaWikiTemplate.prototype.wikifyTable = function(table,w,pair)
{
	function lineEnd(w) {
		var r = w.source.indexOf('\n',w.nextMatch);
		while(r!=-1) {
			var n = w.source.substr(r+1,1);
			if(n=='|' || n=='!' || (n=='{' && w.source.substr(r+2,1)=='|'))
				break;
			r = w.source.indexOf('\n',r+1);
		}
		return r;
	}
	function subWikifyText(e,w,text) {
			var oldSource = w.source; var oldMatch = w.nextMatch;
			w.source = text; w.nextMatch = 0;
			w.subWikifyUnterm(e);
			w.source = oldSource; w.nextMatch = oldMatch;
	}		
	w.nextMatch += 2;
	var i = lineEnd(w);
	if(i>w.nextMatch) {
		MediaWikiFormatter.setAttributesFromParams(table.parentNode,w.source.substring(w.nextMatch,i));
		w.nextMatch = i;
	}
	w.nextMatch++;
	if(w.source.substr(w.nextMatch,2)=='|+') {
		var caption = createTiddlyElement2(table,'caption');
		w.nextMatch += 2;
		i = lineEnd(w);
		var d = MediaWikiTemplate.findRawDelimiter('|',w.source,w.nextMatch);
		if(d!=-1 && d<i) {
			MediaWikiFormatter.setAttributesFromParams(caption,w.source.substring(w.nextMatch,d));
			w.nextMatch = d+1;
		}
		w.subWikifyTerm(caption,/(\n)/mg);
	}
	var tr = createTiddlyElement2(table,'tr');
	if(w.source.substr(w.nextMatch,2)=='|-') {
		w.nextMatch += 2;
		i = lineEnd(w);
		//if(i==-1)
		//	break;
		if(i>w.nextMatch) {
			MediaWikiFormatter.setAttributesFromParams(tr,w.source.substring(w.nextMatch,i));
			w.nextMatch = i;
		}
		w.nextMatch++;
	}
	var x = w.source.substr(w.nextMatch,2);
	while(x!='|}') {
		if(x=='{|') {
			var pair2 = MediaWikiTemplate.findTableBracePair(w.source,w.nextMatch);
			if(pair2.start==w.nextMatch) {
				var table2 = createTiddlyElement2(cell,'table');
				this.wikifyTable(table2,w,pair2);
				var y = w.source.substr(w.nextMatch).escapeLineBreaks();
				while(w.source.substr(w.nextMatch,1)=='\n') {
					w.nextMatch++;
				}
			}
		} else if(x=='|-') {
			tr = createTiddlyElement2(table,'tr');
			w.nextMatch += 2;
			i = lineEnd(w);
			if(i==-1)
				break;
			if(i>w.nextMatch) {
				MediaWikiFormatter.setAttributesFromParams(tr,w.source.substring(w.nextMatch,i));
				w.nextMatch = i;
			}
			w.nextMatch++;
		} else if(x.substr(0,1)=='!') {
			w.nextMatch++;
			i = lineEnd(w);
			if(i==-1)
				break;
			var cell = createTiddlyElement2(tr,'th');
			var c = w.source.indexOf('!!',w.nextMatch);
			while(c!=-1 && c<i) {
				d = MediaWikiTemplate.findRawDelimiter('|',w.source,w.nextMatch);
				if(d!=-1 && d<c) {
					MediaWikiFormatter.setAttributesFromParams(cell,w.source.substring(w.nextMatch,d));
					w.nextMatch = d+1;
				}
				while(w.source.substr(w.nextMatch,1)==' ') {
					w.nextMatch++;
				}
				w.subWikifyTerm(cell,/(\!\!)/mg);
				cell = createTiddlyElement2(tr,'th');
				c = w.source.indexOf('!!',w.nextMatch);
			}
			d = MediaWikiTemplate.findRawDelimiter('|',w.source,w.nextMatch);
			if(d!=-1 && d<i) {
				MediaWikiFormatter.setAttributesFromParams(cell,w.source.substring(w.nextMatch,d));
				w.nextMatch = d+1;
			}
			while(w.source.substr(w.nextMatch,1)==' ') {
				w.nextMatch++;
			}
			subWikifyText(cell,w,w.source.substring(w.nextMatch,i));
			w.nextMatch = i+1;
			//w.subWikifyTerm(cell,/(\n)/mg);
		} else if(x.substr(0,1)=='|') {
			w.nextMatch++;
			i = lineEnd(w);
			if(i==-1)
				break;
			cell = createTiddlyElement2(tr,'td');
			c = w.source.indexOf('||',w.nextMatch);
			while(c!=-1 && c<i) {
				d = MediaWikiTemplate.findRawDelimiter('|',w.source,w.nextMatch);
				if(d!=-1 && d<c) {
					MediaWikiFormatter.setAttributesFromParams(cell,w.source.substring(w.nextMatch,d));
					w.nextMatch = d+1;
				}
				while(w.source.substr(w.nextMatch,1)==' ') {
					w.nextMatch++;
				}
				w.subWikifyTerm(cell,/(\|\|)/mg);
				cell = createTiddlyElement2(tr,'td');
				c = w.source.indexOf('||',w.nextMatch);
			}
			d = MediaWikiTemplate.findRawDelimiter('|',w.source,w.nextMatch);
			if(d!=-1 && d<i) {
				MediaWikiFormatter.setAttributesFromParams(cell,w.source.substring(w.nextMatch,d));
				w.nextMatch = d+1;
			}
			while(w.source.substr(w.nextMatch,1)==' ') {
				w.nextMatch++;
			}
			subWikifyText(cell,w,w.source.substring(w.nextMatch,i));
			w.nextMatch = i+1;
			//w.subWikifyTerm(cell,/(\n)/mg);
		} else {
		}
	x = w.source.substr(w.nextMatch,2);
	}
	w.nextMatch = pair.end + 3;
	return;
	
};

} //# end of 'install only once'
//}}}
/***
|''Name:''|MediaWikiTemplatePlugin|
|''Description:''|Development plugin for MediaWiki Template expansion|
|''Author:''|Martin Budden (mjbudden (at) gmail (dot) com)|
|''Version:''|0.1.10|
|''Date:''|Feb 27, 2008|
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]] |
|''~CoreVersion:''|2.4.1|

|''Display empty template links:''|<<option chkMediaWikiDisplayEmptyTemplateLinks>>|


http://meta.wikimedia.org/wiki/Help:Template
http://meta.wikimedia.org/wiki/User:Happy-melon/Templates

http://meta.wikimedia.org/wiki/Help:Parser_function
http://meta.wikimedia.org/wiki/Help:ParserFunctions (extensions)
http://www.mediawiki.org/wiki/Help:Magic_words
http://meta.wikimedia.org/wiki/Help:Variable

==Parsing templates==

When the MediaWiki [[mw:Manual:Parser.php|parser]] encounters a template (defined as a matched pair of braces not inside <nowiki><nowiki></nowiki> tags), the template is expanded using the following algorithm:

#The template call is divided into the template name and parameter expressions, by looking for pipe characters.  Pipes contained within matched double braces or square brackets are ignored.  
#*This division is performed purely based on pipe characters ''currently'' present in the template call, ignoring those potentially contained within templates.  This is what permits the use of [[Template:!]].
#*A potentially interesting feature is that characters including and following a hash <code>#</code> are stripped from the template name after this division.  So <code><nowiki>{{TEx4#def|ABC}}</nowiki></code> will be parsed in exactly the same way as <code><nowiki>{{TEx4|ABC}}</nowiki></code>.
#The wikicode for the template name is evaluated, calling the template parser [[w:Recursion (computer science)|recursively]] if necessary.  
#The wikicode for each parameter expression is evaluated, again using recursion if the wikicode contains another template. 
#Any parameter expression now containing a raw equals sign is split around that equals sign into a parameter ''name'' and parameter ''value''.  If a parameter expression contains more than one equals sign, the division is done around the ''first'' (working left to right).  
#Any remaining parameter expressions which do not contain equals signs are assigned as values to the implicit parameters, working left to right.  So the first parameter expression which does not contain an equals sign is assigned as the value of parameter <code>1</code>, the next parameter expression is assigned as the value of parameter <code>2</code>, etc.  
#The wikicode of the template page is analysed and stripped around <code><nowiki><noinclude></nowiki></code>, <code><nowiki><includeonly></nowiki></code> or <code><nowiki><onlyinclude></nowiki></code> tags, if present.
#The template call is replaced by the analysed wikicode, replacing parameters by their values if possible.
#*Any parameters that do not appear in the analysed wikicode are discarded, and any parameters appearing in the wikicode which have not been assigned a value are replaced by their defaults (if defined) or left as they are.

***/

//{{{
// Ensure that the MediaWikiTemplate Plugin is only installed once.
if(!version.extensions.MediaWikiTemplatePlugin) {
version.extensions.MediaWikiTemplatePlugin = {installed:true};

if(version.major < 2 || (version.major == 2 && version.minor < 1))
	{alertAndThrow('MediaWikiTemplatePlugin requires TiddlyWiki 2.1 or later.');}

if(config.options.chkMediaWikiDisplayEmptyTemplateLinks == undefined)
	{config.options.chkMediaWikiDisplayEmptyTemplateLinks = false;}

fnLog = function(text)
{
//	if(window.console) console.log(text); else displayMessage(text.substr(0,100));
};

MediaWikiTemplate.subWikify = Wikifier.prototype.subWikify;
Wikifier.prototype.subWikify = function(output,terminator)
{
	if(this.formatter.format=='mediawiki') {
		var mwt = new MediaWikiTemplate();
		this.source = mwt.transcludeTemplates(this.source,this.tiddler);
	}
	MediaWikiTemplate.subWikify.apply(this,arguments);
};

MediaWikiTemplate.normalizeTitle = function(title)
{
	title = title.replace(/_/mg,' ');
	title = title.substr(0,1).toUpperCase() + title.substring(1);
	return title;
};

MediaWikiTemplate.getTemplateContent = function(name)
{
	var i = name.indexOf(':');
	var namespace = 'Template:';
	if(i==0) {
		name = name.substr(1);
		namespace = '';
	} else if(i!=-1) {
		namespace = '';
	}
	i = name.indexOf('#');
	if(i!=-1) {
		name = name.substr(0,i);
	}
	
	name = MediaWikiTemplate.normalizeTitle(name);
	var tiddler = store.fetchTiddler(namespace+name);
	var text = '';
	if(tiddler) {
		text = tiddler.text;
		if(text.indexOf('<')==-1)
			return text; // optimization to avoid regular expression matching
		text = text.replace(/<noinclude>((?:.|\n)*?)<\/noinclude>/mg,'');// remove text between noinclude tags
		text = text.replace(/<includeonly>/mg,'');
		text = text.replace(/<\/includeonly>/mg,'');
		var onlyIncludeRegExp = /<onlyinclude>((?:.|\n)*?)<\/onlyinclude>/mg;
		var t = '';
		onlyIncludeRegExp.lastIndex = 0;
		var match = onlyIncludeRegExp.exec(text);
		while(match) {
			t += match[1];
			match = onlyIncludeRegExp.exec(text);
		}
		text = t == '' ? text : t;
	} else {
		text = namespace + name;
		if(config.options.chkMediaWikiDisplayEmptyTemplateLinks) {
			text = '[['+text+']]';
		}
	}
	return text;
};

MediaWikiTemplate.prototype.substituteParameters = function(text,params)
{
	var t = '';
	var pi = 0;
	var bp = MediaWikiTemplate.findTBP(text,pi);
	var paramIndex = 1;
	while(bp.start!=-1) {
		var name = text.substring(bp.start+3,bp.end);
		var d = MediaWikiTemplate.findRawDelimiter('|',name,0);
		if(d!=-1) {
			var def = name.substr(d+1);
			name = name.substr(0,d);
			var np = MediaWikiTemplate.findDBP(name,0);
			while(np.start!=-1) {
				var nx = this._expandTemplateNTag(this.substituteParameters(name.substring(np.start+2,np.end),params));
				name = name.substr(0,np.start) + nx + name.substr(np.end+2);
				np = MediaWikiTemplate.findDBP(name,0);
			}
		}
		//params is [undefined,"param1=aaa"]
		var val = params[name];
		if(val===undefined) {
			val = params[paramIndex];
		}
		if(val===undefined) {
			val = def;
		}
		if(val===undefined) {
			val = '{{{'+name+'}}}';
		} else {
			// remove numbered parameters before substitute nested parameters
			var p2 = {};
			for(var i in params) {
				if(isNaN(parseInt(i,10)))
					p2[i] = params[i];
			}
			val = this.substituteParameters(val,p2);
		}
		t += text.substring(pi,bp.start) + this._transcludeTemplates(val);
		pi = bp.end+3;
		bp = MediaWikiTemplate.findTBP(text,pi);
		paramIndex++;
	}
	t += text.substring(pi);
	return t;
};

MediaWikiTemplate.prototype.expandTemplateContent = function(templateName,params)
{
	if(this.stack.indexOf(templateName)!=-1) {
		this.error = true;
		//return 'ERROR: template recursion detected';
		return 'Template loop detected: '+templateName;
	}
	this.stack.push(templateName);

	var text = MediaWikiTemplate.getTemplateContent(templateName);
	text = this.substituteParameters(text,params);
//fnLog('ret expandTemplateContent'+text);
	return text;
};

MediaWikiTemplate.prototype._expandVariable = function(text)
{
	if(text.length>16)// optimization to avoid switch statement
		return false;
	var ret = false;
	switch(text) {
	case 'BASEPAGENAME':
		ret = this.tiddler.title;
		var i = ret.indexOf(':');
		if(i!=-1)
			ret = ret.substr(i+1);
		break;
	case 'NAMESPACE':
		ret = this.tiddler.title;
		i = ret.indexOf(':');
		ret = i==-1 ? '' : ret.substr(0,i);
		break;
	case 'PAGENAME':
		ret = this.tiddler.title;
		break;
	case 'PAGENAMEE':
		ret = MediaWikiTemplate.normalizedTitle(this.tiddler.title);
		break;
	case 'NUMBEROFARTICLES':
		var n = 0;
		store.forEachTiddler(function(title,tiddler) {
			if((tiddler.fields.wikiformat && tiddler.fields.wikiformat==config.parsers.mediawikiFormatter.format) || tiddler.isTagged(config.parsers.mediawikiFormatter.formatTag)) {
					++n;
			};
		});
		return String(n);
		break;
	case 'REVISIONID':
		ret  = this.tiddler.fields['server.revision'];
		break;
	case 'SITENAME':
		ret  = store.getTiddlerText('SiteTitle');
		if(ret.indexOf('~')==0) {
			ret = ret.substr(1);
		}
		break;
	default:
		break;
	}
	return ret;
};

MediaWikiTemplate.prototype._expandParserFunction = function(text)
{
	var fnRegExp = /\s*(#?[a-z]+):/mg;
	fnRegExp.lastIndex = 0;
	var match = fnRegExp.exec(text);
	if(!match) {
		return false;
	}
	var ret = false;
	var len = match[0].length;
	var fn = match[1];
	switch(fn.toLowerCase()) {
	case '#if':
		var e = MediaWikiTemplate.findRawDelimiter('|',text,0);
		var p = text.substring(len,e).trim();
		var lhs = text.substr(e+1);
		e = MediaWikiTemplate.findRawDelimiter('|',lhs,0);
		if(e==-1) {
			ret = p=='' ? '' : lhs;
		} else {
			var rhs = lhs.substr(e+1);
			lhs = lhs.substr(0,e);
			ret = p=='' ? rhs : lhs;
		}
		break;
	default:
		break;
	}
	return ret;
};

MediaWikiTemplate.prototype._splitTemplateNTag = function(ntag)
// split naked template tag (ie without {{ and }}) at raw pipes into name and parameter definitions
{
	var pd = []; // parameters definitions array, p[0] contains template name
	var i = 0;
	var s = 0;
	var e = MediaWikiTemplate.findRawDelimiter('|',ntag,s);
	while(e!=-1) {
		pd[i] = ntag.substring(s,e);//.trim();
		i++;
		s = e+1;
		e = MediaWikiTemplate.findRawDelimiter('|',ntag,s);
	}
	pd[i] = ntag.substring(s);//.trim();
	return pd;
};

MediaWikiTemplate.prototype._expandTemplateNTag = function(ntag)
{
	var ret = this._expandVariable(ntag);
	if(ret!==false) {
		return ret;
	}
	var c = MediaWikiTemplate.findDBP(ntag,0);
	if(c.start==-1) {
		// only expand parser functions if all parameters have been subsituted
		ret = this._expandParserFunction(ntag);
		if(ret!==false) {
			return ret;
		}
	}
	var pd = this._splitTemplateNTag(ntag);
	var templateName = pd[0];
	var s = 1;

	var params = {};
	var n = 1;
	for(var i = s;i<pd.length;i++) {
		var t = pd[i];
		var p = MediaWikiTemplate.findRawDelimiter('=',t,0);
		if(p!=-1) {
			var pnRegExp = /\s*([A-Za-z0-9\-]*)\s*=(.*)/mg;
			pnRegExp.lastIndex = 0;
			match = pnRegExp.exec(t);
			if(match) {
				var name = match[1];
				var x = parseInt(name,10);
				if(!isNaN(x)) {
					n = x;
					//t = t.substr(p+1);
					t = match[2];
					p = -2;// do not increment parameter number
				}
			} else {
				p = -1;
			}
		}
		if(p==-2) {
			params[String(n)] = t;
		} else if(p==-1) {
			params[String(n)] = t;
			n++;
		} else if(name!='0') {//0 sets null parameter
			name = this._transcludeTemplates(name);
			var val = t.substr(p+1).trim();// trim named parameter values
			if(val) {
				params[name] = val;
			}
		}
	}
	/*for(i in params) {
		console.log('p0['+i+']='+params[i]);
		params[i] = this.substituteParameters(params[i],params);
		console.log('p1['+i+']='+params[i]);
		params[i] = this._transcludeTemplates(params[i]);
		console.log('p2['+i+']='+params[i]);
	}*/
	
	ret = this.expandTemplateContent(templateName.trim(),params);
	return ret;
};

MediaWikiTemplate.prototype._transcludeTemplates = function(text)
{
	if(!text)
		return text;
	var c = MediaWikiTemplate.findDBP(text,0);
	var ns = text.indexOf('<nowiki>');
	var ne = text.indexOf('</nowiki>',ns);
	if(ns!=-1 && c.start!=-1 && (c.start>ns && c.start<ne)) {
		c = MediaWikiTemplate.findDBP(text,ne);
	}
	while(c.start!=-1) {
		var t = this._expandTemplateNTag(text.substring(c.start+2,c.end));
		if(this.error) {
			text = text.substring(0,c.start) + t + text.substring(c.end+2);
			return text;
		}
		t = this._transcludeTemplates(t);
		text = text.substring(0,c.start) + t + text.substring(c.end+2);
		if(this.error)
			return text;
		c = MediaWikiTemplate.findDBP(text,c.start+t.length);
		this.stack = [];
		this.error = false;
	}
	return text;
};

MediaWikiTemplate.prototype.transcludeTemplates = function(text,tiddler)
{
	this.stack = [];
	this.error = false;
	this.tiddler = tiddler;
	if(tiddler.title.indexOf('Template:')==0)
		return text;
	return this._transcludeTemplates(text);
};

} //# end of 'install only once'
/***
|''Name:''|RemoveTaggingLabelsPlugin|
|''Description:''|Remove the spurious text labels put out by the 'tagging' macro|
|''Version:''|0.0.1|
|''Date:''|Jan 25, 2008|
|''Source:''|http://svn.tiddlywiki.org/Trunk/contributors/PaulDowney/plugins/RemoveTaggingLabelsPlugin|
|''Author:''|PaulDowney (psd (at) osmosoft (dot) com)|
|''License:''|[[BSD open source license]]|
|''~CoreVersion:''|2.1.0|
|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|
***/

//{{{

config.macros.tagging.label = "";
config.macros.tagging.labelNotTag = "";

//}}}
/***
|''Name:''|WikifiedMessagesPlugin|
|''Description:''|Wikify displayMessage text  |
|''Author:''|PaulDowney (psd (at) osmosoft (dot) com) |
|''Source:''|http://whatfettle.com/2008/07/WikifiedMessagesPlugin/ |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/PaulDowney/plugins/WikifiedMessagesPlugin/ |
|''Version:''|0.4|
|''License:''|[[BSD License|http://www.opensource.org/licenses/bsd-license.php]] |
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''~CoreVersion:''|2.4|
!!Documentation
A plugin to replace the core displayMessage function with a version which wikifies the message text.
The construction of the [close] single message and [close all] buttons has been seperated to be overrideable and the created message div is returned by displayMessage, for extensibility by other plugins.
!!Code
***/
//{{{
if(!version.extensions.WikifiedMessagesPlugin) {
version.extensions.WikifiedMessagesPlugin = {installed:true};

	if(!config.extensions){
		config.extensions = {};
	}

	config.extensions.WikifiedMessages = {

		createClearAllButton: function(msgArea)
		{
			return (msgArea.hasChildNodes())? null :
				createTiddlyButton(createTiddlyElement(msgArea,"div",null,"messageToolbar"),
					config.messages.messageClose.text,
					config.messages.messageClose.tooltip,
					clearMessage);
		},
		createClearMessageButton: function(e)
		{
			return null;
		},
		getMessageDiv: function()
		{
			var msgArea = document.getElementById("messageArea");
			var me = config.extensions.WikifiedMessages;
			if(!msgArea){
				return null;
			}
			msgArea.style.display = "block";
			me.createClearAllButton(msgArea);
			e = createTiddlyElement(msgArea,"div",null,"messageBox");
			me.createClearMessageButton(e);
			return e;
		},
		displayMessage: function(text,linkText)
		{
			var e = getMessageDiv();
			if(!e) {
				alert(wikifyPlain(text));
				return null;
			}
			if(linkText) {
				text = "[["+text+"|"+linkText+"]]";
			}
			t = createTiddlyElement(e,"span",null,"messageText");
			t.innerHTML = wikifyStatic(text);
			return e;
		}
	};

	displayMessage = config.extensions.WikifiedMessages.displayMessage;
	getMessageDiv = config.extensions.WikifiedMessages.getMessageDiv;

        // macro, useful for testing
        config.macros.DisplayMessage = {
                handler: function(place,macroName,params,wikifier,paramString,tiddler){
                        displayMessage(paramString);
                }
        };
}
//}}}
/***
|''Name:''|StaticMapPlugin |
|''Description:''|Google static map macro |
|''Author:''|PaulDowney (psd (at) osmosoft (dot) com) |
|''Source:''|http://whatfettle.com/2008/07/StaticMapPlugin/ |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/PaulDowney/plugins/StaticMapPlugin/ |
|''Version:''|0.1 |
|''License:''|[[BSD License|http://www.opensource.org/licenses/bsd-license.php]] |
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''~CoreVersion:''|2.4 |
!!Documentation
Macro to insert a [[Google Static Map|http://code.google.com/apis/maps/documentation/staticmaps/]].
{{{
<<staticMap 
	href:'http://en.wikipedia.org/wiki/Brooklyn_Bridge'
	class:brooklyn
	alt:'Hybrod map of New York centred above Brooklyn Bridge'
	center:Brooklyn+Bridge,New+York,NY
	zoom:14
	size:512x512
	maptype:hybrid
	markers:'color:blue|label:S|40.702147,-74.015794'
	markers:'color:green|label:G|40.711614,-74.012318'
	markers:'color:red|color:red|label:C|40.718217,-73.998284'
	sensor:false
>>
}}}
<<staticMap 
	href:'http://en.wikipedia.org/wiki/Brooklyn_Bridge'
	class:brooklyn
	alt:'Hybrod map of New York centred above Brooklyn Bridge'
	center:Brooklyn+Bridge,New+York,NY
	zoom:14
	size:512x512
	maptype:hybrid
	markers:'color:blue|label:S|40.702147,-74.015794'
	markers:'color:green|label:G|40.711614,-74.012318'
	markers:'color:red|color:red|label:C|40.718217,-73.998284'
	sensor:false
>>
{{{
<<staticMap title:'Osmosoft'>>
}}}
<<staticMap title:'Osmosoft'>>
The default marker is taken from the tiddler {{{geo.lat}}} and {{{geo.long}}} fields:
{{{
<<staticMap>>
}}}
<<staticMap>>
!!Code
***/
//{{{
/*jslint onevar: false nomen: false plusplus: false */
/*global jQuery config escape store */
(function ($) {
	version.extensions.StaticMapPlugin = {installed: true};
	config.macros.staticMap = {
		handler: function (place, macroName, params, wikifier, paramString, tiddler) {
			params = paramString.parseParams()[0];
			var markers = params.markers ? params.markers.join("&markers=") :
				escape(store.getValue(tiddler, 'geo.lat') + "," + store.getValue(tiddler, 'geo.long'));
			var _class = params['class'] || "staticmap";
			var alt = params.alt || "Map";
			var url = 'http://maps.google.com/maps/api/staticmap' +
				'?center=' + escape(params.center || "") +
				'&zoom=' + escape(params.zoom || "16") +
				'&size=' + escape(params.size || "160x160") +
				'&maptype=' + escape(params.maptype || "roadmap") +
				'&markers=' + markers +
				'&sensor=' + escape(params.sensor || 'false');
			if (params.href) {
				place = createExternalLink(place, params.href);
			} else if (params.title) {
				place = createTiddlyLink(place, params.title, false, _class);
			}
			$(place).append('<img class="' + _class + '" src="' + url + '" alt="' + alt + '"/>');
		}
	};
}(jQuery));
//}}}
/***
|''Name:''|TaggedTemplatePlugin|
|''Description:''|Apply a view/edit template based on a tag |
|''Author:''|PaulDowney (psd (at) osmosoft (dot) com)|
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/contributors/PaulDowney/plugins/TaggedTemplatePlugin |
|''Version:''|1.1|
|''License:''|[[BSD License|http://www.opensource.org/licenses/bsd-license.php]] |
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''~CoreVersion:''|2.4|
|''Overrides''|Story.prototype.chooseTemplateForTiddler() |
!!Documentation
This plugin enables the application of a view or edit template based on a tag name. 

The priority of searching for duplicate templates has been designed to allow partially defined themes, in which missing templates are defaulted to ones defined as tiddlers.  Collation sequence is used to disambiguate collisions when a tiddler it tagged with more than one tag with an associated template. For example, tiddler tagged "Foo Bar" will result in a hunt for a template as follows:
# in the current theme by tag:
##[[CurrentTheme]]##barViewTemplate
##[[CurrentTheme]]##fooViewTemplate
# in a template for the tag:
##[[barViewTemplate]]
##[[fooViewTemplate]]
# global in the current theme
##[[CurrentTheme]]##ViewTemplate
# in the global tiddler
##[[ViewTemplate]]
This plugin is used by RippleRap, TiddlyResume and a number of other verticals which use nested themes was based on Eric Shulman's [[TaggedTemplateTweak|http://www.TiddlyTools.com/#TaggedTemplateTweak]] plugin which at the time didn't support themes and searches in a different order.
!!Code
***/
//{{{
/*jslint onevar: false nomen: false plusplus: false */
/*global Story, store, config */
if (!version.extensions.TaggedTemplatePlugin) {
    version.extensions.TaggedTemplatePlugin = {installed: true};

    Story.prototype._chooseTemplateForTiddler = Story.prototype.chooseTemplateForTiddler;
    Story.prototype.chooseTemplateForTiddler = function (title, n)
    {
        var slice, i, tags = [], tagTiddler;
        var tiddler = store.getTiddler(title);

        // translate number into template name
        var template = ["ViewTemplate", "EditTemplate"][n ? n - 1 : 0];

        // canonicalise tags
        if (tiddler) {
            for (i = 0; i < tiddler.tags.length; i++) {
                tags.push(tiddler.tags[i].toLowerCase());
            }
            tags.sort();
        }

        // search theme for tagged template in the current theme
        if (tags.length && store.tiddlerExists(config.options.txtTheme)) {
            for (i = 0; i < tags.length; i++) {
                slice = config.options.txtTheme + '##' + tags[i] + template;
                if (store.getTiddlerText(slice)) {
                    return slice;
                }
            }
        }

        // search theme for tagged template tiddler
        for (i = 0; i < tags.length; i++) {
            tagTiddler = tags[i] + template;
            if (store.tiddlerExists(tagTiddler)) {
                return tagTiddler;
            }
        }

        // search theme for template
        if (store.tiddlerExists(config.options.txtTheme)) {
            slice = config.options.txtTheme + '##' + template;
            if (store.getTiddlerText(slice)) {
                return slice;
            }
        }

        return this._chooseTemplateForTiddler.apply(this, arguments);
    };
}
//}}}
The '''A1 Steam Locomotive Trust''' is a [[Darlington]], [[England]] based [[charitable trust]] formed in 1990 for the primary purpose of completing the next stage of the locomotive heritage movement, the building a new [[steam locomotive]]. This project became the construction of ''[[LNER Peppercorn Class A1 60163 Tornado|60163 Tornado]]'', carried out by '''Locomotive Construction Co Ltd''', a wholly owned subsidiary of the A1 Trust. After over 15 years of fundraising and construction, ''Tornado'' steamed for the first time in January 2008.
The '''Abbey Light Railway''' is a [[narrow gauge railway]] in [[Kirkstall]], [[Leeds]], [[West Yorkshire]], [[England]]. 
Built by enthusiasts, the Railway runs from the nearby Bridge Street commercial area into the grounds of [[Kirkstall Abbey]]. It operates most Sundays.
The '''Alderney Railway''' in [[Alderney]] is the only working railway in the [[Channel Islands]].  It opened in 1847 and runs for about two miles (3 km), mostly following a coastal route, from Braye Road to Mannez Quarry and [[Alderney Lighthouse|Lighthouse]]. 
The railway is run by volunteers and usually operates during summer weekends and bank holidays.  
The '''Alnwick branch line''' was a [[railway]] line in [[Northumberland]], northern [[England]]. It ran from [[Alnmouth railway station]], on the [[East Coast Main Line]], to the town of [[Alnwick]], a distance of 2.75 miles (4.5&nbsp;km). It opened in 1850 to both [[freight]] and [[passenger]] traffic; passenger operations included direct [[Newcastle Central station|Newcastle]] to Alnwick services, as well as regular [[Public transport|shuttle]] runs between Alnmouth and Alnwick. As late as 1966, some of the Alnmouth to Alnwick shuttles were operated by [[steam locomotive]]s, making this one of the very last [[British Rail]] routes with steam-hauled passenger services.
The '''Amberley Museum and Heritage Centre Railway''' is a {{RailGauge|2ft}} gauge railway based at the [[Amberley Museum and Heritage Centre]], [[Amberley, West Sussex|Amberley]], [[West Sussex]]. It has a varied collection of engines and rolling stock ranging from {{RailGauge|18}} gauge to {{RailGauge|63}} gauge. It Operates passenger Trains from Amberley Narrow Gauge Station to Cragside via Brockham using a mixture of Steam, Internal combustion and Battery-electric locomotives.

The '''Amerton Railway''' is a {{RailGauge|24}} narrow gauge [[heritage railway]] in the [[England|English]] county of [[Staffordshire]]. It is owned by the Staffordshire Narrow Gauge Railway Society.  Construction of the railway was begun in 1990 in a field at the side of [[Amerton Working Farm]]. The first trains ran in 1992, but it was around 10 years later when the railway was completed as a full circle with two passing loops.
The '''Amman Valley Railway''' runs alongside the River Amman, some 10 miles north of Swansea in west Wales. It is based around a heritage railway project on one of a number of railway lines that formerly served the various collieries of the area north of Swansea and Llanelli. Some of these lines also carried passengers. As of 2010 the line is being restored to its former condition, with the intention of running light rail trials in the coming year.
The '''Appleby Frodingham Railway''' [[heritage railway|Preservation Society]] is based at [[Scunthorpe]] in [[North Lincolnshire]]. The society owns locomotives and rolling stock but not the railway it runs on. The name comes from the [[Appleby-Frodingham Steel Company]], now simply known as Scunthorpe Works. The railway operates entirely within the [[Corus Group|Corus]] steelworks over the tracks normally used for moving iron, steel and materials around the works.
The '''Astley Green Colliery Museum''' is a museum run by the Red Rose Steam Society in [[Astley, Greater Manchester|Astley]] near [[Tyldesley]] in [[Greater Manchester]], England. ({{gbmapping|SJ70509996}})  Before becoming a museum, the site was a working [[colliery]] that produced coal from 1912 to 1970; it is now protected as a [[Scheduled Monument]].<ref name="pastscape">{{cite web |title=Astley Green Colliery |url=http://www.pastscape.org.uk/hob.aspx?hob_id=623407 |publisher=Pastscape.org.uk |accessdate=2008-04-27}}</ref> The museum occupies a {{convert|15|acre|ha|0}} site by the [[Bridgewater Canal]] which has the only surviving pit headgear and engine house on the [[Lancashire]] coalfield.
The '''Avon Valley Railway''' (AVR) is a three-mile-long [[heritage railway]] based at [[Bitton]] station in [[South Gloucestershire]], England, not far from [[Bristol]] and is run by a local group: The Avon Valley Railway Company Ltd.  The railway follows the Avon Valley south-east from [[Oldland Common]], through Bitton and alongside the [[River Avon, Bristol|River Avon]] towards [[Kelston]] and [[Bath, Somerset|Bath]]. The railway shares its route with the [[Sustrans]] [[cycleway]] and [[Rail trail|footpath]], the [[Bristol & Bath Railway Path]].
The '''Bala Lake Railway''' ([[Welsh language|Welsh:]] ''Rheilffordd Llyn Tegid'') is a [[heritage railway|preserved railway]] at [[Bala Lake]], in [[Gwynedd]], [[north Wales]], which runs for a distance of {{convert|4+1/2|mi|km|1}} using {{RailGauge|24}} gauge rolling stock.
'''Barrow Hill Roundhouse & Railway Centre''', until 1948 known as '''Staveley Roundhouse & Train Centre''', is a former [[Midland Railway]] [[roundhouse]] in [[Barrow Hill, Derbyshire|Barrow Hill]], near [[Staveley, Derbyshire|Staveley]] and [[Chesterfield]], [[Derbyshire]].  Staveley Roundhouse was built to a standard Midland square shed design in [[1870]].  After [[1948]] it became known as Barrow Hill so as not to confuse it with the ex-[[Great Central Railway|Great Central]] shed nearby.  It was operational from [[1870]] until 9 February [[1991]].  After becoming a [[listed building]] and following extensive renovation, the entire engine roundhouse, depot, yard, sidings and associated railway lines were all re-opened between 1989 and 1998. Ten years later it had become the home to many preserved British railway locomotives.
The '''Barry Tourist Railway''' (formerly the '''Barry Island Railway''') is a railway developed to attract visitors to [[Barry, Wales|Barry]] in the [[Vale of Glamorgan]], [[South Wales]]. It is a key element of the Barry Rail Centre which also includes Engineering and Training facilities.  An unusual aspect of the railway is that for several hundred yards across from Barry to Barry Island the trackbed used is directly alongside the [[Network Rail]] track which uses the original down line, with the Barry Tourist Railway using the up. This continues across the Causeway bridge where the lines diverge into separate platforms at Barry Island. The Railway does not consider itself a line but more of a network as it has two different routes. This is reflected in the map below, with Network Rail shown in red.
The '''Battlefield Line Railway''' is a [[heritage railway]] in [[Leicestershire]], [[England]]. It runs from [[Shackerstone]] (Grid ref {{mmukscaled|SK379065|25|SK 379 065}}) to [[Shenton]] ({{mmukscaled|SK396002|25|SK 396 002}}), via [[Market Bosworth]], a total of {{convert|4.5|mi|km}}. Shenton is near [[Battle of Bosworth Field|Bosworth Field]], (the location of the final battle of the [[Wars of the Roses]] immortalised in [[Shakespeare]]'s ''[[Richard III (play)|Richard III]]''), giving the railway its name.
The '''Bicton Woodland Railway''' is a [[narrow gauge railway]] running in gardens in the grounds of [[Bicton House, Devon|Bicton House]] near [[Budleigh Salterton]] in [[Devon]]. The line was built in 1962 as a tourist attraction for visitors to the house. Most of the rolling stock was acquired from the [[Royal Arsenal Railway]], [[Woolwich]], with two locomotives, ''Woolwich'' and ''Carnegie'' coming from that source, as well as seven goods wagons which were reduced to their frames and converted to passenger carriages. It opened to passengers in [[1963]]. Originally locomotives and carriages had [[royal blue]] livery.

The '''Bideford Railway Heritage Centre CIC''' (previously the Bideford and Instow Railway Group) in [[Devon]], [[England]], is responsible for the management of  [[Instow]] [[signal box]] which opens on occasional Sundays and [[bank holiday]]s from Easter to October. The Company is also responsible for the Bideford station site.  A railway museum existed in the rebuilt signal box at the [[Bideford]] site and short passenger rides were given there until 2006 when vandalism temporarily prevented services operating. The site was mothballed in 2008 when housing development threatened to encroach on the trackbed. This threat has now been removed and the company is working on putting permissions back in place, and renovating the site and rolling stock, so that services can recommence. The site remains accessible from the [[Tarka Trail]].
'''Birkenhead Dock Branch''' is a presently disused railway line running from the South junction of [[Rock Ferry railway station|Rock Ferry]], to the site of the former [[Bidston Dock]].  The branch is approximately {{mi to km|4.5}} in length and is accessible by rail from [[Bidston railway station|Bidston]] East junction. The former [[Birkenhead Mollington Street|Mollington Street Depot]] was joined to the branch line. Part of the branch runs through Haymarket Tunnel and a low-level [[Cutting (transportation)|cutting]]. The cutting is situated in the centre of [[Birkenhead]], visible from the road flyovers which are in the town centre. The disused [[Canning Street North]] [[signal box]] and [[level crossing]] are also situated on the branch. Level crossings are also situated across Duke Street and Wallasey Bridge Road. 
The '''Bluebell Railway''' is a [[heritage railway|heritage line]] running for nine miles along the border between [[East Sussex]] and [[West Sussex]], [[England]]. [[Steam train]]s are operated between k|Sheffield Park and Kingscote, with an intermediate station at Horsted Keynes.  The railway is managed and run largely by volunteers. It has the largest collection of steam locomotives in the [[United Kingdom|UK]] after the [[National Railway Museum]] (NRM) (though the Midland Railway, Butterley owns more locomotives after the collection overall), and a collection of almost 150 carriages and wagons (most of them from before or between the world wars), unrivalled in the south of England. In addition to the 30+ locomotives resident on the line, a project is well under way to recreate a long-lost type of locomotive (a [[London, Brighton and South Coast Railway]] [[LB&SCR H2 class|H2 Class]] [[4-4-2 (locomotive)|Atlantic]]) from a few surviving parts.
The '''Bodmin & Wenford Railway''' (BWR) is a [[heritage railway]], based at [[Bodmin]] in [[Cornwall]], United Kingdom. It has an interchange with the [[Network Rail|national rail network]] at [[Bodmin Parkway railway station]], the southern terminus of the line.  The [[Great Western Railway]] opened its branch line from [[Bodmin Parkway railway station|Bodmin Road]] to {{stnlnk|Bodmin General}} 27 May 1887, and on 3 September 1888 a junction line was opened to join with the [[Bodmin and Wadebridge Railway]] at which had opened its line from {{stnlnk|Bodmin North}} to {{stnlnk|Wadebridge}} in 1834.  The line closed on 3 October 1983 following the demise of freight traffic from [[Disused railway stations (Bodmin to Wadebridge line)#Wenford clay dries|Wenford]].
The '''Bo’ness and Kinneil Railway''' is a [[Heritage railway]] in [[Falkirk (council area)|Falkirk]], [[Scotland]].  It is operated by the [[Scottish Railway Preservation Society]], and operates some 5 miles of track, virtually the entire [[Slamannan and Borrowstounness Railway]] that became part of the former [[North British Railway]] on the [[Firth of Forth]]. [[Bo'ness railway station]] is the nucleus of the planned [[Scottish Railway Museum]].
The '''Bowes Railway''', built by [[George Stephenson]] in 1826, is the world's only preserved operational [[standard gauge]] [[cable railway]] system. It was built to transport [[coal]] from [[Durham]] [[Coal mining|pits]] to boats on the [[River Tyne]].  Only part of the system now remains.  A partnership of businessmen, including [[John Bowes]], called the ''Grand Allies'' opened a [[colliery]] at [[Springwell village|Springwell]]. A new railway was needed to transport the coal to the River Tyne. The plan was to combine steam power with gravity on the inclines. The railway was designed by [[George Stephenson]]. Of a similar design was Stephenson's earlier work on the [[Hetton-le-Hole|Hetton]] [[Hetton colliery railway|Colliery Railway]] which was completed in 1822.
The '''Brecon Mountain Railway''' ([[Welsh language|Welsh]]: ''Rheilffordd Mynydd Brycheiniog'') is a [[narrow gauge railway|narrow gauge]] [[heritage railway|preserved railway]] that runs through the [[Brecon Beacons]] along the full length of the [[Pontsticill Reservoir]].  It is located three miles north of [[Merthyr Tydfil]].  The line runs along part of the trackbed of the northern section of the former [[standard gauge]] [[Brecon and Merthyr Railway]] from [[Pant, Merthyr Tydfil|Pant]] to [[Pontsticill]] and then to [[Dolygaer]].  The purpose of the line is to take [[tourists]] into the [[Brecon Beacons National Park]] in preference to them entering with their [[car]]s.  Plans exist for the line to be extended as far as Torpantau, at the southern entrance to the tunnel that carried the line through the hills, along the side of Glyn Colwen and as far as [[Brecon]].
The '''Bredgar & Wormshill Light Railway''' ('''BWLR''') is located near the villages of [[Wormshill]] and [[Bredgar]] in [[Kent]], just south of [[Sittingbourne]]. It is a 2ft gauge [[narrow gauge railway]] about half a mile in length.  The BWLR is a private line which has been built up as a hobby by a group of friends since the early 1970s.<ref>[http://www.bbc.co.uk/kent/content/articles/2007/08/02/bredgar_steam_railway_video_feature.shtml BBC Kent article on the Bredgar & Wormshill Light Railway]</ref> It is a fully operational line, operated to a high standard, with a station, engine sheds and workshops at Warren Wood station and a smaller station at the other end of the line, known as Stony Shaw.
'''Bressingham Steam & Gardens''' is a steam [[museum]], gardens and garden centre located at Bressingham, west of [[Diss]] in [[Norfolk]], [[England]]. The site has several narrow gauge rail lines and a number of types of steam engines and vehicles in its collection and is also the home of the national [[Dad's Army]] exhibition.
The '''Bristol Harbour Railway''' is a [[preserved railway]] in [[Bristol]], [[England]]. It runs for about a mile along the south side of [[Bristol Harbour]], starting at the former [[Bristol Industrial Museum]] {{nowrap|({{coord|51.4483|-2.5969|type:landmark_region:GB|display=inline|name=Bristol Harbour Railway (Prince Street end)}})}}, stopping at the {{SS|Great Britain}}, and ending at [[B Bond Warehouse]] (home of the [[Create Centre]]), one of the large tobacco warehouses beside [[Cumberland Basin (Bristol)|Cumberland Basin]] {{nowrap|({{coord|51.4466|-2.6213|type:landmark_region:GB|display=inline|name=Bristol Harbour Railway (Cumberland Basin end)}})}}.  Although Bristol Industrial Museum, with which the railway was managed by [[Bristol City Council]], closed in late 2006, the railway remains in service.
{{cleanup|date=November 2010}}
{{one source|date=November 2010}}
{{coord|51.865|-0.929|display=title|region:GB_scale:10000}}
[[File:Quainton Road - Brill platform.JPG|thumb|Quainton Road station in 2006, showing the platform formerly used by the Brill trams]]
[[File:ChilternRailwaysClass121QuaintonPhoto2.jpg|thumb|Chiltern Railways [[British Rail Class 121|Class 121 'Bubble Car']] diesel unit at Buckinghamshire Railway Centre on a shuttle service from [[Aylesbury railway station|Aylesbury]] on 3 May 2010]] 
'''Buckinghamshire Railway Centre''' is a [[heritage railway|railway museum]] operated by the Quainton Railway Society Ltd. at [[Quainton Road railway station]], in the far depths of "[[Metro-land]]", about 5 miles (8&nbsp;km) west of [[Aylesbury]] in [[Buckinghamshire]]. The site is divided into two halves which are joined by two foot-bridges, one of which provides wheelchair access. Each side has a demonstration line with various workshop buildings as well as museum buildings. 

Buckinghamshire Railway Centre is rail-connected because Quainton Road station is on the [[Network Rail]] freight-only line (formerly a mainline used jointly by the [[Great Central Railway]] and the [[Metropolitan Railway]] through the Metropolitan and Great Central Railways Joint Committee) which connects [[Aylesbury railway station|Aylesbury]] with the [[Varsity Line|Bletchley to Oxford cross-country route]] at Claydon (LNE) Junction. This allows [[Chiltern Railways]] to operate occasional shuttle trains from Aylesbury to Quainton Road on Buckingham Railway Centre open days.

At the north-west corner of the site are the [[Terminal station|terminal]] buildings of 1851 from [[Oxford Rewley Road railway station]] transplanted here in 2002 to serve as reception, [[Visitor center|visitor centre]] and display building.

==Rolling Stock==
<ref>
{{cite web | url = http://www.brc-stockbook.co.uk/index.html | title = Quainton Virtual Stockbook Home | author = Quainton Railway Society | accessdate = 2008-06-08 }}</ref>
===Steam Locomotives===
:(from time to time a locomotive's older or newer number and livery might be used)
====Operational steam locomotives====
[[File:Metropolitan Railway E Class No 1.JPG|thumb|Metropolitan Railway 0-4-4T E Class No. 1]]
[[File:LSWR 0298 Class Beattie Well Tank 2.jpg|thumb|LSWR 0298 Class no. 0314 British Railways 30585]]
*[[Metropolitan Railway]] [[Metropolitan Railway E Class|0-4-4T E Class]] no. 1 (London Transport L44). Operational and a regular on passenger trains.[http://www.brc-stockbook.co.uk/Met1.htm]
*[[London and South Western Railway|LSWR]] 2-4-0WT [[LSWR 0298 Class|0298 Class]] no. 0314 ([[British Railways]] 30585). Operational, used regularly on passenger trains.[http://www.brc-stockbook.co.uk/beattie.htm]
*[[Peckett and Sons]] 0-4-0ST no. 2087. Operational and used on goods/vintage trains & occasionally on passenger trains.[http://www.brc-stockbook.co.uk/2087.htm]
*[[North British Locomotive Company]] 0-6-0T "Coventry no. 1". also "Thomas" on Thomas days, Operational and used on passenger trains.[http://www.brc-stockbook.co.uk/Coventry.htm]
*[[Peckett and Sons]] 0-4-0ST no. 2105 "Rokeby". Operational and used on goods/vintage trains & occasionally on passenger trains.[http://www.brc-stockbook.co.uk/2105.htm]
*[[Hudswell Clarke]] 0-4-0ST no. 1742 "Millom". Operational and used on goods and vintage trains, boiler ticket expires in 2018.[http://www.brc-stockbook.co.uk/1742.HTM]

====Steam locomotives off site====
*[[Great Western Railway|GWR]] 0-6-0PT [[GWR 5700 Class|5700 Class]] no. 7715 ([[London Passenger Transport Board|London Transport]][[London Underground steam locomotives|L99]]). Operational on the [[Spa Valley Railway]].[http://www.brc-stockbook.co.uk/GWR7715.htm]
*GWR 0-6-0PT [[GWR 9400 Class|9400 Class]] no. 9466. Operational, can be used on the mainline, on loan to the [[Birmingham Railway Museum]].[http://www.brc-stockbook.co.uk/GWR9466.htm]
*[[Aveling and Porter]] 0-4-0WT no. 3587 "Sydenham". On loan to Chatham Dockyard.[http://www.brc-stockbook.co.uk/Sydenham.htm]

====Steam locomotives undergoing overhaul, restoration or light repair====
*GWR 4-6-0 [[GWR 6959 Class|6959 "Modified Hall" Class]] [[no. 6989 "Wightwick Hall"]]. Undergoing restoration.[http://www.brc-stockbook.co.uk/Wightwick.htm]
*GWR 2-8-2T [[GWR 7200 Class|7200 Class]] no. 7200. Undergoing restoration.[http://www.brc-stockbook.co.uk/7200.htm][http://www.7200trust.org.uk/]
*[[Hunslet Engine Company]] 50550 class 0-6-0ST no. 3890. Undergoing overhaul.[http://www.brc-stockbook.co.uk/NCB66.htm]
*[[Peckett and Sons]] 0-4-0ST no. 1900 "Flying Bufferbeam". Britain's smallest standard-gauge steam locomotive now undergoing heavy overhaul.[http://www.brc-stockbook.co.uk/1900.htm]
*[[Andrew Barclay]] 0-4-0ST no. 699 "Swanscombe". This is the oldest surviving Barclay. In use from 2002–2008, now awaiting boiler & motion repair.[http://www.brc-stockbook.co.uk/swan.htm]

====Stored / static steam locomotives====
[[File:South African Railways 25NC Class No 3405 B.jpg|thumb|South African Railways 25NC Class No. 3405 at the Buckinghamshire Railway Centre]]
*[[Andrew Barclay]] 0-4-0F no. 1477. This one of the oldest [[Fireless locomotive]]s still in existence, built in 1916 now on static display awaiting overhaul.[http://www.brc-stockbook.co.uk/1477.htm]
*[[Sentinel Waggon Works]] 0-4-0 no. 9537 "Susan". Stored undercover awaiting overhaul.[http://www.brc-stockbook.co.uk/9537.htm]
*[[Yorkshire Engine Company]] 0-6-0ST no. 2498 "Chislet". On static display awaiting overhaul.[http://www.brc-stockbook.co.uk/chislet.htm]
*[[Hawthorn Leslie and Company]] 0-4-0ST no. 3717. Stored undercover awaiting overhaul.[http://www.brc-stockbook.co.uk/3717.htm]
*[[Hunslet Austerity 0-6-0ST]] no. 3850 "Juno". Stored awaiting overhaul.[http://www.brc-stockbook.co.uk/juno.htm]
*[[Andrew Barclay]] 0-4-0F no. 2243. On static display awaiting overhaul.[http://www.brc-stockbook.co.uk/2243.htm]
*[[Sentinel Waggon Works]] 0-4-0 no. 9366. Stored awaiting overhaul.[http://www.brc-stockbook.co.uk/9366.htm]
*[[W.G. Bagnall]] 0-4-0ST no. 2469 "Scott". Awaiting heavy overhaul.[http://www.brc-stockbook.co.uk/2469.htm]
*[[Hudswell Clarke]] 0-6-0T no. 1334 "Sir Thomas". On static display awaiting overhaul.[http://www.brc-stockbook.co.uk/1334.htm]
*[[Hunslet Engine Co.]] 0-6-0ST no. 3782 "Arthur". Stored Awaiting restoration.[http://www.brc-stockbook.co.uk/Arthur.htm]
*[[GWR Castle Class]] No. 5080 Defiant. [http://www.brc-stockbook.co.uk/defiant.HTM]
*25NC Class 4-8-4 No. 3405 ({{RailGauge|3ft6in}} gauge). [http://www.brc-stockbook.co.uk/25NC.htm]
*[[Aveling and Porter]] 0-4-0T No. 807 Brill. [http://www.brc-stockbook.co.uk/803.htm]

===Diesel locomotives===
[[File:D2298 at the Buckinghamshire Railway Centre 3.jpg|thumb|British Rail Class 04 No. D2298 at the Buckinghamshire Railway Centre]]
*[[British Rail|BR]] 0-6-0 [[British Rail Class 04|Class 04]] no. D2298
*[[John Fowler & Co.]] 0-4-0DM No. 20067 "Osram" [http://www.brc-stockbook.co.uk/Osram.htm]
*[[F. C. Hibberd & Co Ltd|F Hibberd "Planet"]] 0-4-0DM No. 3765 [http://www.brc-stockbook.co.uk/3765.htm]
*Hibberd 0-4-0DM No. 2102 [http://www.brc-stockbook.co.uk/2102.htm]
*Hibberd 0-4-0DM No. 3271 "Walrus" [http://www.brc-stockbook.co.uk/Walrus.htm]
*Hunslet (Kerr Stuart) 0-4-0DM No. K4428 Redland [http://www.brc-stockbook.co.uk/redland.htm]
*Hunslet 0-4-0DM No. 2067 [http://www.brc-stockbook.co.uk/2067.htm]
*[[Ruston (engine builder)|Ruston & Hornsby]] No. 425477 Arthur [http://www.brc-stockbook.co.uk/425477.htm]
*Ruston & Hornsby No. 463153 "Hilsea" [http://www.brc-stockbook.co.uk/Hilsea.htm]

===Diesel multiple units===
*BR [[British Rail Class 115|Class 115]] unit 51886+59761+51889 "Aylesbury College Silver Jubilee 1987"
===Electric Multiple Units===
[[File:London Post Office Railway 1930 Stock.jpg|thumb|1930 Stock Car No. 803 at the Buckinghamshire Railway Centre]]
*[[Post Office Railway]] (London) [[London Post Office Railway 1930 Stock|1930 Stock]] No. 803 [http://www.brc-stockbook.co.uk/POCar.htm]
*[[London Underground]] [[London Underground O Stock|CO/CP Stock]] unit 53028+013063+54233 [http://www.brc-stockbook.co.uk/COCar.htm][http://www.brc-stockbook.co.uk/COPCar.HTM][http://www.brc-stockbook.co.uk/CPCar.HTM]
*New York Subway Car No. 1144 [http://www.brc-stockbook.co.uk/NYCar.htm]

===Carriages & Vans===
*BR [[Post Office Sorting Van|Mk 1 TPO sorting van]] no. 80394
*London Transport [[London Underground engineering stock|brake vans]] nos. B557 and FB578

==External links==
{{commonscat|Buckinghamshire Railway Centre}}
*[http://www.bucksrailcentre.org/ Buckinghamshire Railway Centre website.]
*[http://www.brc-stockbook.co.uk/index.html Buckinghamshire Railway Centre Stockbook]

==References==
<references/>

{{Heritage railways in England}}
{{Transport in Buckinghamshire}}

[[Category:Heritage railways in England]]
[[Category:Museums in Buckinghamshire]]
[[Category:Railway museums in England]]
{{Heritage Railway
|name      = Bure Valley Railway
|image     = [[Image:Bure Valley Railway DSC00533.jpg|centre|300px]]
|caption   = Locomotive ''Spitfire'' at [[Aylsham]], [[Norfolk]] railway station
|locale    = [[Wroxham]]<br />{{coord|52.7168|1.4084|type:railwaystation_region:GB|display=inline,title}}
|terminus  = [[Aylsham]]<br />{{coord|52.7911|1.2548|type:railwaystation_region:GB|display=inline|name=Aylsham South station}} 
|linename  = Bure Valley Railway
|builtby   = 
|originalgauge = {{RailGauge|ussg}}
|preservedgauge = {{RailGauge|15}} 
|era      = 
|owned    = 
|operator = Bure Valley Railway
|stations = 5
|length   = {{convert|9|mi|km|1|abbr=on}}
|originalopen = 1880
|closed   = 1982
|years    = 10 July 1990
|events   = opened
}}
{{Bure Valley Railway}}
The '''Bure Valley Railway''' is a {{RailGauge|15}} [[minimum gauge]] [[heritage railway]] in [[Norfolk, England|Norfolk]], within [[The Broads National Park]].
The railway runs from [[Wroxham]] to [[Aylsham]] ({{convert|9|mi|km|1|disp=/}}) and is Norfolk's longest railway of less than [[standard gauge]]. It uses both [[steam]] and [[diesel locomotive]]s.  There are intermediate halts at [[Brampton, Norfolk|Brampton]], [[Buxton, Norfolk|Buxton]] and [[Coltishall]].  There are 17 bridges, including a {{convert|105|ft|m|0|abbr=on}} long girder bridge over the [[River Bure]] in [[Buxton with Lammas]] as well as [[Aylsham Bypass Tunnel]] under the [[A140 road|A140]] at [[Aylsham]].

== History ==
The railway is built on the trackbed of the [[East Norfolk Railway]] (ENR). The ENR started in 1877 when the East Norfolk Railway opened from [[Norwich, England|Norwich]] to [[Cromer]], with an extension from [[Wroxham]] to [[Aylsham]] in 1880. The ENR was taken over by the [[Great Eastern Railway]] in 1882, which was amalgamated into the [[London & North Eastern Railway]] in 1923. The [[rail nationalisation|railway was nationalised]] in 1948.

In 1952 the [[passenger train|passenger]] service stopped, but the [[freight train|freight]] service continued. {{stnlnk|Buxton Lammas}}, as it was then known, closed for goods in 1964, and Aylsham and [[Coltishall]] in 1974. 

Freight trains continued to run over the line after this for two principal sources of traffic.  The line west of Aylsham via [[Cawston]] and [[Reepham, Norfolk|Reepham]] originally went further to a junction at [[County School railway station|County School Station]]; by this time it instead turned south via a new curve at Themelthorpe to join a fragment of the old [[Midland and Great Northern Joint Railway|Midland and Great Northern]] system to reach {{stnlnk|Lenwade}} and {{stnlnk|Norwich City}}.

[[Coal]] traffic continued to be carried from {{stnlnk|Norwich Thorpe}} via [[Aylsham]] to Norwich City - a fantastic trip around Norfolk just to cross Norwich!  There was also regular traffic from Lenwade in the form of concrete building components.

This traffic ended in 1981 and the line through Aylsham formally closed on 6 January 1982.  A weed-killing train ran in 1983 and track-lifting trains ran the following year.

== Re-opening ==
The Bure Valley Railway opened on 10 July 1990, and a [[long distance footpath]] ([[rail trail]]) opened alongside it in [[1991]].  It is currently home to [[Aylsham Bypass Tunnel|Norfolk's only operational]] [[List of tunnels in the United Kingdom|railway tunnel]], which carries the railway under the Aylsham [[Bypass (road)|Bypass]].  The [[Cromer Tunnel|only other tunnel]], in [[Cromer]], is disused.

== Locomotives ==
{| class="sort wikitable sortable" 
!No.
!Name
!Livery
!Locomotive type
!Wheel <br>arr.
!In Traffic?
|-
|align=center|1
|align=center|Wroxham Broad
|align=center|Light Blue
|align=center|Steam
|align=center|[[2-6-4T]]
|align=center|Yes
|-
|align=center|6
|align=center|Blickling Hall
|align=center|Midland Crimson Lake
|align=center|Steam
|align=center|[[2-6-2]]
|align=center|Yes
|-
|align=center|7
|align=center|Spitfire
|align=center|Brunswick Green
|align=center|Steam
|align=center|[[2-6-2]]
|align=center|Yes
|-
|align=center|8
|align=center|Thunder
|align=center|BR Lined Black
|align=center|Steam
|align=center|[[2-6-2T]]
|align=center|Yes
|-
|align=center|9
|align=center|Mark Timothy
|align=center|Madderlake
|align=center|Steam
|align=center|[[2-6-4T]]
|align=center|Yes
|-
|align=center|3
|align=center|2nd Air Division USAAF
|align=center|Golden Ochre
|align=center|Diesel
|align=center|Bo-Bo
|align=center|Yes
|-
|align=center|4
|align=center|Awaiting Naming
|align=center|Orange
|align=center|Diesel
|align=center|0-4-0
|align=center|Yes
|-
|align=center|5
|align=center|Toby
|align=center|Brown
|align=center|Diesel
|align=center|0-4-0
|align=center|Rarely
|-
|}

When the railway first opened, several locomotives were hired from the [[Romney, Hythe and Dymchurch Railway]], including: Southern Maid, Samson and Winston Churchill.

== Operations ==
The track is laid to a gauge of {{RailGauge|15}}. The railway is operated by a fleet of five steam and three diesel locomotives. Passenger rolling stock consists of 26 fully-enclosed bogie carriages and two four-wheel brake vans.  Trains almost always include carriages capable of accommodating wheelchairs. Approximately half the carriages are equipped with electric heating, for winter services.

== The Friends of the Bure Valley Railway ==
The Friends of the Bure Valley Railway (FoBVR) is the volunteer supporting group for the Bure Valley Railway. It owns locomotive number 4 and supports the railway financially and with regular working parties of volunteers. There is a hut at Aylsham which sells second hand magazines during the season to support the Friends.

== External links ==
{{commonscat|Bure Valley Railway}}
*[http://www.bvrw.co.uk/ Bure Valley Railway website]
<!-- *[http://www.fobvr.org.uk/ Friends of the Bure Valley Railway website] -->

Other Places in Norfolk

*[[Bressingham Steam and Gardens]]
*[[North Norfolk Railway]]
*[[Mid-Norfolk Railway]]
*[[Wells and Walsingham Light Railway]]
*[[Whitwell & Reepham railway station]]
*[[Yaxham Light Railway]]

{{Heritage railways in England}}
{{15 inch gauge railways}}

[[Category:Broadland]]
[[Category:Heritage railways in England]]
[[Category:Minimum gauge railways]]
[[Category:Visitor attractions in Norfolk]]
[[Category:Transport in Norfolk]]
[[Category:North Norfolk]]
[[Category:Rail trails in England]]
The Cadeby Light Railway was a narrow gauge railway in the garden of the rectory in Cadeby, Leicestershire. In the early 1960s the Reverend Teddy Boston became rector of All Saints' Church, Cadeby. Boston was a lifelong railway enthusiast and wanted to build a miniature railway in his new garden, but the cost proved prohibitive. Instead he searched for a full sized narrow gauge locomotive. In 1962 he purchased Pixie a W.G. Bagnall 0-4-0ST from the Cranford quarry. The quarry owners donated a short length of track and two wagons and the Cadeby Light Railway was opened. Over the years, the Rev. Boston built an extensive collection of ex-industrial narrow gauge rolling stock which ran on the extremely short line in his garden. Although the Rev. Boston died in 1986 his widow Audrey kept the railway open for nearly twenty years, holding regular open days. The railway finally closed in 2005, subsequently the majority of the collection has been amalgamated with the Moseley Railway Trust at the Apedale Community Country Park.

The Cambrian Railways Society (CRS) in Oswestry, Shropshire, England, plans to restore the former branch line from Blodwel to Llynclys Junction as a heritage railway. This adjoins the former Nantmawr branch line. Formed in 1972, the society has established a museum dedicated to the history of railways in the Oswestry area. The museum is housed in the sole-surviving Oswestry &amp; Newtown Railway goods shed. A new attraction for 2006 was the recently restored Oswestry South Signal Box, which had been restored thanks to a £22,000 grant from the Oswestry Visitor Facilities Infrastructure fund, using a mixture of contract and volunteer labour from the society. A former Oswestry Works apprentice carpenter, Bill Braddick, has worked on the ornate woodwork, including the facings and bargeboards. The town centre site includes a workshop where maintenance and restoration of the Society's exhibits, both operational and non-operational, takes place. The Society has authority to run Light Railway operations along the short section of railway between Oswestry Railway Station and Middleton Road Bridge. As a prelude, and as part of the reinstatement scheme under the Cambrian Heritage Railways project, it is intended that diesel passenger trains will operate seasonally along this section from Oswestry Station with effect from Easter 2010.
The Cambrian Railways Trust is based at Llynclys near Oswestry, Shropshire, England, very close to the border with Wales. Oswestry was the headquarters of the former Cambrian Railways, previous to the 1922 regrouping of UK railways to form part of The Great Western Railway (GWR), one of the "Big Four" railway companies. The Cambrian Railways Trust (CRT) has formed a working partnership with the nearby Cambrian Railways Society (CRS) and the Oswestry Station Buildings Trust (OSBT), to reinstate the infrastructure required to develop and operate the heritage railway from Gobowen to Llynclys Junction (for Pant) and to Blodwel, under the project known as Cambrian Heritage Railways. http://www. cambrianrailways. com/index. html The railway land and trackbed were purchased from Network Rail by Shropshire County Council; and the new unitary authority, Shropshire Council, has agreed to lease the land to the partnership bodies with effect from April 2009. Prior to this, the Trust has operated regular weekend diesel-multiple unit (DMU) operations since 2006 over a repurchased/re-leased and then restored section of 62 chains (about three quarters of a mile) from Llynclys South station to Penygarreg Lane. Regular steam operations took place during the 2008 and 2009 seasons.
The Chasewater Railway is a former colliery railway running round the shores of Chasewater in Staffordshire, England. It is now operated as a heritage railway.
The Chinnor &amp; Princes Risborough Railway is a heritage railway with its main station at Chinnor on the border between Buckinghamshire and Oxfordshire, England.
The Cholsey and Wallingford Railway is a 2.5-mile (4 km) long standard gauge heritage railway in the English county of Oxfordshire. It operates along most of the length of the former Wallingford branch of the Great Western Railway (GWR), from Cholsey station, 12 miles (19 km) north of Reading on the Great Western Main Line, to a station on the outskirts of the nearby town of Wallingford.
The Churnet Valley Railway is a standard gauge heritage railway based at Cheddleton station to the east of Stoke-on-Trent in Staffordshire. At present it is 5.25 miles (8.4 km) long.
Cleethorpes Coast Light Railway is a 15 in (381 mm) railway built in 1948 in Cleethorpes, North East Lincolnshire operating between Cleethorpes Leisure Centre and behind Pleasure Island/buck beck. It was originally built to a slightly smaller gauge.
The Colne Valley Railway is a heritage railway based at Castle Hedingham Station, near Halstead in Essex, England. The railway consists of a mile-long running line, with a fully reconstructed station, signal box and railway yard. Despite its short length, the CVR is home to three ex-mainline steam locomotives and holds Pullman dining services on a monthly basis.
The Corris Railway is a narrow gauge preserved railway based in Corris on the border between Merionethshire and Montgomeryshire in Mid-Wales. The line opened in 1859, and originally ran from Machynlleth north to Corris and on to Aberllefenni. Branches served the slate quarries at Corris Uchaf, Aberllefenni, the isolated quarries around Ratgoed and quarries along the length of the Dulas Valley. The railway closed in 1948, but a preservation society was formed in 1966, initially opening a museum; a short section of line between Corris and Maespoeth was re-opened to passengers in 2002. The railway now operates as a tourist attraction. A new steam locomotive was built for the railway, which was delivered in 2005. The two surviving locomotives, plus some of the original rolling stock, are preserved on the nearby Talyllyn Railway. The gauge of the railway is 2 ft 3 in (686 mm).
Coventry Railway Centre is located in Warwickshire, south of Coventry city, outside Baginton, and near to Coventry Airport.
Darlington Railway Centre and Museum, also known as Head of Steam, is located on the 1825 route of the Stockton and Darlington Railway which was the world's first steam powered passenger railway. Run by Darlington Borough Council the museum is located in the northern suburbs of Darlington in the ceremonial county of County Durham, England. The site encompasses three significant Stockton and Darlington Railway buildings of the 1830s: North Road railway station, the goods shed and Hopetown Carriage Works. Exhibits include George Stephenson's Locomotion No 1, built for the opening of the Stockton &amp; Darlington Railway, and Derwent, the earliest surviving Darlington built locomotive, on loan from The National Railway Museum collection. Locomotion No 1 is one of the oldest surviving steam engines in the world and the first ever steam train to carry fare paying passengers. In April 2008, it was re-branded as Head of Steam, following a £1.7m refurbishment project.
The Dartmoor Railway is a 15.5-mile (24.9 km) long railway line in Devon, England. From Crediton the line parallels the Tarka Line to the site of the former Coleford Junction. Heading west it then serves Sampford Courtenay, Okehampton and Meldon Quarry. The route is owned from Coleford to Meldon by Aggregate Industries. Freight trains serve the ballast quarry at Meldon. The line is leased to and maintained by the Dartmoor Railway CIC, who operate heritage railway services on certain days. A public service between Exeter and Okehampton is run on summer Sundays operated by First Great Western. Ballast trains are operated by one of the national freight operating companies. The route was originally part of the London and South Western Railway West of England Main Line from Exeter to Plymouth, which opened between 1865 and 1879. In 1968, British Rail closed the line beyond Meldon as part of the Beeching cuts. The Exeter to Okehampton passenger service was withdrawn by British Rail in 1972. Between 1972 and 1997 the line was used for railway ballast traffic from Meldon Quarry and occasional freight traffic to the remaining goods yard at Okehampton before its closure. Occasional Charter and Special trains operated to Okehampton and Meldon Quarry during the passenger closure period. The railway reopened to regular passenger services in 1997 with the creation of Dartmoor Railway.
The Dean Forest Railway is a 4.25-mile (6.8 km) long heritage railway that runs between Lydney and Parkend in the Forest of Dean, Gloucestershire. The route was part of the Severn and Wye Railway which ran from Lydney to Cinderford. The society that operates the line started steam locomotive operations in 1971, and bought the trackbed and line from British Rail in 1986. Services were extended from Norchard to Lydney Lakeside in 1991, Lydney Junction in 1995/96, Tufts Junction in 2001, and to Whitecroft in 2003. HM Railway Inspectorate approval for the section to Parkend was granted in December 2005. Trains are operated by both steam and heritage diesel locomotives, and heritage diesel multiple units. The Dean Forest railway has recently been given the former GWR signal box that stood slightly to the east of Codsall station in Staffordshire. Its removal was completed in July 2007, and will be placed at Whitecroft railway station.
The Derwent Valley Light Railway (DVLR) (also known as The Blackberry Line) was a privately-owned standard-gauge railway running from Layerthorpe on the outskirts of York to Cliffe Common near Selby in North Yorkshire, England. It opened in 1913, and closed in sections between 1965 and 1981. Between 1977 and 1979, passenger steam trains operated between Layerthorpe and Dunnington — the entire length of track at that time. In 1993 a small section was re-opened as part of the Yorkshire Museum of Farming at Murton. The line gained its nickname of The Blackberry Line in the days when it used to transport blackberries to markets in Yorkshire and London.
The Devon Railway Centre is in the village of Bickleigh in Mid Devon, England, at the former Cadeleigh railway station on the closed Great Western Railway branch from Exeter to Dulverton, also known as the Exe Valley Railway. The Centre operates a 2ft (610mm) gauge passenger railway and has the largest narrow gauge collection in the South West. There is also a miniature railway at the site and a model railway at the Centre, where some of the nation's most famous working layouts can be seen. The original Victorian station has been carefully restored.
Didcot Railway Centre, located in the town of Didcot in the English county of Oxfordshire, is based around the site of an old engine shed which became redundant due to the nationalisation of the UK railways, as well as the gradual switch from steam to diesel power.
The Don Valley Railway is a Heritage Railway project began in September 2003 to restore a passenger rail link along the section of the Woodhead Line that runs between Deepcar and Sheffield Don Valley. The project is being developed by Don Valley Railway Ltd. , a not-for-profit company and registered charity that is based in Stocksbridge, South Yorkshire. The company plans to renovate and reopen some of the closed stations along the route, as well as building 2 or 3 new ones. Once the infrastructure is completed, the company plans to operate steam, diesel and electric trains for the purposes of tourism at weekends and weekday commuter service.
Doncaster railway works is in the town of Doncaster, South Yorkshire, England. Always referred to as "the Plant", it was established by the Great Northern Railway in 1853, replacing the previous works in Boston and Peterborough. Until 1867 it only undertook repairs and maintenance. In 1866, Patrick Stirling was appointed as Locomotive Superintendent, and the first of the 875 class was built in 1886. At this time the works also began building new coaches, with, in 1873 the first sleeping cars, in 1879 the first dining cars in the United Kingdom and, in 1882 the first corridor coaches. By 1891, 99 locomotives, 181 carriages and 1493 wagons were being built in the year. Among the locomotives the works produced were the Stirling Singles, the Ivatt Atlantics and the Gresley Pacifics, including the world famous Flying Scotsman, the first locomotive to achieve 100 mph and also run from London King's Cross to Edinburgh Waverley non-stop; and Mallard which achieved the top speed of 126 mph on 3 July 1938 to become the world's fastest steam locomotive, a record that she still holds to the present day. These have hauled such trains as the 'Flying Scotsman', 'Silver Jubilee', 'Coronation' and the 'Elizabethan''. Doncaster also constructed the carriages for the last of these. The works continued building all kinds of rolling stock. During World War II, like other workshops it joined in the war effort, among other things, producing Horsa gliders for the D-Day airborne assault. The carriage building shop was destroyed by fire in 1940. New buildings in 1949 were designed with the BR standard all-steel carriages in mind. In 1957, the last of over two thousand steam locomotives was built and, in 1962, carriage building finished, but the works was modernised with the addition of a diesel locomotive repair shop. Under BREL, new diesel shunters and 25 kV electric locomotives have been built, plus Class 56 and Class 58 diesel-electric locomotives. In July 2003 'The Plant' celebrated its 150th anniversary, with an open weekend, a link to the picture gallery for the weekend can be found below. The works is now over 155 years old. In early 2008 the Crimsal erecting shop was demolished to make way for housing.
The Douglas Bay Horse Tramway is a horse-drawn tramway in Douglas on the Isle of Man. The route runs along the seafront promenade for approximately 1.6 miles (~2.8 km), from a southern terminus at the Victoria Pier, by the Sea Terminal to a northern terminus at Derby Castle, the southern terminus of the Manx Electric Railway, where the workshops and sheds are also located.
The Downpatrick &amp; County Down Railway is a heritage railway in County Down, Northern Ireland. The project is based at Downpatrick, on part of the former route of the Belfast &amp; County Down Railway. The railway, which has a triangular layout, connects two local tourist attractions, Inch Abbey to the north, and a locally famous Viking site (King Magnus' Grave) to the south, and will eventually reach an 18th century corn mill to the south.
The East Anglian Railway Museum is located at Chappel and Wakes Colne railway station in Essex, which is situated on the former Great Eastern Railway branch line from Marks Tey to Sudbury. Services on the Sudbury Branch Line are operated by National Express East Anglia. The Museum has a wide collection of locomotives and rolling stock, some of which are fully restored while others are undergoing repair and restoration. The Restoration Shed was built in 1983–4, prior to which most work had to take place in the Goods Shed or in the open. On event days, steam train rides are operated over a short demonstration track. The Museum also plays host to two popular annual events: the Cider Festival held each June, and the Beer Festival held each September. During the festivals, additional late-evening trains on the Sudbury Branch Line allow festival-goers to return home by train.
The East Hayling Light Railway is a 2 ft (610 mm) gauge narrow gauge railway on Hayling Island, Hampshire, England. Its first services ran in July 2003. As of 2006 there is more than a mile of track in place and it is planned to extend it to the ferry terminal connecting the island with Portsmouth so providing a useful transport link. The extension is called the 'link'.

The East Lancashire Railway is a heritage railway in Lancashire and Greater Manchester, England.
The East Somerset Railway is a 2.5 miles heritage railway in Somerset, running between Cranmore and Mendip Vale. Prior to the Beeching Axe, the railway ran from Witham to Wells, meeting both the Cheddar Valley line and Somerset and Dorset Joint Railway at the latter station.
The Eaton Hall Railway was an early 15 in (381 mm) gauge narrow gauge estate railway built in 1896 at Eaton Hall in Cheshire. It was built for the Duke of Westminster by Sir Arthur Percival Heywood, who had pioneered the fifteen inch (381 mm) gauge with his Duffield Bank Railway, and connected the hall to the GWR station sidings at Balderton on their Shrewsbury to Chester Line, some 3 miles (4.8 km) away.
The Ecclesbourne Valley Railway is an 8.5-mile (13.7 km) long heritage railway in Derbyshire, with operations based at Wirksworth station. It is currently planned to extend the railway along the former Midland Railway branch line which joined the main-line at Duffield. Despite being a branch in itself, there is also has a separate three quarter-mile branch operating from Wirksworth Station Platform 3 to Ravenstor (for the National Stone Centre and High Peak Trail) on a 1 in 27 gradient incline. The line is principally operated by one of the largest fleets of operational heritage Diesel Multiple Units in the UK, with some locomotive hauled trains operating on special event days. There will be the introduction of a fully-rebuilt steam industrial locomotive during 2010.
The Eden Valley Railway (EVR) was a railway in Cumbria, England. It ran between Clifton Junction near Penrith and Kirkby Stephen via Appleby-in-Westmorland. Passenger traffic ended in 1962 and the line was reduced to the track between the junction at Appleby station with the Settle-Carlisle Line and Kirkby Stephen which served a quarry. By 1976 all that was left was 6 miles of track between Appleby in Westmorland and Flitholme which was used infrequently by the British Army at Warcop In 1995 the Eden Valley Railway Society was formed with the aim of re-instating services and restoring on the line. Heritage railway services resumed in 2006 between Warcop and Sandford, where a halt is being considered.
The Elsecar Heritage Railway is located on the southern part of the former South Yorkshire Railway freight-only branch which ran from Elsecar Junction on its Mexborough to Barnsley line. The line was built to serve Earl Fitzwilliam's collieries and ironworks, which he leased out to local ironmasters. The Elsecar Heritage Railway operates trains on a 1 mile (1.6 km) section of the branch with using steam and diesel locomotives currently running between Rockingham Station (at the back of the Elsecar Heritage Centre) and Hemingfield Basin. There are plans to extend the line to Cortonwood. The railway is operated using a variety of different preserved rolling stock.
The Embsay &amp; Bolton Abbey Steam Railway (E&amp;BASR) is a heritage railway in North Yorkshire, England, (formed in 1979). It is part of the former Midland Railway branch from Skipton to Ilkley (which closed down in 1965 14 years earlier). The E&amp;BASR runs from Embsay via Holywell and Draughton to Bolton Abbey station, a distance of 4 miles (6 km). It is a long-term objective to extend the line to Addingham and Skipton.
The Epping Ongar Railway operates on a preserved railway along the final section of the old Great Eastern Railway and London Underground Central Line branch line between Epping and Ongar, with an intermediate station at North Weald. The line was reopened in late 2004 after 10 years of closure (operating a Sunday and Bank Holiday service using a Class 117 diesel multiple unit), running between Ongar and Coopersale. The service is provided by volunteers who maintain the line as well as run the trains. The land and infrastructure is owned by a separate company, Epping Ongar Railway Ltd.
|} Die Fairbourne Railway ist eine Miniaturschmalspurbahn mit heute 311 mm Spurweite und einer Länge von 3,2 km. Sie führt vom Küstenort Fairbourne im nördlichen Mittel-Wales am Strand entlang zur Halbinsel mit dem Anleger der Barmouth Ferry, mit der die Fahrgäste mit der Fähre zum Badeort Barmouth über die Mündung des Flusses Mawddach übersetzen können. Die Bahn war stets eine Touristenbahn und hatte im Gegensatz zu vielen anderen Schmalspurbahnen in Wales nur in ihren Anfangstagen eine Bedeutung für den Güterverkehr.
The Fakenham and Dereham Railway Society (F&amp;DRS) was a heritage railway society in the English county of Norfolk. For a short period of time it operated County School railway station as the Wensum Valley Railway. The F&amp;DRS later became the Mid-Norfolk Railway Preservation Trust, owners and operators of the Mid-Norfolk Railway.
The Ffestiniog Railway is a narrow gauge heritage railway, located in Gwynedd in Wales. It is a major tourist attraction located mainly within the Snowdonia National Park. The railway is about 13+⁄2 miles (21.7 km) long and runs from the harbour at Porthmadog to the slate mining town of Blaenau Ffestiniog. The line travels through mountainous scenery and is single track with passing places. The track gauge is 1 ft 11+⁄2 in (597 mm). The first part of the line runs along a 1 mile (1.6 km) long embankment called "the Cob", which is the dyke of the Traeth Mawr "polder".
The Fleetwood Branch Line consists of the train line from Preston to Fleetwood. It passed through many smaller stations along the way (most of which are now closed). When work at Fleetwood docks was under threat, the Fleetwood station was closed, this effectively closed the branch in 1970. Proposals exist to re-open the branch to passenger services in the near future.
The Foxfield Light Railway is a preserved standard gauge line located south east of Stoke-on-Trent. The line was built in 1893 to serve the colliery at Dilhorne on the Cheadle Coalfield. It joined the North Staffordshire Railway line near Blythe Bridge.
The Gartell Light Railway is a narrow gauge heritage railway located at Yenston, south of Templecombe, in Somerset, England. It operates a 2 ft (610 mm) gauge railway running for 0.75 mile (1.2 km), partly along the track of the old Somerset and Dorset Joint Railway.
|} The Garw Valley Railway (formerly Bridgend Valleys Railway) is a standard gauge heritage railway located in South Wales. It is hoped that, in the near future, there will be brakevan rides between Pontycymer and Pant-y-Gog, a distance of about half-a-mile. The line was formally used for freight and passenger services, and the track is still in place between Brynmenyn and Pontycymer. On 4 March 2006, the Society changed its name from Bridgend Valleys Railway to Garw Valley Railway .
The Gloucestershire Warwickshire Railway (GWR or GWSR) is a volunteer-run heritage railway that has reopened the closed railway line between Toddington and Cheltenham Racecourse railway stations in Gloucestershire. It is currently extending to Broadway, Worcestershire, but none of it is actually in Warwickshire. In the long term the GWR could extend even further: south to Cheltenham Spa railway station and even north to Stratford on Avon and thus become the longest heritage railway in England.
The Glyn Valley Tramway was a narrow gauge railway that connected Chirk with Glyn Ceiriog in Denbighshire (now Wrexham County Borough), Wales. The gauge of the line was 2 ft 4+⁄2 in (724 mm). The total length of the line was 8+⁄4 miles (13.3 km), 6+⁄2 miles (10.5 km) of which were worked by passenger trains, the remainder serving a large granite quarry and several minor slate quarries.

The Great Laxey Mine Railway was originally constructed to serve the Isle of Man's Great Laxey Mine, a lead mine located in Laxey. The 1 ft 7 in (483 mm) gauge railway runs from the old mine entrance to the washing floors along a right of way that passes through the Isle of Man's only railway tunnel under the 3 ft (914 mm) gauge Victorian Manx Electric Railway and the main A2 Douglas to Ramsey coast road.
The Great Little Trains of Wales ist eine Vereinigung der meisten touristisch genutzten Schmalspurbahnen in Wales. Ihre Aufgabe ist ein gemeinsames Marketing. Ziel ist es dabei auch, mehr Touristen nach Wales zu locken. Die Vereinigung wurden in den 1970er Jahren gegründet und zählt seit dem Beitritt der Snowdown Mountain Railway im Jahr 2008 zehn Mitglieder. Die Vereinigung bietet eine Rabattkarte an, mit der auf allen zehn Linien eine Fahrpreisermäßigung gewährt wird. Im Jahr 2009 hatte die Vereinigung die folgenden Mitglieder: Keine Mitglieder der Vereinigung sind die Fairbourne Railway, die Standseilbahn Great Orme Tramway in Llandudno und die allerdings normalspurige Llangollen Railway (Stand 2009).
The Great Whipsnade Railway, also known as The Jumbo Express, is a 2 ft 6 in (762 mm) gauge narrow gauge heritage railway that operates within Whipsnade Zoo.
The Groudle Glen Railway is a narrow gauge railway north of Douglas in the Isle of Man which is owned and operated by members of the Isle of Man Steam Railway Supporters' Association and operates on summer Sundays; May to September and Wednesday evenings in July and August along with a number of annual special events.
This is a general list of rolling stock and locomotives currently or formerly on the Groudle Glen Railway on the Isle of Man.
The Gwili Steam Railway operates a standard gauge preserved railway from Abergwili Junction in South Wales along a short section of the former Carmarthen to Aberystwyth railway that closed for passenger traffic in 1965, the track being lifted in 1975. The Gwili Railway was formed in 1975 and, by 1978, had purchased and rescued about eight miles of track and was running an initial steam-hauled service on a one-mile section of it. The Gwili Railway has the distinction of becoming the first standard-gauge preserved railway to operate in Wales when it re-opened the one-mile section of the Carmarthen-Newcastle Emlyn route from its base at Bronwydd Arms, three miles north of Carmarthen. Since then, the railway has expanded to Danycoed and the company continues to hope to expand to Llanpumpsaint. Currently, the railway is working south towards Carmarthen to a new station called Carmarthen North built at the old Abergwili junction. The locomotive stock of the Gwili Railway is unusual in that it mostly represents local industrial and wartime operations rather than mainline services. In an interview with Steam Railway Magazine, it was stated that railway intends to obtain a larger loco or locos for passenger service.
The Heatherslaw Light Railway is a 15 in (381 mm) gauge passenger carrying railway in Northumberland, England, near the border with Scotland. Founded by Neville Smith, the railway opened in 1989 on the Ford and Etal estate. It operates over a route from Heatherslaw to Etal Village, a little more than 3 kilometres in length. The railway normally operates from March to October inclusive, with an hourly (half-hourly during busy days) train service, but closes for the winter season. The passenger coaches include facilities for transporting wheel chairs, and a typical summer season eight-coach train can convey up to 150 passengers. The railway's principal locomotive from its opening has been an 0-4-2 steam engine named 'The Lady Augusta', built by the Kirklees Light Railway in Yorkshire. The second locomotive is a diesel engine named 'Clive'. The third locomotive partially built by Neville Smith has been completed by Alan Keef. The station at Heatherslaw features an overall roof covering two hard-surfaced platforms; a third line serves as a locomotive release road for engines to run round trains; there are also storage sidings and sheds, as well as a ticket office and shop. The smaller station at Etal has a simple terminal passing loop (with central platform) and a turntable.
The Helston Railway Preservation Company is a heritage railway that aims to rebuild the Helston branch line that linked Gwinear Road on the Cornish Main Line to Helston, Cornwall, England.
Heritage Shunters Trust is a trading name of The South Yorkshire Railway Co. Ltd. which was founded in 1989. HST is a railway preservation society which specialises in the preservation of diesel shunters and the initials HST can be seen as a pun on High Speed Train (shunters being very low-speed machines). The locomotives are kept at Rowsley, Derbyshire on the site of preserved railway Peak Rail but the company is certainly a separate outfit.
The Highland Locomotive Company is a subsidiary of the Strathspey Railway Company. The Strathspey Railway Company operate and own most of, the Strathspey Railway, a heritage railway based in the Central Highlands. The Highland Locomotive Company own three steam locomotives based on the Strathspey Railway. They are: Former British Railways Locomotive Number 46512. 46512 is a London Midland and Scottish Railway designed locomotive built by British Railways at Swindon Works in 1952. The locomotive was designed by George Ivatt to replace many of the ageing 0-6-0 engines that the LMS used to work on secondary duties and on rural branches. 46512 is a 2-6-0 tender engine with a simple 2 cylinder locomotive.
The Hollycombe Steam Collection is a collection of steam-powered vehicles, rides and attractions based near Liphook in Hampshire. The collection includes fairground rides, a display farm and two railways.
Hopetown Carriage Works ist die Betriebswerkstatt der ältesten Bahngesellschaft der Welt und wurde 1853 von Joseph Sparkes in Darlington erbaut. Datei:60163 Tornado outside Hopetown Carriage works. jpg 60163 Tornado neben den Hopetown Carriage Works Das erste Stockwerk des Turms des Gebäudes wurde vermutlich als Werkstatt für Gussmodelle und als Zeichenbüro genutzt. In der Halle wurden Eisenbahnwaggons für die Bahngesellschaft gebaut und Wartungsarbeiten durchgeführt. Das Gebäude gehört zu der ersten Generation von Ausbesserungswerken des Eisenbahnzeitalters. Es befindet sich auf einem dreiecksförmigen Grundstück, das zwischen der am 27. September 1825 eröffneten Strecke der Stockton and Darlington Railway und einer am gleichen Tag eröffneten Abzweigung zu einem Kohlelager liegt. Das Alter des Gebäudes ist ungewöhnlich für ein Gebäude dieses Typs einer Eisenbahngesellschaft. Das zweigeschossige Gebäude wurde aus Sandstein mit einer Verblendung aus Ziegelstein erbaut. Es hat ein walisisches Schieferdach mit zwei Erkern im Mittelteil. Dort gibt es ein Haupttor in venezianischem Stil mit abgestuften Gewölbesteinen. Dieses ist heute zugemauert. Es diente früher als Ein- und Ausfahrt für die Eisenbahnfahrzeuge. Diese wurden im Inneren des Gebäudes auf einer Drehscheibe zur Ausfahrt gedreht. Auf jeder Seite des Haupttores befindet sich jeweils eine kleinere Tür. Das Gebäude befindet sich derzeit in einem renovierungsbedürftigen Zustand. Seine Bedeutung in der Entwicklung des Baus von Eisenbahn-Betriebsgebäuden und seine Seltenheit als erhaltenes Beispiel eines Ausbesserungswerkes aus dieser frühen Epoche machen es nach Ansicht der Gemeindeverwaltung von Darlington zu einem erhaltenswerten Baudenkmal. Es ist ein wichtiger Teil des gesamten Gebäudeensembles der ersten modernen Eisenbahngesellschaft der Welt, der Stockton and Darlington Railway. Die erste kommerziell eingesetzte Dampflokomotive „Locomotion No 1“ war in einem Ausbesserungswerk für Lokomotiven der Firma Alfred Kitching auf dem gleichen Gelände von 1857 bis in die 1880er Jahre ausgestellt. Das Gebäude ist bekannt für das Büro des letzten Chefkonstrukteurs Arthur Peppercorn der London and North Eastern Railway, das sich ab 1946 dort befand. Das südliche Ende des Gebäudes wird heute von dem Verein A1 Steam Locomotive Trust genutzt, der dort eine Dampflokomotive der LNER-Klasse A1 Peppercorn nach historischem Vorbild, die „60163 Tornado“, erbaute. Die „60163 Tornado“ wurde im Jahr 2008 fertiggestellt und bewegte sich am 31. Juli 2008 erstmals aus eigener Kraft. Die andere Hälfte des Gebäudes wird von der North Eastern Locomotive Preservation Group (NELPG) für Hauptuntersuchungen ihres Bestandes an Museumslokomotiven genutzt.
Hythe Pier, the Hythe Pier Railway and the Hythe Ferry together provide a transport link between the English port city of Southampton and the Hampshire village of Hythe on the opposite side of Southampton Water. This link is heavily used by commuters and shoppers from Hythe, as well as forming an important link in the Solent Way and E9 European coastal paths. The pier, railway and ferry service are currently all operated by White Horse Ferries Ltd of Swindon. The railway is the oldest continuously operating public pier train in the world.
Isle of Man Railway (IMR) wurde 1873 gegründet. Sie ist die längste Schmalspurbahn auf den Britische Inseln und verläuft 16 Meilen zwischen Douglas, der Hauptstadt der Isle of Man, und Port Erin. Dort befindet sich auch ein Museum über die Geschichte der Dampfeisenbahnen auf der Isle of Man.
The Isle of Mull Railway is a 10+⁄4 in (260 mm) gauge line, 1+⁄4 miles (2.0 km) long, which runs from the ferry terminal at Craignure to Torosay Castle, on the Isle of Mull in the Scottish Inner Hebrides. Originally it was known as the Mull and West Highland Railway. The line is marketed as Scotland's original island passenger railway.
The Isle of Wight Steam Railway is a heritage railway on the Isle of Wight. The railway passes through 5½ miles of unspoiled countryside from Smallbrook Junction to Wootton station, passing through the small village of Havenstreet, where the line has a station, headquarters and a depot. At Smallbrook Junction, the steam railway connects with the Island Line.
The Keighley and Worth Valley Railway is a 5-mile (8 km) long heritage railway line in West Yorkshire, England, that runs from Keighley to Oxenhope. It connects to the national rail network line at Keighley railway station. It is currently the only heritage railway that operates a whole branch line in its original form.
The Keith and Dufftown Railway ("The Whisky Line") is a heritage railway in Scotland, running for 11 miles (18 km) from Keith Town railway station, Keith to Dufftown railway station, Dufftown via Drummuir. Originally the former Great North of Scotland Railway Keith and Dufftown Railway which was part of the link Aberdeen with Elgin, the line was latterly a freight-only branch for British Rail, truncated at Dufftown, although in latter years it hosted a series of Northern Belle summer Sunday lunch specials from Aberdeen.
The Kent &amp; East Sussex Railway (K&amp;ESR) refers to both an historical private railway company in Kent and Sussex in England, as well as a heritage railway currently running on part of the route of the historical company.
Kew Bridge Steam Museum houses a museum of water supply and a collection of water pumping steam engines. The museum is an Anchor Point of ERIH, The European Route of Industrial Heritage. It is situated in Brentford by Kew Bridge on the River Thames in west London, England.
The Kirklees Light Railway is a 3.5-mile (5.6 km) long 15 in (381 mm) gauge minimum gauge railway in Kirklees metropolitan borough, West Yorkshire first opened in October 1991. It runs along the trackbed of the Lancashire &amp; Yorkshire Railway's branch line from the village of Clayton West to Clayton West Junction near Shepley on the Penistone Line from Huddersfield to Penistone.
The Lakeside and Haverthwaite Railway is a heritage railway in Cumbria, England.
The Lappa Valley Steam Railway is a 15 in (381 mm) minimum gauge railway located near Newquay in Cornwall. The railway functions as a tourist attraction, running from Benny Halt to East Wheal Rose, where there is a leisure area.
The Launceston Steam Railway is narrow gauge railway operating from the town of Launceston in Cornwall. The railway is built on the trackbed of the North Cornwall Railway to the gauge of 1 ft 11+⁄2 in (597 mm) and runs for 2½ miles to Newmills, where there is a farm park.
The Lavender Line is an informal name for a heritage railway based at Isfield Station, near Uckfield in East Sussex.
The Leadhills and Wanlockhead Railway, a 2 ft (610 mm) gauge railway in South Lanarkshire, Scotland, is laid on the trackbed of the former Leadhills and Wanlockhead Branch of the Caledonian Railway which led off the main line between Carlisle and Glasgow at Elvanfoot.
Le Leighton Buzzard Light Railway (LBLR) est une ligne de train historique et touristique à voie étroite à Leighton Buzzard dans le Bedfordshire en Angleterre. La voie a un écartement de 600 mm, et fait seulement 4,8 km de long. La ligne a été construite après la Première Guerre Mondiale pour desservir des carrières de sable au nord de la ville. A la fin des années 60 les carrières ont passé au transport routier et le train a été repris par des bénévoles, qui exploitent à présent la ligne comme un train historique.
The Lincolnshire Coast Light Railway was a narrow gauge heritage railway built in 1958 using equipment from the Nocton Potato Estate railway. The railway was built by a group of railway enthusiasts who wished to preserve the stock and atmosphere of the Lincolnshire area potato railways. The land for the railway was leased from Grimsby Rural District Council and opened in 1960 using a Motor Rail "Simplex" locomotive and a single open bogie carriage. In 1961 a second Motor Rail locomotive was added, and the railway's first steam locomotive, Jurassic arrived. By 1964 the line was carrying 60,000 passengers a year. In 1966 the railway was rebuilt on a new alignment. The line saw considerable success in the late 1960s, and another steam locomotive, Elin, arrived, although it was too heavy for the lightly laid track. In the early 1980s the railway continued to draw passengers, but other issues arose. The council insisted on the installation of  Convert/LoffAoffDbSmid fences on both sides of the railway. In 1985, faced with a series of obstacles, the railway closed, and the track was lifted shortly afterwards. Much of the stock of the railway stayed together and was put into storage at the Skegness Water Leisure Park. A revived Lincolnshire Coast Light Railway was built on the site, and opened on 3 May 2009.
The Lincolnshire Wolds Railway is a heritage railway based at Ludborough station, near Grimsby in Lincolnshire, England. Coordinates: 53°26′41″N 0°01′55″W&#xfeff; / &#xfeff;53.44472°N 0.03194°W&#xfeff; / 53.44472; -0.03194
The Llanberis Lake Railway is a narrow gauge heritage railway that runs for 2.5 miles (4 km) along the northern shore of Llyn Padarn in north Wales in the Snowdonia National Park. The starting point is the town of Llanberis at the eastern end of the lake, with the western terminus at Pen Llyn in the Padarn Country Park. The return journey takes around 45 minutes.
The Llanelli and Mynydd Mawr Railway is a heritage railway which aims to re-instate as much as possible of the former Llanelly and Mynydd Mawr Railway which closed in 1989. The Llanelly and Mynydd Mawr Railway, earlier known as the Carmarthenshire Tramroad was established in 1802 in Wales by an Act of Parliament. It began running trains in 1803, the initial line being a plateway, with motive power provided by a pair of horses. The Llanelly and Mynydd Mawr Railway is claimed to be the Oldest Public Railway in Britain. Although the Surrey Iron Railway was the first to be incorporated, it is believed that the LMMR was the first to open to traffic. The Carmarthenshire Tramroad closed in 1844 but the railway reopened in 1883 operated by the newly formed Llanelly and Mynydd Mawr Railway Co. That company disappeared in 1922 on being absorbed into the Great Western Railway which was in turn of course absorbed into British Railways in 1947. Throughout the twentieth century the line continued as a main artery for coal distribution from the Gwendraeth valley, until the closure of Cynheidre Colliery in 1989.
The Llangollen Railway is a volunteer-run preserved railway in Denbighshire, Wales, which operates between Llangollen and Carrog; at 7.5 miles (12.1 km) long, it is easily the longest preserved standard gauge line in Wales. Work is in the early stages of being carried out on 2.5 miles (4.0 km) of extension from Carrog to Corwen. This will require civil engineering work on an embankment at Corwen, where a new station will be built.
The Post Office Railway, also known as Mail Rail, was a narrow-gauge driverless private underground railway in London built by the Post Office to move mail between sorting offices. Inspired by the Chicago Tunnel Company, it was in operation from 1927 until 2003.
The Lynbarn Railway opened in 1995 as a park ride at The Milky Way, a family-based theme park attraction near Clovelly in north Devon, England. It was built and operated by enthusiast volunteers working to revive the Lynton and Barnstaple Railway (L&amp;B) – a nearby historical line running through Exmoor. Built to the same rail gauge – 1 ft 11+⁄2 in (597 mm) – as the L&amp;B, but with a considerably smaller loading gauge, the ride made significant contributions to the finances, skills and expertise of the L&amp;B and was substantially extended and improved during 2003/2004. So they could concentrate on operating at Woody Bay the L&amp;B sold their share in the Lynbarn operation to the owners of the Milky Way, who now operate the ride along with the other attractions. The "Lynbarn" uses three coaches that were part of a lot bought by the L&amp;B and formerly based at Thorpe Park in Surrey. Four other coaches have been fully rebuilt, and are now carrying passengers at Woody Bay. There are also a number of service wagons, used for maintaining the track. Motive power was provided by two steam outline diesel locomotives. One of these, Parracombe, was built by Baguley in 1947 for the line at Butlins, Clacton. A scene from that period featured in the closing sequences of a popular TV series Hi-de-Hi! (1979-1987). This loco was transferred to the Groudle Glen Railway in 2007.
The Lynton &amp; Barnstaple Railway (L&amp;B) opened as an independent railway in May 1898. It was a single track narrow gauge railway just over 19 miles (30 km) long running through the rugged and picturesque area bordering Exmoor in North Devon, England. Although opened after the 1896 Light Railways Act came into force, it was authorised and constructed prior to that act. Therefore, as with all other railways, it was authorised under its own Act of Parliament and built to higher (and more costly) standards than similar railways of the time. In the United Kingdom it was notable as being the only narrow gauge line required to use main-line standard signalling. For a short period the line earned a modest return for shareholders, but for most of its life the L&amp;B made a loss. In 1922 the L&amp;B was taken over by the Southern Railway, and eventually closed in September 1935. An observer at the time wrote: “ Rarely, if ever before, has the closing of a railway aroused such a keen interest as has been awakened throughout the country by the running of the last trains over the narrow gauge Barnstaple-Lynton section of the Southern Railway. This is to be attributed very largely to the unusual character of the line and the magnificent scenery through which it passes. ” The Lynton &amp; Barnstaple Railway Association was formed in 1979; and a short section was reopened to passengers in 2004. This was extended in 2006; and the following year plans were announced to open nine miles (14 km) of track, linking the station at Woody Bay to both Lynton (at a new terminus on an extension to the original line, closer to the town) and Blackmoor Gate, and to a new station at Wistlandpound Reservoir.
The Malton and Driffield Railway (MDR) ran between the Yorkshire towns of Malton and Driffield. It opened in 1853, with stations at Malton, Settrington, North Grimston, Wharram, Burdale, Sledmere and Fimber, Wetwang, Garton, and Driffield. In 1854, it was amalgamated into the North Eastern Railway (NER), which in the 1923 grouping of railway companies, became part of the London &amp; North Eastern Railway (LNER). After nationalisation of the railways (1948), the line briefly became part of the British Railways network. The route was closed to passenger traffic in 1950, with complete closure in 1958.
The Mangapps Railway Museum (previously Mangapps Farm Railway Museum) is a heritage railway located near Burnham-on-Crouch in Essex. The 3/4 mile stretch of standard gauge track and museum are owned and operated by the Jolly family assisted by a dedicated staff of volunteers. It was never part of the national rail network.
|} Datei:Manx Electric. JPG Triebwagen der Manx Electric Railway in Douglas Die Manx Electric Railway wurde 1893 gegründet. Die elektrische Straßenbahn verbindet an der Ostküste der Insel Man den Ort Ramsey mit der Hauptstadt Douglas. Die Strecke ist 17 Meilen lang und hat eine Spurweite von 3 Fuß. Es ist die älteste Oldtimer-Schmalspurbahn der Britischen Inseln mit den ältesten noch betriebsbereiten Straßenbahnwaggons der Welt.
The Mid-Norfolk Railway or MNR is a heritage railway in the English county of Norfolk. Opening as a tourist line in 1997, it is often referred to as a "New Generation" heritage railway. The 11.5-mile (18.5 km) line runs through the centre of Norfolk between the market towns of Wymondham and Dereham via Yaxham, Thuxton and Kimberley Park, operating steam and diesel services. The line is periodically used for commercial freight operations and staff instruction for mainline railway companies. It is the southern section of the former Wymondham, Dereham, Fakenham and Wells-next-the-Sea line, opened by the Norfolk Railway in 1847 and closed to passengers in stages from 1964 to 1969 as part of the Beeching cuts. The final section of the line closed to goods traffic in 1989. The northern section of this line has been operated by the Wells and Walsingham Light Railway since 1982. The MNR is owned and operated by the Mid-Norfolk Railway Preservation Trust, and is mostly operated and staffed by volunteers. The company owns a further 6 miles (9.7 km) of line, as far as County School railway station, which will make it the third largest heritage railway in England once restoration is complete. The Mid-Norfolk Railway has long-term aims to restore the railway as far as Fakenham.
The Mid-Suffolk Light Railway (aka The Middy) is a heritage railway in Suffolk, which in its heyday it was a branch line which ran for just 19 miles (31 km) from Haughley to Laxfield, Suffolk. The line became part of the LNER in 1924 and was closed completely on 26 July 1952. The Railway is now both a heritage railway and preservation museum run by a small but dedicated band of volunteers. The Mid-Suffolk Light Railway is currently the only steam preservation railway in Suffolk. There are plans to one day extend to and fro along the line and it hopes one day the heritage line will become one of a few British heritage railways to operate a fully complete branch line.
The Middleton Railway is the world's oldest continuously working railway. It was founded in 1758 and is now a heritage railway run by volunteers from The Middleton Railway Trust Ltd. since 1960. The railway operates passenger services at weekends and on public holidays over approximately 1 mile (1.6 km) of track between its headquarters at Moor Road, Hunslet, Leeds, West Yorkshire, England and Park Halt on the outskirts of Middleton Park.
The Mold and Denbigh Junction Railway was a 15.75-mile (25.35 km) link railway in north Wales, between the Mold Railway and the Vale of Clwyd Railway. It was incorporated on 6 August 1861 and closed to passengers in 1962.
== STOP PRESS - Grand Opening Gala == of the passenger carrying Apedale Valley Light Railway is 18th/19th September 2010. Please see the Moseley Railway Trust website website for the latest details! The Moseley Railway Trust is a major British collection of industrial narrow gauge locomotives and other equipment. It originally had its base in south Manchester, but has now completed its relocated to the Apedale Country Park near Newcastle, Staffordshire where a passenger railway and important museum are being established. Moseley Railway Trust is now in the final stages of construction of Phase 1 of their new railway attraction, which should see public trains running during the first half of 2010. The construction of the railway line should be virtually complete by the end of February 2010, then requiring approval of the Railways Inspector to permit opening. Plans for the large new museum building have been approved by the Local Council and it is intended that some construction will commence during 2011. In what has now become a traditional event, an Open Weekend/Gala will be held on 18th &amp; 19th September 2010 when many of the Trusts collection of rare locomotives will be on display and in many cases operating. Please see the The Moseley Railway Trust website for further details. It is planned that there will eventually be an industrial demonstration railway line running around the perimeter of the MRT/Apedale Heritage Centre site, connecting with a recreation of an adit called No 7 Drift (from which coal was extracted by the previous occupiers of the site, the Aurora Mining Company, until around 1996).
The Narrow Gauge Railway Museum is a purpose-built museum dedicated to narrow gauge railways situated at the Tywyn Wharf station of the Talyllyn Railway in Tywyn, Gwynedd, Wales. The museum has a collection of artifacts from over 80 British narrow gauge railways. This includes 7 locomotives, and artifacts including tickets and signalling gear.
The National Railway Museum (NRM) is a museum in York forming part of the British National Museum of Science and Industry and telling the story of rail transport in Britain and its impact on society. It has won many awards, including the European Museum of the Year Award in 2001. It is the home of the national collection of historically significant railway vehicles, as well as a collection of other artefacts and both written and pictorial records.
The Nene Valley Railway (NVR) is a preserved railway in Cambridgeshire, England, running between Peterborough Nene Valley and Yarwell Junction. The line is currently seven and a half miles in length. As well as stations at each terminus, there are three stops en route: Orton Mere, Ferry Meadows and Wansford.
The North Gloucestershire Railway (NGR) is a narrow gauge railway running alongside the Gloucestershire and Warwickshire Railway at Toddington. It was built in 1985 when the Dowty Railway Preservation Society needed a new home for its collection of narrow gauge rolling stock. The rail used on the railway was purchased from the Southend Pier Railway.
The North Ings Farm Museum is a working farm museum containing a 2 ft (610 mm) gauge railway, running on a circuit of 0.25 mile. It is located at Dorrington, between Lincoln and Sleaford, in Lincolnshire. The museum includes agricultural machinery and tractors, commercial vehicles, portable steam pumps and a fairground organ.
The North Norfolk Railway (also known as the "Poppy Line") is a heritage steam railway in Norfolk, England, running between the coastal town of Sheringham and Holt, which is further inland. The railway cuts through the countryside to the east of Weybourne with views of its windmill and passes through the well preserved country station which also houses a locomotive shed together with a carriage maintenance and restoration centre. The Norfolk Orbital Railway, an independent organisation, has plans to join and link the NNR with the Mid-Norfolk Railway.
The North Tyneside Steam Railway Association operates this 2 miles (3.2 km) standard gauge preserved railway between the Stephenson Railway Museum and near to Percy Main metro station in North Shields, North East England. Formerly the Monkwearmouth Station Museum Association the NTSRA was formed in the late 1980's at the Stephenson Railway Museum. The association is managed by a committee that meets quarterly and has an Annual General Meeting yearly. The association exists to provide a volunteer workforce to assist with the maintenance and conservation of locomotives and rolling stock. During the spring through to the autumn the volunteers operate the steam train service from Museum to Percy Main, approximately a four mile round trip. Duties include Drivers for both steam and diesel locomotives, Fireman, Guard, Shunter and Operations Controller.
The North Yorkshire Moors Railway (NYMR) is a heritage railway in North Yorkshire, England.
The Northampton &amp; Lamport Railway is a standard gauge heritage railway in Northamptonshire, England. It is based at Pitsford and Brampton station, near the villages of Pitsford and Chapel Brampton, roughly 5 miles (8.0 km) north of Northampton.
The Northamptonshire Ironstone Railway Trust operates a 1½ mile long heritage railway line at Hunsbury Hill, south-west of Northampton. The line is mainly dedicated to freight working, featuring many sharp curves and steep gradients which were typical of the industrial railway, but rides are available in a variety of vehicles including a converted brake van. In the last few years the site has undergone restoration with ¼ mile of line being regraded and relaid in 113 lb/yd (56.1 kg/m) rail and concrete sleepers, along with the restoration of 2 locomotives and brake van to enable passenger carrying as well as other restoration projects being undertaken. Operationally the railway has received full operating clearance from the HMRI to allow running on the relaid section of the 1st quarter of the mile of the route.
The Nottingham Transport Heritage Centre is a museum of local transport history based at Ruddington in Nottinghamshire, England on the same site as Rushcliffe Country Park. It houses a collection of steam and diesel locomotives, and is currently the northern terminus of the Great Central Railway (Nottingham) heritage line. A nine-mile section of standard gauge track runs south from Ruddington, towards Loughborough. The NTHC also houses a classic road transport collection, and is home to the Nottingham Society of Model and Experimental Engineers. The Nottingham Transport Heritage Centre is open every Sunday and bank holiday from Easter Sunday to late October, with Santa special trains running regularly in December.
Osrail is an amalgamation of both the Cambrian Railways Trust and Cambrian Railways Society based in and around the town of Oswestry Shropshire. This merger took place on the 20th of November 2009.
The Paignton &amp; Dartmouth Steam Railway is a 6.5 miles (10.5 km) heritage railway on the former Kingswear branch line between Paignton and Kingswear in Torbay, Devon, England. Due to the location of this line – at the heart of the English Riviera – much of the railway's business is summer tourists from the resorts of Torbay who are transported to Kingswear railway station from where a ferry takes them across the River Dart to the historic town of Dartmouth. The line is owned and operated by Dart Valley Railway plc, who also own Dart Pleasure Craft Limited. Dart Pleasure Craft, who also trade as River Link, operates the ferry service between Kingswear and Dartmouth, together with river and coastal cruises from Dartmouth, many of which connect with the railway.. As such, it is unusual amongst preserved railways in that it is a for-profit operation, and does not rely on volunteer labour or charitable donations.
The Pallot Heritage Steam Museum is a mechanical heritage museum in the Parish of Trinity in Jersey.
Peak Rail is a preserved railway operating timetabled steam services for tourists and visitors to the Peak District and the Derbyshire Dales. It currently runs for approximately 3 miles between Matlock Riverside and Rowsley South. It remains the intention of Peak Rail to incrementally extend their operations northwards to Bakewell and beyond, as time and resources allow.
The Penrhyn Quarry Railway first opened in 1798 as the Llandegai Tramway; it became the Penrhyn Railway in 1801 although on a different route. Constructed to transport slate from Lord Penrhyn's slate quarries at Bethesda to Port Penrhyn at Bangor, Wales. The railway was around six miles long and used a gauge of 1 ft 10+⁄4 in (578 mm). It is one of the oldest narrow gauge railways in the world; and it was closed in 1962. The Penrhyn Railway Heritage Trust are currently attempting to reopen a section of the original railway near Bethesda.
The Perrygrove Railway is a minimum gauge railway of 15 in (381 mm) gauge. It is a private heritage railway at Perrygrove Farm in the Royal Forest of Dean near Coleford, Gloucestershire, England. Trains travel at frequent intervals on a round trip of 1+⁄2 miles (2.4 km) between four stations. The railway was inspired by the minimum gauge estate railways or British narrow gauge railways developed by Sir Arthur Heywood at the end of the 19th century, including his pioneering Duffield Bank Railway and the later Eaton Hall Railway. Perrygrove is the home of the Heywood Collection, which consists of five original vehicles, including the original saloon carriage from Eaton Hall. Also based at Perrygrove are replica vehicles built by James Waterfield, including the locomotive "Ursula" and the Duffield Bank Dining Carriage. All these vehicles are available for viewing when Perrygrove is open, but visitors are asked to telephone +44 1594 834991 if they wish to be certain of seeing a particular item.
The Plym Valley Railway is part of the closed South Devon and Tavistock Railway near Plymouth, a branch line of the Great Western Railway in Devon. The Plym Valley Railway is currently rebuilding the 0.75-mile (1.21 km) Marsh Mills to Plym Bridge section of the line. The line is being re-created in 1950s to early 1960s period, preserving steam and diesel locomotives, carriages, wagons and other rolling stock, buildings, machinery and equipment of historic railway interest. The PVR is located just off the A38 Marsh Mills junction, Plymouth. Follow the brown tourist signs from Marsh Mills roundabout, or follow the signs for Coypool Park and Ride. Parking is available in the P&amp;R carpark opposite the railway on Sundays.
The Pontypool and Blaenavon Railway is a volunteer-run heritage railway in South Wales, running trains between a station platform in a former colliery furnace site northwards up a steep but short section of railway line to a halt platform opposite the Whistle Stop public house (famed for its collection of miner's lamps) and southwards to the town of Blaenavon . The line is the highest preserved standard-gauge line in the United Kingdom, and also uniquely having the only standard-gauge rail-over-rail bridge within preservation .
The Railway Preservation Society of Ireland (RPSI) is an Irish railway preservation group founded in 1964. The Society has its headquarters at Whitehead, County Antrim, Northern Ireland and a base at Mullingar, County Westmeath. Restoration work is also carried out in the Dublin area.
The Ravenglass and Eskdale Railway is a 15 in (381 mm) minimum gauge heritage railway in Cumbria, England. The seven-mile line runs from Ravenglass to Dalegarth Station near Boot in the valley of Eskdale, in the Lake District. At Ravenglass the line ends at Ravenglass railway station on the Cumbrian Coast Line. Intermediate stations and halts are at Muncaster Mill, Miteside, Murthwaite, Irton Road, Eskdale Green, Fisherground and Beckfoot. The railway is owned by a private company and supported by a preservation society. The oldest locomotive is River Irt, parts of which date from 1894, while the newest is the diesel-hydraulic Douglas Ferreira, built in 2005. The line is known locally as La'al Ratty and its 3 ft (914 mm) gauge predecessor as Owd Ratty. Nearby attractions include: the Roman Bath House at Ravenglass; the Hardknott Roman Fort, known to the Romans as Mediobogdum, at the foot of Hardknott Pass; the watermills at Boot and Muncaster; and Muncaster Castle, the home of the Pennington family since 1208.
The Rhiw Valley Light Railway is located near to the village of Berriew in Powys, Wales. The railway is constructed to 15 in (381 mm) gauge, in an 'out and back' return loop 1,265 metres (0.786 mi). As an 'out and back' loop, trains return to the central station facing in the opposite direction from that in which they departed. The railway was privately built and operated, and its original owner is now deceased. The railway is now owned by his widow, who opens the line to the public just one day per year, in mid-summer. The very attractive route runs through fields and along hedgerows, and being largely unfenced there is considerable interaction with livestock from rabbits to sheep. There are two resident steam locomotives. 'Powys' is a powerful 0-6-2 tank engine, built in 1973 by Severn Lamb. 'Jack' is a large 0-4-0 tender engine, constructed by TMA Engineering of Birmingham and Jack Woodruffe of Welshpool in 2003. An assortment of wooden passenger carriages and wagons is available on the line.
The Rhyl Miniature Railway is a 15 in (381 mm) gauge miniature railway line located in Rhyl on the North Wales Coast. The line runs in a circle around a boating lake near the promenade, to the west of the town centre. The railway is operated by Rhyl Steam Preservation Trust a Registered charity. The railway has a long association with one type of locomotive, a class of six one-third scale 4-4-2 tender engines built by Albert Barnes &amp; Co of Rhyl.
The Ribble Steam Railway is a standard gauge preserved railway in Lancashire, in the United Kingdom. It was opened to the public on 17 September 2005, running along Preston Docks,. The railway began by housing much of the collection from the previously-closed Southport Railway Museum (Steamport), which was based in the old Lancashire and Yorkshire Railway engine shed at Southport (BR shed code 27C).
The Romney, Hythe &amp; Dymchurch Railway is a 15 in (381 mm) gauge light railway in Kent, England. The 13+⁄2 miles (22 km) line runs from the Cinque Port of Hythe via Dymchurch, St. Mary's Bay, New Romney and Romney Sands to Dungeness, close to Dungeness nuclear power station and Dungeness lighthouse.
The Rother Valley Railway is the original name of what became the Kent and East Sussex Railway. Nowadays, the Rother Valley Railway refers to the ‘Missing Link’ between Robertsbridge, a station on the Tonbridge to Hastings mainline, and Bodiam on the Kent and East Sussex Railway, a heritage railway. A society of volunteers are attempting to re-establish the railway link. To date, (2009) the RVR has re-instated the first few hundred yards of line eastwards from Robertsbridge, together with a platform and buffet (utilising a building formerly used as the London terminus of the Orient Express). It has also reinstated several hundred yards of track at the Bodiam end of the route, connecting up with KESR metals. The RVR intends to instigate brake van rides at its Robertsbridge site once the necessary work on rolling stock and infrastructure are completed.

The Royal Deeside Railway was formed in 1996 with the intention of reclaiming part of the former branch line from Aberdeen to Ballater, constructed between 1853 and 1856 by the Deeside Railway company and closed by British Railways in 1966. Work is underway to reinstate the railway between Banchory and Milton of Crathes, with a new station under construction at Milton of Crathes and one mile of track laid towards Banchory. The railway offers a passenger train service every Sunday afternoon from Easter until September, at present using a heritage industrial diesel locomotive hauling the BEMU railcar carriages. It is hoped to introduce steam-hauled passenger services in 2010.
The Royal Docks Heritage Railway, endorsed in 2006 by Newham council, was proposed to open during 2007, taking over the North Woolwich Old Station Museum and the closed section of the North London Line between Custom House and North Woolwich railway stations. Rather than concentrating on the GER, it would have shown the heritage of local and suburban National Rail lines in London and the south east. However later approval of the Crossrail project, due to open in 2017 re-using most of the proposed heritage railway route, has effectively killed the scheme. The Royal Docks Heritage Railway was associated with a separate training organisation called RailSchool. The British Rail Class 50 diesel locomotive No. 50033 Glorious was to be lent to RailSchool by Swindon Steam Railway Museum. The idea was to re-double the track between stations and run heritage train services and training trains. At closure, North London Line services used only one track, but the second track was in place for much of the route. The line might have been Britain's first mainline electric preserved railway. The 1980s station building was to be the public entrance to the museum site. The official website includes details of the visions for the museum plus pictures of the line, taken from a special train run the day after the last public service ran.
The Rudyard Lake Steam Railway is a minimum gauge railway and the third railway of any gauge to run along the side of Rudyard Lake in Staffordshire. The railway runs for 1.5 miles on the track bed of an old standard gauge North Staffordshire Railway line. After the NSR line closed down, a small narrow gauge train ran on the site for two years before moving via Suffolk to Trago Mills in Devon. The current line started in 1985 and is 10+⁄4 in (260 mm) gauge, and operates to a timetable. Trains are about half the size a normal narrow gauge railway and are steam hauled. The railway runs from Rudyard railway station to the Dam then along the side of the lake to terminate by the lakeside at Hunthouse Wood. This is about a mile South of the site of the old Cliffe Park railway station. Trains run on Sundays and Bank Holidays from January to the end of November, with more regular services from Easter to October and daily during school holidays.
The Rushden, Higham &amp; Wellingborough Railway is a heritage railway operated by the Rushden Historical Transport Society in the United Kingdom. The aim is to re-open the ex-Midland Railway branch line from Wellingborough to Higham Ferrers, which had been closed completely in 1971. At present (2009) a ¼ mile stretch of the line is operated between Rushden station and Shirley Road Birdge.
Rutland Railway Museum is a heritage railway on part of a former Midland Railway mineral branch line. It is situated NE of Oakham, in Rutland, England.
The Sanday Light Railway was a privately-owned minimum gauge railway on the island of Sanday, Orkney, Scotland. The railway was of 7+⁄4 in (184 mm) gauge. Construction began in 2000 and the line closed at the end of 2006. It was the most northerly passenger carrying railway in the British Isles, and although it was primarily the owner's hobby it did achieve the status of a tourist attraction and local curiosity. The railway sometimes ran one of its two steam locomotives, a 2-4-2 and a 2-4-0, but more often one of three petrol locomotives. The railway also owned a number of items of rolling stock, including a very rare Cromar White first-class carriage, of which only six were made. Although trains had been operating occasionally in some form beforehand, the railway was officially opened to the public in August 2006 by Sir Peter Maxwell Davies just a few months before its closure, which was variously attributed to the owner being unable to keep his promise to hold Sir Peter's civil partnership ceremony there or unreasonable demands placed upon the railway's operators by local council officials. The owner is currently taking legal action against a number of organisations http://www. sandaylightrailway. co. uk/ over perceived discrimination and misconduct by those organisations, in relation to the railway, its associated tea-rooms and the abortive civil partnership ceremony.
|} Die Bahnstrecke Scarborough–Whitby war eine Bahnlinie, die in der englischen Grafschaft North Yorkshire entlang der Nordseeküste von Scarborough nach Whitby führte. Die Strecke wurde 1965 aufgrund von Einsparungsplänen der British Rail stillgelegt. Das Gleisbett wurde in einen Bahntrassenradweg umgewandelt, welcher nun einen Teil der Route 1 des National Cycle Network sowie der Moor to Sea Cycle Route darstellt. Die Besitzer der nahegelegenen North Yorkshire Moors Railway hatten ursprünglich den Kauf der Bahnstrecke geplant, was jedoch aufgrund zu hoher Kosten scheiterte, sodass sie sich für die andere Bahnstrecke entschieden. An der Küste Yorkshires besteht weiterhin die Hoffnung, dass die Strecke von Scarborough nach Whitby eines Tages als Museumsbahn parallel zu einem Radweg wiedereröffnet werden kann.
The Scottish Industrial Railway Centre is an Industrial Heritage museum operated by the Ayrshire Railway Preservation Group. The centre owns a number of standard gauge steam and diesel locomotives and an extensive collection of photographs.
|} Die Seaton (Electric) Tramway ist eine elektrisch betriebene Schmalspurbahn die zwischen den Orten Seaton und Colyton in Ostdevon in Großbritannien verkehrt.
The Severn Valley Railway is a heritage railway in Shropshire and Worcestershire, England. The 16-mile (26 km) line runs along the Severn Valley from Bridgnorth to Kidderminster, following the course of the River Severn for much of its route. Train services are hauled predominantly by steam locomotives; however diesel traction is also sometimes used. The railway is one of the most popular heritage railways in the country. It hosts numerous special events throughout the year, including both steam and diesel galas.
Shildon Locomotion Museum is a railway museum in Shildon, County Durham, England. The museum is a branch of the National Railway Museum (NRM), which is part of the National Museum of Science and Industry (NMSI). Shildon acts as an annex, with the most important exhibits on display in the NRM's headquarters at York, though exhibits are regularly rotated.
Shillingstone railway station was a station on the Somerset and Dorset Joint Railway (S&amp;DJR), serving the village of Shillingstone in the English county of Dorset. Opened in 1863, the station was located between Sturminster Newton and Blandford Forum stations, although between 1928 and 1956 the next station south was Stourpaine and Durweston Halt. Shillingstone is the last surviving example of a station built by the Dorset Central Railway (one of the forerunners of the S&amp;DJR). The station closed in 1966, when services were withdrawn from the S&amp;DJR route. Since 2001, enthusiasts have been working to re-open the station as a heritage railway attraction. The main building has now been renovated, and opened to the public as a museum, shop and refreshment room in 2008.
The Sittingbourne &amp; Kemsley Light Railway in Kent is a 2 ft 6 in (762 mm) gauge heritage railway that operates from Sittingbourne to the banks of The Swale. The line was formerly owned by Bowater, the paper making firm, and was used to carry raw materials and finished products between Ridham Dock and the company's two mills, one at Sittingbourne and the other at Kemsley. In 2008-09, the line survived a threat of closure due to the owners of Sittingbourne Paper Mill closing the mill and selling the land, the lease then held by the railway expired in January 2009. Negotiations resulted in the railway being saved, although no public trains have run since 2008. In September 2010, press reports announced the possibility that the railway would operate an anniversary service - over a short section between Kemsley Down Station and the Milton Regis Halt - to celebrate 40 years of operation. The service would operate for several days during October, and a full service to Sittingbourne is expected to resume in 2011 once viaduct repairs had been completed.
Die Snaefell Mountain Railway führt von Laxey zum Berggipfel des Snaefell auf der Isle of Man.
Snibston is built on a site of a former colliery and consists of an award winning interactive museum, scheduled ancient colliery buildings, the Century Theatre, and a 100-acre (0.40 km) country park and nature reserve. It is located on Ashby Road, Coalville, Leicestershire, and within the National Forest. Snibston &amp; Snibston Discovery Museum are managed by Leicestershire County Council and supported by Next, The National Forest and is Heritage Lottery Funded.
The Snowdon Mountain Railway (SMR) is a narrow gauge rack and pinion mountain railway in Gwynedd, north-west Wales. It is a tourist railway that travels for 4.7 miles (7.6 km) from Llanberis to the summit of Snowdon, the highest peak in England and Wales. The SMR is the only public rack and pinion railway in the United Kingdom, and after more than 100 years of operation it remains a popular tourist attraction. The line is owned and operated by Heritage Great Britain plc, operators of several other tourist attractions in the United Kingdom. The railway is operated in some of the harshest weather conditions in Britain, with services curtailed from reaching the summit in bad weather. Single carriage trains are pushed up the mountain by either steam locomotives or diesel locomotives. It has also previously used diesel railcars as multiple units. The SMR was the inspiration for the fictional Culdee Fell Railway, appearing in the story book "Mountain Engines", part of the "The Railway Series" written by the late Reverend W. Awdry. The Railway Series books were the basis for the popular Thomas the Tank Engine and Friends children's television series; as yet however the Culdee Fell Railway has not been included in the televised episodes.
The Somerset &amp; Dorset Joint Railway – almost always referred to as "the S&amp;D" – was an English railway line connecting Bath in north east Somerset and Bournemouth now in south east Dorset but then in Hampshire. It was never a high speed line: its winter business was carrying freight and local passenger traffic over the Mendips, but in the summer season the S&amp;D came into its own, carrying a heavy service of Saturday holiday trains from northern towns to Bournemouth. It was often referred to as "the Slow and Dirty" or sometimes "the Slow and Doubtful". It always commanded a considerable loyalty from railway enthusiasts, and when it closed in 1966 it was widely mourned. The S&amp;D Joint Railway was jointly operated by the Midland Railway and the London and South Western Railway (L&amp;SWR). After the 1 January 1923 Grouping joint ownership of the S&amp;D passed to the LMS and the Southern Railway. Its attractions were its quirky individuality, its fascinating and varied scenery, and the way it seemed to struggle against overwhelming odds. Its main line climbed to 811 feet above sea level at Masbury, and it contained several single line sections, but on summer Saturdays it managed to handle a considerable volume of holiday trains, when it seemed every possible locomotive was drafted into service to handle heavy trains requiring double-heading and rear assistance over the steep gradients. Its origins lay in times before the railway network in England had settled, and both local and strategic aspirations structured the line’s earliest days. Work has now started to restore some remnants of the S&amp;DJR to working condition.

The South Tynedale Railway is a heritage railway in England and is England's highest narrow gauge railway. The route runs from Alston in Cumbria to Kirkhaugh in Northumberland via the South Tyne Viaduct, the Gilderdale Viaduct and the Whitley Viaduct. The railway is operated by a charity, which was registered in 1983. Passenger trains operate on the railway between April (or from Easter weekend if in March) through to October each year and currently (2009) attract 40,000 people to the district every year. Special trains operate including Santa Special trains on certain days in December each year. The present line is two and a quarter miles in length and there are plans to extend the line by a further two and a quarter miles to Slaggyford. The line is a 2 ft (610 mm) narrow gauge and is built on the southern end of the track bed of the disused standard gauge Haltwhistle to Alston Line. This connected with the Newcastle and Carlisle Railway at Haltwhistle. The standard gauge line was closed on 1 May 1976 and the track bed is mostly intact.
Southall Railway Centre is a railway heritage centre at Southall in west London, near to Southall railway station and the Grand Union Canal. It is run by the GWR Preservation Group Limited (GWRPG).
The Southend Pier Railway is a narrow gauge railway in the English seaside resort of Southend-on-Sea. It runs the 1.34 miles (2.16 km) length of Southend Pier, providing public passenger transport from the shore to the pier head.
The Southwold Railway was a narrow gauge railway line between Halesworth and Southwold in the English county of Suffolk. 8+⁄4 miles (14.1 km) long, it was built to 3 ft (914 mm) gauge. It opened in 1879 and closed in 1929. Intermediate stations were at Wenhaston, Blythburgh and Walberswick.
The Spa Valley Railway (SVR) is a standard gauge heritage railway that runs between Tunbridge Wells, High Rocks, Groombridge, and Birchden; crossing the Kent and East Sussex border, a distance of 4 miles, along the former Three Bridges to Tunbridge Wells Central Line / Cuckoo Line. Its headquarters is at Tunbridge Wells West railway station. The line is currently being extended to Eridge railway station to link with the Oxted Line. The railway holds a number of special event days, including a Day out with Thomas (the tank engine) on four weekends of the year, Santa Specials, and both steam and heritage diesel weekends. A comparative newcomer to the heritage railway sector, the Spa Valley Railway opened in December 1996 following an 11 year campaign to buy the line from British Rail and re-open it as a passenger railway. It is now a popular attraction with local people and tourists alike, and the forthcoming extension to Eridge will not only make for a longer ride, but offer a cross-platform interchange with Southern main line trains from London. The railway provides a way of getting to other popular local attractions, such as Groombridge Place, High Rocks and the Pantiles in Tunbridge Wells, and many visitors combine a trip on the railway with one or more of these other activities. In 2000, the Spa Valley introduced a bar/buffet car, "Kate", converted from an old compartment carriage.
Stainmore Railway Company is a volunteer run non-profit company aiming to restore Kirkby Stephen East railway station in Kirkby Stephen, Cumbria, England. The station was formerly on the South Durham &amp; Lancashire Union Railway and the company aims to relay a short section of track to allow train running.
The Statfold Barn Railway is a mixed gauge railway of 2 ft (610 mm), 2 ft 6 in (762 mm) and 4 ft 8+⁄2 in (1,435 mm) gauges, near Tamworth, Staffordshire. It is privately owned by Mr Graham Lee, chairman of LH Group Services Ltd – which in 2005 bought what remained of the Hunslet Engine Company. The 'Field Railway' is a dual 2ft and 2ft 6in gauge line approximately 1.5 miles (2.4 km) long with a "balloon loop" at one end with a station at the other end. There is a passing loop half way along the line which has a single platform 'Oak Tree Halt' and a siding heading off to storage facilities in the 'Grain Store'. There is also a separate loop line 'Garden Railway' consisting of 2ft gauge track only. Drivers of mixed-gauge trains must take care not to pass the point where this line diverges or derailment will occur. The running shed has a triple gauge line leading down into the standard gauge storage sidings and then across the Field Railway where a short stub leads into a field. The railway has an extensive workshop where locomotives are built and restored. As at March 2010 some 51 locomotives were based on the Statfold Barn Railway, either in an active condition or waiting for restoration or rebuild.
The Steeple Grange Light Railway is a narrow gauge railway at Wirksworth in Derbyshire, UK. It uses industrial locomotives and rolling stock from disused mines, quarries, and steelworks around the country.
The Stratford on Avon and Broadway Railway project (SBR) aims to re-open the closed railway from Stratford-upon-Avon, Warwickshire to Honeybourne railway station for main-line connection. A later extension is planned to Broadway, Worcestershire where the line could link up with the proposed northern extension of the Gloucestershire Warwickshire Railway. The railway currently operates former Long Marston Ministry of Defence depot. The railway operates at the north west corner of the site which is now the location of the proposed new Middle Quinton Eco-town.

The Swanage Railway is a 6-mile (9.7 km) long heritage railway in the Purbeck district of Dorset, England. The railway follows the route of the Purbeck branch line between Norden railway station, Corfe Castle railway station, Harman's Cross railway station, Herston Halt railway station and Swanage. The line was re−connected to the mainline at Wareham, Dorset along a stretch of the branch line that had previously only remained open to freight traffic until 2005. Trains operate on the Swanage Railway between Swanage and Norden Park &amp; Ride every weekend and Bank Holiday from mid-February to the end of the year, and every day of the week from April to October; with Santa Special services in December. The link between the Swanage Railway and the main line at Wareham has been used for materials deliveries, special excursions, locomotive and stock movements only— work is continuing to provide the infrastructure necessary to enable regular services via Wareham to be implemented. In April 2009 the line reopened to its first through traffic from London with occasional special services.
The Swansea Vale Railway (SVR) was a railway line connecting the port of Swansea in South Wales to industries and coalfields in the Swansea Valley and the Brynamman district on the borders of Glamorgan and Carmarthenshire. Later additions to the route included a loop line through Morriston and a branch – the Swansea Vale and Neath and Brecon Joint Railway – which connected the SVR to the system of the Midland Railway Company by means of running powers over the Neath and Brecon Railway. The Midland and its successor company the London, Midland and Scottish Railway were the owners of the SVR from 1876 until 1947.
The Swindon &amp; Cricklade Railway is a heritage railway in Wiltshire, England, that operates on a short section of the old Midland and South Western Junction Railway line between Swindon and Cricklade.
The Talyllyn Railway is a narrow-gauge preserved railway in Wales running for 7.25 miles (11.67 km) from Tywyn on the Mid-Wales coast to Nant Gwernol near the village of Abergynolwyn. The line was opened in 1866 to carry slate from the quarries at Bryn Eglwys to Tywyn, and was the first narrow gauge railway in Britain authorised by Act of Parliament to carry passengers using steam haulage. Despite severe under-investment, the line remained open, and in 1951 it became the first railway in the world to be preserved as a heritage railway by volunteers. Since preservation, the railway has operated as a tourist attraction, expanding its rolling stock through acquisition and an engineering programme to build new locomotives and carriages. In 1976, an extension was opened along the former mineral line from Abergynolwyn to the new station at Nant Gwernol. In 2001, the preservation society celebrated its 50th anniversary, and in 2005 a major rebuilding and extension of Tywyn Wharf station took place, including a much-expanded facility for the Narrow Gauge Railway Museum. The fictional Skarloey Railway, which formed part of the Railway Series of children's books by The Rev. W. Awdry, was based on the Talyllyn Railway. The preservation of the line inspired the Ealing Comedy film The Titfield Thunderbolt.
The Tanat Valley Light Railway (TVLR) was a 15-mile (24 km) long standard gauge light railway connecting Llangynog with Blodwel in Wales. It opened in 1903 and closed in January 1964.
The Tanfield Railway is a standard gauge heritage railway in Gateshead and County Durham, England. Running on part of a former colliery wooden wagonway, later a steam railway, it operates preserved steam and diesel industrial tank locomotives. The railway operates a passenger service on Sundays all year round, as well as demonstration freight trains. The line runs 3 miles (4.8 km) between a southern terminus at East Tanfield, Durham, to a northern terminus at Sunniside, Gateshead, with the main station, Andrews House situated near to the Marley Hill engine shed. A halt also serves the historic site of the Causey Arch. The railway claims to be the oldest working railway in the world.
|} Die Teifi Valley Railway ist eine Schmalspurbahn in der Spurweite von 610 Millimetern (2 Fuß), die in der südwalisischen Grafschaft Ceredigion zwischen Llandysul und Castell Newydd Emlyn entlang des Teifi verkehrt. Es ist eine touristische Schmalspurbahn auf einem Teil der Carmarthen and Cardigan Railway, später Teil der Great Western Railway. Nachdem die normalspurige Strecke stillgelegt und abgebaut worden war, haben Eisenbahnfreunde auf dem alten Trassee die Schmalspurbahn aufgebaut. Zur Zeit verkehrt sie zwischen dem Weiler Henllan und Llandyfriog. Eine Verlängerung nach Castell Newydd Emlyn (Newcastle Emlyn) und schließlich Pentrecwrt sind angedacht.
The Telford Steam Railway (TSR) is a heritage railway located at Horsehay, Telford in Shropshire, England, formed in 1976. The railway is operated by volunteers on Sundays and Bank Holidays from Easter to the end of September, and at Christmas. Its business name is the Telford Horsehay Steam Trust, (THST).
The Orchid Line is a multi-gauge miniature railway operating within the Wild Life Park in the Ballaugh Curraghs in the north of the Isle of Man and is operated by the Manx Model Engineering Society. It was established in 1992 and has expanded considerably since this time to cover a large part of the park's perimeter.
Tyseley Locomotive Works is the museum and engineering arm of the Birmingham Railway Museum Trust, based in Birmingham, England. It occupies part of the former Great Western Railway's depot, which was constructed in 1908 as a result of expanding operations in the West Midlands, particularly the opening of the North Warwickshire Line as a new main line from Birmingham to Bristol. As well as supporting the trust's operating wing Vintage Trains the museum is home to an extensive collection of steam engines, ranging from small industrial builds to Great Western Railway 'Castles' and 'Halls', and large ex-main line diesel engines.
The Ulster Folk and Transport Museum is situated in Cultra, Northern Ireland, about 11 kilometres (7 miles) east of the city of Belfast. It comprises two separate museums, the Folk Museum and the Transport Museum. The Folk Museum endeavours to illustrate the way of life and traditions of the people in Northern Ireland, past and present, while the Transport Museum explores and exhibits methods of transport by land, sea and air, past and present. The museum ranks among Ireland's foremost visitor attractions and is a former Irish Museum of the Year. It is one of three national museums of Northern Ireland.
The Upper Douglas Cable Tramway was a tram line serving all points between the southern end of the promenade and the upper part of the town of Douglas in the Isle of Man. It opened on 15 August 1896 and closed on 19 August 1929.
The Alford Valley Railway is a 2 ft (610 mm) narrow gauge in the Howe of Alford, Aberdeenshire, Scotland.
The Vale of Glamorgan Railway Company are a Welsh railway preservation society, previously based on the Barry Island Railway.
The Vale of Rheidol Railway is a narrow-gauge 1 ft 11+⁄4 in (603 mm) gauge heritage railway that runs for 11+⁄4 miles (18.91 km) between Aberystwyth and Devil's Bridge in the county of Ceredigion, Wales. It was the last line to be operated by steam as part of the nationalised British Railways network, until it was privatised in 1989.
Volk’s Electric Railway ist eine Straßenbahn in Brighton und die älteste elektrische Straßenbahn in Großbritannien. Sie weist eine Spurweite von 825 mm auf. Die Bahn wurde am 4. August 1883 eröffnet. Gebaut hat sie Magnus Volk, ein Sohn deutscher Einwanderer. Ihm verdankt die Bahn auch ihren Namen. Da die Bahn ohne Oberleitung konstruiert war, erfolgte die Stromversorgung über die beiden Schienen mit 50 V Spannung. Die Bahn war bei ihrer Eröffnung knapp einen halben Kilometer lang, wurde 1884 aber um eine rund 1,2 Kilometer lange Strecke erweitert. Gleichzeitig wurde die Spurweite auf 838 mm geändert. Die erste Strecke wies noch 610 mm auf. 1901 folgte eine weitere Verlängerung, so dass die Bahn nun zwei Kilometer lang war. Später wurde die Bahn um eine dritte Schiene erweitert, welche nun zur Stromzufuhr diente, die Spurweite auf 825 mm und die Fahrspannung auf 150 V umgestellt. 1939 ging die Bahn nach dem Tod von Magnus Volk in den Besitz der Stadt über. Der Zweite Weltkrieg bedingte eine Unterbrechung des Betriebs, welcher erst nach acht Jahren am 15. Mai 1948 wieder aufgenommen wurde. In den Jahren 1952 bis 1953 erfolgte eine gründliche Überholung der Bahn und ab 1954 wird sie nur noch zwischen Ostern und September betrieben. Sie verkehrt dann zwischen 11:00 und 17:00 bzw. , am Wochenende, bis 18:00 Uhr. Die Bahn verkehrt heute an der Küste entlang zwischen den Endhaltestellen Aquarium Station und Black Rock. Sie verbindet den Palace Pier mit der Marina. Neben den beiden Endhaltestellen gibt es noch in der Mitte der Strecke den Halt Peter Pan’s Playground. Das Unternehmen hat auch noch am Ende des 19. Jahrhunderts die durchs Meer führende Brighton and Rottingdean Seashore Electric Railway betrieben.
The Royal Gunpowder Mills, Waltham Abbey, an Anchor Point of the European Route of Industrial Heritage, (ERIH), set in 175 acres (0.71 km) of parkland and containing 21 buildings of major historical importance, mixes history, science, and attractive surroundings. It was one of three Royal Gunpowder Mills in the United Kingdom of Great Britain and Ireland, the other mills were at Ballincollig and Faversham, but is the only site to have survived virtually intact. The Royal Gunpowder Mills, Waltham Abbey, were in operation for over 300 years; however, from the mid 1850s onwards the site was involved in developing new nitro-based explosives and propellants. The site grew in size, and gunpowder became less important. Shortly after World War II it became solely a Defence Research Establishment - firstly the Explosives Research and Development Establishment, then the Propellants, Explosives and Rocket Motor Establishment Waltham Abbey; and finally the Royal Armament Research and Development Establishment Waltham Abbey. Its superior production methods and high quality results earned it a reputation on an international level and played a significant part in the rise of Great Britain as an international power.
The Pump House Steam and Transport Museum is a museum in Walthamstow focusing on the pioneering achievements in road, rail, air and sea transport in the River Lea valley from the early 19th century. The aim of the museum is to show how the coming of the railways and the subsequent industrial development affected the Lea Valley area and its people.
The Watercress Line is the marketing name of the Mid-Hants Railway, a heritage railway in Hampshire, England, running 10 miles (16 km) from New Alresford to Alton where it connects to the National Rail network. The line gained its popular name in the days that it was used to transport locally grown watercress to markets in London. The railway currently operates regular scheduled services, along with dining trains and numerous special events throughout the year. The line is also well known for the facilities, staff and the quality of restoration work performed at Ropley MPD.
Waverley Route Heritage Association is a group involved with the history, heritage and preservation of the Waverley Route. Recent projects have include the restoration of the Whitrope Tunnel. The tunnel was formerly part of the Border Union Railway. Also the in restorations phase is Whitrope Siding, which is the WRHA headquarters and the home of WRHA's Whitrope Heritage Centre.
The Weardale Railway is a British single-track branch line railway providing regular daily passenger service between Bishop Auckland (West), Wolsingham, Frosterley and Stanhope. Services began on 23 May 2010 after a lapse of almost sixty years. The railway originally extended from Bishop Auckland to Wearhead in County Durham, a distance of about 25 miles (40 km). It was built in the nineteenth century to carry passenger and freight traffic. As late as 1992 the line remained in use as part of the national network, serving a large cement works at Eastgate (latterly owned by the Lafarge group) and providing a summer Sundays-only passenger service between Bishop Auckland and Stanhope. The rails were lifted in the 1960s from the extreme western section of the line between Eastgate and Wearhead (passing through Westgate and St John's Chapel, County Durham). The trackbed itself has been removed in at least one place on this last section.
The Wells and Walsingham Light Railway is a 10+⁄4 in (260 mm) gauge heritage railway in Norfolk, England running between the coastal town of Wells and Walsingham which is further inland. The railway occupies a part of the trackbed of the Wymondham to Wells branch also used by the Mid-Norfolk Railway.
The Welsh Highland Heritage Railway (formerly Welsh Highland Railway) is the operating name (from February 2009) for the railway and registered charity that operates from a base on the northern outskirts of Porthmadog, in north west Wales. The parent company name is Welsh Highland Railway Limited.
The Welsh Highland Railway (WHR) is a recently restored 22.5 miles (36.2 km) long narrow gauge heritage railway in North Wales. Its route passes through a number of popular tourist destinations including Beddgelert, the Aberglaslyn Pass and also includes the United Kingdom's only mixed gauge flat rail crossing. Originally running from Dinas near Caernarfon to Porthmadog, the restored line will run from Caernarfon through to Porthmadog, where it will connect with the Ffestiniog Railway. The original line also had branches to Bryngwyn and the slate quarries at Moel Tryfan, which have not been restored. The restoration project has won a number of awards and much of the work was carried out by volunteers. There is also the 1-mile (1.6 km) long Welsh Highland Heritage Railway which runs from Porthmadog and connects to the WHR main line at Pen-y-Mount junction.
The Welshpool and Llanfair Light Railway (W&amp;LLR) is a narrow gauge heritage railway in Powys, Wales. The line is around 8.5 miles (13.7 km) long and runs westwards from the town of Welshpool via Castle Caereinion to the village of Llanfair Caereinion. The track gauge is 2 ft 6 in (762 mm).
The Wensleydale Railway is a railway line in Wensleydale and Lower Swaledale in North Yorkshire, England and the name of the company (Wensleydale Railway plc) that operates services on the line. The line currently runs 17 miles (27 km) between Leeming Bar and Redmire. Formerly it ran from Northallerton on the East Coast Main Line to Garsdale on the Settle-Carlisle Railway, however on Gala weekends and special occasions it runs to Northallerton. This makes the line the longest heritage railway in Great Britain. The track between Redmire and Garsdale has been lifted and several bridges have been demolished. Regular passenger services operate between Leeming Bar and Redmire, however there are plans to also provide regular services between Leeming Bar and Northallerton and between Redmire and Garsdale (though the latter would require restoration of track and missing bridges and is likely to be done in stages). This would recreate 40 miles (64 km) of track between Northallerton and Garsdale and make it the largest private railway in Europe.
The West Lancashire Light Railway operates at Hesketh Bank, situated between Preston and Southport in North West England. The Railway is narrow gauge 2 ft (610 mm) and has a running length of 430 yards (393 m). The full line is longer than this but follows a ledge above the old clay pit which is narrow enough to prohibit the building of a run round loop. An extension is planned. The line now boasts eight steam locomotives, four of which are in operating condition, one is currently being restored and another is on static display. There are also two electric locomotives and many IC locomotives. See Locomotives section for details.
The West Somerset Railway (WSR) is a railway line that originally linked Taunton and Watchet in Somerset, England. It opened in 1862 and was extended from Watchet to Minehead by the Minehead Railway in 1874. Although just a single track, improvements were needed in the first half of the twentieth century to accommodate the significant number of tourists that wished to travel to the Somerset coast. Despite this traffic it was closed in 1971 but was then reopened in 1976 as a heritage railway. At 22.75 miles (36.6 km) it is the longest privately owned passenger rail line in the country, however services normally only operate on the 19.5 miles (31.4 km) between Bishops Lydeard and Minehead. During special events some trains continue to Norton Fitzwarren and a connection to Network Rail allows through trains to operate onto the national network. It operates services using both heritage steam and diesel trains.
The Wisbech and March Bramley Line is a proposed heritage railway based in the town of March in Cambridgeshire, England, that aims to reinstate services over the disused (but still extant) railway line linking the town with Wisbech.
The Wymondham to Wells branch was a railway built in stages by the Norfolk Railway and Eastern Counties Railway between 1847 and 1857. The railway ran from Wymondham in the south, through Dereham and Fakenham to the coastal town of Wells-next-the-Sea; more specifically, the line ran from Wymondham South Junction, where it met the present-day Breckland Line. Passenger services along the line lasted until 1969; the railway continued to be used for freight until 1989. The southern section of the railway now forms the Mid-Norfolk Railway, with part of the northern section serving as the narrow gauge Wells and Walsingham Light Railway.
Yaxham Light Railway is a narrow gauge light railway situated adjacent to Yaxham railway station on the Mid-Norfolk Railway. It is located in the village of Yaxham in the English county of Norfolk.
The Yeovil Railway Centre is a small railway museum at Yeovil Junction on the L&amp;SWR West of England Main Line between Salisbury and Exeter. It was created in 1993 in response to British Rail's decision to remove the turntable from Yeovil Junction. Approximately ¼ mile of track along the Clifton Maybank spur is used for demonstration trains.