git.iko.soy/typeable/pandoc
on master help sign in
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.

commitc74c5fdd97e8bf4c160a42dff72e3a521294bcda authorHubert Plociniczak <hubert.plociniczak@gmail.com> dateTue 18 Oct 2016, 10:50 (10 years ago) parentcbeb72d
3 files changed+3−4
src/Text/Pandoc/Readers/Odt/ContentReader.hs+2−3 tests/odt/native/referenceToText.native+1−1 tests/odt/odt/referenceToText.odt
src/Text/Pandoc/Readers/Odt/ContentReader.hs+2−3
@@ -713,9 +713,8 @@ maybeAddAnchorFrom anchorReader =
713713 >>>
714714 proc (inlines, fAnchorElem) -> do
715715 case fAnchorElem of
716− Right anchorElem ->
717− arr (anchorElem <>) -<< inlines
718− Left _ -> returnA -< inlines
716+ Right anchorElem -> returnA -< anchorElem
717+ Left _ -> returnA -< inlines
719718 where
720719 toAnchorElem :: Anchor -> Inlines
721720 toAnchorElem anchorID = spanWith (anchorID, [], []) mempty
tests/odt/native/referenceToText.native+1−1
@@ -1 +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 "."]]
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 [Str "Some",Space,Str "text",LineBreak,Str "Another",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "link",Span ("anchor",[],[]) []]]
tests/odt/odt/referenceToText.odt

Binary file not shown.