示例#1
0
文件: toc.py 项目: sudhak/docs
 def build_contents(self):
     self.contents = RstCloth()
     self.contents.directive('class', 'hidden')
     self.contents.newline()
     self.contents.directive('toctree',
                             fields=[('titlesonly', '')],
                             indent=3)
     self.contents.newline()
示例#2
0
    def __init__(self, imported_table, widths=None, indent=0):
        self.table = imported_table
        self.indent = indent

        if widths is not None:
            self.widths = [str(i) for i in widths]
        else:
            self.widths = None

        self.r = RstCloth()
        self._render_table()
        self.output = self.r.data
示例#3
0
文件: images.py 项目: rMendozajy/docs
import sys
import os.path
import json

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
                                             '../')))

import makecloth.utils as utils
from rstcloth import RstCloth

r = RstCloth()


def generate_pages(conf):
    image = '/'.join([conf['dir'], conf['name']])
    alt = conf['alt']
    b = conf['name']

    for output in conf['output']:
        if output['type'] == 'print':
            r.directive('only', 'latex', wrap=False, block=b)
        else:
            r.directive('only', 'not latex', wrap=False, block=b)

        r.newline()

        if 'tag' in output:
            tag = '-' + output['tag'] + '.png'
        else:
            tag = '.png'
示例#4
0
#!/usr/bin/python
from yaml import load
from rstcloth import RstCloth

doc = RstCloth(line_width=180)


def parse_seq(action, index, indent):
    index2 = (1, )

    for subaction in action['seq']:
        parse_action(subaction, index + index2, indent)
        index2 = index2[:-1] + (index2[-1] + 1, )


def parse_mix(action, index, indent):
    index2 = (1, )
    for subaction in action['mix']:
        parse_action(subaction, index + index2, indent=indent + 1)
        index2 = index2[:-1] + (index2[-1] + 1, )


HEADINGS = (doc.h3, doc.h4, doc.h5, doc.h6)


def parse_action(action, index=(0, ), indent=0):
    assert type(action) == dict
    index_str = '.'.join(map(str, index[1:])) + '. '

    if 'type' in action and action['type'] == 'section':
        if index_str != '1. ':
示例#5
0
 def setUp(self):
     self.r = RstCloth()
示例#6
0
文件: toc.py 项目: sudhak/docs
 def build_dfn(self):
     self.dfn = RstCloth()