Questions about variable propagation and custom component types
Ladislav Laska <[email protected]> Sat, 6 Sep 2014 23:03:00 +0200
| Newsgroups | gmane.comp.web.mason.user |
|---|---|
| Message-ID | <[email protected]> |
Hi! The last project I've done with Mason was a success, so I've decided to use= it = yet for another one. This time, there is a challenge to it, and since the = documentation is not exactly helping, I've decided to consult here again :-) I have two questions. Let me start with the simple one: 1) How do I propagate a variable Up the component tree? The use case is sim= ple: = I have Base.mc, which defines most of the page layout, and another one, let= 's = say it's foo.mc, which wants to add to the title. I could probably find a w= ay to = hack it by studying the generated class files, but surely, there must be a = simpler way. 2) How do I create custom component type? I've noticed I can add custom = suffixed, but seen no way to declare component it self. I've found that pur= e = perl components are a bit hacky, since they seem to only append the '<%clas= s>' = and '</%class>' and are hacked inside the Interp and Compiler. = I am thinking of making the same thing, in the end, I just want to see the = content before it's modified and filter some stuff in and out. I wonder if = there = is a clean way to do it, mainly because I'm worried that some other plugin = may, = with good intentions, step in and do something stupid, so I won't be able t= o = process the file normally (it won't happen in my case, but hey, good practi= ces!) The use case for this is to have a place, where foo.pp (like plain page) is= in = format: #title: Some title #since: 6.9.2014, 22:55 Some simple text, which is formated by Markdown or some other preprocessor. ... so that any user who can use text editor and learn a bit of a Markdown = syntax can create and write a simple page like this. The component therefor= e = needs to find the few first lines and convert them to variables, push them = upward, run the Markdown and push the result forward into the Mason machine= ry. = Here, you can see another challenge, and that is indexing of *.pp's, so the= y can = appear somewhere automatically (and I won't have to call File::Find or some= thing = else each time I want the list), but this is the easiest part. So, here I am, asking for opinions/solutions/comments/suggestions; even the = drastic ones (note that I don't want any databases, I want my pages in the = filesystem hierarchy of Mason components). Thanks! -- = S pozdravem Ladislav L=E1ska <[email protected]= z> Katedra Aplikovan=E9 Matematiky, MFF UK tel.: +420 739 464 167 ---------------------------------------------------------------------------= --- Slashdot TV. = Video for Nerds. Stuff that matters. http://tv.slashdot.org/