If you need to invent a new markup language for some of your documents, you can just use your CeePlusPlus compiler to carry out the transformations. First, define a DocumentTypeDefinition of sorts by defining a header file. // dtd.h void beginDocument(); void beginSection(char * name); void sectionText(char * text); void endSection(); void endDocument(); Then, write your document. // document.h void myDocument(); // document.cpp #include "dtd.h" void myDocument() { beginDocument(); beginSection("Section One"); sectionText("This is one of my sections." " I forgot to define paragraphs."); endSection(); beginSection("Section Two"); sectionText("Here is another section."); endSection(); endDocument(); }; Then, define your functions to produce formatting: // stylesheet.cpp #include using namespace std; #include "dtd.h" void beginDocument() { cout << "Formatting example" << endl << "" << endl; } void beginSection(char * name) { cout << "

" << name << "

" << endl << "

"; } void sectionText(char * text) { cout << text << endl; } void endSection() { cout << "

" << endl; } void endDocument() { cout << "" << endl; } This is just a sample. * It's possible to create alternate definitions of these functions, if you would like a different style. * It's possible to do validation checking, if you want to maintain state. * If you ''really'' want to maintain state, you can use these functions to construct a data structure (or several data structures) and then make the '''endDocument''' function traverse that data structure. There wouldn't be much sense in doing this, unless your traversal at least has the possibility of going over the data in a different order. Consider generating tables of contents and indeces. Then you write a main function to bring this all together. // main.cpp #include "document.h" int main(void) { myDocument(); } You might want an exception handler if you're doing validation checking. I skipped it, here. You compile all this together using GnuCpp: g++ -c document.cpp -o document.o g++ -c stylesheet.cpp -o stylesheet.o g++ -c main.cpp -o main.o g++ document.o stylesheet.o main.o -o makedoc makedoc > doc.html rm makedoc Then you've got your document in HTML format. Voila! But with different stylesheets, you can produce any format you want. -- EdwardKiser ---- Brilliant! I believe this example, because it is so obvious, could help many a programmer to a deeper understanding of the difference (or similarity!) between code and data. -- DanielBrockman ---- Yuck! You're ''way'' overstretching the idea of MarkUp. A key goal of template mechanisms is "inverting the sock", ie, inserting code into text (data) as opposed to inserting constant text into source code, for convenience or whatever. Markup means to add syntax to (otherwise plain-looking) text to represent structure, or other semantics (I hate this word), for similar purposes (cf definition of MarkUp). What you've done here is merely inserting constant strings into an algorithm (ie, code). The separation-of-concerns achieved by modularizing, here used for transforming the text, doesn't surprise me at all. Trivial. And ugly! (But if you'd done this in Python... ;o) ---- CategoryCee CategoryCpp MarkupLanguage