/usr/lib/python2.7/dist-packages/landslide/main.py is in python-landslide 1.1.3-0.0.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from optparse import OptionParser
from landslide import generator
from . import __version__
def _parse_options():
""" Parses ``landslide`` args options.
"""
parser = OptionParser(
usage="%prog [options] input.md ...",
description="Generates an HTML5 or PDF "
"slideshow from Markdown or other formats",
epilog="Note: PDF export requires the `prince` program: "
"http://princexml.com/",
version="%prog " + __version__)
parser.add_option(
"-c", "--copy-theme",
action="store_true",
dest="copy_theme",
help="Copy theme directory into current presentation source directory",
default=False)
parser.add_option(
"-b", "--debug",
action="store_true",
dest="debug",
help="Will display any exception trace to stdout",
default=False)
parser.add_option(
"-d", "--destination",
dest="destination_file",
help="The path to the to the destination file: .html or "
".pdf extensions allowed (default: presentation.html)",
metavar="FILE",
default="presentation.html")
parser.add_option(
"-e", "--encoding",
dest="encoding",
help="The encoding of your files (defaults to utf8)",
metavar="ENCODING",
default="utf8")
parser.add_option(
"-i", "--embed",
action="store_true",
dest="embed",
help="Embed stylesheet and javascript contents, "
"base64-encoded images in presentation to make a "
"standalone document",
default=False)
parser.add_option(
"-l", "--linenos",
type="choice",
choices=generator.VALID_LINENOS,
dest="linenos",
help="How to output linenos in source code. Three options availables: "
"no (no line numbers); "
"inline (inside <pre> tag); "
"table (lines numbers in another cell, copy-paste friendly)",
default="inline",
)
parser.add_option(
"-o", "--direct-output",
action="store_true",
dest="direct",
help="Prints the generated HTML code to stdout; won't work with PDF "
"export",
default=False)
parser.add_option(
"-P", "--no-presenter-notes",
action="store_false",
dest="presenter_notes",
help="Don't include presenter notes in the output",
default=True)
parser.add_option(
"-q", "--quiet",
action="store_false",
dest="verbose",
help="Won't write anything to stdout (silent mode)",
default=False)
parser.add_option(
"-r", "--relative",
action="store_true",
dest="relative",
help="Make your presentation asset links relative to current pwd; "
"This may be useful if you intend to publish your html "
"presentation online.",
default=False,
)
parser.add_option(
"-t", "--theme",
dest="theme",
help="A theme name, or path to a landlside theme directory",
default='default')
parser.add_option(
"-v", "--verbose",
action="store_true",
dest="verbose",
help="Write informational messages to stdout (enabled by default)",
default=True)
parser.add_option(
"-x", "--extensions",
dest="extensions",
help="Comma-separated list of extensions for Markdown",
default='',
)
parser.add_option(
"-w", "--watch",
action="store_true",
dest="watch",
help="Watch source directory for changes and regenerate slides",
default=False
)
parser.add_option(
"-m", "--math-output",
action="store_true",
dest="math_output",
help="Enable mathematical output using MathJax",
default=False
)
(options, args) = parser.parse_args()
if not args:
parser.print_help()
sys.exit(1)
return options, args[0]
def log(message, type):
"""Basic logger, print output directly to stdout and errors to stderr.
"""
(sys.stdout if type == 'notice' else sys.stderr).write(message + "\n")
def run(input_file, options):
""" Runs the Generator using parsed options.
"""
options.logger = log
generator.Generator(input_file, **options.__dict__).execute()
def main():
""" Main program entry point.
"""
options, input_file = _parse_options()
if (options.debug):
run(input_file, options)
else:
try:
run(input_file, options)
except Exception as e:
sys.stderr.write("Error: %s\n" % e)
sys.exit(1)
if __name__ == '__main__':
main()
|