summaryrefslogtreecommitdiffstats
path: root/tools/md_browser
diff options
context:
space:
mode:
authordpranke <dpranke@chromium.org>2015-10-05 18:20:48 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-06 01:22:14 +0000
commitf87211d56e86be9d68e637e47e7fdfbbcb8834d6 (patch)
treeb882410cd2e04011e1d9a1abc862b6534a35f704 /tools/md_browser
parente5421b13225d3dd9006be2b9f22d038bc9c300b1 (diff)
downloadchromium_src-f87211d56e86be9d68e637e47e7fdfbbcb8834d6.zip
chromium_src-f87211d56e86be9d68e637e47e7fdfbbcb8834d6.tar.gz
chromium_src-f87211d56e86be9d68e637e47e7fdfbbcb8834d6.tar.bz2
Revert of Check in a simple pure-python based Markdown previewer. (patchset #3 id:90001 of https://codereview.chromium.org/1356203004/ )
Reason for revert: checklicenses.py is complaining: http://build.chromium.org/p/chromium/builders/Linux/builds/67561 Original issue's description: > Check in a simple pure-python based Markdown previewer. > > We are now trying to write more and more of our documentation > as Markdown files that live in the repo, but there's no easy > way to preview changes in a local checkout. > > This CL adds a simple previewing tool written in pure Python > that depends on the 'Markdown' python package (also pure Python) > to do all the heavy lifting. It aims to replicate the look > and feel of googlesource.com as closely as possible. > > R=nodir@chromium.org, jam@chromium.org > BUG= > > Committed: https://crrev.com/abe11cb68dd11d5ee153218ba99a3cdba3a3ced6 > Cr-Commit-Position: refs/heads/master@{#352450} TBR=nodir@chromium.org,jam@chromium.org,scottmg@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG= Review URL: https://codereview.chromium.org/1389543003 Cr-Commit-Position: refs/heads/master@{#352503}
Diffstat (limited to 'tools/md_browser')
-rw-r--r--tools/md_browser/OWNERS2
-rw-r--r--tools/md_browser/README.md27
-rw-r--r--tools/md_browser/doc.css298
-rw-r--r--tools/md_browser/footer.html8
-rw-r--r--tools/md_browser/header.html7
-rw-r--r--tools/md_browser/md_browser.py102
6 files changed, 0 insertions, 444 deletions
diff --git a/tools/md_browser/OWNERS b/tools/md_browser/OWNERS
deleted file mode 100644
index 3fc266c..0000000
--- a/tools/md_browser/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-dpranke@chromium.org
-nodir@chromium.org
diff --git a/tools/md_browser/README.md b/tools/md_browser/README.md
deleted file mode 100644
index 05d6b9d..0000000
--- a/tools/md_browser/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# md_browser
-
-This is a simple tool to render the markdown docs in a chromium checkout
-locally. It is written in Python and uses the Python 'markdown' package,
-which is checked into src/third_party.
-
-md_browser attempts to emulate the flavor of Markdown implemented by
-[Gitiles](https://gerrit.googlesource.com/gitiles/+/master/Documentation/markdown.md).
-
-Gitiles is the source browser running on https://chromium.googlesource.com,
-and can be run locally, but to do so requires a Java install and a Buck
-install, which can be slightly annoying to set up on Mac or Windows.
-
-This is a lighterweight solution, which also allows you to preview uncommitted
-changes (i.e., it just serves files out of the filesystem, and is not a
-full Git repo browser like Gitiles is).
-
-To run md_browser:
-
-1. cd to the top of your chromium checkout
-
-2. run `python tools/md_browser/md_browser.py`
-
-3. There is no step three.
-
-This will run a local web server on port 8080 that points to the top
-of the repo. You can specify a different port with the `-p` flag.
diff --git a/tools/md_browser/doc.css b/tools/md_browser/doc.css
deleted file mode 100644
index 93ea5fc..0000000
--- a/tools/md_browser/doc.css
+++ /dev/null
@@ -1,298 +0,0 @@
-/**
- * Copyright 2015 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* This file is cloned from
- * https://gerrit.googlesource.com/gitiles/+/master/gitiles-servlet/src/main/resources/com/google/gitiles/static/doc.css
- */
-
-html.doc-page, .doc {
- font-family: arial,sans-serif;
-}
-.doc-page body {
- margin: 0;
-}
-
-.banner {
- min-height: 44px;
- margin: 0;
- padding: 14px 15px 13px;
- border-bottom: 1px solid #eee;
-}
-.banner h1, .banner h2 {
- float: left;
- font-size: 32px;
- font-weight: 300;
- line-height: 1.375;
- margin: 0;
-}
-.banner img {
- margin: -1px 10px -4px 0px;
- vertical-align: middle;
-}
-.banner a, .banner a:hover {
- text-decoration: none;
-}
-.banner, .banner a:link, .banner a:visited {
- color: #777;
-}
-.banner h2:before {
- border-right: 1px solid #eee;
- content: "";
- float: left;
- height: 44px;
- margin: 0 12px 0 14px;
-}
-
-.nav, .footer-line {
- color: #333;
- padding: 0 15px;
- background: #eee;
-}
-.nav ul {
- list-style: none;
- margin: 0;
- padding: 6px 0;
-}
-.nav li {
- float: left;
- font-size: 14px;
- line-height: 1.43;
- margin: 0 20px 0 0;
- padding: 6px 0;
-}
-.nav li a, .footer-line a {
- color: #7a7af9;
-}
-.nav li a:hover {
- color: #0000f9;
-}
-.banner:after, .nav ul:after, .cols:after {
- clear: both;
- content: "";
- display: block;
-}
-
-.nav-aux, .doc {
- max-width: 978px;
-}
-.nav-aux, .doc-page .doc {
- margin: auto;
-}
-
-.footer-break {
- clear: both;
- margin: 120px 0 0 0;
-}
-.footer-line {
- font-size: 13px;
- line-height: 30px;
- height: 30px;
-}
-.footer-line ul {
- list-style: none;
- margin: 0;
- padding: 0;
-}
-.footer-line li {
- display: inline;
-}
-.footer-line li+li:before {
- content: "ยท";
- padding: 0 5px;
-}
-.footer-line .nav-aux {
- position: relative;
-}
-.gitiles-att {
- color: #A0ADCC;
- position: absolute;
- top: 0;
- right: 0;
-}
-.gitiles-att a {
- font-style: italic;
-}
-
-/* Markdown rendered in /+doc/ or tree view page . */
-
-.doc {
- color: #444;
- font-size: 13px;
- line-height: normal;
-}
-
-.doc h1, .doc h2, .doc h3, .doc h4, .doc h5, .doc h6 {
- font-family: "open sans",arial,sans-serif;
- font-weight: bold;
- color: #444;
- height: auto;
- white-space: normal;
- overflow: visible;
- margin: 0.67em 0 0.67em 0;
-}
-.doc h1 {
- font-size: 20px;
- margin: 0.67em 0 0.67em 0;
-}
-.doc h2 {
- font-size: 16px;
- margin: 0.67em 0 0.67em 0;
-}
-.doc h3 {
- font-size: 14px;
- margin: 0.67em 0 0.67em 0;
-}
-.doc h4 {
- font-size: 13px;
- margin: 1em 0 1em 0;
-}
-.doc h5 {
- font-size: 13px;
- margin: 1.3em 0 1.3em 0;
-}
-.doc h6 {
- font-size: 13px;
- margin: 1.6em 0 1.6em 0;
-}
-
-.doc a { text-decoration: none; }
-.doc a:link { color: #245dc1; }
-.doc a:visited { color: #7759ae; }
-.doc a:hover { text-decoration: underline; }
-
-.doc ul, .doc ol {
- margin: 10px 10px 10px 30px;
- padding: 0;
-}
-
-.doc img {
- border: 0;
- max-width: 100%;
-}
-.doc iframe {
- min-width: 100px;
- min-height: 30px;
-}
-iframe.noborder {
- border: 0;
-}
-
-.doc em {
- font-weight: normal;
- font-style: italic;
-}
-.doc strong {
- font-weight: bold;
- color: inherit;
-}
-
-.doc pre {
- border: 1px solid silver;
- background: #fafafa;
- margin: 0 2em 0 2em;
- padding: 2px;
-}
-.doc code, .doc .code {
- color: #060;
- font: 13px/1.54 "courier new",courier,monospace;
-}
-
-.doc dl dt {
- margin-top: 1em;
-}
-
-.doc table {
- border-collapse: collapse;
- border-spacing: 0;
-}
-.doc th {
- text-align: center;
-}
-.doc th, .doc td {
- border: 1px solid #eee;
- padding: 4px 12px;
- vertical-align: top;
-}
-.doc th {
- background-color: #f5f5f5;
-}
-
-.toc {
- margin-top: 30px;
-}
-.toc-aux {
- padding: 2px;
- background: #f9f9f9;
- border: 1px solid #f2f2f2;
- border-radius: 4px;
-}
-.toc h2 {
- margin: 0 0 5px 0;
-}
-.toc ul {
- margin: 0 0 0 30px;
-}
-.toc ul li {
- margin-left: 0px;
- list-style: disc;
-}
-.toc ul ul li {
- list-style: circle;
-}
-
-.note, .promo, .aside {
- border: 1px solid;
- border-radius: 4px;
- margin: 10px 0;
- padding: 10px;
-}
-.note {
- background: #fffbe4;
- border-color: #f8f6e6;
-}
-.promo {
- background: #f6f9ff;
- border-color: #eff2f9;
-}
-.aside {
- background: #f9f9f9;
- border-color: #f2f2f2;
-}
-.note :first-child,
-.promo :first-child,
-.aside :first-child {
- margin-top: 0;
-}
-.note p:last-child,
-.promo p:last-child,
-.aside p:last-child {
- margin-bottom: 0;
-}
-
-.cols {
- margin: 0 -1.533%;
- width: 103.067%;
-}
-.col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
-.col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
- float: left;
- margin: 0 1.488% 20px;
-}
-.col-1 { width: 5.357%; }
-.col-2 { width: 13.690%; }
-.col-3 { width: 22.024%; }
-.col-4 { width: 30.357%; }
-.col-5 { width: 38.690%; }
-.col-6 { width: 47.024%; }
-.col-7 { width: 55.357%; }
-.col-8 { width: 63.690%; }
-.col-9 { width: 72.024%; }
-.col-10 { width: 80.357%; }
-.col-11 { width: 88.690%; }
-.col-12 { width: 97.024%; }
-.cols hr {
- width: 80%;
-}
diff --git a/tools/md_browser/footer.html b/tools/md_browser/footer.html
deleted file mode 100644
index 8aab624..0000000
--- a/tools/md_browser/footer.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<div class="footer-break"></div>
-<div class="footer-line">
-<div class="nav-aux">
-<div class="gitiles-att"></div>
-</div>
-</div>
-</body>
-</html>
diff --git a/tools/md_browser/header.html b/tools/md_browser/header.html
deleted file mode 100644
index 939eb94..0000000
--- a/tools/md_browser/header.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3CDTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html class="doc-page">
-<head>
-<link rel="stylesheet" type="text/css" href="/doc.css" />
-</head>
-<body>
-<div class="doc">
diff --git a/tools/md_browser/md_browser.py b/tools/md_browser/md_browser.py
deleted file mode 100644
index 7fb51eb2..0000000
--- a/tools/md_browser/md_browser.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Simple Markdown browser for a Git checkout."""
-from __future__ import print_function
-
-import SimpleHTTPServer
-import SocketServer
-import argparse
-import codecs
-import os
-import socket
-import sys
-
-
-THIS_DIR = os.path.abspath(os.path.dirname(__file__))
-SRC_DIR = os.path.dirname(os.path.dirname(THIS_DIR))
-sys.path.append(os.path.join(SRC_DIR, 'third_party', 'Python-Markdown'))
-import markdown
-
-
-def main(argv):
- parser = argparse.ArgumentParser(prog='md_browser')
- parser.add_argument('-p', '--port', type=int, default=8080,
- help='port to run on (default = %(default)s)')
- args = parser.parse_args(argv)
-
- try:
- s = Server(args.port, SRC_DIR)
- print("Listening on http://localhost:%s/" % args.port)
- s.serve_forever()
- s.shutdown()
- return 0
- except KeyboardInterrupt:
- return 130
-
-
-class Server(SocketServer.TCPServer):
- def __init__(self, port, top_level):
- SocketServer.TCPServer.__init__(self, ('0.0.0.0', port), Handler)
- self.port = port
- self.top_level = top_level
-
- def server_bind(self):
- self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- self.socket.bind(self.server_address)
-
-
-class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
- def do_GET(self):
- full_path = os.path.abspath(os.path.join(self.server.top_level,
- self.path[1:]))
- if not full_path.startswith(SRC_DIR):
- self._DoUnknown()
- elif self.path == '/doc.css':
- self._WriteTemplate('doc.css')
- elif not os.path.exists(full_path):
- self._DoNotFound()
- elif self.path.lower().endswith('.md'):
- self._DoMD()
- else:
- self._DoUnknown()
-
- def _DoMD(self):
- extensions = [
- 'markdown.extensions.fenced_code',
- 'markdown.extensions.tables',
- 'markdown.extensions.toc',
- ]
-
- contents = self._Read(self.path[1:])
- md_fragment = markdown.markdown(contents,
- extensions=extensions,
- output_format='html4').encode('utf-8')
- try:
- self._WriteTemplate('header.html')
- self.wfile.write(md_fragment)
- self._WriteTemplate('footer.html')
- except:
- raise
-
- def _DoNotFound(self):
- self.wfile.write('<html><body>%s not found</body></html>' % self.path)
-
- def _DoUnknown(self):
- self.wfile.write('<html><body>I do not know how to serve %s.</body>'
- '</html>' % self.path)
-
- def _Read(self, relpath):
- assert not relpath.startswith(os.sep)
- path = os.path.join(self.server.top_level, relpath)
- with codecs.open(path, encoding='utf-8') as fp:
- return fp.read()
-
- def _WriteTemplate(self, template):
- contents = self._Read(os.path.join('tools', 'md_browser', template))
- self.wfile.write(contents.encode('utf-8'))
-
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv[1:]))