Exemple #1
0
import sys
import subprocess

sys.path.insert(0, "../../rson/py2x")
from rson import loads
from simplejson import dumps

subprocess.call("../../rst2pdf/bin/rst2pdf manual.txt -e preprocess -e dotted_toc -o manual.pdf".split())

lines = iter(open("manual.txt", "rb").read().splitlines())

badstuff = "page:: space:: footer:: ##Page## contents::".split()
result = []
for line in lines:
    for check in badstuff:
        if check in line:
            break
    else:
        result.append(line)

result.append("")
result = "\n".join(result)

from wikir import publish_string

result = publish_string(result)

f = open("manual.wiki", "wb")
f.write(result)
f.close()
Exemple #2
0
# REQUIRES both rst2pdf and wikir project from google code.

import sys
import subprocess
sys.path.insert(0, '../../rson/py2x')
from rson import loads
from simplejson import dumps

subprocess.call('../../rst2pdf/bin/rst2pdf manual.txt -e preprocess -e dotted_toc -o manual.pdf'.split())

lines = iter(open('manual.txt', 'rb').read().splitlines())

badstuff = 'page:: space:: footer:: ##Page## contents::'.split()
result = []
for line in lines:
    for check in badstuff:
        if check in line:
            break
    else:
        result.append(line)

result.append('')
result = '\n'.join(result)

from wikir import publish_string
result = publish_string(result)

f = open('manual.wiki', 'wb')
f.write(result)
f.close()
Exemple #3
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# COPYING file for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# CODE IS POETRY

import os
import fnmatch
from wikir import publish_string

files = os.listdir('documentation/rest/')

for rstpath in files:
    rstpath = 'documentation/rest/'+rstpath
    rstfilename = os.path.basename(rstpath)
    if os.path.isfile(rstpath) and fnmatch.fnmatch(rstpath, '*.rest'):
        rstfile = open(rstpath, 'r')
        rstcontent = rstfile.read()
        print 'Converting: '+rstpath
        wikicontent = publish_string(rstcontent)
        wikipath = 'documentation/googlewiki/'+rstfilename.split('.')[0]+'.wiki'
        wikifile = open(wikipath, 'w')
        wikiput = wikifile.write(wikicontent)
        wikifile.close()
        rstfile.close()