mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 09:26:27 +03:00
* Move displacy frontend source
This commit is contained in:
parent
497d0929fe
commit
477785914d
|
@ -1,246 +0,0 @@
|
||||||
var container = document.getElementById("displacy");
|
|
||||||
var dp = [];
|
|
||||||
|
|
||||||
var displaCy = function(mode, api, query, call) {
|
|
||||||
if(mode == "manual" && !call) call = query + "/";
|
|
||||||
var request = call || query;
|
|
||||||
if(mode == "steps") call = 0;
|
|
||||||
|
|
||||||
dp.loadingIndicator();
|
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.open( "POST", api, true);
|
|
||||||
xhr.setRequestHeader("Content-type", "text/plain");
|
|
||||||
xhr.onreadystatechange = function(data) {
|
|
||||||
if (xhr.readyState === 4) {
|
|
||||||
if (xhr.status === 200) {
|
|
||||||
var result = JSON.parse(xhr.responseText);
|
|
||||||
dp.setDisplay(mode, api, query, call, result);
|
|
||||||
dp.loadingIndicator(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xhr.send(JSON.stringify({ text: request}));
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.setDisplay = function(mode, api, query, call, result) {
|
|
||||||
var state = (typeof call === "number") ? call : 0;
|
|
||||||
var wordlist = result.words;
|
|
||||||
var arrowlist = result.states[state].arrows;
|
|
||||||
var stacklist = result.states[state].stack;
|
|
||||||
var focus = result.states[state].focus;
|
|
||||||
var is_final = result.states[state].is_final;
|
|
||||||
var actionlist = result.actions;
|
|
||||||
|
|
||||||
var classnames = {
|
|
||||||
words: { "NO_TAG" : "w-notag", "ADJ" : "w-adj", "ADV" : "w-adv", "ADP" : "w-adp", "DET" : "w-det", "NOUN" : "w-noun", "PRON" : "w-pron", "PRT" : "w-prt", "VERB" : "w-verb", "X" : "w-x", "PUNCT" : "w-punct", "EOL" : "w-eol", "SPACE" : "w-space", "on_stack" : "stack", "is_entity" : "w-ent", "low_prob" : "w-low", "in_focus" : "in-focus"
|
|
||||||
},
|
|
||||||
arrows : { "correct_arc" : "correct", "incorrect_arc" : "incorrect" }
|
|
||||||
}
|
|
||||||
|
|
||||||
container.scrollLeft = 0;
|
|
||||||
dp.clearDisplay();
|
|
||||||
dp.addCss(arrowlist, wordlist);
|
|
||||||
dp.addArrows(arrowlist);
|
|
||||||
dp.addWords(wordlist, classnames.words, focus, stacklist);
|
|
||||||
dp.setFocus(focus, arrowlist, wordlist, stacklist);
|
|
||||||
|
|
||||||
if(mode == "steps") dp.addActions(actionlist, is_final, mode, api, query, call, result);
|
|
||||||
if(mode == "manual") dp.addActions(actionlist, is_final, mode, api, query, call);
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.clearDisplay = function() {
|
|
||||||
document.getElementById("displacy").innerHTML = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.clearActions = function() {
|
|
||||||
var actions = document.getElementById("actions");
|
|
||||||
if(actions != null) actions.innerHTML = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.loadingIndicator = function(loading) {
|
|
||||||
var spinner = dp.element("div", "spinner", "spinner", false);
|
|
||||||
container.appendChild(spinner);
|
|
||||||
|
|
||||||
if(!loading) {
|
|
||||||
document.getElementById("spinner").style.visibility = "hidden";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.calcSize = function(arrowlist) {
|
|
||||||
var size = { height: "350", width: "175", spacing: "10", unit: "px" }
|
|
||||||
if(arrowlist.length <= 3) size.height /= 2.75;
|
|
||||||
if(arrowlist.length > 12) {
|
|
||||||
size.width *= 1.15;
|
|
||||||
size.height *=1.25;
|
|
||||||
}
|
|
||||||
if(arrowlist.length > 20) {
|
|
||||||
size.width *=1.25;
|
|
||||||
size.height *=1.5;
|
|
||||||
}
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.addCss = function(arrowlist, wordlist) {
|
|
||||||
var size = dp.calcSize(arrowlist);
|
|
||||||
|
|
||||||
var css = {
|
|
||||||
height: size.height + size.unit,
|
|
||||||
width: size.width + size.unit,
|
|
||||||
spacing: size.spacing + size.unit
|
|
||||||
}
|
|
||||||
|
|
||||||
var stylesheet = dp.element("style", false, false, ["scoped", "true"]);
|
|
||||||
var styles = ["#displacy *,#displacy *:before,#displacy *:after{box-sizing:border-box}#displacy{position:relative;overflow:scroll}#displacy .focus{position:absolute;top:0;height:100%;z-index:-1;background:rgba(0,0,0,.25)}#displacy .current-stack{margin:6em 1.5em;font-size:.75em;opacity:.25}#displacy .actions{position:fixed;}#displacy .words{display:flex;display:-webkit-flex;display:-ms-flexbox;display:-webkit-box;flex-flow:row nowrap;overflow:hidden;text-align:center}#displacy .words .word:after{content:attr(title);display:block}#displacy .arrows{width:100%;position:relative}.level{position:absolute;bottom:0;width:100%}#displacy .arrow{height:100%;position:absolute;overflow:hidden}#displacy .arrow:before{content:attr(title);text-align:center;display:block;height:200%;border-radius:50%;border:2px solid;margin:0 auto}#displacy .arrow:after{content:'';width:0;height:0;position:absolute;bottom:-1px;border-top:12px solid;border-left:6px solid transparent;border-right:6px solid transparent}#displacy .arrow.null{display:none}"];
|
|
||||||
|
|
||||||
for(var i = 1; i <= arrowlist.length; i++) {
|
|
||||||
var level = ".level" + i;
|
|
||||||
|
|
||||||
styles.push("#displacy " + level + "{height:" + parseInt(100/arrowlist.length * i) + "%}#displacy " + level + " .arrow{width:calc(" + css.width + " * " + i + ")}#displacy " + level + " .arrow:before{width:calc(100% - " + css.spacing + " * " + parseInt(arrowlist.length - i) + " - 10px)}#displacy " + level + " .arrow.left:after{left:calc(" + css.spacing + " * " + (arrowlist.length - i)/2 + ")}#displacy " + level + " .arrow.right:after{right:calc(" + css.spacing + " * " + (arrowlist.length - i)/2 + ")}");
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 1; i < wordlist.length; i++) {
|
|
||||||
styles.push("#displacy .level .arrow:nth-child(" + i + "){left:calc(" + css.width + " * " + parseInt(i - 1) + ")}#displacy .arrows{height:" + css.height + "}#displacy .level{left:calc(" + css.width + "/2)}");
|
|
||||||
}
|
|
||||||
|
|
||||||
styles.push("#displacy .words{min-width:calc(" + css.width + " * " + wordlist.length + ")}.words .word{width:" + css.width + "}")
|
|
||||||
|
|
||||||
stylesheet.appendChild(document.createTextNode(styles.join(' ')));
|
|
||||||
container.appendChild(stylesheet);
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.addArrows = function(arrowlist) {
|
|
||||||
var arrowContainer = dp.element("div", "arrows");
|
|
||||||
|
|
||||||
for(var i = 0; i < arrowlist.length; i++) {
|
|
||||||
var level = dp.element("div", "level level" + (i + 1));
|
|
||||||
|
|
||||||
for(var j = 0; j < arrowlist[i].length; j++) {
|
|
||||||
var arrow = dp.element("span");
|
|
||||||
|
|
||||||
if(arrowlist[i][j] !== null) {
|
|
||||||
arrow.setAttribute("title", arrowlist[i][j].label);
|
|
||||||
arrow.className = "arrow " + arrowlist[i][j].dir;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
arrow.className = "arrow null";
|
|
||||||
}
|
|
||||||
level.appendChild(arrow);
|
|
||||||
}
|
|
||||||
arrowContainer.appendChild(level);
|
|
||||||
}
|
|
||||||
container.appendChild(arrowContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.addWords = function(wordlist, classnames, focus, stacklist) {
|
|
||||||
var wordContainer = dp.element("div", "words");
|
|
||||||
|
|
||||||
for(i = 0; i < wordlist.length; i++) {
|
|
||||||
var classes = [ "word" ];
|
|
||||||
var current = wordlist[i];
|
|
||||||
var tag = current.tag;
|
|
||||||
|
|
||||||
var word = dp.element("div", false, false, ["title", tag]);
|
|
||||||
classes.push(classnames[tag]);
|
|
||||||
|
|
||||||
if(i === focus) classes.push(classnames["in_focus"]);
|
|
||||||
if(stacklist[i]) classes.push(classnames["on_stack"]);
|
|
||||||
if(current.is_entity) classes.push(classnames["is_entity"]);
|
|
||||||
if(!current.is_entity && current.prob <= -17) classes.push(classnames["low_prob"]);
|
|
||||||
|
|
||||||
word.className = classes.join(" ");
|
|
||||||
var wordtext = dp.element("span", false, false, false, wordlist[i].word);
|
|
||||||
word.appendChild(wordtext);
|
|
||||||
wordContainer.appendChild(word);
|
|
||||||
}
|
|
||||||
container.appendChild(wordContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.setFocus = function(focus, arrowlist, wordlist, stacklist) {
|
|
||||||
var size = dp.calcSize(arrowlist);
|
|
||||||
|
|
||||||
var focusContainer = dp.element("div", "focus", "focus");
|
|
||||||
focusContainer.style.width = size.width + size.unit;
|
|
||||||
focusContainer.style.left = size.width * focus + size.unit;
|
|
||||||
|
|
||||||
focusContainer.appendChild(dp.compileStack(wordlist, stacklist));
|
|
||||||
container.appendChild(focusContainer);
|
|
||||||
|
|
||||||
if(size.width * focus - container.scrollLeft > container.clientWidth/2) container.scrollLeft = size.width * focus - container.clientWidth/2 + size.width/2;
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.compileStack = function(wordlist, stacklist) {
|
|
||||||
var stack = dp.element("div", "current-stack", false, ["title", "Stack"]);
|
|
||||||
|
|
||||||
for(var i in wordlist) {
|
|
||||||
if(stacklist[i]) {
|
|
||||||
var word = dp.element("div", false, false, false, wordlist[i].word);
|
|
||||||
stack.appendChild(word);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.addActions = function(actionlist, is_final, mode, api, query, call, result) {
|
|
||||||
dp.clearActions();
|
|
||||||
var bindings = [];
|
|
||||||
var actionContainer = dp.element("div", "actions", "actions");
|
|
||||||
|
|
||||||
for(var i in actionlist) {
|
|
||||||
var button = dp.element("button", actionlist[i].label, false, false, actionlist[i].label);
|
|
||||||
button.onclick = dp.performAction(mode, api, query, call, actionlist[i].key, result);
|
|
||||||
|
|
||||||
if(actionlist[i].is_valid && !is_final) bindings.push({
|
|
||||||
key: actionlist[i].key,
|
|
||||||
code: actionlist[i].binding,
|
|
||||||
action: button.onclick
|
|
||||||
});
|
|
||||||
else button.disabled = true;
|
|
||||||
|
|
||||||
actionContainer.appendChild(button);
|
|
||||||
}
|
|
||||||
container.appendChild(actionContainer);
|
|
||||||
|
|
||||||
document.onkeydown = function(event) {
|
|
||||||
if ('input' != event.target.tagName.toLowerCase()) {
|
|
||||||
var codes = [];
|
|
||||||
for(i in bindings) {
|
|
||||||
if(event.keyCode == bindings[i].code) {
|
|
||||||
bindings[i].action();
|
|
||||||
}
|
|
||||||
codes.push(bindings[i].code);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(codes.indexOf(event.keyCode)!=-1) return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(is_final) container.scrollLeft = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.performAction = function(mode, api, query, call, action, result) {
|
|
||||||
if(mode == "parse" || mode == "manual") {
|
|
||||||
return function() {
|
|
||||||
call += action + ",";
|
|
||||||
displaCy(mode, api, query, call);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mode == "steps") {
|
|
||||||
return function() {
|
|
||||||
if(action == "N") call++;
|
|
||||||
else if(action == "P" && call > 0) call--;
|
|
||||||
else call = 0;
|
|
||||||
dp.setDisplay(mode, api, query, call, result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dp.element = function(tag, classname, id, attribute, content) {
|
|
||||||
var element = document.createElement(tag);
|
|
||||||
element.className = classname || "";
|
|
||||||
if(id) element.id = id;
|
|
||||||
if(attribute) element.setAttribute(attribute[0], attribute[1]);
|
|
||||||
if(content) element.appendChild(document.createTextNode(content));
|
|
||||||
return element;
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
// Page
|
|
||||||
$c-text: black
|
|
||||||
$c-bg: white
|
|
||||||
$c-medium: #a7aaa2
|
|
||||||
$c-light: lighten($c-medium, 32.5%)
|
|
||||||
$c-bad: #e80037
|
|
||||||
$c-good: #00cc3a
|
|
||||||
$c-highlight: #ffa400
|
|
||||||
$c-lowlight: $c-medium
|
|
||||||
|
|
||||||
// Sections
|
|
||||||
$c-page: #009acc
|
|
||||||
$c-blog: #f25f5c
|
|
||||||
|
|
||||||
// Social
|
|
||||||
$c-twitter: #5ea9dd
|
|
||||||
$c-reddit: #ff4500
|
|
||||||
$c-hn: #ff6600
|
|
||||||
|
|
||||||
// Prism
|
|
||||||
$prism-bg: #272822
|
|
||||||
$prism-text: #f8f8f2
|
|
||||||
$prism-punct: #999999
|
|
||||||
$prism-comment: slategray
|
|
||||||
$prism-number: #ae81ff
|
|
||||||
$prism-selector: #a6e22e
|
|
||||||
$prism-operator: #f92672
|
|
||||||
$prism-keyword: #66d9ef
|
|
||||||
$prism-regex: #e6db74
|
|
||||||
$prism-tag: #f92672
|
|
||||||
$prism-value: #fd971f
|
|
||||||
|
|
||||||
//$prism-punct: #f8f8f2
|
|
||||||
//$prism-operator: #f8f8f2
|
|
|
@ -1,101 +0,0 @@
|
||||||
// Font import
|
|
||||||
@font-face
|
|
||||||
font-family: 'Karla'
|
|
||||||
src: url('../fonts/karla-regular.eot')
|
|
||||||
src: url('../fonts/karla-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/karla-regular.woff2') format('woff2'), url('../fonts/karla-regular.woff') format('woff'), url('../fonts/karla-regular.ttf') format('truetype'), url('../fonts/karla-regular.svg#karlaregular') format('svg')
|
|
||||||
font-weight: 400
|
|
||||||
font-style: normal
|
|
||||||
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF
|
|
||||||
|
|
||||||
@font-face
|
|
||||||
font-family: 'Karla'
|
|
||||||
src: url('../fonts/karla-regular.eot')
|
|
||||||
src: url('../fonts/karla-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/karla-regular.woff2') format('woff2'), url('../fonts/karla-regular.woff') format('woff'), url('../fonts/karla-regular.ttf') format('truetype'), url('../fonts/karla-regular.svg#karlaregular') format('svg')
|
|
||||||
font-weight: 400
|
|
||||||
font-style: normal
|
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000
|
|
||||||
|
|
||||||
@font-face
|
|
||||||
font-family: 'Karla'
|
|
||||||
src: url('../fonts/karla-italic.eot')
|
|
||||||
src: url('../fonts/karla-italic.eot?#iefix') format('embedded-opentype'), url('../fonts/karla-italic.woff2') format('woff2'), url('../fonts/karla-italic.woff') format('woff'), url('../fonts/karla-italic.ttf') format('truetype'), url('../fonts/karla-italic.svg#karlaitalic') format('svg')
|
|
||||||
font-weight: 400
|
|
||||||
font-style: italic
|
|
||||||
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF
|
|
||||||
|
|
||||||
@font-face
|
|
||||||
font-family: 'Karla'
|
|
||||||
src: url('../fonts/karla-italic.eot')
|
|
||||||
src: url('../fonts/karla-italic.eot?#iefix') format('embedded-opentype'), url('../fonts/karla-italic.woff2') format('woff2'), url('../fonts/karla-italic.woff') format('woff'), url('../fonts/karla-italic.ttf') format('truetype'), url('../fonts/karla-italic.svg#karlaitalic') format('svg')
|
|
||||||
font-weight: 400
|
|
||||||
font-style: italic
|
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000
|
|
||||||
|
|
||||||
@font-face
|
|
||||||
font-family: 'Karla'
|
|
||||||
src: url('../fonts/karla-bold.eot')
|
|
||||||
src: url('../fonts/karla-bold.eot?#iefix') format('embedded-opentype'), url('../fonts/karla-bold.woff2') format('woff2'), url('../fonts/karla-bold.woff') format('woff'), url('../fonts/karla-bold.ttf') format('truetype'), url('../fonts/karla-bold.svg#karlabold') format('svg')
|
|
||||||
font-weight: 700
|
|
||||||
font-style: normal
|
|
||||||
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF
|
|
||||||
|
|
||||||
@font-face
|
|
||||||
font-family: 'Karla'
|
|
||||||
src: url('../fonts/karla-bold.eot')
|
|
||||||
src: url('../fonts/karla-bold.eot?#iefix') format('embedded-opentype'), url('../fonts/karla-bold.woff2') format('woff2'), url('../fonts/karla-bold.woff') format('woff'), url('../fonts/karla-bold.ttf') format('truetype'), url('../fonts/karla-bold.svg#karlabold') format('svg')
|
|
||||||
font-weight: 700
|
|
||||||
font-style: normal
|
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000
|
|
||||||
|
|
||||||
@font-face
|
|
||||||
font-family: 'Karla'
|
|
||||||
src: url('../fonts/karla-bolditalic.eot')
|
|
||||||
src: url('../fonts/karla-bolditalic.eot?#iefix') format('embedded-opentype'), url('../fonts/karla-bolditalic.woff2') format('woff2'), url('../fonts/karla-bolditalic.woff') format('woff'), url('../fonts/karla-bolditalic.ttf') format('truetype'), url('../fonts/karla-bolditalic.svg#karlabolditalic') format('svg')
|
|
||||||
font-weight: 700
|
|
||||||
font-style: italic
|
|
||||||
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF
|
|
||||||
|
|
||||||
@font-face
|
|
||||||
font-family: 'Karla'
|
|
||||||
src: url('../fonts/karla-bolditalic.eot')
|
|
||||||
src: url('../fonts/karla-bolditalic.eot?#iefix') format('embedded-opentype'), url('../fonts/karla-bolditalic.woff2') format('woff2'), url('../fonts/karla-bolditalic.woff') format('woff'), url('../fonts/karla-bolditalic.ttf') format('truetype'), url('../fonts/karla-bolditalic.svg#karlabolditalic') format('svg')
|
|
||||||
font-weight: 700
|
|
||||||
font-style: italic
|
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000
|
|
||||||
|
|
||||||
@font-face
|
|
||||||
font-family: 'Inconsolata'
|
|
||||||
src: url('../fonts/inconsolata-regular.eot')
|
|
||||||
src: url('../fonts/inconsolata-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/inconsolata-regular.woff2') format('woff2'), url('../fonts/inconsolata-regular.woff') format('woff'), url('../fonts/inconsolata-regular.ttf') format('truetype'), url('../fonts/inconsolata-regular.svg#inconsolataregular') format('svg')
|
|
||||||
font-weight: 400
|
|
||||||
font-style: normal
|
|
||||||
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF
|
|
||||||
|
|
||||||
@font-face
|
|
||||||
font-family: 'Inconsolata'
|
|
||||||
src: url('../fonts/inconsolata-regular.eot')
|
|
||||||
src: url('../fonts/inconsolata-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/inconsolata-regular.woff2') format('woff2'), url('../fonts/inconsolata-regular.woff') format('woff'), url('../fonts/inconsolata-regular.ttf') format('truetype'), url('../fonts/inconsolata-regular.svg#inconsolataregular') format('svg')
|
|
||||||
font-weight: 400
|
|
||||||
font-style: normal
|
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000
|
|
||||||
|
|
||||||
@font-face
|
|
||||||
font-family: 'Inconsolata'
|
|
||||||
src: url('../fonts/inconsolata-bold.eot')
|
|
||||||
src: url('../fonts/inconsolata-bold.eot?#iefix') format('embedded-opentype'), url('../fonts/inconsolata-bold.woff2') format('woff2'), url('../fonts/inconsolata-bold.woff') format('woff'), url('../fonts/inconsolata-bold.ttf') format('truetype'), url('../fonts/inconsolata-bold.svg#inconsolatabold') format('svg')
|
|
||||||
font-weight: 700
|
|
||||||
font-style: normal
|
|
||||||
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF
|
|
||||||
|
|
||||||
@font-face
|
|
||||||
font-family: 'Inconsolata'
|
|
||||||
src: url('../fonts/inconsolata-bold.eot')
|
|
||||||
src: url('../fonts/inconsolata-bold.eot?#iefix') format('embedded-opentype'), url('../fonts/inconsolata-bold.woff2') format('woff2'), url('../fonts/inconsolata-bold.woff') format('woff'), url('../fonts/inconsolata-bold.ttf') format('truetype'), url('../fonts/inconsolata-bold.svg#inconsolatabold') format('svg')
|
|
||||||
font-weight: 700
|
|
||||||
font-style: normal
|
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000
|
|
||||||
|
|
||||||
// Font families
|
|
||||||
$ff-regular: Georgia, 'Times New Roman', serif
|
|
||||||
$ff-display: 'Karla', Arial, sans-serif
|
|
||||||
$ff-code: 'Inconsolata', monospace
|
|
|
@ -1,45 +0,0 @@
|
||||||
@mixin colors($background, $foreground)
|
|
||||||
@if $background != "inherit"
|
|
||||||
background-color: #{$background}
|
|
||||||
@if $foreground != "inherit"
|
|
||||||
color: #{$foreground}
|
|
||||||
|
|
||||||
@mixin vendor($name, $argument)
|
|
||||||
-webkit-#{$name}: #{$argument}
|
|
||||||
-ms-#{$name}: #{$argument}
|
|
||||||
-moz-#{$name}: #{$argument}
|
|
||||||
-o-#{$name}: #{$argument}
|
|
||||||
#{$name}: #{$argument}
|
|
||||||
|
|
||||||
@mixin position($type, $position, $direction, $positionval, $directionval)
|
|
||||||
position: #{$type}
|
|
||||||
#{$position}: #{$positionval}
|
|
||||||
#{$direction}: #{$directionval}
|
|
||||||
|
|
||||||
@mixin spacing($margin, $padding)
|
|
||||||
@if $margin != "inherit"
|
|
||||||
margin: #{$margin}
|
|
||||||
@if $padding != "inherit"
|
|
||||||
padding: #{$padding}
|
|
||||||
|
|
||||||
@mixin font-size($font-size, $line-height)
|
|
||||||
@if $font-size != "inherit"
|
|
||||||
font-size: #{$font-size}
|
|
||||||
|
|
||||||
@if $line-height != "inherit"
|
|
||||||
line-height: #{$line-height}
|
|
||||||
|
|
||||||
@mixin size($width, $height: $width)
|
|
||||||
@if $width != "auto"
|
|
||||||
width: $width
|
|
||||||
|
|
||||||
@if $height != "auto"
|
|
||||||
height: $height
|
|
||||||
|
|
||||||
@mixin font($font, $text-transform, $text-align)
|
|
||||||
font: $font
|
|
||||||
|
|
||||||
@if $text-align != "inherit"
|
|
||||||
text-align: $text-align
|
|
||||||
@if $text-transform != "inherit"
|
|
||||||
text-transform: $text-transform
|
|
|
@ -1,94 +0,0 @@
|
||||||
code,
|
|
||||||
pre
|
|
||||||
@include font(bold 1rem/1.5em $ff-code, inherit, inherit)
|
|
||||||
@include vendor(tab-size, 4)
|
|
||||||
@include vendor(hyphens, none)
|
|
||||||
direction: ltr
|
|
||||||
white-space: pre
|
|
||||||
border: none
|
|
||||||
word:
|
|
||||||
spacing: normal
|
|
||||||
break: normal
|
|
||||||
|
|
||||||
pre
|
|
||||||
@include spacing(0 0 2em 0, 2em)
|
|
||||||
@include colors($prism-bg, $prism-text)
|
|
||||||
overflow: auto
|
|
||||||
text-shadow: 0 1px rgba(0, 0, 0, 0.3)
|
|
||||||
|
|
||||||
*:not(pre)
|
|
||||||
> code
|
|
||||||
@include spacing(0 .25em, 0 .5em)
|
|
||||||
display: inline-block
|
|
||||||
border-radius: .2em
|
|
||||||
|
|
||||||
&[class*="language-"]
|
|
||||||
@include colors($prism-bg, $prism-text)
|
|
||||||
|
|
||||||
&:not([class*="language-"])
|
|
||||||
border: 1px solid lighten($c-medium, 10%)
|
|
||||||
|
|
||||||
.declaration code
|
|
||||||
background: transparent
|
|
||||||
border: none !important
|
|
||||||
|
|
||||||
.token.comment,
|
|
||||||
.token.prolog,
|
|
||||||
.token.doctype,
|
|
||||||
.token.cdata
|
|
||||||
color: $prism-comment
|
|
||||||
|
|
||||||
.token.punctuation
|
|
||||||
color: $prism-punct
|
|
||||||
|
|
||||||
.namespace
|
|
||||||
opacity: .7
|
|
||||||
|
|
||||||
.token.property,
|
|
||||||
.token.tag,
|
|
||||||
.token.constant,
|
|
||||||
.token.symbol,
|
|
||||||
.token.deleted
|
|
||||||
color: $prism-tag
|
|
||||||
|
|
||||||
.token.boolean,
|
|
||||||
.token.number
|
|
||||||
color: $prism-number
|
|
||||||
|
|
||||||
.token.selector,
|
|
||||||
.token.attr-name,
|
|
||||||
.token.string,
|
|
||||||
.token.char,
|
|
||||||
.token.builtin,
|
|
||||||
.token.inserted
|
|
||||||
color: $prism-selector
|
|
||||||
|
|
||||||
.token.operator,
|
|
||||||
.token.entity,
|
|
||||||
.token.url,
|
|
||||||
.language-css .token.string,
|
|
||||||
.style .token.string,
|
|
||||||
.token.variable
|
|
||||||
color: $prism-operator
|
|
||||||
|
|
||||||
.token.atrule,
|
|
||||||
.token.attr-value,
|
|
||||||
.token.function
|
|
||||||
color: $prism-value
|
|
||||||
|
|
||||||
.token.keyword
|
|
||||||
color: $prism-keyword
|
|
||||||
|
|
||||||
.token.regex,
|
|
||||||
.token.important
|
|
||||||
color: $prism-regex
|
|
||||||
|
|
||||||
.token.important,
|
|
||||||
.token.bold
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
.token.italic
|
|
||||||
font-style: italic
|
|
||||||
|
|
||||||
.token.entity
|
|
||||||
cursor: help
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user