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