The DSL that underlies Wikipedia’s nice transit diagrams is Quite A Thing. This diagram for San Francisco’s T Third Street line is generated by this code:
{{Routemap
|inline = <includeonly>1</includeonly>
|title = T Third Street
|title-bg = #{{rcr|MUNI|T}}
|navbar = T Third Street
|navbar pos = 2
|map =
{{munis|Chinatown}}
\utKACCa~~{{munis|Union Square/Market Street}}
HUBrg\utACC!~HUBeq~~ ~~{{munis|Powell}}~~{{rint|bart}} {{rint|sanfrancisco|J}} {{rint|sanfrancisco|K}} {{rint|sanfrancisco|M}} {{rint|sanfrancisco|N}} {{rint|sanfrancisco|S}} {{rint|sanfrancisco|F}}
utvCONTgq\utvSTRq!~ulHST-!~ul-HST!~HUB\utKRZvtu\utvCONTfq!~utCONTfq-~~ ~~{{munis|Yerba Buena/Moscone}}
HUBe@g\utACC~~{{Jctrdt|state=CA|I|80}}
\dRP4q\utSKRZ-G4\dRP4q~~ ~~ ~~[[Central Subway (San Francisco)|Central Subway]]
\utSTRe ~~ ~~ ~~{{munis|4th and Brannan}}
\uACC~~''[[Caltrain]]''
LSTR+l\KACCeq!~HUBa\uSTR\~~ ~~ ~~{{rint|sanfrancisco|E}} {{rint|sanfrancisco|N}}
uENDEaq\uACCq!~HUB\uKRZ\uCONTfq~~{{4th & King–Arleta}}
{{munis|Sunnydale}}
\\uKACCe\~~}}
(There isn’t as much code here as you’d expect because everything below 4th and King is provided by the separate “4th & King–Arleta” template, presumably so that it can be reused in a different diagram.)