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

Plan #1

Open
7 of 8 tasks
0xAX opened this issue Jan 6, 2014 · 13 comments
Open
7 of 8 tasks

Plan #1

0xAX opened this issue Jan 6, 2014 · 13 comments

Comments

@0xAX
Copy link
Member

0xAX commented Jan 6, 2014

1.0.0

  • Split all by '\n'
  • Parse doctype
  • Parse indentation
  • Parse tags
  • Parse nested tags
  • Parse text
  • HTML comments
  • Parse comments
@pap
Copy link
Contributor

pap commented Jan 31, 2014

I've sent a PR. Do you need/want some help on this one ?

@0xAX
Copy link
Member Author

0xAX commented Jan 31, 2014

Hello @pap,

thank you for the PR, i'm very appreciate your help 👍 I mainly working on Weber development now, so exhaml is in very early stage. Need to finish parser and make generator.

I can add you to elixir-web for easy contribution

@pap
Copy link
Contributor

pap commented Jan 31, 2014

@0xAX Don’t mention it, i’m glad to help out…
i’ve been “disconnected” from weber because i was finishing a big project. I intend to be more active !
As for exhaml i’m excited about it because i’m maily a Ruby on rails developer and i don’t like the verbosity of erb templates or any kind of templating that requires full html tag madness !

On 31/01/2014, at 18:05, 0xAX notifications@github.com wrote:

Hello @pap,

thank you for the PR, i'm very appreciate your help I mainly working on Weber development now, so exhaml is in very early stage. Need to finish parser and make generator.

I can add you to elixir-web for easy contribution


Reply to this email directly or view it on GitHub.

@0xAX
Copy link
Member Author

0xAX commented Jan 31, 2014

@pap

Initial tokenizer is done, exhaml already can compile haml like:

  def test2 do
    """
    %section
      %h1
        %div{ test => test, test2 => test2}
        asd
    %div
    """
  end

  def test3 do
    """
    %ul
      %li
        %a{:href => "#devices-tab"}Devices
      %li
        %a{:href => "#options-tab"}System Options
      %li
        %a{:href => "#reports-tab"}Reports
      %li
        %a{:href => "#notes-tab"}Notes
    """
  end

  def test4 do
    """
    %div{ class => main }
      %div{class = int1 }
      %div{class = int2, id = int22 }
    """
  end

Next point is - generator

@pap
Copy link
Contributor

pap commented Jan 31, 2014

@0xAX take a look at this gist ... i used Exhaml to parse a haml file i use in one of my rails apps.

https://gist.github.com/pap/74575d2f451be5e26a6f

There are a few issues ...

You based your work on the original haml code ?
I've cloned it and will take a look at it ...
By compile haml you mean take haml input parse it and output html right ?

@0xAX
Copy link
Member Author

0xAX commented Jan 31, 2014

Thanks, will check it.

By compile haml you mean take haml input parse it and output html right ?

No i mean convery haml code to the internal elixir-terms based structure and only than to html

@0xAX
Copy link
Member Author

0xAX commented Jan 31, 2014

@pap Hard to read. Can you give me please your plain HAML code from gist

@pap
Copy link
Contributor

pap commented Jan 31, 2014

@0xAX about the html comments:

=# this is haml commented
-# this is also haml commented

You plan to output commented html right ?

@0xAX
Copy link
Member Author

0xAX commented Jan 31, 2014

@pap,yes i know, now there is only -# support in parser. Comments stills in structure after parsing, but removing in generation time

@pap
Copy link
Contributor

pap commented Jan 31, 2014

@0xAX
About the haml source:
Sorry for the poor formatting ... you can read it here
https://gist.github.com/pap/361bdea0f45e7b9690be

About comments:
I think we could use the - and = semantic ...
Comments in haml starting with -# should not output to html but if you comment with =# the comments should be added ...i know its probably a unneeded step since the generated html will only be seen in client ... but as a developer i might want the generated html to have some kind of info ... what's your thought on this ?

@0xAX
Copy link
Member Author

0xAX commented Jan 31, 2014

Thanks, i will look.

Current parser is not counting identations, so we can't know where comments are finish, so i decided to leave it in structure.

@pap
Copy link
Contributor

pap commented Jan 31, 2014

@0xAX what do you mean about not counting indentation?
I'll take a look but i think the general approach for the parser should be "parsing" each indented block.

%A 
    %a1
    %a2
        a2.1
%B
    %b1
        b1.1
    %b2

We should parse A into a structure, then B into another. Each level of indentation should be "nested" inside its "parent"

This is good because we can have "partials" rendered for example:

file main.html

%p
  %b
    Bold Title
  %i
    Italic content
  = render "test"

File _test.html (partial)

%h1
  Title

The result would be

%p
  %b
    Bold Title
  %i
    Italic content
  %h1
    Title

@pap
Copy link
Contributor

pap commented Feb 10, 2014

Hi @0xAX did you already took a look at this https://github.com/nurugger07/calliope ?

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

2 participants