Sublime Forum

Automate Text Replacement by Line?


I have been using Sublime for a couple years to format HTML for publishing through a CMS and a mailer service. I am able to clean HTML through a command I built using RegReplace and use snippets to bring up code I regularly use.

What I hope to do is use placeholders for info like titles, etc, across all the files I am working on, and have a replacement function that pulls data from given lines in a single reference. Is there a plugin or function that would allow me to automate replacing ex TITLEONE with the content of line 24 from another file? I understand I can manually find and replace across all open files (which is what I do currently), but since I have to go through this process across dozens of variables regularly, any help would be greatly appreciated.



Sounds to me like you’d want to use a proper templating language. I’d suggest looking at Jinja2.



Or Panini if you need simple node package :slight_smile:

1 Like


Thank you both. I’ll certainly spend more time trying to learn how to utilize Jinja2 and Panini.

It seems like a lot of the common use is somewhat opposite my case – being able to replace identical placeholders simultaneously across files, whereas what I’m doing is replacing similar placeholders across templates (TITLEONE, TITLETWO, etc) with different information, but all from the same source text sent to me.