English 中文(简体)
What is a simple webpage compiler for restructured text?
原标题:

Instead of a blog/cms, I d like to have a static html-based site with a few (rarely updated) pages. I figure the simplest way to update them is to keep the sources in a format like ReST, and compile it each time it updates. What is a recommended compiler for this usage? I d like to have my own theme/design and I don t need anything beyond the proper ReST syntax (Sphinx is too much, for example).

最佳回答

rest2web might be more the sort of thing you re looking for.

问题回答

A Makefile would be a good solution to do this. Here s a quick template makefile

# Flags to pass to rst2html
# e.g. RSTFLAGS = --stylesheet-path=mystyle.css 
RSTFLAGS = 

%.html: %.rst
        rst2html $(RSTFLAGS) $< $@

.PHONY: all
.DEFAULT: all

all: index.html foo.html bar.html # any other html files to be generated from an rst file

Then just run make in the directory with your files to generate the html from the rst

If you dont necessarily need restructured text, but markdown or textile is just as fine, then check out jekyll.

I use it myself. Thumbs up.

I use nanoc3 along with docutils (via a sphinx install) to enable nice restructuredtext support in a static site generator. I ve looked at (and would like to use) a pure python solution (hyde) but nanoc allows for cleaner ReST source files.

I ve also considered using sphinx to produce a static site, but it s not as easy to do this without rolling a lot of code to support it.

I m happy to detail how to do this precisely if there is still interest in this topic. It s basically using docutils to output html from the source rest. I have a simple nanoc processor that does this:

module Nanoc3::Filters

  class ReST < Nanoc3::Filter

    identifier :rest

    def run(content, params={})
      open( |rst2html.py --template=rest.template ,  r+ ) do |io|
        io.write(content)
        io.close_write
        io.read
      end
    end

  end

end

The rest.template file is basically a dummy template with the following single line:

%(body)s

You may want to use a static site generator. There s a billion of them…

https://www.staticgen.com/





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签