Add convert to Halogen#4
Merged
dnikolovv merged 5 commits intodnikolovv:masterfrom Aug 30, 2022
Merged
Conversation
Owner
|
Hey @br4ch1st0chr0n3! Thank you for contributing! Looks great! The thing I'm concerned about is the unicode. What do you think about switching to ascii like: At least in my experience, it's very rare to see projects that use unicode, so it might be best to support the more common usage (or ideally have the user choose what they want). |
Contributor
Author
|
Sure, @dnikolovv. Fixed it |
Contributor
Author
|
Now <section class="a-class" b>
<h1>Some heading</h1>
<p>A paragraph.</p>
</section>becomes import Halogen as H
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
-- HTML starts here
node0 :: forall (a :: Type) (b :: Type). HTML a b
node0 = HH.section [ classes_ [ "a-class" ], attr_ "b" "" ]
[ HH.h1_ [ HH.text "Some heading" ], HH.p_ [ HH.text "A paragraph." ] ]
-- End of HTML
attr_ :: forall (a :: Row Type) (b :: Type). String -> String -> HP.IProp a b
attr_ k v = HP.attr (H.AttrName k) v
classes_
:: forall (a :: Row Type) (b :: Type)
. Array String
-> HP.IProp (class :: String | a) b
classes_ n = HP.classes $ H.ClassName <$> n
|
Owner
|
Great, thanks! I'll be merging this and maybe we can do the tabs soon. |
Contributor
Author
|
Nice! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of all thank you, @dnikolovv!
Now, about PR. This version seems to work for simple cases. Also, I suggest adding tabs for switching between React and Halogen code.
Sample HTML:
Purescript output: