Skip to content

Commit

Permalink
vgrelease template alias #562
Browse files Browse the repository at this point in the history
  • Loading branch information
spencermountain committed Oct 16, 2023
1 parent bbf84d3 commit 0b57da6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 33 deletions.
13 changes: 9 additions & 4 deletions scratch.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import wtf from './src/index.js'
console.log('start')

let str = `hello
{{usableitinerary}}
let str = `before {{vgrelease|NA|September 29, 1999|EU|October 18, 1999}} after
`
// let doc = wtf(str)
const doc = await wtf.fetch('https://en.wikivoyage.org/wiki/Interstate_5')

wtf.extend((models, templates) => {
templates.vgrelease = ['region', 'date', 'region2', 'date2', 'region3', 'date3', 'region4', 'date4']
})
let doc = wtf(str)
// const doc = await wtf.fetch('https://en.wikivoyage.org/wiki/Interstate_5')

console.log(doc.template().json())
console.log(doc.text())
43 changes: 14 additions & 29 deletions src/template/custom/aliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@ let aliases = {
redir: 'redirect',
sisterlinks: 'sister project links',
'main article': 'main',
'by': 'baseball year',
'aldsy': 'alds year',
'nldsy': 'nlds year',
by: 'baseball year',
aldsy: 'alds year',
nldsy: 'nlds year',
//not perfect..
'str rep': 'replace',
'ushr2': 'ushr',
'stn': 'station',
'metrod': 'metro',
'fw': 'ferry',
'rws': 'stnlnk',
ushr2: 'ushr',
stn: 'station',
metrod: 'metro',
fw: 'ferry',
rws: 'stnlnk',
sclass2: 'sclass',
under: 'underline',
brackets: 'bracket',
raise: 'lower'
raise: 'lower',
vgrelease: 'video game release',
}

//multiple aliases
Expand Down Expand Up @@ -81,7 +82,7 @@ let multi = {
'unbulleted list',
'unbulleted',
'unbulletedlist',
'vunblist'
'vunblist',
],

'election box begin': [
Expand Down Expand Up @@ -244,33 +245,17 @@ let multi = {
'user-blocked',
'notabug',
'notfixed',
'won\'t fix',
"won't fix",
'withdraw',
'nojoy',
'unrelated',
'off-topic talk',
'nayc',
'nayg',
],
checked: [
'already done',
'resolved1',
'check mark-n',
'checked box',
],
checked: ['already done', 'resolved1', 'check mark-n', 'checked box'],
// https://en.wikipedia.org/wiki/Template:Ferry
'station link': [
'amtk',
'cta',
'bts',
'mnrr',
'mtams',
'munis',
'njts',
'scax',
'wmata',
'rwsa',
],
'station link': ['amtk', 'cta', 'bts', 'mnrr', 'mtams', 'munis', 'njts', 'scax', 'wmata', 'rwsa'],
// 'br separated entries': [
// 'br list',
// 'br-separated entries',
Expand Down

0 comments on commit 0b57da6

Please sign in to comment.