Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow direct attributes giving on a field #74

Open
aminya opened this issue Feb 5, 2020 · 1 comment
Open

Allow direct attributes giving on a field #74

aminya opened this issue Feb 5, 2020 · 1 comment
Labels
decision Need to decide about this enhancement New feature or request

Comments

@aminya
Copy link
Owner

aminya commented Feb 5, 2020

It helps to avoid creating new struct if the field is just a text and some attributes.
Attributes can be given in a Tuple with the xml name of them:

@aml mutable struct tr "~"
  th::String, "~", missing, ("class", "style")
end

Two commas were used because the first one is the place holder for the value checking function.

For accessing the Dict after creation, one should be able to do this:

tr.th # regular content
tr.th["class"] # attribute
@aminya aminya added the enhancement New feature or request label Feb 5, 2020
@aminya aminya self-assigned this Feb 5, 2020
@aminya aminya pinned this issue Feb 5, 2020
@aminya
Copy link
Owner Author

aminya commented Feb 19, 2020

Thinking more about this:

  • This is just defining a new type in 1 line, while it can be split easily (not sure how much value we get from this quicker syntax)

  • What should be given in the Tuple:

  • just giving the xml name? and assuming only strings?

("class", "style")
  • giving all the argument information? -> similar to just defining separate types
(x::String, att"class", y::Int64, att"style")
  • How can they instantiate a type with attributes?
tr( th = th("good", class = "this", style = "that"))
  • How can they access the attributes?
tr.th # regular content
tr.th["class"] # attribute

@aminya aminya added decision Need to decide about this question Further information is requested and removed question Further information is requested labels Feb 28, 2020
@aminya aminya removed their assignment Mar 3, 2020
@aminya aminya unpinned this issue Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decision Need to decide about this enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant