sahandnayebaziz / hypertext Goto Github PK
View Code? Open in Web Editor NEWAny-way-you-want-it, type-safe HTML in Swift.
License: MIT License
Any-way-you-want-it, type-safe HTML in Swift.
License: MIT License
So now the automatic naming of the library just literally takes the class name of the tag, which is cool for all the default html elements, but that doesn't work for custom elements like web-components. Custom elements are required to have a least one dash -
in their name according to the html spec, AFAIK. So for example <material-button></material-button>
. And how would someone name the class that represents that tag? I reckon that class would be called MaterialButton
or materialButton
.
With the current state of the library, if the developer would write this:
class materialButton: tag {}
Then their button would be called <materialButton></materialButton>
instead of <material-button></material-button>
. So how about we change the automatic naming to change camelCase class names to slug-case element names? I think it shouldn't be too hard.
Hello,
Thanks for creating this library. If we can use this package also with CocoaPods, it would be really great! I have an iOS project which I'm using CocoaPods as a dependency manager in it and I think CocoaPods can increase the usage of the library :)
Cheers
I made a branch locally where I changed the init()
methods to make it more intuitive, imo. You see when you write HTML, you always write the attributes of an element first (optionally of course) and then you write that element's children.
<div class="container">
<p>
Well hello there...
</p>
</div>
But right now this library doesn't reflect that, because this library requires you to first write the children and then write the attributes, like so:
let view = div(setChildren: { p { "Well hello there..." } }, attributes: ["class": "container"])
My new init()
methods allow you to do this:
let view = div(["class":"container"]) {
p {
"Well hello there..."
}
}
Do you see how much better that reflects the actual HTML code? Would you like that too?
cells.append(td([AttributeName.colspan: 2.description]) { totalLabel() })
I'm getting errors "Ambiguous use of 'description' after Xcode was upgraded to version 9.0. The above code is an example. This seems to be caused by the following:
`public extension Renderable {
var description: String {
return render()
}
}
extension String: Renderable {}
extension Int: Renderable {}
extension Double: Renderable {}
extension Float: Renderable {}`
In this case, Int already has a description property but since it is Renderable it is redefined. I don't know why this wasn't an issue in Xcode 8.x.
use js ?
Hello again,
Thanks for the quick response. Good work! I've just tried to install the library via CocoaPods with
pod 'Hypertext'
in Podfile but it failed with error:
[!] Unable to find a specification for 'Hypertext'
I also tried with installing via
pod 'Hypertext', :git => '[email protected]:sahandnayebaziz/Hypertext.git', :tag => '2.1.0'
but still same. I think something is wrong with CocoaPods. You may need to delete the repo from CocoaPods and upload it again. There are some way on the web to solve this.
Also, it would be perfect for beginners to have an installation guide for the library on Readme. This is just a suggestion to attract more people in every experience level to library :)
I believe in this case they should be value types, because they don't have identity. Do you agree?
I guess i found a bug.
if i have this line code
let html = body { div { b {"Hello World"} } }.render()
this is working but if i have this line code
let html = html { body { b {"Hello World"} } }.render()
is not any more working
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.