-
Notifications
You must be signed in to change notification settings - Fork 2
/
__init__.py
59 lines (45 loc) · 1.36 KB
/
__init__.py
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
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Copyright (c) Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# ----------------------------------------------------------------------------
"""Python wrapper around syntect library."""
# Standard library imports
import os.path as osp
# Local imports
from .syntect import (highlight, load_syntax_folder, load_theme_folder,
escape_to_console, escape_to_latex,
Style, Color, FontStyleConst,
Syntax, Theme, SyntaxSet, ThemeSet, LoadingError,
SyntaxNotFoundError, __version__)
HERE = osp.dirname(osp.abspath(__file__))
GRAMMARS = osp.join(HERE, 'grammars')
class FontStyle:
"""Font style modifiers"""
BOLD = FontStyleConst.bold()
ITALIC = FontStyleConst.italic()
UNDERLINE = FontStyleConst.underline()
def load_default_syntax() -> SyntaxSet:
"""Load the default syntax definitions included with pysyntect."""
return load_syntax_folder(GRAMMARS)
# Package functions
highlight
load_syntax_folder
load_theme_folder
escape_to_console
escape_to_latex
# Package classes
Style
Color
FontStyle
Syntax
Theme
SyntaxSet
ThemeSet
# Exception classes
LoadingError
SyntaxNotFoundError
# Package version
__version__