mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-08 15:05: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 editorData = await this.editor.save();
|
||||||
const firstBlock = editorData.blocks.length ? editorData.blocks[0] : null;
|
const firstBlock = editorData.blocks.length ? editorData.blocks[0] : null;
|
||||||
const title = firstBlock && firstBlock.type === 'header' ? firstBlock.data.text : 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) {
|
if (!title) {
|
||||||
throw new Error('Entry should start with Header');
|
throw new Error('Entry should start with Header');
|
||||||
|
@ -93,7 +102,7 @@ export default class Writing {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
parent: this.nodes.parentIdSelector.value,
|
parent: this.nodes.parentIdSelector.value,
|
||||||
uri: this.nodes.uriInput ? this.nodes.uriInput.value : '',
|
uri: uri,
|
||||||
body: editorData
|
body: editorData
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ const aliasTypes = require('../constants/aliasTypes');
|
||||||
*/
|
*/
|
||||||
router.get('*', async (req, res) => {
|
router.get('*', async (req, res) => {
|
||||||
try {
|
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) {
|
switch (alias.type) {
|
||||||
case aliasTypes.PAGE: {
|
case aliasTypes.PAGE: {
|
||||||
|
|
|
@ -51,8 +51,8 @@ const translationTable = {
|
||||||
'ч': 'ch',
|
'ч': 'ch',
|
||||||
'ш': 'sh',
|
'ш': 'sh',
|
||||||
'щ': 'shch',
|
'щ': 'shch',
|
||||||
'ъ': '',
|
'ъ': "''",
|
||||||
'ь': '',
|
'ь': "'",
|
||||||
'ю': 'yu',
|
'ю': 'yu',
|
||||||
'я': 'ya',
|
'я': 'ya',
|
||||||
'Ё': 'YO',
|
'Ё': 'YO',
|
||||||
|
@ -61,8 +61,8 @@ const translationTable = {
|
||||||
'Ч': 'CH',
|
'Ч': 'CH',
|
||||||
'Ш': 'SH',
|
'Ш': 'SH',
|
||||||
'Щ': 'SHCH',
|
'Щ': 'SHCH',
|
||||||
'Ъ': '',
|
'Ъ': "''",
|
||||||
'Ь': '',
|
'Ь': "'",
|
||||||
'Ю': 'YU',
|
'Ю': 'YU',
|
||||||
'Я': 'YA'
|
'Я': 'YA'
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<ul class="docs-aside__section-list">
|
<ul class="docs-aside__section-list">
|
||||||
{% for child in firstLevelPage.children %}
|
{% for child in firstLevelPage.children %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ child.uri }}">
|
<a href="/{{ child.uri }}">
|
||||||
{{ child.title }}
|
{{ child.title }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue