|
30 | 30 |
|
31 | 31 | import argparse
|
32 | 32 | import os
|
| 33 | +import platform |
33 | 34 | import posixpath
|
34 | 35 | import shutil
|
35 | 36 | import sys
|
36 | 37 | import textwrap
|
37 | 38 | import webbrowser
|
38 | 39 |
|
| 40 | +if platform.system() == 'Windows': |
| 41 | + python = 'py' |
| 42 | +else: |
| 43 | + python = 'python3' |
| 44 | + |
39 | 45 | try:
|
40 | 46 | import mistune
|
41 | 47 | except ImportError:
|
42 | | - import platform |
43 | | - if platform.system() == 'Windows': |
44 | | - python = 'py' |
45 | | - else: |
46 | | - python = 'python3' |
47 | 48 | print("mistune isn't installed.", file=sys.stderr)
|
48 | 49 | print("You can install it by running this command on a terminal or ")
|
49 | 50 | print("command prompt:")
|
50 | 51 | print()
|
51 | | - print(" %s -m pip install --user mistune" % python) |
| 52 | + print(" %s -m pip install mistune" % python) |
52 | 53 | sys.exit(1)
|
53 | 54 |
|
54 | 55 | try:
|
@@ -112,7 +113,7 @@ def fix_filename(filename):
|
112 | 113 | return filename
|
113 | 114 |
|
114 | 115 |
|
115 | | -class TutorialRenderer(mistune.Renderer): |
| 116 | +class TutorialRenderer(mistune.HTMLRenderer): |
116 | 117 |
|
117 | 118 | def __init__(self, pygments_style):
|
118 | 119 | super().__init__()
|
@@ -226,8 +227,7 @@ def main():
|
226 | 227 | if pygments is None:
|
227 | 228 | print("Pygments isn't installed. You can install it like this:")
|
228 | 229 | print()
|
229 | | - print(">>> import pip") |
230 | | - print(">>> pip.main(['install', '--user', 'pygments'])") |
| 230 | + print(" %s -m pip install pygments" % python) |
231 | 231 | print()
|
232 | 232 | print("You can also continue without Pygments, but the code examples")
|
233 | 233 | print("will not be colored.")
|
|
0 commit comments