Merge branch 'release/1.2.2'

This commit is contained in:
Book Pauk
2024-07-28 20:22:54 +07:00
4 changed files with 31 additions and 15 deletions

View File

@@ -1271,8 +1271,14 @@ class TextPage {
if (note) { if (note) {
if (orig) {//show dialog if (orig) {//show dialog
this.noteId = noteId; this.noteId = noteId;
const pad = (note.para.length > 1 ? 20 : 0); this.noteHtml = note.xml
this.noteHtml = note.para.map(p => `<p style="margin: 0; padding-left: ${pad}px">${p}</p>`).join(''); .replace(/<p>/g, '<p class="note-para">')
.replace(/<stanza>/g, '<br>').replace(/<\/stanza>/g, '')
.replace(/<v>/g, '<p style="margin: 0">').replace(/<\/v>/g, '</p>')
.replace(/<emphasis>/g, '<em>').replace(/<\/emphasis>/g, '</em>')
.replace(/<text-author>/g, '<br>').replace(/<\/text-author>/g, '')
;
this.noteDialogVisible = true; this.noteDialogVisible = true;
} else {//go to orig } else {//go to orig
this.goToOrigNote(noteId); this.goToOrigNote(noteId);
@@ -1335,3 +1341,10 @@ export default vueComponent(TextPage);
} }
</style> </style>
<style>
.note-para {
margin: 0;
padding: 0;
margin-bottom: 10px;
}
</style>

View File

@@ -94,6 +94,7 @@ export default class BookParser {
let inNote = false; let inNote = false;
let noteId = ''; let noteId = '';
let inNotesBody = false; let inNotesBody = false;
const noteTags = new Set(['p', 'poem', 'stanza', 'v', 'text-author', 'emphasis']);
//оглавление //оглавление
this.contents = []; this.contents = [];
@@ -429,7 +430,7 @@ export default class BookParser {
} }
note.noteParaIndex = paraIndex; note.noteParaIndex = paraIndex;
note.para = []; note.xml = '';
noteId = id; noteId = id;
} }
@@ -447,15 +448,11 @@ export default class BookParser {
inPara = true; inPara = true;
isFirstTitlePara = false; isFirstTitlePara = false;
if (inNotesBody && noteId) { if (inTitle && inNotesBody && noteId) {
if (!inTitle) {
this.notes[noteId].para.push('');
} else {
growParagraph(`<note href="${noteId}">`, 0); growParagraph(`<note href="${noteId}">`, 0);
} }
} }
} }
}
if (tag == 'subtitle') { if (tag == 'subtitle') {
newParagraph(); newParagraph();
@@ -487,6 +484,10 @@ export default class BookParser {
bold = true; bold = true;
space += 1; space += 1;
} }
if (!inTitle && inNotesBody && noteId && noteTags.has(tag)) {
this.notes[noteId].xml += `<${tag}>`;
}
} }
}; };
@@ -551,6 +552,10 @@ export default class BookParser {
bold = false; bold = false;
space -= 1; space -= 1;
} }
if (!inTitle && inNotesBody && noteId && noteTags.has(tag)) {
this.notes[noteId].xml += `</${tag}>`;
}
} }
let i = path.lastIndexOf(tag); let i = path.lastIndexOf(tag);
@@ -637,10 +642,8 @@ export default class BookParser {
else else
growParagraph(' ', 1); growParagraph(' ', 1);
if (!inTitle && inPara && inNotesBody && noteId) { if (!inTitle && inNotesBody && noteId) {
const p = this.notes[noteId].para; this.notes[noteId].xml += text;
if (p.length)
p[p.length - 1] = p[p.length - 1] + text;
} }
} }
}; };

View File

@@ -1,6 +1,6 @@
export const versionHistory = [ export const versionHistory = [
{ {
version: '1.2.1', version: '1.2.2',
releaseDate: '2024-07-28', releaseDate: '2024-07-28',
showUntil: '2024-08-04', showUntil: '2024-08-04',
content: content:

View File

@@ -1,6 +1,6 @@
{ {
"name": "liberama", "name": "liberama",
"version": "1.2.1", "version": "1.2.2",
"author": "Book Pauk <bookpauk@gmail.com>", "author": "Book Pauk <bookpauk@gmail.com>",
"license": "CC0-1.0", "license": "CC0-1.0",
"repository": "bookpauk/liberama", "repository": "bookpauk/liberama",