3 ms·
I actually built something similar in Clojure for a client, if it where not for a client I would share it with you, but the basics where pretty easy, what I did
by kls 15y ago
I actually built something similar in Clojure for a client, if it where not for a client I would share it with you, but the basics where pretty easy, what I did was I used the HTML data attributes as my templating instructions so I would add a attribute like <div data-cms-template="header"> I then used a parser to look for the attributes and replace them with the other template file content that where specified in a config.xml file. It was simple and it worked well. I really wish the big CMS's would convert over to using the data attributed as opposed to each using some kind of proprietary custom tags. IT would be really nice if they standardized the attribute names so that at least the basic templates where cross CMS compatible.
- Random_Person 15y agoThat's actually really close to what I want to do... I just need to learn how to parse correctly and replace. I have 4 basic page layouts, but only 2 that I regularly generate content for. The header, footer, nav bar, sidebars, and major layout DIV's on these pages are all constant. I'd like to be able to take a text document of paragraphs and run it through the parser that would apply <p>'s to the paragraphs and format the image links properly based on some sort of predefined replacement markup. This is where I fall down. I need to figure out how to parse and I'm not finding any links to learn. I can read lines and stick open and close <p>'s on newlines, but the parsing of stuff inline is where I'm stuck.