| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| #!/bin/bash | ||
| set -e | ||
| yarn run build && NODE_PATH=build node build/build-doc.js |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| #!/bin/bash | ||
| set -e | ||
| yarn run build && NODE_PATH="build/" node build/cli-integration-tests.js |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #!/bin/bash | ||
| # | ||
| set -e | ||
| yarn run build && NODE_PATH="build/" node build/fuzzing.js |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| nodeLinker: node-modules |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| import { EmojiButton } from '../../build/lib/@joeattardi/emoji-button/dist/index.js'; | ||
| window.EmojiButton = EmojiButton; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,6 +154,10 @@ body, button { | |
| font-size: 16px; | ||
| } | ||
|
|
||
| div, span, a { | ||
| font-family: Roboto; | ||
| } | ||
|
|
||
| h2 { | ||
| font-size: 24px; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| const fs = require('fs-extra'); | ||
| const glob = require('glob'); | ||
| const { resolve } = require('path'); | ||
| const { copyDir, dirname, copyFile, mkdir } = require('@joplin/tools/gulp/utils'); | ||
|
|
||
| const nodeModulesDir = resolve(__dirname, '../node_modules'); | ||
|
|
||
| async function main() { | ||
| const langSourceDir = resolve(__dirname, '../../../Assets/TinyMCE/langs'); | ||
| const buildLibDir = resolve(__dirname, '../build/lib'); | ||
|
|
||
| const dirs = [ | ||
| 'tinymce', | ||
| '@fortawesome/fontawesome-free/webfonts', | ||
| 'roboto-fontface/fonts', | ||
| 'codemirror/theme', | ||
| { | ||
| src: langSourceDir, | ||
| dest: `${buildLibDir}/tinymce/langs`, | ||
| }, | ||
| ]; | ||
|
|
||
| const files = [ | ||
| '@fortawesome/fontawesome-free/css/all.min.css', | ||
| 'react-datetime/css/react-datetime.css', | ||
| 'smalltalk/css/smalltalk.css', | ||
| 'roboto-fontface/css/roboto/roboto-fontface.css', | ||
| 'codemirror/lib/codemirror.css', | ||
| 'codemirror/addon/dialog/dialog.css', | ||
| '@joeattardi/emoji-button/dist/index.js', | ||
| 'mark.js/dist/mark.min.js', | ||
| { | ||
| src: resolve(__dirname, '../../lib/services/plugins/sandboxProxy.js'), | ||
| dest: `${buildLibDir}/@joplin/lib/services/plugins/sandboxProxy.js`, | ||
| }, | ||
| ]; | ||
|
|
||
| for (const dir of dirs) { | ||
| let sourceDir, destDir; | ||
|
|
||
| if (typeof dir !== 'string') { | ||
| sourceDir = dir.src; | ||
| destDir = dir.dest; | ||
| } else { | ||
| sourceDir = `${nodeModulesDir}/${dir}`; | ||
| destDir = `${buildLibDir}/${dir}`; | ||
| } | ||
|
|
||
| console.info(`Copying ${sourceDir} => ${destDir}`); | ||
| await mkdir(destDir); | ||
| await copyDir(sourceDir, destDir); | ||
| } | ||
|
|
||
| for (const file of files) { | ||
| let sourceFile, destFile; | ||
|
|
||
| if (typeof file !== 'string') { | ||
| sourceFile = file.src; | ||
| destFile = file.dest; | ||
| } else { | ||
| sourceFile = `${nodeModulesDir}/${file}`; | ||
| destFile = `${buildLibDir}/${file}`; | ||
| } | ||
|
|
||
| await mkdir(dirname(destFile)); | ||
|
|
||
| console.info(`Copying ${sourceFile} => ${destFile}`); | ||
| await copyFile(sourceFile, destFile); | ||
| } | ||
|
|
||
| const supportedLocales = glob.sync(`${langSourceDir}/*.js`).map(s => { | ||
| s = s.split('/'); | ||
| s = s[s.length - 1]; | ||
| s = s.split('.'); | ||
| return s[0]; | ||
| }); | ||
|
|
||
| const content = `module.exports = ${JSON.stringify(supportedLocales, null, 2)}`; | ||
|
|
||
| await fs.writeFile(`${__dirname}/../gui/NoteEditor/NoteBody/TinyMCE/supportedLocales.js`, content, 'utf8'); | ||
| } | ||
|
|
||
| module.exports = main; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,19 @@ | ||
| // We don't make that a gulp task because we might want to run it before | ||
| // gulp has been installed. | ||
|
|
||
| const fs = require('fs'); | ||
|
|
||
| function main() { | ||
| const mobileDir = `${__dirname}/..`; | ||
| fs.rmSync(`${mobileDir}/android/.gradle`, { recursive: true, force: true }); | ||
| fs.rmSync(`${mobileDir}/android/app/build`, { recursive: true, force: true }); | ||
| fs.rmSync(`${mobileDir}/ios/Pods`, { recursive: true, force: true }); | ||
| console.info('To clean the Android build, in some rare cases you might also need to clear the cache in ~/.android and ~/.gradle'); | ||
| } | ||
|
|
||
| try { | ||
| main(); | ||
| } catch (error) { | ||
| console.error('Could not clean mobile app build', error); | ||
| process.exit(1); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| Copyright (c) 2012 Jeremy Selier | ||
|
|
||
| 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. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Uslug.js | ||
|
|
||
| * * * | ||
|
|
||
| Modified for Joplin: | ||
|
|
||
| - Added support for emojis - "🐶🐶🐶🐱" => "dogdogdogcat" | ||
|
|
||
| * * * | ||
|
|
||
| Permissive slug generator that works with unicode. | ||
| We keep only characters from the categories Letter, Number and Separator (see [Unicode Categories](http://www.unicode.org/versions/Unicode6.0.0/ch04.pdf)) | ||
| and the common [CJK Unified Ideographs](http://www.unicode.org/versions/Unicode6.0.0/ch12.pdf) as defined in the version 6.0.0 of the Unicode specification. | ||
|
|
||
| Inspired by [unicode-slugify](https://github.com/mozilla/unicode-slugify). | ||
| Note that this slug generator is different from [node-slug](https://github.com/dodo/node-slug) which focus on translating unicode characters to english or latin equivalent. | ||
|
|
||
|
|
||
| ## Quick Examples | ||
|
|
||
| uslug('Быстрее и лучше!') // 'быстрее-и-лучше' | ||
| uslug('汉语/漢語') // '汉语漢語' | ||
|
|
||
| uslug('Y U NO', { lower: false })) // 'Y-U-NO' | ||
| uslug('Y U NO', { spaces: true })) // 'y u no' | ||
| uslug('Y-U|NO', { allowedChars: '|' })) // 'yu|no' | ||
|
|
||
|
|
||
| ## Installation | ||
|
|
||
| npm install uslug | ||
|
|
||
|
|
||
| ## Options | ||
|
|
||
| ### uslug(string, options) | ||
|
|
||
| Generate a slug for the string passed. | ||
|
|
||
| __Arguments__ | ||
|
|
||
| * string - The string you want to slugify. | ||
| * options - An optional object that can contain: | ||
| * allowedChars: a String of chars that you want to be whitelisted. Default: '-_~'. | ||
| * lower: a Boolean to force to lower case the slug. Default: true. | ||
| * spaces: a Boolean to allow spaces. Default: false. | ||
|
|
||
|
|
||
| ## License | ||
|
|
||
| This project is distributed under the MIT License. See LICENSE file for more information. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| module.exports = require('./lib/uslug'); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /* | ||
| * List of Unicode code that are flagged as separator. | ||
| * | ||
| * Contains Unicode code of: | ||
| * - Zs = Separator, space | ||
| * - Zl = Separator, line | ||
| * - Zp = Separator, paragraph | ||
| * | ||
| * This list has been computed from http://unicode.org/Public/UNIDATA/UnicodeData.txt | ||
| * curl -s http://unicode.org/Public/UNIDATA/UnicodeData.txt | grep -E ';Zs;|;Zl;|;Zp;' | cut -d \; -f 1 | xargs -I{} printf '%d, ' 0x{} | ||
| * | ||
| */ | ||
| exports.Z = [32, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| (function() { | ||
| var L = require('./L').L, | ||
| N = require('./N').N, | ||
| Z = require('./Z').Z, | ||
| M = require('./M').M, | ||
| unorm = require('unorm'); | ||
|
|
||
| var nodeEmoji = require('node-emoji') | ||
|
|
||
| var _unicodeCategory = function(code) { | ||
| if (~L.indexOf(code)) return 'L'; | ||
| if (~N.indexOf(code)) return 'N'; | ||
| if (~Z.indexOf(code)) return 'Z'; | ||
| if (~M.indexOf(code)) return 'M'; | ||
| return undefined; | ||
| }; | ||
|
|
||
| module.exports = function(string, options) { | ||
| string = string || ''; | ||
| options = options || {}; | ||
| var allowedChars = options.allowedChars || '-_~'; | ||
| var lower = typeof options.lower === 'boolean' ? options.lower : true; | ||
| var spaces = typeof options.spaces === 'boolean' ? options.spaces : false; | ||
| var rv = []; | ||
| var noEmojiString = nodeEmoji.unemojify(string); | ||
| var chars = unorm.nfkc(noEmojiString); | ||
| for(var i = 0; i < chars.length; i++) { | ||
| var c = chars[i]; | ||
| var code = c.charCodeAt(0); | ||
| // Allow Common CJK Unified Ideographs | ||
| // See: http://www.unicode.org/versions/Unicode6.0.0/ch12.pdf - Table 12-2 | ||
| if (0x4E00 <= code && code <= 0x9FFF) { | ||
| rv.push(c); | ||
| continue; | ||
| } | ||
|
|
||
| // Allow Hangul | ||
| if (0xAC00 <= code && code <= 0xD7A3) { | ||
| rv.push(c); | ||
| continue; | ||
| } | ||
|
|
||
| // Japanese ideographic punctuation | ||
| if ((0x3000 <= code && code <= 0x3002) || (0xFF01 <= code && code <= 0xFF02)) { | ||
| rv.push(' '); | ||
| } | ||
|
|
||
| if (allowedChars.indexOf(c) != -1) { | ||
| rv.push(c); | ||
| continue; | ||
| } | ||
| var val = _unicodeCategory(code); | ||
| if (val && ~'LNM'.indexOf(val)) rv.push(c); | ||
| if (val && ~'Z'.indexOf(val)) rv.push(' '); | ||
| } | ||
| var slug = rv.join('').replace(/^\s+|\s+$/g, '').replace(/\s+/g,' '); | ||
| if (!spaces) slug = slug.replace(/[\s\-]+/g,'-'); | ||
| if (lower) slug = slug.toLowerCase(); | ||
| return slug; | ||
| }; | ||
| }()); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "name": "@joplin/fork-uslug", | ||
| "version": "1.0.4", | ||
| "description": "A permissive slug generator that works with unicode.", | ||
| "author": "Jeremy Selier <jerem.selier@gmail.com>", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "node-emoji": "1.11.0", | ||
| "unorm": ">= 1.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "should": ">= 0.2.1" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "http://github.com/jeremys/uslug.git" | ||
| }, | ||
| "main": "./index", | ||
| "engines": { | ||
| "node": ">= 0.4.0" | ||
| }, | ||
| "bugs": { | ||
| "url": "http://github.com/jeremys/uslug/issues" | ||
| }, | ||
| "licenses": [ | ||
| { | ||
| "type": "MIT", | ||
| "url": "http://github.com/jeremys/uslug/raw/master/LICENSE" | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| var should = require('should'), | ||
| uslug = require('../lib/uslug'); | ||
|
|
||
|
|
||
| var word0 = 'Ελληνικά'; | ||
| var word1 = [word0, word0].join('-'); | ||
| var word2 = [word0, word0].join(' - '); | ||
|
|
||
| var tests = [ | ||
| ['', ''], | ||
| ['The \u212B symbol invented by A. J. \u00C5ngstr\u00F6m (1814, L\u00F6gd\u00F6, \u2013 1874) denotes the length 10\u207B\u00B9\u2070 m.', 'the-å-symbol-invented-by-a-j-ångström-1814-lögdö-1874-denotes-the-length-1010-m'], | ||
| ['Быстрее и лучше!', 'быстрее-и-лучше'], | ||
| ['xx x - "#$@ x', 'xx-x-x'], | ||
| ['Bän...g (bang)', 'bäng-bang'], | ||
| [word0, word0.toLowerCase()], | ||
| [word1, word1.toLowerCase()], | ||
| [word2, word1.toLowerCase()], | ||
| [' a ', 'a'], | ||
| ['tags/', 'tags'], | ||
| ['y_u_no', 'y_u_no'], | ||
| ['el-ni\xf1o', 'el-ni\xf1o'], | ||
| ['x荿', 'x荿'], | ||
| ['ϧ蒬蓣', '\u03e7蒬蓣'], | ||
| ['¿x', 'x'], | ||
| ['汉语/漢語', '汉语漢語'], | ||
| ['فار,سي', 'فارسي'], | ||
| ['เแโ|ใไ', 'เแโใไ'], | ||
| ['日本語ドキュメンテ(ーション)', '日本語ドキュメンテーション'], | ||
| ['一二三四五六七八九十!。。。', '一二三四五六七八九十'], | ||
| ['संसद में काम नहीं तो वेतन क्यों?', 'संसद-में-काम-नहीं-तो-वेतन-क्यों'], | ||
| ['เร่งรัด \'ปรับเงินเดือนท้องถิ่น 1 ขั้น\' ตามมติ ครม.', 'เร่งรัด-ปรับเงินเดือนท้องถิ่น-1-ขั้น-ตามมติ-ครม'], | ||
| ['オバマ大統領が病院爆撃の調査へ同意するように、協力してください!', 'オバマ大統領が病院爆撃の調査へ同意するように-協力してください'], | ||
| ['일본정부 법무대신(法務大臣): 우리는 일본 입관법의 재검토를 요구한다!', '일본정부-법무대신法務大臣-우리는-일본-입관법의-재검토를-요구한다'], | ||
| ['😁', 'grin'], | ||
| ['😁a', 'grina'], | ||
| ['🐶🐶🐶🐱', 'dogdogdogcat'], | ||
| ]; | ||
|
|
||
| for (var t in tests) { | ||
| var test = tests[t]; | ||
| uslug(test[0]).should.equal(test[1]); | ||
| } | ||
|
|
||
| uslug('qbc,fe', { allowedChars: 'q' }).should.equal('qbcfe'); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
| }, | ||
| "scripts": { | ||
| "test": "jest", | ||
| "test-ci": "yarn test" | ||
| }, | ||
| "files": [ | ||
| "generators" | ||
|
|
||