Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TIKA-4361 -- follow on fix
Browse files Browse the repository at this point in the history
tballison committed Jan 28, 2025
1 parent 34a8d34 commit ea89231
Showing 1 changed file with 39 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -941,27 +941,32 @@ private void processControlWord(int param, PushbackInputStream in)
} else {
// In document
if (equals("b")) {
//TIKA-4361 -- need to make sure we're not in an href?
// b0
assert param == 0;
if (groupState.bold) {
pushText();
if (groupState.italic) {
end("i");
}
end("b");
if (groupState.italic) {
start("i");
//only modify styles if we're not in a hyperlink
if (fieldState == 0) {
if (groupState.bold) {
pushText();
if (groupState.italic) {
end("i");
}
end("b");
if (groupState.italic) {
start("i");
}
groupState.bold = false;
}
groupState.bold = false;
}
} else if (equals("i")) {
// i0
assert param == 0;
if (groupState.italic) {
pushText();
end("i");
groupState.italic = false;
//only modify styles if we're not in a hyperlink
if (fieldState == 0) {
if (groupState.italic) {
pushText();
end("i");
groupState.italic = false;
}
}
} else if (equals("f")) {
// Change current font
@@ -1174,23 +1179,27 @@ private void processControlWord() throws IOException, SAXException, TikaExceptio
inHeader = false;
}
} else {
if (equals("b")) {
if (!groupState.bold) {
pushText();
lazyStartParagraph();
if (groupState.italic) {
// Make sure nesting is always <b><i>
end("i");
//only modify styles if we're not in a hyperlink
if (fieldState == 0) {
if (equals("b")) {
if (!groupState.bold) {
pushText();
lazyStartParagraph();
if (groupState.italic) {
// Make sure nesting is always <b><i>
end("i");
}
groupState.bold = true;
startStyles(groupState);
}
} else if (equals("i")) {
//START I
if (!groupState.italic) {
pushText();
lazyStartParagraph();
groupState.italic = true;
start("i");
}
groupState.bold = true;
startStyles(groupState);
}
} else if (equals("i")) {
if (!groupState.italic) {
pushText();
lazyStartParagraph();
groupState.italic = true;
start("i");
}
}
}

0 comments on commit ea89231

Please sign in to comment.