FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
aws-cli/doc/source/guzzle_sphinx_theme/__init__.py at develop · gitqueue/aws-cli · GitHub
gitqueue
/
aws-cli
Public
forked from
aws/aws-cli
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
aws-cli
/
doc
/
source
/
guzzle_sphinx_theme
/
__init__.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
157 lines (127 loc) · 6.9 KB
Breadcrumbs
aws-cli
/
doc
/
source
/
guzzle_sphinx_theme
/
__init__.py
Copy path
File metadata and controls
157 lines (127 loc) · 6.9 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
"""Sphinx Guzzle theme."""
import
os
import
xml
.
etree
.
ElementTree
as
ET
from
docutils
import
nodes
from
sphinx
.
locale
import
admonitionlabels
from
sphinx
.
writers
.
html
import
HTMLTranslator
as
SphinxHTMLTranslator
from
pygments
.
style
import
Style
from
pygments
.
token
import
Keyword
,
Name
,
Comment
,
String
,
Error
, \
Number
,
Operator
,
Generic
,
Whitespace
,
Punctuation
,
Other
,
Literal
def
setup
(
app
):
"""Setup conntects events to the sitemap builder"""
app
.
connect
(
'html-page-context'
,
add_html_link
)
app
.
connect
(
'build-finished'
,
create_sitemap
)
app
.
sitemap_links
=
[]
def
add_html_link
(
app
,
pagename
,
templatename
,
context
,
doctree
):
"""As each page is built, collect page names for the sitemap"""
base_url
=
app
.
config
[
'html_theme_options'
].
get
(
'base_url'
,
''
)
if
base_url
:
app
.
sitemap_links
.
append
(
base_url
+
pagename
+
".html"
)
def
create_sitemap
(
app
,
exception
):
"""Generates the sitemap.xml from the collected HTML page links"""
if
(
not
app
.
config
[
'html_theme_options'
].
get
(
'base_url'
,
''
)
or
exception
is
not
None
or
not
app
.
sitemap_links
):
return
filename
=
app
.
outdir
+
"/sitemap.xml"
print
(
"Generating sitemap.xml in %s"
%
filename
)
root
=
ET
.
Element
(
"urlset"
)
root
.
set
(
"xmlns"
,
"http://www.sitemaps.org/schemas/sitemap/0.9"
)
for
link
in
app
.
sitemap_links
:
url
=
ET
.
SubElement
(
root
,
"url"
)
ET
.
SubElement
(
url
,
"loc"
).
text
=
link
ET
.
ElementTree
(
root
).
write
(
filename
)
def
html_theme_path
():
return
[
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))]
class
HTMLTranslator
(
SphinxHTMLTranslator
):
"""
Handle translating to bootstrap structure.
"""
def
visit_table
(
self
,
node
,
name
=
''
):
"""
Override docutils default table formatter to not include a border
and to use Bootstrap CSS
See: http://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/docutils/writers/html4css1/__init__.py#l1550
"""
self
.
context
.
append
(
self
.
compact_p
)
self
.
compact_p
=
True
classes
=
' '
.
join
([
'table'
,
'table-bordered'
,
self
.
settings
.
table_style
]).
strip
()
self
.
body
.
append
(
self
.
starttag
(
node
,
'table'
,
CLASS
=
classes
))
def
depart_table
(
self
,
node
):
"""
This needs overridin' too
"""
self
.
compact_p
=
self
.
context
.
pop
()
self
.
body
.
append
(
'</table>
\n
'
)
class
GuzzleStyle
(
Style
):
background_color
=
"#f8f8f8"
default_style
=
""
styles
=
{
# No corresponding class for the following:
#Text: "", # class: ''
Whitespace
:
"underline #f8f8f8"
,
# class: 'w'
Error
:
"#a40000 border:#ef2929"
,
# class: 'err'
Other
:
"#000000"
,
# class 'x'
Comment
:
"italic #8f5902"
,
# class: 'c'
Comment
.
Preproc
:
"noitalic"
,
# class: 'cp'
Keyword
:
"bold #004461"
,
# class: 'k'
Keyword
.
Constant
:
"bold #004461"
,
# class: 'kc'
Keyword
.
Declaration
:
"bold #004461"
,
# class: 'kd'
Keyword
.
Namespace
:
"bold #004461"
,
# class: 'kn'
Keyword
.
Pseudo
:
"bold #004461"
,
# class: 'kp'
Keyword
.
Reserved
:
"bold #004461"
,
# class: 'kr'
Keyword
.
Type
:
"bold #004461"
,
# class: 'kt'
Operator
:
"#582800"
,
# class: 'o'
Operator
.
Word
:
"bold #004461"
,
# class: 'ow' - like keywords
Punctuation
:
"bold #000000"
,
# class: 'p'
# because special names such as Name.Class, Name.Function, etc.
# are not recognized as such later in the parsing, we choose them
# to look the same as ordinary variables.
Name
:
"#000000"
,
# class: 'n'
Name
.
Attribute
:
"#006EC4"
,
# class: 'na' - to be revised
Name
.
Builtin
:
"#004461"
,
# class: 'nb'
Name
.
Builtin
.
Pseudo
:
"#3465a4"
,
# class: 'bp'
Name
.
Class
:
"#000000"
,
# class: 'nc' - to be revised
Name
.
Constant
:
"#000000"
,
# class: 'no' - to be revised
Name
.
Decorator
:
"#888"
,
# class: 'nd' - to be revised
Name
.
Entity
:
"#ce5c00"
,
# class: 'ni'
Name
.
Exception
:
"bold #cc0000"
,
# class: 'ne'
Name
.
Function
:
"#000000"
,
# class: 'nf'
Name
.
Property
:
"#000000"
,
# class: 'py'
Name
.
Label
:
"#f57900"
,
# class: 'nl'
Name
.
Namespace
:
"#000000"
,
# class: 'nn' - to be revised
Name
.
Other
:
"#000000"
,
# class: 'nx'
Name
.
Tag
:
"bold #004461"
,
# class: 'nt' - like a keyword
Name
.
Variable
:
"#000000"
,
# class: 'nv' - to be revised
Name
.
Variable
.
Class
:
"#000000"
,
# class: 'vc' - to be revised
Name
.
Variable
.
Global
:
"#000000"
,
# class: 'vg' - to be revised
Name
.
Variable
.
Instance
:
"#000000"
,
# class: 'vi' - to be revised
Number
:
"#990000"
,
# class: 'm'
Literal
:
"#000000"
,
# class: 'l'
Literal
.
Date
:
"#000000"
,
# class: 'ld'
String
:
"#4e9a06"
,
# class: 's'
String
.
Backtick
:
"#4e9a06"
,
# class: 'sb'
String
.
Char
:
"#4e9a06"
,
# class: 'sc'
String
.
Doc
:
"italic #8f5902"
,
# class: 'sd' - like a comment
String
.
Double
:
"#4e9a06"
,
# class: 's2'
String
.
Escape
:
"#4e9a06"
,
# class: 'se'
String
.
Heredoc
:
"#4e9a06"
,
# class: 'sh'
String
.
Interpol
:
"#4e9a06"
,
# class: 'si'
String
.
Other
:
"#4e9a06"
,
# class: 'sx'
String
.
Regex
:
"#4e9a06"
,
# class: 'sr'
String
.
Single
:
"#4e9a06"
,
# class: 's1'
String
.
Symbol
:
"#4e9a06"
,
# class: 'ss'
Generic
:
"#000000"
,
# class: 'g'
Generic
.
Deleted
:
"#a40000"
,
# class: 'gd'
Generic
.
Emph
:
"italic #000000"
,
# class: 'ge'
Generic
.
Error
:
"#ef2929"
,
# class: 'gr'
Generic
.
Heading
:
"bold #000080"
,
# class: 'gh'
Generic
.
Inserted
:
"#00A000"
,
# class: 'gi'
Generic
.
Output
:
"#888"
,
# class: 'go'
Generic
.
Prompt
:
"#745334"
,
# class: 'gp'
Generic
.
Strong
:
"bold #000000"
,
# class: 'gs'
Generic
.
Subheading
:
"bold #800080"
,
# class: 'gu'
Generic
.
Traceback
:
"bold #a40000"
,
# class: 'gt'
}
Back
|
FazBrowse Home
|
New Git URL