From b4cf16ab838c5ca51a35f33aee89382055c0fdc8 Mon Sep 17 00:00:00 2001 From: Wesley Moore Date: Fri, 8 Mar 2024 21:57:12 +1000 Subject: [PATCH] Sketch out site content derived from README --- config.toml | 13 ++- content/_index.md | 58 +++++++++++++ content/documentation.md | 183 +++++++++++++++++++++++++++++++++++++++ content/feed-icon.svg | 18 ++++ content/install.md | 52 +++++++++++ content/news/_index.md | 9 ++ content/news/hello.md | 21 +++++ templates/index.html | 51 +++++++++++ templates/index.xml | 31 +++++++ templates/section.html | 16 ++++ 10 files changed, 451 insertions(+), 1 deletion(-) create mode 100644 content/_index.md create mode 100644 content/documentation.md create mode 100755 content/feed-icon.svg create mode 100644 content/install.md create mode 100644 content/news/_index.md create mode 100644 content/news/hello.md create mode 100644 templates/index.html create mode 100644 templates/index.xml create mode 100644 templates/section.html diff --git a/config.toml b/config.toml index f11235c..34b22a0 100644 --- a/config.toml +++ b/config.toml @@ -8,6 +8,9 @@ compile_sass = false build_search_index = false generate_feed = true +feed_filename = "index.xml" + +theme = "juice" [markdown] # Whether to do syntax highlighting @@ -16,4 +19,12 @@ highlight_code = true smart_punctuation = true [extra] -# Put all your custom variables here +email = "wes@wezm.net" +author = "Wesley Moore" +juice_logo_name = "RSS Please" +juice_logo_path = "feed-icon.svg" +juice_extra_menu = [ + { title = "News", link = "/news/"}, + { title = "GitHub", link = "https://github.com/wezm/rsspls"}, +] +repository_url = "https://github.com/wezm/rsspls" diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..4a23319 --- /dev/null +++ b/content/_index.md @@ -0,0 +1,58 @@ ++++ +title = "Home" +sort_by = "weight" +#paginate_by = 10 ++++ + +
+ A small tool (rsspls) to generate RSS feeds from web pages that lack them. + It runs on BSD, Linux, macOS, Windows, and more. +
+ +
+ +
+ + Build Status + + Version + + License +
+ +
+ +`rsspls` generates RSS feeds from web pages. Example use cases: + +* Create a feed for a blog that does not have one so that you will know when + there are new posts. +* Create a feed from the search results on real estate agent's website so that + you know when there are new listings—without having to check manually all the + time. +* Create a feed of the upcoming tour dates of your favourite band or DJ. +* Create a feed of the product page for a company, so you know when new + products are added. + +The idea is that you will then subscribe to the generated feeds in your feed +reader. This will typically require the feeds to be hosted via a web server. + +Credits +------- + +* [RSS feed icon](http://www.feedicons.com/) by The Mozilla Foundation + +Licence +------- + +This project is dual licenced under either of: + +- Apache License, Version 2.0 ([LICENSE-APACHE](https://github.com/wezm/rsspls/blob/master/LICENSE-APACHE)) +- MIT license ([LICENSE-MIT](https://github.com/wezm/rsspls/blob/master/LICENSE-MIT)) + +at your option. + +[rustup]: https://www.rust-lang.org/tools/install +[toml]: https://toml.io/ +[selectors]: https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors +[cron]: https://en.wikipedia.org/wiki/Cron +[timers]: https://wiki.archlinux.org/title/Systemd/Timers diff --git a/content/documentation.md b/content/documentation.md new file mode 100644 index 0000000..24342fd --- /dev/null +++ b/content/documentation.md @@ -0,0 +1,183 @@ ++++ +title = "Documentation" +description = "Documentation" +weight = 2 ++++ + +### Configuration + +Unless specified via the `--config` command line option `rsspls` reads its +configuration from one of the following paths: + +* UNIX-like systems: + * `$XDG_CONFIG_HOME/rsspls/feeds.toml` + * `~/.config/rsspls/feeds.toml` if `XDG_CONFIG_HOME` is unset. +* Windows: + * `C:\Users\You\AppData\Roaming\rsspls\feeds.toml` + +The configuration file is in [TOML][toml] format. + +The parts of the page to extract for the feed are specified using [CSS +selectors][selectors]. + +#### Annotated Sample Configuration + +The sample file below demonstrates all the parts of the configuration. + +```toml +# The configuration must start with the [rsspls] section +[rsspls] +# Optional output directory to write the feeds to. If not specified it must be supplied via +# the --output command line option. +output = "/tmp" +# Optional proxy address. If specified, all requests will be routed through it. +# The address needs to be in the format: protocol://ip_address:port +# The supported protocols are: http, https, socks and socks5h. +# It can also be specified as environment variable `http_proxy` or `HTTPS_PROXY`. +# The config file takes precedence, then the env vars in the above order. +# proxy = socks5://10.64.0.1:1080 + +# Next is the array of feeds, each one starts with [[feed]] +[[feed]] +# The title of the channel in the feed +title = "My Great RSS Feed" + +# The output filename without the output directory to write this feed to. +# Note: this is a filename only, not a path. It should not contain slashes. +filename = "wezm.rss" + +# Optional User-Agent header to be set for the HTTP request. +# user_agent = "Mozilla/5.0" + +# The configuration for the feed +[feed.config] +# The URL of the web page to generate the feed from. +url = "https://www.wezm.net/" + +# A CSS selector to select elements on the page that represent items in the feed. +item = "article" + +# A CSS selector relative to `item` to an element that will supply the title for the item. +heading = "h3" + +# A CSS selector relative to `item` to an element that will supply the link for the item. +# Note: This element must have a `href` attribute. +# Note: If not supplied rsspls will attempt to use the heading selector for link for backwards +# compatibility with earlier versions. A message will be emitted in this case. +link = "h3 a" + +# Optional CSS selector relative to `item` that will supply the content of the RSS item. +summary = ".post-body" + +# Optional CSS selector relative to `item` that supplies media content (audio, video, image) +# to be added as an RSS enclosure. +# Note: The media URL must be given by the `src` or `href` attribute of the selected element. +# Note: Currently if the item does not match the media selector then it will be skipped. +# media = "figure img" + +# Optional CSS selector relative to `item` that supples the publication date of the RSS item. +date = "time" + +# Alternatively for more control `date` can be specified as a table: +# [feed.config.date] +# selector = "time" +# # Optional type of value being parsed. +# # Defaults to DateTime, can also be Date if you're parsing a value without a time. +# type = "Date" +# # format of the date to parse. See the following for the syntax +# # https://time-rs.github.io/book/api/format-description.html +# format = "[day padding:none]/[month padding:none]/[year]" # will parse 1/2/1934 style dates + +# A second example feed +[[feed]] +title = "Example Site" +filename = "example.rss" + +[feed.config] +url = "https://example.com/" +item = "div" +heading = "a" +``` + +The first example above (for my blog WezM.net) matches HTML that looks like this: + +```html +
+

Recent Posts

+ +
+

Monitoring My Garage Door With a Raspberry Pi, Rust, and a 13Mb Linux System

+ + +
+

I’ve accidentally left our garage door open a few times. To combat this I built + a monitor that sends an alert via Mattermost when the door has been left open + for more than 5 minutes. This turned out to be a super fun project. I used + parts on hand as much as possible, implemented the monitoring application in + Rust, and then built a stripped down Linux image to run it. +

+
+ + Continue Reading → +
+ +
+ +
+ + + + View more posts → +
+``` + +#### More Detail on Date Handling + +The `date` key in the configuration can be a string or a table. If it's a +string then it's used as selector to find the element containing the date and +`rsspls` will attempt to automatically parse the value. If automatic parsing +fails you can manually specify the format using the table form of `date`: + +```toml +[feed.config.date] +selector = "time" # required +type = "Date" +format = "[day padding:none]/[month padding:none]/[year]" +``` + +* `type` is `Date` when you want to parse just a date. Use `DateTime` if you're + parsing a date and time with the format. Defaults to `DateTime`. +* `format` is a format description using the syntax described on this page: + . + +If the element matched by the `date` selector is a `