From 836153de43933dca3205e4459f55979d467f927e Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Sun, 31 Dec 2017 09:09:22 -0500 Subject: Docx Reader: Combine adjacent anchors. There isn't any reason to have numberous anchors in the same place, since we can't maintain docx's non-nesting overlapping. So we reduce to a single anchor, and have all links pointing to one of the overlapping anchors point to that one. This changes the behavior from commit e90c714c7 slightly (use the first anchor instead of the last) so we change the expected test result. Note that because this produces a state that has to be set after every invocation of `parPartToInlines`, we make the main function into a primed subfunction `parPartToInlines'`, and make `parPartToInlines` a wrapper around that. --- test/docx/unused_anchors.native | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/docx/unused_anchors.native b/test/docx/unused_anchors.native index 334269793..051dfe424 100644 --- a/test/docx/unused_anchors.native +++ b/test/docx/unused_anchors.native @@ -1,3 +1,3 @@ [Header 1 ("my-section",[],[]) [Str "My",Space,Str "Section"] -,Para [Link ("",[],[]) [Str "Here",Space,Str "is",Space,Str "a",Space,Str "link."] ("#Bar","")] -,Para [Span ("Bar",["anchor"],[]) [],Str "Here",Space,Str "is",Space,Str "the",Space,Str "target."]] +,Para [Link ("",[],[]) [Str "Here",Space,Str "is",Space,Str "a",Space,Str "link."] ("#Foo","")] +,Para [Span ("Foo",["anchor"],[]) [],Str "Here",Space,Str "is",Space,Str "the",Space,Str "target."]] -- cgit v1.2.3