diff --git a/www/contribute/producing-an-ebook-step-by-step.php b/www/contribute/producing-an-ebook-step-by-step.php index 5508c150..7f4666d1 100644 --- a/www/contribute/producing-an-ebook-step-by-step.php +++ b/www/contribute/producing-an-ebook-step-by-step.php @@ -115,7 +115,7 @@ proceed to seal up my confession, I bring the life of that unhappy Henry Jekyll
The file we downloaded contains the entire work. Jekyll is a short work, but for longer work it quickly becomes impractical to have the entire text in one file. Not only is it a pain to edit, but ereaders often have trouble with extremely large files.
The next step is to split the file at logical places; that usually means at each chapter break. For works that contain their chapters in larger “parts,” the part division should also be its own file. For example, see Treasure Island.
To split the work, we use se split-file
. se split-file
takes a single file and breaks it in to a new file every time it encounters the markup <!--se:split-->
. se split-file
automatically includes basic header and footer markup in each split file.
Notice that in our source file, each chapter is marked with an <h2>
element. We can use that to our advantage and save ourselves the trouble of adding the <!--se:split-->
markup by hand:
perl -pi -e 's|<h2|<\!--se:split--><h2|g' src/epub/text/body.xhtml
+ Notice that in our source file, each chapter is marked with an <h2>
element. We can use that to our advantage and save ourselves the trouble of adding the <!--se:split-->
markup by hand:
perl -pi -e 's|<h2|<!--se:split--><h2|g' src/epub/text/body.xhtml
Now that we’ve added our markers, we split the file. se split-file
puts the results in our current directory and conveniently names them by chapter number.
se split-file src/epub/text/body.xhtml mv chapter* src/epub/text/
Once we’re happy that the source file has been split correctly, we can remove it.
rm src/epub/text/body.xhtml