Commit 4056fa7e authored by Jérome Perrin's avatar Jérome Perrin

software/theia: include a CSS to enable more fonts

parent 7803ee1c
......@@ -15,7 +15,7 @@
[instance]
filename = instance.cfg.in
md5sum = f95354d4af4a78ad7fd11ebc9281ed19
md5sum = 3bc174f9ec19721ab21491eb51cc45b7
[yarn.lock]
filename = yarn.lock
......@@ -24,3 +24,11 @@ md5sum = d058e73c3d90ac3da44734c2d47eac95
[python-language-server-requirements.txt]
filename = python-language-server-requirements.txt
md5sum = d2ce161244ce9ebce5295302a1b2a7df
[preloadTemplate.html]
filename = preloadTemplate.html
md5sum = 8157c22134200bd862a07c6521ebf799
[slapos.css.in]
filename = slapos.css.in
md5sum = 456dd5931e7c86456c69af062a2d2368
......@@ -54,7 +54,7 @@ template = inline:
root $${directory:frontend-static}
browse
proxy / $${theia-instance:base-url} {
except public $${favicon.ico:filename}
except $${frontend-instance-fonts:folder-name} $${frontend-instance-slapos.css:folder-name} public $${favicon.ico:filename}
}
proxy /services $${theia-instance:base-url} {
websocket
......@@ -83,6 +83,24 @@ port = $${frontend-instance-config:port}
pidfile = $${directory:pidfiles}/$${:_buildout_section_name_}.pid
url = https://$${:hostname}:$${:port}/
[frontend-instance-fonts]
; XXX caddy 1 does not seem to serve different folders at different locations
; so we link fonts in static folder
recipe = plone.recipe.command
location = $${directory:frontend-static}/$${:folder-name}
folder-name = fonts
command =
mkdir $${:location}
ln -s ${source-code-pro-fonts:location} $${:location}/source-code-pro
ln -s ${jetbrains-mono-fonts:location} $${:location}/jetbrains-mono
stop-on-error = true
[frontend-instance-slapos.css]
recipe = slapos.recipe.template:jinja2
template = ${slapos.css.in:output}
rendered = $${directory:frontend-static}/$${:folder-name}/slapos.css
folder-name = css
[frontend-reload]
recipe = slapos.cookbook:wrapper
wrapper-path = $${directory:services}/$${:_buildout_section_name_}
......@@ -323,3 +341,4 @@ project = $${:srv}/project
slapos = $${:srv}/slapos
frontend-static = $${:srv}/frontend-static
frontend-static-public = $${:frontend-static}/public
frontend-static-css = $${:frontend-static}/css
<script>
let link = document.createElement('link');
link.rel = "stylesheet";
link.href = "/css/slapos.css";
document.head.appendChild(link);
</script>
\ No newline at end of file
/* Source Code Pro */
@font-face{
font-family: 'Source Code Pro';
font-weight: 200;
font-style: normal;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-ExtraLight.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-ExtraLight.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-ExtraLight.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-ExtraLight.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 200;
font-style: italic;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-ExtraLightIt.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-ExtraLightIt.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-ExtraLightIt.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-ExtraLightIt.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 300;
font-style: normal;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-Light.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-Light.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-Light.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-Light.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 300;
font-style: italic;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-LightIt.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-LightIt.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-LightIt.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-LightIt.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 400;
font-style: normal;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-Regular.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-Regular.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-Regular.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 400;
font-style: italic;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-It.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-It.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-It.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-It.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 500;
font-style: normal;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-Medium.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-Medium.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-Medium.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-Medium.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 500;
font-style: italic;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-MediumIt.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-MediumIt.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-MediumIt.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-MediumIt.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 600;
font-style: normal;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-Semibold.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-Semibold.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-Semibold.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-Semibold.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 600;
font-style: italic;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-SemiboldIt.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-SemiboldIt.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-SemiboldIt.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-SemiboldIt.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 700;
font-style: normal;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-Bold.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-Bold.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-Bold.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 700;
font-style: italic;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-BoldIt.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-BoldIt.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-BoldIt.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-BoldIt.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 900;
font-style: normal;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-Black.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-Black.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-Black.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-Black.ttf') format('truetype');
}
@font-face{
font-family: 'Source Code Pro';
font-weight: 900;
font-style: italic;
font-stretch: normal;
src: url('/fonts/source-code-pro/WOFF2/TTF/SourceCodePro-BlackIt.ttf.woff2') format('woff2'),
url('/fonts/source-code-pro/WOFF/OTF/SourceCodePro-BlackIt.otf.woff') format('woff'),
url('/fonts/source-code-pro/OTF/SourceCodePro-BlackIt.otf') format('opentype'),
url('/fonts/source-code-pro/TTF/SourceCodePro-BlackIt.ttf') format('truetype');
}
/* JetBrains Mono */
/* CSS come from https://github.com/paleite/typeface-jetbrains-mono/blob/6cbded1fa6283c29b9e5d93e5c70f5702e17bc68/index.css */
/* JetBrainsMono-Bold-Italic - © 2000-2020 JetBrains s.r.o. Developed with drive and IntelliJ IDEA. */
@font-face {
font-family: "JetBrains Mono";
font-style: italic;
font-weight: 700;
font-feature-settings: "calt" 1, "zero" 1;
font-display: swap;
src: url("/fonts/jetbrains-mono/web/eot/JetBrainsMono-Bold-Italic.eot") format("embedded-opentype"),
url("/fonts/jetbrains-mono/web/woff2/JetBrainsMono-Bold-Italic.woff2") format("woff2"),
url("/fonts/jetbrains-mono/web/woff/JetBrainsMono-Bold-Italic.woff") format("woff"),
url("/fonts/jetbrains-mono/ttf/JetBrainsMono-Bold-Italic.ttf") format("truetype");
}
/* JetBrainsMono-Bold - © 2000-2020 JetBrains s.r.o. Developed with drive and IntelliJ IDEA. */
@font-face {
font-family: "JetBrains Mono";
font-style: normal;
font-weight: 700;
font-feature-settings: "calt" 1, "zero" 1;
font-display: swap;
src: url("/fonts/jetbrains-mono/web/eot/JetBrainsMono-Bold.eot") format("embedded-opentype"),
url("/fonts/jetbrains-mono/web/woff2/JetBrainsMono-Bold.woff2") format("woff2"),
url("/fonts/jetbrains-mono/web/woff/JetBrainsMono-Bold.woff") format("woff"),
url("/fonts/jetbrains-mono/ttf/JetBrainsMono-Bold.ttf") format("truetype");
}
/* JetBrainsMono-ExtraBold-Italic - © 2000-2020 JetBrains s.r.o. Developed with drive and IntelliJ IDEA. */
@font-face {
font-family: "JetBrains Mono ExtraBold";
font-style: italic;
font-weight: 800;
font-feature-settings: "calt" 1, "zero" 1;
font-display: swap;
src: url("/fonts/jetbrains-mono/web/eot/JetBrainsMono-ExtraBold-Italic.eot") format("embedded-opentype"),
url("/fonts/jetbrains-mono/web/woff2/JetBrainsMono-ExtraBold-Italic.woff2") format("woff2"),
url("/fonts/jetbrains-mono/web/woff/JetBrainsMono-ExtraBold-Italic.woff") format("woff"),
url("/fonts/jetbrains-mono/ttf/JetBrainsMono-ExtraBold-Italic.ttf") format("truetype");
}
/* JetBrainsMono-ExtraBold - © 2000-2020 JetBrains s.r.o. Developed with drive and IntelliJ IDEA. */
@font-face {
font-family: "JetBrains Mono ExtraBold";
font-style: normal;
font-weight: 800;
font-feature-settings: "calt" 1, "zero" 1;
font-display: swap;
src: url("/fonts/jetbrains-mono/web/eot/JetBrainsMono-ExtraBold.eot") format("embedded-opentype"),
url("/fonts/jetbrains-mono/web/woff2/JetBrainsMono-ExtraBold.woff2") format("woff2"),
url("/fonts/jetbrains-mono/web/woff/JetBrainsMono-ExtraBold.woff") format("woff"),
url("/fonts/jetbrains-mono/ttf/JetBrainsMono-ExtraBold.ttf") format("truetype");
}
/* JetBrainsMono-Italic - © 2000-2020 JetBrains s.r.o. Developed with drive and IntelliJ IDEA. */
@font-face {
font-family: "JetBrains Mono";
font-style: italic;
font-weight: 400;
font-feature-settings: "calt" 1, "zero" 1;
font-display: swap;
src: url("/fonts/jetbrains-mono/web/eot/JetBrainsMono-Italic.eot") format("embedded-opentype"),
url("/fonts/jetbrains-mono/web/woff2/JetBrainsMono-Italic.woff2") format("woff2"),
url("/fonts/jetbrains-mono/web/woff/JetBrainsMono-Italic.woff") format("woff"),
url("/fonts/jetbrains-mono/ttf/JetBrainsMono-Italic.ttf") format("truetype");
}
/* JetBrainsMono-Medium-Italic - © 2000-2020 JetBrains s.r.o. Developed with drive and IntelliJ IDEA. */
@font-face {
font-family: "JetBrains Mono Medium";
font-style: italic;
font-weight: 500;
font-feature-settings: "calt" 1, "zero" 1;
font-display: swap;
src: url("/fonts/jetbrains-mono/web/eot/JetBrainsMono-Medium-Italic.eot") format("embedded-opentype"),
url("/fonts/jetbrains-mono/web/woff2/JetBrainsMono-Medium-Italic.woff2") format("woff2"),
url("/fonts/jetbrains-mono/web/woff/JetBrainsMono-Medium-Italic.woff") format("woff"),
url("/fonts/jetbrains-mono/ttf/JetBrainsMono-Medium-Italic.ttf") format("truetype");
}
/* JetBrainsMono-Medium - © 2000-2020 JetBrains s.r.o. Developed with drive and IntelliJ IDEA. */
@font-face {
font-family: "JetBrains Mono Medium";
font-style: normal;
font-weight: 500;
font-feature-settings: "calt" 1, "zero" 1;
font-display: swap;
src: url("/fonts/jetbrains-mono/web/eot/JetBrainsMono-Medium.eot") format("embedded-opentype"),
url("/fonts/jetbrains-mono/web/woff2/JetBrainsMono-Medium.woff2") format("woff2"),
url("/fonts/jetbrains-mono/web/woff/JetBrainsMono-Medium.woff") format("woff"),
url("/fonts/jetbrains-mono/ttf/JetBrainsMono-Medium.ttf") format("truetype");
}
/* JetBrainsMono-Regular - © 2000-2020 JetBrains s.r.o. Developed with drive and IntelliJ IDEA. */
@font-face {
font-family: "JetBrains Mono";
font-style: normal;
font-weight: 400;
font-feature-settings: "calt" 1, "zero" 1;
font-display: swap;
src: url("/fonts/jetbrains-mono/web/eot/JetBrainsMono-Regular.eot") format("embedded-opentype"),
url("/fonts/jetbrains-mono/web/woff2/JetBrainsMono-Regular.woff2") format("woff2"),
url("/fonts/jetbrains-mono/web/woff/JetBrainsMono-Regular.woff") format("woff"),
url("/fonts/jetbrains-mono/ttf/JetBrainsMono-Regular.ttf") format("truetype");
}
......@@ -11,6 +11,7 @@ extends =
../../component/curl/buildout.cfg
../../component/coreutils/buildout.cfg
../../component/java-jdk/buildout.cfg
../../component/fonts/buildout.cfg
../../stack/slapos.cfg
../../stack/monitor/buildout.cfg
../../component/defaults.cfg
......@@ -116,6 +117,12 @@ eggs =
supervisor
setuptools
[template-base]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:parts-directory}/${:_buildout_section_name_}
mode = 0644
[python-language-server]
version = 0.19.0
recipe = plone.recipe.command
......@@ -127,11 +134,7 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_}
stop-on-error = true
[python-language-server-requirements.txt]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:parts-directory}/${:_buildout_section_name_}
mode = 0644
<= template-base
[theia]
recipe = plone.recipe.command
......@@ -152,10 +155,13 @@ uses = ${yarn.lock:recipe}
THEIA_DEFAULT_PLUGINS = ${:location}/plugins/
[yarn.lock]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:parts-directory}/${:_buildout_section_name_}
mode = 0644
<= template-base
[preloadTemplate.html]
<= template-base
[slapos.css.in]
<= template-base
[package.json]
recipe = slapos.recipe.template:jinja2
......@@ -193,6 +199,11 @@ template =
"java.home": "${java-jdk:location}"
}
}
},
"generator": {
"config": {
"preloadTemplate": "${preloadTemplate.html:output}"
}
}
},
"dependencies": {
......@@ -345,9 +356,7 @@ template =
[instance]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
mode = 0644
<= template-base
output = ${buildout:directory}/instance.cfg
[versions]
......
......@@ -32,6 +32,7 @@ import logging
import subprocess
import tempfile
import time
import re
from six.moves.urllib.parse import urlparse, urljoin
import pexpect
......@@ -81,6 +82,16 @@ class TestTheia(SlapOSInstanceTestCase):
self.assertEqual(requests.codes.ok, resp.status_code)
self.assertTrue(resp.raw)
# there is a CSS referencing fonts
css_text = requests.get(urljoin(authenticated_url, '/css/slapos.css'), verify=False).text
css_urls = re.findall(r'url\([\'"]+([^\)]+)[\'"]+\)', css_text)
self.assertTrue(css_urls)
# and fonts are served
for url in css_urls:
resp = requests.get(urljoin(authenticated_url, url), verify=False)
self.assertEqual(requests.codes.ok, resp.status_code)
self.assertTrue(resp.raw)
def test_theia_slapos(self):
# Make sure we can use the shell and the integrated slapos command
process = pexpect.spawnu(
......@@ -134,7 +145,7 @@ class TestTheia(SlapOSInstanceTestCase):
process.wait()
def test_theia_shell_execute_tasks(self):
# shell needs to understand -c "comamnd" arguments for theia tasks feature
# shell needs to understand -c "command" arguments for theia tasks feature
test_file = '{}/test file'.format(self.computer_partition_root_path)
subprocess.check_call([
'{}/bin/theia-shell'.format(self.computer_partition_root_path),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment