View Single Post
Old 09-02-2015, 05:42 AM   #17
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by doubleshuffle View Post
Good. I was afraid I'd have to start bothering with epub3.
Some epub3 features actually simplify the formatting of poems. IMHO, it couldn't hurt to have a look at pseudo classes, which allow you to apply CSS rules based on the number of an element without additional markup.

For example, you could automatically apply CSS rules to the last line of a verse and display line numbers every 5 lines using the following stylesheet:

Code:
ul {
    counter-reset: counter;
    margin-left: .25em;
}

li {
    counter-increment: counter;
    list-style-type: none;
}

ul li:nth-child(5n+5):before {
    left: 0;
    position: absolute;
    padding-left: 1em;
    content: counter(counter);
}

ul li:nth-child(6n+6) {
    text-align: right;
    margin-bottom: 1em;
}

h3 {
    text-align: center;
}
I've attached a slightly updated example file that I posted in a related thread.

Since this is an ePub3 file, it'll only work with Sigil, iBooks, ADE4/RMSK11*, Gitden Reader*, Kindles and other ePub3 apps.

*ADE and Gitden Reader, which both use the Readium engine, generally support pseudo classes, but have problems with counters.
ADE adds phantom numbers and Gitden Reader displays numbers only on the first page.

The only app that displays the test file correctly is iBooks.
Attached Thumbnails
Click image for larger version

Name:	ADE4.png
Views:	245
Size:	89.3 KB
ID:	141599   Click image for larger version

Name:	gitden_reader_android.png
Views:	235
Size:	201.8 KB
ID:	141600  
Attached Files
File Type: epub The_Raven_epub3.epub (5.9 KB, 178 views)
Doitsu is offline   Reply With Quote