ocsigen / tyxml

Build valid HTML and SVG documents
https://ocsigen.org/tyxml/
Other
167 stars 59 forks source link

IDEs and the ppx #122

Open Drup opened 8 years ago

Drup commented 8 years ago

Editing html with the ppx is ... a bit annoying.

(See here for what the syntax looks like)

AltGr commented 8 years ago

I am not sure what you expect for indentation. Recent ocp-indent supports ppx, and doesn't make assumptions about the contents of string quotations (i.e. they're indented as <:quot< >> used to be: if starting with a newline, indentation is completely free and preserved by ocp-indent; otherwise, it's preserved but a minimum left margin corresponding to the first non-blank character is enforced)

Drup commented 8 years ago

it's preserved but a minimum left margin corresponding to the first non-blank character is enforced

That's the main issue. The string delimiters are placed a bit all over the place (since they are used as antiquotations..).

Consider this:

let%html my_paragraphs = {|
  <p>|}[my_span]{|</p>
  <p>more content</p>
|}
Chris00 commented 8 years ago

In Tuareg, strings split on several lines are aligned with the opening {|. I am not sure what general rule you would propose. Why don't you write the above as:

let%html my_paragraphs =
  {|<p>|}[my_span]
    {|</p><p>more content</p>|}
Drup commented 8 years ago

The goal is to format the inside of the quotation like you would format html.

AltGr commented 8 years ago

@Drup so for you it would be best to follow the don't-touch rule whether the {| string starts with a newline or not ?

Drup commented 8 years ago

I think it would be better yes.