View Full Version : epub and longs urls


irc
08-24-2010, 05:43 PM
Hi,

I am having a problem getting a list of references to read correctly on an ereader. They are URLs and the ones that are long are getting cut-off and not wrapping to the next line. This is the script and wonder if anyone has any suggestions. Many thanks.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>sourcedocuments</title>
<link href="stylesheet.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div>
<span id="C1F13"></span><a href="toc.xhtml#FTOC13">Table of Contents</a>
<h1>SOURCE DOCUMENTS</h1>
<p>Concept Document for the Transnational Qualifications Framework for Small States of the Commonwealth. SAQA and COL. 2008.</p>
<p>Guidelines for Good Practice for QualityAssurance. INQAAHE. 2007.</p>
<p>Standards and Guidelines for Quality Assurance in the Higher Education Area. European Association for Quality Assurance in Higher Education. 2005.</p>
<p>Guidelines on Quality Assurance in Higher Education. UNESCO. 2005.</p>
<p>A review of international and national developments in the use of qualifications frameworks. A report prepared for the European Training Foundation prepared by Mike Coles. 2006.</p>
<p>Information was also soured from the following websites:</p>
<p>http://ec.europa.eu/education/lifelong-learning-policy/doc48_en.htm</p>
<p>http://ssl.ebits.co.nz/hsi/Article.aspx?ID=342</p>
<p>http://ec.europa.eu.int/com/education/policies/2010/doc/basic2004.pdf</p>
<p>http://www.qaa.ac.uk/academicinfrastructure/FHEQ/academicCredit/AcademicCredit.pdf</p>
<p>http://www.saqa.org.za</p>
<p>http://www.mqa.mu</p>
<p>http://www.nzqa.govt.nz</p>
<p>http://diplomamillnews.blogspot.com/</p>
</div>
</body>
</html>

charleski
08-24-2010, 09:50 PM
Insert a soft hyphen (& shy; without the space) after each forward slash.

shall1028
08-24-2010, 09:53 PM
1) no spaces no chance for "an ereader" to break the line at a word break so the "an" just chops it off as it has no break in the middle of a word function. That's the why.

2) never heard of the model ereader "an" so you're on your own to figure if there is a maker supplied workaround.

shall1028
08-24-2010, 10:02 PM
Looks like charleski know the appropriate magic incantations. I'll have to file that one away for future reference.

Good one!

charleski
08-25-2010, 07:48 AM
Actually, if you want this to work properly in iBooks you need to add something else. ADE-based readers will split on a soft hyphen and hide the hyphen, whereas iBooks splits and shows it (which is generally the desired behaviour, but not here).

Add the following to your css:
span.hide { visibility: hidden }

then place the following at the points where you want long urls to wrap to the next line:
<span class="hide">& shy;</span>
(again, remove the space between the '&' and the 'shy').

irc
08-25-2010, 12:21 PM
Thank you. The soft hyphen worked perfectly. I did not elaborate on the model of the reader as I am hoping that the work could be read on as many different readers as possible (with the exception of the ipad as I believe this can often require extra script).
Many thanks for the advice.

amoroso
08-25-2010, 04:47 PM
Add the following to your css:
span.hide { visibility: hidden }

then place the following at the points where you want long urls to wrap to the next line:
<span class="hide">& shy;</span>
(again, remove the space between the '&' and the 'shy').
To create clickable links (rendered with a monospaced font) for reading systems that support web browsing, I have used code like this:

<a href="http://www.example.com/my/dir/ectory"><tt>http://www.example.com/<span class="hide">& shy;</span>my/<span class="hide">& shy;</span>dir/<span class="hide">& shy;</span>ectory</tt></a>

This correctly splits long URLs at line ends on my Opus. However, the device renders as underlined only the last part of the split URL, i.e. "ectory" in this example. And the whole URL uses the default ebook text font, not the monospaced one.

amoroso
08-25-2010, 05:56 PM
To create clickable links (rendered with a monospaced font) [...]
I stand corrected. I checked my code, and I used the monospaced font only in some instances, where it was correctly rendered as monospaced by the Opus. The issue with only the last section of the URL being underlined, however, is still there.

Jellby
08-26-2010, 06:18 AM
Note that the "visibility" property is not among the CSS subset required for ePUB, in other words, it might be unsupported by compliant readers.

In principle, a zero-width space (http://en.wikipedia.org/wiki/Zero-width_space) (& #8203;) should work.

amoroso
08-26-2010, 01:49 PM
In principle, a zero-width space (http://en.wikipedia.org/wiki/Zero-width_space) (& #8203;) should work.
This works great, and URLs are correctly underlined on the Opus.

eping
08-27-2010, 12:04 PM
1) no spaces no chance for "an ereader" to break the line at a word break so the "an" just chops it off as it has no break in the middle of a word function. That's the why.

Yes, that's the reason.
I think it's a bug of ADE, ereader should wrap the text at the last possible character in the last line if no proper break point found. That's very easy, browsers have no such bug. In coding, it's easier than wrapping at a space, the only reason is the developer neglected this.