aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiederick de Vries <diederick@diederickdevries.net>2018-06-13 16:48:05 +0200
committerDiederick de Vries <diederick@diederickdevries.net>2018-06-13 16:48:05 +0200
commit1802bd2ae3faab20e3c920799e4c934db4864abd (patch)
tree462039966a1a9fbc9a0847a30cd39702e9cc2676
parentbd9e0e370ed3d6f00621a1b5d9382d8fd8a20da6 (diff)
downloadcareless-1802bd2ae3faab20e3c920799e4c934db4864abd.tar.gz
careless-1802bd2ae3faab20e3c920799e4c934db4864abd.tar.bz2
careless-1802bd2ae3faab20e3c920799e4c934db4864abd.zip
Add fix where the regex matches also inside the hash before the title
-rw-r--r--careless.groovy11
1 files changed, 7 insertions, 4 deletions
diff --git a/careless.groovy b/careless.groovy
index 37f11c1..7585a2a 100644
--- a/careless.groovy
+++ b/careless.groovy
@@ -97,14 +97,17 @@ class Process {
97 return articles 97 return articles
98 } 98 }
99 99
100 private Article getArticle(Map heading) { 100 private Article getArticle(Map heading) {
101 def link = heading.link 101 def link = heading.link
102 def article = link.find(nrs)
103 def s = link.indexOf("&dn=") + 4 102 def s = link.indexOf("&dn=") + 4
104 def e = link.indexOf(article) 103 def rest = link.substring(s, link.length()-1)
104 def article = rest.find(nrs)
105 def e = s + rest.indexOf(article)
106 def title = (heading.link.substring(s, e) + "- " + article).replaceAll("\\+", " ")
107 log.debug ("title = $title (from $s to $e)")
105 [ 108 [
106 id: heading.id, 109 id: heading.id,
107 title: (heading.link.substring(s, e) + "- " + article).replaceAll("\\+", " "), 110 title: title,
108 link: heading.link 111 link: heading.link
109 ] as Article 112 ] as Article
110 } 113 }