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

Syntax code blocks lose indenting but keep colours in PDF #236

Closed
wolandscat opened this issue Jun 25, 2015 · 7 comments
Closed

Syntax code blocks lose indenting but keep colours in PDF #236

wolandscat opened this issue Jun 25, 2015 · 7 comments
Assignees
Labels

Comments

@wolandscat
Copy link

Code that is rendered correctly in the HTML output is coloured correctly (indicating that Pygments styling is occurring), but the indenting is lost in the PDF:

image

@mojavelinux
Copy link
Member

Aha! This is a tab issue. We convert spaces (to an internal PDF spacer character) but we do not current convert tabs. Therefore, the tabs get dropped.

This is related to asciidoctor/asciidoctor#1170. We can implement this feature ahead of core since it is handled by different code anyway. But that proposes the design we indent to implement.

@mojavelinux
Copy link
Member

A quickfix is to use spaces instead of tabs, but I do understand that it's necessary to support both.

@mojavelinux mojavelinux added this to the v1.5.0 milestone Jun 25, 2015
@mojavelinux mojavelinux self-assigned this Jun 25, 2015
@wolandscat
Copy link
Author

Using spaces does work, and that's pretty acceptable from my point of view. The confusing thing is when something renders the way you expect in HTML but not in the PDF.

@mojavelinux
Copy link
Member

The confusing thing is when something renders the way you expect in HTML but not in the PDF.

That's just life at the moment since these are two completely different worlds. We're doing our best to squash these differences so that you can think at the higher level of abstraction...and I believe we can achieve that for all but the rarest edge cases. We just have to keep throwing data at it so we can see the trouble spots light up.

@mojavelinux
Copy link
Member

I'm going to leave this issue open so that we normalize tabs, one way or another.

@wolandscat
Copy link
Author

It may be worth adding something to the Asciidoctor user guide here and/or here to say: use spaces to be sure of getting expected output, since noone can be sure how TABs might render.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 27, 2015
@mojavelinux
Copy link
Member

I decided to do this correctly by actually expanding tabs to spaces instead of simply replacing them. That means counting columns and expanding tabs to the number of spaces needed to fill the column in which the tab is used. Not only will the spaces be preserved, it will now be possible to use tabs to align output into columns (such as the output of a command or otherwise tab-separated data).

Unfortunately, things are going to be a bit weird before Asciidoctor 1.5.3 if you're using the indent attribute. The indent attribute triggers a replacement of tabs to spaces, but not with the expand logic (see https://github.com/asciidoctor/asciidoctor/blob/v1.5.2/lib/asciidoctor/parser.rb#L2632). Therefore, you may get mixed and unexpected behavior. If you aren't using the indent attribute, you won't be affected.

The good news is now I know how to solve asciidoctor/asciidoctor#1170 properly.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 27, 2015
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 28, 2015
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 29, 2015
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 29, 2015
…ize attribute

- expand tabs to spaces using proper tab expansion logic
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 29, 2015
…ize attribute

- expand tabs to spaces using proper tab expansion logic
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 29, 2015
…ize attribute

- expand tabs to spaces using proper tab expansion logic
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 29, 2015
…ize attribute

- expand tabs to spaces using proper tab expansion logic
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 29, 2015
…ize attribute

- expand tabs to spaces using proper tab expansion logic
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 29, 2015
…ize attribute

- expand tabs to spaces using proper tab expansion logic
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 29, 2015
…ize attribute

- expand tabs to spaces using proper tab expansion logic
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 29, 2015
…ize attribute

- expand tabs to spaces using proper tab expansion logic
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 29, 2015
…ize attribute

- expand tabs to spaces using proper tab expansion logic
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 5, 2015
…ize attribute

- expand tabs to spaces using proper tab expansion logic
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- expand tabs to spaces using proper tab expansion logic
- skip tab expansion if already performed by Asciidoctor core
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- expand tabs to spaces using proper tab expansion logic
- skip tab expansion if already performed by Asciidoctor core
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- expand tabs to spaces using proper tab expansion logic
- skip tab expansion if already performed by Asciidoctor core
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- expand tabs to spaces using proper tab expansion logic
- skip tab expansion if already performed by Asciidoctor core
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- expand tabs to spaces using proper tab expansion logic
- skip tab expansion if already performed by Asciidoctor core
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- expand tabs to spaces using proper tab expansion logic
- skip tab expansion if already performed by Asciidoctor core
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- expand tabs to spaces using proper tab expansion logic
- skip tab expansion if already performed by Asciidoctor core
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- expand tabs to spaces using proper tab expansion logic
- skip tab expansion if already performed by Asciidoctor core
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- expand tabs to spaces using proper tab expansion logic
- skip tab expansion if already performed by Asciidoctor core
- use simpler logic if lines only have tab indentation
- use zero-width space to guard start of line instead of no-break space
- add a capabilities hash to tune behavior of converter
- remove preserve feature of layout_prose
- guard indentation after passing highlighting source
- add helper method to guard indentation in formatted text fragments
- add guard indentation logic to CodeRay Prawn encoder
mojavelinux added a commit that referenced this issue Jul 6, 2015
resolves #236 expand tabs to spaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants