I would like to write a website with nice design, say like the ones generated by WordPress, SPIP or with advanced CSS-based templates. At the same time, I would like to write the contents in a text editor (possibly in text mode, with Emacs or vim, for instance) just like one writes a LaTeX file. In addition, I would like to use version control so as to easily see the changes across different versions of the website. I should say that the website I have in mind is not a blog; it is more organized and several pages should be updated with time. I am not looking for a highly complex solution as it is for a personal website with a few dozen pages (organized in "sections", "subsections" and maybe even "subsubsections").
I guess I have in mind the LaTeX model, where you write the contents and let the compiler generate a nice output. The LaTeX code is rather simple, and it is in text format so that it is trivial to apply version control.
Why classical solutions do not seem to work
WordPress is very nice, but as far as I can tell, you cannot really edit from a text editor in a terminal. You must use some kind of graphical interface. SPIP, like WordPress, will generate a database for which version control (with Git or so) does not seem appropriate.
HTML/PHP/CSS templates are nice, but the contents and the design are a bit too intricated. In particular, it is not easy to switch from one template to another, especially as there are no standards. Usually, a template does not evolve, since you just picked it somewhere. In addition, it offers little flexibility and may lack features that you need to add yourself. For instance, it may never produce a mobile version, while a clever exporter might do that.
I am aware of software like orgmode under Emacs and corresponding exporters. But this is more for blogs, and the design is not so great in the end.
I guess my question is whether there is software that could publish webpages written in plain text and organize these webpages (in pages/subpages, with menus, nice design, ...). If the overall organization of the webpages must be carried out of the text editor, that would be acceptable. The webpages could still have images, equations and so forth if the software is clever enough.
I cited WordPress and SPIP, but I considered many other solutions like a wiki (MediaWiki or whatever), other publishers like Dotclear, CMSs like Joomla, CMFs like Drupal or even frameworks like Django, ... Maybe one of those is actually the solution and I just did not realize that?
There is an additional constraint/example I would like to add. Imagine you want to include pages generated by an external software, e.g., Doxygen for the documentation of some software. Then you may need to automate the addition of the documentation (for a new version of the software). This requires some flexibility, maybe scripting options.