diff --git a/claat/parser/gdoc/parse.go b/claat/parser/gdoc/parse.go index ef760a9e4..057b22d44 100644 --- a/claat/parser/gdoc/parse.go +++ b/claat/parser/gdoc/parse.go @@ -77,6 +77,9 @@ const ( // google docs comments are links with commentPrefix. commentPrefix = "#cmnt" + + // the google.com redirector service + redirectorPrefix = "https://www.google.com/url?q=" ) var ( @@ -786,6 +789,11 @@ func link(ds *docState) nodes.Node { return nil } + // re-write google.com redirector URLs + if strings.HasPrefix(href, redirectorPrefix) { + href = strings.TrimPrefix(href, redirectorPrefix) + } + t := nodes.NewTextNode(nodes.NewTextNodeOptions{ Value: text, }) diff --git a/claat/parser/gdoc/parse_test.go b/claat/parser/gdoc/parse_test.go index db5d7a19d..87b8a7f42 100644 --- a/claat/parser/gdoc/parse_test.go +++ b/claat/parser/gdoc/parse_test.go @@ -536,7 +536,8 @@ func TestParseFragment(t *testing.T) {
this should not be ignored
-
+ 
[a]Test comment.