04-17-2020, 04:38 AM | #1 |
Zealot
Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
|
[Conversion Output] Markdown Output. Test and seek for help.
I create a Markdown Output plugin. This is nothing new, just the function of TXT Output plugin with txt_output_formatting=markdown, and keep_links=True, keep_image_references=True in default. keep_color have been removed for it is a function in textile. I create this, so that I don't need to set them and rename .txt to .md everytime.
I think this can work, but I still have some questions.
|
04-17-2020, 05:07 AM | #2 |
Zealot
Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
|
And, by the way. I think let build-in plugins the same as outer plugin is a better idea. Now they cannot be removed and hard to change.
|
04-17-2020, 06:00 AM | #3 |
creator of calibre
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
1. yes
2. You implement gui_configuration_widget() in your plugin |
04-17-2020, 09:44 AM | #4 | |
Zealot
Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
|
Quote:
I update this plugin. Now it has gui in convert. And now it has more questions. 1. It can convert to Markdown when I use ebook-convert.exe try.epub .md but when I use gui, it prints calibre, version 4.12.0 (win32, embedded-python: True) Conversion error: Failed: Convert book 1 of 1 (***) Convert book 1 of 1 (***) Failed to initialize plugin: u'C:\\Users\\LJT\\AppData\\Roaming\\calibre\\plugi ns\\Markdown Output.zip' Python function terminated unexpectedly No plugin to handle output format: md (Error Code: 1) Traceback (most recent call last): File "site.py", line 114, in main File "site.py", line 88, in run_entry_point File "site-packages\calibre\utils\ipc\worker.py", line 209, in main File "site-packages\calibre\gui2\convert\gui_conversion.py", line 43, in gui_convert_override File "site-packages\calibre\gui2\convert\gui_conversion.py", line 25, in gui_convert File "site-packages\calibre\ebooks\conversion\plumber.py", line 758, in __init__ ValueError: No plugin to handle output format: md 2. I can see gui in convert widget like image_8.png. How to remove formatting and keep text color? 3. Preference->Output options do not have markdown output. What can I do? |
|
04-17-2020, 10:11 AM | #5 |
creator of calibre
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Thats because your plugin is failing initialization
Failed to initialize plugin: u'C:\\Users\\LJT\\AppData\\Roaming\\calibre\\plugi ns\\Markdown Output.zip' |
04-17-2020, 10:15 AM | #6 |
Zealot
Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
|
|
04-17-2020, 10:18 AM | #7 |
creator of calibre
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Run calibre in debug mode (right click preferences button) and you will get more information
|
04-17-2020, 10:42 AM | #8 | ||
Zealot
Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
|
Quote:
Code:
for zfp in list(external_plugins) + builtin_plugins: try: if not isinstance(zfp, type): # We have a plugin name pname = zfp zfp = os.path.join(plugin_dir, zfp+'.zip') if not os.path.exists(zfp): zfp = external_plugins[pname] try: plugin = load_plugin(zfp) if not isinstance(zfp, type) else zfp except PluginNotFound: continue if perf: st = time.time() plugin = initialize_plugin(plugin, None if isinstance(zfp, type) else zfp) if perf: times[plugin.name] = time.time() - st _initialized_plugins.append(plugin) except: print('Failed to initialize plugin:', repr(zfp)) traceback.print_exc() if DEBUG: traceback.print_exc() Quote:
Last edited by The_book; 04-17-2020 at 10:45 AM. |
||
04-17-2020, 10:52 AM | #9 |
creator of calibre
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Move your import
at calibre_plugins.markdown_output.ui", line 1, in <module> to inside the function where it is actually used. |
04-17-2020, 11:03 AM | #10 |
Zealot
Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
|
Thanks. Now it works well. I update it.
|
04-18-2020, 09:23 AM | #11 |
Zealot
Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
|
By adding
Code:
class TXTUIForm(Ui_Form): def setupUi(self, Form): super(TXTUIForm, self).setupUi(Form) def delete(layout, widget): layout.removeWidget(widget) widget.deleteLater() delete(self.gridLayout,self.label_4) delete(self.gridLayout,self.opt_txt_output_formatting) delete(self.verticalLayout,self.opt_keep_color) |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Conversion Output] KFX Output | jhowell | Plugins | 1493 | 03-21-2024 09:34 AM |
[Conversion Output] KePub Output Plugin | jgoguen | Plugins | 551 | 07-18-2023 06:22 AM |
Adding TOC anchor links to Markdown/TXT output | maf_jclark | Conversion | 2 | 01-17-2014 10:20 PM |
Unexpected output from Markdown conversion to ePub | Agama | Conversion | 5 | 11-25-2012 08:58 AM |
Test oeb2mobi output for me? | llasram | Kindle Formats | 60 | 01-08-2009 02:13 PM |