diff options
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | src/feednim/atom.nim | 10 | ||||
| -rw-r--r-- | src/feednim/submodule.nim | 12 | ||||
| -rw-r--r-- | tests/test_atom.nim | 16 | ||||
| -rw-r--r-- | tests/test_atom.xml | 89 |
5 files changed, 108 insertions, 23 deletions
@@ -2,7 +2,7 @@ # 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 wriiten by an inexperienced dope who barely understands Nim. Use at your own risk. +It has not been tested, has no tests, and is mostly written by an inexperienced dope who barely understands Nim. Use at your own risk. ## Usage @@ -13,4 +13,4 @@ It has not been tested, has no tests, and is mostly wriiten by an inexperienced <code>getRSS(url: string): RSS</code> Gets the RSS from the specified _url_<br> <code>loadJsonFeed(filename: string): JSONfeed</code> Loads the JSONFeed from the given _filename_<br> -<code>getJsonFeed(url: string): JSONfeed </pre>JsonFeed = JSONFeed from the specified _url_<br>
\ No newline at end of file +<code>getJsonFeed(url: string): JSONfeed</code> JsonFeed = JSONFeed from the specified _url_<br>
\ No newline at end of file diff --git a/src/feednim/atom.nim b/src/feednim/atom.nim index cce9c44..1b43b03 100644 --- a/src/feednim/atom.nim +++ b/src/feednim/atom.nim @@ -31,15 +31,6 @@ type name*: string # Required Atom field url*: string email*: string - - AtomImage* = object - url*: string - title*: string - link*: string - width*: string - height*: string - description*: string - AtomLink* = object href*: string rel*: string @@ -65,6 +56,7 @@ type summary*: string + proc parseEntry( node: XmlNode) : AtomEntry = var entry: AtomEntry = AtomEntry() diff --git a/src/feednim/submodule.nim b/src/feednim/submodule.nim deleted file mode 100644 index 1af4e81..0000000 --- a/src/feednim/submodule.nim +++ /dev/null @@ -1,12 +0,0 @@ -# This is just an example to get you started. Users of your library will -# import this file by writing ``import FeedNim/submodule``. Feel free to rename or -# remove this file altogether. You may create additional modules alongside -# this file as required. - -type - Submodule* = object - name*: string - -proc initSubmodule*(): Submodule = - ## Initialises a new ``Submodule`` object. - Submodule(name: "Anonymous") diff --git a/tests/test_atom.nim b/tests/test_atom.nim new file mode 100644 index 0000000..3d563da --- /dev/null +++ b/tests/test_atom.nim @@ -0,0 +1,16 @@ +# This is just an example to get you started. You may wish to put all of your +# tests into a single file, or separate them into multiple `test1`, `test2` +# etc. files (better names are recommended, just make sure the name starts with +# the letter 't'). +# +# To run these tests, simply execute `nimble test`. + + + + + +import unittest + +import FeedNim +test "can add": + check add(5, 5) == 10 diff --git a/tests/test_atom.xml b/tests/test_atom.xml new file mode 100644 index 0000000..5854868 --- /dev/null +++ b/tests/test_atom.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="utf-8"?> +<feed xmlns="http://www.w3.org/2005/Atom"> + <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id> + <title>Bloggs's Planes Trains and Automobiles</title> + <updated>2003-12-13T18:30:02Z</updated> + <author> + <name>Joe Bloggs</name> + <url>http://joe.bloggs</url> + <email>mail@joe.bloggs</email> + </author> + <author> + <name>Jane Bloggs</name> + </author> + <category>Planes</category> + <category>Trains</category> + <category>Automobiles</category> + <generator>nim<generator> + <icon>http://joe.bloggs/mug,jpg</icon> + <link + href="http://joe.bloggs/american" + rel="alternate" + type="application/xml+rss" + hreflang="en-US" + title="Ye-ha" + length="1000000" + /> + <logo>© Joe and Jane Bloggs</logo> + <rights>© Joe and Jane Bloggs</rights> + <subtitle></subtitle> + + <entry> + <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> + <title>Aeroplanes not Airplanes</title> + <updated>2003-12-13T18:30:02Z</updated> + <author> + <name>Joe Bloggs</name> + <url>http://joe.bloggs</url> + <email>mail@joe.bloggs</email> + </author> + <category>planes</category> + <content type="html"> + <b>Aero</b>- not air-, fools! + </content> + <link + href="http://planes.com" + rel="reply" + type="html" + hreflang="en-US" + title="Airplanes not Aeroplanes" + length="1000000" + /> + <published>2003-12-13T18:30:02Z</published> + <rights>© Joe Bloggs</rights> + <source> + <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> + <title>Aeroplane</title> + <subtitle>Aeroplanes</subtitle> + <updated>1755-04-15T18:30:00Z</updated> + <author> + <name>Samuel Johnson</name> + <url>http://dictionary.com</url> + <email>sjohnson@dictionary.com</email> + </author> + <category>words</category> + <rights>© Samual Johnson</rights> + + + + </source> + </entry> + + <entry> + <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> + <title>Aeroplanes not Airplanes</title> + <updated>2003-12-13T18:30:02Z</updated> + <author> + <name>Joe Bloggs</name> + <url>http://joe.bloggs</url> + <email>mail@joe.bloggs</email> + </author> + <category>trains</category> + <content src="http://trains.com"></content> + <published>2003-12-13T18:20:02Z</published> + <rights>© Jane Bloggs</rights> + <summary> + Trains! + </summary> + </entry> +</feed>
\ No newline at end of file |
