Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have an open-source project for which I have to generate HTML pages to put on the web. I wanted to keep everything as simple HTML pages. The problem with this approach is if I need to change the design, I have to goto all the pages and change it. This will be tough as I have lot of pages.

Is there some kind of HTML generators which can process simple annotated text files? This way, I can maintain the documentation and website contents as plain text files and run it through this program to generate static HTML pages. This also helps in keeping the design consistent.

Any help would be great!

share|improve this question
1  
What language are you working in now? It helps to know what tools you're using. – S.Lott Jan 9 '11 at 14:14

5 Answers

All of the "lightweight" markup languages work well for this.

Markdown http://daringfireball.net/projects/markdown/

ReStructuredText (RST) http://docutils.sourceforge.net/rst.html

There are others. http://en.wikipedia.org/wiki/Lightweight_markup_language

I'm a fan of RST.

rst2html.py somefile.rst >somefile.html
share|improve this answer
Thanks for the reply. daringfireball looks good. But I can't find how it generates the HTML file? I can see HTML being emitted to the console directly. – Appu Jan 9 '11 at 14:45
1  
@Appu: Do you know how shell redirect works? someapp source.txt >webpage.html? Have you seen the > operator of the shell? If not, you should read up on the shell. – S.Lott Jan 9 '11 at 15:18

This tool was created for python, but I believe can be used for other projects too. Django uses it. http://sphinx.pocoo.org/

share|improve this answer
+1: Essentially, this is RST markup and is a more sophisticated application than rst2html.py. – S.Lott Jan 9 '11 at 21:47
Well, I don't usually have internet at home, so I found it very useful, when I could generate whole django docs from a django code snapshot. That's how I know it :-) – gruszczy Jan 9 '11 at 22:12

With docbook you can have your content as a set of XML files then compile it into HTML, PDF, or whatever - many filters exist.

Here is some XML http://elastik.svn.sourceforge.net/viewvc/elastik/book/

Here is the docs http://book.elastik.jarofgreen.co.uk/

share|improve this answer

I used a similar approach for status pages that I wanted 100% pure HTML.

If you have no restriction on the machine that can generate the pages, I suggest you to use any popular scripting language you know, like PHP.

In my case, I simply maintained ASP.NET pages in a local project, but the output was the generated HTML pages. For that I used ApplicationHost. Here is an example (input is the path to an ASPX page):

    public static string GenerateToHtml(string input)
    {
        string template = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Host\\input.aspx");

        File.Copy(input, template, true);

        VirtualHost host = (VirtualHost)ApplicationHost.CreateApplicationHost(
                                                       typeof(VirtualHost),
                                                       "/Host",
                                                       Path.GetDirectoryName(template));

        // We must get with the filename only. If we use a full path we get a Bad Request
        string content = host.GetContent(Path.GetFileName(template), string.Empty);
        File.Delete(template);
        return content;
    }
share|improve this answer

All recent versions of MS Word will Save As a web page (.html or .html). I just checked on the oldest version I have (Word 2002) and it is available.

I believe the same option exists in Open Office, although I don't have it currently installed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.