Exemplo n.º 1
0
from sphinx.highlighting import lexers
from pygments.lexers.web import PhpLexer
from pygments.lexers.web import HtmlLexer
from pygments.lexers.shell import BashLexer

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
    'sensio.sphinx.refinclude', 'sensio.sphinx.configurationblock',
    'sensio.sphinx.phpcode', 'sphinx.ext.autodoc', 'sphinx.ext.doctest',
    'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.ifconfig',
    'sphinxcontrib.youtube'
]
lexers['php'] = PhpLexer(startinline=True)
lexers['php-annotations'] = PhpLexer(startinline=True)
lexers['html'] = HtmlLexer()
lexers['bash'] = BashLexer()

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix of source filenames.
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
Exemplo n.º 2
0
import sys, os
import sphinx_rtd_theme

import recommonmark
from recommonmark.transform import AutoStructify

from sphinx.highlighting import lexers
from pygments.lexers.web import PhpLexer
from pygments.lexers.web import HtmlLexer
from pygments.lexers.web import JsonLexer

from datetime import datetime

lexers['php'] = PhpLexer(startinline=True)
lexers['php-annotations'] = PhpLexer(startinline=True)
lexers['html'] = HtmlLexer(startinline=True)
lexers['json'] = JsonLexer(startinline=True)

extensions = [
    'recommonmark',
    'sphinx_rtd_theme',
]

source_suffix = ['.rst', '.md']
master_doc = 'index'

project = 'Warden'
copyright = '2019 by David Alger.'
author = 'David Alger'
version = ''
release = ''
Exemplo n.º 3
0
__author__ = 'faye'
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import os
from pygments import highlight
from pygments.lexers.web import HtmlLexer
from pygments.formatters.html import HtmlFormatter

for directory, subdirectories, files in os.walk("../ct_studies"):
    for file in files:
        f = open(os.path.join(directory, file), "r+")
        highlighted = highlight(f.read(), HtmlLexer(), HtmlFormatter())
        open(os.path.join(directory, file), "w").close()
        f.write(highlighted)
        f.write('<style>' + HtmlFormatter().get_style_defs('.highlight') +
                '</style>')
        #print highlighted
        #print HtmlFormatter().get_style_defs('.highlight')
        f.close()