README.md in html2rss-0.8.2 vs README.md in html2rss-0.9.0

- old
+ new

@@ -3,10 +3,11 @@ [![Build Status](https://travis-ci.org/gildesmarais/html2rss.svg?branch=master)](https://travis-ci.org/gildesmarais/html2rss) [![Gem Version](https://badge.fury.io/rb/html2rss.svg)](http://rubygems.org/gems/html2rss/) [![Coverage Status](https://coveralls.io/repos/github/gildesmarais/html2rss/badge.svg?branch=master)](https://coveralls.io/github/gildesmarais/html2rss?branch=master) [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](https://www.rubydoc.info/gems/html2rss) ![Retro Badge: valid RSS](https://validator.w3.org/feed/images/valid-rss-rogers.png) +[![](http://img.shields.io/liberapay/goal/gildesmarais.svg?logo=liberapa)](https://liberapay.com/gildesmarais/donate) **Searching for a ready to use app which serves generated feeds via HTTP?** [Head over to `html2rss-web`!](https://github.com/gildesmarais/html2rss-web) This Ruby gem builds RSS 2.0 feeds from a _feed config_. @@ -25,10 +26,12 @@ | ---------------------------------------------: | -------------------- | | Add this line to your application's `Gemfile`: | `gem 'html2rss'` | | Then execute: | `bundle` | | In your code: | `require 'html2rss'` | +😍 Love it? Feel free [to donate](https://liberapay.com/gildesmarais/donate). Thank you! 💓 + ## Building a feed config Here's a minimal working example: ```ruby @@ -100,10 +103,30 @@ | -------------- | -------------------------------------------------------- | | `selector` | The CSS selector to select the tag with the information. | | `extractor` | Name of the extractor. See notes below. | | `post_process` | A hash or array of hashes. See notes below. | +#### Reverse ordering of items + +The `items` selector hash can have an `order` attribute. +If the value is `reverse` the order of items in the RSS will be reversed. + +<details> + <summary>See a YAML feed config example</summary> + +```yml +channel: +  # ... omitted +selectors: + items: + selector: 'ul > li' + order: 'reverse' +  # ... omitted +``` + +</details> + ## Using extractors Extractors help with extracting the information from the selected HTML tag. - The default extractor is `text`, which returns the tag's inner text. @@ -321,11 +344,11 @@ <summary>See a Ruby example</summary> ```ruby Html2rss.feed( channel: { - url: 'https://example.com', title: 'Example with JSON', json: true + url: 'https://example.com', json: true }, selectors: {} # ... omitted ) ``` @@ -335,11 +358,10 @@ <summary>See a YAML feed config example</summary> ```yaml channel: url: https://example.com - title: "Example with JSON" json: true selectors:   # ... omitted ``` @@ -411,11 +433,10 @@ ```ruby Html2rss.feed( channel: { url: 'https://example.com', - title: "Example with http headers", headers: { "User-Agent": "html2rss-request", "X-Something": "Foobar", "Authorization": "Token deadbea7", "Cookie": "monster=MeWantCookie" @@ -431,11 +452,10 @@ <summary>See a YAML feed config example</summary> ```yaml channel: url: https://example.com - title: "Example with http headers" headers: "User-Agent": "html2rss-request" "X-Something": "Foobar" "Authorization": "Token deadbea7" "Cookie": "monster=MeWantCookie" @@ -451,11 +471,11 @@ This step is not required to work with this gem. If you're using [`html2rss-web`](https://github.com/gildesmarais/html2rss-web) and want to create your private feed configs, keep on reading! -First, create your YAML file, e.g. called `config.yml`. +First, create your YAML file, e.g. called `feeds.yml`. This file will contain your global config and feed configs. Example: ```yml @@ -475,14 +495,14 @@ Build your feeds like this: ```ruby require 'html2rss' -myfeed = Html2rss.feed_from_yaml_config('config.yml', 'myfeed') -myotherfeed = Html2rss.feed_from_yaml_config('config.yml', 'myotherfeed') +myfeed = Html2rss.feed_from_yaml_config('feeds.yml', 'myfeed') +myotherfeed = Html2rss.feed_from_yaml_config('feeds.yml', 'myotherfeed') ``` -Find a full example of a `config.yml` at [`spec/config.test.yml`](https://github.com/gildesmarais/html2rss/blob/master/spec/config.test.yml). +Find a full example of a `feeds.yml` at [`spec/config.test.yml`](https://github.com/gildesmarais/html2rss/blob/master/spec/config.test.yml). ## Gotchas and tips & tricks - Check that the channel URL does not redirect to a mobile page with a different markup structure. - Do not rely on your web browser's developer console. `html2rss` does not execute JavaScript.