Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 479
- Log:
Esacpe "[" and "]" in news feed parsed output, as it was being treated
like Textile data by the CMS and therefore rendered incorrectly.
- Author:
- rool
- Date:
- Mon Sep 09 20:55:23 +0100 2019
- Size:
- 3001 Bytes
1 | # News tag |
2 | # ======== |
3 | # |
4 | # Defines a tag to produce a "latest news" summary based on an XML feed. |
5 | # |
6 | # |
7 | # History |
8 | # ------- |
9 | # |
10 | # 2006-08-06 (ADH): Created. |
11 | # 2006-08-07 (ADH): It seems the core RSS features are easily sufficient |
12 | # so fun though Simple-RSS was, it makes sense to use |
13 | # something that doesn't add extra dependencies. Moved |
14 | # over to the Ruby RSS parser. Since tags get expanded |
15 | # before filters run, but there is no way to escape |
16 | # text filtered by (say) Textile, instead get rid of |
17 | # characters known to be a problem. |
18 | # 2006-08-08 (ADH): Now knows about the prevalent part filter during tag |
19 | # processing and takes steps to escape the generated |
20 | # content. Markdown doesn't seem to need it but Textile |
21 | # is escaped; it turns out there is a '<notextile>' tag |
22 | # which does the job. Generating HTML from a tag is |
23 | # still conceptually wrong because of filter operations |
24 | # but for now I still want to keep this behavior very |
25 | # simple for its users. There is an RSS behavior which |
26 | # can be used if a more flexible scheme is required at |
27 | # the expense of more effort and less clean handling of |
28 | # empty RSS item fields. |
29 | # 2006-11-09 (ADH): Added 'escaped' attribute to deal with feeds which |
30 | # have already had "%xx" hex escape sequences applied |
31 | # in URIs, as well as feeds that have not. |
32 | # 2011-03-06 (ADH): Imported into Radiant 0.9.1 as an Extension. |
33 | # 2011-03-16 (ADH): Added Atom feed compatibility. |
34 | # 2013-08-30 (ADH): Added SSL certificate chain fetch support. |
35 | # 2019-09-10 (ADH): Escape "[" and "]" in titles, as this seemed to cause |
36 | # layout problems; implication was that CMS parsed the |
37 | # output data as if Textile markup. |
38 | |
39 | # Uncomment this if you reference any of your controllers in activate |
40 | # require_dependency 'application_controller' |
41 | |
42 | require 'rss' |
43 | |
44 | class NewsTagExtension < Radiant::Extension |
45 | version "2.0" |
46 | description %{ |
47 | This extension provides a 'news' tag which generates a parsed HTML summary |
48 | of an RSS feed. |
49 | } |
50 | url "http://pond.org.uk/" |
51 | |
52 | def activate |
53 | ApplicationController.class_eval do |
54 | around_filter :break_mvc_for_news_tag_request_ssl_use_in_view_via_radiant_model |
55 | |
56 | def break_mvc_for_news_tag_request_ssl_use_in_view_via_radiant_model |
57 | methods = ["request"] |
58 | |
59 | methods.each do |method| |
60 | value = send(method) |
61 | unless (Page.new.respond_to?(method)) |
62 | Page.send(:define_method, method, proc { value }) |
63 | end |
64 | end |
65 | |
66 | yield |
67 | |
68 | methods.each do |method| |
69 | if (Page.new.respond_to?(method)) |
70 | Page.send( :remove_method, method ) |
71 | end |
72 | end |
73 | end |
74 | end |
75 | |
76 | Page.send :include, NewsTag |
77 | end |
78 | end |