epub import self referencing urls

19 views
Skip to first unread message

Michael Giesler

unread,
Feb 14, 2015, 4:56:21 PM2/14/15
to pressbooks
Hi,

right now the epub import doesn't handle self referencing links at all
(kneadHref() is an empty method). This leads to not working links
within the pressbooks book.

I need these links for footnotes and would like to use the [footnote]
markdown but I do not see a reasonable way to extract a single
footnote from the href'ed file.

So my solution is the following:
In epub201::kneadHref() I search for <a> tags with local href, I
replace it with a temporary unique string and store the href file and
the string in some variable.
After importing all epub files I can resolve all unique strings to
wordpress post ids and once again replace the unique string with the
correct final link.

Unfortunately I have to save the post contents once again after
initial saving but as far as I see we have to do it this way to get
the correct wordpress post ids.

I am not very familiar with the pressbooks code, so I hope that you
give me a hint if I miss something in my considerations. If I don't
hit heavier problems I would write the code within the next week and
do a pull request from my fork.

Best regards,
Michael Giesler
Reply all
Reply to author
Forward
0 new messages