mirror of https://github.com/Nonannet/copapy.git
Copapy logo added to doc page and readme
This commit is contained in:
parent
e0b6798742
commit
70b916cc34
|
|
@ -1,3 +1,7 @@
|
||||||
|
<div align="center">
|
||||||
|
<img src="docs/source/media/logo.svg" alt="Copapy logo" width="160" />
|
||||||
|
</div>
|
||||||
|
|
||||||
# Copapy
|
# Copapy
|
||||||
|
|
||||||
Copapy is a Python framework for deterministic, low-latency realtime computation with automatic differentiation support, targeting hardware applications - for example in the fields of robotics, aerospace, SDR, embedded systems and control systems in general.
|
Copapy is a Python framework for deterministic, low-latency realtime computation with automatic differentiation support, targeting hardware applications - for example in the fields of robotics, aerospace, SDR, embedded systems and control systems in general.
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,17 @@ exclude_patterns = []
|
||||||
# -- Options for HTML output -------------------------------------------------
|
# -- Options for HTML output -------------------------------------------------
|
||||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
||||||
|
|
||||||
# html_theme = 'alabaster'
|
|
||||||
html_theme = 'pydata_sphinx_theme'
|
html_theme = 'pydata_sphinx_theme'
|
||||||
html_static_path = ['_static']
|
html_static_path = ['_static']
|
||||||
|
html_title = "Python framework for deterministic, low-latency realtime computation"
|
||||||
|
html_short_title = "Copapy"
|
||||||
|
html_logo = 'media/logo.svg'
|
||||||
|
html_favicon = 'media/logo.svg'
|
||||||
html_css_files = ['custom.css']
|
html_css_files = ['custom.css']
|
||||||
html_theme_options = {
|
html_theme_options = {
|
||||||
"secondary_sidebar_items": ["page-toc"],
|
"secondary_sidebar_items": ["page-toc"],
|
||||||
"footer_start": ["copyright"]
|
"footer_start": ["copyright"],
|
||||||
|
"logo": {"text": "Copapy"}
|
||||||
}
|
}
|
||||||
html_theme_options["footer_end"] = []
|
html_theme_options["footer_end"] = []
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,32 @@ import re
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def extract_sections(md_text: str) -> dict[str, str]:
|
|
||||||
|
def strip_leading_html_tag(text: str) -> str:
|
||||||
|
"""Remove a leading HTML element if the first non-space character is '<'."""
|
||||||
|
trimmed = text.lstrip()
|
||||||
|
#if not trimmed.startswith('<'):
|
||||||
|
# return text
|
||||||
|
|
||||||
|
match = re.match(
|
||||||
|
r'^\s*<\s*(?P<tag>[A-Za-z][A-Za-z0-9:-]*)(?:\s+[^<>]*)?>'
|
||||||
|
r'(?P<body>.*?)(?:</\s*(?P=tag)\s*>)?',
|
||||||
|
trimmed,
|
||||||
|
re.DOTALL,
|
||||||
|
)
|
||||||
|
if not match:
|
||||||
|
return text
|
||||||
|
|
||||||
|
return trimmed[match.end():]
|
||||||
|
|
||||||
|
|
||||||
|
def extract_sections(md_text: str) -> dict[str, tuple[str, str]]:
|
||||||
"""
|
"""
|
||||||
Extracts sections based on headings (#...).
|
Extracts sections based on headings (#...).
|
||||||
Returns {heading_text: section_content}
|
Returns {heading_text: section_content}
|
||||||
Works for simple Markdown, not fully strict.
|
Works for simple Markdown, not fully strict.
|
||||||
|
|
||||||
|
If strip_first_heading is True, omit the first heading/section from the output.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# regex captures: heading marks (###...), heading text, and the following content
|
# regex captures: heading marks (###...), heading text, and the following content
|
||||||
|
|
@ -17,13 +38,17 @@ def extract_sections(md_text: str) -> dict[str, str]:
|
||||||
re.MULTILINE | re.DOTALL
|
re.MULTILINE | re.DOTALL
|
||||||
)
|
)
|
||||||
|
|
||||||
sections: dict[str, str] = {}
|
sections: dict[str, tuple[str, str]] = {}
|
||||||
for _, title, content in pattern.findall(md_text):
|
matched = list(pattern.findall(md_text))
|
||||||
|
|
||||||
|
for prefix, title, content in matched:
|
||||||
assert isinstance(content, str)
|
assert isinstance(content, str)
|
||||||
sections[title] = content.strip().replace('](docs/source/media/', '](media/')
|
content = strip_leading_html_tag(content)
|
||||||
|
sections[title] = (prefix + ' ' + title, content.strip().replace('](docs/source/media/', '](media/'))
|
||||||
|
|
||||||
return sections
|
return sections
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(description='Extract sections from README.md and generate documentation files')
|
parser = argparse.ArgumentParser(description='Extract sections from README.md and generate documentation files')
|
||||||
parser.add_argument('--readme', type=str, default='README.md', help='README.md path')
|
parser.add_argument('--readme', type=str, default='README.md', help='README.md path')
|
||||||
|
|
@ -37,9 +62,9 @@ if __name__ == '__main__':
|
||||||
readme = extract_sections(f.read())
|
readme = extract_sections(f.read())
|
||||||
|
|
||||||
with open(os.path.join(build_dir, 'start.md'), 'wt') as f:
|
with open(os.path.join(build_dir, 'start.md'), 'wt') as f:
|
||||||
f.write('\n'.join(f"{s}\n" + readme[s.strip(' #')] for s in [
|
f.write('\n'.join('\n'.join(readme[s]) if s != 'Copapy' else readme[s][1] for s in [
|
||||||
'# Copapy', '## Current state', '## Install', '## Examples',
|
'Copapy', 'Current state', 'Install', 'Examples',
|
||||||
'### Basic example', '### Inverse kinematics', '## License']))
|
'Basic example', 'Inverse kinematics', 'License']))
|
||||||
|
|
||||||
with open(os.path.join(build_dir, 'compiler.md'), 'wt') as f:
|
with open(os.path.join(build_dir, 'compiler.md'), 'wt') as f:
|
||||||
f.write('\n'.join(readme[s] for s in ['How it works']))
|
f.write('\n'.join(readme[s][1] for s in ['How it works']))
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="50mm"
|
||||||
|
height="50mm"
|
||||||
|
viewBox="0 0 50 50"
|
||||||
|
version="1.1"
|
||||||
|
id="svg1"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<defs
|
||||||
|
id="defs1">
|
||||||
|
<radialGradient
|
||||||
|
xlink:href="#linearGradient4"
|
||||||
|
id="radialGradient5"
|
||||||
|
cx="107.11821"
|
||||||
|
cy="235.82867"
|
||||||
|
fx="107.11821"
|
||||||
|
fy="235.82867"
|
||||||
|
r="24.039047"
|
||||||
|
gradientTransform="matrix(1,0,0,0.95918092,-67.935504,-192.92731)"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient4">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#2ec8b5;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop4" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#13bc30;stop-opacity:1;"
|
||||||
|
offset="0.81555557"
|
||||||
|
id="stop5" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#049f40;stop-opacity:1;"
|
||||||
|
offset="1"
|
||||||
|
id="stop8" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<g
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-13.750923,-8.9786913)">
|
||||||
|
<path
|
||||||
|
id="text1-8-8-2-3-4"
|
||||||
|
style="font-style:italic;font-size:70.5556px;line-height:1.25;font-family:Cambria;-inkscape-font-specification:'Cambria Italic';text-align:center;text-anchor:middle;fill:url(#radialGradient5);fill-opacity:1;stroke:none;stroke-width:0.264583"
|
||||||
|
d="m 43.128156,27.242126 c 0,0 -9.0193,17.94078 -9.54773,19.30631 -0.52844,1.36553 -1.06402,2.95147 -1.06402,4.16874 0,3.74367 2.06705,5.61568 6.20117,5.61568 3.05465,0 6.0752,-1.21743 9.06095,-3.65197 l 1.43505,-2.86339 c -1.98313,1.16297 -6.22373,2.86339 -7.94628,2.86339 -1.97519,0 -3.12683,-0.80027 -3.12683,-2.82139 0,-0.57419 0.0602,-1.52908 0.57711,-2.96637 0.51695,-1.43729 10.02626,-19.651 10.02626,-19.651 h 12.16102 l 2.3169,-4.51837 c -2.61867,0.19291 -15.87083,0.19404 -20.67909,0.21217 -1.31311,0.005 -4.19846,0.13112 -5.51169,0.27927 -6.05803,0.68345 -10.32667,2.58452 -14.9987,7.97142 -5.87218,6.77069 -10.61497,23.53356 -2.76675,24.90545 2.41712,0.42252 5.25201,-0.58293 9.18033,-6.78407 2.44714,-3.86301 7.28627,-13.37301 10.98693,-20.8859 l -3.01186,0.009 c -3.88681,7.43627 -8.83327,16.45417 -10.16461,18.73719 -0.48019,0.82345 -2.18721,4.0008 -4.3248,4.75991 -4.80166,1.70519 -5.76602,-8.11809 -0.75697,-16.21679 4.16175,-6.72876 11.59127,-8.35206 16.48548,-8.4633 0.37281,-0.001 5.46813,-0.006 5.46813,-0.006 z m -0.59092,-5.45067 c 1.08293,-2.22106 1.29372,-2.48023 1.29372,-2.48023 l 3.24988,0.0286 -1.23803,2.43839 5.69979,-0.006 1.21805,-2.44463 4.48655,0.008 -5.56556,-9.11832 -14.61667,8.79773 3.85328,0.18155 c 0,0 -0.0989,0.18068 -1.35589,2.59494" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.7 KiB |
Loading…
Reference in New Issue