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

DocBook Reader doesn't seem to parse elements within "code" xml #1449

Closed
bexelbie opened this issue Jul 23, 2014 · 3 comments
Closed

DocBook Reader doesn't seem to parse elements within "code" xml #1449

bexelbie opened this issue Jul 23, 2014 · 3 comments

Comments

@bexelbie
Copy link

elements such as <screen> can contain other elements such as <command>. These inner elements appear to be ignored.

All of these elements are calling codeWithLang and that doesn't appear to account for nested tags.

What led me to the above conclusion was that code like this

<screen>
]# <command>ls</command>
</screen>

results in (in this case html, but I've tried odt as well with similar results)

<pre><code>~]# 
            </code></pre>

The inner block is gone.

@jgm
Copy link
Owner

jgm commented Jul 23, 2014

Pandoc's document model doesn't allow structure in code blocks. But we should at least extract the string content of these inner tags, recursively.

@jgm jgm closed this as completed in 9c3f768 Jul 23, 2014
@bexelbie
Copy link
Author

Why does pandoc not allow markup within code blocks? I believe some of the output formats, such as html, support it. In an idea world wouldn't it be the Writer's job to dump the inner tags that it can't support while preserving their content.

(This is similar to the issue with the odt writer dumping markdown that uses the pre html tag without preserving the string content)

mpickering pushed a commit to mpickering/pandoc that referenced this issue Jul 25, 2014
Of course, we can't include structure in the code block, but
this way we at least preserve the text.  Closes jgm#1449.
@jgm
Copy link
Owner

jgm commented Jul 28, 2014

+++ bcexelbi [Jul 24 14 01:30 ]:

Why does pandoc not allow markup within code blocks? I believe some of
the output formats, such as html, support it. In an idea world wouldn't
it be the Writer's job to dump the inner tags that it can't support
while preserving their content.

In an ideal world, perhaps. And adding additional structure to the
CodeBlock type could be considered in the future. But such changes
would require a lot of changes to the code (they would affect all the
writers and readers, and they would make writing filters much less
straightforward). Not many formats allow structure inside code blocks,
and those that do vary widely in the kind of structure they allow.

Pandoc tries to find a happy medium, in its representation of documents,
between simplicity and expressiveness. (Not the "least common
denominator," but not far from that.)

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

2 participants