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

Code markup using backticks not right #460

Closed
gdamore opened this issue Jan 2, 2020 · 7 comments · Fixed by #466
Closed

Code markup using backticks not right #460

gdamore opened this issue Jan 2, 2020 · 7 comments · Fixed by #466
Assignees
Labels
Milestone

Comments

@gdamore
Copy link
Collaborator

gdamore commented Jan 2, 2020

I have markup for literals as VALUE -- for example:

`NNG_ESTATE`

This should render as

<code>NNG_ESTATE</code>

But it passes through with the backticks untransformed.

@xcoulon
Copy link
Member

xcoulon commented Jan 4, 2020

thanks for reporting this issue, @gdamore I'll look into it

@xcoulon xcoulon self-assigned this Jan 4, 2020
@xcoulon xcoulon added this to the v0.3.0 milestone Jan 4, 2020
@xcoulon
Copy link
Member

xcoulon commented Jan 4, 2020

@gdamore I just tried with the latest version of libasciidoc, using the following content in a file:

> cat tmp/test.adoc 
`NNG_ESTATE`

> libasciidoc -o - tmp/test.adoc 
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="libasciidoc">
<title></title>
</head>
<body class="article">
<div id="header">
<h1></h1>
</div>
<div id="content">
<div class="paragraph">
<p><code>NNG_ESTATE</code></p>
</div>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2020/01/04 18:34:17 CET
</div>
</div>
</body>
</html>

would you have an example of content in which the backsticks are not detected, please?

@gdamore
Copy link
Collaborator Author

gdamore commented Jan 4, 2020

Probably because it's nested in other markup.

Here's the source document: https://github.com/nanomsg/nng/blob/master/docs/man/nng_setopt.3.adoc

(There are many documents in that tree -- what I was doing was testing if I could use libasciidoc instead of the asciidoctor toolchain to publish my HTML markup -- the bugs you see are the results of diff'ing the output between asciidoctor and libasciidoc. I only tried this one sample page, and the results were different enough for me to decide to file bugs and wait for fixes before I try again.)

(As an aside, I'm also extremely interested in having versions of this that can generate other output formats -- the NNG reference manual is currently generated using a modified version of asciidoctor-pdf but I'm not a ruby developer, and the results are somewhat unsatisfactory. I'd feel better tackling this in Go if I could.)

@xcoulon
Copy link
Member

xcoulon commented Jan 5, 2020

Probably because it's nested in other markup.

Here's the source document: https://github.com/nanomsg/nng/blob/master/docs/man/nng_setopt.3.adoc

(There are many documents in that tree -- what I was doing was testing if I could use libasciidoc instead of the asciidoctor toolchain to publish my HTML markup -- the bugs you see are the results of diff'ing the output between asciidoctor and libasciidoc. I only tried this one sample page, and the results were different enough for me to decide to file bugs and wait for fixes before I try again.)

Great, thanks for pointing me to this doc, this will be very helpful in fixing the bugs.
I understand your concerns and I'll work on fixing all the diffs ;)

(As an aside, I'm also extremely interested in having versions of this that can generate other output formats -- the NNG reference manual is currently generated using a modified version of asciidoctor-pdf but I'm not a ruby developer, and the results are somewhat unsatisfactory. I'd feel better tackling this in Go if I could.)

I have not started working on other outputs yet, to be honest. But the result of the parsing is an AST that is converted into HTML, so I guess it should be possible to plug another renderer to get a PDF output for example.

xcoulon added a commit to xcoulon/libasciidoc that referenced this issue Jan 5, 2020
xcoulon added a commit that referenced this issue Jan 5, 2020
#466)

Modify the grammar to include a new rule to parse the labeled list item term to find footnotes, images, links and quoted text, but only when processing the draft document into the final document. The draft document will still have a "raw" string term, to keep the parsing of the whole document fast.

Fixes #456
Fixes #460

Signed-off-by: Xavier Coulon <[email protected]>
@xcoulon
Copy link
Member

xcoulon commented Jan 6, 2020

@gdamore I've fixed the 3 issues you reported but I also opened #469, #470 and #473 to address the remaining diffs compared to the output produced by Asciidoctor on https://github.com/nanomsg/nng/blob/master/docs/man/nng_setopt.3.adoc. Once these 3 extra issues are fixed, the output should be identical ;)

@xcoulon
Copy link
Member

xcoulon commented Jan 12, 2020

@gdamore I fixed all the issues you reported, plus the 3 other ones I opened when comparing the doc generated by Asciidoctor vs libasciidoc.
The outputs are now almost identical, the only remaining difference is around the usage of index terms:

(((options, socket)))
The `nng_setopt()` functions are used to configure options for
the socket _s_.

Asciidoctor generates the following output:

<div class="paragraph">
<p>
The <code>nng_setopt()</code> functions are used to configure options for
the socket <em>s</em>.</p>
</div>

whereas libasciidoc does not begin the paragraph with an empty line:

<div class="paragraph">
<p>The <code>nng_setopt()</code> functions are used to configure options for
the socket <em>s</em>.</p>
</div>

I believe that this does not affect the rendering in the browser, and I also think it's cleaner without this blank line.

Please don't hesitate to open other issues if you find some bugs or missing features!

@gdamore
Copy link
Collaborator Author

gdamore commented Jan 21, 2020

Thanks very much for this work. I'm going to have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants