mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
TXT Output: Basic Markdown formatted output.
This commit is contained in:
parent
88a60c1610
commit
04e3ba0e81
@ -8,6 +8,7 @@ import os
|
|||||||
|
|
||||||
from calibre.customize.conversion import OutputFormatPlugin, \
|
from calibre.customize.conversion import OutputFormatPlugin, \
|
||||||
OptionRecommendation
|
OptionRecommendation
|
||||||
|
from calibre.ebooks.txt.markdownml import MarkdownMLizer
|
||||||
from calibre.ebooks.txt.txtml import TXTMLizer
|
from calibre.ebooks.txt.txtml import TXTMLizer
|
||||||
from calibre.ebooks.txt.newlines import TxtNewlines, specified_newlines
|
from calibre.ebooks.txt.newlines import TxtNewlines, specified_newlines
|
||||||
|
|
||||||
@ -44,10 +45,17 @@ class TXTOutput(OutputFormatPlugin):
|
|||||||
recommended_value=False, level=OptionRecommendation.LOW,
|
recommended_value=False, level=OptionRecommendation.LOW,
|
||||||
help=_('Force splitting on the max-line-length value when no space '
|
help=_('Force splitting on the max-line-length value when no space '
|
||||||
'is present. Also allows max-line-length to be below the minimum')),
|
'is present. Also allows max-line-length to be below the minimum')),
|
||||||
|
OptionRecommendation(name='markdown_format',
|
||||||
|
recommended_value=False, level=OptionRecommendation.LOW,
|
||||||
|
help=_('Produce Markdown formatted text.')),
|
||||||
])
|
])
|
||||||
|
|
||||||
def convert(self, oeb_book, output_path, input_plugin, opts, log):
|
def convert(self, oeb_book, output_path, input_plugin, opts, log):
|
||||||
writer = TXTMLizer(log)
|
if opts.markdown_format:
|
||||||
|
writer = MarkdownMLizer(log)
|
||||||
|
else:
|
||||||
|
writer = TXTMLizer(log)
|
||||||
|
|
||||||
txt = writer.extract_content(oeb_book, opts)
|
txt = writer.extract_content(oeb_book, opts)
|
||||||
|
|
||||||
log.debug('\tReplacing newlines with selected type...')
|
log.debug('\tReplacing newlines with selected type...')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user