/usr/lib/python2.7/dist-packages/plasTeX/Config.py is in python-plastex 0.9.2-1.2.
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | import os
from ConfigManager import *
c = config = ConfigManager()
#
# General
#
general = c.add_section('general')
general['renderer'] = StringOption(
""" Renderer to use for conversion """,
options = '--renderer',
default = 'XHTML',
)
general['theme'] = StringOption(
""" Theme for the renderer to use """,
options = '--theme',
default = 'default',
)
general['copy-theme-extras'] = BooleanOption(
""" Copy files associated with the theme to the output directory """,
options = '--copy-theme-extras !--no-theme-extras',
default = True,
)
general['kpsewhich'] = StringOption(
""" Program which locates LaTeX files and packages """,
options = '--kpsewhich',
default = 'kpsewhich',
)
def readconfig(file):
""" Read a configuration file """
if not os.path.isfile(file):
print >>sys.stderr, "WARNING: Could not load config file '%s'" % file
return
config.read(file)
general['config'] = StringOption(
"""
Load additional configuration file
This configuration file will be loaded during the processing of
command-line options. However, configuration files cannot override
command-line options. So no matter what is in the configuration file,
if an option is specified on the command-line, it will always win.
To eliminate any confusion, this should generally be the first
argument.
""",
options = '--config -c',
callback = readconfig,
)
general['paux-dirs'] = MultiOption(
"""
Directories where *.paux files should be loaded from.
""",
options = '--paux-dirs',
)
#
# Links
#
links = c.add_section('links')
def getstring(data):
""" Return a string which may or may not be quoted """
data = list(data.lstrip())
if not data:
return ''
s = []
for quote in '\'"':
if data[0] == quote:
data.pop(0)
while data:
if data[0] == quote:
data.pop(0)
break
s.append(data.pop(0))
return ''.join(s), ''.join(data)
while data:
if data[0] != ' ':
s.append(data.pop(0))
continue
break
return ''.join(s), ''.join(data)
def setlinks(data):
""" Set links in the configuration """
data = data[1:-1].strip()
key, data = getstring(data)
url, data = getstring(data)
title, data = getstring(data)
if not title:
title = url
url = ''
if title:
links['%s-title' % key] = StringOption(default=title)
if url:
links['%s-url' % key] = StringOption(default=url)
links[';links'] = CompoundOption(
""" Set links for use in navigation """,
options = '--link',
category = 'document',
callback = setlinks,
)
#
# Counters
#
counters = c.add_section('counters')
def setcounter(data):
""" Set counters in the configuration """
value = [x for x in data[1:-1].split() if x]
if len(value) == 2:
counters[value[0]] = IntegerOption(default=int(value[1]))
counters[';counters'] = CompoundOption(
""" Set initial counter values """,
options = '--counter',
category = 'document',
callback = setcounter,
)
#
# Files
#
files = c.add_section('files')
c.add_category('files', 'File Handling Options')
files['input-encoding'] = StringOption(
""" Input file encoding """,
options = '--input-encoding',
default = 'utf-8',
category = 'files',
)
files['output-encoding'] = StringOption(
""" Output file encoding """,
options = '--output-encoding',
default = 'utf-8',
category = 'files',
)
files['escape-high-chars'] = BooleanOption(
""" Escape characters that are higher than 7-bit """,
options = '--escape-high-chars',
default = False,
category = 'files',
)
files['split-level'] = IntegerOption(
""" Highest section level that generates a new file """,
options = '--split-level',
default = 2,
category = 'files',
)
def setFilename(data):
""" If there is only one filename specified, turn off splitting """
data = data.strip()
if ' ' in data:
return data
if '[' in data:
return data
files['split-level'] = -10
return data
files['filename'] = StringOption(
""" Template for output filenames """,
options = '--filename',
default = 'index [$id, sect$num(4)]',
category = 'files',
callback = setFilename,
)
files['bad-chars'] = StringOption(
""" Characters that should not be allowed in a filename """,
options = '--bad-filename-chars',
default = ': #$%^&*!~`"\'=?/{}[]()|<>;\\,.',
category = 'files',
)
files['bad-chars-sub'] = StringOption(
""" Character that should be used instead of an illegal character """,
options = '--bad-filename-chars-sub',
default = '-',
category = 'files',
)
files['directory'] = StringOption(
""" Directory to put output files into """,
options = '--dir -d',
category = 'files',
default = '$jobname',
)
#
# Images
#
images = c.add_section('images')
c.add_category('images', 'Image Generation Options')
images['base-url'] = StringOption(
""" Base URL for all images """,
options = '--image-base-url',
category = 'images',
)
images['enabled'] = BooleanOption(
""" Enable image generation """,
options = '--enable-images !--disable-images',
default = True,
category = 'images',
)
images['imager'] = StringOption(
""" LaTeX to image program """,
options = '--imager',
default = 'dvipng dvi2bitmap gspdfpng gsdvipng OSXCoreGraphics',
category = 'images',
)
images['vector-imager'] = StringOption(
""" LaTeX to vector image program """,
options = '--vector-imager',
default = 'none dvisvgm',
category = 'images',
)
images['filenames'] = StringOption(
""" Template for image filenames """,
options = '--image-filenames',
default = 'images/img-$num(4)',
category = 'images',
)
images['baseline-padding'] = IntegerOption(
""" Amount to pad the image below the baseline """,
options = '--image-baseline-padding',
default = 0,
category = 'images',
)
images['scale-factor'] = FloatOption(
""" Factor to scale externally included images by """,
options = '--image-scale-factor',
default = 1.0,
category = 'images',
)
images['compiler'] = StringOption(
""" LaTeX command to use when compiling image document """,
options = '--image-compiler',
category = 'images',
)
images['cache'] = BooleanOption(
""" Enable image caching between runs """,
options = '--enable-image-cache !--disable-image-cache',
default = False,
category = 'images',
)
images['save-file'] = BooleanOption(
""" Should the temporary images.tex file be saved for debugging? """,
options = '--save-image-file !--delete-image-file',
default = False,
category = 'images',
)
images['transparent'] = BooleanOption(
""" Specifies whether the image backgrounds should be transparent or not """,
options = '--transparent-images !--opaque-images',
default = False,
category = 'images',
)
images['resolution'] = IntegerOption(
""" Resolution of images document """,
options = '--image-resolution',
default = 0,
category = 'images',
)
#
# Document
#
doc = c.add_section('document')
c.add_category('document', 'Document Options')
doc['base-url'] = StringOption(
""" Base URL for inter-node links """,
options = '--base-url',
category = 'document',
)
doc['title'] = StringOption(
"""
Title for the document
This option specifies a title to use instead of the title
specified in the LaTeX document.
""",
options = '--title',
category = 'document',
)
doc['toc-depth'] = IntegerOption(
""" Number of levels to display in the table of contents """,
options = '--toc-depth',
category = 'document',
default = 3,
)
doc['toc-non-files'] = BooleanOption(
""" Display sections that do not create files in the table of contents """,
options = '--toc-non-files',
category = 'document',
default = False,
)
doc['sec-num-depth'] = IntegerOption(
""" Maximum section depth to display section numbers """,
options = '--sec-num-depth',
category = 'document',
default = 2,
)
doc['index-columns'] = IntegerOption(
""" Number of columns to split the index entries into """,
options = '--index-columns',
category = 'document',
default = 2,
)
doc['lang-terms'] = StringOption(
""" Specifies a '%s' delimited list of files that contain language terms """ % os.pathsep,
options = '--lang-terms',
category = 'document',
default = '',
)
config.read('~/.plasTeXrc')
config.read('/usr/local/etc/plasTeXrc')
config.read(os.path.join(os.path.dirname(__file__), 'plasTeXrc'))
del c
|