Merge pull request #215 from jpirnay/fix-align
fix: Honor users choice for alignment
This commit is contained in:
@@ -979,7 +979,8 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
|||||||
self->currentCssStyle = cssStyle;
|
self->currentCssStyle = cssStyle;
|
||||||
auto headerBlockStyle = BlockStyle::fromCssStyle(cssStyle, emSize, CssTextAlign::Center, self->viewportWidth);
|
auto headerBlockStyle = BlockStyle::fromCssStyle(cssStyle, emSize, CssTextAlign::Center, self->viewportWidth);
|
||||||
headerBlockStyle.textAlignDefined = true;
|
headerBlockStyle.textAlignDefined = true;
|
||||||
if (self->embeddedStyle && cssStyle.hasTextAlign()) {
|
if (self->embeddedStyle && cssStyle.hasTextAlign() &&
|
||||||
|
self->paragraphAlignment == static_cast<uint8_t>(CssTextAlign::None)) {
|
||||||
headerBlockStyle.alignment = cssStyle.textAlign;
|
headerBlockStyle.alignment = cssStyle.textAlign;
|
||||||
}
|
}
|
||||||
self->startNewTextBlock(headerBlockStyle);
|
self->startNewTextBlock(headerBlockStyle);
|
||||||
@@ -990,7 +991,8 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
|||||||
// Preserve paragraph break semantics for this <p>, but skip its inner text payload.
|
// Preserve paragraph break semantics for this <p>, but skip its inner text payload.
|
||||||
self->currentCssStyle = cssStyle;
|
self->currentCssStyle = cssStyle;
|
||||||
auto blockStyle = userAlignmentBlockStyle;
|
auto blockStyle = userAlignmentBlockStyle;
|
||||||
if (self->embeddedStyle && cssStyle.hasTextAlign()) {
|
if (self->embeddedStyle && cssStyle.hasTextAlign() &&
|
||||||
|
self->paragraphAlignment == static_cast<uint8_t>(CssTextAlign::None)) {
|
||||||
blockStyle.alignment = cssStyle.textAlign;
|
blockStyle.alignment = cssStyle.textAlign;
|
||||||
blockStyle.textAlignDefined = true;
|
blockStyle.textAlignDefined = true;
|
||||||
}
|
}
|
||||||
@@ -1024,7 +1026,8 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
|||||||
} else {
|
} else {
|
||||||
self->currentCssStyle = cssStyle;
|
self->currentCssStyle = cssStyle;
|
||||||
auto blockStyle = userAlignmentBlockStyle;
|
auto blockStyle = userAlignmentBlockStyle;
|
||||||
if (self->embeddedStyle && cssStyle.hasTextAlign()) {
|
if (self->embeddedStyle && cssStyle.hasTextAlign() &&
|
||||||
|
self->paragraphAlignment == static_cast<uint8_t>(CssTextAlign::None)) {
|
||||||
blockStyle.alignment = cssStyle.textAlign;
|
blockStyle.alignment = cssStyle.textAlign;
|
||||||
blockStyle.textAlignDefined = true;
|
blockStyle.textAlignDefined = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user