Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 06-11-2020, 05:23 PM   #1
d351r3d
Enthusiast
d351r3d began at the beginning.
 
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
Using HTML Entities With CSS

I want to use the html entity version of < ([ noparse ]<<[ /noparse ]) and > (>) and make anything in-between them blue. If I just did it with p or something it would be fine but that's not possible. There's also the < span > deal but I don't want to span 32k things.

Code:
<blah blah blah blah blah stuff[noparse ]>[/noparse]
I just want it to be like this:
<blah blah blah blah blah stuff>

I have no idea why it renders the entities even with the code around them.

Last edited by d351r3d; 06-11-2020 at 07:03 PM.
d351r3d is offline   Reply With Quote
Old 06-11-2020, 06:39 PM   #2
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,166
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
Check into the [ noparse ] [ /noparse ] pair of tags in bbcode to avoid the forum handling your text.
PeterT is offline   Reply With Quote
Old 06-11-2020, 07:04 PM   #3
d351r3d
Enthusiast
d351r3d began at the beginning.
 
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
Quote:
Originally Posted by PeterT View Post
Check into the [ noparse ] [ /noparse ] pair of tags in bbcode to avoid the forum handling your text.
The noparse doesn't work

& # 6 0 ;
& # 6 2 ;
d351r3d is offline   Reply With Quote
Old 06-11-2020, 09:51 PM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
The noparse thing works. I use it to display entity codes all the time. Just leave the ampersand outside of the tags and the rest inside.

&#60;
&#60;

As far as making all text between the entities blue in an epub, there's no shortcut. You'll have to create 32k spans or 32k inline styles. There is no entity element that can be utilized by css. Nor any (pseudo-)selectors to specify "between elements x and y" even if there were.

Last edited by DiapDealer; 06-11-2020 at 09:53 PM.
DiapDealer is online now   Reply With Quote
Old 06-12-2020, 05:13 AM   #5
d351r3d
Enthusiast
d351r3d began at the beginning.
 
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
Quote:
Originally Posted by DiapDealer View Post
The noparse thing works. I use it to display entity codes all the time. Just leave the ampersand outside of the tags and the rest inside.

&#60;
&#60;

As far as making all text between the entities blue in an epub, there's no shortcut. You'll have to create 32k spans or 32k inline styles. There is no entity element that can be utilized by css. Nor any (pseudo-)selectors to specify "between elements x and y" even if there were.
That's a bummer but not really. Just regex all the spans in after making all the
&#60;
&#60;
d351r3d is offline   Reply With Quote
Old 06-12-2020, 11:35 AM   #6
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,094
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Not sure I understand the willingness to put &#60; around all your text but not put a span??

CSS is pretty amazing. Depending on how well your targeted reader/app supports the current standards (:first-child, :first-line, etc.), you can get some pretty fancy formatting without having to do all the spans.

It would be interesting to see a sample of what you are trying to style. We might have a better solution than the &#60; one.

Cheers,
Turtle91 is offline   Reply With Quote
Old 06-12-2020, 11:37 AM   #7
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,094
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Also, in Sigil (and I think Calibre has something similar) you can make a 'clip' to easily insert spans around your selected text.

clip:
<span>\1</span>

Then highlight the text and click the clip.
Turtle91 is offline   Reply With Quote
Old 06-12-2020, 11:41 AM   #8
d351r3d
Enthusiast
d351r3d began at the beginning.
 
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
Quote:
Originally Posted by Turtle91 View Post
Also, in Sigil (and I think Calibre has something similar) you can make a 'clip' to easily insert spans around your selected text.

clip:
<span>\1</span>

Then highlight the text and click the clip.
The image attached is why I'm using the html entities. I'm not wrapping everything with them. <> That aren't tags bring forth errors in sigil. To make the errors go away I replaced them with the html entities
Attached Thumbnails
Click image for larger version

Name:	IMG_20200612_193943.jpg
Views:	236
Size:	181.9 KB
ID:	179874  
d351r3d is offline   Reply With Quote
Old 06-12-2020, 12:05 PM   #9
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,094
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Try this find/replace:

Find: &lt;(.*?)&gt;
-or-
Find: &#60;(.*?)&#62;

Replace: <span>\1</span>

with this CSS:
span {color:blue}
Turtle91 is offline   Reply With Quote
Old 06-12-2020, 12:09 PM   #10
d351r3d
Enthusiast
d351r3d began at the beginning.
 
Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
Quote:
Originally Posted by Turtle91 View Post
Try this find/replace:

Find: &lt;(.*?)&gt;
-or-
Find: &#60;(.*?)&#62;

Replace: <span>\1</span>

with this CSS:
span {color:blue}
Thanks for the assistance.

Find: &#60;(.*?)&#62;

Replace: <span>&#60;\1&#62;</span>

Last edited by d351r3d; 06-12-2020 at 12:13 PM.
d351r3d is offline   Reply With Quote
Reply

Tags
css, entities, epub, html


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML Entities placed in ToC break Kobo Aura trekky0623 Calibre 11 12-16-2016 04:22 PM
More help needed. Automatic HTML entities conversion arspr Editor 3 12-31-2013 01:45 PM
Search & Replace issue with html entities Aleyst Sigil 2 09-27-2011 07:49 AM
HTML entities being changed to actual glyphs GrannyGrump Sigil 4 09-10-2011 01:16 AM
Why do html entities get replaced upon import? kentmatt Calibre 1 12-08-2010 12:21 PM


All times are GMT -4. The time now is 11:30 AM.


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