All Projects → jinjor → elm-html-parser

jinjor / elm-html-parser

Licence: BSD-3-Clause license
Parse HTML in Elm!

Programming Languages

elm
856 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to elm-html-parser

eslump
Fuzz testing JavaScript parsers and suchlike programs.
Stars: ✭ 56 (+27.27%)
Mutual labels:  parse
ujson drf
JSON Renderer and Parser for Django Rest Framework using the ultra fast json (in C).
Stars: ✭ 14 (-68.18%)
Mutual labels:  parse
php-simple-request
php-simple-request is a request parser library designed to simplify requests validation and filtering using annotations, generating at the same time an object representation from the request data.
Stars: ✭ 15 (-65.91%)
Mutual labels:  parse
twkb
A small GO parser for the TWKB format
Stars: ✭ 17 (-61.36%)
Mutual labels:  parse
BaaSDelphiSamples
💾 Code samples for BaaS and PaaS using Delphi
Stars: ✭ 30 (-31.82%)
Mutual labels:  parse
color-math
Expressions to manipulate colors.
Stars: ✭ 18 (-59.09%)
Mutual labels:  parse
node-red-contrib-string
Provides a string manipulation node with a chainable UI based on the concise and lightweight stringjs.com.
Stars: ✭ 15 (-65.91%)
Mutual labels:  parse
parse
Parse with an Eloquent-like interface for Laravel
Stars: ✭ 15 (-65.91%)
Mutual labels:  parse
logstash-laravel-logs
Process Laravel Log files on Logstash and forward to ElasticSearch
Stars: ✭ 35 (-20.45%)
Mutual labels:  parse
xml-spac
Handle streaming XML data with declarative, composable parsers
Stars: ✭ 39 (-11.36%)
Mutual labels:  parse
golgi
A composable routing library for Haxe.
Stars: ✭ 37 (-15.91%)
Mutual labels:  parse
rpgdice
A generic RPG dice roller syntax and library.
Stars: ✭ 24 (-45.45%)
Mutual labels:  parse
asmdot
[Unstable] Fast, zero-copy and lightweight (Arm | Mips | x86) assembler in (C | C++ | C# | Go | Haskell | Javascript | Nim | OCaml | Python | Rust).
Stars: ✭ 23 (-47.73%)
Mutual labels:  parse
python-fastimport
Git Fastimport parser and generator in Python
Stars: ✭ 19 (-56.82%)
Mutual labels:  parse
svg-quick-editor
SVG Quick Editor is a free and open-source SVG editing tool. It offers features such as editing SVG colors, viewing or deleting their paths.
Stars: ✭ 88 (+100%)
Mutual labels:  parse
tparse
time parsing library for Go; supports more time units than standard library
Stars: ✭ 42 (-4.55%)
Mutual labels:  parse
rasn1
Ruby ASN.1 library
Stars: ✭ 14 (-68.18%)
Mutual labels:  parse
ParseCareKit
Securely synchronize any CareKit 2.1+ based app to a Parse Server Cloud. Compatible with parse-hipaa.
Stars: ✭ 28 (-36.36%)
Mutual labels:  parse
jgeXml
The Just-Good-Enough XML Toolkit
Stars: ✭ 20 (-54.55%)
Mutual labels:  parse
parse-csv
CSV parser for node.js
Stars: ✭ 15 (-65.91%)
Mutual labels:  parse

Note

For anyone who is using Elm 0.19 and blocked by this library, consider using hecrj/html-parser for now. It seems still WIP but passed the same test cases. I think that means the most difficult part of the HTML spec should be already covered (e.g. <li> does not need a closing tag). Also, it uses the official parser elm/parser which I was planning to use in the newer version. So I think contributing to hecrj/html-parser is the fastest path for everyone getting happy :)

elm-html-parser

Build Status

Parse HTML in Elm! (DEMO)

Parse

import HtmlParser as HtmlParser exposing (..)

parse "text" == [ Text "text" ]

parse "<h1>Hello<br>World</h1>"
  == [ Element "h1" [] [ Text "Hello", Element "br" [] [], Text "World" ] ]

parse """<a href="http://example.com">Example</a>"""
  == [ Element "a" [("href", "http://example.com")] [ Text "Example" ] ]

Query

import HtmlParser exposing (..)
import HtmlParser.Util exposing (..)

table = """
  <table border=0 cellpadding=0 cellspacing=0 width=216 style='border-collapse:
   collapse;width:162pt'>
  <!--StartFragment-->
   <col width=72 span=3 style='width:54pt'>
   <tr height=18 style='height:13.5pt'>
    <td height=18 align=right width=72 style='height:13.5pt;width:54pt'>1</td>
    <td align=right width=72 style='width:54pt'>2</td>
    <td align=right width=72 style='width:54pt'>3</td>
   </tr>
   <tr height=18 style='height:13.5pt'>
    <td height=18 class=xl69 align=right style='height:13.5pt'>2</td>
    <td class=xl66 align=right>3</td>
    <td align=right>4</td>
   </tr>
  <!--EndFragment-->
  </table>
"""

( parse table
  |> getElementsByTagName "tr"
  |> mapElements
    (\_ _ innerTr ->
      innerTr
        |> mapElements (\_ _ innerTd -> textContent innerTd)
        |> String.join "\t"
        |> String.trim
    )
  |> String.join "\n"
) == "1\t2\t3\n2\t3\t4"

LICENSE

BSD3

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].