Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 11-10-2016, 05:41 PM   #1
Dalcyks
Junior Member
Dalcyks doesn't litterDalcyks doesn't litter
 
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
Dalcyks is offline   Reply With Quote
Old 11-10-2016, 08:38 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,843
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.
kovidgoyal is online now   Reply With Quote
Advert
Old 11-10-2016, 09:30 PM   #3
Dalcyks
Junior Member
Dalcyks doesn't litterDalcyks doesn't litter
 
Posts: 7
Karma: 110
Join Date: Nov 2016
Location: midatlantic USA
Device: Kindle Paperwhite 3
Quote:
Originally Posted by kovidgoyal View Post
calibre has no support for random markdown extensions. The help for the markdown extensions option shows you the list of extensions calibre supports.
Thank you for your response!

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?
Dalcyks is offline   Reply With Quote
Old 11-11-2016, 01:23 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,843
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.
kovidgoyal is online now   Reply With Quote
Old 11-11-2016, 01:44 AM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,843
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.
kovidgoyal is online now   Reply With Quote
Advert
Old 11-11-2016, 01:48 AM   #6
Dalcyks
Junior Member
Dalcyks doesn't litterDalcyks doesn't litter
 
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.
Dalcyks is offline   Reply With Quote
Old 11-11-2016, 07:31 AM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,843
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
kovidgoyal is online now   Reply With Quote
Old 11-16-2016, 03:00 AM   #8
Dalcyks
Junior Member
Dalcyks doesn't litterDalcyks doesn't litter
 
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.
Dalcyks is offline   Reply With Quote
Old 11-16-2016, 03:04 AM   #9
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
1) yes
2) Both are pubdate. The date field in calibre is timestamp
kovidgoyal is online now   Reply With Quote
Reply

Tags
calibre, markdown, metadata


Forum Jump

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


All times are GMT -4. The time now is 08:20 AM.


MobileRead.com is a privately owned, operated and funded community.