From d4e766c8dca5ebe6a11f8f60b93c8126166fbfc0 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Fri, 21 Oct 2016 01:28:15 +0200 Subject: [PATCH] nimweb updated for the new news filenames --- tools/nimweb.nim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/nimweb.nim b/tools/nimweb.nim index 65af672166..4273488b04 100644 --- a/tools/nimweb.nim +++ b/tools/nimweb.nim @@ -89,7 +89,7 @@ Compile_options: will be passed to the Nim compiler """ - rYearMonthDay = r"(\d{4})_(\d{2})_(\d{2})" + rYearMonthDay = r"on\s+(\d{2})\/(\d{2})\/(\d{4})" rssUrl = "http://nim-lang.org/news.xml" rssNewsUrl = "http://nim-lang.org/news.html" activeSponsors = "web/sponsors.csv" @@ -347,6 +347,7 @@ proc buildAddDoc(c: var TConfigData, destPath: string) = proc parseNewsTitles(inputFilename: string): seq[TRssItem] = # Goes through each news file, returns its date/title. result = @[] + var matches: array[3, string] let reYearMonthDay = re(rYearMonthDay) for kind, path in walkDir(inputFilename): let (dir, name, ext) = path.splitFile @@ -354,8 +355,8 @@ proc parseNewsTitles(inputFilename: string): seq[TRssItem] = let content = readFile(path) let title = content.splitLines()[0] let urlPath = "news/" & name & ".html" - if name =~ reYearMonthDay: - result.add(TRssItem(year: matches[0], month: matches[1], day: matches[2], + if content.find(reYearMonthDay, matches) >= 0: + result.add(TRssItem(year: matches[2], month: matches[1], day: matches[0], title: title, url: "http://nim-lang.org/" & urlPath, content: content)) result.reverse()