Улучшение конвертирования html->fb2
This commit is contained in:
@@ -240,6 +240,7 @@ export default class BookParser {
|
||||
newParagraph(' ', 1);
|
||||
isFirstTitlePara = true;
|
||||
bold = true;
|
||||
center = true;
|
||||
}
|
||||
|
||||
if (tag == 'epigraph') {
|
||||
@@ -282,6 +283,7 @@ export default class BookParser {
|
||||
if (tag == 'subtitle') {
|
||||
isFirstTitlePara = false;
|
||||
bold = false;
|
||||
center = false;
|
||||
}
|
||||
|
||||
if (tag == 'epigraph') {
|
||||
|
||||
@@ -77,7 +77,8 @@ class ConvertHtml extends ConvertBase {
|
||||
}
|
||||
};
|
||||
|
||||
const newPara = new Set(['tr', '/table', 'hr', 'br', 'br/', 'li', 'dt', 'dd', 'p', 'title', '/title', 'h1', 'h2', 'h3', '/h1', '/h2', '/h3']);
|
||||
const newPara = new Set(['tr', '/table', 'hr', 'br', 'br/', 'li', 'dt', 'dd', 'p', 'title', '/title', 'ul', '/ul', 'h1', 'h2', 'h3', 'h4', 'h5', '/h1', '/h2', '/h3', '/h4', '/h5']);
|
||||
const newPara2 = new Set(['h1', 'h2', 'h3', 'h4', 'h5']);
|
||||
|
||||
const onTextNode = (text, cutCounter, cutTag) => {// eslint-disable-line no-unused-vars
|
||||
text = this.escapeEntities(text);
|
||||
@@ -108,6 +109,8 @@ class ConvertHtml extends ConvertBase {
|
||||
if (!cutCounter) {
|
||||
if (newPara.has(tag))
|
||||
newParagraph();
|
||||
if (newPara2.has(tag))
|
||||
newParagraph();
|
||||
|
||||
switch (tag) {
|
||||
case 'i':
|
||||
@@ -141,6 +144,8 @@ class ConvertHtml extends ConvertBase {
|
||||
if (!cutCounter) {
|
||||
if (newPara.has('/' + tag))
|
||||
newParagraph();
|
||||
if (newPara2.has('/' + tag))
|
||||
newParagraph();
|
||||
|
||||
switch (tag) {
|
||||
case 'i':
|
||||
|
||||
@@ -102,6 +102,8 @@ class ConvertSamlib extends ConvertBase {
|
||||
case 'h1':
|
||||
case 'h2':
|
||||
case 'h3':
|
||||
case 'h4':
|
||||
case 'h5':
|
||||
if (inPara)
|
||||
closeTag('p');
|
||||
openTag('p');
|
||||
@@ -173,6 +175,8 @@ class ConvertSamlib extends ConvertBase {
|
||||
case 'h1':
|
||||
case 'h2':
|
||||
case 'h3':
|
||||
case 'h4':
|
||||
case 'h5':
|
||||
closeTag('p');
|
||||
bold = false;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user