feature: vor und nachteile

This commit is contained in:
Hikyu
2026-05-31 13:54:31 +02:00
parent 552a947a1c
commit e3dad17446
23270 changed files with 3024794 additions and 200 deletions
+19
View File
@@ -0,0 +1,19 @@
Copyright (C) 2015 by Markus Hedvall
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.
+48
View File
@@ -0,0 +1,48 @@
# plantuml-encoder
PlantUML encoder for browsers and Node.js.
[![npm Version](https://img.shields.io/npm/v/plantuml-encoder.svg)](https://www.npmjs.com/package/plantuml-encoder) [![build-status](https://travis-ci.org/markushedvall/plantuml-encoder.svg?branch=master)](https://travis-ci.org/markushedvall/plantuml-encoder) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
Encoded PlantUML can be used to create PlantUML URL links.
# Install
Node.js:
```
npm install plantuml-encoder
```
browser:
```
bower install plantuml-encoder
```
# Example
```javascript
var plantumlEncoder = require('plantuml-encoder')
var encoded = plantumlEncoder.encode('A -> B: Hello')
console.log(encoded) // SrJGjLDmibBmICt9oGS0
var url = 'http://www.plantuml.com/plantuml/img/' + encoded
```
The URL can then be used to display the diagram:
![alt tag](http://www.plantuml.com/plantuml/img/SrJGjLDmibBmICt9oGS0)
# Decode example
```javascript
var plantumlEncoder = require('plantuml-encoder')
var plain = plantumlEncoder.decode('SrJGjLDmibBmICt9oGS0')
console.log(plain) // A -> B: Hello
```
# License
MIT
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
encode: require('./dist/plantuml-encoder').encode,
decode: require('./dist/plantuml-decoder').decode
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
encode: require('./lib/encoder').encode,
decode: require('./lib/decoder').decode
}
+7
View File
@@ -0,0 +1,7 @@
'use strict'
var pako = require('pako/lib/deflate.js')
module.exports = function (data) {
return pako.deflateRaw(data, { level: 9, to: 'string' })
}
+7
View File
@@ -0,0 +1,7 @@
'use strict'
var pako = require('pako/lib/inflate.js')
module.exports = function (data) {
return pako.inflateRaw(data, { to: 'string' })
}
+41
View File
@@ -0,0 +1,41 @@
'use strict'
// Reverse of
// http://plantuml.sourceforge.net/codejavascript2.html
// It is described as being "a transformation close to base64"
// The code has been slightly modified to pass linters
function decode6bit (cc) {
var c = cc.charCodeAt(0)
if (cc === '_') return 63
if (cc === '-') return 62
if (c >= 97) return c - 61 // - 97 + 26 + 10
if (c >= 65) return c - 55 // - 65 + 10
if (c >= 48) return c - 48
return '?'
}
function extract3bytes (data) {
var c1 = decode6bit(data[0])
var c2 = decode6bit(data[1])
var c3 = decode6bit(data[2])
var c4 = decode6bit(data[3])
var b1 = c1 << 2 | (c2 >> 4) & 0x3F
var b2 = (c2 << 4) & 0xF0 | (c3 >> 2) & 0xF
var b3 = (c3 << 6) & 0xC0 | c4 & 0x3F
return [b1, b2, b3]
}
module.exports = function (data) {
var r = ''
var i = 0
for (i = 0; i < data.length; i += 4) {
var t = extract3bytes(data.substring(i, i + 4))
r = r + String.fromCharCode(t[0])
r = r + String.fromCharCode(t[1])
r = r + String.fromCharCode(t[2])
}
return r
}
+9
View File
@@ -0,0 +1,9 @@
'use strict'
var inflate = require('./inflate')
var decode64 = require('./decode64')
module.exports.decode = function (encoded) {
var deflated = decode64(encoded)
return inflate(deflated)
}
+7
View File
@@ -0,0 +1,7 @@
'use strict'
const zlib = require('zlib')
module.exports = function (data) {
return zlib.deflateRawSync(data, { level: 9 }).toString('binary')
}
+58
View File
@@ -0,0 +1,58 @@
'use strict'
// Encode code taken from the PlantUML website:
// http://plantuml.sourceforge.net/codejavascript2.html
// It is described as being "a transformation close to base64"
// The code has been slightly modified to pass linters
function encode6bit (b) {
if (b < 10) {
return String.fromCharCode(48 + b)
}
b -= 10
if (b < 26) {
return String.fromCharCode(65 + b)
}
b -= 26
if (b < 26) {
return String.fromCharCode(97 + b)
}
b -= 26
if (b === 0) {
return '-'
}
if (b === 1) {
return '_'
}
return '?'
}
function append3bytes (b1, b2, b3) {
var c1 = b1 >> 2
var c2 = ((b1 & 0x3) << 4) | (b2 >> 4)
var c3 = ((b2 & 0xF) << 2) | (b3 >> 6)
var c4 = b3 & 0x3F
var r = ''
r += encode6bit(c1 & 0x3F)
r += encode6bit(c2 & 0x3F)
r += encode6bit(c3 & 0x3F)
r += encode6bit(c4 & 0x3F)
return r
}
module.exports = function (data) {
var r = ''
for (var i = 0; i < data.length; i += 3) {
if (i + 2 === data.length) {
r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), 0)
} else if (i + 1 === data.length) {
r += append3bytes(data.charCodeAt(i), 0, 0)
} else {
r += append3bytes(data.charCodeAt(i),
data.charCodeAt(i + 1),
data.charCodeAt(i + 2))
}
}
return r
}
+9
View File
@@ -0,0 +1,9 @@
'use strict'
var deflate = require('./deflate')
var encode64 = require('./encode64')
module.exports.encode = function (puml) {
var deflated = deflate(puml)
return encode64(deflated)
}
+7
View File
@@ -0,0 +1,7 @@
'use strict'
const zlib = require('zlib')
module.exports = function (data) {
return zlib.inflateRawSync(Buffer.from(data, 'binary')).toString()
}
+45
View File
@@ -0,0 +1,45 @@
{
"name": "plantuml-encoder",
"version": "1.4.0",
"description": "PlantUML encoder for browsers and Node.js",
"author": "Markus Hedvall <mackanhedvall@gmail.com>",
"repository": "https://github.com/markushedvall/plantuml-encoder",
"license": "MIT",
"keywords": [
"plantuml",
"encoder"
],
"main": "index.js",
"browser": {
"./lib/deflate.js": "./lib/browser-deflate.js",
"./lib/inflate.js": "./lib/browser-inflate.js",
"./index.js": "./browser-index.js"
},
"devDependencies": {
"pako": "=1.0.10",
"browserify": "^16.x",
"chai": "^4.x",
"mocha": "^6.x",
"standard": "^13.x",
"uglify-js": "^3.x"
},
"files": [
"index.js",
"browser-index.js",
"lib/",
"dist/"
],
"scripts": {
"test": "standard && mocha",
"build": "npm run browserify && npm run uglify",
"browserify": "npm run browserifyEncoder && npm run browserifyDecoder",
"browserifyEncoder": "browserify lib/encoder.js -s plantumlEncoder -o dist/plantuml-encoder.js",
"browserifyDecoder": "browserify lib/decoder.js -s plantumlEncoder -o dist/plantuml-decoder.js",
"uglify": "npm run uglifyEncoder && npm run uglifyDecoder",
"uglifyEncoder": "uglifyjs dist/plantuml-encoder.js -c -m -o dist/plantuml-encoder.min.js",
"uglifyDecoder": "uglifyjs dist/plantuml-decoder.js -c -m -o dist/plantuml-decoder.min.js"
},
"standard": {
"ignore": "dist/"
}
}