* [gentoo-commits] sites/www:master commit in: _plugins/
@ 2015-04-25 11:23 Alex Legler
0 siblings, 0 replies; 7+ messages in thread
From: Alex Legler @ 2015-04-25 11:23 UTC (permalink / raw
To: gentoo-commits
commit: 54e3431ef9467bdfd501c3878291905c055385b9
Author: Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Sat Apr 25 11:19:17 2015 +0000
Commit: Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Sat Apr 25 11:22:51 2015 +0000
URL: https://gitweb.gentoo.org/sites/www.git/commit/?id=54e3431e
Skip news items in the planet box
_plugins/planet.rb | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/_plugins/planet.rb b/_plugins/planet.rb
index 4c9df0d..265e703 100644
--- a/_plugins/planet.rb
+++ b/_plugins/planet.rb
@@ -11,6 +11,7 @@ module Gentoo
planetinfo.xpath('/rss/channel/item').each do |item|
item_data = {}
+ ignore = false
item.children.each do |tag|
case tag.name
@@ -22,11 +23,14 @@ module Gentoo
if tag.text =~ /^(.*) \(([^)]+)\)$/
item_data['author'] = $1
item_data['nick'] = $2
+ else
+ # It's a news item; skip
+ ignore = true
end
end
end
- site.data['planet']['posts'] << item_data
+ site.data['planet']['posts'] << item_data unless ignore
end
end
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] sites/www:master commit in: _plugins/
@ 2015-10-05 11:18 Alex Legler
0 siblings, 0 replies; 7+ messages in thread
From: Alex Legler @ 2015-10-05 11:18 UTC (permalink / raw
To: gentoo-commits
commit: a09c58fbe14a8d7e61d4a8df4f4119663b521db5
Author: Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Mon Oct 5 11:18:24 2015 +0000
Commit: Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Mon Oct 5 11:18:24 2015 +0000
URL: https://gitweb.gentoo.org/sites/www.git/commit/?id=a09c58fb
Adapt to pgo again
_plugins/packages.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/_plugins/packages.rb b/_plugins/packages.rb
index 7b406ce..2d96cf1 100644
--- a/_plugins/packages.rb
+++ b/_plugins/packages.rb
@@ -15,7 +15,7 @@ module Gentoo
item.children.each do |tag|
case tag.name
when 'title'
- if tag.text =~ /^Added: (.*) \((.*)\)$/
+ if tag.text =~ /^(.*) \((.*)\)$/
item_data['atom'] = $1.strip
item_data['atom_c'], item_data['atom_p'] = item_data['atom'].split('/', 2)
item_data['description'] = $2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] sites/www:master commit in: _plugins/
@ 2015-10-12 9:28 Alex Legler
0 siblings, 0 replies; 7+ messages in thread
From: Alex Legler @ 2015-10-12 9:28 UTC (permalink / raw
To: gentoo-commits
commit: 99d78a277fd6111ecddca724388f56c77271e809
Author: Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Mon Oct 12 09:28:31 2015 +0000
Commit: Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Mon Oct 12 09:28:31 2015 +0000
URL: https://gitweb.gentoo.org/sites/www.git/commit/?id=99d78a27
Support non-bz2 stages
_plugins/downloads.rb | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/_plugins/downloads.rb b/_plugins/downloads.rb
index 69720e3..42c7fb2 100644
--- a/_plugins/downloads.rb
+++ b/_plugins/downloads.rb
@@ -12,33 +12,31 @@ module Gentoo
site.data['downloads'][arch] = {}
File.readlines(raw_arch + '/iso.txt').each do |line|
- #puts line
next if line.start_with? '#'
if line =~ /^(\d{8})\/(\S+) (\d+)$/
- date = Date.parse("%s-%s-%s" % [$1[0..3], $1[4..5], $1[6..7]])
+ date = Date.parse('%s-%s-%s' % [$1[0..3], $1[4..5], $1[6..7]])
site.data['downloads'][arch]['iso'] ||= {}
site.data['downloads'][arch]['iso']['minimal'] = { 'date' => date, 'filename' => "%s/%s" % [$1, $2], 'size' => $3 }
end
end
File.readlines(raw_arch + '/stage3.txt').each do |line|
- # puts line
next if line.start_with? '#'
- if line =~ /^(\d{8})\/(\w+\/)?stage3-(.*)-\d{8}.tar.bz2 (\d+)$/
- date = Date.parse("%s-%s-%s" % [$1[0..3], $1[4..5], $1[6..7]])
+ if line =~ /^(\d{8})\/(\w+\/)?stage3-(.*)-\d{8}.tar.(\S+) (\d+)$/
+ date = Date.parse('%s-%s-%s' % [$1[0..3], $1[4..5], $1[6..7]])
site.data['downloads'][arch]['stage3'] ||= {}
site.data['downloads'][arch]['stage3'][$3] = {
'name' => $3,
'date' => date,
- 'filename' => "%s/%sstage3-%s-%s.tar.bz2" % [$1, $2, $3, $1],
+ 'filename' => '%s/%sstage3-%s-%s.tar.%s' % [$1, $2, $3, $1, $4],
'subdir' => $2,
- 'size' => $4
+ 'size' => $5
}
end
end
end
end
end
-end
\ No newline at end of file
+end
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] sites/www:master commit in: _plugins/
@ 2015-11-30 19:48 Alex Legler
0 siblings, 0 replies; 7+ messages in thread
From: Alex Legler @ 2015-11-30 19:48 UTC (permalink / raw
To: gentoo-commits
commit: a100faf515c3cfe8c2d1d8fe4bc6c0fb48f7429d
Author: Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Mon Nov 30 19:48:22 2015 +0000
Commit: Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Mon Nov 30 19:48:22 2015 +0000
URL: https://gitweb.gentoo.org/sites/www.git/commit/?id=a100faf5
Ruby code cleanup
_plugins/devaway.rb | 4 ++--
_plugins/filters.rb | 6 +++---
_plugins/herds.rb | 6 +++---
_plugins/mirrors.rb | 4 +---
_plugins/navigation.rb | 31 +++++++++++++++++--------------
_plugins/news.rb | 38 +++++++++++++++-----------------------
_plugins/planet.rb | 3 +--
_plugins/tags.rb | 9 +++++----
_plugins/wiki.rb | 2 +-
9 files changed, 48 insertions(+), 55 deletions(-)
diff --git a/_plugins/devaway.rb b/_plugins/devaway.rb
index 5d411a0..9ba5018 100644
--- a/_plugins/devaway.rb
+++ b/_plugins/devaway.rb
@@ -5,11 +5,11 @@ module Gentoo
def generate(site)
data = Nokogiri::XML(File.open(DEVAWAY_XML))
- site.data['devaway'] ||= { }
+ site.data['devaway'] ||= {}
data.xpath('/devaway/dev').each do |dev|
site.data['devaway'][dev['nick']] = dev.xpath('./reason/text()').first.content
end
end
end
-end
\ No newline at end of file
+end
diff --git a/_plugins/filters.rb b/_plugins/filters.rb
index 34ad123..df5b4f7 100644
--- a/_plugins/filters.rb
+++ b/_plugins/filters.rb
@@ -1,6 +1,6 @@
module Gentoo
module Filters
- UNITS = %W(B KiB MiB GiB TiB).freeze
+ UNITS = %w(B KiB MiB GiB TiB).freeze
def nice_filesize(input)
number = input.to_i
@@ -12,7 +12,7 @@ module Gentoo
exponent = (Math.log(number) / Math.log(1024)).to_i
exponent = max_exp if exponent > max_exp
- number /= 1024 ** exponent
+ number /= 1024**exponent
end
"#{number} #{UNITS[exponent]}"
@@ -25,4 +25,4 @@ module Gentoo
end
end
-Liquid::Template.register_filter(Gentoo::Filters)
\ No newline at end of file
+Liquid::Template.register_filter(Gentoo::Filters)
diff --git a/_plugins/herds.rb b/_plugins/herds.rb
index 2f357c7..971f1e2 100644
--- a/_plugins/herds.rb
+++ b/_plugins/herds.rb
@@ -4,7 +4,7 @@ module Gentoo
def generate(site)
xml = Nokogiri::XML(File.open(XML))
-
+
site.data['herds'] ||= {}
xml.xpath('/herds/herd').each do |item|
@@ -21,7 +21,7 @@ module Gentoo
maint_data = {
'email' => maint.xpath('./email/text()').first.text,
'name' => nil,
- 'role' => nil,
+ 'role' => nil
}
ns_name = maint.xpath('./name/text()')
@@ -40,4 +40,4 @@ module Gentoo
end
end
end
-end
\ No newline at end of file
+end
diff --git a/_plugins/mirrors.rb b/_plugins/mirrors.rb
index 1d30238..c1bf17b 100644
--- a/_plugins/mirrors.rb
+++ b/_plugins/mirrors.rb
@@ -26,7 +26,6 @@ module Gentoo
next unless mirror.name == 'mirror'
mirror.children.each do |tag|
-
case tag.name
when 'name'
mirror_data['name'] = tag.text
@@ -46,7 +45,6 @@ module Gentoo
site.data['mirrors'][key][region][country_code]['mirrors'] << mirror_data
end
end
-
end
end
-end
\ No newline at end of file
+end
diff --git a/_plugins/navigation.rb b/_plugins/navigation.rb
index 0df1404..66bf9a3 100644
--- a/_plugins/navigation.rb
+++ b/_plugins/navigation.rb
@@ -24,38 +24,43 @@ module Gentoo
end
private
+
def primary(all_pages, current_page)
- pages = all_pages.select {|page| page.data['nav1-show'] == true }
+ pages = all_pages.select { |page| page.data['nav1-show'] == true }
generate(pages, current_page, '1')
end
def secondary(all_pages, current_page)
- pages = all_pages.select {|page| page.data['nav1'] == current_page['nav1'] and page.data['nav2-show'] == true }
+ pages = all_pages.select { |page| page.data['nav1'] == current_page['nav1'] && page.data['nav2-show'] == true }
generate(pages, current_page, '2')
end
def tertiary(all_pages, current_page)
- pages = all_pages.select {|page| page.data['nav1'] == current_page['nav1'] and page.data['nav2'] == current_page['nav2'] and page.data['nav3-show'] == true }
+ pages = all_pages.select do |page|
+ page.data['nav1'] == current_page['nav1'] &&
+ page.data['nav2'] == current_page['nav2'] &&
+ page.data['nav3-show'] == true
+ end
generate(pages, current_page, '3')
end
def sitemap(all_pages, nav1)
- pages = all_pages.select {|page| page.data['nav1'] == nav1 and page.data['nav2-show'] == true }
+ pages = all_pages.select { |page| page.data['nav1'] == nav1 && page.data['nav2-show'] == true }
generate(pages, {}, '2')
end
def generate(all_pages, current_page, level)
- level_show = "nav%s-show" % level
- level_weight = "nav%s-weight" % level
- level_str = "nav%s" % level
+ level_show = 'nav%s-show' % level
+ level_weight = 'nav%s-weight' % level
+ level_str = 'nav%s' % level
- pages = all_pages.select {|page| page.data[level_show] == true }
+ pages = all_pages.select { |page| page.data[level_show] == true }
pages.sort! do |a, b|
- if a.data.has_key? level_weight and b.data.has_key? level_weight
+ if a.data.key?(level_weight) && b.data.key?(level_weight)
a.data[level_weight] <=> b.data[level_weight]
else
a_title = a.data['navtitle'] || a.data['title']
@@ -71,13 +76,13 @@ module Gentoo
html += "<li class=\"%s\">" % css_class
- if page.data.has_key? 'redirect'
+ if page.data.key? 'redirect'
html += '<a href="' + page.data['redirect'] + '">'
else
html += '<a href="' + page.url.gsub('index.html', '') + '">'
end
- if page.data.has_key? 'navtitle'
+ if page.data.key? 'navtitle'
html += page.data['navtitle']
else
html += page.data['title']
@@ -88,10 +93,8 @@ module Gentoo
html
end
-
-
end
end
end
-Liquid::Template.register_tag('navigation', Gentoo::Tags::NavigationTag)
\ No newline at end of file
+Liquid::Template.register_tag('navigation', Gentoo::Tags::NavigationTag)
diff --git a/_plugins/news.rb b/_plugins/news.rb
index a93aa06..a90c435 100644
--- a/_plugins/news.rb
+++ b/_plugins/news.rb
@@ -1,12 +1,12 @@
module Gentoo
class NewsGenerator < Jekyll::Generator
- NEWS_DIR = '_data/news/'
+ NEWS_DIR = '_data/news/'
def generate(site)
site.data['newsitems'] ||= []
Dir.chdir(NEWS_DIR) do
- Dir.glob("[0-9][0-9][0-9][0-9]*").reverse.each do |path|
+ Dir.glob('[0-9][0-9][0-9][0-9]*').reverse_each do |path|
begin
name = path
@@ -17,7 +17,7 @@ module Gentoo
end
end
- site.data['newsitems'] = site.data['newsitems'].sort {|a,b| b['date'] <=> a['date'] }
+ site.data['newsitems'] = site.data['newsitems'].sort { |a, b| b['date'] <=> a['date'] }
end
end
@@ -28,31 +28,23 @@ module Gentoo
@dir = NewsGenerator::NEWS_DIR
@name = "#{name}.html"
- self.process(@name)
- self.read_yaml(File.join(@base, NewsGenerator::NEWS_DIR, path), "#{name}.en.txt")
+ process(@name)
+ read_yaml(File.join(@base, NewsGenerator::NEWS_DIR, path), "#{name}.en.txt")
- self.data['permalink'] = "/support/news-items/#{name}.html"
- self.data['layout'] = 'page-pre'
- self.data['nav1'] = 'support'
- self.data['nav2'] = 'news-items'
+ data['permalink'] = "/support/news-items/#{name}.html"
+ data['layout'] = 'page-pre'
+ data['nav1'] = 'support'
+ data['nav2'] = 'news-items'
File.readlines(File.join(@base, NewsGenerator::NEWS_DIR, path, "#{name}.en.txt")).each do |line|
- if line =~ /Title: (.*)$/
- @title = $1
- end
-
- if line =~ /Author: (.*)$/
- @author = $1
- end
-
- if line =~ /Posted: (.*)$/
- @date = $1
- end
+ @title = $1 if line =~ /Title: (.*)$/
+ @author = $1 if line =~ /Author: (.*)$/
+ @date = $1 if line =~ /Posted: (.*)$/
end
- site.data['newsitems'] << { 'title' => @title, 'author' => @author, 'date' => @date, 'url' => self.data['permalink'] }
+ site.data['newsitems'] << { 'title' => @title, 'author' => @author, 'date' => @date, 'url' => data['permalink'] }
- self.data['title'] = @title
+ data['title'] = @title
end
end
-end
\ No newline at end of file
+end
diff --git a/_plugins/planet.rb b/_plugins/planet.rb
index 265e703..cca9122 100644
--- a/_plugins/planet.rb
+++ b/_plugins/planet.rb
@@ -32,7 +32,6 @@ module Gentoo
site.data['planet']['posts'] << item_data unless ignore
end
-
end
end
-end
\ No newline at end of file
+end
diff --git a/_plugins/tags.rb b/_plugins/tags.rb
index 5175cde..7ad24bb 100644
--- a/_plugins/tags.rb
+++ b/_plugins/tags.rb
@@ -1,4 +1,5 @@
require_relative 'lib/weightedrandomizer'
+
module Gentoo
module Tags
class AdsTag < Liquid::Tag
@@ -8,18 +9,19 @@ module Gentoo
def render(context)
ads = context.registers[:site].data['ads']['active']
- ad_html = ""
+ ad_html = ''
first_ad = true
raw_weighted_ads = Hash[ads.map { |ad| [ad, ad['weight'] || 0] }]
ads_wr = WeightedRandomizer.new(raw_weighted_ads)
- ads_wr.sample(AD_COUNT*10).uniq.slice(0, AD_COUNT).each do |ad|
+ ads_wr.sample(AD_COUNT * 10).uniq.slice(0, AD_COUNT).each do |ad|
if first_ad
ad_html += '<div class="col-xs-12 col-md-2 col-md-offset-2 sponsorlogo">'
first_ad = false
else
ad_html += '<div class="col-xs-12 col-md-2 sponsorlogo">'
end
- ad_html += '<!-- sponsor{name:%s,weight:%d} -->' % [ad['name'], ad['weight']]
+
+ ad_html += '<!-- sponsor{name:%s,weight:%d} -->' % [ad['name'], ad['weight']]
if ad.has_key? 'img'
ad_html += "<a href=\"%s\" title=\"%s\"><img src=\"/assets/img/sponsors/ads/%s\" alt=\"%s\"></a>" %
@@ -34,7 +36,6 @@ module Gentoo
ad_html
end
end
-
end
end
diff --git a/_plugins/wiki.rb b/_plugins/wiki.rb
index ee2c27c..5d25716 100644
--- a/_plugins/wiki.rb
+++ b/_plugins/wiki.rb
@@ -27,4 +27,4 @@ module Gentoo
end
end
end
-end
\ No newline at end of file
+end
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] sites/www:master commit in: _plugins/
@ 2016-01-31 0:55 Alex Legler
0 siblings, 0 replies; 7+ messages in thread
From: Alex Legler @ 2016-01-31 0:55 UTC (permalink / raw
To: gentoo-commits
commit: 1fa6d0d864034078bbb1cb8233e88ac79413d0e8
Author: Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Sun Jan 31 00:54:58 2016 +0000
Commit: Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Sun Jan 31 00:54:58 2016 +0000
URL: https://gitweb.gentoo.org/sites/www.git/commit/?id=1fa6d0d8
Clear debug code
_plugins/downloads.rb | 3 ---
1 file changed, 3 deletions(-)
diff --git a/_plugins/downloads.rb b/_plugins/downloads.rb
index 22d58e2..da4596e 100644
--- a/_plugins/downloads.rb
+++ b/_plugins/downloads.rb
@@ -44,9 +44,6 @@ module Gentoo
end
end
end
-
- require 'pp'
- pp site.data['downloads']
end
end
end
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] sites/www:master commit in: _plugins/
@ 2016-03-26 11:50 Alex Legler
0 siblings, 0 replies; 7+ messages in thread
From: Alex Legler @ 2016-03-26 11:50 UTC (permalink / raw
To: gentoo-commits
commit: 949faff19ad88a8ef952e7e2f51900d490135cce
Author: Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Sat Mar 26 11:49:00 2016 +0000
Commit: Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 11:50:19 2016 +0000
URL: https://gitweb.gentoo.org/sites/www.git/commit/?id=949faff1
Fix parsing of new packages containing '(' (#578104)
_plugins/packages.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/_plugins/packages.rb b/_plugins/packages.rb
index 2d96cf1..9278b88 100644
--- a/_plugins/packages.rb
+++ b/_plugins/packages.rb
@@ -15,7 +15,7 @@ module Gentoo
item.children.each do |tag|
case tag.name
when 'title'
- if tag.text =~ /^(.*) \((.*)\)$/
+ if tag.text =~ /^([^(]*) \((.*)\)$/
item_data['atom'] = $1.strip
item_data['atom_c'], item_data['atom_p'] = item_data['atom'].split('/', 2)
item_data['description'] = $2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] sites/www:master commit in: _plugins/
@ 2016-05-27 12:07 Alex Legler
0 siblings, 0 replies; 7+ messages in thread
From: Alex Legler @ 2016-05-27 12:07 UTC (permalink / raw
To: gentoo-commits
commit: 39d6a6d35154e36319cf0e15e18e0ce3dcef185b
Author: Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Fri May 27 12:00:16 2016 +0000
Commit: Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Fri May 27 12:00:16 2016 +0000
URL: https://gitweb.gentoo.org/sites/www.git/commit/?id=39d6a6d3
Remove debug code
_plugins/packages.rb | 2 --
1 file changed, 2 deletions(-)
diff --git a/_plugins/packages.rb b/_plugins/packages.rb
index 9278b88..98cb373 100644
--- a/_plugins/packages.rb
+++ b/_plugins/packages.rb
@@ -27,8 +27,6 @@ module Gentoo
site.data['packages']['updates'] << item_data
end
-
- puts site.data['packages']['updates']
end
end
end
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-05-27 12:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-25 11:23 [gentoo-commits] sites/www:master commit in: _plugins/ Alex Legler
-- strict thread matches above, loose matches on Subject: below --
2015-10-05 11:18 Alex Legler
2015-10-12 9:28 Alex Legler
2015-11-30 19:48 Alex Legler
2016-01-31 0:55 Alex Legler
2016-03-26 11:50 Alex Legler
2016-05-27 12:07 Alex Legler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox