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

Add an annotate stage and more options #1

Open
TimothyGu opened this issue Oct 5, 2015 · 0 comments
Open

Add an annotate stage and more options #1

TimothyGu opened this issue Oct 5, 2015 · 0 comments

Comments

@TimothyGu
Copy link
Member

This module is getting messy. It would help if we have a separate annotation stage for choosing the layout of a block.

For example, for the following source we can generate all sorts of blocks. Depending on user-supplied options and possibility we should annotate the blocks with properties that help doing such things.

div
  p
    | hey #[strong text]
div
  p
    | two line
    | text

Base output (all options at false):

div
  p hey #[strong text]
div
  p
    | two line
    | text
  1. aggressive inlining (unrelated to performance)

    div
      p hey #[strong text]
    div
      p two line
        | text
  2. use block expansion for a block

    div: p: hey #[strong text]
    div: p
      | two line
      | text
  3. use dot

    div
      p.
        hey #[strong text]
    div
      p.
        two line
        text
  4. And any combination thereof:

    (dot and expansion)

    div: p: | hey #[strong text]
    div: p.
      two line
      text

    (inlining and expansion)

    div: p hey #[strong text]
    div: p two line
      | text

A propose to have the following defaults:

  • block expansion: auto: only when there is only one node and one level of node and if the lowest level is text, it has only one line. so

    div
      p
        strong
          | hey
    div
      p
        strong
          | multi
          | strong
    div
      div
        p multi
        p line
    div
      p
        img

    turns into

    div
      p: strong hey
    div
      p
        strong
          | multi
          | strong
    div
      div
        p multi
        p line
    div
      p: img
  • aggressive inlining: false as it looks ugly

  • dot: auto: use the current heuristics that I believe it works well enough: use dot syntax when there's nothing besides buffered code and text, and (number of whole lines of code)/(total lines) < 0.35

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

1 participant