Skip to content

Commit

Permalink
Merge branch 'release/1.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpauk committed Jul 28, 2024
2 parents 8858d6d + 4be9ce5 commit 59c4b62
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
17 changes: 15 additions & 2 deletions client/components/Reader/TextPage/TextPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1271,8 +1271,14 @@ class TextPage {
if (note) {
if (orig) {//show dialog
this.noteId = noteId;
const pad = (note.para.length > 1 ? 20 : 0);
this.noteHtml = note.para.map(p => `<p style="margin: 0; padding-left: ${pad}px">${p}</p>`).join('');
this.noteHtml = note.xml
.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;
} else {//go to orig
this.goToOrigNote(noteId);
Expand Down Expand Up @@ -1335,3 +1341,10 @@ export default vueComponent(TextPage);
}
</style>
<style>
.note-para {
margin: 0;
padding: 0;
margin-bottom: 10px;
}
</style>
25 changes: 14 additions & 11 deletions client/components/Reader/share/BookParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export default class BookParser {
let inNote = false;
let noteId = '';
let inNotesBody = false;
const noteTags = new Set(['p', 'poem', 'stanza', 'v', 'text-author', 'emphasis']);

//оглавление
this.contents = [];
Expand Down Expand Up @@ -429,7 +430,7 @@ export default class BookParser {
}

note.noteParaIndex = paraIndex;
note.para = [];
note.xml = '';
noteId = id;
}

Expand All @@ -447,12 +448,8 @@ export default class BookParser {
inPara = true;
isFirstTitlePara = false;

if (inNotesBody && noteId) {
if (!inTitle) {
this.notes[noteId].para.push('');
} else {
growParagraph(`<note href="${noteId}">`, 0);
}
if (inTitle && inNotesBody && noteId) {
growParagraph(`<note href="${noteId}">`, 0);
}
}
}
Expand Down Expand Up @@ -487,6 +484,10 @@ export default class BookParser {
bold = true;
space += 1;
}

if (!inTitle && inNotesBody && noteId && noteTags.has(tag)) {
this.notes[noteId].xml += `<${tag}>`;
}
}
};

Expand Down Expand Up @@ -551,6 +552,10 @@ export default class BookParser {
bold = false;
space -= 1;
}

if (!inTitle && inNotesBody && noteId && noteTags.has(tag)) {
this.notes[noteId].xml += `</${tag}>`;
}
}

let i = path.lastIndexOf(tag);
Expand Down Expand Up @@ -637,10 +642,8 @@ export default class BookParser {
else
growParagraph(' ', 1);

if (!inTitle && inPara && inNotesBody && noteId) {
const p = this.notes[noteId].para;
if (p.length)
p[p.length - 1] = p[p.length - 1] + text;
if (!inTitle && inNotesBody && noteId) {
this.notes[noteId].xml += text;
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion client/components/Reader/versionHistory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const versionHistory = [
{
version: '1.2.1',
version: '1.2.2',
releaseDate: '2024-07-28',
showUntil: '2024-08-04',
content:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "liberama",
"version": "1.2.1",
"version": "1.2.2",
"author": "Book Pauk <bookpauk@gmail.com>",
"license": "CC0-1.0",
"repository": "bookpauk/liberama",
Expand Down

0 comments on commit 59c4b62

Please sign in to comment.