Skip to content

Commit ce37506

Browse files
committed
feat: add documentation gh action
1 parent 5f2fb49 commit ce37506

File tree

18 files changed

+409
-0
lines changed

18 files changed

+409
-0
lines changed

.github/workflows/docs.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: docs
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
permissions:
8+
pages: write
9+
id-token: write
10+
11+
jobs:
12+
documentation:
13+
environment:
14+
name: github-pages
15+
url: ${{ steps.deployment.outputs.page_url }}
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: checkout
19+
uses: actions/[email protected]
20+
21+
- name: Generate Documentation
22+
run: |
23+
sudo apt-get install python3 python3-pip
24+
sudo pip3 install sphinx furo myst-parser sphinx-copybutton linkify-it-py sphinx-togglebutton sphinxemoji
25+
cd docs/docgen/
26+
python3 docgen.py ../../
27+
28+
- name: Upload to GitHub Pages
29+
uses: actions/upload-pages-artifact@v3
30+
with:
31+
path: docs/docgen/build/
32+
33+
- name: Deploy to GitHub Pages
34+
id: deployment
35+
uses: actions/deploy-pages@v4

docs/docgen/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Generates the repository documentation files from comments in the source files.
2+
3+
Example documentation comment:
4+
5+
```
6+
(*
7+
# Mainscreen.PointToMM
8+
\`\`\`pascal
9+
function TRSMainScreen.PointToMM(MS: TPoint; Height: Int32=0; Accuracy:Double=0.2): Vector3;
10+
\`\`\`
11+
12+
Takes a mainscreen point and converts it to a point on the minimap.
13+
14+
Returns a Vector3 which includes input height. Conversion to a TPoint if that's what you need is simply
15+
done by calling `.ToPoint()` on the result.
16+
17+
### Example
18+
\`\`\`pascal
19+
WriteLn Mainscreen.PointToMM(Point(250,140), 2);
20+
WriteLn Mainscreen.PointToMM(Point(250,140), 2).ToPoint(); // as a TPoint (lost accuracy)
21+
\`\`\`
22+
*)
23+
```
24+
25+
Usage (Linux):
26+
27+
```bash
28+
sudo apt-get install python3 python3-pip
29+
sudo pip install sphinx furo myst-parser
30+
python3 docgen.py ../../
31+
```

docs/docgen/conf.py

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
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/master/config
8+
9+
# -- Path setup --------------------------------------------------------------
10+
11+
# If extensions (or modules to document with autodoc) are in another directory,
12+
# add these directories to sys.path here. If the directory is relative to the
13+
# documentation root, use os.path.abspath to make it absolute, like shown here.
14+
#
15+
# import os
16+
# import sys
17+
# sys.path.insert(0, os.path.abspath('.'))
18+
19+
20+
# -- Project information -----------------------------------------------------
21+
22+
project = u'SRL-T'
23+
description = u'SRL-T is a fork of SRL-Development. SRL is a library for Simba to interact with RuneScape.'
24+
copyright = u'2020, SRL Group'
25+
author = u'SRL Group'
26+
27+
# The short X.Y version
28+
version = u''
29+
# The full version, including alpha/beta/rc tags
30+
release = u''
31+
32+
33+
# -- General configuration ---------------------------------------------------
34+
35+
# If your documentation needs a minimal Sphinx version, state it here.
36+
#
37+
# needs_sphinx = '1.0'
38+
39+
# Add any Sphinx extension module names here, as strings. They can be
40+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
41+
# ones.
42+
extensions = [
43+
'sphinx.ext.githubpages',
44+
'sphinx.ext.autodoc',
45+
'sphinx.ext.autosummary',
46+
'sphinx.ext.autosectionlabel',
47+
'sphinx.ext.intersphinx',
48+
'sphinx_copybutton',
49+
'sphinx_togglebutton',
50+
'sphinxemoji.sphinxemoji',
51+
'myst_parser'
52+
]
53+
54+
autodoc_default_flags = ['members']
55+
autosummary_generate = True
56+
57+
# Add any paths that contain templates here, relative to this directory.
58+
templates_path = ['.']
59+
60+
# The suffix(es) of source filenames.
61+
# You can specify multiple suffix as a list of string:
62+
#
63+
# source_suffix = ['.rst', '.md']
64+
source_suffix = ['.rst', '.md']
65+
66+
# The master toctree document.
67+
master_doc = 'index'
68+
69+
# The language for content autogenerated by Sphinx. Refer to documentation
70+
# for a list of supported languages.
71+
#
72+
# This is also used if you do content translation via gettext catalogs.
73+
# Usually you set "language" from the command line for these cases.
74+
language = "en"
75+
76+
# List of patterns, relative to source directory, that match files and
77+
# directories to ignore when looking for source files.
78+
# This pattern also affects html_static_path and html_extra_path .
79+
exclude_patterns = []
80+
81+
# The name of the Pygments (syntax highlighting) style to use.
82+
pygments_style = 'sphinx'
83+
84+
85+
# -- Options for HTML output -------------------------------------------------
86+
87+
# The theme to use for HTML and HTML Help pages. See the documentation for
88+
# a list of builtin themes.
89+
#
90+
html_theme = 'furo'
91+
92+
# Theme options are theme-specific and customize the look and feel of a theme
93+
# further. For a list of options available for each theme, see the
94+
# documentation.
95+
#
96+
html_theme_options = {
97+
98+
}
99+
100+
# Add any paths that contain custom static files (such as style sheets) here,
101+
# relative to this directory. They are copied after the builtin static files,
102+
# so a file named "default.css" will overwrite the builtin "default.css".
103+
#html_static_path = ['_static']
104+
105+
# Custom sidebar templates, must be a dictionary that maps document names
106+
# to template names.
107+
#
108+
# The default sidebars (for documents that don't match any pattern) are
109+
# defined by theme itself. Builtin themes are using these templates by
110+
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
111+
# 'searchbox.html']``.
112+
#
113+
# html_sidebars = {}
114+
115+
116+
# -- Options for HTMLHelp output ---------------------------------------------
117+
118+
# Output file base name for HTML help builder.
119+
htmlhelp_basename = project+'doc'
120+
121+
122+
# -- Options for LaTeX output ------------------------------------------------
123+
124+
latex_elements = {
125+
# The paper size ('letterpaper' or 'a4paper').
126+
#
127+
# 'papersize': 'letterpaper',
128+
129+
# The font size ('10pt', '11pt' or '12pt').
130+
#
131+
# 'pointsize': '10pt',
132+
133+
# Additional stuff for the LaTeX preamble.
134+
#
135+
# 'preamble': '',
136+
137+
# Latex figure (float) alignment
138+
#
139+
# 'figure_align': 'htbp',
140+
}
141+
142+
# Grouping the document tree into LaTeX files. List of tuples
143+
# (source start file, target name, title,
144+
# author, documentclass [howto, manual, or own class]).
145+
latex_documents = [(master_doc, project+'.tex', project+' Documentation', author, 'manual')]
146+
147+
148+
# -- Options for manual page output ------------------------------------------
149+
150+
# One entry per manual page. List of tuples
151+
# (source start file, name, description, authors, manual section).
152+
man_pages = [(master_doc, project, project+' Documentation',[author], 1)]
153+
154+
155+
# -- Options for Texinfo output ----------------------------------------------
156+
157+
# Grouping the document tree into Texinfo files. List of tuples
158+
# (source start file, target name, title, author,
159+
# dir menu entry, description, category)
160+
texinfo_documents = [(master_doc, project, project+' Documentation', author, project, description,'Miscellaneous')]
161+
162+
163+
# -- Extension configuration -------------------------------------------------
164+
intersphinx_mapping = {'WaspLib': ('https://torwent.github.io/WaspLib', None)}
165+
intersphinx_disabled_reftypes = ["*"]
166+
167+
myst_enable_extensions = [
168+
'linkify', 'colon_fence', 'substitution'
169+
]
170+
sphinxemoji_style = 'twemoji'

0 commit comments

Comments
 (0)