1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-08-08 06:55:26 +02:00

Fixed bugs related to translation

This commit is contained in:
DorofeevMark 2019-01-12 20:44:37 +03:00
parent 180194c5b3
commit 66195ffe69
7 changed files with 23 additions and 14 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -86,6 +86,15 @@ export default class Writing {
const editorData = await this.editor.save();
const firstBlock = editorData.blocks.length ? editorData.blocks[0] : null;
const title = firstBlock && firstBlock.type === 'header' ? firstBlock.data.text : null;
let uri = '';
if (this.nodes.uriInput) {
if (this.nodes.uriInput.value.match(/^[a-z0-9'-]+$/i)) {
uri = this.nodes.uriInput.value;
} else {
throw new Error('Uri has unexpected characters');
}
}
if (!title) {
throw new Error('Entry should start with Header');
@ -93,7 +102,7 @@ export default class Writing {
return {
parent: this.nodes.parentIdSelector.value,
uri: this.nodes.uriInput ? this.nodes.uriInput.value : '',
uri: uri,
body: editorData
};
}

View file

@ -11,7 +11,7 @@ const aliasTypes = require('../constants/aliasTypes');
*/
router.get('*', async (req, res) => {
try {
const alias = await Aliases.get(req.originalUrl.slice(1));
const alias = await Aliases.get(req.originalUrl.slice(1)); // Cuts first '/' character
switch (alias.type) {
case aliasTypes.PAGE: {

View file

@ -51,8 +51,8 @@ const translationTable = {
'ч': 'ch',
'ш': 'sh',
'щ': 'shch',
'ъ': '',
'ь': '',
'ъ': "''",
'ь': "'",
'ю': 'yu',
'я': 'ya',
'Ё': 'YO',
@ -61,8 +61,8 @@ const translationTable = {
'Ч': 'CH',
'Ш': 'SH',
'Щ': 'SHCH',
'Ъ': '',
'Ь': '',
'Ъ': "''",
'Ь': "'",
'Ю': 'YU',
'Я': 'YA'
};

View file

@ -8,7 +8,7 @@
<ul class="docs-aside__section-list">
{% for child in firstLevelPage.children %}
<li>
<a href="{{ child.uri }}">
<a href="/{{ child.uri }}">
{{ child.title }}
</a>
</li>