From a35e601dcc474fa4a33682522f360c7eb4963c39 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Thu, 31 Mar 2016 11:03:00 -0400 Subject: [PATCH] Fixed error with links in lists Former-commit-id: b67711dfe796fe21944c8546766f300de8f676b2 [formerly a4d179052e2e1a41e8386a25d4e3271212764ff9] [formerly bbaafc6a325179acb67f13a8b586c1c1857aae2e [formerly a1fdd16073c8ed96c0e742462f375b64270dd771]] Former-commit-id: 5a4f9291ae8d63e95ca5b53daf7f3892308311a3 [formerly 38f184d06b0b4d49fbf27977b247bfa98c92bd1c] Former-commit-id: 678df5edc9528504cab10aaee24a1a309af2ff4d --- routes.go | 9 +++++++++ templates/list.tmpl | 8 ++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/routes.go b/routes.go index cb4320b..308c675 100644 --- a/routes.go +++ b/routes.go @@ -459,6 +459,15 @@ func renderList(c *gin.Context, title string) { pClean.AllowDataURIImages() text := pClean.SanitizeBytes([]byte(p.CurrentText)) listItems, _ := reorderList(string(text)) + for i := range listItems { + newHTML := strings.Replace(string(listItems[i]), "", ""+``, -1) + newHTML = strings.Replace(newHTML, "", "
  • "+``, -1) + newHTML = strings.Replace(newHTML, "
  • ", "
    ", -1) + newHTML = strings.Replace(newHTML, "
  • "+``, "
  • "+``, -1) + newHTML = strings.Replace(newHTML, "
  • ", "", -1) + listItems[i] = template.HTML([]byte(newHTML)) + } c.HTML(http.StatusOK, "list.tmpl", gin.H{ "Title": title, "WikiName": RuntimeArgs.WikiName, diff --git a/templates/list.tmpl b/templates/list.tmpl index a89e84e..eae054a 100644 --- a/templates/list.tmpl +++ b/templates/list.tmpl @@ -11,6 +11,7 @@ padding: 0; list-style-type: none; } +span { cursor: pointer; } @@ -45,7 +46,7 @@
    @@ -54,9 +55,6 @@ $('.deletable').click(function(event) { event.preventDefault(); var lineNum = $(this).attr('id') - var href = $(this).attr('href') - if (href == "#") { - console.log(lineNum) $.ajax({ url: "/listitem" + '?' + $.param({ "lineNum": lineNum, @@ -67,8 +65,6 @@ window.location.reload(true); } }); - } - }); $(document).keydown(function(e){