Skip to content

htmlgen does not support data-* attributes #13444

Closed
@sveri

Description

@sveri

When using htmlgen and using any data- attribute I get a compile error.

Example

import htmlgen

td(data-label ="foobar")

Current Output

Typemismatch error

Possible Solution

In htmlgen.nim change the proc delete to check for data attributes like this:

proc delete[T](s: var seq[T], attr: T): bool =
  # data-* attributes are user defined, so it would not make sense to
  # define each single one statically.
  if attr.startsWith("data-"):
    return true

  var idx = find(s, attr)
  if idx >= 0:
    var L = s.len
    s[idx] = s[L-1]
    setLen(s, L-1)
    result = true
$ nim -v
Nim Compiler Version 1.0.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions