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

Side by Side Diff: tools/md_browser/md_browser.py

Issue 1488693002: [md_browser] Add markdown.extensions.def_list to list of supported extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Simple Markdown browser for a Git checkout.""" 5 """Simple Markdown browser for a Git checkout."""
6 from __future__ import print_function 6 from __future__ import print_function
7 7
8 import SimpleHTTPServer 8 import SimpleHTTPServer
9 import SocketServer 9 import SocketServer
10 import argparse 10 import argparse
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 self._WriteTemplate('doc.css') 94 self._WriteTemplate('doc.css')
95 elif not os.path.exists(full_path): 95 elif not os.path.exists(full_path):
96 self._DoNotFound() 96 self._DoNotFound()
97 elif path.lower().endswith('.md'): 97 elif path.lower().endswith('.md'):
98 self._DoMD(path) 98 self._DoMD(path)
99 else: 99 else:
100 self._DoUnknown() 100 self._DoUnknown()
101 101
102 def _DoMD(self, path): 102 def _DoMD(self, path):
103 extensions = [ 103 extensions = [
104 'markdown.extensions.def_list',
104 'markdown.extensions.fenced_code', 105 'markdown.extensions.fenced_code',
105 'markdown.extensions.tables', 106 'markdown.extensions.tables',
106 'markdown.extensions.toc', 107 'markdown.extensions.toc',
107 'gitiles_ext_blocks', 108 'gitiles_ext_blocks',
108 ] 109 ]
109 extension_configs = { 110 extension_configs = {
110 'markdown.extensions.toc': { 111 'markdown.extensions.toc': {
111 'slugify': _gitiles_slugify 112 'slugify': _gitiles_slugify
112 }, 113 },
113 } 114 }
(...skipping 23 matching lines...) Expand all
137 with codecs.open(path, encoding='utf-8') as fp: 138 with codecs.open(path, encoding='utf-8') as fp:
138 return fp.read() 139 return fp.read()
139 140
140 def _WriteTemplate(self, template): 141 def _WriteTemplate(self, template):
141 contents = self._Read(os.path.join('tools', 'md_browser', template)) 142 contents = self._Read(os.path.join('tools', 'md_browser', template))
142 self.wfile.write(contents.encode('utf-8')) 143 self.wfile.write(contents.encode('utf-8'))
143 144
144 145
145 if __name__ == '__main__': 146 if __name__ == '__main__':
146 sys.exit(main(sys.argv[1:])) 147 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698