-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ReadTheDocs] Structure and template fixes (#6667)
Fixes merge conflicts in the wiki (99 - Developers should not exists). Fixes several errors including some which prevents the Loris ReadTheDocs to compile (last compiled version is 4 months old now). Demo: https://loris-dev.readthedocs.io/en/latest Docs is now part of the breadcrumb. I can probably find a way to remove it if that's undesirable. Symlinks are problematic (and as pointed here, not really useful) as we need (for now) to use relative links across all the documentation to avoid broken links. Resolves #6209 Resolves #6329 Resolves #6545 Resolves #6622 Resolves #6623 Resolves #6737 Resolves #6736
- Loading branch information
Showing
28 changed files
with
201 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../modules/api/docs/LorisRESTAPI.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../modules/api/docs/LorisRESTAPI_v0.0.3.md |
2 changes: 1 addition & 1 deletion
2
docs/wiki/99 - Developers/UnitTestGuide.md → docs/wiki/99_Developers/UnitTestGuide.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
site_name: LORIS | ||
repo_url: https://github.com/aces/Loris | ||
# Solve the broken 404 page issue | ||
site_url: https://acesloris.readthedocs.io/en/latest/ | ||
|
||
nav: | ||
- Home: 'README.md' | ||
- Wiki: 'docs/wiki/index.md' | ||
- Server Install and Configuration: | ||
- 'Prerequisities and Assumptions': 'docs/wiki/00_SERVER_INSTALL_AND_CONFIGURATION/00_Prerequisites_And_Assumptions/README.md' | ||
- 'Database Configuration': 'docs/wiki/00_SERVER_INSTALL_AND_CONFIGURATION/00_Prerequisites_And_Assumptions/Database_Configuration.md' | ||
- Installation: | ||
- 'Ubuntu Install': 'docs/wiki/00_SERVER_INSTALL_AND_CONFIGURATION/01_LORIS_Install/Ubuntu/README.md' | ||
- 'CentOS Install': 'docs/wiki/00_SERVER_INSTALL_AND_CONFIGURATION/01_LORIS_Install/CentOS/README.md' | ||
- Website Configuration: | ||
- 'Website Configuration': 'docs/wiki/00_SERVER_INSTALL_AND_CONFIGURATION/02_Website_Configuration/README.md' | ||
- 'Handling Large File Uploads': 'docs/wiki/00_SERVER_INSTALL_AND_CONFIGURATION/02_Website_Configuration/Handling_Large_File_Uploads.md' | ||
- 'Enabling reCAPTCHA': 'docs/wiki/00_SERVER_INSTALL_AND_CONFIGURATION/02_Website_Configuration/reCAPTCHA.md' | ||
- Study Parameters Setup: | ||
- Study Variables: | ||
- Introduction: 'docs/wiki/01_STUDY_PARAMETERS_SETUP/01_Study_Variables/00_Introduction_to_Study_Variables.md' | ||
- Projects: 'docs/wiki/01_STUDY_PARAMETERS_SETUP/01_Study_Variables/02_Projects.md' | ||
- Sites: 'docs/wiki/01_STUDY_PARAMETERS_SETUP/01_Study_Variables/03_Sites.md' | ||
- Subprojects: 'docs/wiki/01_STUDY_PARAMETERS_SETUP/01_Study_Variables/04_Subprojects.md' | ||
- Timepoints: 'docs/wiki/01_STUDY_PARAMETERS_SETUP/01_Study_Variables/05_Timepoints.md' | ||
- Clinical Instruments: 'docs/wiki/01_STUDY_PARAMETERS_SETUP/02_Clinical_Instruments/README.md' | ||
- Modules: 'docs/wiki/01_STUDY_PARAMETERS_SETUP/03_Loris_Modules/README.md' | ||
- Getting Started: 'docs/wiki/02_GETTING_STARTED/README.md' | ||
- Help and Troubleshooting: 'docs/wiki/03_HELP_AND_TROUBLESHOOTING/README.md' | ||
- REST API: | ||
- 'Stable' : 'docs/wiki/99_Developers/LORIS-REST-API-0.0.2.md' | ||
- 'Dev' : 'docs/wiki/99_Developers/LORIS-REST-API-0.0.3-dev.md' | ||
- Developers: | ||
- Overview: 'docs/wiki/99_Developers/README.md' | ||
- 'Coding Standards': 'docs/CodingStandards.md' | ||
- 'SQL Dictionary': 'docs/wiki/99_Developers/SQL_Dictionary.md' | ||
- 'Automated Testing': 'docs/wiki/99_Developers/Automated_Testing.md' | ||
- 'Style Guide (for help text)': 'docs/wiki/99_Developers/Help_Style_Guide.md' | ||
- 'Creating a Module': 'docs/wiki/99_Developers/Creating_Module.md' | ||
- 'ReactJS Guidelines': 'docs/wiki/99_Developers/ReactJS_Guidelines.md' | ||
- 'Code Review Guide': 'docs/wiki/99_Developers/Code_Review_Guide.md' | ||
|
||
use_directory_urls: False | ||
|
||
theme: | ||
name: readthedocs | ||
custom_dir: 'themes/loris_theme/' | ||
navigation_depth: 4 | ||
|
||
plugins: | ||
- search | ||
- root: | ||
ignore_folders: ['node_modules', 'vendor', 'deprecated_wiki', '_DELETED', '_ARCHIVE'] | ||
ignore_hidden: True |
Empty file.
68 changes: 68 additions & 0 deletions
68
readthedocs/plugins/mkdocs-root-plugin/mkdocs_root_plugin/plugin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from mkdocs.plugins import BasePlugin | ||
from mkdocs.config import config_options | ||
|
||
import os | ||
import shutil | ||
import sys | ||
|
||
class RootPlugin(BasePlugin): | ||
config_scheme = ( | ||
('ignore_folders', config_options.Type(list, default=[])), | ||
('ignore_hidden', config_options.Type(bool, default=True)) | ||
) | ||
|
||
def __init__(self): | ||
self.docs_dir = "docs_" | ||
|
||
def on_pre_build(self, config): | ||
self.ignore_folders = self.config['ignore_folders'] | ||
self.ignore_folders += [config['docs_dir'], | ||
config['site_dir'], | ||
self.docs_dir] | ||
self.ignore_hidden = self.config['ignore_hidden'] | ||
# Update the docs_dir with our temporary one! | ||
self.orig_docs_dir = config['docs_dir'] | ||
config['docs_dir'] = self.docs_dir | ||
# Add all md files from directory, keeping folder structure | ||
self.paths = self.gen_from_dir() | ||
|
||
def on_serve(self, server, config, **kwargs): | ||
builder = list(server.watcher._tasks.values())[0]['func'] | ||
|
||
# still watch the original docs/ directory | ||
if os.path.exists(self.orig_docs_dir): | ||
server.watch(self.orig_docs_dir, builder) | ||
|
||
# watch all the doc files | ||
for orig, _ in self.paths: | ||
server.watch(orig, builder) | ||
|
||
return server | ||
|
||
def on_post_build(self, config): | ||
shutil.rmtree(self.docs_dir) | ||
|
||
def valid_dir(self, dir): | ||
if self.ignore_hidden and dir[0] == ".": | ||
return False | ||
if dir in self.ignore_folders: | ||
return False | ||
return True | ||
|
||
def gen_from_dir(self): | ||
paths = [] | ||
for root, dirs, files in os.walk("."): | ||
for f in files: | ||
if any (s in f for s in ('.md', '.svg', '.png', '.jpg')): | ||
doc_root = "./" + self.docs_dir + root[1:] | ||
orig = "{}/{}".format(root, f) | ||
new = "{}/{}".format(doc_root, f) | ||
try: | ||
os.makedirs(doc_root, exist_ok=True) | ||
shutil.copy(orig, new) | ||
paths.append((orig, new)) | ||
except Exception as e: | ||
print("ERROR: {}.. skipping {}".format(e, orig)) | ||
|
||
dirs[:] = [d for d in dirs if self.valid_dir(d)] | ||
return paths |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
name='mkdocs-root-plugin', | ||
version='0.0.1', | ||
python_requires='>=3', | ||
install_requires=[ | ||
'mkdocs>=1.0.6', | ||
'click>=7.1' | ||
], | ||
packages=setuptools.find_packages(), | ||
entry_points={ | ||
'mkdocs.plugins': [ | ||
'root = mkdocs_root_plugin.plugin:RootPlugin' | ||
] | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mkdocs==1.1 | ||
./readthedocs/plugins/mkdocs-root-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<div role="navigation" aria-label="breadcrumbs navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="{{ nav.homepage.url|url }}">Docs</a> »</li> | ||
{% if page %} | ||
{% for doc in page.ancestors|reverse %} | ||
{% if doc.link %} | ||
<li><a href="{{ doc.link|e }}">{{ doc.title }}</a> »</li> | ||
{% else %} | ||
<li>{{ doc.title }} »</li> | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
|
||
{% if page %}<li>{{ page.title }}</li>{% endif %} | ||
|
||
<li class="wy-breadcrumbs-aside"> | ||
{%- block repo %} | ||
{% if page and page.edit_url %} | ||
<a href="{{ page.edit_url }}" | ||
{%- if config.repo_name|lower == 'github' %} | ||
class="icon icon-github" | ||
{%- elif config.repo_name|lower == 'bitbucket' %} | ||
class="icon icon-bitbucket" | ||
{%- elif config.repo_name|lower == 'gitlab' %} | ||
class="icon icon-gitlab" | ||
{% endif %}> Edit on {{ config.repo_name }}</a> | ||
{% endif %} | ||
{%- endblock %} | ||
</li> | ||
</ul> | ||
{% if config.theme.prev_next_buttons_location|lower in ['top', 'both'] | ||
and page and (page.next_page or page.previous_page) %} | ||
<div class="rst-breadcrumbs-buttons" role="navigation" aria-label="breadcrumb navigation"> | ||
{%- if page.next_page %} | ||
<a href="{{ page.next_page.url|url }}" class="btn btn-neutral float-right" title="{{ page.next_page.title }}">Next <span class="icon icon-circle-arrow-right"></span></a> | ||
{%- endif %} | ||
{%- if page.previous_page %} | ||
<a href="{{ page.previous_page.url|url }}" class="btn btn-neutral" title="{{ page.previous_page.title }}"><span class="icon icon-circle-arrow-left"></span> Previous</a> | ||
{%- endif %} | ||
</div> | ||
{% endif %} | ||
<hr/> | ||
</div> |