Example #1
0
def all_stories() -> Tuple[Story, ...]:
    story0 = Story(component=BaseLayout,
                   props=dict(
                       language='EN',
                       extrahead=None,
                   ))

    story1 = Story(component=BaseLayout,
                   plugins=(themabaster, ),
                   singletons=(
                       (sc, SphinxConfig),
                       (html_config, HTMLConfig),
                       (page_context, PageContext),
                       (theme_config, ThemeConfig),
                   ),
                   usage=html('<{BaseLayout} />'))

    story2 = Story(component=BaseLayout,
                   plugins=(themabaster, ),
                   singletons=(
                       (sc, SphinxConfig),
                       (html_config, HTMLConfig),
                       (page_context, PageContext),
                       (theme_config, ThemeConfig),
                   ),
                   usage=html('<{BaseLayout} doctype={doctype} />'))

    return story0, story1, story2
Example #2
0
    def __call__(self) -> VDOM:
        return html('''\n
{[
html('<link rel={link["rel"]} href={link["href"]} title={link["title"]} />')
for link in self.resolved_links
]}
        ''')
Example #3
0
    def __call__(self) -> VDOM:
        if self.display_toc:
            return html('''\n
<h3><a href={self.resolved_pathto}>Table of Contents</a></h3>
{self.toc}
            ''')
        return html('')
Example #4
0
def all_stories() -> Tuple[Story, ...]:
    story0 = Story(
        component=AboutTravisButton,
        props=dict(
            travis_button=theme_config.travis_button,
            travis_path=theme_config.travis_path,
            github_repo=theme_config.github_repo,
            github_user=theme_config.github_user,
            badge_branch=theme_config.badge_branch,
        ),
    )
    story1 = Story(
        component=AboutTravisButton,
        props=dict(
            travis_button=True,
            travis_path=theme_config.travis_path,
            github_repo='thisrepo',
            github_user='******',
            badge_branch=theme_config.badge_branch,
        ),
    )
    story2 = Story(component=AboutTravisButton,
                   usage=html('<{AboutTravisButton} />'))
    story3 = Story(
        component=AboutTravisButton,
        usage=html(
            '<{AboutTravisButton} travis_button={True} github_repo="thisrepo" github_user="******" />'
        ))

    return story0, story1, story2, story3
Example #5
0
def all_stories() -> Tuple[Story, ...]:
    story0 = Story(
        component=Donate,
        props=dict(
            donate_url=theme_config.donate_url,
            opencollective=theme_config.opencollective,
            opencollective_button_color=theme_config.opencollective_button_color,
            project=sphinx_config.project,
            tidelift_url=theme_config.tidelift_url,
        ),
    )
    story1 = Story(
        component=Donate,
        props=dict(
            donate_url='someurl',
            opencollective=theme_config.opencollective,
            opencollective_button_color=theme_config.opencollective_button_color,
            project=sphinx_config.project,
            tidelift_url=theme_config.tidelift_url,
        ),
    )
    story2 = Story(
        component=Donate,
        usage=html('<{Donate} />')
    )
    story3 = Story(
        component=Donate,
        usage=html(
            '<{Donate} donate_url="donate.com" opencollective="opencollective.com" tidelift_url="tidelift.com"  />')
    )

    return story0, story1, story2, story3
Example #6
0
def all_stories() -> Tuple[Story, ...]:
    story0 = Story(
        component=AboutGitHubButton,
        props=dict(
            github_button=theme_config.github_button,
            github_repo=theme_config.github_repo,
            github_user=theme_config.github_user,
            github_type=theme_config.github_type,
            github_count=theme_config.github_count,
        ),
    )
    story1 = Story(
        component=AboutGitHubButton,
        props=dict(
            github_button=True,
            github_repo='repo',
            github_user='******',
            github_count='true',
            github_type='watch',
        ),
    )
    story2 = Story(component=AboutGitHubButton,
                   usage=html('<{AboutGitHubButton} />'))

    story3 = Story(
        component=AboutGitHubButton,
        usage=html(
            '<{AboutGitHubButton} github_button={True} github_repo="thisrepo" github_user="******" /> '
        ))

    return story0, story1, story2, story3
Example #7
0
    def __call__(self) -> VDOM:
        shortcut = html(
            '<link rel="shortcut icon" type="image/x-icon" href={self.shortcut_href} />'
        ) if self.shortcut_href else None
        png = html(
            '<link rel="shortcut icon" type="image/x-icon" href={self.png_href} />'
        ) if self.png_href else None
        precomposed = html(
            '<link rel="apple-touch-icon-precomposed" type="image/x-icon" href={self.png_href} />'
        ) if self.png_href else None
        if self.favicons.sizes:
            sizes = []
            for size in self.favicons.sizes:
                size_href = self.pathto(join('static', size.filename), 1)
                size_size = size.size
                sizes.append(
                    html(
                        '<link rel="apple-touch-icon-precomposed" sizes={size_size} href={size_href} />'
                    ))
        else:
            sizes = None
        return html('''\n
{shortcut}
{png}
{precomposed}
{sizes}
        ''')
Example #8
0
    def __call__(self) -> VDOM:
        if not self.sidebars:
            return html('')
        else:
            return html('''\n
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
    <div class="sphinxsidebarwrapper">
        {[sidebar for sidebar in self.resolved_sidebars]}
    </div>
</div>
                    ''')
Example #9
0
 def __post_init__(self):
     # Alabaster wraps the main content in <div class="bodywrapper">
     # if nosidebar is true. Thus, get the main content first, then
     # insert in the two flavors of response.
     main_content = html('''\n
     <{Relbar1}/>
       <div class="body" role="main">
         {self.body}
       </div>          
     <{Relbar2}/>        
             ''')
     self.inner = main_content if self.nosidebar else html('<div class="bodywrapper">{main_content}</div>')
Example #10
0
    def __post_init__(self):
        self.resolved_previous = html('''\n
<li>
    &larr;
    <a href="{self.previous.link}" title="Previous Document">{self.previous.title}</a>
</li>
''') if self.previous else None
        self.resolved_next = html('''\n
<li>
    <a href="{self.next.link}" title="Next Document">{self.next.title}</a>
    &rarr;
</li>
''') if self.previous else None
Example #11
0
    def __call__(self) -> VDOM:
        if self.show_sourcelink and self.has_source and self.sourcename:
            return html('''\n
<div role="note" aria-label="source link" data-testid="sourcelink">
    <h3>This Page</h3>
    <ul class="this-page-menu">
        <li>
            <a href={self.resolved_pathto} rel="nofollow">Show Source</a>
        </li>
    </ul>
</div>
            ''')
        return html('')
Example #12
0
    def __post_init__(self):
        self.resolved_copyright = f'&copy; {self.copyright}.' if self.copyright else ''
        self.resolved_powered_by = html('''\n
{'|' if self.copyright else ''}
Powered by <a href="http://sphinx-doc.org/">Sphinx</a>
        ''') if self.show_powered_by else html('')
        if self.show_sourcelink and self.has_source and self.sourcename:
            ps = self.pathto(f'_sources/{self.sourcename}')
            self.resolved_page_source = html('''\n
{'|' if self.show_copyright or self.show_powered_by else ''}
<a href={ps} rel="nofollow">Page source</a>
            ''')
        else:
            self.resolved_page_source = html('')
Example #13
0
def main():
    site = dict(title='My Site')
    page = dict(title='My Page')

    return render(html('''
        <{App} site={site} page={page} />
'''))
Example #14
0
def main():
    todos = ['first']
    return render(
        html('''
      <h1>{title}</h1>
      <{TodoList} todos={todos} />
    '''))
Example #15
0
    def __call__(self) -> VDOM:
        return html('''\n
<{AboutLogo} />
<{AboutDescription} />
<{AboutGitHubButton} />
<{AboutTravisButton} />
        ''')
Example #16
0
def all_stories() -> Tuple[Story, ...]:
    story0 = Story(
        component=LocalToc,
        props=dict(
            display_toc=page_context.display_toc,
            master_doc=sphinx_config.master_doc,
            pathto=page_context.pathto,
            toc=page_context.toc,
        ),
    )
    story1 = Story(
        component=LocalToc,
        props=dict(
            display_toc=False,
            master_doc=sphinx_config.master_doc,
            pathto=page_context.pathto,
            toc=page_context.toc,
        ),
    )
    story2 = Story(
        component=LocalToc,
        usage=html('<{LocalToc} />')
    )

    return story0, story1, story2
Example #17
0
def all_stories() -> Tuple[Story, ...]:
    story0 = Story(
        component=FaviconSet,
        props=dict(
            favicons=dataclasses.replace(theme_config.favicons),
            pathto=fake_pathto,
        ),
    )
    story1 = Story(
        component=FaviconSet,
        props=dict(
            favicons=no_shortcut,
            pathto=fake_pathto,
        ),
    )
    story2 = Story(
        component=FaviconSet,
        props=dict(
            favicons=no_sizes,
            pathto=fake_pathto,
        ),
    )
    story3 = Story(component=FaviconSet, usage=html('<{FaviconSet} />'))

    return story0, story1, story2, story3
Example #18
0
def all_stories() -> Tuple[Story, ...]:
    story0 = Story(component=Head,
                   props=dict(
                       extrahead=None,
                       pathto=fake_pathto,
                   ))

    story1 = Story(component=Head,
                   props=dict(
                       extrahead=extrahead,
                       pathto=fake_pathto,
                   ))

    story2 = Story(component=Head,
                   scannables=(
                       canonical_link,
                       cssfiles,
                       faviconset,
                       jsfiles,
                       linktags,
                       title,
                   ),
                   usage=html('<{Head} />'))

    return story0, story1, story2
Example #19
0
def all_stories() -> Tuple[Story, ...]:
    story0 = Story(component=Body, )

    story1 = Story(component=Body,
                   plugins=(themabaster, ),
                   usage=html('<{Body} />'))

    return story0, story1
Example #20
0
def all_stories() -> Tuple[Story, ...]:
    story0 = Story(component=Content, )

    story1 = Story(component=Content,
                   scannables=(relbar1, ),
                   usage=html(f'<{Content} />'))

    return story0, story1
Example #21
0
    def __call__(self) -> VDOM:
        return html('''\n
<div class="footer">
    {self.resolved_copyright}
    {self.resolved_powered_by}
    {self.resolved_page_source}
</div>
        ''')
Example #22
0
    def __call__(self) -> VDOM:
        return html('''\n
<body>
<{Header} />
<{Content} />
<{Footer} />
</body>
''')
Example #23
0
    def __call__(self) -> VDOM:
        if self.pagename != 'search' and self.builder != 'singlehtml':
            return html('''\n
<div id="searchbox" style="display: none" role="search" data-testid="searchbox">
    <h3>{{ _('Quick search') }}</h3>
    <div class="searchformwrapper">
        <form class="search" action="{self.resolved_pathto}" method="get">
          <input type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
            ''')
        return html('')
Example #24
0
def all_stories() -> Tuple[Story, ...]:
    story0 = Story(
        component=Header,
        props=dict(),
    )
    story1 = Story(component=Header, usage=html('<{Header} />'))

    return story0, story1
Example #25
0
    def __call__(self) -> VDOM:
        return html('''\n
{self.doctype}
<html ...{self.html_props}>
    <{Head} extrahead={self.extrahead} />
    <{Body} />
</html>
        ''')
Example #26
0
    def __call__(self):
        c = self.children
        return html('''\
<section>
    <h1>{self.site_name}</h1>
    <div>{self.children}</div>
</section>
        ''')
Example #27
0
def all_stories() -> Tuple[Story, ...]:
    story0 = Story(
        component=Sidebar1,
        props=dict(),
    )
    story1 = Story(component=Sidebar1, usage=html('<{Sidebar1} />'))

    return story0, story1
Example #28
0
 def __call__(self) -> Optional[VDOM]:
     if self.show_button:
         return html('''\n
     <p>
         <iframe src="https://ghbtns.com/github-btn.html?user={self.github_user}&repo={self.github_repo}&type={self.github_type}&count={self.github_count}&size=large&v=2"
                 allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
     </p>            
         ''')
     return None
Example #29
0
    def __call__(self) -> VDOM:
        return html('''\n
<{Sidebar1} />
<div class="document">
    <{Document} />
    <{Sidebar2} />
    <div class="clearer"></div>
</div>
''')
Example #30
0
    def __call__(self) -> VDOM:
        return html('''\n
<nav id="rellinks">
    <ul>
        {self.resolved_previous}
        {self.resolved_next}
    </ul>
</nav>       
        ''')