Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS-related fixes #796

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/manager/rss_generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $SIGNATURES
RSS should not contain relative links so this finds relative links and prepends
them with the canonical link.
"""
fix_relative_links(s::String, link::String) =
fix_relative_links(s::AbstractString, link::String) =
replace(s, r"(href|src)\s*?=\s*?\"\/" => SubstitutionString("\\1=\"$link"))

"""
Expand All @@ -66,7 +66,7 @@ function add_rss_item()
title = jor("rss_title", "title")
descr = jor("rss", "rss_description")

descr = fd2html(descr; internal=true) |> remove_html_ps
descr = fd2html(descr; internal=true) |> remove_html_ps |> chomp

content = ""
if globvar(:rss_full_content)::Bool
Expand Down Expand Up @@ -134,7 +134,7 @@ function rss_generator()::Nothing
end

endswith(rss_link, "/") || (rss_link *= "/")
rss_descr = fd2html(rss_descr; internal=true) |> remove_html_ps
rss_descr = fd2html(rss_descr; internal=true) |> remove_html_ps |> chomp

# sort items by pubDate
RSS_DICT_SORTED = sort(OrderedDict(RSS_DICT), rev = true, byvalue = true, by = x -> x[1].pubDate)
Expand Down Expand Up @@ -191,9 +191,10 @@ function write_rss_xml(rss_path, rss_title, rss_descr, rss_link, rss_items, rss_
<item>
<title><![CDATA[$(v.title)]]></title>
<link>$(full_link)</link>
<description><![CDATA[$(fix_relative_links(v.description, rss_link))<br><a href=\"$(full_link)\">Read more</a>]]></description>
<description><![CDATA[$(fix_relative_links(v.description, rss_link))
$(ifelse(isempty(v.content),
"", "<content:encoded><![CDATA[$(fix_relative_links(v.content, rss_link))]]></content:encoded>"))
"<br><a href=\"$(full_link)\">Read more</a>]]></description>",
"]]></description><content:encoded><![CDATA[$(fix_relative_links(v.content, rss_link))]]></content:encoded>"))
""")
for elem in (:author, :category, :comments, :enclosure)
e = getproperty(v, elem)
Expand Down