Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 02-09-2017, 10:42 PM   #16
nabsltd
Evangelist
nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.
 
Posts: 417
Karma: 6913952
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe
pre isn't required to do fixed formatting

I just re-formatted a book I bought, and hit this same issue. Here's what I used for some source code:

Code:
.div-indent {
	margin-left: 2em;
}
.div-computer {
	margin-top: 4%;
	margin-bottom: 4%;
	margin-left: 2em;
	margin-right: 2em;
	font-size: 90%;
	font-family: "Consolas", "Courier New", "Courier Std", "Courier", "DejaVu Sans Mono", monospace;
}
.para-left {
	text-align: left;
}
Code:
<div class="div-computer">
  <p class="para-left">void main (void)</p>
  <div class="div-indent">
    <p class="para-left">{</p>
    <p class="para-left">char keyfile = fopen("108952.jpg");</p>
    <p class="para-left">char extract;</p>
    <p class="para-left">while (infile)</p>
    <div class="div-indent">
      <p class="para-left">{</p>
      <p class="para-left">extract = asc(least_sig_bit(keyfile) / 2)^6;</p>
      <p class="para-left">stdoutput(extract);</p>
      <p class="para-left">}</p>
    </div>
    <p class="para-left">}</p>
  </div>
</div>
No complaints about the code...I know it's not valid, but that's what was in the book. The attachment shows how it renders.
Attached Thumbnails
Click image for larger version

Name:	SourceCode.jpg
Views:	189
Size:	20.0 KB
ID:	154888  
nabsltd is offline   Reply With Quote
Old 02-10-2017, 04:51 AM   #17
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,887
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Sorry, but I just have to say go return that book. The code is awful. I would not trust the author.
JSWolf is offline   Reply With Quote
Old 02-11-2017, 04:02 PM   #18
nabsltd
Evangelist
nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.
 
Posts: 417
Karma: 6913952
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe
Quote:
Originally Posted by JSWolf View Post
Sorry, but I just have to say go return that book. The code is awful. I would not trust the author.
It's a novel, so it doesn't really matter.
nabsltd is offline   Reply With Quote
Old 02-25-2017, 11:20 AM   #19
GaryVe
Junior Member
GaryVe began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2017
Device: Kindle
Hi CBSA,

I think that I have the answer for you on that same ePub. Do a replace all of "</code> " (think that it was two spaces, may have been more) with "</code>" (no spaces). Do this in each html file; don't do anything to the CSS file.

I used Calibre to edit the book to do this. You will see it auto correct as you do the replace all.

Let me know if it works for you.

G

Last edited by GaryVe; 02-27-2017 at 09:35 AM.
GaryVe is offline   Reply With Quote
Old 02-25-2017, 12:47 PM   #20
GaryVe
Junior Member
GaryVe began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2017
Device: Kindle
Correction to the above: copy and paste the offending code from the html script, which I have to be: (ignore the quotes)

"</code>

<"

and replace this with just "</code> <"

and then replace

"</code>

<"

with "</code><"

Works perfectly for me.

G

Last edited by GaryVe; 02-25-2017 at 02:45 PM.
GaryVe is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
find badly formatted ebooks alexxxm Calibre 3 05-29-2016 12:33 PM
The Adventures of Joe Nobody and the Badly Formatted Epub mklynds Sigil 44 01-30-2013 02:43 PM
Badly formatted eBooks Katsunami General Discussions 27 02-03-2012 11:49 AM
Touch A badly formatted book or bad Kobo Touch rendering? jswinden Kobo Reader 16 07-07-2011 07:19 PM
Classic Bought a Badly Formatted Book From B&N lionel47 Barnes & Noble NOOK 11 05-22-2010 04:31 PM


All times are GMT -4. The time now is 10:14 PM.


MobileRead.com is a privately owned, operated and funded community.