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:
parent
180194c5b3
commit
66195ffe69
7 changed files with 23 additions and 14 deletions
2
public/dist/code-styling.bundle.js
vendored
2
public/dist/code-styling.bundle.js
vendored
File diff suppressed because one or more lines are too long
8
public/dist/editor.bundle.js
vendored
8
public/dist/editor.bundle.js
vendored
File diff suppressed because one or more lines are too long
4
public/dist/main.bundle.js
vendored
4
public/dist/main.bundle.js
vendored
File diff suppressed because one or more lines are too long
|
@ -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
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -51,8 +51,8 @@ const translationTable = {
|
|||
'ч': 'ch',
|
||||
'ш': 'sh',
|
||||
'щ': 'shch',
|
||||
'ъ': '',
|
||||
'ь': '',
|
||||
'ъ': "''",
|
||||
'ь': "'",
|
||||
'ю': 'yu',
|
||||
'я': 'ya',
|
||||
'Ё': 'YO',
|
||||
|
@ -61,8 +61,8 @@ const translationTable = {
|
|||
'Ч': 'CH',
|
||||
'Ш': 'SH',
|
||||
'Щ': 'SHCH',
|
||||
'Ъ': '',
|
||||
'Ь': '',
|
||||
'Ъ': "''",
|
||||
'Ь': "'",
|
||||
'Ю': 'YU',
|
||||
'Я': 'YA'
|
||||
};
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue