Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: app/handlers/doc.py

Issue 162403002: Remove docs and point to ones on dartlang.org. (Closed) Base URL: https://github.com/dart-lang/pub-dartlang.git@master
Patch Set: Re-upload. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: app/handlers/doc.py
diff --git a/app/handlers/doc.py b/app/handlers/doc.py
deleted file mode 100644
index a92bc3c714d90da0cc6f68267d5b5c6073a3bb9b..0000000000000000000000000000000000000000
--- a/app/handlers/doc.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-import codecs
-import itertools
-import os
-import re
-
-import cherrypy
-import yaml
-
-import handlers
-
-class Doc(object):
- """The handler for /doc/*."""
-
- def index(self):
- raise cherrypy.HTTPRedirect('/doc/')
-
- def show(self, filename):
- """Display a documentation page.
-
- Each page is static HTML wrapped in a dynamic layout. The HTML is
- generated offline from Markdown source files in /doc; the titles are
- loaded from those source files as well.
- """
-
- # Redirect from the old names for the commands.
- if filename == 'pub-install.html':
- raise cherrypy.HTTPRedirect('/doc/pub-get.html')
-
- if filename == 'pub-update.html':
- raise cherrypy.HTTPRedirect('/doc/pub-upgrade.html')
-
- if filename == '': filename = 'index.html'
- root = os.path.join(os.path.dirname(__file__), '..')
-
- html_path = os.path.join(root, 'views', 'doc', filename)
- if not os.path.isfile(html_path):
- handlers.http_error(404)
-
- markdown_filename = re.sub("\.html$", ".markdown", filename)
- markdown_path = os.path.join(root, 'doc', markdown_filename)
- with codecs.open(markdown_path, encoding='utf-8') as f:
- frontmatter = self._frontmatter(f)
-
- with codecs.open(html_path, encoding='utf-8') as f:
- html = """<article>
- <h1>%s</h1>
- %s
- </article>""" % (frontmatter['title'], f.read())
- return handlers.layout(html, title=frontmatter['title'])
-
- def _frontmatter(self, f):
- """Parses the YAML frontmatter of a file."""
- if f.readline() != '---\n': return {}
- yaml_lines = itertools.takewhile(lambda line: line != '---\n', f)
- return yaml.load(''.join(yaml_lines))
« no previous file with comments | « app/doc/versioning.markdown ('k') | app/pub_dartlang.py » ('j') | app/views/index.mustache » ('J')

Powered by Google App Engine
This is Rietveld 408576698