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

role attribute in DocBook <phrase> elements not picked up #7195

Closed
bigsmoke opened this issue Apr 1, 2021 · 7 comments
Closed

role attribute in DocBook <phrase> elements not picked up #7195

bigsmoke opened this issue Apr 1, 2021 · 7 comments

Comments

@bigsmoke
Copy link
Contributor

bigsmoke commented Apr 1, 2021

pandoc 2.13 doesn't pick up role attributes from <phrase> elements. Looking at DocBook.hs line 1076 it appears to my non-Haskell-savvy brain that pandoc wrongly looks for a <phrase class> instead of the <phrase role> attribute.

Gentle reminder: DocBook generally uses role where for example HTML uses class.

Thank you for this great product, by the way!

@jgm
Copy link
Owner

jgm commented Apr 3, 2021

Sure, I'll make the change. Pinging @mboes (#6438) to make sure there's nothing I'm overlooking.

@jgm jgm closed this as completed in 935d107 Apr 3, 2021
@Thoma5
Copy link

Thoma5 commented Apr 6, 2021

@jgm if phrase is already picked up and now even the role attribute, isn't this a step towards the solution of #3657?

@jgm
Copy link
Owner

jgm commented Apr 6, 2021

Well, you can use a filter to intercept Span elements with the desired class and add custom-style attributes accordingly. That is very flexible and doesn't presuppose any particular mapping of docbook roles to docx custom styles.

@bigsmoke
Copy link
Contributor Author

Thanks a lot for addressing this, and so quickly too! 😄

@de103252
Copy link

Quite new to Pandoc and to Haskell, so bear with me. I am trying to apply a custom paragraph style for Docbook block elements that have a role attribute. For inline elements such as "phrase", this works: I can intercept the Span and can add the custom style (as soon as I have grokked Lua, that is).

For block elements, however, it does not work. The parseMixed function does not care about the Docbook "role" attribute, as far as I can tell without really understanding the Haskell code.
If it did work, it would in fact solve #3657, I believe?! The problem addressed there is precisely the one I am trying to solve myself.

Thanks!

@jgm
Copy link
Owner

jgm commented Sep 20, 2023

If there is a particular block-level element for which you'd like role to be parsed as class, we could do that, provided the corresponding pandoc Block element actually has a slot for attributes. (Only some do.)
Div is a generic block container that can take attributes, so if there were something like <div> in docbook, which would be like <phrase> but for block-level content, we could implement this for that.

In any case best to request this in a new issue (with a pointer to this one).

@de103252
Copy link

Thanks @jgm for the quick reply. Actually, my Docbook in turn is the output of AsciiDoctor so I don't have freedom in choosing the elements. In my case, I'm dealing with a simpara element, which is "A paragraph that contains only text and inline markup, no block elements."
Not being Haskell savvy, I don't yet grok what you mean by "the corresponding pandoc Block element actually has a slot for attributes". Anyway, I will open a new issue as suggested, in the hope I can phrase it in a way that makes sense.

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

4 participants