summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert.plociniczak@gmail.com>2016-10-18 10:50:37 +0200
committerHubert Plociniczak <hubert.plociniczak@gmail.com>2016-10-18 10:50:37 +0200
commitc74c5fdd97e8bf4c160a42dff72e3a521294bcda (patch)
tree990dbcc48aff95a118948952f47183824e9b695e
parentcbeb72d06b4eb3718479eba5257a33a385f642fe (diff)
Issue 3143: Don't duplicate text for anchors
When creating an anchor element we were adding its representation as well as the original content, leading to text duplication.
-rw-r--r--src/Text/Pandoc/Readers/Odt/ContentReader.hs5
-rw-r--r--tests/odt/native/referenceToText.native2
-rw-r--r--tests/odt/odt/referenceToText.odtbin10179 -> 10208 bytes
3 files changed, 3 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Odt/ContentReader.hs b/src/Text/Pandoc/Readers/Odt/ContentReader.hs
index 8c475eefc..ffd2f61d1 100644
--- a/src/Text/Pandoc/Readers/Odt/ContentReader.hs
+++ b/src/Text/Pandoc/Readers/Odt/ContentReader.hs
@@ -713,9 +713,8 @@ maybeAddAnchorFrom anchorReader =
>>>
proc (inlines, fAnchorElem) -> do
case fAnchorElem of
- Right anchorElem ->
- arr (anchorElem <>) -<< inlines
- Left _ -> returnA -< inlines
+ Right anchorElem -> returnA -< anchorElem
+ Left _ -> returnA -< inlines
where
toAnchorElem :: Anchor -> Inlines
toAnchorElem anchorID = spanWith (anchorID, [], []) mempty
diff --git a/tests/odt/native/referenceToText.native b/tests/odt/native/referenceToText.native
index 1d80e2d0d..a2c3e588d 100644
--- a/tests/odt/native/referenceToText.native
+++ b/tests/odt/native/referenceToText.native
@@ -1 +1 @@
-[Para [Span ("an anchor",[],[]) [],Str "Some",Space,Str "text."],Para [Str "A",Space,Str "reference",Space,Str "to",Space,Link ("",[],[]) [Str "Some",Space,Str "text"] ("#an anchor",""),Str "."]]
+[Para [Span ("an anchor",[],[]) [],Str "Some",Space,Str "text."],Para [Str "A",Space,Str "reference",Space,Str "to",Space,Link ("",[],[]) [Str "Some",Space,Str "text"] ("#an anchor",""),Str "."],Para [Str "Some",Space,Str "text",LineBreak,Str "Another",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "link",Span ("anchor",[],[]) []]]
diff --git a/tests/odt/odt/referenceToText.odt b/tests/odt/odt/referenceToText.odt
index 281055aa0..19237e6f1 100644
--- a/tests/odt/odt/referenceToText.odt
+++ b/tests/odt/odt/referenceToText.odt
Binary files differ