05-08-2017, 03:31 AM | #1 |
Member
Posts: 16
Karma: 10
Join Date: Dec 2015
Device: sigil
|
[Plugin] reLink 1.0a : Link unspecified href to the right XHTML file.
Hello everyone !
I just want to share this plugin "edit" that Just find the XHTML source where the ID is from and replace the link by it's real path. Eg : Let's suppose that there is a <p id="myid001">Text</p> in Chapter003.xhtml. So the script find it and convert all link that point to it like this : Code:
<a href="#myid001">Text</a> Code:
<a href="../Text/Chapter003.xhtml#myid001"> EDIT : The plugin assumes that all fragment ids are unique, however, if multiple files contain the same id they'll all be changed to the last file that the id was used in. You can use the AddIDs by Doitsu to generate ID on your document if there is no ID in. Requirements : - Python 3.4 - BeautifulSoup 4 - Sigil 0.8.7 Version : 1.0a Thanks ! NB : Sorry, my english is poor And it's my first post. Last edited by hantsaniala; 05-22-2017 at 05:22 AM. Reason: Updating attachement. |
05-08-2017, 04:10 AM | #2 |
Grand Sorcerer
Posts: 5,611
Karma: 23187563
Join Date: Dec 2010
Device: Kindle PW2
|
Thanks for contributing this plugin!
I did a quick test and it appears that your plugin will prefix fragment ids with the file name if it can be found in any file. To make it even more useful, I'd recommend the following: 1. Add the following line to plugin.xml to automatically start the plugin: Code:
<autostart>true</autostart> 3. The plugin assumes that all fragment ids are unique, however, if multiple files contain the same id they'll all be changed to the last file that the id was used in. |
Advert | |
|
05-20-2017, 09:27 AM | #3 | |
Junior Member
Posts: 4
Karma: 10
Join Date: May 2017
Device: kindle
|
Quote:
not work plugin Status: failed Traceback (most recent call last): File "C:\Program Files\Sigil\plugin_launchers\python\launcher.py", line 134, in launch target_script = __import__(script_module) File "C:\Users\com106\AppData\Local\sigil-ebook\sigil\plugins\reLink\plugin.py", line 4, in <module> from bs4 import BeautifulSoup ImportError: No module named 'bs4' Error: No module named 'bs4' Please suggest |
|
05-20-2017, 10:11 AM | #4 |
Grand Sorcerer
Posts: 27,621
Karma: 194727102
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Either configure Sigil's Plugin manager to use an external Python interpreter with the BeautifulSoup module installed, or convince the plugin author to modify the plugin to use Sigil's own sigil_bs4 module if it's present (sigil_bs4 has been available to Sigil plugins since v0.8.900).
The easiest "fix" would be to change line 4 of plugin.py from: Code:
from bs4 import BeautifulSoup Code:
try: from sigil_bs4 import BeautifulSoup except: from bs4 import BeautifulSoup Last edited by DiapDealer; 05-20-2017 at 10:21 AM. |
05-22-2017, 05:21 AM | #5 | |
Member
Posts: 16
Karma: 10
Join Date: Dec 2015
Device: sigil
|
I've updated the pulgin as Doitsu and DiapDealer said.
Quote:
Thanks for the help bro. |
|
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
table of content file link not add in toc.ncx file | bhambhu | Conversion | 0 | 01-14-2016 01:40 AM |
XHTML file limit? | BobK99 | Sigil | 4 | 03-08-2013 05:38 AM |
How to link to a XHTML Table in a epub. | ebookn00b | ePub | 5 | 06-05-2012 12:35 PM |
ncx file to html/xhtml file | javochase | Conversion | 1 | 06-23-2011 06:57 PM |
xhtml file name change | bobcdy | Sigil | 11 | 10-23-2010 12:05 AM |