11-10-2016, 05:41 PM | #1 |
Junior Member
Posts: 7
Karma: 110
Join Date: Nov 2016
Location: midatlantic USA
Device: Kindle Paperwhite 3
|
Markdown Metadata
I am trying to use Markdown-tagged TXT files (.MD) as input to Calibre. These I want to convert, ultimately to Kindle PW3, but I'll settle for ePub. The problem I'm having is that the metadata in the .MD doesn't seem to be reading into Calibre properly.
My desired outcome is to (1) populate the Calibre metadata fields with the values in the .MD, and (2) be able to include metadata values in the converted ePub. Neither of which seem to be working. Here is my test-flow... I created a TEST.MD file containing the following 9 lines (copied from the Metadata Extension doc): Title: My Document Summary: A brief description of my document. Authors: Waylan Limberg John Doe Date: October 2, 2007 blank-value: base_url: http://example.com <blank line> This is the first paragraph of the document. Calibre Preference settings: [Preferences - Input Options - TXT Input -] Paragraph Style: auto Formatting Style: markdown Markdown - Meta: checked all other options: unchecked [Preferences - Common Options - Structure Detection -] Insert Metadata as page at start of book: checked [Preferences - Adding Books - The Add Process -] Read Metadata from File Contents rather than file name: checked Procedure: 1) restarted Calibre (to be sure settings "took") 2) 'Calibre - Add Books' for the TEST.MD file 3) I note: at this point, Calibre metadata fields contain all default values. They were not automatically changed by the 'Add Book' (would have been nice). 4) In Calibre, I set Author, Tags, and Publisher metadata values to the word 'test'. 5) 'Calibre - Edit Metadata' (clicking the MD format, then clicking the 'Set metadata for the book from the selected format' icon). 6) Calibre metadata values do not change to those in TEST.MD. 7) 'Calibre - Convert Books' (MD to EPUB). 8) I note: The in-file metadata lines are NOT included in the ePub as text/paragraphs (this implies that they were actually recognized as something special). 9) I note: NO 'Insert Metadata as page at start of book' page was created in the ePub (this should have worked regardless of the metadata values). 10) 'Calibre - Convert Books' (MD to MOBI). 11) Same results as the ePub, except a final blank page was included (as viewed with the Calibre viewer). Any idea what I might be missing? Calibre 2.70[64 bit] / Win7 |
11-10-2016, 08:38 PM | #2 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibre has no support for random markdown extensions. The help for the markdown extensions option shows you the list of extensions calibre supports.
|
Advert | |
|
11-10-2016, 09:30 PM | #3 | |
Junior Member
Posts: 7
Karma: 110
Join Date: Nov 2016
Location: midatlantic USA
Device: Kindle Paperwhite 3
|
Quote:
I see the the "Meta" extension listed in both the help link you mentioned and in the 'checkable' option box above it. It was from the help text for that extension that I copy-n-pasted the test file contents I used. Are you saying that even if it's in that list, it may be considered a 'random extension' and thus actually unsupported? |
|
11-11-2016, 01:23 AM | #4 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Ah, I had no idea that extension was included in the markdown standard library.
I have no idea what that extension does, in fact, I dont see how it could possibly work, since all markdown extensions do is change the html generated from the input txt and html has no standard for metadata. Indeed, reading https://pythonhosted.org/Markdown/ex...meta_data.html the page says it does not do anything. So if you want support for metadata in markdown, you'd have to modify the calibre txt input plugin to make use of the metadata read by that extension. |
11-11-2016, 01:44 AM | #5 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Another approach is to get that extension to output dublin core metadata into the generated html, which will be read by calibre.
|
Advert | |
|
11-11-2016, 01:48 AM | #6 |
Junior Member
Posts: 7
Karma: 110
Join Date: Nov 2016
Location: midatlantic USA
Device: Kindle Paperwhite 3
|
OK, that now makes sense! I was wondering why it did remove those lines from the conversion input stream, but it not affect the books metadata values. It is the input plugin being unaware of the extension. Thank you.
|
11-11-2016, 07:31 AM | #7 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
This should do the trick for the basic metadata fields:
https://github.com/kovidgoyal/calibr...1937b71a2be8c9 |
11-16-2016, 03:00 AM | #8 |
Junior Member
Posts: 7
Karma: 110
Join Date: Nov 2016
Location: midatlantic USA
Device: Kindle Paperwhite 3
|
Kovid, Thank you very much for that. I look forward to the next build! With this being the first time I've actually looked at Python code, I have a couple of curiosities:
1) It appears (new line 141 in processor.py) that the 5-star rating is kept internally as a value 0 to 10. Is that true? 2) Will this distinguish between the "date" and "pubdate" as separate metadata fields or are both labels synonymous with "pubdate" (lines 127,130 in processor.py). Thanks again for the feedback and the fixes. |
11-16-2016, 03:04 AM | #9 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
1) yes
2) Both are pubdate. The date field in calibre is timestamp |
Tags |
calibre, markdown, metadata |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
markdown-calibre | signum | Calibre | 8 | 12-31-2014 07:25 PM |
Multimarkdown instead of markdown | anywho | Calibre | 15 | 08-13-2013 09:20 PM |
markdown-calibre | bobb40 | Conversion | 1 | 07-08-2011 12:02 PM |
->Txt+Markdown | Perkin | Calibre | 2 | 12-11-2010 04:04 AM |
Markdown editor | user_none | Workshop | 0 | 08-30-2009 09:25 PM |