utkarshkukreti / markup.rs

A blazing fast, type-safe template engine for Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hyphenated attributes throw "error: expected `=`"

niallrr opened this issue · comments

commented

Hyphenated attributes produce the following error. This is important for being able to use Bootstrap.

button [
    type="button",
    class="btn btn-circle btn-dual-secondary d-lg-none align-v-r",
    data-toggle="layout",
    data-action="sidebar_close"
    ]
    {
        i [class="fa fa-times text-danger"]
    }

Throws the error

error: expected `=`
   --> src/t_base.rs:115:29
    |
115 |                         data-toggle="layout",
    |  
commented

Just found a workaround

    "data-toggle"="layout",
    "data-action"="sidebar_close"

Hi, yes, that's the right way. Proc macros in Rust work with Rust tokens, so there's no way to distinguish between data - toggle = "layout" and data-toggle = "layout", which is why I allow string literals on the left of =.

commented

@utkarshkukreti Is there a similar way to output a hyphenated element?

my-custom-element#id.class {
  @content
}

Currently gives error expected expression pointing at the @content. This is important for custom elements.