Skip to content

Commit 0a57b80

Browse files
author
François Prunayre
committed
Add theme for the doc and build configuration.
1 parent d98c32f commit 0a57b80

27 files changed

+6172
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1+
# Project documentation module
12

3+
The documentation use [RST format](http://sphinx-doc.org/rest.html).
4+
5+
Sphinx is required to build documentation.
6+
See http://sphinx-doc.org/latest/install.html.
7+
8+
The theme is based on [sphinx_rtd_theme](https://github.com/snide/sphinx_rtd_theme).
9+
See theme folder.
10+
11+
12+
To build the documentation, run:
13+
14+
```
15+
mvn clean install
16+
```

pom.xml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<!--<parent>
8+
<groupId>org.geonetwork-opensource</groupId>
9+
<artifactId>geonetwork</artifactId>
10+
<version>3.0.0-SNAPSHOT</version>
11+
</parent>-->
12+
13+
<groupId>org.geonetwork-opensource</groupId>
14+
<artifactId>doc</artifactId>
15+
<name>Documentation module</name>
16+
<description></description>
17+
<version>3.0.0-SNAPSHOT</version>
18+
19+
<licenses>
20+
<license>
21+
<name>General Public License (GPL)</name>
22+
<url>http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt</url>
23+
</license>
24+
</licenses>
25+
26+
<build>
27+
<plugins>
28+
<plugin>
29+
<groupId>org.codehaus.mojo</groupId>
30+
<artifactId>exec-maven-plugin</artifactId>
31+
<version>1.1</version>
32+
<executions>
33+
<execution>
34+
<id>build-docs-en</id>
35+
<phase>prepare-package</phase>
36+
<goals>
37+
<goal>exec</goal>
38+
</goals>
39+
<configuration>
40+
<executable>sphinx-build</executable>
41+
<arguments>
42+
<argument>-a</argument>
43+
<argument>-b</argument>
44+
<argument>html</argument>
45+
<argument>en</argument>
46+
<argument>target/doc/en</argument>
47+
</arguments>
48+
<workingDirectory>${basedir}</workingDirectory>
49+
</configuration>
50+
</execution>
51+
<!--<execution>
52+
<id>build-docs-en-json</id>
53+
<phase>prepare-package</phase>
54+
<goals>
55+
<goal>exec</goal>
56+
</goals>
57+
<configuration>
58+
<executable>sphinx-build</executable>
59+
<arguments>
60+
<argument>-a</argument>
61+
<argument>-b</argument>
62+
<argument>json</argument>
63+
<argument>en</argument>
64+
<argument>target/doc/en-json</argument>
65+
</arguments>
66+
<workingDirectory>${basedir}</workingDirectory>
67+
</configuration>
68+
</execution>-->
69+
</executions>
70+
</plugin>
71+
</plugins>
72+
</build>
73+
74+
</project>

theme/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Sphinx ReadTheDocs theme.
2+
3+
From https://github.com/ryan-roemer/sphinx-bootstrap-theme.
4+
5+
"""
6+
import os
7+
8+
VERSION = (0, 1, 8)
9+
10+
__version__ = ".".join(str(v) for v in VERSION)
11+
__version_full__ = __version__
12+
13+
14+
def get_html_theme_path():
15+
"""Return list of HTML theme paths."""
16+
cur_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
17+
return cur_dir

theme/breadcrumbs.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<div role="navigation" aria-label="breadcrumbs navigation">
2+
<ul class="wy-breadcrumbs">
3+
<li><a href="{{ pathto(master_doc) }}">Docs</a> &raquo;</li>
4+
{% for doc in parents %}
5+
<li><a href="{{ doc.link|e }}">{{ doc.title }}</a> &raquo;</li>
6+
{% endfor %}
7+
<li>{{ title }}</li>
8+
<li class="wy-breadcrumbs-aside">
9+
{% if pagename != "search" %}
10+
{% if theme_display_github %}
11+
<a href="https://{{ github_host|default("github.com") }}/{{ theme_github_user }}/{{ theme_github_repo }}/blob/{{ theme_github_version }}/{{ theme_doc_path }}/{{ pagename }}{{ theme_source_suffix }}" class="fa fa-github"> Edit on GitHub</a>
12+
{% elif display_bitbucket %}
13+
<a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ source_suffix }}" class="fa fa-bitbucket"> Edit on Bitbucket</a>
14+
{% elif show_source and source_url_prefix %}
15+
<a href="{{ source_url_prefix }}{{ pagename }}{{ source_suffix }}">View page source</a>
16+
{% elif show_source and has_source and sourcename %}
17+
<a href="{{ pathto('_sources/' + sourcename, true)|e }}" rel="nofollow"> View page source</a>
18+
{% endif %}
19+
{% endif %}
20+
</li>
21+
</ul>
22+
<hr/>
23+
</div>

theme/footer.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<footer>
2+
{% if next or prev %}
3+
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
4+
{% if next %}
5+
<a href="{{ next.link|e }}" class="btn btn-neutral float-right" title="{{ next.title|striptags|e }}" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
6+
{% endif %}
7+
{% if prev %}
8+
<a href="{{ prev.link|e }}" class="btn btn-neutral" title="{{ prev.title|striptags|e }}" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
9+
{% endif %}
10+
</div>
11+
{% endif %}
12+
13+
<hr/>
14+
15+
<div role="contentinfo">
16+
<p>
17+
{%- if show_copyright %}
18+
{%- if hasdoc('copyright') %}
19+
{% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
20+
{%- else %}
21+
{% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}.{% endtrans %}
22+
{%- endif %}
23+
{%- endif %}
24+
25+
{%- if last_updated %}
26+
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
27+
{%- endif %}
28+
</p>
29+
</div>
30+
31+
{%- if show_sphinx %}
32+
{% trans %}Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>{% endtrans %}.
33+
{%- endif %}
34+
35+
</footer>
36+

theme/layout.html

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
{# TEMPLATE VAR SETTINGS #}
2+
{%- set url_root = pathto('', 1) %}
3+
{%- if url_root == '#' %}{% set url_root = '' %}{% endif %}
4+
{%- if not embedded and docstitle %}
5+
{%- set titlesuffix = " &mdash; "|safe + docstitle|e %}
6+
{%- else %}
7+
{%- set titlesuffix = "" %}
8+
{%- endif %}
9+
10+
<!DOCTYPE html>
11+
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
12+
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
13+
<head>
14+
<meta charset="utf-8">
15+
{{ metatags }}
16+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
17+
{% block htmltitle %}
18+
<title>{{ title|striptags|e }}{{ titlesuffix }}</title>
19+
{% endblock %}
20+
21+
{# FAVICON #}
22+
{% if favicon %}
23+
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
24+
{% endif %}
25+
26+
{# CSS #}
27+
28+
{# OPENSEARCH #}
29+
{% if not embedded %}
30+
{% if use_opensearch %}
31+
<link rel="search" type="application/opensearchdescription+xml" title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}" href="{{ pathto('_static/opensearch.xml', 1) }}"/>
32+
{% endif %}
33+
34+
{% endif %}
35+
36+
{# RTD hosts this file, so just load on non RTD builds #}
37+
{% if not READTHEDOCS %}
38+
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
39+
{% endif %}
40+
41+
{% for cssfile in css_files %}
42+
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
43+
{% endfor %}
44+
45+
{% for cssfile in extra_css_files %}
46+
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
47+
{% endfor %}
48+
49+
{%- block linktags %}
50+
{%- if hasdoc('about') %}
51+
<link rel="author" title="{{ _('About these documents') }}"
52+
href="{{ pathto('about') }}"/>
53+
{%- endif %}
54+
{%- if hasdoc('genindex') %}
55+
<link rel="index" title="{{ _('Index') }}"
56+
href="{{ pathto('genindex') }}"/>
57+
{%- endif %}
58+
{%- if hasdoc('search') %}
59+
<link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}"/>
60+
{%- endif %}
61+
{%- if hasdoc('copyright') %}
62+
<link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}"/>
63+
{%- endif %}
64+
<link rel="top" title="{{ docstitle|e }}" href="{{ pathto('index') }}"/>
65+
{%- if parents %}
66+
<link rel="up" title="{{ parents[-1].title|striptags|e }}" href="{{ parents[-1].link|e }}"/>
67+
{%- endif %}
68+
{%- if next %}
69+
<link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}"/>
70+
{%- endif %}
71+
{%- if prev %}
72+
<link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}"/>
73+
{%- endif %}
74+
{%- endblock %}
75+
{%- block extrahead %} {% endblock %}
76+
77+
{# Keep modernizr in head - http://modernizr.com/docs/#installing #}
78+
<script src="_static/js/modernizr.min.js"></script>
79+
80+
</head>
81+
82+
<body class="wy-body-for-nav" role="document">
83+
84+
<div class="wy-grid-for-nav">
85+
86+
{# SIDE NAV, TOGGLES ON MOBILE #}
87+
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
88+
<div class="wy-side-nav-search">
89+
{% block sidebartitle %}
90+
91+
{% if logo and theme_logo_only %}
92+
<a href="{{ pathto(master_doc) }}">
93+
{% else %}
94+
<a href="{{ pathto(master_doc) }}" class="icon icon-home"> {{ project }}
95+
{% endif %}
96+
97+
{% if logo %}
98+
{# Not strictly valid HTML, but it's the only way to display/scale it properly, without weird scripting or heaps of work #}
99+
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" />
100+
{% endif %}
101+
</a>
102+
103+
{% include "searchbox.html" %}
104+
105+
{% endblock %}
106+
</div>
107+
108+
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
109+
{% block menu %}
110+
{% set toctree = toctree(maxdepth=2, collapse=False, includehidden=True) %}
111+
{% if toctree %}
112+
{{ toctree }}
113+
{% else %}
114+
<!-- Local TOC -->
115+
<div class="local-toc">{{ toc }}</div>
116+
{% endif %}
117+
{% endblock %}
118+
</div>
119+
&nbsp;
120+
</nav>
121+
122+
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
123+
124+
{# MOBILE NAV, TRIGGLES SIDE NAV ON TOGGLE #}
125+
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
126+
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
127+
<a href="{{ pathto(master_doc) }}">{{ project }}</a>
128+
</nav>
129+
130+
131+
{# PAGE CONTENT #}
132+
<div class="wy-nav-content">
133+
<div class="rst-content">
134+
{% include "breadcrumbs.html" %}
135+
<div role="main" class="document">
136+
{% block body %}{% endblock %}
137+
</div>
138+
{% include "footer.html" %}
139+
</div>
140+
</div>
141+
142+
</section>
143+
144+
</div>
145+
{% include "versions.html" %}
146+
147+
{% if not embedded %}
148+
149+
<script type="text/javascript">
150+
var DOCUMENTATION_OPTIONS = {
151+
URL_ROOT:'{{ url_root }}',
152+
VERSION:'{{ release|e }}',
153+
COLLAPSE_INDEX:false,
154+
FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}',
155+
HAS_SOURCE: {{ has_source|lower }}
156+
};
157+
</script>
158+
{%- for scriptfile in script_files %}
159+
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
160+
{%- endfor %}
161+
162+
{% endif %}
163+
164+
{# RTD hosts this file, so just load on non RTD builds #}
165+
{% if not READTHEDOCS %}
166+
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script>
167+
{% endif %}
168+
169+
{# STICKY NAVIGATION #}
170+
{% if theme_sticky_navigation %}
171+
<script type="text/javascript">
172+
jQuery(function () {
173+
SphinxRtdTheme.StickyNav.enable();
174+
});
175+
</script>
176+
{% endif %}
177+
178+
{%- block footer %} {% endblock %}
179+
180+
</body>
181+
</html>

0 commit comments

Comments
 (0)