first commit

This commit is contained in:
Ayxan
2022-05-23 00:16:32 +04:00
commit d660f2a4ca
24786 changed files with 4428337 additions and 0 deletions

View File

@ -0,0 +1,9 @@
from ._version import __version__ # noqa
from .style import JupyterStyle # noqa
def _jupyter_labextension_paths():
return [{
"src": "labextension",
"dest": "jupyterlab_pygments"
}]

View File

@ -0,0 +1,6 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
version_info = (0, 2, 2)
__version__ = '.'.join(map(str, version_info))

View File

@ -0,0 +1,104 @@
{
"name": "jupyterlab_pygments",
"version": "0.2.2",
"description": "Pygments theme using JupyterLab CSS variables",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://github.com/jupyterlab/jupyterlab_pygments",
"bugs": {
"url": "https://github.com/jupyterlab/jupyterlab_pygments/issues"
},
"license": "BSD-3-Clause",
"author": {
"name": "Jupyter Development Team",
"email": "jupyter@googlegroups.com"
},
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"repository": {
"type": "git",
"url": "https://github.com/jupyterlab/jupyterlab_pygments.git"
},
"scripts": {
"build": "jlpm build:css && jlpm build:lib && jlpm build:labextension:dev",
"build:prod": "jlpm clean && jlpm build:css && jlpm build:lib && jlpm build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc",
"build:css": "python generate_css.py",
"clean": "jlpm clean:lib",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo style/base.css",
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf jupyterlab_pygments/labextension",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
"lint": "jlpm stylelint && jlpm prettier && jlpm eslint",
"lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check",
"prettier": "jlpm prettier:base --write --list-different",
"prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "jlpm prettier:base --check",
"stylelint": "jlpm stylelint:check --fix",
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
"watch": "run-p watch:src watch:labextension",
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyterlab/application": "^3.1.0"
},
"devDependencies": {
"@jupyterlab/builder": "^3.1.0",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"eslint": "^7.14.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"rimraf": "^3.0.2",
"stylelint": "^14.3.0",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-recommended": "^6.0.0",
"stylelint-config-standard": "~24.0.0",
"stylelint-prettier": "^2.0.0",
"typescript": "~4.1.3"
},
"sideEffects": [
"style/*.css",
"style/index.js"
],
"styleModule": "style/index.js",
"publishConfig": {
"access": "public"
},
"jupyterlab": {
"extension": true,
"outputDir": "jupyterlab_pygments/labextension",
"_build": {
"load": "static/remoteEntry.aa1060b2d1221f8e5688.js",
"extension": "./extension",
"style": "./style"
}
},
"jupyter-releaser": {
"hooks": {
"before-build-npm": [
"python -m pip install jupyterlab~=3.1",
"jlpm"
],
"before-build-python": [
"jlpm clean:all"
]
}
}
}

View File

@ -0,0 +1 @@
"use strict";(self.webpackChunkjupyterlab_pygments=self.webpackChunkjupyterlab_pygments||[]).push([[568],{568:(t,e,a)=>{a.r(e),a.d(e,{default:()=>p});const p={id:"jupyterlab_pygments:plugin",autoStart:!0,activate:t=>{}}}}]);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
var _JUPYTERLAB;(()=>{"use strict";var e,r,t={741:(e,r,t)=>{var n={"./index":()=>t.e(568).then((()=>()=>t(568))),"./extension":()=>t.e(568).then((()=>()=>t(568))),"./style":()=>t.e(747).then((()=>()=>t(747)))},o=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then((()=>{throw new Error('Module "'+e+'" does not exist in container.')})),t.R=void 0,r),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={id:e,exports:{}};return t[e](a,a.exports,o),a.exports}o.m=t,o.c=n,o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((r,t)=>(o.f[t](e,r),r)),[])),o.u=e=>e+"."+{568:"1e2faa2ba0bbe59c4780",747:"8eb3ddccc7ec4987bff9"}[e]+".js?v="+{568:"1e2faa2ba0bbe59c4780",747:"8eb3ddccc7ec4987bff9"}[e],o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="jupyterlab_pygments:",o.l=(t,n,a,i)=>{if(e[t])e[t].push(n);else{var l,u;if(void 0!==a)for(var d=document.getElementsByTagName("script"),s=0;s<d.length;s++){var c=d[s];if(c.getAttribute("src")==t||c.getAttribute("data-webpack")==r+a){l=c;break}}l||(u=!0,(l=document.createElement("script")).charset="utf-8",l.timeout=120,o.nc&&l.setAttribute("nonce",o.nc),l.setAttribute("data-webpack",r+a),l.src=t),e[t]=[n];var p=(r,n)=>{l.onerror=l.onload=null,clearTimeout(f);var o=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),o&&o.forEach((e=>e(n))),r)return r(n)},f=setTimeout(p.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=p.bind(null,l.onerror),l.onload=p.bind(null,l.onload),u&&document.head.appendChild(l)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{o.S={};var e={},r={};o.I=(t,n)=>{n||(n=[]);var a=r[t];if(a||(a=r[t]={}),!(n.indexOf(a)>=0)){if(n.push(a),e[t])return e[t];o.o(o.S,t)||(o.S[t]={});var i=o.S[t],l="jupyterlab_pygments",u=[];return"default"===t&&((e,r,t,n)=>{var a=i[e]=i[e]||{},u=a[r];(!u||!u.loaded&&(1!=!u.eager?n:l>u.from))&&(a[r]={get:()=>o.e(568).then((()=>()=>o(568))),from:l,eager:!1})})("jupyterlab_pygments","0.2.2"),e[t]=u.length?Promise.all(u).then((()=>e[t]=1)):1}}})(),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var r=o.g.document;if(!e&&r&&(r.currentScript&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");t.length&&(e=t[t.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={761:0};o.f.j=(r,t)=>{var n=o.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var a=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=a);var i=o.p+o.u(r),l=new Error;o.l(i,(t=>{if(o.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;l.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",l.name="ChunkLoadError",l.type=a,l.request=i,n[1](l)}}),"chunk-"+r,r)}};var r=(r,t)=>{var n,a,[i,l,u]=t,d=0;if(i.some((r=>0!==e[r]))){for(n in l)o.o(l,n)&&(o.m[n]=l[n]);u&&u(o)}for(r&&r(t);d<i.length;d++)a=i[d],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0},t=self.webpackChunkjupyterlab_pygments=self.webpackChunkjupyterlab_pygments||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var a=o(741);(_JUPYTERLAB=void 0===_JUPYTERLAB?{}:_JUPYTERLAB).jupyterlab_pygments=a})();

View File

@ -0,0 +1,4 @@
/* This is a generated file of CSS imports */
/* It was generated by @jupyterlab/builder in Build.ensureAssets() */
import 'jupyterlab_pygments/style/index.js';

View File

@ -0,0 +1,16 @@
{
"packages": [
{
"name": "css-loader",
"versionInfo": "5.2.7",
"licenseId": "MIT",
"extractedText": "Copyright JS Foundation and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
},
{
"name": "style-loader",
"versionInfo": "2.0.0",
"licenseId": "MIT",
"extractedText": "Copyright JS Foundation and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
}
]
}

View File

@ -0,0 +1,133 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from pygments.style import Style
from pygments.token import (
Comment, Error, Generic, Keyword, Literal, Name, Number, Operator, Other,
Punctuation, String, Text, Whitespace)
class JupyterStyle(Style):
"""
A pygments style using JupyterLab CSS variables.
The goal is to mimick JupyterLab's codemirror theme.
Known impossibilities:
- With pygments, the dot in `foo.bar` is considered an Operator (class: 'o'),
while in codemirror, it is bare text.
- With pygments, in both `from foo import bar`, and `foo.bar`, "bar" is
considered a Name (class: 'n'), while in coremirror, the latter is a property.
Available CSS variables are
--jp-mirror-editor-keyword-color
--jp-mirror-editor-atom-color
--jp-mirror-editor-number-color
--jp-mirror-editor-def-color
--jp-mirror-editor-variable-color
--jp-mirror-editor-variable-2-color
--jp-mirror-editor-variable-3-color
--jp-mirror-editor-punctuation-color
--jp-mirror-editor-property-color
--jp-mirror-editor-operator-color
--jp-mirror-editor-comment-color
--jp-mirror-editor-string-color
--jp-mirror-editor-string-2-color
--jp-mirror-editor-meta-color
--jp-mirror-editor-qualifier-color
--jp-mirror-editor-builtin-color
--jp-mirror-editor-bracket-color
--jp-mirror-editor-tag-color
--jp-mirror-editor-attribute-color
--jp-mirror-editor-header-color
--jp-mirror-editor-quote-color
--jp-mirror-editor-link-color
--jp-mirror-editor-error-color
"""
default_style = ''
background_color = 'var(--jp-cell-editor-background)'
highlight_color = 'var(--jp-cell-editor-active-background)'
styles = {
Text: 'var(--jp-mirror-editor-variable-color)', # no class
Whitespace: '', # class: 'w'
Error: 'var(--jp-mirror-editor-error-color)', # class: 'err'
Other: '', # class: 'x'
Comment: 'italic var(--jp-mirror-editor-comment-color)', # class: 'c'
#Comment.Multiline: '', # class: 'cm'
#Comment.Preproc: '', # class: 'cp'
#Comment.Single: '', # class: 'c1'
#Comment.Special: '', # class: 'cs'
Keyword: 'bold var(--jp-mirror-editor-keyword-color)', # class: 'k'
#Keyword.Constant: '', # class: 'kc'
#Keyword.Declaration: '', # class: 'kd'
#Keyword.Namespace: '', # class: 'kn'
#Keyword.Pseudo: '', # class: 'kp'
#Keyword.Reserved: '', # class: 'kr'
#Keyword.Type: '', # class: 'kt'
Operator: 'bold var(--jp-mirror-editor-operator-color)', # class: 'o'
Operator.Word: '', # class: 'ow'
Literal: '', # class: 'l'
Literal.Date: '', # class: 'ld'
String: 'var(--jp-mirror-editor-string-color)',
#String.Backtick: '', # class: 'sb'
#String.Char: '', # class: 'sc'
#String.Doc: '', # class: 'sd'
#String.Double: '', # class: 's2'
#String.Escape: '', # class: 'se'
#String.Heredoc: '', # class: 'sh'
#String.Interpol: '', # class: 'si'
#String.Other: '', # class: 'sx'
#String.Regex: '', # class: 'sr'
#String.Single: '', # class: 's1'
#String.Symbol: '', # class: 'ss'
Number: 'var(--jp-mirror-editor-number-color)', # class: 'm'
#Number.Float: '', # class: 'mf'
#Number.Hex: '', # class: 'mh'
#Number.Integer: '', # class: 'mi'
#Number.Integer.Long: '', # class: 'il'
#Number.Oct: '', # class: 'mo'
Name: '', # class: 'n'
#Name.Attribute: '', # class: 'na'
#Name.Builtin: '', # class: 'nb'
#Name.Builtin.Pseudo: '', # class: 'bp'
#Name.Class: '', # class: 'nc'
#Name.Constant: '', # class: 'no'
#Name.Decorator: '', # class: 'nd'
#Name.Entity: '', # class: 'ni'
#Name.Exception: '', # class: 'ne'
#Name.Function: '', # class: 'nf'
#Name.Property: '', # class 'py'
#Name.Label: '', # class: 'nl'
#Name.Namespace: '', # class: 'nn'
#Name.Other: '', # class: 'nx'
#Name.Tag: '', # class: 'nt'
#Name.Variable: '', # class: 'nv'
#Name.Variable.Class: '', # class: 'vc'
#Name.Variable.Global: '', # class: 'vg'
#Name.Variable.Instance: '', # class: 'vi'
Generic: '', # class: 'g'
#Generic.Deleted: '', # class: 'gd',
#Generic.Emph: 'italic', # class: 'ge'
#Generic.Error: '', # class: 'gr'
#Generic.Heading: '', # class: 'gh'
#Generic.Inserted: '', # class: 'gi'
#Generic.Output: '', # class: 'go'
#Generic.Prompt: '', # class: 'gp'
#Generic.Strong: '', # class: 'gs'
#Generic.Subheading: '', # class: 'gu'
#Generic.Traceback: '', # class: 'gt'
Punctuation: 'var(--jp-mirror-editor-punctuation-color)' # class: 'p'
}