From cf70fe629a909b1eeba086b5bbc436250898ae97 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sat, 4 Jun 2016 17:16:20 +0100 Subject: Implemented generation of sponsors page + missing assets. --- tools/nimweb.nim | 37 ++++++++++++++++++++++++++++- tools/website.tmpl | 34 ++++++++++++++++++++++++++ web/assets/bountysource/bountysource.png | Bin 0 -> 27078 bytes web/assets/bountysource/secondspectrum.png | Bin 0 -> 53148 bytes web/assets/niminaction/banner.jpg | Bin 0 -> 86775 bytes web/assets/style.css | 31 ++++++++++++++++++++++++ web/sponsors.csv | 22 +++++++++++++++++ 7 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 web/assets/bountysource/bountysource.png create mode 100644 web/assets/bountysource/secondspectrum.png create mode 100644 web/assets/niminaction/banner.jpg create mode 100644 web/sponsors.csv diff --git a/tools/nimweb.nim b/tools/nimweb.nim index 8b7cb381f..f0479a258 100644 --- a/tools/nimweb.nim +++ b/tools/nimweb.nim @@ -9,7 +9,7 @@ import os, strutils, times, parseopt, parsecfg, streams, strtabs, tables, - re, htmlgen, macros, md5, osproc + re, htmlgen, macros, md5, osproc, parsecsv type TKeyValPair = tuple[key, id, val: string] @@ -29,6 +29,15 @@ type TAction = enum actAll, actOnlyWebsite, actPdf + Sponsor = object + logo: string + name: string + url: string + thisMonth: int + allTime: int + since: string + level: int + var action: TAction proc initConfigData(c: var TConfigData) = @@ -83,6 +92,7 @@ Compile_options: rYearMonthDayTitle = r"(\d{4})-(\d{2})-(\d{2})\s+(.*)" rssUrl = "http://nim-lang.org/news.xml" rssNewsUrl = "http://nim-lang.org/news.html" + sponsors = "web/sponsors.csv" validAnchorCharacters = Letters + Digits @@ -407,6 +417,30 @@ proc buildJS(destPath: string) = exec("nim js -d:release --out:$1 web/nimblepkglist.nim" % [destPath / "nimblepkglist.js"]) +proc readSponsors(sponsorsFile: string): seq[Sponsor] = + result = @[] + var fileStream = newFileStream(sponsorsFile, fmRead) + if fileStream == nil: quit("Cannot open sponsors.csv file: " & sponsorsFile) + var parser: CsvParser + open(parser, fileStream, sponsorsFile) + discard readRow(parser) # Skip the header row. + while readRow(parser): + result.add(Sponsor(logo: parser.row[0], name: parser.row[1], + url: parser.row[2], thisMonth: parser.row[3].parseInt, + allTime: parser.row[4].parseInt, + since: parser.row[5], level: parser.row[6].parseInt)) + parser.close() + +proc buildSponsors(c: var TConfigData, sponsorsFile: string, outputDir: string) = + let sponsors = generateSponsors(readSponsors(sponsorsFile)) + let outFile = outputDir / "sponsors.html" + var f: File + if open(f, outFile, fmWrite): + writeLine(f, generateHtmlPage(c, "Our Sponsors", sponsors, "")) + close(f) + else: + quit("[Error] Cannot write file: " & outFile) + proc buildWebsite(c: var TConfigData) = const cmd = "nim rst2html --compileonly $1 -o:web/$2.temp web/$2.txt" @@ -438,6 +472,7 @@ proc buildWebsite(c: var TConfigData) = removeFile(temp) copyDir("web/assets", "web/upload/assets") buildNewsRss(c, "web/upload") + buildSponsors(c, sponsors, "web/upload") proc main(c: var TConfigData) = buildWebsite(c) diff --git a/tools/website.tmpl b/tools/website.tmpl index 6ae975839..69547ca9e 100644 --- a/tools/website.tmpl +++ b/tools/website.tmpl @@ -209,3 +209,37 @@ runForever() # end if +#end proc +# +#proc generateSponsors(sponsors: seq[Sponsor]): string = +#result = "" +

Our Current Sponsors

+

This page lists the companies and individuals that are, very kindly, contributing a +monthly amount to help sustain Nim's development. For more details take a +look at the Bountysource campaign.

+
+#for sponsor in sponsors: +
+ #if sponsor.url.len > 0: + ${sponsor.name} + #else: + ${sponsor.name} + #end if +
+ +
+ Donated $$${sponsor.thisMonth} this month +
+
+ Donated $$${sponsor.allTime} in total since ${sponsor.since} +
+#end for +
+# +#end proc diff --git a/web/assets/bountysource/bountysource.png b/web/assets/bountysource/bountysource.png new file mode 100644 index 000000000..d92d75df0 Binary files /dev/null and b/web/assets/bountysource/bountysource.png differ diff --git a/web/assets/bountysource/secondspectrum.png b/web/assets/bountysource/secondspectrum.png new file mode 100644 index 000000000..4dab35c6f Binary files /dev/null and b/web/assets/bountysource/secondspectrum.png differ diff --git a/web/assets/niminaction/banner.jpg b/web/assets/niminaction/banner.jpg new file mode 100644 index 000000000..b2fb3efc9 Binary files /dev/null and b/web/assets/niminaction/banner.jpg differ diff --git a/web/assets/style.css b/web/assets/style.css index 98bf12a9a..d7599477e 100644 --- a/web/assets/style.css +++ b/web/assets/style.css @@ -572,5 +572,36 @@ pre .end { background:url("images/tabEnd.png") no-repeat left bottom; } #bountysource a, #bountysource a:visited, #bountysource a:hover { color: #1a1a1a; +} + +/* Current sponsors page */ + +dt { + font-size: 20pt; + clear: both; + margin-bottom: 10pt; +} + +dd.logo { + width: 200px; + min-height: 50px; + margin-bottom: 10pt; + margin-right: 20pt; + float: left; +} + +dd.logo img { + max-height: 200px; +} + +dd.this_month { + font-size: 20pt; +} + +dt a, dt a:visited, dt a:hover { + color: #1d1d1d !important; +} +dt.level-1 { + color: #2f2f2f !important; } diff --git a/web/sponsors.csv b/web/sponsors.csv new file mode 100644 index 000000000..046469d82 --- /dev/null +++ b/web/sponsors.csv @@ -0,0 +1,22 @@ +logo,name,url,this_month,all_time,since,level +assets/bountysource/secondspectrum.png,Second Spectrum,http://www.secondspectrum.com/,250,250,"May 5, 2016",250 +,flyx,http://flyx.org,35,70,"Apr 7, 2016",25 +,Adrian Veith,https://github.com/AdrianV,25,50,"Apr 20, 2016",25 +,Federico Ceratto,http://firelet.net,25,50,"Apr 7, 2016",25 +,Lloyd Moore,https://github.com/iolloyd,25,50,"Apr 29, 2016",25 +,Ruslan Mustakov,https://github.com/endragor,25,50,"Apr 7, 2016",25 +,Yuriy Glukhov,https://github.com/yglukhov/,25,50,"Apr 6, 2016",25 +,TedSinger,https://github.com/TedSinger,15,30,"Apr 9, 2016",10 +,Pradeep Gowda,https://www.btbytes.com/,10,20,"Apr 6, 2016",10 +,Jonathan Arnett,http://j3rn.com,10,10,"May 20, 2016",10 +,niebaopeng,https://github.com/niebaopeng,10,10,"Apr 15, 2016",10 +,Handojo Goenadi,,5,10,"Apr 19, 2016",5 +,John Novak,http://www.johnnovak.net/,5,10,"Apr 29, 2016",5 +,Matthew Newton,,5,10,"Apr 20, 2016",5 +,McSpiros,https://github.com/SpirosMakris,5,10,"Apr 6, 2016",5 +,Mirek Rusin,http://quartzcomposer.com,5,10,"Apr 9, 2016",5 +,pyloor,https://github.com/pyloor,5,10,"May 16, 2016",5 +,Sokolov Yura,https://github.com/funny-falcon,5,10,"Apr 7, 2016",5 +,Ivan Florentin,https://github.com/ivanflorentin,5,5,"May 2, 2016",5 +,Michael D. Sklaroff,,1,2,"Apr 27, 2016",1 +,Svend Knudsen,,1,2,"Apr 11, 2016",1 -- cgit 1.4.1-2-gfad0