Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 04-11-2022, 07:18 PM   #1
celiapgt
EBook-obsessive gal
celiapgt began at the beginning.
 
celiapgt's Avatar
 
Posts: 39
Karma: 10
Join Date: Mar 2011
Location: La ciudad de la eterna primavera
Device: Kobo Clara HD
Toggle comments on HTML or CSS files

Hi, everyone!


I have looked up with no success. Does anyone know if there is a plugin to toggle comments on HTML or CSS files?
Or maybe just a regex function is needed?


Since I'm no programmer, I cannot do it myself. I'm sorry for that.
celiapgt is offline   Reply With Quote
Old 04-11-2022, 07:33 PM   #2
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,307
Karma: 145435140
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
What do you mean by toggle comments? in the CSS files, you would use /* comment text */ and in a HTML file, you would use <! -- comment text --> to add a comment. Are you looking for a plugin to allow you to highlight text and then mark it as a comment?

I.e.
Code:
<!-- Write your comments here for a HTML file -->


/* This is a single-line comment in a CSS file */


p {
  text-align:center;  /* center the text */
}
DNSB is offline   Reply With Quote
Advert
Old 04-11-2022, 07:50 PM   #3
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,093
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
I would just set that as a clip.

- type your comment
- highlight your commented text
- click the appropriate clip button

Probably alot shorter/faster/easier than making a whole plugin for it.
Turtle91 is offline   Reply With Quote
Old 04-11-2022, 08:07 PM   #4
celiapgt
EBook-obsessive gal
celiapgt began at the beginning.
 
celiapgt's Avatar
 
Posts: 39
Karma: 10
Join Date: Mar 2011
Location: La ciudad de la eterna primavera
Device: Kobo Clara HD
Quote:
Originally Posted by DNSB View Post
What do you mean by toggle comments? … Are you looking for a plugin to allow you to highlight text and then mark it as a comment?

What I mean is when I'm experimenting with the code, I want to highlihgt some text block and comment it. Or if it is already commented, I want to uncomment it. Exactly as you said

Last edited by celiapgt; 04-11-2022 at 08:16 PM.
celiapgt is offline   Reply With Quote
Old 04-11-2022, 08:13 PM   #5
celiapgt
EBook-obsessive gal
celiapgt began at the beginning.
 
celiapgt's Avatar
 
Posts: 39
Karma: 10
Join Date: Mar 2011
Location: La ciudad de la eterna primavera
Device: Kobo Clara HD
Yes, I was thinking of using clips, but I do not know how to use it. For example,

Code:
<p>A paragraph</p>
<hr />
<p>Another paragraph</p>
or

Code:
blockquote.modern {
 text-align:justify;
 margin: 0 1em 1em;
}
So, if I select either one of those blocks, I get (accordingly):

Code:
<!-- 
<p>A paragraph</p>
<hr />
<p>Another paragraph</p>
-->
or

Code:
/*
blockquote.modern {
 text-align:justify;
 margin: 0 1em 1em;
}
*/
And if I already have these latter paragraphs, I can revert them to the first two paragraphs.


How can I achieve it? Is it possible using clips/regex or plugins?
celiapgt is offline   Reply With Quote
Advert
Old 04-11-2022, 08:50 PM   #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,093
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
That could be done with a saved search.

Find: [\<\!\-\-|\/\*]\s*(.*?)\s*[\-\-\>|\*\/]
Replace: \1

- highlight commented section, including tags
- hit saved search button

I’m pretty sure you can assign a shortcut key for the clip(s), maybe you can do the same for a saved search??

Also, I’m not sure you need to escape every character in the find - I’m writing this on my phone without testing - but you get the idea. If I’m wrong I guarantee someone will correct it!

Edit: added \s* to not capture any spaces to prevent adding space every time this method is used.

</CDO>

Last edited by Turtle91; 04-11-2022 at 09:00 PM.
Turtle91 is offline   Reply With Quote
Old 04-12-2022, 01:15 PM   #7
celiapgt
EBook-obsessive gal
celiapgt began at the beginning.
 
celiapgt's Avatar
 
Posts: 39
Karma: 10
Join Date: Mar 2011
Location: La ciudad de la eterna primavera
Device: Kobo Clara HD
Hey, Turtle91!

Thank you for your response. I'm trying and coping with your idea. Yes, I get it ;D
Clever one! Regex are not my strong but now I can develop the rest of them.

I cannot assign a keyboard shortcut to a saved search :-S


It is something worthwhile to have keyboard shortcuts for Saved Searches, and I hope the developers consider it. Would save a lot of time and clicking (I'm more a keyboard gal).



Thanks again!
Live long and prosper!
celiapgt is offline   Reply With Quote
Old 04-12-2022, 03:48 PM   #8
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,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by celiapgt View Post
It is something worthwhile to have keyboard shortcuts for Saved Searches, and I hope the developers consider it. Would save a lot of time and clicking (I'm more a keyboard gal).
You can assign keyboard shortcuts to the first 20 clips, and there are also two clip bars.



Just assign the following two clips to one of the first 20 clips:
Code:
CSS comment	/* \1 */
HTML comment	<!-- \1 -->
Doitsu is offline   Reply With Quote
Old 04-16-2022, 08:26 PM   #9
celiapgt
EBook-obsessive gal
celiapgt began at the beginning.
 
celiapgt's Avatar
 
Posts: 39
Karma: 10
Join Date: Mar 2011
Location: La ciudad de la eterna primavera
Device: Kobo Clara HD
Thank you, Doitsu!

I'm saving them as clips.
celiapgt is offline   Reply With Quote
Reply

Tags
comments, css, html, regex function, toggle


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Several Html and Css files into one Epub File? MarjaE Editor 3 04-04-2017 03:20 PM
How to change CSS to comments but retain original numeric values crankypants Sigil 3 11-03-2015 10:49 AM
Importing css in html files shotsky Conversion 6 07-14-2012 05:34 PM
Fixed Layout Sample ".mobi" file with package(html, css, opf, ncx files). Sushil Kindle Fire 1 01-13-2012 07:16 AM
Help! Newbie having problems converting HTML/CSS files jackie_w Calibre 6 09-14-2009 04:53 PM


All times are GMT -4. The time now is 07:14 AM.


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