internal/godoc/dochtml/internal/render: fix numbered lists

Spacing inside the li element was incorrect.

Also added a test.

Also removed extraneous print statement.

Change-Id: Ic84082b6b4eee18c1db9c22952fa1e455a0b4ff5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/413318
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/godoc/dochtml/internal/render/linkify.go b/internal/godoc/dochtml/internal/render/linkify.go
index 996b7d5..d90073c 100644
--- a/internal/godoc/dochtml/internal/render/linkify.go
+++ b/internal/godoc/dochtml/internal/render/linkify.go
@@ -102,13 +102,13 @@
 
 	oListTemplate = template.Must(template.New("olist").Parse(
 		`<ol>
-		   {{range .}}
-		     {{.}}
-           {{end}}
-         </ol>`))
+{{- range .}}
+  {{.}}
+{{- end}}
+</ol>`))
 
 	listItemTemplate = template.Must(template.New("li").Parse(
-		`<li{{with .Number}}value="{{.}}" {{end}}>{{.Content}}</li>`))
+		`<li{{with .Number}} value="{{.}}"{{end}}>{{.Content}}</li>`))
 )
 
 func (r *Renderer) formatDocHTML(text string, extractLinks bool) safe.HTML {
@@ -145,7 +145,6 @@
 		case *comment.List:
 			if inLinks {
 				for _, item := range b.Items {
-					fmt.Println("    ", item)
 					if link, ok := itemLink(item); ok {
 						r.links = append(r.links, link)
 					}
diff --git a/internal/godoc/dochtml/internal/render/linkify_test.go b/internal/godoc/dochtml/internal/render/linkify_test.go
index 8cae71c..8bd846c 100644
--- a/internal/godoc/dochtml/internal/render/linkify_test.go
+++ b/internal/godoc/dochtml/internal/render/linkify_test.go
@@ -123,7 +123,7 @@
 </p>`,
 		},
 		{
-			name: "list",
+			name: "ulist",
 			doc: `
 			Here is a list:
 				- a
@@ -135,6 +135,18 @@
 </ul>`,
 		},
 		{
+			name: "olist",
+			doc: `
+			Here is a list:
+				1. a
+				2. b`,
+			want: `<p>Here is a list:
+</p><ol>
+  <li value="1">a</li>
+  <li value="2">b</li>
+</ol>`,
+		},
+		{
 			name:         "Links section is not extracted",
 			extractLinks: []bool{false},
 			doc:          linksDoc,