Exemplo n.º 1
0
def test_images():
    assert ('image file not readable: foo.png' in app._warning.getvalue())
    assert ('nonlocal image URI found: http://www.python.org/logo.png'
            in app._warning.getvalue())

    tree = env.get_doctree('images')
    htmlbuilder = StandaloneHTMLBuilder(app)
    htmlbuilder.set_environment(app.env)
    htmlbuilder.init()
    htmlbuilder.imgpath = 'dummy'
    htmlbuilder.post_process_images(tree)
    assert set(htmlbuilder.images.keys()) == \
        set(['subdir/img.png', 'img.png', 'subdir/simg.png', 'svgimg.svg',
             'img.foo.png'])
    assert set(htmlbuilder.images.values()) == \
        set(['img.png', 'img1.png', 'simg.png', 'svgimg.svg', 'img.foo.png'])

    latexbuilder = LaTeXBuilder(app)
    latexbuilder.set_environment(app.env)
    latexbuilder.init()
    latexbuilder.post_process_images(tree)
    assert set(latexbuilder.images.keys()) == \
        set(['subdir/img.png', 'subdir/simg.png', 'img.png', 'img.pdf',
             'svgimg.pdf', 'img.foo.png'])
    assert set(latexbuilder.images.values()) == \
        set(['img.pdf', 'img.png', 'img1.png', 'simg.png',
             'svgimg.pdf', 'img.foo.png'])
Exemplo n.º 2
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for epub must be .html only
     self.out_suffix = '.xhtml'
     self.link_suffix = '.xhtml'
     self.playorder = 0
     self.tocid = 0
Exemplo n.º 3
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for epub must be .html only
     self.out_suffix = '.xhtml'
     self.link_suffix = '.xhtml'
     self.playorder = 0
     self.tocid = 0
Exemplo n.º 4
0
def test_images(app):
    app.build()
    assert ('image file not readable: foo.png'
            in app._warning.getvalue())

    tree = app.env.get_doctree('images')
    htmlbuilder = StandaloneHTMLBuilder(app)
    htmlbuilder.set_environment(app.env)
    htmlbuilder.init()
    htmlbuilder.imgpath = 'dummy'
    htmlbuilder.post_process_images(tree)
    assert set(htmlbuilder.images.keys()) == \
        set(['subdir/img.png', 'img.png', 'subdir/simg.png', 'svgimg.svg',
             'img.foo.png'])
    assert set(htmlbuilder.images.values()) == \
        set(['img.png', 'img1.png', 'simg.png', 'svgimg.svg', 'img.foo.png'])

    latexbuilder = LaTeXBuilder(app)
    latexbuilder.set_environment(app.env)
    latexbuilder.init()
    latexbuilder.post_process_images(tree)
    assert set(latexbuilder.images.keys()) == \
        set(['subdir/img.png', 'subdir/simg.png', 'img.png', 'img.pdf',
             'svgimg.pdf', 'img.foo.png'])
    assert set(latexbuilder.images.values()) == \
        set(['img.pdf', 'img.png', 'img1.png', 'simg.png',
             'svgimg.pdf', 'img.foo.png'])
Exemplo n.º 5
0
def test_images(app):
    app.build()

    tree = app.env.get_doctree('images')
    htmlbuilder = StandaloneHTMLBuilder(app)
    htmlbuilder.set_environment(app.env)
    htmlbuilder.init()
    htmlbuilder.imgpath = 'dummy'
    htmlbuilder.post_process_images(tree)
    assert set(htmlbuilder.images.keys()) == \
        set(['subdir/img.png', 'img.png', 'subdir/simg.png', 'svgimg.svg',
             'img.foo.png'])
    assert set(htmlbuilder.images.values()) == \
        set(['img.png', 'img1.png', 'simg.png', 'svgimg.svg', 'img.foo.png'])

    latexbuilder = LaTeXBuilder(app)
    latexbuilder.set_environment(app.env)
    latexbuilder.init()
    latexbuilder.post_process_images(tree)
    assert set(latexbuilder.images.keys()) == \
        set(['subdir/img.png', 'subdir/simg.png', 'img.png', 'img.pdf',
             'svgimg.pdf', 'img.foo.png'])
    assert set(latexbuilder.images.values()) == \
        set(['img.pdf', 'img.png', 'img1.png', 'simg.png',
             'svgimg.pdf', 'img.foo.png'])
    def init(self):
        StandaloneHTMLBuilder.init(self)

        # Pull project data from conf.py if it exists
        context = self.config.html_context
        if 'current_version' in context:
            self.version = context['current_version']
        if 'slug' in context:
            self.project = context['slug']

        # Put in our media files instead of putting them in the docs.
        for index, file in enumerate(self.script_files):
            if file in MEDIA_MAPPING.keys():
                self.script_files[index] = MEDIA_MAPPING[file] % context['MEDIA_URL']
                if file == "_static/jquery.js":
                    self.script_files.insert(index+1, "%sjavascript/jquery/jquery-migrate-1.2.1.min.js" % context['MEDIA_URL'])

        if 'html_theme' in context and context['html_theme'] == 'sphinx_rtd_theme':
            self.css_files.append('%scss/sphinx_rtd_theme.css' % context['MEDIA_URL'])
        else:
            self.css_files.append('%scss/badge_only.css' % context['MEDIA_URL'])

        # Analytics codes
        #self.script_files.append('_static/readthedocs-ext.js')
        #self.script_files.append('%sjavascript/analytics.js' % context['MEDIA_URL'])

        # We include the media servers version here so we can update rtd.js across all
        # documentation without rebuilding every one. 
        # If this script is embedded in each build, 
        # then updating the file across all docs is basically impossible.
        self.script_files.append('%sjavascript/readthedocs-doc-embed.js' % context['MEDIA_URL'])
        self.css_files.append('%scss/readthedocs-doc-embed.css' % context['MEDIA_URL'])
Exemplo n.º 7
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for epub must be .html only
     self.out_suffix = '.xhtml'
     self.link_suffix = '.xhtml'
     self.playorder = 0
     self.tocid = 0
     self.use_index = self.get_builder_config('use_index', 'epub')
Exemplo n.º 8
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for epub must be .html only
     self.out_suffix = '.xhtml'
     self.link_suffix = '.xhtml'
     self.playorder = 0
     self.tocid = 0
     self.use_index = self.get_builder_config('use_index', 'epub')
Exemplo n.º 9
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for HTML help must be .html only
     self.out_suffix = '.html'
     # determine the correct locale setting
     locale = chm_locales.get(self.config.language)
     if locale is not None:
         self.lcid, self.encoding = locale
Exemplo n.º 10
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for HTML help must be .html only
     self.out_suffix = '.html'
     # determine the correct locale setting
     locale = chm_locales.get(self.config.language)
     if locale is not None:
         self.lcid, self.encoding = locale
Exemplo n.º 11
0
 def init(self):
     # type: () -> None
     # the output files for HTML help is .html by default
     self.out_suffix = '.html'
     self.link_suffix = '.html'
     StandaloneHTMLBuilder.init(self)
     # determine the correct locale setting
     locale = chm_locales.get(self.config.language)
     if locale is not None:
         self.lcid, self.encoding = locale
Exemplo n.º 12
0
 def init(self):
     # type: () -> None
     StandaloneHTMLBuilder.init(self)
     # the output files for epub must be .html only
     self.out_suffix = '.xhtml'
     self.link_suffix = '.xhtml'
     self.playorder = 0
     self.tocid = 0
     self.id_cache = {}  # type: Dict[unicode, unicode]
     self.use_index = self.get_builder_config('use_index', 'epub')
Exemplo n.º 13
0
 def init(self):
     # type: () -> None
     StandaloneHTMLBuilder.init(self)
     # the output files for epub must be .html only
     self.out_suffix = '.xhtml'
     self.link_suffix = '.xhtml'
     self.playorder = 0
     self.tocid = 0
     self.id_cache = {}  # type: Dict[unicode, unicode]
     self.use_index = self.get_builder_config('use_index', 'epub')
Exemplo n.º 14
0
 def init(self):
     # type: () -> None
     # the output files for HTML help is .html by default
     self.out_suffix = '.html'
     self.link_suffix = '.html'
     StandaloneHTMLBuilder.init(self)
     # determine the correct locale setting
     locale = chm_locales.get(self.config.language)
     if locale is not None:
         self.lcid, self.encoding = locale
Exemplo n.º 15
0
    def init(self):
        StandaloneHTMLBuilder.init(self)

        # Pull project data from conf.py if it exists
        context = self.config.html_context
        if context.has_key('current_version'):
            self.version = context['current_version']
        if context.has_key('slug'):
            self.project = context['slug']

        self.storage = WebStorage(builder=self)

        # add our custom bits
        self.script_files.append('_static/jquery.pageslide.js')
        self.script_files.append('_static/websupport2-bundle.js')
        self.css_files.append('_static/websupport2.css')
        self.css_files.append('_static/sphinxweb.css')
        self.css_files.append('_static/jquery.pageslide.css')
Exemplo n.º 16
0
 def init(self):
     # type: () -> None
     StandaloneHTMLBuilder.init(self)
     self.out_suffix = '.html'
     self.link_suffix = '.html'
Exemplo n.º 17
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for HTML help must be .html only
     self.out_suffix = '.html'
Exemplo n.º 18
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     self.out_suffix = '.html'
Exemplo n.º 19
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for mobi must be .html only
     self.out_suffix = '.html'
     self.playorder = 0
Exemplo n.º 20
0
 def init(self):
     # type: () -> None
     StandaloneHTMLBuilder.init(self)
     # the output files for HTML help must be .html only
     self.out_suffix = '.html'
     self.link_suffix = '.html'
Exemplo n.º 21
0
 def init(self):
     # type: () -> None
     StandaloneHTMLBuilder.init(self)
     # the output files for HTML help must be .html only
     self.out_suffix = '.html'
     self.link_suffix = '.html'
Exemplo n.º 22
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for mobi must be .html only
     self.out_suffix = '.html'
     self.playorder = 0
Exemplo n.º 23
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for HTML help must be .html only
     self.out_suffix = '.html'
Exemplo n.º 24
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
Exemplo n.º 25
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     self.toctree = Toctree(self._render_title, self.get_relative_uri)
Exemplo n.º 26
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     finalize_media(self)
Exemplo n.º 27
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     self.toctree = Toctree(self._render_title, self.get_relative_uri)
Exemplo n.º 28
0
 def init(self):
     StandaloneHTMLBuilder.init(self)
     finalize_comment_media(self)
Exemplo n.º 29
0
 def init(self):
     # type: () -> None
     StandaloneHTMLBuilder.init(self)
     self.out_suffix = '.html'
     self.link_suffix = '.html'