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

Custom Tags #46

Open
sritchie opened this issue Dec 10, 2014 · 10 comments
Open

Custom Tags #46

sritchie opened this issue Dec 10, 2014 · 10 comments

Comments

@sritchie
Copy link

I know it explicitly says NOT to do this in the README... BUT, let me make the pitch.

I've written a bunch of components in Om-Bootstrap that could easily be hooked into Sablono's renderer, if I were able to extend specific (namespaced) keywords in the markup to call out to my om-bootstrap components.

For example,

[:div
  [::b/button {:bs-style "primary"}
    [:a "Anchor tag"]]]

::b/button would pass the options and children into om-bootstrap.button/button.

What do you think? Is this a feature you guys would be interested in?

@r0man
Copy link
Owner

r0man commented Dec 12, 2014

Hi Sam,
could you provide more details on how this should work?
Roman

@sritchie
Copy link
Author

Hey r0man,

I'd replace react-fn with a multimethod:

https://github.com/r0man/sablono/blob/master/src/sablono/compiler.clj#L72

that way the user could extend it to different tags.

@r0man
Copy link
Owner

r0man commented Dec 22, 2014

Hi Sam,

makeing react-fn a multimethod is not a big deal. However, I
think we need a better name for the function. Patch with tests
welcome, and ideally without any additional dependencies.

Roman

@sritchie
Copy link
Author

Okay, I should have some time to play with this in the next week or so. Thanks!

@dsvensson
Copy link

Updates?

@sritchie
Copy link
Author

sritchie commented Jul 1, 2015

Haven't worked on this, but converting that function to a multimethod should do it easily.

@pangloss
Copy link

I'd also love to be able to plug custom element tags into sablono.

If this is hung up on deciding on a name, how about element-constructor?

@sritchie
Copy link
Author

sritchie commented Aug 1, 2015

I think it's just hung up on someone coding up the multimethod implementation. I'm just not using sablono in my work, so haven't gotten around to it.


Sent from Mailbox

On Fri, Jul 31, 2015 at 4:00 PM, Darrick Wiebe [email protected]
wrote:

I'd also love to be able to plug custom element tags into sablono.

If this is hung up on deciding on a name, how about element-constructor?

Reply to this email directly or view it on GitHub:
#46 (comment)

@zcaudate
Copy link

zcaudate commented Jun 9, 2017

I would really like this feature because then you can plug-in different renderers and do things closer to jsx: https://react.semantic-ui.com/views/card#card-example-card

[:sem/card 
  [:sem/image ...]
  [:sem/card.header]]

@bendlas
Copy link

bendlas commented Jul 6, 2017

I'm in love with the idea of allowing qualified keywords as sablono hiccup tag names, to call constructor functions but there is a big caveat: the sablono interpreter + advanced optimization:

Since clojurescript function names are subject to renaming, but keywords aren't, the interpreter won't be able to construct such elements, unless all used constructor functions are marked ^:export.

This is really sub-optimal, but maybe rum and om can be persuaded to change their def* forms accordingly ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants