Skip to content

Commit

Permalink
Merge pull request #22 from angelasofiaremolinagutierrez/brython-update
Browse files Browse the repository at this point in the history
Brython update
  • Loading branch information
AngelaRemolina authored Aug 17, 2021
2 parents 3ef8080 + 1f73185 commit 3f27c97
Show file tree
Hide file tree
Showing 61 changed files with 234,210 additions and 9,940 deletions.
4 changes: 2 additions & 2 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
"sphinx.ext.mathjax",
"recommonmark",
"myst_parser",
"sphinx.ext.intersphinx",
] + runestone_extensions()

Expand Down Expand Up @@ -322,7 +322,7 @@
# It True, sets js files from Sphinx & Runestone to be loaded with defer attr
# substantially speeding up page rendering. May cause issues with books that
# have custom directives or raw html that assume jquery or another library
# is loaded before body is parsed.
# is loaded before body is parsed.
html_defer_js = True

# Output file base name for HTML help builder.
Expand Down
7,248 changes: 31 additions & 7,217 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion requirements-dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ selenium>=2.53.6
pyvirtualdisplay
pytest
pylint
readme-renderer>24
readme-renderer>24
myst_parser
41 changes: 33 additions & 8 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ alabaster==0.7.12
# via sphinx
astroid==2.5.6
# via pylint
attrs==20.3.0
atomicwrites==1.4.0
# via pytest
attrs==21.2.0
# via
# markdown-it-py
# pytest
babel==2.9.1
# via sphinx
bleach==3.3.0
Expand All @@ -27,10 +31,16 @@ codechat==1.8.6
cogapp==3.0.0
# via -r requirements.in
colorama==0.4.4
# via twine
# via
# pylint
# pytest
# sphinx
# tqdm
# twine
docutils==0.16
# via
# codechat
# myst-parser
# readme-renderer
# sphinx
easyprocess==0.3
Expand All @@ -49,19 +59,29 @@ iniconfig==1.1.1
# via pytest
isort==5.8.0
# via pylint
jinja2==2.11.3
# via sphinx
jinja2==3.0.1
# via
# myst-parser
# sphinx
keyring==23.0.1
# via twine
lazy-object-proxy==1.6.0
# via astroid
lxml==4.6.3
# via codechat
markupsafe==1.1.1
markdown-it-py==1.1.0
# via
# mdit-py-plugins
# myst-parser
markupsafe==2.0.1
# via jinja2
mccabe==0.6.1
# via pylint
packaging==20.9
mdit-py-plugins==0.2.8
# via myst-parser
myst-parser==0.15.1
# via -r requirements-dev.in
packaging==21.0
# via
# bleach
# pytest
Expand Down Expand Up @@ -95,18 +115,22 @@ pytz==2021.1
# via babel
pyvirtualdisplay==2.1
# via -r requirements-dev.in
pywin32-ctypes==0.2.0
# via keyring
pyyaml==5.4.1
# via myst-parser
readme-renderer==29.0
# via
# -r requirements-dev.in
# twine
requests-toolbelt==0.9.1
# via twine
requests==2.25.1
requests==2.26.0
# via
# requests-toolbelt
# sphinx
# twine
rfc3986==1.4.0
rfc3986==1.5.0
# via twine
selenium==3.141.0
# via -r requirements-dev.in
Expand All @@ -121,6 +145,7 @@ snowballstemmer==2.1.0
sphinx==3.5.4
# via
# -r requirements.in
# myst-parser
# sphinxcontrib-paverutils
sphinxcontrib-applehelp==1.0.2
# via sphinx
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# *********
# |docname|
# *********
click
click<8.0
Paver>=1.2.4
six>1.12
Sphinx>=2.0.0
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2020.12.5
# via requests
chardet==4.0.0
# via requests
click==7.1.2
click<8.0
# via -r requirements.in
codechat==1.8.6
# via -r requirements.in
Expand Down
6 changes: 0 additions & 6 deletions runestone/activecode/js/activecode_brython.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export default class BrythonActiveCode extends ActiveCode {
import sys
from browser import document, html
import traceback
preElem = html.PRE()
logger = html.CODE()
container = html.DIV()
Expand All @@ -60,9 +59,7 @@ class NewOut:
def write(self, data):
logger.innerHTML += str(data)
container.style.visibility = "visible"
sys.stderr = sys.stdout = NewOut()
def my_exec(code):
try:
exec(code, locals())
Expand Down Expand Up @@ -101,12 +98,9 @@ def my_exec(code):
container.style.backgroundColor = "#f2dede"
container.style.border = "1px solid #ebccd1"
logger.classList.add("plaintext")
document <= container
my_prog = ${JSON.stringify(prog)}
my_exec(my_prog)
document <= html.SCRIPT("hljs.highlightAll();")
document <= html.SCRIPT("let container = document.querySelector('.container-pre'); let height = container.offsetHeight; document.body.style.paddingBottom = String(height)+'px';")
</script>
Expand Down
4 changes: 3 additions & 1 deletion runestone/activecode/test/_sources/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

ActiveCode Test
===============

Note: an existing server-side test is named ``test_activecode_1``. So, we start numbering here at 2.

.. activecode:: test_activecode_2
Expand Down Expand Up @@ -2839,4 +2840,5 @@ Trying Brython as Python 3 interpreter
alert("Hello! I'm using Brython :D")

document <= html.BUTTON("My button", id="button_alert")
document["button_alert"].bind("click", hello)
document["button_alert"].bind("click", hello)

38 changes: 23 additions & 15 deletions runestone/common/css/runestone-custom-sphinx-bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,20 @@ div.flash {
position: fixed;
}

.navLink:hover {
opacity: 1;
}

.navLink a {
display: inline-block;
background-color: white;
border-style:solid;
border-color:lightgrey;
border-width:2px;
width:100px;
height:50px
}

#relations-next {
right: 35px;
}
Expand All @@ -669,28 +683,22 @@ div.flash {
left: 35px;
}

@media (max-width: 600px) {
.nextprev-list {
margin: 10px;
padding-left: 0;
height: 50px;
}

/* Styling definitions for chevron function in bookfuncs.js */
@media (max-width: 600px) {

.navLink {
z-index: 2;
display: inline;
position: static;
}

ul#top-relations-console,
ul#bottom-relations-console {
list-style: none;
text-align: center;
width: 100%;
margin: 0 auto;
padding: 40px 0 20px 0;
}

#top-relations-next,
#top-relations-prev,
#bottom-relations-next,
#bottom-relations-prev {
#relations-next,
#relations-prev {
width: 25%;
padding: 0 20px;
display: inline;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
<div class="container" id="continue-reading"></div>

<div class="container" id="main-content" role="main">

<!-- Ad Serving for Runestone Campaign -->
{% if dynamic_pages == 'True' %}
{% raw %}
Expand All @@ -310,9 +311,9 @@
<div id=scprogresscontainer>
You have attempted <span id=scprogresstotal></span> of <span id=scprogressposs></span> activities on this page <div id="subchapterprogress"></div>
</div>
{% block nextprevious %}
{% include "subchapter.html" %}
{% endblock %}

{% include "subchapter.html" %}

</div>
{%- endblock %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
<ul role="navigation" class="nextprev-list nextprev-list" aria-label="Change page">
{%- if prev %}
<ul>
<li id="relations-prev" style="opacity:0.4" onmouseover="mouseOverPrev()" onmouseout="mouseOutPrev()"class="navLink" title='Previous Section - {{ prev.title|extractText|extractTextII }}' data-toggle="tooltip">
<a href="{{ prev.link|e }}" aria-label="{{ prev.title|extractText|extractTextII }}">
<div style="background-color: white; border-style:solid; border-color:lightgrey; border-width:2px; width:100px; height:50px">
<i class='prevNav glyphicon glyphicon-chevron-left' style="top:50%; transform:translateY(-50%)translateX(-50%); left: 50%; color:black;"></i>
</div>
</a>
</li>
</ul>

{% endif %}
<li id="relations-prev" class="navLink" title='Previous Section - {{ prev.title|extractText|extractTextII }}' data-toggle="tooltip">
<a href="{{ prev.link|e }}" aria-label="Previous - {{ prev.title|extractText|extractTextII }}">
<i class='prevNav glyphicon glyphicon-chevron-left' style="top:50%; transform:translateY(-50%)translateX(-50%); left: 50%; color:black;"></i>
</a>
</li>
{% endif %}

{%- if next %}
<ul>
<li id="relations-next" style="opacity:0.4" onmouseover="mouseOverNext()" onmouseout="mouseOutNext()" class="navLink" title='Next Section - {{ next.title|extractText|extractTextII }}' data-toggle="tooltip" >
<a href="{{ next.link|e }}" aria-label="{{ next.title|extractText|extractTextII }}">
<div style="background-color: white; border-style:solid; border-color:lightgrey; border-width:2px; width:100px; height:50px">
<i id="relationsNextIcon" class='nextNav glyphicon glyphicon-chevron-right' style="top:50%; transform:translateY(-50%)translateX(-50%); left: 50%; color:black; "></i>
</div>
<li id="relations-next" class="navLink" title='Next Section - {{ next.title|extractText|extractTextII }}' data-toggle="tooltip" >
<a href="{{ next.link|e }}" aria-label="Next - {{ next.title|extractText|extractTextII }}">
<i id="relationsNextIcon" class='nextNav glyphicon glyphicon-chevron-right' style="top:50%; transform:translateY(-50%)translateX(-50%); left: 50%; color:black; "></i>
</a>
</li>
</ul>

{%- endif %}

<script>
document.addEventListener('load', (event) => {
$('#relations-prev').tooltip({'placement':'right', 'selector': '', 'delay': { show: 100, hide: 50}});
$('#relations-next').tooltip({'placement':'left', 'selector': '', 'delay': { show: 100, hide: 50}});
window.addEventListener('load', (event) => {
$('#relations-prev').tooltip({'placement': 'right', 'delay': { show: 100, hide: 50}});
$('#relations-next').tooltip({'placement': 'left', 'delay': { show: 100, hide: 50}});
});
</script>

Expand Down
Loading

0 comments on commit 3f27c97

Please sign in to comment.