Giter VIP home page Giter VIP logo

feedjira-opml's Introduction

Feedjira::Opml

Gem Version Dependency Status Build Status Code Climate Coverage Status

This gem registers a new parser with Feedjira which provides basic support for OPML files. It is based on OPML version 2.0, but does not currently support all aspects of the specification (directories, for example, are not supported).

Beyond what is provided by Feedjira, there is no support for converting OPML files to hashes, or generating valid OPML from other data sources.

Usage

Since feedjira-opml automatically registers its OPML parser with Feedjira, using the standard processing methods should generally yield the desired results.

Feedjira::Feed.parse(string_of_xml)

The OPML parser will match on /\<opml/, so it won't conflict with RSS, Atom, or other native Feedjira parsers.

If its necessary to use the OPML parser explicitly:

Feedjira::Feed.parse_with(Feedjira::Parser::OPML, string_of_xml)

Output

All elements and attributes are typecast based on the OPML specification. The behavior for handling values that don't adhere to the spec is undefined.

@opml.head.title
@opml.head.owner_name
@opml.head.date_created # Returns a Time
@opml.head.expansion_state # Returns an Array

Working with outlines is similar.

outline = @opml.body.outlines.first

url = outline.xml_url # Returns a URI

The isComment and isBreakpoint attributes are converted to booleans and accessed through convenience methods.

is_comment = outline.comment?

There are certain situations where the spec requires certain values meet some criteria based on other values, (e.g. "An outline element whose type is link must have a url attribute whose value is an http address."). These requirements are not currently enforced by the parser.

feedjira-opml's People

Contributors

farski avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.