(70 by default).

"""

from lexor import init, load_aux

INFO = init(
    version=(0, 0, 3, 'final', 0),
    lang='html',
    type='writer',
    description='Writes HTML files without indentation.',
    git={
        'host': 'github',
        'user': '******',
        'repo': 'html-writer-default'
    },
    author={
        'name': 'Manuel Lopez',
        'email': '*****@*****.**'
    },
    docs='http://jmlopez-rod.github.io/'
         'lexor-lang/html-writer-default',
    license='BSD License',
    path=__file__
)
DEFAULTS = {
    'width': '70',
    'add_block': '',
    'del_block': '',
}
MOD = load_aux(INFO)['nw']
Exemple #2
0
This parser attempts to combine the best features of Markdown and
LaTeX. This is all in taste and preferences of the author.

"""

from lexor import init, load_aux

DEFAULTS = {
    'inline': 'off',
}
INFO = init(
    version=(0, 0, 1, 'rc', 9),
    lang='lexor',
    type='parser',
    description='Parse Markdown and LaTeX elements. ',
    url='http://jmlopez-rod.github.io/lexor-lang/lexor-parser-default',
    author='Manuel Lopez',
    author_email='*****@*****.**',
    license='BSD License',
    path=__file__
)
MOD = load_aux(INFO)
REPOSITORY = [
    MOD['auto'].AutoLinkNP,
    MOD['auto'].AutoMailNP,
    MOD['cdata'].CDataNP,
    MOD['comment'].CommentNP,
    MOD['code'].CodeInlineNP,
    MOD['code'].CodeBlockNP,
    MOD['define'].MacroNP,
    MOD['doctype'].DocumentTypeNP,
parsed in html.

"""

from lexor import init, load_aux

INFO = init(
    version=(0, 0, 3, 'rc', 0),
    lang='lexor',
    to_lang='html',
    type='converter',
    description='Convert lexor files to html.',
    git={
        'host': 'github',
        'user': '******',
        'repo': 'lexor-converter-html-default'
    },
    author={
        'name': 'Manuel Lopez',
        'email': '*****@*****.**'
    },
    docs='http://jmlopez-rod.github.io/'
         'lexor-lang/lexor-converter-html-default',
    license='BSD License',
    path=__file__
)
DEFAULTS = {
    'error': 'on',
    'exec': 'on',
}
MOD = load_aux(INFO)
REPOSITORY = [
Exemple #4
0
    lexor example.html to html~min@comment="Copyright:"~

will be

    <!--Copyright: ML--><html><br/> content. </html>

"""

from lexor import init, load_aux

INFO = init(version=(0, 0, 1, 'final', 0),
            lang='html',
            type='writer',
            description='Writes HTML files to minimize the file size.',
            url='http://jmlopez-rod.github.io/lexor-lang/html-writer-min',
            author='Manuel Lopez',
            author_email='*****@*****.**',
            license='BSD License',
            path=__file__)
MOD = load_aux(INFO)['nw']
DEFAULTS = {
    'comment': '',
}
MAPPING = {
    '#text': MOD.TextNW,
    '#comment': MOD.CommentNW,
    '#doctype': MOD.DoctypeNW,
    '#cdata-section': MOD.CDataNW,
    '__default__': MOD.DefaultNW,
}
"""HTML to HTML DEFAULT Converter Style

Evaluates python instructions.

"""
from lexor import init

INFO = init(
    version=(0, 0, 2, 'final', 0),
    lang='html',
    to_lang='html',
    type='converter',
    description='Copy html file and evaluate python instructions.',
    git={
        'host': 'github',
        'user': '******',
        'repo': 'html-converter-html-default'
    },
    author={
        'name': 'Manuel Lopez',
        'email': '*****@*****.**'
    },
    docs='http://jmlopez-rod.github.io/'
         'lexor-lang/html-converter-html-default',
    license='BSD License',
    path=__file__
)
Notice that `echo` commands will be appended to the parent node
before `print` commands.

"""

from lexor import init
from lexor.core.converter import NodeConverter
from lexor.core.parser import Parser

INFO = init(
    version=(0, 0, 1, 'final', 0),
    lang='xml',
    to_lang='xml',
    type='converter',
    description='Copy xml file and evaluate python instructions.',
    url='http://jmlopez-rod.github.io/lexor-lang/xml-converter-xml-default',
    author='Manuel Lopez',
    author_email='*****@*****.**',
    license='BSD License',
    path=__file__
)
DEFAULTS = {
    'error': 'on',
    'exec': 'on',
}


class PythonNC(NodeConverter):
    """Append a node with python instructions to a list. """

    def process(self, node):
no tex tags. This writer assumes that the document is a valid html
document and it attempts to write it in the latex format. Due to this
all the tex converters will aim to attempt to convert to valid html
tags.

"""

from lexor import init, load_aux
from lexor.core.writer import NodeWriter

INFO = init(
    version=(0, 0, 1, 'final', 0),
    lang='latex',
    type='writer',
    description='Writes HTML files in LaTeX form.',
    url='http://jmlopez-rod.github.io/lexor-lang/latex-writer-default',
    author='Manuel Lopez',
    author_email='*****@*****.**',
    license='BSD License',
    path=__file__
)
DEFAULTS = {
    'width': '70',
    'add_block': '',
    'del_block': '',
    'header': 'setext',
    'hashheader': 'closed',
}
MOD = load_aux(INFO)
MAPPING = {
    'latex': MOD['latex'].LatexNW,
Exemple #8
0
    lexor example.html to html~min@comment="Copyright:"~

will be

    <!--Copyright: ML--><html><br/> content. </html>

"""

from lexor import init, load_aux

INFO = init(
    version=(0, 0, 1, 'final', 0),
    lang='html',
    type='writer',
    description='Writes HTML files to minimize the file size.',
    url='http://jmlopez-rod.github.io/lexor-lang/html-writer-min',
    author='Manuel Lopez',
    author_email='*****@*****.**',
    license='BSD License',
    path=__file__
)
MOD = load_aux(INFO)['nw']
DEFAULTS = {
    'comment': '',
}
MAPPING = {
    '#text': MOD.TextNW,
    '#comment': MOD.CommentNW,
    '#doctype': MOD.DoctypeNW,
    '#cdata-section': MOD.CDataNW,
    '__default__': MOD.DefaultNW,
    </parent>

then this style will print

    <parent att1="val1" att2="val2">
        <child/>
    </parent>

"""

from lexor import init, load_aux

INFO = init(
    version=(0, 0, 1, 'final', 0),
    lang='xml',
    type='writer',
    description='Writes XML files with no text node processing.',
    url='http://jmlopez-rod.github.io/lexor-lang/xml-writer-plain',
    author='Manuel Lopez',
    author_email='*****@*****.**',
    license='BSD License',
    path=__file__
)
MOD = load_aux(INFO)['nw']
MAPPING = {
    '#comment': MOD.CommentNW,
    '#doctype': MOD.DoctypeNW,
    '#cdata-section': MOD.CDataNW,
    '__default__': MOD.DefaultNW,
}
Converts a lexor file to a valid latex file. Note that when using
python embeddings, everything outputed by the print statement will be
parsed in html (should be in latex but the parser is not yet
available).

"""

from lexor import init, load_aux

INFO = init(
    version=(0, 0, 1, 'final', 1),
    lang='lexor',
    to_lang='latex',
    type='converter',
    description='Convert lexor files to latex.',
    url='http://jmlopez-rod.github.io/'
        'lexor-lang/lexor-converter-latex-default',
    author='Manuel Lopez',
    author_email='*****@*****.**',
    license='BSD License',
    path=__file__
)
DEFAULTS = {
    'error': 'on',
    'exec': 'on',
}
MOD = load_aux(INFO)
REPOSITORY = [
    MOD['define'].DefineNC,
    MOD['define'].MacroNC,
    MOD['define'].UndefineNC,
DEFAULTS = {
    'newline': 'on',  # make sure it is off when running tests
    'todo': 'on',
    'doc-parser-lang': 'lexor',
    'doc-parser-style': '_',
}
INFO = init(
    version=(0, 0, 0, 'alpha', 0),
    lang='es6',
    type='parser',
    description='Parse es6 files. ',
    git={
        'host': 'github',
        'user': '******',
        'repo': 'es6-parser-ioffice'
    },
    author={
        'name': 'Manuel Lopez',
        'email': '*****@*****.**'
    },
    docs='http://jmlopez-rod.github.io/lexor-lang/es6-parser-ioffice',
    license='BSD License',
    path=__file__
)
MOD = load_aux(INFO)
REPOSITORY = [
    MOD['comment'].CommentNP
]
MAPPING = {
    '__default__': (
        '/', [
This style attempts to follow all the XML rules and gathers all the
information in an xml file. This includes all the extra spaces, new
lines and tab characters the file might contain.

"""

from lexor import init, load_aux


INFO = init(
    version=(0, 0, 1, 'final', 0),
    lang='xml',
    type='parser',
    description='Parse XML files using all the valid rules.',
    url='http://jmlopez-rod.github.io/lexor-lang/xml-parser-default',
    author='Manuel Lopez',
    author_email='*****@*****.**',
    license='BSD License',
    path=__file__
)
MOD = load_aux(INFO)
MAPPING = {
    '__default__': (
        '<&', [
            MOD['element'].ElementNP,
            MOD['cdata'].CDataNP,
            MOD['doctype'].DocumentTypeNP,
            MOD['comment'].CommentNP,
            MOD['pi'].ProcessingInstructionNP,
            MOD['entity'].EntityNP,
Exemple #13
0
"""LEXOR: LOG Writer Style

This style displays message nodes provided by other lexor parsing and
converting styles.

"""

from lexor import init
from lexor.core.writer import NodeWriter

INFO = init(
    version=(0, 0, 2, 'final', 2),
    lang='lexor',
    type='writer',
    description='Display messages from parsed/converted documents.',
    url='http://jmlopez-rod.github.io/lexor-lang/lexor-writer-log',
    author='Manuel Lopez',
    author_email='*****@*****.**',
    license='BSD License',
    path=__file__
)
DEFAULTS = {
    'explanation': 'off',
    'module': 'off',
    'nodeid': 'off',
}


class MsgNW(NodeWriter):
    """Display messages stored in the nodes. """
The goal of this style is to take any file, treat it as HTML and
write it in the lexor format. The lexor format is still being
developed. It will essentially be derived from Markdown, Kramdown,
pandoc and other preprocessors out there.

"""

from lexor import init, load_aux

INFO = init(
    version=(0, 0, 1, 'rc', 3),
    lang='lexor',
    type='writer',
    description='Writes files in the lexor format.',
    url='http://jmlopez-rod.github.io/lexor-lang/lexor-writer-default',
    author='Manuel Lopez',
    author_email='*****@*****.**',
    license='BSD License',
    path=__file__
)
DEFAULTS = {
    'width': '70',
    'add_block': '',
    'del_block': '',
    'header': 'setext',
    'hashheader': 'closed',
}
MOD = load_aux(INFO)
MAPPING = {
    'list_item': MOD['list'].LexorListItemNW,
"""XML: DEFAULT Writer Style

This style writes an xml document by showing its tree structure. It
removes extra spaces in the text nodes.

"""

from lexor import init, load_aux

INFO = init(
    version=(0, 0, 1, 'final', 0),
    lang='xml',
    type='writer',
    description='Writes XML files by displaying its tree structure.',
    url='http://jmlopez-rod.github.io/lexor-lang/xml-writer-default',
    author='Manuel Lopez',
    author_email='*****@*****.**',
    license='BSD License',
    path=__file__
)
DEFAULTS = {
    'entity': '%s',
    'tab': '    ',
}
MOD = load_aux(INFO)['nw']
MAPPING = {
    '#text': MOD.TextNW,
    '#entity': '#text',
    '#comment': MOD.CommentNW,
    '#doctype': MOD.DoctypeNW,
    '#cdata-section': MOD.CDataNW,
Exemple #16
0
"""
from lexor import init
from lexor.core.writer import NodeWriter
import lexor.core.elements as core

INFO = init(
    version=(0, 1, 1, 'final', 0),
    lang='lexor',
    type='writer',
    description='Reproduces the lexor builtin method `__repr__`.',
    git={
        'host': 'github',
        'user': '******',
        'repo': 'lexor-writer-repr'
    },
    author={
        'name': 'Manuel Lopez',
        'email': '*****@*****.**'
    },
    docs='http://jmlopez-rod.github.io/'
         'lexor-lang/lexor-writer-repr',
    license='BSD License',
    path=__file__
)
DEFAULTS = {
    'tab_form': '  ',
    'print_id': 'false',
    'print_pos': 'false',
}
TRUE = ['true', 'on', '1']
Exemple #17
0
python embeddings, everything outputed by the print statement will be
parsed in html.

"""

from lexor import init, load_aux

INFO = init(version=(0, 0, 3, 'rc', 0),
            lang='lexor',
            to_lang='html',
            type='converter',
            description='Convert lexor files to html.',
            git={
                'host': 'github',
                'user': '******',
                'repo': 'lexor-converter-html-default'
            },
            author={
                'name': 'Manuel Lopez',
                'email': '*****@*****.**'
            },
            docs='http://jmlopez-rod.github.io/'
            'lexor-lang/lexor-converter-html-default',
            license='BSD License',
            path=__file__)
DEFAULTS = {
    'error': 'on',
    'exec': 'on',
}
MOD = load_aux(INFO)
REPOSITORY = [
    MOD['code'].CodeBlockNC,
Exemple #18
0
from lexor import init
from lexor.core.writer import NodeWriter
import lexor.core.elements as core


RE = re.compile("<module '(?P<name>.*?)' from '(?P<path>.*?)'>")
RE2 = re.compile("<(?P<name>.*?) object at (?P<id>.*?)>")
RE3 = re.compile("<class '(?P<name>.*?)'>")
RE4 = re.compile("<(?P<name>.*?) instance at (?P<id>.*?)>")


INFO = init(
    version=(0, 0, 1, "final", 0),
    lang="xml",
    type="writer",
    description="Write rst file for the lexor-lang project.",
    author="Manuel Lopez",
    author_email="*****@*****.**",
    license="BSD License",
    path=__file__,
)


class DefaultNW(NodeWriter):
    """Default way of writing HTML elements in the plain style. """

    def start(self, node):
        if isinstance(node, core.ProcessingInstruction):
            self.write("<%s" % node.name)
            if "\n" in node.data:
                self.write("\n")
            else:
"""LEXOR: DEFAULT Writer Style

The goal of this style is to take any file, treat it as HTML and
write it in the lexor format. The lexor format is still being
developed. It will essentially be derived from Markdown, Kramdown,
pandoc and other preprocessors out there.

"""

from lexor import init, load_aux

INFO = init(version=(0, 0, 1, 'rc', 3),
            lang='lexor',
            type='writer',
            description='Writes files in the lexor format.',
            url='http://jmlopez-rod.github.io/lexor-lang/lexor-writer-default',
            author='Manuel Lopez',
            author_email='*****@*****.**',
            license='BSD License',
            path=__file__)
DEFAULTS = {
    'width': '70',
    'add_block': '',
    'del_block': '',
    'header': 'setext',
    'hashheader': 'closed',
}
MOD = load_aux(INFO)
MAPPING = {
    'list_item': MOD['list'].LexorListItemNW,
    'ul': MOD['list'].ListNW,