sentence links

This commit is contained in:
Andrea Vos 2022-07-24 18:57:52 +02:00
parent 651b51224a
commit b91b2b1479
5 changed files with 37 additions and 9 deletions

View File

@ -178,6 +178,13 @@ pronouns:
- 'Osoba B używa {/ona=rodzaju żeńskiego}, więc zwracając się do osoby A lub mówiąc o niej będzie używała form żeńskich.'
- 'Osoba C używa {/onu=dukaizmów} wymiennie z {/ono=rodzajem neutralnym}, więc zwracając się do osoby A lub mówiąc o num będzie używała form postpłciowych bądź neutralnych.'
others: 'Pozostałe formy'
sentence:
subdomains: ['moje', 'nasze']
prefixes: ['/to']
examples:
- 'moje.zaimki.pl/to/ono/jego'
- 'moje.zaimki.pl/to/onu&ona'
- 'nasze.zaimki.pl/to/oni/ich&one/ich'
pronunciation:
enabled: true

View File

@ -94,6 +94,8 @@ pronouns:
othersRaw: 'inne'
or: 'lub'
grammarTable: 'Odmiana'
sentence:
'Oprócz domyślnych linków możesz też podlinkować do swoich zaimków tak, aby URL czytało się niemal jak zdanie, na przykład:'
sources:
header: 'Teksty kultury'

View File

@ -318,15 +318,17 @@ export default {
}
if (config.pronouns.enabled) {
routes.push({ path: `/${encodeURIComponent(config.pronouns.any)}`, component: resolve(__dirname, 'routes/any.vue') });
routes.push({ path: `/${encodeURIComponent(config.pronouns.any)}::group`, component: resolve(__dirname, 'routes/any.vue') });
if (config.pronouns.null && config.pronouns.null.routes) {
for (let route of config.pronouns.null.routes) {
routes.push({ path: '/' + encodeURIComponent(route), component: resolve(__dirname, 'routes/avoiding.vue') });
for (let prefix of [...(config.pronouns.sentence ? config.pronouns.sentence.prefixes : []), '']) {
routes.push({ path: `${prefix}/${encodeURIComponent(config.pronouns.any)}`, component: resolve(__dirname, 'routes/any.vue') });
routes.push({ path: `${prefix}/${encodeURIComponent(config.pronouns.any)}::group`, component: resolve(__dirname, 'routes/any.vue') });
if (config.pronouns.null && config.pronouns.null.routes) {
for (let route of config.pronouns.null.routes) {
routes.push({ path: `${prefix}/${encodeURIComponent(route)}`, component: resolve(__dirname, 'routes/avoiding.vue') });
}
}
if (config.pronouns.mirror) {
routes.push({ path: `${prefix}/${encodeURIComponent(config.pronouns.mirror.route)}`, component: resolve(__dirname, 'routes/mirror.vue') });
}
}
if (config.pronouns.mirror) {
routes.push({ path: '/' + encodeURIComponent(config.pronouns.mirror.route), component: resolve(__dirname, 'routes/mirror.vue') });
}
}
@ -340,7 +342,7 @@ export default {
routes.push({ path: '/api', component: resolve(__dirname, 'routes/api.vue') });
}
routes.push({ name: 'all', path: '*', component: resolve(__dirname, 'routes/pronoun.vue') });
routes.push({ name: 'all', path: `*`, component: resolve(__dirname, 'routes/pronoun.vue') });
},
},
}

View File

@ -3,6 +3,16 @@
<section>
<Suggested/>
<div v-if="config.pronouns.sentence" class="alert alert-info small">
<Icon v="lightbulb-on"/>
<T>pronouns.sentence</T>
<ul class="mb-0">
<li v-for="example in config.pronouns.sentence.examples">
<a :href="`https://${example}`" target="_blank" rel="noopener">{{ example }}</a>
</li>
</ul>
</div>
<ul class="list-group mt-4">
<li v-for="[group, groupPronouns] in pronounLibrary.split()" class="list-group-item">
<p class="h5">

View File

@ -48,6 +48,13 @@ export const buildPronoun = (pronouns, path) => {
const config = global.config || process.env.CONFIG;
for (let prefix of config.pronouns.sentence ? config.pronouns.sentence.prefixes : []) {
if (('/' + path).startsWith(prefix + '/')) {
path = path.substring(prefix.length);
break;
}
}
const pronounsWithAliases = addAliasesToPronouns(pronouns);
const pronounStr = path.split(',');