From 043f3631c64df15a3639c089bb839e96b8e4b563 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Primo=C5=BE=20Godec?=
Date: Mon, 26 Jul 2021 15:30:44 +0200
Subject: [PATCH] Change documentation theme to sphinx_rtd_theme
---
doc/_static/custom.css | 13 +++++++++
doc/_static/style.css | 37 --------------------------
doc/conf.py | 6 +++--
doc/index.rst | 1 +
doc/scripting/wikipedia.rst | 2 +-
orangecontrib/text/widgets/__init__.py | 16 ++++++-----
setup.py | 26 +++++++++++++++---
7 files changed, 52 insertions(+), 49 deletions(-)
create mode 100644 doc/_static/custom.css
delete mode 100644 doc/_static/style.css
diff --git a/doc/_static/custom.css b/doc/_static/custom.css
new file mode 100644
index 000000000..0be5ba4d7
--- /dev/null
+++ b/doc/_static/custom.css
@@ -0,0 +1,13 @@
+/* This CSS snippet makes that the navbar collapse on medium screen already */
+@media screen and (max-width: 950px){
+ .wy-nav-top{display:block}
+ .wy-nav-side{left:-300px}
+ .wy-nav-side.shift{width:85%;left:0}
+ .wy-side-scroll{width:auto}
+ .wy-side-nav-search{width:auto}
+ .wy-menu.wy-menu-vertical{width:auto}
+ .wy-nav-content-wrap{margin-left:0}
+ .wy-nav-content-wrap
+ .wy-nav-content{padding:1.618em}
+ .wy-nav-content-wrap.shift{position:fixed;min-width:100%;left:85%;top:0;height:100%;overflow:hidden}
+}
\ No newline at end of file
diff --git a/doc/_static/style.css b/doc/_static/style.css
deleted file mode 100644
index 6dddc8f9d..000000000
--- a/doc/_static/style.css
+++ /dev/null
@@ -1,37 +0,0 @@
-p + dl {
- border-top: 2px solid gray;
- border-bottom: 2px solid gray;
- padding: 12px;
-}
-
-p + dl dd:last-of-type {
- margin-bottom: 0;
-}
-
-p + dl dt {
- font-weight: bold;
-}
-
-p + dl dt::after {
- content: ":";
-}
-
-dd dt {
- font-weight: bold;
- display: inline-block;
-}
-
-dd dt::after {
- content: ":";
-}
-
-dd dd {
- display: inline;
- margin: 0;
- }
-
-dd dd:after{
- display: block;
- content: '';
- }
-
diff --git a/doc/conf.py b/doc/conf.py
index 3751d8a7a..2be7a7c2f 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -107,7 +107,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
-html_theme = 'alabaster'
+html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@@ -136,7 +136,9 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-# html_static_path = ['_static']
+html_static_path = ['_static']
+
+html_css_files = ['custom.css']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
diff --git a/doc/index.rst b/doc/index.rst
index 7040f8f34..022533375 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -30,6 +30,7 @@ Widgets
widgets/statistics
widgets/corpustonetwork
widgets/keywords
+ widgets/score-documents
Scripting
---------
diff --git a/doc/scripting/wikipedia.rst b/doc/scripting/wikipedia.rst
index 3ba0e977d..a4554642d 100644
--- a/doc/scripting/wikipedia.rst
+++ b/doc/scripting/wikipedia.rst
@@ -2,6 +2,6 @@
Wikipedia
=========
-.. autoclass:: orangecontrib.text.wikipedia.WikipediaAPI
+.. autoclass:: orangecontrib.text.wikipedia_api.WikipediaAPI
:members:
:special-members: __init__
diff --git a/orangecontrib/text/widgets/__init__.py b/orangecontrib/text/widgets/__init__.py
index 5e1a1548f..6b9a3caaf 100644
--- a/orangecontrib/text/widgets/__init__.py
+++ b/orangecontrib/text/widgets/__init__.py
@@ -1,4 +1,5 @@
# Category metadata.
+import sysconfig
# Category icon show in the menu
ICON = "icons/category.svg"
@@ -8,18 +9,21 @@
BACKGROUND = "light-blue"
-
# Location of widget help files.
WIDGET_HELP_PATH = (
# Used for development.
# You still need to build help pages using
- # make htmlhelp
- # inside doc folder
- ("{DEVELOP_ROOT}/doc/_build/htmlhelp/index.html", None),
+ # `make html` inside doc folder
+ ("{DEVELOP_ROOT}/doc/_build/html/index.html", None),
+
+ # Documentation included in wheel
+ # Correct DATA_FILES entry is needed in setup.py and documentation has to be built
+ # before the wheel is created.
+ ("{}/help/orange3-text/index.html".format(sysconfig.get_path("data")), None),
# Online documentation url, used when the local documentation is available.
# Url should point to a page with a section Widgets. This section should
# includes links to documentation pages of each widget. Matching is
# performed by comparing link caption to widget name.
- ("https://orange3-text.readthedocs.io/en/latest/", "")
-)
\ No newline at end of file
+ ("https://orange3-text.readthedocs.io/en/latest/", ""),
+)
diff --git a/setup.py b/setup.py
index cfce3bbbe..46228e3fd 100644
--- a/setup.py
+++ b/setup.py
@@ -148,7 +148,25 @@ def temp_test_suite():
return TestSuite([])
-if __name__ == '__main__':
+DATA_FILES = []
+
+
+def include_documentation(local_dir, install_dir):
+ global DATA_FILES
+
+ doc_files = []
+ for dirpath, _, files in os.walk(local_dir):
+ doc_files.append(
+ (
+ dirpath.replace(local_dir, install_dir),
+ [os.path.join(dirpath, f) for f in files],
+ )
+ )
+ DATA_FILES.extend(doc_files)
+
+
+if __name__ == "__main__":
+ include_documentation("doc/_build/html", "help/orange3-text")
write_version_py()
setup(
name=NAME,
@@ -163,12 +181,14 @@ def temp_test_suite():
packages=find_packages(),
include_package_data=True,
install_requires=INSTALL_REQUIRES,
+ data_files=DATA_FILES,
entry_points=ENTRY_POINTS,
keywords=KEYWORDS,
namespace_packages=['orangecontrib'],
zip_safe=False,
test_suite="setup.temp_test_suite",
extras_require={
- 'test': ['coverage']
- },
+ 'test': ['coverage'],
+ 'doc': ['sphinx', 'recommonmark', 'sphinx_rtd_theme'],
+ },
)