polyrex-feed-reader 0.5.7 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9523402db0e6f7d0ff90259f7f751a7cf78fb081
4
- data.tar.gz: fd5925817d1230a0ab6de9838edb593973706243
3
+ metadata.gz: 70cd5af224b421e30e10b21592dff7318997e9c3
4
+ data.tar.gz: d17440d0114605492ef80cb7f677ff25446896e2
5
5
  SHA512:
6
- metadata.gz: 7770b7d3c6316199a1cae2c7510752ea9b80c61a92d573139fb1bb983d5df50cfb2d3c6aa0be2b295771816e57115f087124d39a3a789aa62baed014aa43caa6
7
- data.tar.gz: 9f80edd950899deec608ff3ca0ae3f9625a47a2c7c9083cb001045dc39d2f1466172317e451cec0028fdf27612471600d98c0039383f274144489772c33ae54c
6
+ metadata.gz: 952f2418decaea137e0946e8edd5262abebefc59319e23ce8e0eff737c99136e24c0008e9139b09f89926a39eb541524b33597c9c93fde2628c7f4f4d43458d6
7
+ data.tar.gz: efa60ecba20d82ed677b6479d7828841f4a4c898d7b951594f8b124145f05d317870a82a1dbf2c5b9b953e7dfb6d4899fa965f9df75a20a72affe3bae4bd1ced
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/dynarex-feed.xsl CHANGED
@@ -39,7 +39,7 @@
39
39
  </xsl:template>
40
40
  <xsl:template match="summary">
41
41
  <div id="summary">
42
- <a href="{link}"><h1><xsl:value-of select="title" disable-output-escaping="true"/></h1></a>
42
+ <a href="{link}"><h1><xsl:value-of select="title" disable-output-escaping="yes"/></h1></a>
43
43
  </div>
44
44
  </xsl:template>
45
45
 
@@ -56,9 +56,10 @@
56
56
  <xsl:for-each select="item">
57
57
 
58
58
  <li><div><a name="{@id}"/>
59
- <a href="{link}"><h1><xsl:value-of select="title"/></h1></a>
59
+ <a href="{link}" target="_blank"><h1><xsl:value-of select="title" disable-output-escaping="yes"/></h1></a>
60
60
  <p><xsl:value-of select="description" disable-output-escaping="yes"/></p>
61
61
  <p>last updated: <xsl:value-of select="date"/></p>
62
+ <h2>Share</h2><textarea cols="50" rows="5">[<xsl:value-of select="title" disable-output-escaping="yes"/>](<xsl:value-of select="link" disable-output-escaping="yes"/>) via <xsl:value-of select="../../summary/title"/></textarea>
62
63
  </div>
63
64
  </li>
64
65
 
@@ -69,4 +70,4 @@
69
70
  </div>
70
71
  </xsl:template>
71
72
 
72
- </xsl:stylesheet>
73
+ </xsl:stylesheet>
data/lib/feeds.css CHANGED
@@ -106,10 +106,13 @@ nav {
106
106
  text-decoration: none;
107
107
  }
108
108
 
109
-
110
- #wrap .a_hot {background-color: #fee;}
111
- #wrap .b_warm {background-color: #edd;}
112
- #wrap .c_cold {background-color: #dbc;}
113
- #wrap .d_coldx1week {background-color: #cab;}
114
- #wrap .e_coldx1month {background-color: #aae;}
115
- #wrap .f_coldx6months {background-color: #88c;}
109
+ nav>ul>li>a {text-decoration: none;}
110
+ #wrap div.a_hot, div>ul>li.a_hot {background-color: #fee;}
111
+ nav>ul>li.a_hot>a:link {background-color: transparent; border-bottom: 3px solid #fee;}
112
+ #wrap div.b_warm, div>ul>li.b_warm {background-color: #edd;}
113
+ nav>ul>li.b_warm>a:link {background-color: transparent; border-bottom: 1px solid #edd;}
114
+ #wrap div.c_cold, div>ul>li.c_cold {background-color: #dbc;}
115
+ /* nav>ul>li.c_cold>a:link {background-color: transparent; border-bottom: 1px solid #dbc;} */
116
+ #wrap div.d_coldx1week, div>ul>li.d_coldx1week {background-color: #cab;}
117
+ #wrap div.e_coldx1month, div>ul>li.e_coldx1month {background-color: #aae;}
118
+ #wrap div.f_coldx6months, div>ul>li.f_coldx6months {background-color: #88c;}
data/lib/feeds.xsl CHANGED
@@ -37,7 +37,7 @@
37
37
  <ul>
38
38
  <xsl:for-each select="records/column/records/section/records/feed">
39
39
  <xsl:sort select="summary/title"/>
40
- <li><a href="#{summary/title}"><xsl:value-of select="summary/title"/></a></li>
40
+ <li class="{summary/recent}"><a href="#{summary/title}"><xsl:value-of select="summary/title"/></a></li>
41
41
  </xsl:for-each>
42
42
  </ul>
43
43
  </nav>
@@ -89,7 +89,7 @@
89
89
  </xsl:template>
90
90
 
91
91
  <xsl:template match='feed/summary'>
92
- <a href="{substring-before(xhtml,'.')}.html"><h3><xsl:value-of select='title'/></h3></a>
92
+ <a href="{substring-before(xhtml,'.')}.html" target="_blank"><h3><xsl:value-of select='title'/></h3></a>
93
93
  <span><xsl:value-of select='last_modified'/></span>
94
94
  </xsl:template>
95
95
 
@@ -101,7 +101,7 @@
101
101
  </xsl:template>
102
102
 
103
103
  <xsl:template match='item/summary'>
104
- <a href="{link}" target="_blank"><h4><xsl:value-of disable-output-escaping="yes" select='title'/></h4></a>
104
+ <a href="{local_link}" target="_blank"><h4><xsl:value-of disable-output-escaping="yes" select='title'/></h4></a>
105
105
  <p><xsl:value-of disable-output-escaping="yes" select='description'/></p>
106
106
  </xsl:template>
107
107
 
@@ -5,6 +5,7 @@
5
5
  require 'nokogiri'
6
6
  require 'rss_to_dynarex'
7
7
  require 'polyrex'
8
+ require 'time'
8
9
 
9
10
 
10
11
  MINUTE = 60
@@ -26,6 +27,7 @@ class PolyrexFeedReader
26
27
 
27
28
  feeds do |feed, filename|
28
29
 
30
+ next if nothing_new? feed
29
31
  puts "transforming %s " % filename
30
32
  xsltproc 'dynarex-feed.xsl', File.read(filename), filename.sub(/xml$/,'html')
31
33
  end
@@ -43,6 +45,7 @@ EOF
43
45
 
44
46
  feeds do |feed, filename|
45
47
 
48
+ next if nothing_new? feed
46
49
  puts "fetching %s " % feed.rss_url.inspect
47
50
 
48
51
  rtd = RSStoDynarex.new feed.rss_url
@@ -65,8 +68,6 @@ EOF
65
68
 
66
69
  feeds do |feed, filename|
67
70
 
68
- puts 'adding : ' + filename.inspect
69
-
70
71
  d = Dynarex.new filename
71
72
 
72
73
  feed.last_accessed = datetimestamp()
@@ -81,13 +82,19 @@ EOF
81
82
  next
82
83
  end
83
84
 
85
+ puts 'adding : ' + filename.inspect
86
+
84
87
  feed.recent = 'a_hot'
85
88
  feed.records.remove_all
86
89
  items.each.with_index do |x, i|
87
90
 
88
- h = {title: x[:title], link: "%s#%s" % [filename.sub(/xml$/,'html'),i]}
91
+ h = {
92
+ title: x[:title],
93
+ link: x[:link],
94
+ local_link: "%s#%s" % [filename.sub(/xml$/,'html'),i]
95
+ }
89
96
 
90
- if i == 0 then
97
+ if i == 0 and feed.important != 'n' then
91
98
 
92
99
  raw_desc = CGI.unescapeHTML(x[:description]).gsub(/<\/?[^>]*>/, "")
93
100
  desc = raw_desc.length > 300 ? raw_desc[0..296] + ' ...' : raw_desc
@@ -152,6 +159,12 @@ EOF
152
159
  end
153
160
 
154
161
  end
162
+
163
+ def nothing_new?(feed)
164
+
165
+ feed.occurrence == 'daily' and \
166
+ Time.parse(feed.last_accessed) + DAY > Time.now
167
+ end
155
168
 
156
169
  def ordinal(i)
157
170
  i.to_s + ( (10...20).include?(i) ? 'th' :
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrex-feed-reader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -29,7 +29,7 @@ cert_chain:
29
29
  LxhpHfLSRfOWDFimU0YGVs8dISSHOneULhblAYTTb7tvv2Zr8wG/bdlLhWuwoz23
30
30
  L5EDjzznPMmVNG60mdktue6PKdOEFp7N
31
31
  -----END CERTIFICATE-----
32
- date: 2013-12-13 00:00:00.000000000 Z
32
+ date: 2013-12-16 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: polyrex
metadata.gz.sig CHANGED
Binary file