First Commit
This commit is contained in:
1
html/sternwarte/checkfuehrung/node_modules/cardinal/.npmignore
generated
vendored
Executable file
1
html/sternwarte/checkfuehrung/node_modules/cardinal/.npmignore
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
assets
|
||||
6
html/sternwarte/checkfuehrung/node_modules/cardinal/.travis.yml
generated
vendored
Executable file
6
html/sternwarte/checkfuehrung/node_modules/cardinal/.travis.yml
generated
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- "6"
|
||||
- "8"
|
||||
- "10"
|
||||
23
html/sternwarte/checkfuehrung/node_modules/cardinal/LICENSE
generated
vendored
Executable file
23
html/sternwarte/checkfuehrung/node_modules/cardinal/LICENSE
generated
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
Copyright 2012 Thorsten Lorenz.
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
131
html/sternwarte/checkfuehrung/node_modules/cardinal/README.md
generated
vendored
Executable file
131
html/sternwarte/checkfuehrung/node_modules/cardinal/README.md
generated
vendored
Executable file
@@ -0,0 +1,131 @@
|
||||
# cardinal [](http://travis-ci.org/thlorenz/cardinal)
|
||||
|
||||
<a href="https://www.patreon.com/bePatron?u=8663953"><img alt="become a patron" src="https://c5.patreon.com/external/logo/become_a_patron_button.png" height="35px"></a>
|
||||
|
||||
[](https://nodei.co/npm/cardinal/)
|
||||
|
||||
**car·di·nal** *(kärdn-l, kärdnl)* - crested thick-billed North American finch having bright red plumage in the male.
|
||||
|
||||

|
||||
|
||||
## Features
|
||||
|
||||
- highlights JavaScript code with ANSI colors to improve terminal output
|
||||
- theming support, see [custom color themes](https://github.com/thlorenz/cardinal/tree/master/themes)
|
||||
- optionally print line numbers
|
||||
- API and command line interface (`cdl`)
|
||||
- `.cardinalrc` config to customize settings
|
||||
- supports UNIX pipes
|
||||
|
||||
***
|
||||
|
||||
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
|
||||
|
||||
- [Installation](#installation)
|
||||
- [As library](#as-library)
|
||||
- [As Commandline Tool](#as-commandline-tool)
|
||||
- [Commandline](#commandline)
|
||||
- [Highlight a file](#highlight-a-file)
|
||||
- [As part of a UNIX pipe](#as-part-of-a-unix-pipe)
|
||||
- [Theme](#theme)
|
||||
- [API](#api)
|
||||
- [*highlight(code[, opts])*](#highlightcode-opts)
|
||||
- [*highlightFileSync(fullPath[, opts])*](#highlightfilesyncfullpath-opts)
|
||||
- [*highlightFile(fullPath[, opts], callback)*](#highlightfilefullpath-opts-callback)
|
||||
- [opts](#opts)
|
||||
- [Examples ([*browse*](https://github.com/thlorenz/cardinal/tree/master/examples))](#examples-[browse]https://githubcom/thlorenz/cardinal/tree/master/examples)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
### As library
|
||||
|
||||
npm install cardinal
|
||||
|
||||
### As Commandline Tool
|
||||
|
||||
[sudo] npm install -g cardinal
|
||||
|
||||
**Note:**
|
||||
|
||||
When installed globally, cardinal exposes itself as the `cdl` command.
|
||||
|
||||
## Commandline
|
||||
|
||||
### Highlight a file
|
||||
|
||||
cdl <file.js> [options]
|
||||
|
||||
**options**:
|
||||
- `--nonum`: turns off line number printing (relevant if it is turned on inside `~/.cardinalrc`
|
||||
|
||||
### As part of a UNIX pipe
|
||||
|
||||
cat file.js | grep console | cdl
|
||||
|
||||
**Note:**
|
||||
|
||||
Not all code lines may be parsable JavaScript. In these cases the line is printed to the terminal without
|
||||
highlighting it.
|
||||
|
||||
### Theme
|
||||
|
||||
The default theme will be used for highlighting.
|
||||
|
||||
To use a different theme, include a `.cardinalrc` file in your `HOME` directory.
|
||||
|
||||
This is a JSON file of the following form:
|
||||
|
||||
```json
|
||||
{
|
||||
"theme": "hide-semicolons",
|
||||
"linenos": true|false
|
||||
}
|
||||
```
|
||||
|
||||
- `theme` can be the name of any of the [built-in themes](https://github.com/thlorenz/cardinal/tree/master/themes) or the
|
||||
full path to a custom theme anywhere on your computer.
|
||||
- linenos toggles line number printing
|
||||
|
||||
## API
|
||||
|
||||
### *highlight(code[, opts])*
|
||||
|
||||
- returns the highlighted version of the passed code ({String}) or throws an error if it was not able to parse it
|
||||
- opts (see below)
|
||||
|
||||
### *highlightFileSync(fullPath[, opts])*
|
||||
|
||||
- returns the highlighted version of the file whose fullPath ({String}) was passed or throws an error if it was not able
|
||||
to parse it
|
||||
- opts (see below)
|
||||
|
||||
### *highlightFile(fullPath[, opts], callback)*
|
||||
|
||||
- calls back with the highlighted version of the file whose fullPath ({String}) was passed or with an error if it was not able
|
||||
to parse it
|
||||
- opts (see below)
|
||||
- `callback` ({Function}) has the following signature: `function (err, highlighted) { .. }`
|
||||
|
||||
### opts
|
||||
|
||||
opts is an {Object} with the following properties:
|
||||
|
||||
- `theme` {Object} is used to optionally override the theme used to highlight
|
||||
- `linenos` {Boolean} if `true` line numbers are included in the highlighted code
|
||||
- `firstline` {Integer} sets line number of the first line when line numbers are printed
|
||||
- `jsx` {Boolean} if `true` _JSX_ syntax is supported, otherwise cardinal will raise an error
|
||||
when encountering _JSX_ (default: `false`)
|
||||
|
||||
**Note** The `json` option is obsoleted and not necessary anymore as cardinal properly understands both JSON and JavaScript.
|
||||
|
||||
## Examples ([*browse*](https://github.com/thlorenz/cardinal/tree/master/examples))
|
||||
|
||||
- [sample .cardinalrc](https://github.com/thlorenz/cardinal/blob/master/examples/.cardinalrc)
|
||||
- [highlighting a code snippet](https://github.com/thlorenz/cardinal/blob/master/examples/highlight-string.js) via
|
||||
***highlight()***
|
||||
- [file that highlights itself](https://github.com/thlorenz/cardinal/blob/master/examples/highlight-self.js) via
|
||||
***highlightFile()*** including line numbers
|
||||
- [file that highlights itself hiding all
|
||||
semicolons](https://github.com/thlorenz/cardinal/blob/master/examples/highlight-self-hide-semicolons.js) via
|
||||
***highlightFileSync()***
|
||||
78
html/sternwarte/checkfuehrung/node_modules/cardinal/bin/cdl.js
generated
vendored
Executable file
78
html/sternwarte/checkfuehrung/node_modules/cardinal/bin/cdl.js
generated
vendored
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env node
|
||||
var cardinal = require('..')
|
||||
var path = require('path')
|
||||
var settings = require('../settings')
|
||||
var args = process.argv
|
||||
var theme = settings.resolveTheme()
|
||||
var opts = settings.getSettings()
|
||||
var highlighted
|
||||
|
||||
opts = opts || {}
|
||||
opts.theme = theme
|
||||
// jsx is only turned on when highlighting non-json files
|
||||
opts.jsx = false
|
||||
|
||||
function usage() {
|
||||
var msg = [
|
||||
'Usage: cdl <filename.js> [options]'
|
||||
, ''
|
||||
, 'Options (~/.cardinalrc overrides):'
|
||||
, ' --nonum: turn off line printing'
|
||||
, ''
|
||||
, 'Unix Pipe Example: cat filename.js | grep console | cdl'
|
||||
, ''
|
||||
].join('\n')
|
||||
console.log(msg)
|
||||
}
|
||||
|
||||
function highlightFile() {
|
||||
try {
|
||||
// Enabling jsx for JSON breaks most likelely due to esprima AST generation
|
||||
// not working for JSON
|
||||
opts.jsx = path.extname(args[2]) !== '.json'
|
||||
highlighted = cardinal.highlightFileSync(args[2], opts)
|
||||
console.log(highlighted)
|
||||
} catch (e) {
|
||||
console.trace()
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
(function runner() {
|
||||
// E.g., "cardinal myfile.js"
|
||||
if (args.length === 3) return highlightFile()
|
||||
|
||||
var opt = args[3]
|
||||
|
||||
// E.g., "cardinal myfile.js --nonum"
|
||||
if (opt && opt.indexOf('--') === 0) {
|
||||
if ((/^--(nonum|noline)/i).test(opt)) opts.linenos = false
|
||||
else {
|
||||
usage()
|
||||
return console.error('Unknown option: ', opt)
|
||||
}
|
||||
|
||||
return highlightFile()
|
||||
}
|
||||
|
||||
// UNIX pipes e.g., "cat myfile.js | grep console | cardinal
|
||||
var stdin = process.stdin
|
||||
var stdout = process.stdout
|
||||
|
||||
// line numbers don't make sense when we are printing line by line
|
||||
opts.linenos = false
|
||||
|
||||
stdin.setEncoding('utf-8')
|
||||
stdin.resume()
|
||||
stdin
|
||||
.on('data', function(chunk) {
|
||||
chunk.split('\n').forEach(function(line) {
|
||||
try {
|
||||
stdout.write(cardinal.highlight(line, opts) + '\n')
|
||||
} catch (e) {
|
||||
// line doesn't represent a valid js snippet and therefore cannot be parsed -> just print as is
|
||||
stdout.write(line + '\n')
|
||||
}
|
||||
})
|
||||
})
|
||||
})()
|
||||
7
html/sternwarte/checkfuehrung/node_modules/cardinal/cardinal.js
generated
vendored
Executable file
7
html/sternwarte/checkfuehrung/node_modules/cardinal/cardinal.js
generated
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
highlight: require('./lib/highlight')
|
||||
, highlightFile: require('./lib/highlightFile')
|
||||
, highlightFileSync: require('./lib/highlightFileSync')
|
||||
}
|
||||
3
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/.cardinalrc
generated
vendored
Executable file
3
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/.cardinalrc
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"theme": "hide-semicolons"
|
||||
}
|
||||
7
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/README.md
generated
vendored
Executable file
7
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/README.md
generated
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
# Cardinal Examples
|
||||
|
||||
You can run the examples individually or as a demo:
|
||||
|
||||
- install cardinal: `npm install cardinal`
|
||||
- explore cardinal: `npm explore cardinal`
|
||||
- run the demo: `npm run demo`
|
||||
78
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/git-diff.txt
generated
vendored
Executable file
78
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/git-diff.txt
generated
vendored
Executable file
@@ -0,0 +1,78 @@
|
||||
diff --git a/test/settings.js b/test/settings.js
|
||||
index 7b28d66..642688f 100644
|
||||
--- a/test/settings.js
|
||||
+++ b/test/settings.js
|
||||
@@ -1,14 +1,20 @@
|
||||
'use strict';
|
||||
/*jshint asi: true*/
|
||||
|
||||
-var test = require('tap').test
|
||||
- , path = require('path')
|
||||
- , fs = require('fs')
|
||||
- , settings = require('../settings')
|
||||
- , existsSync = fs.existsSync || path.existsSync
|
||||
+var test = require('tap').test
|
||||
+ , path = require('path')
|
||||
+ , fs = require('fs')
|
||||
, hideSemicolonsTheme = require('../themes/hide-semicolons')
|
||||
, home = path.join(__dirname, 'fixtures', 'home')
|
||||
, rcpath = path.join(home, '.cardinalrc')
|
||||
+ , existsSync = fs.existsSync || path.existsSync
|
||||
+ , settingsResolve = require.resolve('../settings')
|
||||
+ , settings
|
||||
+
|
||||
+function setup () {
|
||||
+ delete require.cache[settingsResolve]
|
||||
+ settings = require(settingsResolve)
|
||||
+}
|
||||
|
||||
function writerc(config) {
|
||||
fs.writeFileSync(rcpath, JSON.stringify(config), 'utf-8')
|
||||
@@ -25,22 +31,47 @@ function resolveTheme (config) {
|
||||
return result;
|
||||
}
|
||||
|
||||
+function getSettings (config) {
|
||||
+ writerc(config)
|
||||
+ var result = settings.getSettings(home)
|
||||
+ removerc()
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
if (!existsSync(home)) fs.mkdirSync(home);
|
||||
|
||||
test('no .cardinalrc in home', function (t) {
|
||||
+ setup()
|
||||
var theme = settings.resolveTheme(home)
|
||||
t.equals(theme, undefined, 'resolves no theme')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('.cardinalrc with theme "hide-semicolons" in home', function (t) {
|
||||
+ setup()
|
||||
var theme = resolveTheme({ theme: "hide-semicolons" })
|
||||
t.deepEquals(theme, hideSemicolonsTheme, 'resolves hide-semicolons theme')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('.cardinalrc with full path to "hide-semicolons.js" in home', function (t) {
|
||||
+ setup()
|
||||
var theme = resolveTheme({ theme: path.join(__dirname, '..', 'themes', 'hide-semicolons.js') })
|
||||
t.deepEquals(theme, hideSemicolonsTheme, 'resolves hide-semicolons theme')
|
||||
t.end()
|
||||
})
|
||||
+
|
||||
+test('.cardinalrc with linenos: true', function (t) {
|
||||
+ setup()
|
||||
+ var opts = { linenos: true }
|
||||
+ t.deepEquals(getSettings(opts), opts)
|
||||
+ t.end()
|
||||
+})
|
||||
+
|
||||
+test('.cardinalrc with linenos: true and theme', function (t) {
|
||||
+ setup()
|
||||
+ var opts = { linenos: true, theme: 'some theme' }
|
||||
+ t.deepEquals(getSettings(opts), opts)
|
||||
+ t.end()
|
||||
+})
|
||||
+
|
||||
90
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/highlight-diff.js
generated
vendored
Executable file
90
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/highlight-diff.js
generated
vendored
Executable file
@@ -0,0 +1,90 @@
|
||||
'use strict'
|
||||
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var highlighter = require('..')
|
||||
var colors = require('ansicolors')
|
||||
var diffFile = path.join(__dirname, 'git-diff.txt')
|
||||
var diff = fs.readFileSync(diffFile, 'utf-8')
|
||||
|
||||
// @@ is not a valid js token, so when we see it, we can be sure that we are dealing with a git or svn diff
|
||||
var diffRegex = /^@@[^@]+@@$/m
|
||||
var diffIndRegex = /^(@@[^@]+@@)(.*)$/
|
||||
var addRemRegex = /^[+-]/
|
||||
var lines = diff.split('\n')
|
||||
|
||||
function isDiff(lines) {
|
||||
return !!lines
|
||||
.filter(function(line) {
|
||||
return diffRegex.test(line)
|
||||
})
|
||||
.length
|
||||
}
|
||||
|
||||
diff = isDiff(lines)
|
||||
|
||||
function tryHighlight(code) {
|
||||
// TODO: need to remove symbols added to get valid code
|
||||
// this should be done by getting the splits instead of the actual code from the highlighter
|
||||
// now we can remove first / last one after highlighting completed
|
||||
function tryAppending(appended, tryNext) {
|
||||
try {
|
||||
return highlighter.highlight(code + appended)
|
||||
} catch (e) {
|
||||
return tryNext(code)
|
||||
}
|
||||
}
|
||||
|
||||
function tryRemoveLeadingComma(tryNext) {
|
||||
var success
|
||||
try {
|
||||
success = highlighter.highlight(code.replace(/^( +),(.+)$/, '$1 $2'))
|
||||
return success
|
||||
} catch (e) {
|
||||
return tryNext(code)
|
||||
}
|
||||
}
|
||||
|
||||
function tryPlain() {
|
||||
try {
|
||||
return highlighter.highlight(code)
|
||||
} catch (e) {
|
||||
return tryCloseMustache()
|
||||
}
|
||||
}
|
||||
|
||||
function tryCloseMustache() { return tryAppending('}', tryCloseParen) }
|
||||
|
||||
function tryCloseParen() { return tryAppending('\\)', tryCloseMustacheParen) }
|
||||
|
||||
function tryCloseMustacheParen() { return tryAppending('})', tryRemovingCommas) }
|
||||
|
||||
function tryRemovingCommas() { return tryRemoveLeadingComma(giveUp) }
|
||||
|
||||
function giveUp() { return code }
|
||||
|
||||
return tryPlain()
|
||||
}
|
||||
|
||||
function highlightDiffInd(line, matches) {
|
||||
var highlighted = colors.brightBlue(matches[1])
|
||||
var code = matches[2]
|
||||
return code ? highlighted + tryHighlight(code) : highlighted
|
||||
}
|
||||
|
||||
function colorsAddRemove(c) {
|
||||
return addRemRegex.test(c) ? colors.yellow(c) : c
|
||||
}
|
||||
|
||||
function highlightDiff(line) {
|
||||
var diffIndMatches = diffIndRegex.exec(line)
|
||||
|
||||
return diffIndMatches
|
||||
? highlightDiffInd(line, diffIndMatches)
|
||||
: colorsAddRemove(line[0]) + tryHighlight(line.slice(1))
|
||||
}
|
||||
|
||||
var highlightFn = diff ? highlightDiff : tryHighlight
|
||||
var highlightedLines = lines.map(highlightFn)
|
||||
|
||||
console.log(highlightedLines.join('\n'))
|
||||
11
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/highlight-json.js
generated
vendored
Executable file
11
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/highlight-json.js
generated
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
// This file will highlight the passed code using the custom theme when run via: "node highlight-json"
|
||||
'use strict'
|
||||
|
||||
var cardinal = require('..')
|
||||
|
||||
var json = JSON.stringify({
|
||||
foo: 'bar',
|
||||
baz: 'quux'
|
||||
})
|
||||
|
||||
console.log(cardinal.highlight(json))
|
||||
22
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/highlight-self-hide-semicolons.js
generated
vendored
Executable file
22
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/highlight-self-hide-semicolons.js
generated
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* This file will highlight itself using a custom theme when run via: "node highlight-self-hide-semicolons"
|
||||
* The custom theme highlights semicolons as 'black', thus hiding them.
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
var cardinal = require('..')
|
||||
var hideSemicolonsTheme = require('../themes/hide-semicolons')
|
||||
|
||||
function highlight() {
|
||||
// Using the synchronous highlightFileSync()
|
||||
// For asynchronous highlighting use: highlightFile() - see highlight-self.js
|
||||
|
||||
try {
|
||||
var highlighted = cardinal.highlightFileSync(__filename, {theme: hideSemicolonsTheme})
|
||||
console.log(highlighted)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
highlight()
|
||||
16
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/highlight-self.js
generated
vendored
Executable file
16
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/highlight-self.js
generated
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
// This file will highlight itself using the default theme when run via: "node highlight-self"
|
||||
'use strict'
|
||||
|
||||
var cardinal = require('..')
|
||||
|
||||
function highlight() {
|
||||
// Using the asynchronous highlightFile()
|
||||
// For synchronous highlighting use: highlightFileSync() - see highlight-self-hide-semicolons.js
|
||||
|
||||
cardinal.highlightFile(__filename, { linenos: true }, function(err, res) {
|
||||
if (err) return console.error(err)
|
||||
console.log(res)
|
||||
})
|
||||
}
|
||||
|
||||
highlight()
|
||||
15
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/highlight-string.js
generated
vendored
Executable file
15
html/sternwarte/checkfuehrung/node_modules/cardinal/examples/highlight-string.js
generated
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
// This file will highlight the passed code using the custom theme when run via: "node highlight-string"
|
||||
'use strict'
|
||||
|
||||
var cardinal = require('..')
|
||||
|
||||
var code = '' +
|
||||
|
||||
function add(a, b) {
|
||||
var sum = a + b
|
||||
return sum
|
||||
} +
|
||||
|
||||
''
|
||||
|
||||
console.log(cardinal.highlight(code))
|
||||
75
html/sternwarte/checkfuehrung/node_modules/cardinal/lib/highlight.js
generated
vendored
Executable file
75
html/sternwarte/checkfuehrung/node_modules/cardinal/lib/highlight.js
generated
vendored
Executable file
@@ -0,0 +1,75 @@
|
||||
'use strict'
|
||||
|
||||
var redeyed = require('redeyed')
|
||||
var theme = require('../themes/default')
|
||||
var colors = require('ansicolors')
|
||||
|
||||
var colorSurround = colors.brightBlack
|
||||
var surroundClose = '\u001b[39m'
|
||||
|
||||
function trimEmptyLines(lines) {
|
||||
// remove lines from the end until we find a non-empy one
|
||||
var line = lines.pop()
|
||||
while (!line || !line.length) {
|
||||
line = lines.pop()
|
||||
}
|
||||
|
||||
// put the non-empty line back
|
||||
if (line) lines.push(line)
|
||||
}
|
||||
|
||||
function addLinenos(highlightedCode, firstline) {
|
||||
var highlightedLines = highlightedCode.split('\n')
|
||||
|
||||
trimEmptyLines(highlightedLines)
|
||||
|
||||
var linesLen = highlightedLines.length
|
||||
var lines = []
|
||||
var totalDigits
|
||||
var lineno
|
||||
|
||||
function getDigits(n) {
|
||||
if (n < 10) return 1
|
||||
if (n < 100) return 2
|
||||
if (n < 1000) return 3
|
||||
if (n < 10000) return 4
|
||||
// this works for up to 99,999 lines - any questions?
|
||||
return 5
|
||||
}
|
||||
|
||||
function pad(n, totalDigits) {
|
||||
// not pretty, but simple and should perform quite well
|
||||
var padDigits = totalDigits - getDigits(n)
|
||||
switch (padDigits) {
|
||||
case 0: return '' + n
|
||||
case 1: return ' ' + n
|
||||
case 2: return ' ' + n
|
||||
case 3: return ' ' + n
|
||||
case 4: return ' ' + n
|
||||
case 5: return ' ' + n
|
||||
}
|
||||
}
|
||||
|
||||
totalDigits = getDigits(linesLen + firstline - 1)
|
||||
|
||||
for (var i = 0; i < linesLen; i++) {
|
||||
// Don't close the escape sequence here in order to not break multi line code highlights like block comments
|
||||
lineno = colorSurround(pad(i + firstline, totalDigits) + ': ').replace(surroundClose, '')
|
||||
lines.push(lineno + highlightedLines[i])
|
||||
}
|
||||
|
||||
return lines.join('\n')
|
||||
}
|
||||
|
||||
module.exports = function highlight(code, opts) {
|
||||
opts = opts || { }
|
||||
try {
|
||||
var result = redeyed(code, opts.theme || theme, { jsx: !!opts.jsx })
|
||||
var firstline = opts.firstline && !isNaN(opts.firstline) ? opts.firstline : 1
|
||||
|
||||
return opts.linenos ? addLinenos(result.code, firstline) : result.code
|
||||
} catch (e) {
|
||||
e.message = 'Unable to perform highlight. The code contained syntax errors: ' + e.message
|
||||
throw e
|
||||
}
|
||||
}
|
||||
25
html/sternwarte/checkfuehrung/node_modules/cardinal/lib/highlightFile.js
generated
vendored
Executable file
25
html/sternwarte/checkfuehrung/node_modules/cardinal/lib/highlightFile.js
generated
vendored
Executable file
@@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
|
||||
var fs = require('fs')
|
||||
var highlight = require('./highlight')
|
||||
|
||||
function isFunction(obj) {
|
||||
return toString.call(obj) === '[object Function]'
|
||||
}
|
||||
|
||||
module.exports = function highlightFile(fullPath, opts, cb) {
|
||||
if (isFunction(opts)) {
|
||||
cb = opts
|
||||
opts = { }
|
||||
}
|
||||
opts = opts || { }
|
||||
|
||||
fs.readFile(fullPath, 'utf-8', function(err, code) {
|
||||
if (err) return cb(err)
|
||||
try {
|
||||
cb(null, highlight(code, opts))
|
||||
} catch (e) {
|
||||
cb(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
10
html/sternwarte/checkfuehrung/node_modules/cardinal/lib/highlightFileSync.js
generated
vendored
Executable file
10
html/sternwarte/checkfuehrung/node_modules/cardinal/lib/highlightFileSync.js
generated
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
'use strict'
|
||||
|
||||
var fs = require('fs')
|
||||
var highlight = require('./highlight')
|
||||
|
||||
module.exports = function highlightFileSync(fullPath, opts) {
|
||||
var code = fs.readFileSync(fullPath, 'utf-8')
|
||||
opts = opts || { }
|
||||
return highlight(code, opts)
|
||||
}
|
||||
80
html/sternwarte/checkfuehrung/node_modules/cardinal/package.json
generated
vendored
Executable file
80
html/sternwarte/checkfuehrung/node_modules/cardinal/package.json
generated
vendored
Executable file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"_from": "cardinal@^2.1.1",
|
||||
"_id": "cardinal@2.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-fMEFXYItISlU0HsIXeolHMe8VQU=",
|
||||
"_location": "/cardinal",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "cardinal@^2.1.1",
|
||||
"name": "cardinal",
|
||||
"escapedName": "cardinal",
|
||||
"rawSpec": "^2.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mysql2"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cardinal/-/cardinal-2.1.1.tgz",
|
||||
"_shasum": "7cc1055d822d212954d07b085dea251cc7bc5505",
|
||||
"_spec": "cardinal@^2.1.1",
|
||||
"_where": "/Users/rxf/Projekte/SternDBase/sternwarte/checkfuehrung/node_modules/mysql2",
|
||||
"author": {
|
||||
"name": "Thorsten Lorenz",
|
||||
"email": "thlorenz@gmx.de",
|
||||
"url": "thlorenz.com"
|
||||
},
|
||||
"bin": {
|
||||
"cdl": "bin/cdl.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/thlorenz/cardinal/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"ansicolors": "~0.3.2",
|
||||
"redeyed": "~2.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Syntax highlights JavaScript code with ANSI colors to be printed to the terminal.",
|
||||
"devDependencies": {
|
||||
"readdirp": "~2.1.0",
|
||||
"standart": "~6.1.0",
|
||||
"tape": "~4.9.0"
|
||||
},
|
||||
"homepage": "https://github.com/thlorenz/cardinal#readme",
|
||||
"keywords": [
|
||||
"syntax",
|
||||
"highlight",
|
||||
"theme",
|
||||
"javascript",
|
||||
"json",
|
||||
"terminal",
|
||||
"console",
|
||||
"print",
|
||||
"output"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "cardinal.js",
|
||||
"name": "cardinal",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/thlorenz/cardinal.git"
|
||||
},
|
||||
"scripts": {
|
||||
"demo": "node examples/highlight-string.js; node examples/highlight-self; node examples/highlight-self-hide-semicolons;",
|
||||
"lint": "standart",
|
||||
"lint-fix": "standart --fix",
|
||||
"run-test": "tape test/*.js",
|
||||
"test": "npm run run-test && npm run lint"
|
||||
},
|
||||
"standart": {
|
||||
"ignore": [
|
||||
"test/fixtures"
|
||||
]
|
||||
},
|
||||
"version": "2.1.1"
|
||||
}
|
||||
53
html/sternwarte/checkfuehrung/node_modules/cardinal/settings.js
generated
vendored
Executable file
53
html/sternwarte/checkfuehrung/node_modules/cardinal/settings.js
generated
vendored
Executable file
@@ -0,0 +1,53 @@
|
||||
'use strict'
|
||||
|
||||
var path = require('path')
|
||||
var fs = require('fs')
|
||||
var utl = require('./utl')
|
||||
var home = process.env.HOME
|
||||
var settings
|
||||
|
||||
function getSettings(home_) {
|
||||
if (settings) return settings
|
||||
var settingsJson
|
||||
try {
|
||||
settingsJson = fs.readFileSync(path.join(home_ || home, '.cardinalrc'), 'utf-8')
|
||||
} catch (_) {
|
||||
// no .cardinalrc found - not a problem
|
||||
return undefined
|
||||
}
|
||||
try {
|
||||
return JSON.parse(settingsJson)
|
||||
} catch (e) {
|
||||
// Have a .cardinalrc, but something about it is wrong - warn the user
|
||||
// Coudn't parse the contained JSON
|
||||
console.error(e)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
// home_ mainly to be used during tests
|
||||
// Resolves the preferred theme from the .cardinalrc found in the HOME directory
|
||||
// If it couldn't be resolved, undefined is returned
|
||||
function resolveTheme(home_) {
|
||||
var themePath
|
||||
var settings = getSettings(home_)
|
||||
|
||||
if (!settings || !settings.theme) return undefined
|
||||
|
||||
try {
|
||||
// allow specifying just the name of a built-in theme or a full path to a custom theme
|
||||
themePath = utl.isPath(settings.theme) ? settings.theme : path.join(__dirname, 'themes', settings.theme)
|
||||
|
||||
return require(themePath)
|
||||
} catch (e) {
|
||||
// Specified theme path is invalid
|
||||
console.error(e)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
resolveTheme: resolveTheme
|
||||
, getSettings: getSettings
|
||||
}
|
||||
|
||||
22
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-block-comment.js
generated
vendored
Executable file
22
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-block-comment.js
generated
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
|
||||
/* eslint-disable no-path-concat */
|
||||
|
||||
var test = require('tape')
|
||||
var fs = require('fs')
|
||||
var customTheme = require('./fixtures/custom')
|
||||
var cardinal = require('..')
|
||||
|
||||
test('\nhighlighting a block comment without line numbers', function(t) {
|
||||
var code = fs.readFileSync(__dirname + '/fixtures/block-comment.js', 'utf8')
|
||||
var highlighted = cardinal.highlight(code, { theme: customTheme })
|
||||
t.equal(highlighted, '\n\u001b[90m/**\n * This is a meaningless block jsdoc for a meaningless function.\n * Joins two strings, separating them to appear on two lines.\n * \n * @name foo\n * @function\n * @param uno {String} first string\n * @param dos {String} second string\n * @return {String} result of the join\n */\u001b[39m\n\u001b[96mmodule\u001b[39m\u001b[32m.\u001b[39m\u001b[96mexports\u001b[39m \u001b[93m=\u001b[39m \u001b[94mfunction\u001b[39m \u001b[96mfoo\u001b[39m \u001b[90m(\u001b[39m\u001b[96muno\u001b[39m\u001b[32m,\u001b[39m \u001b[96mdos\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m\n \u001b[31mreturn\u001b[39m \u001b[96muno\u001b[39m \u001b[93m+\u001b[39m \u001b[92m\'\\n\'\u001b[39m \u001b[93m+\u001b[39m \u001b[96mdos\u001b[39m\u001b[90m;\u001b[39m\n\u001b[33m}\u001b[39m\n')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('\nhighlighting a block comment with line numbers', function(t) {
|
||||
var code = fs.readFileSync(__dirname + '/fixtures/block-comment.js', 'utf8')
|
||||
var highlighted = cardinal.highlight(code, { theme: customTheme, linenos: true })
|
||||
t.equal(highlighted, '\u001b[90m 1: \n\u001b[90m 2: \u001b[90m/**\n\u001b[90m 3: * This is a meaningless block jsdoc for a meaningless function.\n\u001b[90m 4: * Joins two strings, separating them to appear on two lines.\n\u001b[90m 5: * \n\u001b[90m 6: * @name foo\n\u001b[90m 7: * @function\n\u001b[90m 8: * @param uno {String} first string\n\u001b[90m 9: * @param dos {String} second string\n\u001b[90m10: * @return {String} result of the join\n\u001b[90m11: */\u001b[39m\n\u001b[90m12: \u001b[96mmodule\u001b[39m\u001b[32m.\u001b[39m\u001b[96mexports\u001b[39m \u001b[93m=\u001b[39m \u001b[94mfunction\u001b[39m \u001b[96mfoo\u001b[39m \u001b[90m(\u001b[39m\u001b[96muno\u001b[39m\u001b[32m,\u001b[39m \u001b[96mdos\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m\n\u001b[90m13: \u001b[31mreturn\u001b[39m \u001b[96muno\u001b[39m \u001b[93m+\u001b[39m \u001b[92m\'\\n\'\u001b[39m \u001b[93m+\u001b[39m \u001b[96mdos\u001b[39m\u001b[90m;\u001b[39m\n\u001b[90m14: \u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
42
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-file-async.js
generated
vendored
Executable file
42
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-file-async.js
generated
vendored
Executable file
@@ -0,0 +1,42 @@
|
||||
'use strict'
|
||||
|
||||
/* eslint-disable no-path-concat */
|
||||
|
||||
var test = require('tape')
|
||||
var path = require('path')
|
||||
var customTheme = require('./fixtures/custom')
|
||||
var cardinal = require('..')
|
||||
|
||||
var file = path.join(__dirname, 'fixtures/foo.js')
|
||||
var fileWithErrors = path.join(__dirname, 'fixtures/foo-with-errors.js')
|
||||
|
||||
test('supplying custom theme', function(t) {
|
||||
cardinal.highlightFile(file, { theme: customTheme }, function(err, highlighted) {
|
||||
t.equals(null, err, 'no error')
|
||||
t.equals(highlighted, '\u001b[94mfunction\u001b[39m \u001b[96mfoo\u001b[39m\u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m \n \u001b[32mvar\u001b[39m \u001b[96ma\u001b[39m \u001b[93m=\u001b[39m \u001b[34m3\u001b[39m\u001b[90m;\u001b[39m \u001b[31mreturn\u001b[39m \u001b[96ma\u001b[39m \u001b[93m>\u001b[39m \u001b[34m2\u001b[39m \u001b[93m?\u001b[39m \u001b[31mtrue\u001b[39m \u001b[93m:\u001b[39m \u001b[91mfalse\u001b[39m\u001b[90m;\u001b[39m \n\u001b[33m}\u001b[39m\n')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('not supplying custom theme', function(t) {
|
||||
cardinal.highlightFile(file, function(err, highlighted) {
|
||||
t.equals(null, err, 'no error')
|
||||
t.equals(highlighted, '\u001b[94mfunction\u001b[39m \u001b[37mfoo\u001b[39m\u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m \n \u001b[32mvar\u001b[39m \u001b[37ma\u001b[39m \u001b[93m=\u001b[39m \u001b[34m3\u001b[39m\u001b[90m;\u001b[39m \u001b[31mreturn\u001b[39m \u001b[37ma\u001b[39m \u001b[93m>\u001b[39m \u001b[34m2\u001b[39m \u001b[93m?\u001b[39m \u001b[91mtrue\u001b[39m \u001b[93m:\u001b[39m \u001b[91mfalse\u001b[39m\u001b[90m;\u001b[39m \n\u001b[33m}\u001b[39m\n')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('syntactically invalid code', function(t) {
|
||||
cardinal.highlightFile(fileWithErrors, function(err, highlighted) {
|
||||
t.equals(null, err, 'no error')
|
||||
t.equals(highlighted, '\u001b[94mfunction\u001b[39m \u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m \n \u001b[32mvar\u001b[39m \u001b[37ma\u001b[39m \u001b[93m=\u001b[39m \u001b[34m3\u001b[39m\u001b[90m;\u001b[39m \u001b[31mreturn\u001b[39m \u001b[37ma\u001b[39m \u001b[93m>\u001b[39m \u001b[34m2\u001b[39m \u001b[93m?\u001b[39m \u001b[91mtrue\u001b[39m \u001b[93m:\u001b[39m \u001b[91mfalse\u001b[39m\u001b[90m;\u001b[39m \n\u001b[33m}\u001b[39m\u001b[90m;\u001b[39m\n')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('non existing file', function(t) {
|
||||
cardinal.highlightFile('./not/existing', function(err, highlighted) {
|
||||
t.ok((/ENOENT. .*not.existing/).test(err.message))
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
40
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-file-sync.js
generated
vendored
Executable file
40
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-file-sync.js
generated
vendored
Executable file
@@ -0,0 +1,40 @@
|
||||
'use strict'
|
||||
|
||||
/* eslint-disable no-path-concat */
|
||||
|
||||
var test = require('tape')
|
||||
var path = require('path')
|
||||
var customTheme = require('./fixtures/custom')
|
||||
var cardinal = require('..')
|
||||
|
||||
var file = path.join(__dirname, 'fixtures/foo.js')
|
||||
var fileWithErrors = path.join(__dirname, 'fixtures/foo-with-errors.js')
|
||||
|
||||
test('supplying custom theme', function(t) {
|
||||
var highlighted = cardinal.highlightFileSync(file, { theme: customTheme })
|
||||
|
||||
t.equals(highlighted, '\u001b[94mfunction\u001b[39m \u001b[96mfoo\u001b[39m\u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m \n \u001b[32mvar\u001b[39m \u001b[96ma\u001b[39m \u001b[93m=\u001b[39m \u001b[34m3\u001b[39m\u001b[90m;\u001b[39m \u001b[31mreturn\u001b[39m \u001b[96ma\u001b[39m \u001b[93m>\u001b[39m \u001b[34m2\u001b[39m \u001b[93m?\u001b[39m \u001b[31mtrue\u001b[39m \u001b[93m:\u001b[39m \u001b[91mfalse\u001b[39m\u001b[90m;\u001b[39m \n\u001b[33m}\u001b[39m\n')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('not supplying custom theme', function(t) {
|
||||
var highlighted = cardinal.highlightFileSync(file)
|
||||
|
||||
t.equals(highlighted, '\u001b[94mfunction\u001b[39m \u001b[37mfoo\u001b[39m\u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m \n \u001b[32mvar\u001b[39m \u001b[37ma\u001b[39m \u001b[93m=\u001b[39m \u001b[34m3\u001b[39m\u001b[90m;\u001b[39m \u001b[31mreturn\u001b[39m \u001b[37ma\u001b[39m \u001b[93m>\u001b[39m \u001b[34m2\u001b[39m \u001b[93m?\u001b[39m \u001b[91mtrue\u001b[39m \u001b[93m:\u001b[39m \u001b[91mfalse\u001b[39m\u001b[90m;\u001b[39m \n\u001b[33m}\u001b[39m\n')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('syntactically invalid code', function(t) {
|
||||
var highlighted = cardinal.highlightFileSync(fileWithErrors)
|
||||
t.equals(highlighted, '\u001b[94mfunction\u001b[39m \u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m \n \u001b[32mvar\u001b[39m \u001b[37ma\u001b[39m \u001b[93m=\u001b[39m \u001b[34m3\u001b[39m\u001b[90m;\u001b[39m \u001b[31mreturn\u001b[39m \u001b[37ma\u001b[39m \u001b[93m>\u001b[39m \u001b[34m2\u001b[39m \u001b[93m?\u001b[39m \u001b[91mtrue\u001b[39m \u001b[93m:\u001b[39m \u001b[91mfalse\u001b[39m\u001b[90m;\u001b[39m \n\u001b[33m}\u001b[39m\u001b[90m;\u001b[39m\n')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('non existing file', function(t) {
|
||||
try {
|
||||
cardinal.highlightFileSync('./not/existing')
|
||||
} catch (e) {
|
||||
t.ok((/ENOENT. .*not.existing/).test(e.message))
|
||||
t.end()
|
||||
}
|
||||
})
|
||||
15
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-json-file-async.js
generated
vendored
Executable file
15
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-json-file-async.js
generated
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
'use strict'
|
||||
|
||||
var test = require('tape')
|
||||
var path = require('path')
|
||||
var cardinal = require('..')
|
||||
|
||||
var file = path.join(__dirname, 'fixtures/json.json')
|
||||
|
||||
test('without custom theme', function(t) {
|
||||
cardinal.highlightFile(file, function(err, highlighted) {
|
||||
t.equals(null, err, 'no error')
|
||||
t.equals(highlighted, '\u001b[33m{\u001b[39m\u001b[32m"foo"\u001b[39m\u001b[93m:\u001b[39m\u001b[92m"bar"\u001b[39m\u001b[32m,\u001b[39m\u001b[32m"baz"\u001b[39m\u001b[93m:\u001b[39m\u001b[92m"quux"\u001b[39m\u001b[32m,\u001b[39m\u001b[32m"bam"\u001b[39m\u001b[93m:\u001b[39m\u001b[90mnull\u001b[39m\u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
14
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-json-file-sync.js
generated
vendored
Executable file
14
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-json-file-sync.js
generated
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
'use strict'
|
||||
|
||||
var test = require('tape')
|
||||
var path = require('path')
|
||||
var cardinal = require('..')
|
||||
|
||||
var file = path.join(__dirname, 'fixtures/json.json')
|
||||
|
||||
test('without custom theme', function(t) {
|
||||
var highlighted = cardinal.highlightFileSync(file)
|
||||
|
||||
t.equals(highlighted, '\u001b[33m{\u001b[39m\u001b[32m"foo"\u001b[39m\u001b[93m:\u001b[39m\u001b[92m"bar"\u001b[39m\u001b[32m,\u001b[39m\u001b[32m"baz"\u001b[39m\u001b[93m:\u001b[39m\u001b[92m"quux"\u001b[39m\u001b[32m,\u001b[39m\u001b[32m"bam"\u001b[39m\u001b[93m:\u001b[39m\u001b[90mnull\u001b[39m\u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
32
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-json.js
generated
vendored
Executable file
32
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-json.js
generated
vendored
Executable file
@@ -0,0 +1,32 @@
|
||||
'use strict'
|
||||
|
||||
var test = require('tape')
|
||||
var customTheme = require('./fixtures/custom')
|
||||
var cardinal = require('..')
|
||||
|
||||
var json = JSON.stringify({
|
||||
foo: 'bar',
|
||||
baz: 'quux',
|
||||
bam: null
|
||||
})
|
||||
|
||||
test('supplying custom theme', function(t) {
|
||||
var highlighted = cardinal.highlight(json, { theme: customTheme })
|
||||
|
||||
t.equals(highlighted, '\u001b[33m{\u001b[39m\u001b[92m"foo"\u001b[39m\u001b[93m:\u001b[39m\u001b[92m"bar"\u001b[39m\u001b[32m,\u001b[39m\u001b[92m"baz"\u001b[39m\u001b[93m:\u001b[39m\u001b[92m"quux"\u001b[39m\u001b[32m,\u001b[39m\u001b[92m"bam"\u001b[39m\u001b[93m:\u001b[39m\u001b[90mnull\u001b[39m\u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('not supplying custom theme', function(t) {
|
||||
var highlighted = cardinal.highlight(json)
|
||||
|
||||
t.equals(highlighted, '\u001b[33m{\u001b[39m\u001b[32m"foo"\u001b[39m\u001b[93m:\u001b[39m\u001b[92m"bar"\u001b[39m\u001b[32m,\u001b[39m\u001b[32m"baz"\u001b[39m\u001b[93m:\u001b[39m\u001b[92m"quux"\u001b[39m\u001b[32m,\u001b[39m\u001b[32m"bam"\u001b[39m\u001b[93m:\u001b[39m\u001b[90mnull\u001b[39m\u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('with the obsoleted json option (ignored)', function(t) {
|
||||
var highlighted = cardinal.highlight(json, { json: true })
|
||||
|
||||
t.equals(highlighted, '\u001b[33m{\u001b[39m\u001b[32m"foo"\u001b[39m\u001b[93m:\u001b[39m\u001b[92m"bar"\u001b[39m\u001b[32m,\u001b[39m\u001b[32m"baz"\u001b[39m\u001b[93m:\u001b[39m\u001b[92m"quux"\u001b[39m\u001b[32m,\u001b[39m\u001b[32m"bam"\u001b[39m\u001b[93m:\u001b[39m\u001b[90mnull\u001b[39m\u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
61
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-string.js
generated
vendored
Executable file
61
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-highlight-string.js
generated
vendored
Executable file
@@ -0,0 +1,61 @@
|
||||
'use strict'
|
||||
|
||||
var test = require('tape')
|
||||
var customTheme = require('./fixtures/custom')
|
||||
var cardinal = require('..')
|
||||
|
||||
var code = 'function foo() { var a = 3; return a > 2 ? true : false; }'
|
||||
var codeWithErrors = 'function () { var a = 3; return a > 2 ? true : false; }'
|
||||
|
||||
test('supplying custom theme', function(t) {
|
||||
var highlighted = cardinal.highlight(code, { theme: customTheme })
|
||||
|
||||
t.equals(highlighted, '\u001b[94mfunction\u001b[39m \u001b[96mfoo\u001b[39m\u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m \u001b[32mvar\u001b[39m \u001b[96ma\u001b[39m \u001b[93m=\u001b[39m \u001b[34m3\u001b[39m\u001b[90m;\u001b[39m \u001b[31mreturn\u001b[39m \u001b[96ma\u001b[39m \u001b[93m>\u001b[39m \u001b[34m2\u001b[39m \u001b[93m?\u001b[39m \u001b[31mtrue\u001b[39m \u001b[93m:\u001b[39m \u001b[91mfalse\u001b[39m\u001b[90m;\u001b[39m \u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('not supplying custom theme', function(t) {
|
||||
var highlighted = cardinal.highlight(code)
|
||||
|
||||
t.equals(highlighted, '\u001b[94mfunction\u001b[39m \u001b[37mfoo\u001b[39m\u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m \u001b[32mvar\u001b[39m \u001b[37ma\u001b[39m \u001b[93m=\u001b[39m \u001b[34m3\u001b[39m\u001b[90m;\u001b[39m \u001b[31mreturn\u001b[39m \u001b[37ma\u001b[39m \u001b[93m>\u001b[39m \u001b[34m2\u001b[39m \u001b[93m?\u001b[39m \u001b[91mtrue\u001b[39m \u001b[93m:\u001b[39m \u001b[91mfalse\u001b[39m\u001b[90m;\u001b[39m \u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('syntactically invalid code', function(t) {
|
||||
var highlighted = cardinal.highlight(codeWithErrors)
|
||||
|
||||
t.equals(highlighted, '\u001b[94mfunction\u001b[39m \u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m \u001b[32mvar\u001b[39m \u001b[37ma\u001b[39m \u001b[93m=\u001b[39m \u001b[34m3\u001b[39m\u001b[90m;\u001b[39m \u001b[31mreturn\u001b[39m \u001b[37ma\u001b[39m \u001b[93m>\u001b[39m \u001b[34m2\u001b[39m \u001b[93m?\u001b[39m \u001b[91mtrue\u001b[39m \u001b[93m:\u001b[39m \u001b[91mfalse\u001b[39m\u001b[90m;\u001b[39m \u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('line numbers no firstline given', function(t) {
|
||||
var highlighted = cardinal.highlight(code, { linenos: true })
|
||||
t.equals(highlighted, '\u001b[90m1: \u001b[94mfunction\u001b[39m \u001b[37mfoo\u001b[39m\u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m \u001b[32mvar\u001b[39m \u001b[37ma\u001b[39m \u001b[93m=\u001b[39m \u001b[34m3\u001b[39m\u001b[90m;\u001b[39m \u001b[31mreturn\u001b[39m \u001b[37ma\u001b[39m \u001b[93m>\u001b[39m \u001b[34m2\u001b[39m \u001b[93m?\u001b[39m \u001b[91mtrue\u001b[39m \u001b[93m:\u001b[39m \u001b[91mfalse\u001b[39m\u001b[90m;\u001b[39m \u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('line numbers firstline 99', function(t) {
|
||||
var highlighted = cardinal.highlight(code, { linenos: true, firstline: 99 })
|
||||
t.equals(highlighted, '\u001b[90m99: \u001b[94mfunction\u001b[39m \u001b[37mfoo\u001b[39m\u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m \u001b[32mvar\u001b[39m \u001b[37ma\u001b[39m \u001b[93m=\u001b[39m \u001b[34m3\u001b[39m\u001b[90m;\u001b[39m \u001b[31mreturn\u001b[39m \u001b[37ma\u001b[39m \u001b[93m>\u001b[39m \u001b[34m2\u001b[39m \u001b[93m?\u001b[39m \u001b[91mtrue\u001b[39m \u001b[93m:\u001b[39m \u001b[91mfalse\u001b[39m\u001b[90m;\u001b[39m \u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('line numbers multi line no first line given', function(t) {
|
||||
var multilineCode = '' +
|
||||
function foo() {
|
||||
return 1
|
||||
}
|
||||
var highlighted = cardinal.highlight(multilineCode, { linenos: true })
|
||||
t.equals(highlighted, '\u001b[90m1: \u001b[94mfunction\u001b[39m \u001b[37mfoo\u001b[39m\u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m\n\u001b[90m2: \u001b[31mreturn\u001b[39m \u001b[34m1\u001b[39m\n\u001b[90m3: \u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('line numbers multi line first line 99', function(t) {
|
||||
var multilineCode = '' +
|
||||
function foo() {
|
||||
return 1
|
||||
}
|
||||
var highlighted = cardinal.highlight(multilineCode, { linenos: true, firstline: 99 })
|
||||
t.equals(highlighted, '\u001b[90m 99: \u001b[94mfunction\u001b[39m \u001b[37mfoo\u001b[39m\u001b[90m(\u001b[39m\u001b[90m)\u001b[39m \u001b[33m{\u001b[39m\n\u001b[90m100: \u001b[31mreturn\u001b[39m \u001b[34m1\u001b[39m\n\u001b[90m101: \u001b[33m}\u001b[39m')
|
||||
t.end()
|
||||
})
|
||||
37
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-smoke.js
generated
vendored
Executable file
37
html/sternwarte/checkfuehrung/node_modules/cardinal/test/cardinal-smoke.js
generated
vendored
Executable file
@@ -0,0 +1,37 @@
|
||||
'use strict'
|
||||
|
||||
// applying esprima to a bunch of files of contained libraries as a smoke test
|
||||
var test = require('tape')
|
||||
var path = require('path')
|
||||
var fs = require('fs')
|
||||
var readdirp = require('readdirp')
|
||||
var cardinal = require('..')
|
||||
var nodeModules = path.join(__dirname, '..', 'node_modules')
|
||||
var tapedir = path.join(nodeModules, 'tape')
|
||||
var redeyeddir = path.join(nodeModules, 'redeyed')
|
||||
|
||||
test('tape', function(t) {
|
||||
readdirp({ root: tapedir, fileFilter: '*.js' })
|
||||
.on('data', function(entry) {
|
||||
var code = fs.readFileSync(entry.fullPath, 'utf-8')
|
||||
var result = cardinal.highlight(code)
|
||||
|
||||
if (!(/^[^/*]*var /.test(code))) {
|
||||
t.pass('skipping ' + entry.path + ' due to missing var statement')
|
||||
} else {
|
||||
t.assert(~result.indexOf('[32mvar\u001b[39m'), 'highlighted ' + entry.path)
|
||||
}
|
||||
})
|
||||
.on('end', t.end.bind(t))
|
||||
})
|
||||
|
||||
test('redeyed', function(t) {
|
||||
readdirp({ root: redeyeddir, fileFilter: 'redeyed.js' })
|
||||
.on('data', function(entry) {
|
||||
var code = fs.readFileSync(entry.fullPath, 'utf-8')
|
||||
var result = cardinal.highlight(code)
|
||||
|
||||
t.assert(~result.indexOf('[32mvar\u001b[39m') || !(~result.indexOf('var ')), 'highlighted ' + entry.path)
|
||||
})
|
||||
.on('end', t.end.bind(t))
|
||||
})
|
||||
14
html/sternwarte/checkfuehrung/node_modules/cardinal/test/fixtures/block-comment.js
generated
vendored
Executable file
14
html/sternwarte/checkfuehrung/node_modules/cardinal/test/fixtures/block-comment.js
generated
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
|
||||
/**
|
||||
* This is a meaningless block jsdoc for a meaningless function.
|
||||
* Joins two strings, separating them to appear on two lines.
|
||||
*
|
||||
* @name foo
|
||||
* @function
|
||||
* @param uno {String} first string
|
||||
* @param dos {String} second string
|
||||
* @return {String} result of the join
|
||||
*/
|
||||
module.exports = function foo (uno, dos) {
|
||||
return uno + '\n' + dos;
|
||||
}
|
||||
144
html/sternwarte/checkfuehrung/node_modules/cardinal/test/fixtures/custom.js
generated
vendored
Executable file
144
html/sternwarte/checkfuehrung/node_modules/cardinal/test/fixtures/custom.js
generated
vendored
Executable file
@@ -0,0 +1,144 @@
|
||||
var colors = require('ansicolors');
|
||||
|
||||
// Change the below definitions in order to tweak the color theme.
|
||||
module.exports = {
|
||||
|
||||
'Boolean': {
|
||||
// changed from default
|
||||
'true' : colors.red
|
||||
|
||||
, 'false' : undefined
|
||||
, _default : colors.brightRed
|
||||
}
|
||||
|
||||
, 'Identifier': {
|
||||
'undefined' : colors.brightBlack
|
||||
, 'self' : colors.brightRed
|
||||
, 'console' : colors.blue
|
||||
, 'log' : colors.blue
|
||||
, 'warn' : colors.red
|
||||
, 'error' : colors.brightRed
|
||||
//
|
||||
// changed from default
|
||||
, _default : colors.brightCyan
|
||||
}
|
||||
|
||||
, 'Null': {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
, 'Numeric': {
|
||||
_default: colors.blue
|
||||
}
|
||||
|
||||
, 'String': {
|
||||
_default: colors.brightGreen
|
||||
}
|
||||
|
||||
, 'Keyword': {
|
||||
'break' : undefined
|
||||
|
||||
, 'case' : undefined
|
||||
, 'catch' : colors.cyan
|
||||
, 'continue' : undefined
|
||||
|
||||
, 'debugger' : undefined
|
||||
, 'default' : undefined
|
||||
, 'delete' : colors.red
|
||||
, 'do' : undefined
|
||||
|
||||
, 'else' : undefined
|
||||
|
||||
, 'finally' : colors.cyan
|
||||
, 'for' : undefined
|
||||
, 'function' : undefined
|
||||
|
||||
, 'if' : undefined
|
||||
, 'in' : undefined
|
||||
, 'instanceof' : undefined
|
||||
|
||||
, 'new' : colors.red
|
||||
, 'return' : colors.red
|
||||
, 'switch' : undefined
|
||||
|
||||
, 'this' : colors.brightRed
|
||||
, 'throw' : undefined
|
||||
, 'try' : colors.cyan
|
||||
, 'typeof' : undefined
|
||||
|
||||
, 'var' : colors.green
|
||||
, 'void' : undefined
|
||||
|
||||
, 'while' : undefined
|
||||
, 'with' : undefined
|
||||
, _default : colors.brightBlue
|
||||
}
|
||||
, 'Punctuator': {
|
||||
';': colors.brightBlack
|
||||
, '.': colors.green
|
||||
, ',': colors.green
|
||||
|
||||
, '{': colors.yellow
|
||||
, '}': colors.yellow
|
||||
, '(': colors.brightBlack
|
||||
, ')': colors.brightBlack
|
||||
, '[': colors.yellow
|
||||
, ']': colors.yellow
|
||||
|
||||
, '<': undefined
|
||||
, '>': undefined
|
||||
, '+': undefined
|
||||
, '-': undefined
|
||||
, '*': undefined
|
||||
, '%': undefined
|
||||
, '&': undefined
|
||||
, '|': undefined
|
||||
, '^': undefined
|
||||
, '!': undefined
|
||||
, '~': undefined
|
||||
, '?': undefined
|
||||
, ':': undefined
|
||||
, '=': undefined
|
||||
|
||||
, '<=': undefined
|
||||
, '>=': undefined
|
||||
, '==': undefined
|
||||
, '!=': undefined
|
||||
, '++': undefined
|
||||
, '--': undefined
|
||||
, '<<': undefined
|
||||
, '>>': undefined
|
||||
, '&&': undefined
|
||||
, '||': undefined
|
||||
, '+=': undefined
|
||||
, '-=': undefined
|
||||
, '*=': undefined
|
||||
, '%=': undefined
|
||||
, '&=': undefined
|
||||
, '|=': undefined
|
||||
, '^=': undefined
|
||||
, '/=': undefined
|
||||
|
||||
, '===': undefined
|
||||
, '!==': undefined
|
||||
, '>>>': undefined
|
||||
, '<<=': undefined
|
||||
, '>>=': undefined
|
||||
|
||||
, '>>>=': undefined
|
||||
|
||||
, _default: colors.brightYellow
|
||||
}
|
||||
|
||||
// line comment
|
||||
, Line: {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
/* block comment */
|
||||
, Block: {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
, _default: undefined
|
||||
};
|
||||
3
html/sternwarte/checkfuehrung/node_modules/cardinal/test/fixtures/foo-with-errors.js
generated
vendored
Executable file
3
html/sternwarte/checkfuehrung/node_modules/cardinal/test/fixtures/foo-with-errors.js
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
function () {
|
||||
var a = 3; return a > 2 ? true : false;
|
||||
};
|
||||
3
html/sternwarte/checkfuehrung/node_modules/cardinal/test/fixtures/foo.js
generated
vendored
Executable file
3
html/sternwarte/checkfuehrung/node_modules/cardinal/test/fixtures/foo.js
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
function foo() {
|
||||
var a = 3; return a > 2 ? true : false;
|
||||
}
|
||||
1
html/sternwarte/checkfuehrung/node_modules/cardinal/test/fixtures/json.json
generated
vendored
Executable file
1
html/sternwarte/checkfuehrung/node_modules/cardinal/test/fixtures/json.json
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"foo":"bar","baz":"quux","bam":null}
|
||||
23
html/sternwarte/checkfuehrung/node_modules/cardinal/test/fixtures/svn-diff.txt
generated
vendored
Executable file
23
html/sternwarte/checkfuehrung/node_modules/cardinal/test/fixtures/svn-diff.txt
generated
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
Index: grunt.js
|
||||
===================================================================
|
||||
--- grunt.js (revision 31200)
|
||||
+++ grunt.js (working copy)
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
module.exports = function (grunt) {
|
||||
|
||||
+ console.log('hello world');
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
lint: {
|
||||
@@ -19,10 +20,6 @@
|
||||
'packages/services.web/{!(test)/**/,}*.js',
|
||||
'packages/error/**/*.js'
|
||||
],
|
||||
- scripts: [
|
||||
- 'grunt.js',
|
||||
- 'db/**/*.js'
|
||||
- ],
|
||||
browser: [
|
||||
'packages/web/server.js',
|
||||
'packages/web/server/**/*.js',
|
||||
77
html/sternwarte/checkfuehrung/node_modules/cardinal/test/settings.js
generated
vendored
Executable file
77
html/sternwarte/checkfuehrung/node_modules/cardinal/test/settings.js
generated
vendored
Executable file
@@ -0,0 +1,77 @@
|
||||
'use strict'
|
||||
/* jshint asi: true */
|
||||
|
||||
var test = require('tape')
|
||||
var path = require('path')
|
||||
var fs = require('fs')
|
||||
var hideSemicolonsTheme = require('../themes/hide-semicolons')
|
||||
var home = path.join(__dirname, 'fixtures', 'home')
|
||||
var rcpath = path.join(home, '.cardinalrc')
|
||||
var existsSync = fs.existsSync || path.existsSync
|
||||
var settingsResolve = require.resolve('../settings')
|
||||
var settings
|
||||
|
||||
function setup() {
|
||||
delete require.cache[settingsResolve]
|
||||
settings = require(settingsResolve)
|
||||
}
|
||||
|
||||
function writerc(config) {
|
||||
fs.writeFileSync(rcpath, JSON.stringify(config), 'utf-8')
|
||||
}
|
||||
|
||||
function removerc() {
|
||||
fs.unlinkSync(rcpath)
|
||||
}
|
||||
|
||||
function resolveTheme(config) {
|
||||
writerc(config)
|
||||
var result = settings.resolveTheme(home)
|
||||
removerc()
|
||||
return result
|
||||
}
|
||||
|
||||
function getSettings(config) {
|
||||
writerc(config)
|
||||
var result = settings.getSettings(home)
|
||||
removerc()
|
||||
return result
|
||||
}
|
||||
|
||||
if (!existsSync(home)) fs.mkdirSync(home)
|
||||
|
||||
test('no .cardinalrc in home', function(t) {
|
||||
setup()
|
||||
var theme = settings.resolveTheme(home)
|
||||
t.equals(theme, undefined, 'resolves no theme')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('.cardinalrc with theme "hide-semicolons" in home', function(t) {
|
||||
setup()
|
||||
var theme = resolveTheme({ theme: 'hide-semicolons' })
|
||||
t.deepEquals(theme, hideSemicolonsTheme, 'resolves hide-semicolons theme')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('.cardinalrc with full path to "hide-semicolons.js" in home', function(t) {
|
||||
setup()
|
||||
var theme = resolveTheme({ theme: path.join(__dirname, '..', 'themes', 'hide-semicolons.js') })
|
||||
t.deepEquals(theme, hideSemicolonsTheme, 'resolves hide-semicolons theme')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('.cardinalrc with linenos: true', function(t) {
|
||||
setup()
|
||||
var opts = { linenos: true }
|
||||
t.deepEquals(getSettings(opts), opts)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('.cardinalrc with linenos: true and theme', function(t) {
|
||||
setup()
|
||||
var opts = { linenos: true, theme: 'some theme' }
|
||||
t.deepEquals(getSettings(opts), opts)
|
||||
t.end()
|
||||
})
|
||||
|
||||
22
html/sternwarte/checkfuehrung/node_modules/cardinal/test/themes.js
generated
vendored
Executable file
22
html/sternwarte/checkfuehrung/node_modules/cardinal/test/themes.js
generated
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
/* jshint asi: true */
|
||||
|
||||
var test = require('tape')
|
||||
var path = require('path')
|
||||
var fs = require('fs')
|
||||
var themesdir = path.join(__dirname, '..', 'themes')
|
||||
var allFiles = fs.readdirSync(themesdir)
|
||||
|
||||
test('validate themes by requiring all of them', function(t) {
|
||||
allFiles
|
||||
.filter(function(file) { return path.extname(file) === '.js' })
|
||||
.forEach(function(theme) {
|
||||
try {
|
||||
t.ok(require(path.join(themesdir, theme)), theme + ' is valid')
|
||||
} catch (e) {
|
||||
t.fail('theme: ' + theme + ' is invalid! ' + e.message)
|
||||
}
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
31
html/sternwarte/checkfuehrung/node_modules/cardinal/themes/README.md
generated
vendored
Executable file
31
html/sternwarte/checkfuehrung/node_modules/cardinal/themes/README.md
generated
vendored
Executable file
@@ -0,0 +1,31 @@
|
||||
# cardinal themes
|
||||
|
||||
These are the built in themes that come with cardinal.
|
||||
|
||||
You can create more themes by copying and then editing the [empty
|
||||
theme](https://github.com/thlorenz/cardinal/blob/master/themes/empty.js) which is provided for that purpose.
|
||||
|
||||
The [hide semicolons theme](https://github.com/thlorenz/cardinal/blob/master/themes/hide-semicolons.js) has the added
|
||||
benefit of making all semicolons invisible. This makes code more readable at times.
|
||||
|
||||
Find out how to change the theme used by cardinal [here](https://github.com/thlorenz/cardinal#theme).
|
||||
|
||||
# sharing themes
|
||||
|
||||
To add your theme to the cardinal built-in themes, follow the below steps:
|
||||
|
||||
1. fork the cardinal repository
|
||||
2. add your theme to the themes folder and commit your changes
|
||||
3. create a pull request
|
||||
|
||||
If you believe that your theme is better than the current default theme, let me know by creating an issue.
|
||||
|
||||
This will allow others to cast their vote. If enough people agree, your theme will be promoted to be the default.
|
||||
|
||||
## Contributed Themes
|
||||
|
||||
### tomorrow night
|
||||
|
||||
[](https://github.com/thlorenz/cardinal/blob/master/themes/tomorrow-night.js)
|
||||
|
||||
*by [firede](https://github.com/firede)*
|
||||
201
html/sternwarte/checkfuehrung/node_modules/cardinal/themes/default.js
generated
vendored
Executable file
201
html/sternwarte/checkfuehrung/node_modules/cardinal/themes/default.js
generated
vendored
Executable file
@@ -0,0 +1,201 @@
|
||||
var colors = require('ansicolors')
|
||||
|
||||
// Change the below definitions in order to tweak the color theme.
|
||||
module.exports = {
|
||||
|
||||
'Boolean': {
|
||||
'true' : undefined
|
||||
, 'false' : undefined
|
||||
, _default : colors.brightRed
|
||||
}
|
||||
|
||||
, 'Identifier': {
|
||||
'undefined' : colors.brightBlack
|
||||
, 'self' : colors.brightRed
|
||||
, 'console' : colors.blue
|
||||
, 'log' : colors.blue
|
||||
, 'warn' : colors.red
|
||||
, 'error' : colors.brightRed
|
||||
, _default : colors.white
|
||||
}
|
||||
|
||||
, 'Null': {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
, 'Numeric': {
|
||||
_default: colors.blue
|
||||
}
|
||||
|
||||
, 'String': {
|
||||
_default: function(s, info) {
|
||||
var nextToken = info.tokens[info.tokenIndex + 1]
|
||||
|
||||
// show keys of object literals and json in different color
|
||||
return (nextToken && nextToken.type === 'Punctuator' && nextToken.value === ':')
|
||||
? colors.green(s)
|
||||
: colors.brightGreen(s)
|
||||
}
|
||||
}
|
||||
|
||||
, 'Keyword': {
|
||||
'break' : undefined
|
||||
|
||||
, 'case' : undefined
|
||||
, 'catch' : colors.cyan
|
||||
, 'class' : undefined
|
||||
, 'const' : undefined
|
||||
, 'continue' : undefined
|
||||
|
||||
, 'debugger' : undefined
|
||||
, 'default' : undefined
|
||||
, 'delete' : colors.red
|
||||
, 'do' : undefined
|
||||
|
||||
, 'else' : undefined
|
||||
, 'enum' : undefined
|
||||
, 'export' : undefined
|
||||
, 'extends' : undefined
|
||||
|
||||
, 'finally' : colors.cyan
|
||||
, 'for' : undefined
|
||||
, 'function' : undefined
|
||||
|
||||
, 'if' : undefined
|
||||
, 'implements' : undefined
|
||||
, 'import' : undefined
|
||||
, 'in' : undefined
|
||||
, 'instanceof' : undefined
|
||||
, 'let' : undefined
|
||||
, 'new' : colors.red
|
||||
, 'package' : undefined
|
||||
, 'private' : undefined
|
||||
, 'protected' : undefined
|
||||
, 'public' : undefined
|
||||
, 'return' : colors.red
|
||||
, 'static' : undefined
|
||||
, 'super' : undefined
|
||||
, 'switch' : undefined
|
||||
|
||||
, 'this' : colors.brightRed
|
||||
, 'throw' : undefined
|
||||
, 'try' : colors.cyan
|
||||
, 'typeof' : undefined
|
||||
|
||||
, 'var' : colors.green
|
||||
, 'void' : undefined
|
||||
|
||||
, 'while' : undefined
|
||||
, 'with' : undefined
|
||||
, 'yield' : undefined
|
||||
, _default : colors.brightBlue
|
||||
}
|
||||
, 'Punctuator': {
|
||||
';': colors.brightBlack
|
||||
, '.': colors.green
|
||||
, ',': colors.green
|
||||
|
||||
, '{': colors.yellow
|
||||
, '}': colors.yellow
|
||||
, '(': colors.brightBlack
|
||||
, ')': colors.brightBlack
|
||||
, '[': colors.yellow
|
||||
, ']': colors.yellow
|
||||
|
||||
, '<': undefined
|
||||
, '>': undefined
|
||||
, '+': undefined
|
||||
, '-': undefined
|
||||
, '*': undefined
|
||||
, '%': undefined
|
||||
, '&': undefined
|
||||
, '|': undefined
|
||||
, '^': undefined
|
||||
, '!': undefined
|
||||
, '~': undefined
|
||||
, '?': undefined
|
||||
, ':': undefined
|
||||
, '=': undefined
|
||||
|
||||
, '<=': undefined
|
||||
, '>=': undefined
|
||||
, '==': undefined
|
||||
, '!=': undefined
|
||||
, '++': undefined
|
||||
, '--': undefined
|
||||
, '<<': undefined
|
||||
, '>>': undefined
|
||||
, '&&': undefined
|
||||
, '||': undefined
|
||||
, '+=': undefined
|
||||
, '-=': undefined
|
||||
, '*=': undefined
|
||||
, '%=': undefined
|
||||
, '&=': undefined
|
||||
, '|=': undefined
|
||||
, '^=': undefined
|
||||
, '/=': undefined
|
||||
, '=>': undefined
|
||||
, '**': undefined
|
||||
|
||||
, '===': undefined
|
||||
, '!==': undefined
|
||||
, '>>>': undefined
|
||||
, '<<=': undefined
|
||||
, '>>=': undefined
|
||||
, '...': undefined
|
||||
, '**=': undefined
|
||||
|
||||
, '>>>=': undefined
|
||||
|
||||
, _default: colors.brightYellow
|
||||
}
|
||||
|
||||
// line comment
|
||||
, Line: {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
/* block comment */
|
||||
, Block: {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
// JSX
|
||||
, JSXAttribute: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXClosingElement: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXElement: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXEmptyExpression: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXExpressionContainer: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXIdentifier: {
|
||||
className: colors.blue
|
||||
, _default: colors.magenta
|
||||
}
|
||||
, JSXMemberExpression: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXNamespacedName: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXOpeningElement: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXSpreadAttribute: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXText: {
|
||||
_default: colors.brightGreen
|
||||
}
|
||||
|
||||
, _default: undefined
|
||||
}
|
||||
199
html/sternwarte/checkfuehrung/node_modules/cardinal/themes/empty.js
generated
vendored
Executable file
199
html/sternwarte/checkfuehrung/node_modules/cardinal/themes/empty.js
generated
vendored
Executable file
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
* Copy this file and use it as a starting point for your custom cardinal color theme.
|
||||
* Just fill in or change the entries for the tokens you want to color
|
||||
* Keep in mind that more specific configurations override less specific ones.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var colors = require('ansicolors')
|
||||
|
||||
// Change the below definitions in order to tweak the color theme.
|
||||
module.exports = {
|
||||
|
||||
'Boolean': {
|
||||
'true' : undefined
|
||||
, 'false' : undefined
|
||||
, _default : undefined
|
||||
}
|
||||
|
||||
, 'Identifier': {
|
||||
_default: undefined
|
||||
}
|
||||
|
||||
, 'Null': {
|
||||
_default: undefined
|
||||
}
|
||||
|
||||
, 'Numeric': {
|
||||
_default: undefined
|
||||
}
|
||||
|
||||
, 'String': {
|
||||
_default: undefined
|
||||
}
|
||||
|
||||
, 'Keyword': {
|
||||
'break' : undefined
|
||||
|
||||
, 'case' : undefined
|
||||
, 'catch' : undefined
|
||||
, 'class' : undefined
|
||||
, 'const' : undefined
|
||||
, 'continue' : undefined
|
||||
|
||||
, 'debugger' : undefined
|
||||
, 'default' : undefined
|
||||
, 'delete' : undefined
|
||||
, 'do' : undefined
|
||||
|
||||
, 'else' : undefined
|
||||
, 'enum' : undefined
|
||||
, 'export' : undefined
|
||||
, 'extends' : undefined
|
||||
|
||||
, 'finally' : undefined
|
||||
, 'for' : undefined
|
||||
, 'function' : undefined
|
||||
|
||||
, 'if' : undefined
|
||||
, 'implements' : undefined
|
||||
, 'import' : undefined
|
||||
, 'in' : undefined
|
||||
, 'instanceof' : undefined
|
||||
, 'interface' : undefined
|
||||
, 'let' : undefined
|
||||
, 'new' : undefined
|
||||
|
||||
, 'package' : undefined
|
||||
, 'private' : undefined
|
||||
, 'protected' : undefined
|
||||
, 'public' : undefined
|
||||
|
||||
, 'return' : undefined
|
||||
, 'static' : undefined
|
||||
, 'super' : undefined
|
||||
, 'switch' : undefined
|
||||
|
||||
, 'this' : undefined
|
||||
, 'throw' : undefined
|
||||
, 'try' : undefined
|
||||
, 'typeof' : undefined
|
||||
|
||||
, 'var' : undefined
|
||||
, 'void' : undefined
|
||||
|
||||
, 'while' : undefined
|
||||
, 'with' : undefined
|
||||
, 'yield' : undefined
|
||||
, _default : undefined
|
||||
}
|
||||
, 'Punctuator': {
|
||||
';': undefined
|
||||
, '.': undefined
|
||||
, ',': undefined
|
||||
|
||||
, '{': undefined
|
||||
, '}': undefined
|
||||
, '(': undefined
|
||||
, ')': undefined
|
||||
, '[': undefined
|
||||
, ']': undefined
|
||||
|
||||
, '<': undefined
|
||||
, '>': undefined
|
||||
, '+': undefined
|
||||
, '-': undefined
|
||||
, '*': undefined
|
||||
, '%': undefined
|
||||
, '&': undefined
|
||||
, '|': undefined
|
||||
, '^': undefined
|
||||
, '!': undefined
|
||||
, '~': undefined
|
||||
, '?': undefined
|
||||
, ':': undefined
|
||||
, '=': undefined
|
||||
|
||||
, '<=': undefined
|
||||
, '>=': undefined
|
||||
, '==': undefined
|
||||
, '!=': undefined
|
||||
, '++': undefined
|
||||
, '--': undefined
|
||||
, '<<': undefined
|
||||
, '>>': undefined
|
||||
, '&&': undefined
|
||||
, '||': undefined
|
||||
, '+=': undefined
|
||||
, '-=': undefined
|
||||
, '*=': undefined
|
||||
, '%=': undefined
|
||||
, '&=': undefined
|
||||
, '|=': undefined
|
||||
, '^=': undefined
|
||||
, '/=': undefined
|
||||
, '=>': undefined
|
||||
, '**': undefined
|
||||
|
||||
, '===': undefined
|
||||
, '!==': undefined
|
||||
, '>>>': undefined
|
||||
, '<<=': undefined
|
||||
, '>>=': undefined
|
||||
, '...': undefined
|
||||
, '**=': undefined
|
||||
|
||||
, '>>>=': undefined
|
||||
|
||||
, _default: undefined
|
||||
}
|
||||
|
||||
// line comment
|
||||
, Line: {
|
||||
_default: undefined
|
||||
}
|
||||
|
||||
/* block comment */
|
||||
, Block: {
|
||||
_default: undefined
|
||||
}
|
||||
|
||||
// JSX
|
||||
, JSXAttribute: {
|
||||
_default: undefined
|
||||
}
|
||||
, JSXClosingElement: {
|
||||
_default: undefined
|
||||
}
|
||||
, JSXElement: {
|
||||
_default: undefined
|
||||
}
|
||||
, JSXEmptyExpression: {
|
||||
_default: undefined
|
||||
}
|
||||
, JSXExpressionContainer: {
|
||||
_default: undefined
|
||||
}
|
||||
, JSXIdentifier: {
|
||||
// many more identifies are possible, div, table, etc.
|
||||
className: undefined
|
||||
, _default: undefined
|
||||
}
|
||||
, JSXMemberExpression: {
|
||||
_default: undefined
|
||||
}
|
||||
, JSXNamespacedName: {
|
||||
_default: undefined
|
||||
}
|
||||
, JSXOpeningElement: {
|
||||
_default: undefined
|
||||
}
|
||||
, JSXSpreadAttribute: {
|
||||
_default: undefined
|
||||
}
|
||||
, JSXText: {
|
||||
_default: undefined
|
||||
}
|
||||
|
||||
, _default: undefined
|
||||
}
|
||||
202
html/sternwarte/checkfuehrung/node_modules/cardinal/themes/hide-semicolons.js
generated
vendored
Executable file
202
html/sternwarte/checkfuehrung/node_modules/cardinal/themes/hide-semicolons.js
generated
vendored
Executable file
@@ -0,0 +1,202 @@
|
||||
var colors = require('ansicolors')
|
||||
|
||||
// Change the below definitions in order to tweak the color theme.
|
||||
module.exports = {
|
||||
|
||||
'Boolean': {
|
||||
'true' : undefined
|
||||
, 'false' : undefined
|
||||
, _default : colors.brightRed
|
||||
}
|
||||
|
||||
, 'Identifier': {
|
||||
'undefined' : colors.brightBlack
|
||||
, 'self' : colors.brightRed
|
||||
, 'console' : colors.blue
|
||||
, 'log' : colors.blue
|
||||
, 'warn' : colors.red
|
||||
, 'error' : colors.brightRed
|
||||
, _default : colors.white
|
||||
}
|
||||
|
||||
, 'Null': {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
, 'Numeric': {
|
||||
_default: colors.blue
|
||||
}
|
||||
|
||||
, 'String': {
|
||||
_default: function(s, info) {
|
||||
var nextToken = info.tokens[info.tokenIndex + 1]
|
||||
|
||||
// show keys of object literals and json in different color
|
||||
return (nextToken && nextToken.type === 'Punctuator' && nextToken.value === ':')
|
||||
? colors.green(s)
|
||||
: colors.brightGreen(s)
|
||||
}
|
||||
}
|
||||
|
||||
, 'Keyword': {
|
||||
'break' : undefined
|
||||
|
||||
, 'case' : undefined
|
||||
, 'catch' : colors.cyan
|
||||
, 'class' : undefined
|
||||
, 'const' : undefined
|
||||
, 'continue' : undefined
|
||||
|
||||
, 'debugger' : undefined
|
||||
, 'default' : undefined
|
||||
, 'delete' : colors.red
|
||||
, 'do' : undefined
|
||||
|
||||
, 'else' : undefined
|
||||
, 'enum' : undefined
|
||||
, 'export' : undefined
|
||||
, 'extends' : undefined
|
||||
|
||||
, 'finally' : colors.cyan
|
||||
, 'for' : undefined
|
||||
, 'function' : undefined
|
||||
|
||||
, 'if' : undefined
|
||||
, 'implements' : undefined
|
||||
, 'import' : undefined
|
||||
, 'in' : undefined
|
||||
, 'instanceof' : undefined
|
||||
, 'let' : undefined
|
||||
, 'new' : colors.red
|
||||
, 'package' : undefined
|
||||
, 'private' : undefined
|
||||
, 'protected' : undefined
|
||||
, 'public' : undefined
|
||||
, 'return' : colors.red
|
||||
, 'static' : undefined
|
||||
, 'super' : undefined
|
||||
, 'switch' : undefined
|
||||
|
||||
, 'this' : colors.brightRed
|
||||
, 'throw' : undefined
|
||||
, 'try' : colors.cyan
|
||||
, 'typeof' : undefined
|
||||
|
||||
, 'var' : colors.green
|
||||
, 'void' : undefined
|
||||
|
||||
, 'while' : undefined
|
||||
, 'with' : undefined
|
||||
, 'yield' : undefined
|
||||
, _default : colors.brightBlue
|
||||
}
|
||||
, 'Punctuator': {
|
||||
// setting semicolon's color to the same as the terminal background makes it invisible
|
||||
';': colors.black
|
||||
|
||||
, '.': colors.green
|
||||
, ',': colors.green
|
||||
|
||||
, '{': colors.yellow
|
||||
, '}': colors.yellow
|
||||
, '(': colors.brightBlack
|
||||
, ')': colors.brightBlack
|
||||
, '[': colors.yellow
|
||||
, ']': colors.yellow
|
||||
|
||||
, '<': undefined
|
||||
, '>': undefined
|
||||
, '+': undefined
|
||||
, '-': undefined
|
||||
, '*': undefined
|
||||
, '%': undefined
|
||||
, '&': undefined
|
||||
, '|': undefined
|
||||
, '^': undefined
|
||||
, '!': undefined
|
||||
, '~': undefined
|
||||
, '?': undefined
|
||||
, ':': undefined
|
||||
, '=': undefined
|
||||
|
||||
, '<=': undefined
|
||||
, '>=': undefined
|
||||
, '==': undefined
|
||||
, '!=': undefined
|
||||
, '++': undefined
|
||||
, '--': undefined
|
||||
, '<<': undefined
|
||||
, '>>': undefined
|
||||
, '&&': undefined
|
||||
, '||': undefined
|
||||
, '+=': undefined
|
||||
, '-=': undefined
|
||||
, '*=': undefined
|
||||
, '%=': undefined
|
||||
, '&=': undefined
|
||||
, '|=': undefined
|
||||
, '^=': undefined
|
||||
, '/=': undefined
|
||||
, '=>': undefined
|
||||
, '**': undefined
|
||||
|
||||
, '===': undefined
|
||||
, '!==': undefined
|
||||
, '>>>': undefined
|
||||
, '<<=': undefined
|
||||
, '>>=': undefined
|
||||
, '...': undefined
|
||||
, '**=': undefined
|
||||
|
||||
, '>>>=': undefined
|
||||
|
||||
, _default: colors.brightYellow
|
||||
}
|
||||
|
||||
// line comment
|
||||
, Line: {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
/* block comment */
|
||||
, Block: {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
// JSX
|
||||
, JSXAttribute: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXClosingElement: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXElement: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXEmptyExpression: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXExpressionContainer: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXIdentifier: {
|
||||
className: colors.blue
|
||||
, _default: colors.magenta
|
||||
}
|
||||
, JSXMemberExpression: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXNamespacedName: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXOpeningElement: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXSpreadAttribute: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXText: {
|
||||
_default: colors.brightGreen
|
||||
}
|
||||
, _default: undefined
|
||||
}
|
||||
169
html/sternwarte/checkfuehrung/node_modules/cardinal/themes/jq.js
generated
vendored
Executable file
169
html/sternwarte/checkfuehrung/node_modules/cardinal/themes/jq.js
generated
vendored
Executable file
@@ -0,0 +1,169 @@
|
||||
var colors = require('ansicolors')
|
||||
|
||||
// mimics [jq](https://stedolan.github.io/jq/) highlighting for json files
|
||||
// mainly in the fact that the keys are a clearly different color than the strings
|
||||
// However improvements to this theme are highly welcome! :)
|
||||
|
||||
// Change the below definitions in order to tweak the color theme.
|
||||
module.exports = {
|
||||
|
||||
'Boolean': {
|
||||
'true' : undefined
|
||||
, 'false' : undefined
|
||||
, _default : colors.brightRed
|
||||
}
|
||||
|
||||
, 'Identifier': {
|
||||
'undefined' : colors.brightBlack
|
||||
, 'self' : colors.brightRed
|
||||
, 'console' : colors.blue
|
||||
, 'log' : colors.blue
|
||||
, 'warn' : colors.red
|
||||
, 'error' : colors.brightRed
|
||||
, _default : colors.white
|
||||
}
|
||||
|
||||
, 'Null': {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
, 'Numeric': {
|
||||
_default: colors.blue
|
||||
}
|
||||
|
||||
, 'String': {
|
||||
_default: function(s, info) {
|
||||
var nextToken = info.tokens[info.tokenIndex + 1]
|
||||
|
||||
// show keys of object literals and json in different color
|
||||
return (nextToken && nextToken.type === 'Punctuator' && nextToken.value === ':')
|
||||
? colors.brightBlue(s)
|
||||
: colors.brightGreen(s)
|
||||
}
|
||||
}
|
||||
|
||||
, 'Keyword': {
|
||||
'break' : undefined
|
||||
|
||||
, 'case' : undefined
|
||||
, 'catch' : colors.cyan
|
||||
, 'class' : undefined
|
||||
, 'const' : undefined
|
||||
, 'continue' : undefined
|
||||
|
||||
, 'debugger' : undefined
|
||||
, 'default' : undefined
|
||||
, 'delete' : colors.red
|
||||
, 'do' : undefined
|
||||
|
||||
, 'else' : undefined
|
||||
, 'enum' : undefined
|
||||
, 'export' : undefined
|
||||
, 'extends' : undefined
|
||||
|
||||
, 'finally' : colors.cyan
|
||||
, 'for' : undefined
|
||||
, 'function' : undefined
|
||||
|
||||
, 'if' : undefined
|
||||
, 'implements' : undefined
|
||||
, 'import' : undefined
|
||||
, 'in' : undefined
|
||||
, 'instanceof' : undefined
|
||||
, 'let' : undefined
|
||||
, 'new' : colors.red
|
||||
, 'package' : undefined
|
||||
, 'private' : undefined
|
||||
, 'protected' : undefined
|
||||
, 'public' : undefined
|
||||
, 'return' : colors.red
|
||||
, 'static' : undefined
|
||||
, 'super' : undefined
|
||||
, 'switch' : undefined
|
||||
|
||||
, 'this' : colors.brightRed
|
||||
, 'throw' : undefined
|
||||
, 'try' : colors.cyan
|
||||
, 'typeof' : undefined
|
||||
|
||||
, 'var' : colors.green
|
||||
, 'void' : undefined
|
||||
|
||||
, 'while' : undefined
|
||||
, 'with' : undefined
|
||||
, 'yield' : undefined
|
||||
, _default : colors.brightBlue
|
||||
}
|
||||
, 'Punctuator': {
|
||||
';': colors.brightBlack
|
||||
, '.': colors.green
|
||||
, ',': colors.green
|
||||
|
||||
, '{': colors.brightWhite
|
||||
, '}': colors.brightWhite
|
||||
, '(': colors.brightBlack
|
||||
, ')': colors.brightBlack
|
||||
, '[': colors.brightWhite
|
||||
, ']': colors.brightWhite
|
||||
|
||||
, '<': undefined
|
||||
, '>': undefined
|
||||
, '+': undefined
|
||||
, '-': undefined
|
||||
, '*': undefined
|
||||
, '%': undefined
|
||||
, '&': undefined
|
||||
, '|': undefined
|
||||
, '^': undefined
|
||||
, '!': undefined
|
||||
, '~': undefined
|
||||
, '?': undefined
|
||||
, ':': undefined
|
||||
, '=': undefined
|
||||
|
||||
, '<=': undefined
|
||||
, '>=': undefined
|
||||
, '==': undefined
|
||||
, '!=': undefined
|
||||
, '++': undefined
|
||||
, '--': undefined
|
||||
, '<<': undefined
|
||||
, '>>': undefined
|
||||
, '&&': undefined
|
||||
, '||': undefined
|
||||
, '+=': undefined
|
||||
, '-=': undefined
|
||||
, '*=': undefined
|
||||
, '%=': undefined
|
||||
, '&=': undefined
|
||||
, '|=': undefined
|
||||
, '^=': undefined
|
||||
, '/=': undefined
|
||||
, '=>': undefined
|
||||
, '**': undefined
|
||||
|
||||
, '===': undefined
|
||||
, '!==': undefined
|
||||
, '>>>': undefined
|
||||
, '<<=': undefined
|
||||
, '>>=': undefined
|
||||
, '...': undefined
|
||||
, '**=': undefined
|
||||
|
||||
, '>>>=': undefined
|
||||
|
||||
, _default: colors.brightYellow
|
||||
}
|
||||
|
||||
// line comment
|
||||
, Line: {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
/* block comment */
|
||||
, Block: {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
, _default: undefined
|
||||
}
|
||||
215
html/sternwarte/checkfuehrung/node_modules/cardinal/themes/tomorrow-night.js
generated
vendored
Executable file
215
html/sternwarte/checkfuehrung/node_modules/cardinal/themes/tomorrow-night.js
generated
vendored
Executable file
@@ -0,0 +1,215 @@
|
||||
var colors = require('ansicolors')
|
||||
|
||||
// Change the below definitions in order to tweak the color theme.
|
||||
module.exports = {
|
||||
|
||||
'Boolean': {
|
||||
'true' : undefined
|
||||
, 'false' : undefined
|
||||
, _default : colors.yellow
|
||||
}
|
||||
|
||||
, 'Identifier': {
|
||||
'undefined' : colors.yellow
|
||||
, 'self' : colors.yellow
|
||||
, 'type' : colors.yellow
|
||||
, 'value' : colors.yellow
|
||||
, 'console' : undefined
|
||||
, 'log' : colors.blue
|
||||
, 'warn' : colors.blue
|
||||
, 'error' : colors.blue
|
||||
, 'join' : colors.blue
|
||||
, _default : function(s, info) {
|
||||
var prevToken = info.tokens[info.tokenIndex - 1]
|
||||
var nextToken = info.tokens[info.tokenIndex + 1]
|
||||
|
||||
return (nextToken
|
||||
&& nextToken.type === 'Punctuator'
|
||||
&& nextToken.value === '('
|
||||
&& prevToken
|
||||
&& prevToken.type === 'Keyword'
|
||||
&& prevToken.value === 'function'
|
||||
) ? colors.blue(s) : colors.white(s)
|
||||
}
|
||||
}
|
||||
|
||||
, 'Null': {
|
||||
_default: colors.yellow
|
||||
}
|
||||
|
||||
, 'Numeric': {
|
||||
_default: colors.yellow
|
||||
}
|
||||
|
||||
, 'String': {
|
||||
_default: function(s, info) {
|
||||
var nextToken = info.tokens[info.tokenIndex + 1]
|
||||
|
||||
// show keys of object literals and json in different color
|
||||
return (nextToken && nextToken.type === 'Punctuator' && nextToken.value === ':')
|
||||
? colors.green(s)
|
||||
: colors.brightGreen(s)
|
||||
}
|
||||
}
|
||||
|
||||
, 'Keyword': {
|
||||
'break' : colors.magenta
|
||||
|
||||
, 'case' : colors.magenta
|
||||
, 'catch' : colors.magenta
|
||||
, 'class' : undefined
|
||||
, 'const' : undefined
|
||||
, 'continue' : colors.magenta
|
||||
|
||||
, 'debugger' : colors.magenta
|
||||
, 'default' : colors.magenta
|
||||
, 'delete' : colors.red
|
||||
, 'do' : colors.magenta
|
||||
|
||||
, 'else' : colors.magenta
|
||||
, 'enum' : undefined
|
||||
, 'export' : undefined
|
||||
, 'extends' : undefined
|
||||
|
||||
, 'finally' : colors.magenta
|
||||
, 'for' : colors.magenta
|
||||
, 'function' : colors.magenta
|
||||
|
||||
, 'if' : colors.magenta
|
||||
, 'implements' : undefined
|
||||
, 'import' : undefined
|
||||
, 'in' : colors.cyan
|
||||
, 'instanceof' : colors.cyan
|
||||
, 'let' : undefined
|
||||
, 'new' : colors.cyan
|
||||
, 'package' : undefined
|
||||
, 'private' : undefined
|
||||
, 'protected' : undefined
|
||||
, 'public' : undefined
|
||||
, 'return' : colors.magenta
|
||||
, 'static' : undefined
|
||||
, 'super' : undefined
|
||||
, 'switch' : colors.magenta
|
||||
|
||||
, 'this' : colors.red
|
||||
, 'throw' : colors.magenta
|
||||
, 'try' : colors.magenta
|
||||
, 'typeof' : colors.cyan
|
||||
|
||||
, 'var' : colors.magenta
|
||||
, 'void' : colors.magenta
|
||||
|
||||
, 'while' : colors.magenta
|
||||
, 'with' : colors.cyan
|
||||
, 'yield' : undefined
|
||||
, _default : colors.white
|
||||
}
|
||||
, 'Punctuator': {
|
||||
';': colors.white
|
||||
, '.': colors.white
|
||||
, ',': colors.white
|
||||
|
||||
, '{': colors.white
|
||||
, '}': colors.white
|
||||
, '(': colors.white
|
||||
, ')': colors.white
|
||||
, '[': colors.white
|
||||
, ']': colors.white
|
||||
|
||||
, '<': undefined
|
||||
, '>': undefined
|
||||
, '+': undefined
|
||||
, '-': undefined
|
||||
, '*': undefined
|
||||
, '%': undefined
|
||||
, '&': undefined
|
||||
, '|': colors.white
|
||||
, '^': undefined
|
||||
, '!': undefined
|
||||
, '~': undefined
|
||||
, '?': colors.white
|
||||
, ':': colors.white
|
||||
, '=': undefined
|
||||
|
||||
, '<=': undefined
|
||||
, '>=': undefined
|
||||
, '==': undefined
|
||||
, '!=': undefined
|
||||
, '++': undefined
|
||||
, '--': undefined
|
||||
, '<<': undefined
|
||||
, '>>': undefined
|
||||
, '&&': undefined
|
||||
, '||': undefined
|
||||
, '+=': undefined
|
||||
, '-=': undefined
|
||||
, '*=': undefined
|
||||
, '%=': undefined
|
||||
, '&=': undefined
|
||||
, '|=': undefined
|
||||
, '^=': undefined
|
||||
, '/=': undefined
|
||||
, '=>': undefined
|
||||
, '**': undefined
|
||||
|
||||
, '===': undefined
|
||||
, '!==': undefined
|
||||
, '>>>': undefined
|
||||
, '<<=': undefined
|
||||
, '>>=': undefined
|
||||
, '...': undefined
|
||||
, '**=': undefined
|
||||
|
||||
, '>>>=': undefined
|
||||
|
||||
, _default: colors.cyan
|
||||
}
|
||||
|
||||
// line comment
|
||||
, Line: {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
/* block comment */
|
||||
, Block: {
|
||||
_default: colors.brightBlack
|
||||
}
|
||||
|
||||
// JSX
|
||||
, JSXAttribute: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXClosingElement: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXElement: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXEmptyExpression: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXExpressionContainer: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXIdentifier: {
|
||||
className: colors.blue
|
||||
, _default: colors.magenta
|
||||
}
|
||||
, JSXMemberExpression: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXNamespacedName: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXOpeningElement: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXSpreadAttribute: {
|
||||
_default: colors.magenta
|
||||
}
|
||||
, JSXText: {
|
||||
_default: colors.brightGreen
|
||||
}
|
||||
|
||||
, _default: undefined
|
||||
}
|
||||
12
html/sternwarte/checkfuehrung/node_modules/cardinal/utl.js
generated
vendored
Executable file
12
html/sternwarte/checkfuehrung/node_modules/cardinal/utl.js
generated
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
var util = require('util')
|
||||
|
||||
module.exports.isPath = function(s) {
|
||||
return (/[/\\]/).test(s)
|
||||
}
|
||||
|
||||
module.exports.inspect = function(obj, depth) {
|
||||
console.log(util.inspect(obj, false, depth || 5, true))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user