home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.editors      What? Edlin ain't good enough for you?      123,932 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 123,532 of 123,932   
   Stan Brown to Richard Owlett   
   Re: Automating an atypical search & repl   
   13 Jul 24 23:08:54   
   
   From: the_stan_brown@fastmail.fm   
      
   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   
   >     arbitrary_text   
   >   
   > I wish to delete "" and *ASSOCIATED* "".   
   > Obviously it would not be wise to fully automate the action.   
   > I wish to find all occurrences of  class='add'>arbitrary_text 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;\([^<]*\);\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   
      
   > Can KDE's Kate do it?   
      
   I've no idea.   
      
   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.   
   --   
   Stan Brown, Tehachapi, California, USA         https://BrownMath.com/   
   Shikata ga nai...   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca