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

Source code blocks are rendered without indentation in versions 1.5.0.beta.3 and 1.5.0.beta.4 #1258

Closed
BojanStipic opened this issue Sep 5, 2019 · 5 comments
Assignees
Milestone

Comments

@BojanStipic
Copy link

Source code blocks, such as this one:

[source,c]
----
int main() {
	lsp_event_loop();
	return 0;
}

void lsp_event_loop(void) {
	for(;;) {
		unsigned long content_length = lsp_parse_header(); //<1>
		cJSON *request = lsp_parse_content(content_length); //<2>
		json_rpc(request); //<3>
		cJSON_Delete(request); //<4>
	}
}
----

are rendered without indentation.

This is the rendered output:
image

It worked fine with 1.5.0.beta.2 and earlier versions, but is broken in 1.5.0.beta.3 and 1.5.0.beta.4.

My document is available in this repository, so you can take a look at it as an example. It can be compiled with make command.

@mojavelinux
Copy link
Member

It looks like the tab processing broke. Sigh. It has been a game of whack-a-mole to get this logic stabilized. I'll take a look. It just means we need more tests.

@mojavelinux
Copy link
Member

Can you tell me which version of Asciidoctor core you're using?

asciidoctor -v

(That matters since Asciidoctor PDF uses Asciidoctor).

@BojanStipic
Copy link
Author

Thank you for the quick response.
Sure, version is:

Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

I think it is a problem with asciidoctor-pdf specifically, because I downgraded to 1.5.0.beta.2 without touching Asciidoctor core and it started indenting again.

@mojavelinux
Copy link
Member

As a workaround, you can set the tabsize attribute on the document, which activates the same logic as before.

= Document Title
:tabsize: 4

content here

(You could also set it from the API or CLI).

@mojavelinux
Copy link
Member

Yes, I know the problem is with Asciidoctor PDF. I had made the assumption that core always replaces tabs, but that's not always true. And tabs must always be replaced in the PDF since PDF doesn't support tabs.

@mojavelinux mojavelinux self-assigned this Sep 5, 2019
@mojavelinux mojavelinux added this to the v1.5.0.beta.5 milestone Sep 5, 2019
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Sep 6, 2019
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants