Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download header files from the gallery #563

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,10 @@ pyfar/signals/files/*
# workaround for failing test discovery in vscode
tests/*/__init__.py
tests/private/

# ignore downloads from pyfar gallery
docs/header.rst
docs/_static/favicon.ico
docs/_static/header.rst
docs/_static/css/custom.css
docs/resources/logos/pyfar_logos_fixed_size_pyfar.png
8 changes: 0 additions & 8 deletions docs/_static/css/custom.css

This file was deleted.

Binary file removed docs/_static/favicon.ico
Binary file not shown.
41 changes: 0 additions & 41 deletions docs/_templates/navbar-nav.html

This file was deleted.

32 changes: 32 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import os
import sys
import urllib3
import shutil
sys.path.insert(0, os.path.abspath('..'))

import pyfar # noqa
Expand All @@ -26,6 +28,7 @@
'autodocsumm',
'sphinx_design',
'sphinx_favicon',
'sphinx_reredirects',
]

# show tocs for classes and functions of modules using the autodocsumm
Expand Down Expand Up @@ -107,6 +110,7 @@
"navbar_start": ["navbar-logo"],
"navbar_end": ["navbar-icon-links", "theme-switcher"],
"navbar_align": "content",
"header_links_before_dropdown": 8,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was 10 in the gallery. Is this by design?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 8 is by definition no More Dropdown

"icon_links": [
{
"name": "GitHub",
Expand All @@ -125,6 +129,34 @@
"default_mode": "light"
}

# redirect index to pyfar.html
redirects = {
"index": "pyfar.html"
}

# -- download navbar and style files from gallery -----------------------------
branch = 'main'
link = f'https://github.com/pyfar/gallery/raw/{branch}/docs/'
folders_in = [
'_static/css/custom.css',
'_static/favicon.ico',
'_static/header.rst',
'resources/logos/pyfar_logos_fixed_size_pyfar.png'
]
c = urllib3.PoolManager()
for file in folders_in:
url = link + file
filename = file
os.makedirs(os.path.dirname(filename), exist_ok=True)
with c.request('GET', url, preload_content=False) as res, open(filename, 'wb') as out_file:
shutil.copyfileobj(res, out_file)

# replace pyfar hard link to internal link
with open("_static/header.rst", "rt") as fin:
with open("header.rst", "wt") as fout:
for line in fin:
fout.write(line.replace(f'https://{project}.readthedocs.io', project))

# -- pyfar specifics -----------------------------------------------------

# write shortcuts to sphinx readable format
Expand Down
52 changes: 1 addition & 51 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,52 +1,2 @@
.. |pyfar_logo| image:: resources/pyfar.png
:width: 150
:alt: Alternative text

Getting Started
===============

.. toctree::
:maxdepth: 2

readme

Documentation
=============

.. toctree::
:maxdepth: 2

concepts

.. toctree::
:maxdepth: 2

classes

.. toctree::
:maxdepth: 2

modules

Contributing
===============

.. toctree::
:maxdepth: 1

contributing

Other
=====
.. toctree::
:maxdepth: 1

history

..
(removed because it is contained in the new spinx style)
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
.. include:: header.rst
31 changes: 31 additions & 0 deletions docs/pyfar.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
pyfar
=====

.. toctree::
:caption: Getting Started
:maxdepth: 2

readme


.. toctree::
:caption: Documentation
:maxdepth: 2

concepts
classes
modules


.. toctree::
:caption: Contributing
:maxdepth: 1

contributing


.. toctree::
:caption: Other
:maxdepth: 1

history
Binary file not shown.
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ nbmake>=0.7.0
pydata-sphinx-theme
sphinx-design
sphinx-favicon
sphinx-reredirects