Skip to content

Commit 797a62b

Browse files
committed
Add rtd
1 parent 0bf9eed commit 797a62b

File tree

9 files changed

+580
-0
lines changed

9 files changed

+580
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ share/pkg/brew
2020
share/pkg/nixos
2121
share/pkg/pentoo
2222

23+
# rtd
24+
share/doc/_build/
25+
share/doc/make.bat
26+
share/doc/linkcheck
27+
share/doc/venv
28+
2329

2430
# --------------------------------------------------------------------------------------------------
2531
# Tests

.readthedocs.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Required
2+
version: 2
3+
4+
# Build documentation in the docs/ directory with Sphinx
5+
sphinx:
6+
configuration: share/doc/conf.py
7+
8+
# Optionally build your docs in additional formats such as PDF
9+
formats: []
10+
11+
# Optionally set the version of Python and requirements required to build your docs
12+
python:
13+
version: 3.7
14+
install:
15+
- requirements: share/doc/requirements.txt

share/doc/Makefile

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
ifneq (,)
2+
.error This Makefile requires GNU Make.
3+
endif
4+
5+
# -------------------------------------------------------------------------------------------------
6+
# Default configuration
7+
# -------------------------------------------------------------------------------------------------
8+
.PHONY: help build autobuild linkcheck linkcheck2
9+
10+
11+
# -------------------------------------------------------------------------------------------------
12+
# Default Target
13+
# -------------------------------------------------------------------------------------------------
14+
15+
help:
16+
@echo "build Build and test documentation"
17+
@echo "autobuild Continuously run and build (http://0.0.0.0:8000)"
18+
@echo "linkcheck Sphinx linkcheck"
19+
@echo "linkcheck2 Custom linkcheck"
20+
21+
22+
# -------------------------------------------------------------------------------------------------
23+
# Target
24+
# -------------------------------------------------------------------------------------------------
25+
26+
linkcheck2:
27+
docker run \
28+
--rm \
29+
$$(tty -s && echo "-it" || echo) \
30+
-v $(PWD):/data \
31+
cytopia/linkcheck -l -k -r 60 -t 30 -e rst -c '200,204' _includes/
32+
33+
linkcheck:
34+
docker run \
35+
--rm \
36+
$$(tty -s && echo "-it" || echo) \
37+
-e SPHINX_PROJECT="doc" \
38+
-e SPHINX_PORT=8000 \
39+
-e NEW_UID="$$(id -u)" \
40+
-e NEW_GID="$$(id -g)" \
41+
-v $(PWD)/..:/shared/httpd \
42+
devilbox/python-sphinx:3.8-dev \
43+
sphinx-build -M linkcheck . _build
44+
45+
build:
46+
docker run \
47+
--rm \
48+
$$(tty -s && echo "-it" || echo) \
49+
-e SPHINX_PROJECT="doc" \
50+
-e SPHINX_PORT=8000 \
51+
-e NEW_UID="$$(id -u)" \
52+
-e NEW_GID="$$(id -g)" \
53+
-v $(PWD)/..:/shared/httpd \
54+
devilbox/python-sphinx:3.8-dev \
55+
sphinx-build -a -E -n -j auto -W . _build/html
56+
57+
autobuild:
58+
docker run \
59+
--rm \
60+
$$(tty -s && echo "-it" || echo) \
61+
-e SPHINX_PROJECT="doc" \
62+
-e SPHINX_PORT=8000 \
63+
-e NEW_UID="$$(id -u)" \
64+
-e NEW_GID="$$(id -g)" \
65+
-p "8000:8000" \
66+
-v $(PWD)/..:/shared/httpd \
67+
devilbox/python-sphinx:3.8-dev \
68+
sphinx-autobuild -a -E -n -j auto -W -H 0.0.0.0 -p 8000 . _build/html

share/doc/_static/css/pwncat.css

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/************************************************************
2+
* MENU
3+
***********************************************************/
4+
5+
/* overwrite logo dimensions */
6+
.wy-side-nav-search>a img.logo,
7+
.wy-side-nav-search .wy-dropdown>a img.logo {
8+
width: 128px;
9+
}
10+
11+
/* overwrite top-left serach div */
12+
.wy-side-nav-search {
13+
background-color: #343131;
14+
}
15+
16+
/* sidebar category headlines */
17+
.wy-menu-vertical header, .wy-menu-vertical p.caption {
18+
margin-top: 25px;
19+
margin-bottom: 15px;
20+
padding: 0 1.518em;
21+
padding-top:10px;
22+
border-top: 1px solid #9b9b9b;
23+
font-size: 100%;
24+
}
25+
26+
27+
/************************************************************
28+
* Code blocks
29+
***********************************************************/
30+
31+
/* Disable annoying scrollbar in code-blocks */
32+
.codeblock,
33+
pre.literal-block,
34+
.rst-content .literal-block,
35+
.rst-content pre.literal-block,
36+
.rst-content div[class^='highlight'],
37+
div[class^='highlight'] {
38+
overflow: hidden !important;
39+
}
40+
/* bg color for code windows */
41+
.highlight {
42+
background-color: #ffffff !important;
43+
}
44+
.rst-content .code-block-caption {
45+
text-align: left !important;
46+
}
47+
/*
48+
div.rtd-pro.rtd-pro-footer {
49+
display: none;
50+
}
51+
*/
52+
53+
54+
/************************************************************
55+
* Custom overwrites
56+
***********************************************************/
57+
/*
58+
table.install, table.install th.head {
59+
text-align: center;
60+
}
61+
*/
62+
div.contents p {
63+
margin-bottom: 10px;
64+
}

share/doc/conf.py

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Configuration file for the Sphinx documentation builder.
4+
#
5+
# This file does only contain a selection of the most common options. For a
6+
# full list see the documentation:
7+
# http://www.sphinx-doc.org/en/stable/config
8+
import os
9+
10+
# -- Path setup --------------------------------------------------------------
11+
12+
# If extensions (or modules to document with autodoc) are in another directory,
13+
# add these directories to sys.path here. If the directory is relative to the
14+
# documentation root, use os.path.abspath to make it absolute, like shown here.
15+
#
16+
# import os
17+
# import sys
18+
# sys.path.insert(0, os.path.abspath('.'))
19+
from recommonmark.parser import CommonMarkParser
20+
21+
22+
# -- Project information -----------------------------------------------------
23+
24+
project = u'pwncat'
25+
copyright = u'2020, cytopia'
26+
author = u'cytopia'
27+
28+
# The short X.Y version
29+
version = u'0.1.1'
30+
# The full version, including alpha/beta/rc tags
31+
release = u'0.1.1'
32+
33+
34+
# -- General configuration ---------------------------------------------------
35+
36+
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
37+
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
38+
39+
# If your documentation needs a minimal Sphinx version, state it here.
40+
#
41+
# needs_sphinx = '1.0'
42+
43+
# Add any Sphinx extension module names here, as strings. They can be
44+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
45+
# ones.
46+
extensions = [
47+
'sphinx.ext.todo'
48+
]
49+
50+
todo_include_todos = True
51+
52+
# Add any paths that contain templates here, relative to this directory.
53+
templates_path = ['_templates']
54+
55+
# The suffix(es) of source filenames.
56+
# You can specify multiple suffix as a list of string:
57+
#
58+
source_suffix = '.rst'
59+
# Exclude Markdown files for now
60+
#source_suffix = ['.rst', '.md']
61+
#source_parsers = {
62+
# '.md': CommonMarkParser,
63+
#}
64+
65+
# The master toctree document.
66+
master_doc = 'index'
67+
68+
# The language for content autogenerated by Sphinx. Refer to documentation
69+
# for a list of supported languages.
70+
#
71+
# This is also used if you do content translation via gettext catalogs.
72+
# Usually you set "language" from the command line for these cases.
73+
language = None
74+
75+
# List of patterns, relative to source directory, that match files and
76+
# directories to ignore when looking for source files.
77+
# This pattern also affects html_static_path and html_extra_path .
78+
exclude_patterns = [
79+
u'_build/*',
80+
u'_includes/**',
81+
u'venv/**',
82+
u'requirements.txt',
83+
u'Thumbs.db',
84+
u'.DS_Store'
85+
]
86+
87+
# The name of the Pygments (syntax highlighting) style to use.
88+
pygments_style = 'sphinx'
89+
90+
rst_epilog = """
91+
.. |psf| replace:: pwncat
92+
"""
93+
94+
95+
# -- Options for Link check -------------------------------------------------
96+
97+
# http://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-the-linkcheck-builder
98+
linkcheck_ignore = [
99+
r'http(s)?://localhost(/)?.*',
100+
r'http(s)?://127\.0\.0\.1(/)?.*',
101+
r'http(s)?://.+\.loc$',
102+
r'http(s)?://.+\.loc/.+$'
103+
]
104+
linkcheck_retries = 5
105+
linkcheck_timeout = 60
106+
linkcheck_anchors = True
107+
108+
109+
# -- Options for HTML output -------------------------------------------------
110+
111+
# The theme to use for HTML and HTML Help pages. See the documentation for
112+
# a list of builtin themes.
113+
#
114+
#html_theme = 'alabaster'
115+
#html_theme = 'sphinx_rtd_theme'
116+
html_theme = 'default'
117+
118+
html_logo = 'img/logo.png'
119+
120+
# From:
121+
# * https://github.com/snide/sphinx_png_theme#using-this-theme-locally-then-building-on-read-the-docs
122+
if not on_rtd: # only import and set the theme if we're building docs locally
123+
import sphinx_rtd_theme
124+
html_theme = 'sphinx_rtd_theme'
125+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
126+
127+
# Theme options are theme-specific and customize the look and feel of a theme
128+
# further. For a list of options available for each theme, see the
129+
# documentation.
130+
#
131+
# html_theme_options = {}
132+
# https://sphinx-rtd-theme.readthedocs.io/en/latest/configuring.html#project-wide-configuration
133+
html_theme_options = {
134+
'canonical_url': '',
135+
'analytics_id': '',
136+
'logo_only': False,
137+
'display_version': True,
138+
'prev_next_buttons_location': 'bottom',
139+
#'style_external_links': True,
140+
#'vcs_pageview_mode': '',
141+
# Toc options
142+
'collapse_navigation': False,
143+
'sticky_navigation': True,
144+
'navigation_depth': 5,
145+
#'includehidden': True,
146+
#'titles_only': False
147+
}
148+
149+
# Add any paths that contain custom static files (such as style sheets) here,
150+
# relative to this directory. They are copied after the builtin static files,
151+
# so a file named "default.css" will overwrite the builtin "default.css".
152+
html_static_path = ['_static']
153+
154+
# Custom sidebar templates, must be a dictionary that maps document names
155+
# to template names.
156+
#
157+
# The default sidebars (for documents that don't match any pattern) are
158+
# defined by theme itself. Builtin themes are using these templates by
159+
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
160+
# 'searchbox.html']``.
161+
#
162+
# html_sidebars = {}
163+
164+
def setup(app):
165+
'''Include custom css file'''
166+
app.add_stylesheet('css/pwncat.css')
167+
168+
169+
# If true, “Created using Sphinx” is shown in the HTML footer. Default is True.
170+
html_show_sphinx = False
171+
172+
173+
# -- Options for HTMLHelp output ---------------------------------------------
174+
175+
# Output file base name for HTML help builder.
176+
htmlhelp_basename = 'pwncat'
177+
178+
179+
# -- Options for LaTeX output ------------------------------------------------
180+
181+
latex_elements = {
182+
# The paper size ('letterpaper' or 'a4paper').
183+
#
184+
# 'papersize': 'letterpaper',
185+
186+
# The font size ('10pt', '11pt' or '12pt').
187+
#
188+
# 'pointsize': '10pt',
189+
190+
# Additional stuff for the LaTeX preamble.
191+
#
192+
# 'preamble': '',
193+
194+
# Latex figure (float) alignment
195+
#
196+
# 'figure_align': 'htbp',
197+
}
198+
199+
# Grouping the document tree into LaTeX files. List of tuples
200+
# (source start file, target name, title,
201+
# author, documentclass [howto, manual, or own class]).
202+
latex_documents = [
203+
(
204+
master_doc,
205+
'pwncat.tex',
206+
u'pwncat documentation',
207+
u'cytopia',
208+
'manual'
209+
),
210+
]
211+
212+
213+
# -- Options for manual page output ------------------------------------------
214+
215+
# One entry per manual page. List of tuples
216+
# (source start file, name, description, authors, manual section).
217+
man_pages = [
218+
(
219+
master_doc,
220+
'pwncat',
221+
u'pwncat documentation',
222+
[author],
223+
1
224+
)
225+
]

share/doc/img/logo.png

188 KB
Loading

0 commit comments

Comments
 (0)