Improve catpage_for.rb

Allow to filter pages with many pages variables
Allow to filter pages using dynamic variables as values
This commit is contained in:
Saivann 2013-06-21 21:49:20 -04:00
parent 96f7a4c727
commit 33dc7127bf
5 changed files with 28 additions and 20 deletions

View file

@ -7,25 +7,25 @@ title: Network status and alerts - Bitcoin
<link rel="alternate" type="application/rss+xml" href="/en/rss/alerts.rss" title="Bitcoin network status and alerts">
<div class="versiontext">
<h1>Network status and alerts<a type="application/rss+xml" href="/en/rss/alerts.rss"><img src="/img/icon_rss.svg" alt="rss" class="rssicon"></a></h1>
{% assign active = false %}{% catpage_for p in site.pages reversed sort_by:date category:alert %}{% if p.active == true %}{% assign active = true %}{% endif %}{% endcatpage_for %}
{% assign active = false %}{% filter_for p in site.pages reversed sort_by:date category:alert %}{% if p.active == true %}{% assign active = true %}{% endif %}{% endfilter_for %}
{% if active == false %}
<div class="alertstatusinactive">There is no ongoing event on the Bitcoin network.</div>
{% else %}
<div class="alertstatusactive"">The following network event is ongoing.</div>
<ul class="alertsactive">
{% catpage_for p in site.pages reversed sort_by:date category:alert %}{% if p.active == true %}
{% filter_for p in site.pages reversed sort_by:date category:alert %}{% if p.active == true %}
<li>
{{ p.date | date:"%Y-%m-%d" }} - <a href="{{ p.url | replace:'.html','' }}">{{ p.title }}</a>
</li>
{% endif %}{% endcatpage_for %}
{% endif %}{% endfilter_for %}
</ul>
{% endif %}
<ul class="alertsinactive">
{% catpage_for p in site.pages reversed sort_by:date category:alert %}{% if p.active == false %}
{% filter_for p in site.pages reversed sort_by:date category:alert %}{% if p.active == false %}
<li>
{{ p.date | date:"%Y-%m-%d" }} - <a href="{{ p.url | replace:'.html','' }}">{{ p.title }}</a>
</li>
{% endif %}{% endcatpage_for %}
{% endif %}{% endfilter_for %}
</ul>
<p>See the complete <a href="https://en.bitcoin.it/wiki/Common_Vulnerabilities_and_Exposures">CVE list</a>.</p>
</div>

View file

@ -10,12 +10,12 @@
<url>http://bitcoin.org/img/logo_rss.png</url>
<link>http://bitcoin.org/en/alerts</link>
</image>
{% catpage_for p in site.pages reversed sort_by:date category:alert %}
{% filter_for p in site.pages reversed sort_by:date category:alert %}
<item>
<title>{{ p.title }}</title>
<link>http://bitcoin.org{{ p.url | replace:'.html','' }}</link>
<pubDate>{{ p.date | date: "%a, %d %b %Y" }}</pubDate>
</item>
{% endcatpage_for %}
{% endfilter_for %}
</channel>
</rss>

View file

@ -10,12 +10,12 @@
<url>http://bitcoin.org/img/logo_rss.png</url>
<link>http://bitcoin.org/en/version-history</link>
</image>
{% catpage_for p in site.pages reversed sort_by:date category:release %}
{% filter_for p in site.pages reversed sort_by:date category:release %}
<item>
<title>{{ p.title }}</title>
<link>http://bitcoin.org{{ p.url | replace:'.html','' }}</link>
<pubDate>{{ p.date | date: "%a, %d %b %Y" }}</pubDate>
</item>
{% endcatpage_for %}
{% endfilter_for %}
</channel>
</rss>

View file

@ -8,10 +8,10 @@ title: Bitcoin-Qt version history
<div class="versiontext">
<h1>Bitcoin-Qt version history<a type="application/rss+xml" href="/en/rss/releases.rss"><img src="/img/icon_rss.svg" alt="rss" class="rssicon"></a></h1>
<ul>
{% catpage_for p in site.pages reversed sort_by:date category:release %}
{% filter_for p in site.pages reversed sort_by:date category:release %}
<li>
{{ p.date | date:"%Y-%m-%d" }} - <a href="{{ p.url | replace:'.html','' }}">{{ p.title }}</a>
</li>
{% endcatpage_for %}
{% endfilter_for %}
</ul>
</div>