commit | df079801282548afb031b54664793f4052e3ea7c | [log] [tgz] |
---|---|---|
author | Dmitri Shuralyov <shurcooL@gmail.com> | Wed Mar 16 00:46:16 2016 -0700 |
committer | Andrew Gerrand <adg@golang.org> | Fri Mar 18 00:42:36 2016 +0000 |
tree | d362bd9f83b02f60df3a0e55ef0660fdee26cb8c | |
parent | 309d40be40a505acad758e7a37458e11300dfdbf [diff] |
Support {file} after '#' in go-source meta tag. Due to the way LineFmt is currently used (see https://github.com/golang/gddo/blob/309d40be40a505acad758e7a37458e11300dfdbf/gddo-server/template.go#L104), we need to split fileTemplate into two parts at a cut point. Previously, the cut point has always been just before the first '#', if present, or end of string otherwise. Now, we'll extend the cut to include the last {file} segment, if it it appears beyond a '#'. Some examples, where the '|' in the URL represents the cut: ↓ https://example.org/repo{/dir}/{file}?view=t| ↓ https://example.org/repo{/dir}/{file}?view=t|#L{line} ↓ https://example.org/repo{/dir}/{file}?view=t#{file}|-L{line} ↓ https://example.org/repo{/dir}/{file}?view=t#FileName-{file}|-and-LineNumber{line}-and-more Add test for a case where {file} comes after '#'. Fixes #385. Also, remove unintended extra `<head>` before `<!DOCTYPE html><html><head>` in test data. Change-Id: Ia053602b566d8b7b61b4692be76d6b0cbf866325 Reviewed-on: https://go-review.googlesource.com/20749 Reviewed-by: Andrew Gerrand <adg@golang.org>