mbylstra / html-to-elm

An online tool for converting HTML to elm-html. Go to
http://mbylstra.github.io/html-to-elm/
395 stars 23 forks source link

Only a portion of elements are translated #2

Closed mrmurphy closed 8 years ago

mrmurphy commented 8 years ago

I paste in:

<div class="navbar navbar-default yamm" role="navigation" id="navbar">
        <div class="container">
            <div class="navbar-header">

                <a class="navbar-brand home" href="index.html" data-animate-hover="bounce">
                    <img src="img/logo.png" alt="Cheese Palette logo" class="hidden-xs">
                    <img src="img/logo-small.png" alt="Cheese Palette logo" class="visible-xs"><span class="sr-only">Cheese Palette - go to homepage</span>
                </a>
                <div class="navbar-buttons">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navigation">
                        <span class="sr-only">Toggle navigation</span>
                        <i class="fa fa-align-justify"></i>
                    </button>
                    <a class="btn btn-default navbar-toggle" href="basket.html">
                        <i class="fa fa-shopping-cart"></i>  <span class="hidden-xs">3 items in cart</span>
                    </a>
                </div>
            </div>

            <div class="navbar-collapse collapse" id="navigation">

                <ul class="nav navbar-nav navbar-left">
                    <li class="active"><a href="index.html">Home</a>
                    </li>
                    <li class="active"><a href="/cheeses">Our Cheeses</a>
                    </li>
                    <li class="active"><a href="/baskets">Gift Baskets</a>
                    </li>
                    <li class="active"><a href="/platters">Event Platters</a>
                    </li>
                    <li class="active"><a href="/tastings">Cheese Tastings</a>
                    </li>
                </ul>

            </div>

            <div class="navbar-buttons">

                <div class="navbar-collapse collapse right" id="basket-overview">
                    <a href="/cart" class="btn btn-primary navbar-btn"><i class="fa fa-shopping-cart"></i><span class="hidden-sm">3 items in cart</span></a>
                </div>
            </div>
        </div>
    </div>

But I only get

div [ class "navbar navbar-default yamm", id "navbar", attribute "role" "navigation" ]
    [ div [ class "container" ]
        [ div [ class "navbar-header" ]
            [ a [ class "navbar-brand home", attribute "data-animate-hover" "bounce", href "index.html" ]
                [ img [ alt "Cheese Palette logo", class "hidden-xs", src "img/logo.png" ]
                    []
                , img [ alt "Cheese Palette logo", class "visible-xs", src "img/logo-small.png" ]
                    []
                , span [ class "sr-only" ]
                    [ text "Cheese Palette " ]
                ]

back out. Only the beginning of the content was translated. The rest seems to be skipped for some reason.

Thanks for writing this neat tool!

mrmurphy commented 8 years ago

Just a follow up, if I remove the "-" from Cheese Palette - go to homepage the rest of the document appears to translate successfully.

mbylstra commented 8 years ago

Thanks. I realised the parser wasn't allowing special html syntax characters such as '-', '/', '!' and '>' in text nodes. This should be fixed now.

mrmurphy commented 8 years ago

Great! Thanks for addressing this so quickly!