From 36df49cdb9f6383ac2b08909489dcb0665bb2418 Mon Sep 17 00:00:00 2001 From: John Conway Date: Fri, 10 May 2019 14:04:50 +0100 Subject: Added a lot more usage and implementation detail --- README.md | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e445a36..a6c8525 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,11 @@ # Feed-Nim A feed parsing module for [Nim](https://nim-lang.org), which parses RSS, Atom, and JSONfeed syndication formats. This has been substantially re-written and expanded from [Nim-RSS](https://github.com/achesak/nim-rss). -It has not been tested, has no tests, and is mostly written by an inexperienced dope who barely understands Nim. It probably doesn't work. Use at your own risk. +It has not been tested in the wild, and is mostly written by an inexperienced dope who barely understands Nim. It will probably break. Use at your own risk. + +## Intallation + +nimble install feednim ## Usage @@ -13,4 +17,32 @@ It has not been tested, has no tests, and is mostly written by an inexperienced getRSS(url: string): RSS Gets the RSS from the specified _url_
loadJsonFeed(filename: string): JSONfeed Loads the JSONFeed from the given _filename_
-getJsonFeed(url: string): JSONfeed Gets the JSONfeed from the specified _url_
\ No newline at end of file +getJsonFeed(url: string): JSONfeed Gets the JSONfeed from the specified _url_
+ +### Accessors + +Feed-Nim will give a data tree which looks very similar to the data tree of the feed, and the nodes will mostly have the same names. For example an RSS feed 'title' node will be + + +let feed = loadRSS("my_feed.xml") +feed.title # Will hold the title + + +(Bet you didn't see that coming!) + +There are some exeptions, elements that can be repeated accorting to the specifications are pluralised as follows: + +*RSS*: `` -> accessed as '`.items[index]`' +*RSS and Atom*: `` -> '`.categories[index]`' +*Atom*: `` -> accessed as '`.entries[index]`' +*Atom*: `` -> accessed as '`.authors[index]`' (if you call just .author, you will return the first author of the sequence) +*Atom*: `` -> accessed as '`.contributors[index]`' (again, calling this singular will return the first in the sequence) + +Some Atom nodes have the Nim keyword 'type' as an attribute. These have been changed as follows. + +`` type is accesed with linkType +`, , and <subtitle type="">` types are accesed with textType + +### Limitations + +Feed-Nim does not implement the full specification of any of the feed types. Notably, in Atom, the common attributes 'xml:lang' and 'xml:base' are not implemented. All three formats are extensible, but there is no support for this (extensions _should_ be ignored by Feed-Nim, but this is untested). \ No newline at end of file -- cgit v1.2.3