Comments (7)
I'm playing with an implementation here: https://github.com/maragudk/gomponents-xml/pull/1
Not sure how I'm going to keep code duplication down, but maybe it doesn't matter. Or maybe I should just incorporate it in this repo⦠(I'm thinking out loud.)
from gomponents.
Hi @tgrosinger . Hmm, yeah, the library is really geared towards HTML5 use, but I've hit the use case before. I have an SVG package in the repo which would potentially hit the same issue.
Maybe I could consider making an XML package that renders slightly differently, I'll think about that. I would think it would have more or less the same API, without the HTML-specific parts, and probably no helpers, so it would be pretty easy to implement.
from gomponents.
It's not very clean at all, but this change did fix the issue for me: https://github.com/tgrosinger/gomponents/commit/b8a83564c297b77523b7944ad5c97fbb1329ca13
I think if renderChild
were exported it would be much easier to reduce the duplication. Then I might suggest creating an xml
package as a sibling to the svg
and html
packages.
from gomponents.
Alternatively, this might also relate to #124 and possibly moving where the void element checking occurs and moving it out closer to the specific element type. That might be harder to do without changing the API though.
from gomponents.
@tgrosinger Both good points. For me, it's important that the focus of the library is HTML, and having something like XML support is nice, but not central to it.
I don't want to pollute the public API with XML-specific stuff that would confuse other users, but maybe I can pull the rendering logic into an internal package and thus have it available both from the xml
and core package. That would also clean up the svg
package, which similarly doesn't have void elements.
That actually seems like a feasible solution. I'll play around with it when I get some time, hopefully next week.
from gomponents.
Sounds great. Thank you very much for looking at this!
from gomponents.
@tgrosinger I played around with this a bit, but quickly ran into problems with import cycles when pulling out the rendering logic. I'm not currently sure about a path forward without breaking the API (not an option), exposing rendering logic in the API (not a huge fan of that, since the focus is definitely HTML and would be totally irrelevant to those consumers), or duplicating a lot of code (also not a huge fan of that). I'll think about it some more, and suggestions are also welcome. π
from gomponents.
Related Issues (20)
- Fragments HOT 6
- Links? HOT 1
- Why g.Map doesn't also do g.Group? HOT 2
- Generics g.Map performance HOT 7
- Use Custom attributes & alpine js HOT 3
- component specific css and js HOT 6
- Use with tinygo HOT 3
- Merge multiple occurrences of the `class` attribute HOT 5
- Proposal: Re-export packages with shorter names (g, h, c) HOT 3
- Inline if with nil pointer HOT 7
- Why can't a group be rendered? HOT 5
- Add lib to awesome Go HOT 1
- Remove fmt.Stringer support? HOT 1
- Handling internationalization HOT 8
- trigger an error on duplicate attributes HOT 3
- Make Group renderable
- Proposal to Add String Rendering Method to Node Interface HOT 5
- HTML -> gomponents converter tool HOT 2
- Label can be an attribute as well HOT 2
- Missing list attribute HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gomponents.