ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - Betree/atomex: 🌊 Elixir RSS/ATOM feed builder with a focus on standards compliance, security and extensibility
🌊 Elixir RSS/ATOM feed builder with a focus on standards compliance, security and extensibility - Betree/atomex
Visit Site

GitHub - Betree/atomex: 🌊 Elixir RSS/ATOM feed builder with a focus on standards compliance, security and extensibility

GitHub - Betree/atomex: 🌊 Elixir RSS/ATOM feed builder with a focus on standards compliance, security and extensibility

Atomex

Coverage Status Build Status

Atomex is an ATOM 1.0 feed builder with a focus on RFC4287 compliance, security and extensibility. It is safe to use it with user content: everything is escaped by default. Built on top of xml_builder.

API reference is available here: https://hexdocs.pm/atomex/api-reference.html

TODO

  • Feed required params (id, title, updated)
  • Feed recommended params (author, link)
  • Feed optional params
    • category
    • contributor
    • generator
    • icon
    • logo
    • rights
    • subtitle
  • Entry required params (id, title, updated)
  • Entry recommended params (author, content, link, summary)
  • Entry optional params
    • category
    • contributor
    • published
    • rights
    • source
  • Validator

Installation

def deps do
  [
    {:atomex, "0.3.0"}
  ]
end

Basic usage

Required field are always passed in new functions. There are however recommended fields that you should not ignore. See Validating your feed below.

alias Atomex.{Feed, Entry}

def build_feed(comments) do
  Feed.new("https://example.com", DateTime.utc_now, "My incredible feed")
  |> Feed.author("John Doe", email: "[email protected]")
  |> Feed.link("https://example.com/feed", rel: "self")
  |> Feed.entries(Enum.map(comments, &get_entry/1))
  |> Feed.build()
  |> Atomex.generate_document()
end

defp get_entry(_comment = %{id, text, inserted_at, user}) do
  Entry.new("https://example.com/comments/#{id}", inserted_at, "New comment by #{user.name}")
  |> Entry.author(user.name, uri: "https://example.com/users/#{user.id}")
  |> Entry.content("<h1>Content here will be properly escaped! Text: #{text}</h1>", type: "html")
  |> Entry.build()
end

To avoid escaping, you can pass a tuple as value like this (be careful though, a user may break it with malicious content):

Entry.content(entry, {:cdata, "<h1>Amazing</h1>"}, type: "html")
# Render as => <content type="html"><![CDATA[<h1>Amazing</h1>]]></content>

Extending the default API

  • You can specify custom schemas
Feed.build(feed, %{"xmlns:georss" => "http://www.georss.org/georss"})
# <?xml version="1.0" encoding="UTF-8"?>
# <rss version="2.0" xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss">
#...
  • And custom fields
Feed.new(...)
|> Feed.add_field(:custom_field, %{attribute: 42}, "Foobar")
|> Feed.build()
|> Atomex.generate_document()
# ...
# <custom_field attribute="42">Foobar</custom_field>

For more complicated use cases, content can also be given a xml element directly. Use XmlBuilder to achieve that.

Validating your feed

Use this tool from W3C

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory