Use Juniper and tidy up

This commit is contained in:
ines 2018-04-30 18:48:35 +02:00
parent 45bb8d75a5
commit 6efb4cdf88
9 changed files with 44 additions and 58 deletions

View File

@ -86,8 +86,8 @@
}
],
"V_CSS": "2.1.2",
"V_JS": "2.1.0",
"V_CSS": "2.1.3",
"V_JS": "2.1.1",
"DEFAULT_SYNTAX": "python",
"ANALYTICS": "UA-58931649-1",
"MAILCHIMP": {

View File

@ -260,8 +260,8 @@ mixin code(label, language, prompt, height, icon, wrap)
mixin code-exec(label, large)
- label = (label || "Editable code example") + " (experimental)"
+terminal-wrapper(label, !large)
figure.thebelab-wrapper
span.thebelab-wrapper__text.u-text-tiny v#{BINDER_VERSION} · Python 3 · via #[+a("https://mybinder.org/").u-hide-link Binder]
figure.juniper-wrapper
span.juniper-wrapper__text.u-text-tiny v#{BINDER_VERSION} · Python 3 · via #[+a("https://mybinder.org/").u-hide-link Binder]
+code(data-executable="true")&attributes(attributes)
block

View File

@ -1,15 +1,10 @@
//- 💫 INCLUDES > SCRIPTS
if IS_PAGE || SECTION == "index"
script(type="text/x-thebe-config")
| { bootstrap: true, binderOptions: { repo: "#{KERNEL_BINDER}"},
| kernelOptions: { name: "#{KERNEL_PYTHON}" }}
- scripts = ["vendor/prism.min", "vendor/vue.min"]
- if (SECTION == "universe") scripts.push("vendor/vue-markdown.min")
- if (quickstart) scripts.push("vendor/quickstart.min")
- if (IS_PAGE) scripts.push("vendor/in-view.min")
- if (IS_PAGE || SECTION == "index") scripts.push("vendor/thebelab.custom.min")
- if (IS_PAGE || SECTION == "index") scripts.push("vendor/juniper.min")
for script in scripts
script(src="/assets/js/" + script + ".js")

View File

@ -3,7 +3,7 @@
//- Code block
.c-code-block,
.thebelab-cell
.juniper-cell
background: $color-front
color: darken($color-back, 20)
padding: 0.75em 0
@ -32,7 +32,7 @@
//- Code block content
.c-code-block__content,
.thebelab-input,
.juniper-input,
.jp-OutputArea
display: block
font: normal normal 1.1rem/#{1.9} $font-code
@ -45,13 +45,21 @@
vertical-align: middle
opacity: 0.5
//- Thebelab
//- Juniper
[data-executable]
margin-bottom: 0
.thebelab-input.thebelab-input
padding: 3em 2em 1em
.juniper-cell
border: 0
.juniper-input
padding: 0
.juniper-output
color: inherit
background: inherit
padding: 0
.jp-OutputArea
&:not(:empty)
@ -75,13 +83,14 @@
font-family: inherit
font-weight: bold
.thebelab-run-button
.juniper-button
@extend .u-text-label, .u-text-label--dark
position: static
.thebelab-wrapper
.juniper-wrapper
position: relative
.thebelab-wrapper__text
.juniper-wrapper__text
@include position(absolute, top, right, 1.25rem, 1.25rem)
color: $color-subtle-dark
z-index: 10

View File

@ -36,21 +36,19 @@ import initUniverse from './universe.vue.js';
/**
* Initialise Quickstart
*/
if (document.querySelector('#qs') && window.Quickstart) {
new Quickstart('#qs');
{
if (document.querySelector('#qs') && window.Quickstart) {
new Quickstart('#qs');
}
}
/**
* Thebelabs
* Initialise Juniper
*/
if (window.thebelab) {
window.thebelab.on('status', (ev, data) => {
if (data.status == 'failed') {
const msg = "Failed to connect to kernel :( This can happen if too many users are active at the same time. Please reload the page and try again!";
const wrapper = `<span style="white-space: pre-wrap">${msg}</span>`;
document.querySelector('.jp-OutputArea-output pre').innerHTML = wrapper;
}
});
{
if (window.Juniper) {
new Juniper({ repo: 'ines/spacy-binder' });
}
}
/**

View File

@ -116,7 +116,8 @@ export default function(selector, dataPath) {
$_updateUrl(params) {
const loc = Object.keys(params)
.map(param => `${param}=${encodeURIComponent(params[param])}`);
const url = loc.length ? '?' + loc.join('&') : window.location.origin + window.location.pathname;
const url = loc.length ? '?' + loc.join('&')
: window.location.origin + window.location.pathname;
window.history.pushState(params, null, url);
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -276,7 +276,7 @@ p
nlp = spacy.load('en_core_web_sm')
matcher = Matcher(nlp.vocab)
# register a new token extension to flag bad HTML
Token.set_extension('bad_html', default=False, force=True)
Token.set_extension('bad_html', default=False)
def merge_and_flag(matcher, doc, i, matches):
match_id, start, end = matches[i]
@ -650,7 +650,7 @@ p
matcher.add('HASHTAG', None, [{'ORTH': '#'}, {'IS_ASCII': True}])
# register token extension
Token.set_extension('is_hashtag', default=False, force=True)
Token.set_extension('is_hashtag', default=False)
doc = nlp(u"Hello world 😀 #MondayMotivation")
matches = matcher(doc)