Yuki Takei 9 лет назад
Родитель
Сommit
01c1292956

+ 12 - 0
packages/growi-plugin-lsx/.babelrc

@@ -0,0 +1,12 @@
+{
+  "presets": [
+    "es2015"
+  ],
+  "env": {
+    "development": {
+      "presets": [
+        "power-assert"
+      ]
+    }
+  }
+}

+ 13 - 0
packages/growi-plugin-lsx/.editorconfig

@@ -0,0 +1,13 @@
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+insert_final_newline = false
+trim_trailing_whitespace = false

+ 36 - 0
packages/growi-plugin-lsx/.gitignore

@@ -0,0 +1,36 @@
+# Logs
+logs
+*.log
+npm-debug.log.*
+
+# OS generated files #
+.DS_Store
+.Trash-*
+ehthumbs.db
+Icon?
+Thumbs.db
+
+# Node Files #
+/node_modules/
+/bower_components/
+npm-debug.log
+/npm-debug.log.*
+
+# Dist #
+/dist
+/lib
+/public/__build__/
+/src/*/__build__/
+/__build__/**
+/public/dist/
+/src/*/dist/
+/.awcache
+.webpack.json
+/compiled/
+
+# Doc #
+/doc/
+
+# IDE #
+.idea
+.vscode

+ 21 - 0
packages/growi-plugin-lsx/LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 Yuki Takei
+
+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.

+ 12 - 0
packages/growi-plugin-lsx/README.md

@@ -0,0 +1,12 @@
+# crowi-plugin-lsx
+The Crowi Plugin to add lsx tag like [Pukiwiki lsx plugin](http://ukiya.sakura.ne.jp/index.php?PukiWiki%2F1.4%2F%E3%83%9E%E3%83%8B%E3%83%A5%E3%82%A2%E3%83%AB%2F%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3%2F%E7%8B%AC%E8%87%AA%E3%81%AB%E8%BF%BD%E5%8A%A0%E3%81%97%E3%81%9F%E3%82%82%E3%81%AE%2Flsx)
+
+Overview
+----------
+
+(TBD)
+
+Install
+--------
+
+(TBD)

+ 29 - 0
packages/growi-plugin-lsx/package.json

@@ -0,0 +1,29 @@
+{
+  "name": "crowi-plugin-lsx",
+  "version": "1.0.0",
+  "description": "The Crowi Plugin to add lsx tag",
+  "main": "lib/index.js",
+  "files": ["lib"],
+  "scripts": {
+    "build": "NODE_ENV=production babel src --out-dir lib --source-maps inline",
+    "watch": "babel src --out-dir lib --watch --source-maps inline",
+    "test": "mocha --compilers js:babel-register test/*.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/yuki-takei/crowi-plugin-lsx.git"
+  },
+  "author": "Yuki Takei <yuki@weseek.co.jp>",
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/yuki-takei/crowi-plugin-lsx/issues"
+  },
+  "homepage": "https://github.com/yuki-takei/crowi-plugin-lsx#readme",
+  "devDependencies": {
+    "babel-cli": "^6.23.0",
+    "babel-preset-es2015": "^6.22.0",
+    "babel-preset-power-assert": "^1.0.0",
+    "babel-register": "^6.23.0",
+    "power-assert": "^1.4.2"
+  }
+}

+ 6 - 0
packages/growi-plugin-lsx/src/client-entry.js

@@ -0,0 +1,6 @@
+import { LsxPreProcessor } from './resource/js/util/PreProcessor/LsxPreProcessor';
+
+export default (crowi, crowiRenderer) => {
+  crowiRenderer.preProcessors = crowiRenderer.preProcessors.concat(
+        crowiRenderer.preProcessors, [new LsxPreProcessor()]);
+}

+ 1 - 0
packages/growi-plugin-lsx/src/index.js

@@ -0,0 +1 @@
+export * from './meta';

+ 7 - 0
packages/growi-plugin-lsx/src/meta.js

@@ -0,0 +1,7 @@
+export const meta = {
+  pluginSchemaVersion: 2,
+  serverEntries: [],
+  clientEntries: [
+    './client-entry.js'
+  ]
+}

+ 9 - 0
packages/growi-plugin-lsx/src/resource/js/util/PreProcessor/LsxPreProcessor.js

@@ -0,0 +1,9 @@
+export class LsxPreProcessor {
+  process(markdown) {
+    return markdown
+      // see: https://regex101.com/r/NQq3s9/2
+      .replace(/\$lsx\((.*)\)/g, function(all, group1) {
+        return `$lsx tag called!! (option='${group1}')`;
+      });
+  }
+}