diff --git a/_static/css/jupman-web.css b/_static/css/jupman-web.css
index 49faf79c..e660c776 100644
--- a/_static/css/jupman-web.css
+++ b/_static/css/jupman-web.css
@@ -1,4 +1,6 @@
+/** ONLY AVAILABLE IN THE WEBSITE */
+
/* Makes visible the '+' boxes in menu
https://github.com/DavidLeoni/jupman/issues/38
@@ -41,4 +43,36 @@ img {
*/
.jupman-inline-img {
display: inline;
-}
\ No newline at end of file
+}
+
+.jupman-sol {
+ margin-top: -10px
+}
+
+.jupman-sol-question {
+ margin-bottom: 20px
+}
+
+.jupman-sol-label {
+ background-color:#f3faff /* lighter than admonition */;
+
+ padding: 7px;
+
+ border-style: solid;
+ border-color: #ede4f4;
+}
+
+.jupman-sol-content {
+ background-color:#f3faff;
+ padding-right:7px;
+ border-style: solid;
+ border-color: #ede4f4;
+}
+
+.jupman-sol-hidden {
+ display: 'none';
+}
+
+.jupman-sol-visible {
+ display: block;
+}
diff --git a/_static/css/jupman.css b/_static/css/jupman.css
index a3a28238..424bae53 100644
--- a/_static/css/jupman.css
+++ b/_static/css/jupman.css
@@ -1,4 +1,6 @@
+ /** ONLY AVAILABLE IN JUPYTER **/
+
#jupman-nav {
position: fixed;
top: 10px;
@@ -113,17 +115,3 @@
#jupman-toc .toc-active {
background: rgba(168, 254, 255, 0.32);
}
-
- .jupman-solution {
- padding:1px;
- }
-
- .jupman-solution-header {
- display:none;
- color: blue;
- text-decoration: underline;
- cursor: pointer;
- }
-
-
-
diff --git a/_static/css/softpython-theme.css b/_static/css/softpython-theme.css
index 246fc36f..067b6683 100644
--- a/_static/css/softpython-theme.css
+++ b/_static/css/softpython-theme.css
@@ -153,3 +153,28 @@ div.nbinput.container div.prompt, div.nboutput.container div.prompt{
width:5px !important;
}
+.jupman-sol {
+ margin-top: -10px
+}
+
+.jupman-sol-question {
+ margin-bottom: 20px
+}
+
+
+.jupman-sol-label {
+ background-color:#ebf3ed; /* lighter than admonition */
+
+ padding: 7px;
+
+ border-style: solid;
+ border-color: #d3dfd6;
+}
+
+
+.jupman-sol-content {
+ background-color:#ebf3ed;
+ padding-right:7px;
+ border-style: solid;
+ border-color: #d3dfd6;
+}
diff --git a/_static/js/jupman.js b/_static/js/jupman.js
index c8921363..bc3c045d 100644
--- a/_static/js/jupman.js
+++ b/_static/js/jupman.js
@@ -1,17 +1,18 @@
-/*
+/**
* JUPYTER MANAGER JavaScript https://github.com/DavidLeoni/jupman
*
*/
+
+/**
+ * @deprecated use jupman.toggleVisibility instead
+ * @param {string} what
+ */
function toggleVisibility(what){
- var e = document.getElementById(what);
- if(e.style.display == 'block')
- e.style.display = 'none';
- else
- e.style.display = 'block';
- };
-
+ console.warn("global toggleVisibility is deprecated, use jupman.toggleVisibility instead");
+ jupman.toggleVisibility(what);
+};
function showthis(url) {
window.open(url, "pres", "toolbar=yes,scrollbars=yes,resizable=yes,top=10,left=400,width=500,height=500");
@@ -103,42 +104,49 @@ var jupman = {
}
}).parents('div .cell ').hide();
},
+
+ /**
+ * NOTE: ONLY WORKS ON THE WEBSITE
+ *
+ * @param {@string} solId i.e. jupman-sol-7
+ * @since 3.2
+ */
+ toggleSolution : function(solId){
+
+ let sol = $('#' + solId);
+
+ button = sol.children(':first');
+
+ content = sol.children(':nth-child(2)');
+
+ if (content.css('display') === 'none'){
+ button.val(button.data('jupman-hide'));
+ } else {
+ button.val(button.data('jupman-show'));
+ }
+ content.slideToggle();
+ },
- toggleVisibility: function(what){
+ /**
+ * Simple vanilla way to toggle an element
+ * @param {string} what i.e. someid (no # prefix)
+ */
+ toggleVisibility : function (what){
+
var e = document.getElementById(what);
- if(e.style.display == 'block')
- e.style.display = 'none';
- else
- e.style.display = 'block';
+ if(e.style.display == 'block') {
+ e.style.display = 'none';
+ } else {
+ e.style.display = 'block';
+ }
},
-
+
/**
* Code common to both jupman in jupyter and Website
*/
initCommon : function(){
-
- $(".jupman-solution-header").remove();
- span = $('
');
- span.addClass('jupman-solution-header');
- span.text('Show/hide solution');
-
- span.insertBefore(".jupman-solution");
-
-
- $(".jupman-solution").hide();
- $(".jupman-solution-header").show();
- $('.jupman-solution-header')
- .off('click')
- .click(function(){
-
- var uls = $(this).nextAll(".jupman-solution");
- var sibling = uls.eq(0);
-
- sibling.slideToggle();
- ev.preventDefault();
- ev.stopPropagation();
- });
+ console.log('Jupman initCommon')
},
@@ -157,16 +165,7 @@ var jupman = {
// **************************** WARNING ********************************
// THIS HIDE STUFF DOES NOT WORK IN SPHINX, ONLY WORKS WHEN YOU MANUALLY EXPORT TO HTML
// ******************************************************************************
- jupman.hideCell("%%HTML");
- jupman.hideCell("import jupman");
-
- // TODO this is a bit too hacky
- jupman.hideCell(/from exercise(.+)_solution import \*/)
- jupman.hideCellAll(/.*jupman_init.*/);
- jupman.hideCell("jupman_show_run(");
- jupman.hideCell("nxpd.draw(");
- jupman.hideCellAll("jupman_run(");
if (jupman.hasToc()){
if ($("#jupman-toc").length === 0){
@@ -200,7 +199,7 @@ var jupman = {
} else {
$("#jupman-toc").hide();
}
-
+$
/* if ($("#jupman-toc").is(":visible")){
if (jupman.hoverToc()) {
} else {
@@ -285,7 +284,7 @@ var jupman = {
jupman.initCommon();
- if (typeof JUPMAN_IN_JUPYTER === "undefined" || !JUPMAN_IN_JUPYTER ){
+ if (typeof JUPMAN_IN_JUPYTER === "undefined" || !JUPMAN_IN_JUPYTER ){
jupman.initWebsite();
} else {
jupman.initJupyter();
diff --git a/_test/jupman_tools_test.py b/_test/jupman_tools_test.py
index 4c0f3432..dae03134 100644
--- a/_test/jupman_tools_test.py
+++ b/_test/jupman_tools_test.py
@@ -190,9 +190,9 @@ def test_setup(tconf):
mockapp = MockSphinx()
tconf.setup(mockapp)
- assert os.path.isfile(os.path.join(tconf.jm.generated, 'jupyter-intro.zip'))
- assert os.path.isfile(os.path.join(tconf.jm.generated, 'python-intro.zip'))
- assert os.path.isfile(os.path.join(tconf.jm.generated, 'tools-intro.zip'))
+ assert os.path.isfile(os.path.join(tconf.jm.generated, 'jupyter-example.zip'))
+ assert os.path.isfile(os.path.join(tconf.jm.generated, 'python-example.zip'))
+ assert os.path.isfile(os.path.join(tconf.jm.generated, 'jup-and-py-example.zip'))
def test_ignore_spaces():
diff --git a/changelog.md b/changelog.md
index 65cc0be1..8dcad67e 100644
--- a/changelog.md
+++ b/changelog.md
@@ -3,7 +3,18 @@
Jupman Jupyter Manager
-https://jupman.softpython.org
+[jupman.softpython.org](https://jupman.softpython.org)
+
+
+## October 16 2020 - 3.2
+
+- added optional build on Github Actions
+- solutions are finally hidden on the website, with a click to show button!
+- moved to jupman.softpython.org
+- updated nbsphinx to 0.7.1
+- updated sphinx_rtd_theme to 0.4.3
+- updated sphinx to 2.3.1
+- updated pygments to2.7.1
## January 16th 2020 - 3.1
diff --git a/conf.py b/conf.py
index d7806f21..2d948453 100644
--- a/conf.py
+++ b/conf.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python3# -*- coding: utf-8 -*-
+
# This is the configuration file of Sphynx, edit it as needed.
import recommonmark
@@ -12,6 +13,7 @@
import sys
sys.path.append('.') # for rtd
import jupman_tools as jmt
+import jupman_tools
on_rtd = os.environ.get('READTHEDOCS') == 'True'
@@ -48,7 +50,13 @@
jm.chapter_patterns = ['*/']
jm.chapter_exclude_patterns = ['[^_]*/','exams/', 'project/']
-# words used in ipynb files - you might want to translate these in your language. Use plural.
+# words used in ipynb files - you might want to translate these in your language.
+# Use singular
+jm.ipynb_show_solution = "Show solution"
+jm.ipynb_hide_solution = "Hide"
+jm.ipynb_show_answer = "Show answer"
+jm.ipynb_hide_answer = "Hide"
+# Use plural
jm.ipynb_solutions = "SOLUTIONS"
jm.ipynb_exercises = "EXERCISES"
@@ -424,7 +432,9 @@
# Background images fitting mode
pdf_fit_background_mode = 'scale'
+
def setup(app):
+ jmt.init(jm)
app.add_config_value( 'recommonmark_config', {
'auto_toc_tree_section': 'Contents',
@@ -445,12 +455,13 @@ def sub(x):
return x
jm.zip_paths(['project', 'requirements.txt'],
- '_static/generated/project-template',
- patterns = sub)
-
+ '_static/generated/project-template',
+ patterns = sub)
source_suffix = {
'.rst': 'restructuredtext',
'.txt': 'markdown',
'.md': 'markdown'
-}
\ No newline at end of file
+}
+
+
diff --git a/index.ipynb b/index.ipynb
index 2a752b69..bff64e7d 100644
--- a/index.ipynb
+++ b/index.ipynb
@@ -534,13 +534,13 @@
"\n",
"- Based on [NBSphinx](http://nbsphinx.readthedocs.io/) which produces website made of static files\n",
"- Supports build with ReadTheDocs or [Github Actions](https://github.com/DavidLeoni/readthedocs-to-actions) (or local Docker emulating ReadTheDocs)\n",
- "- decent PDF layout\n",
"- builds exercises from solution templates (both .ipynb and .py)\n",
"- builds chapter zips\n",
"- supports sharing code among chapters\n",
"- Python Tutor integration (can work offline, doesn't need to install dependencies)\n",
"- includes a exam management system (script and grades spreadsheet)\n",
"- configuration clearly separated from code\n",
+ "- decent PDF layout\n",
"- made for Python 3\n",
"- comes with [documentation](usage.ipynb)\n",
"- Open source code [on Github](https://github.com/DavidLeoni/jupman)\n",
@@ -553,8 +553,9 @@
"\n",
"**Used by:**\n",
"\n",
- "- [Scientific Programming Lab at University of Trento, Data Science Master](http://datasciprolab.readthedocs.io/) (English)\n",
- "- [SoftPython book](http://softpython.readthedocs.io/) (Italian)"
+ "- [SoftPython book (english)](https://en.softpython.org/)\n",
+ "- [SoftPython book (italian)](https://it.softpython.org/)\n",
+ "- [Scientific Programming Lab at University of Trento, Data Science Master](http://datasciprolab.readthedocs.io/) (English)"
]
},
{
@@ -576,13 +577,17 @@
"source": [
"## Revisions\n",
"\n",
+ "* **16 October 2020**: Released v3.2\n",
+ "\n",
+ "* **16 January 2020**: Released v3.1\n",
+ "\n",
"* **29 December 2019**: Released v3.0\n",
"\n",
"* **24 September 2018**: Released v2.0\n",
"\n",
"* **3 August 2018**: Released v0.8\n",
"\n",
- "* [Change log](changelog.ipynb)\n"
+ "* [Change log](changelog.md)"
]
},
{
@@ -605,9 +610,9 @@
"\n",
"1. [JUPMAN USAGE](usage.ipynb)\n",
"1. Chapter examples\n",
- " 1. [Python introduction](python-intro.ipynb)\n",
- " 1. [Jupyter introduction](jupyter-intro.ipynb)\n",
- " 1. [Tools](tools-intro.ipynb)\n",
+ " 1. [Python example](python-example/python-example.ipynb)\n",
+ " 1. [Jupyter example](jupyter-example/jupyter-example-sol.ipynb)\n",
+ " 1. [Jupyter and python example](jup-and-py-example/jup-and-py-example-sol.ipynb)\n",
"1. Templates\n",
" 1. [Past exams](past-exams.ipynb)\n",
" 1. [Changelog](changelog.md)"
diff --git a/jupyter-intro/example.csv b/jup-and-py-example/example.csv
similarity index 100%
rename from jupyter-intro/example.csv
rename to jup-and-py-example/example.csv
diff --git a/jupyter-intro/example.txt b/jup-and-py-example/example.txt
similarity index 100%
rename from jupyter-intro/example.txt
rename to jup-and-py-example/example.txt
diff --git a/jupyter-intro/_static/img/leaves.png b/jup-and-py-example/img/leaves.png
similarity index 100%
rename from jupyter-intro/_static/img/leaves.png
rename to jup-and-py-example/img/leaves.png
diff --git a/jupyter-intro/_static/img/local-image.svg b/jup-and-py-example/img/local-image.svg
similarity index 100%
rename from jupyter-intro/_static/img/local-image.svg
rename to jup-and-py-example/img/local-image.svg
diff --git a/tools-intro/tools-intro-sol.ipynb b/jup-and-py-example/jup-and-py-example-sol.ipynb
similarity index 100%
rename from tools-intro/tools-intro-sol.ipynb
rename to jup-and-py-example/jup-and-py-example-sol.ipynb
diff --git a/python-intro/local.py b/jup-and-py-example/local.py
similarity index 100%
rename from python-intro/local.py
rename to jup-and-py-example/local.py
diff --git a/python-intro/other_format_sol.pdf b/jup-and-py-example/other_format_sol.pdf
similarity index 100%
rename from python-intro/other_format_sol.pdf
rename to jup-and-py-example/other_format_sol.pdf
diff --git a/tools-intro/text_sol.py b/jup-and-py-example/text_sol.py
similarity index 100%
rename from tools-intro/text_sol.py
rename to jup-and-py-example/text_sol.py
diff --git a/tools-intro/text_test.py b/jup-and-py-example/text_test.py
similarity index 100%
rename from tools-intro/text_test.py
rename to jup-and-py-example/text_test.py
diff --git a/jupman-tests.ipynb b/jupman-tests.ipynb
index 9ab6b7a1..06561561 100644
--- a/jupman-tests.ipynb
+++ b/jupman-tests.ipynb
@@ -12,6 +12,8 @@
"text/html": [
"\n",
"\n",
"\n",
" \n",
- " \n",
- "
\n",
+ "
\n",
" \n",
"