Skip to content

Commit

Permalink
TIKA-4361 -- follow on fix (#2108)
Browse files Browse the repository at this point in the history
(cherry picked from commit 05db89d)
  • Loading branch information
tballison committed Jan 28, 2025
1 parent 14e652a commit 91ba3d6
Showing 1 changed file with 39 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
}
}
}
Expand Down

0 comments on commit 91ba3d6

Please sign in to comment.