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

meta elements (except cover) not supported in metadata.xml #5098

Closed
jeffmcneill opened this issue Nov 25, 2018 · 15 comments
Closed

meta elements (except cover) not supported in metadata.xml #5098

jeffmcneill opened this issue Nov 25, 2018 · 15 comments

Comments

@jeffmcneill
Copy link

jeffmcneill commented Nov 25, 2018

It appears that meta elements (except for the cover) do not appear to be supported in metadata.xml. See: #269 similar issue.

Specifically, I am trying to add the popular calibre:series and calibre:series_index tags: These are not pulled into the content.opf file when generating an epub. Is there a different process I should be using to include these meta tags (YAML file or something else)?

Pandoc version: 1.17.2~dfsg-3

Meta tags included in metadata.xml, which do not appear in content.opf:

<meta name="calibre:series" content="Classics on War and Politics"/>
<meta name="calibre:series_index" content="2.0"/>
@jgm
Copy link
Owner

jgm commented Nov 25, 2018

As the documentation for --epub-metadata says, "The file should contain a series of Dublin Core elements" (dc: namespace). Other elements, including things in a calibre namespace, are ignored.

@jgm
Copy link
Owner

jgm commented Nov 25, 2018

OK, looking at https://www.eboundcanada.org/Resources/whats-in-an-epub-the-opf-file/ I see that meta elements are sometimes included in content.opf. I didn't know this. It shouldn't be too hard to modify pandoc to include them too. Note that you're using an ancient version of pandoc.

@jgm
Copy link
Owner

jgm commented Nov 25, 2018

I misremembered. We actually parse the metadata into a structured EPUBMetadata type, which defines the metadata that get put in content.opf. We could probably address this by adding a field for generic custom metadata like this.

@jgm jgm closed this as completed in 743d1b3 Nov 25, 2018
@jeffmcneill
Copy link
Author

I really appreciate the speedy responses and fix. I'm a big fan of your software. Is there a way to incorporate these latest changes into the 2.4 release? I've tried various ways of compiling from source but no joy. I can of course wait until the next release. I'm on Debian (and I have updated to the most recent Github release, thanks for pointing that out).

@mb21
Copy link
Collaborator

mb21 commented Nov 25, 2018

@jeffmcneill you can try the unofficial nightly builds.

@jeffmcneill
Copy link
Author

@mb21 nightly worked a charm :)

@jeffmcneill
Copy link
Author

I'm trying to put all the metadata in a YAML header instead of a metadata.xml file. This seems to work for everything except for the Calibre meta tags as mentioned above in this original issue. Is there any way to get these kinds of tags into the YAML header of a markdown file? Note that I generate PDF and Epub from this file.

<meta name="calibre:series" content="Classics on War and Politics"/>
<meta name="calibre:series_index" content="2.0"/>

@mb21
Copy link
Collaborator

mb21 commented Oct 31, 2019

Can you post the YAML you tried?

@jgm
Copy link
Owner

jgm commented Oct 31, 2019

Try

---
calibre:
   series: Classics on War and Policitics
---

I just tried it and it worked.

@jeffmcneill
Copy link
Author

jeffmcneill commented Oct 31, 2019

Works for me, thanks!

calibre: 
  series: Children's Classics
  series_index: 1.0

@YannKervran
Copy link

YannKervran commented Mar 30, 2021

Sorry to make this thread alive after a long time, but I wanted to check I have not missed something before making a possible Issue message.

Following the instructions here, I have included in the YAML preamble of my markdown text

---
schema:
   accessMode: textual
---

in the hope I would get
<meta property="schema:accessMode">textual</meta>
in the resulting content.opf in my epub file, but it seems it doesn’t work.

Is there something I have misunderstood ?

Edit : I forgot to say that my intent is to include Accessibility Metadata

@jgm
Copy link
Owner

jgm commented Mar 30, 2021

The manual contains a list of the fields that are recognized in epub metadata:
https://pandoc.org/MANUAL.html#epub-metadata

@YannKervran
Copy link

Thank you very much for your answer (and this marvelous engine)
And yes, I have seen this part in the Documentation, but as the calibre fields are not specified, I was wondering why it accepts it and not mine. (as I am not native English speaker I can miss something).

@davidlday
Copy link

The manual contains a list of the fields that are recognized in epub metadata: https://pandoc.org/MANUAL.html#epub-metadata

@jgm Unless I missed something, I don't think the manual does contain them all. I see in the code epubCalibreFields but I don't see any mention of calibre fields in the manual, as @YannKervran pointed out. I potentially have a need for the accessibility metadata as well, and at first read this thread made me think I could just add them and have them get picked up, since that's what appears to happen with calibre fields. It's not, though, correct? Would the accessibility fields need coded in as well?

Just trying to confirm before I start looking at putting a PR together. Thank you!

@jgm
Copy link
Owner

jgm commented Oct 5, 2021

@davidlday yes, it needs to be coded in ... we want to make sure that we don't generate invalid EPUBs, so all the metadata must be representable in the EPUBMetadata record.
(Also, it wouldn't hurt to update the manual.)
The clauses at line 259 and around 981 would also need to be updated (this is really ugly code anyway and something more elegant could be done).

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

5 participants