View Single Post
Old 04-27-2023, 09:40 PM   #1
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,081
Karma: 76037135
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
txt > epub conversion question

I had this problem before:
https://www.mobileread.com/forums/sh...d.php?t=348081

I have some saved walkthroughs from GameFAQs and Neoseeker and other sites. Here's a few examples: [1] [2] [3].

These often have ASCII art and specific fixed-width alignment which causes them to misbehave if I open them directly in ebook-viewer.

If I convert them to ePub, the fixed-width alignment also tends to get messed up (I've tried different paragraph & formatting styles but had no luck).

So instead, here's what I do:

1. Convert to ePub. (Unlike 'add an empty file,' this generates structure and OPF data.) Open in ebook-editor.

2. Replace this to stylesheet.css:
Code:
pre {
   font-family: "courier new", courier, monospace;
   font-size: 10px;
   white-space: pre-wrap;
3. Go to index.html. Remove everything from between the body tags. Replace it with this:
Code:
  <body>
    <pre>
[the text copied from the original .txt]
    </pre>
  </body>
It ends up looking as expected, and I can use ebook-viewer's search:

Click image for larger version

Name:	2023-04-27 22_47_07-Morrowind Scroll FAQ [EPUB] — E-book viewer.png
Views:	155
Size:	36.5 KB
ID:	201324

But this isn't really the proper way and I can't do things like add a ToC. Does anybody else have a suggestion of what to do?


Last edited by ownedbycats; 04-27-2023 at 09:53 PM.
ownedbycats is online now   Reply With Quote