def setup(app): ''' Sets up the extension. ''' # new config values app.add_config_value("tagline", "My blog", True) app.add_config_value("description", "My blog", True) app.add_config_value("author", "Winston Smith", True) app.add_config_value("rss_service", None, True) app.add_config_value("rss_generate_full_posts", False, True) app.add_config_value("website", "http://127.0.0.1/blog/html/", True) app.add_config_value("posts_per_page", 10, True) # new directives app.add_directive("author", author.AuthorDirective) app.add_directive("comments", metadata.CommentsDirective) app.add_directive("tags", filing.create_filing_directive("tags")) app.add_directive("categories", filing.create_filing_directive("categories")) app.add_directive("more", readmore.InsertReadMoreLink) # create a new Sphinx event which gets called when we generate aggregated # pages app._events["html-collected-context"] = "pagename, templatename, context" # event handlers app.connect("builder-inited", initialize) app.connect("source-read", source_read) app.connect("env-updated", env_updated) app.connect("html-page-context", html_page_context) app.connect("html-collect-pages", html_collect_pages) app.connect("html-collected-context", html_collected_context) # monkey-patch Sphinx html translator to emit proper HTML5 html5.patch_translator()
def setup(app): ''' Sets up the extension. ''' # new config values app.add_config_value("tagline", "My blog", True) app.add_config_value("description", "My blog", True) app.add_config_value("author", "Winston Smith", True) app.add_config_value("rss_service", None, True) app.add_config_value("rss_generate_full_posts", False, True) app.add_config_value("website", "http://127.0.0.1/blog/html/", True) app.add_config_value("posts_per_page", 10, True) app.add_config_value("landing_page", None, True) app.add_config_value("first_page_title", None, True) # added here for consistency, slug_word_separator is used by Tinkerer # command line and not really needed by the Sphinx environment app.add_config_value("slug_word_separator", "_", True) app.add_config_value("rss_max_items", 0, True) # new directives app.add_directive("author", author.AuthorDirective) app.add_directive("comments", metadata.CommentsDirective) app.add_directive("tags", filing.create_filing_directive("tags")) app.add_directive("categories", filing.create_filing_directive("categories")) app.add_directive("more", readmore.InsertReadMoreLink) # create a new Sphinx event which gets called when we generate aggregated # pages app.events.events[ "html-collected-context"] = "pagename, templatename, context" # event handlers app.connect("builder-inited", initialize) app.connect("source-read", source_read) app.connect("env-updated", env_updated) app.connect("html-page-context", html_page_context) app.connect("html-collect-pages", html_collect_pages) app.connect("html-collected-context", html_collected_context) # monkey-patch Sphinx html translator to emit proper HTML5 html5.patch_translator()