#117 slash-separated pronoun urls

This commit is contained in:
Andrea Vos 2020-12-03 17:38:58 +01:00
parent e23c943f25
commit a787f403a5
2 changed files with 22 additions and 0 deletions

View File

@ -34,6 +34,7 @@ pronouns:
reflexive: '#self'
examples: ['💫', '💙']
template: 'Open one of the examples and simply replace the emoji in the URL with your own.'
slashes: true
avoiding: false
others: 'Other pronouns'

View File

@ -51,6 +51,27 @@ export const buildPronoun = (pronouns, path) => {
pronoun = buildPronounFromTemplate(path.substring(1), process.env.CONFIG.pronouns.null);
}
const p = path.split('/').filter(s => !!s);
if (!pronoun && process.env.CONFIG.pronouns.slashes !== false && p.length === MORPHEMES.length) {
pronoun = new Pronoun(
`${p[0]}/${p[1]}`,
'',
false,
buildDict(function*() {
let i = 0;
for (let m of MORPHEMES) {
yield [m, p[i++]];
}
}),
[ p[p.length - 1].endsWith('selves') ], // TODO English specific, extract somewhere
[ false ],
[],
[],
null,
false,
)
}
return pronoun;
}