Re: Automating an atypical search & replace

Liste des GroupesRevenir à c editors 
Sujet : Re: Automating an atypical search & replace
De : rowlett (at) *nospam* access.net (Richard Owlett)
Groupes : comp.editors
Date : 14. Jul 2024, 09:02:12
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v700m7$2a95$1@dont-email.me>
References : 1 2
User-Agent : Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.4
On 07/14/2024 01:08 AM, Stan Brown wrote:
On Sat, 13 Jul 2024 11:08:48 -0500, Richard Owlett wrote:
>
I'm reformatting some HTML files containing chapters of the KJV Bible.
My source follows the practice of italicizing some words.
I find italics distracting.
>
These occurrences are consistently of the form
     <span class='add'>arbitrary_text</span>
>
I wish to delete "<span class='add'>" and *ASSOCIATED* "</span>".
Obviously it would not be wise to fully automate the action.
I wish to find all occurrences of <span
class='add'>arbitrary_text</span> an manually confirm the edit.
>
In general, is it feasible?
 Yes, of course. Any editor above the level of Notepad ought to be
able to do this. (Sadly, a lot of editors are not above the level of
Notepad.)
 For instance, in Vim you would use this command after opening the
file:
 :%s;<span class='add'>\([^<]*\)</span>;\1;gc
 % = process every line of the file
\( ... \) makes that part of the pattern match addressable
[^>]* matches a string of characters not including a <. If there is
other HTML between span and /span, it will not match.
\1 = the text found between span and /span
gc = do every occurrence on each line, but confirm each one
I'll use parsing that expression as a guide to understanding
https://docs.kde.org/stable5/en/kate/katepart/regular-expressions.html .

 
Can KDE's Kate do it?
 I've no idea.
I'm gaining an appreciation of just how much HTML Kate can handle.
Its highlighting feature begins to serve for minimal syntax checking.

 But there's an easier solution. Change the definition of class add in
your style sheet:
 span.add { font-style:normal; }
 Then you won't have to edit the HTML at all.
>
Learning CSS is beyond my current goals.

Date Sujet#  Auteur
13 Jul 24 * Automating an atypical search & replace23Richard Owlett
13 Jul 24 +* Re: Automating an atypical search & replace4Janis Papanagnou
13 Jul 24 i`* Please ignore my previous post - Re: Automating an atypical search & replace3Janis Papanagnou
14 Jul 24 i `* Re: Please ignore my previous post - Re: Automating an atypical search & replace2Richard Owlett
14 Jul 24 i  `- Re: Please ignore my previous post - Re: Automating an atypical search & replace1Janis Papanagnou
13 Jul 24 +- [OT] Change text decorations in HTML (was Re: Automating an atypical search & replace)1Janis Papanagnou
14 Jul 24 +* Re: Automating an atypical search & replace4Lawrence D'Oliveiro
14 Jul 24 i+* Re: Automating an atypical search & replace2Stan Brown
14 Jul 24 ii`- Re: Automating an atypical search & replace1Richard Owlett
14 Jul 24 i`- Re: Automating an atypical search & replace1Richard Owlett
14 Jul 24 `* Re: Automating an atypical search & replace13Stan Brown
14 Jul 24  `* Re: Automating an atypical search & replace12Richard Owlett
14 Jul 24   `* Re: Automating an atypical search & replace11Lawrence D'Oliveiro
14 Jul 24    +* Re: Automating an atypical search & replace3Richard Owlett
15 Jul 24    i`* Re: Automating an atypical search & replace2Lawrence D'Oliveiro
15 Jul 24    i `- Re: Automating an atypical search & replace1Richard Owlett
15 Jul 24    `* Re: Automating an atypical search & replace7candycanearter07
15 Jul 24     `* Re: Automating an atypical search & replace6Lawrence D'Oliveiro
16 Jul 24      +* Re: Automating an atypical search & replace4Richard Owlett
16 Jul 24      i`* Re: Automating an atypical search & replace3Lawrence D'Oliveiro
16 Jul 24      i `* Re: Automating an atypical search & replace2Richard Owlett
17 Jul 24      i  `- Re: Automating an atypical search & replace1Lawrence D'Oliveiro
16 Jul 24      `- Re: Automating an atypical search & replace1candycanearter07

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal