-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
15,084 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"presets": [ | ||
["env", { | ||
"modules": false | ||
}] | ||
], | ||
"env": { | ||
"test": { | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"node": "current" | ||
} | ||
}] | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
version: 2 | ||
jobs: | ||
python: | ||
parallelism: 1 | ||
docker: | ||
- image: circleci/python:3.7 | ||
steps: | ||
- checkout | ||
- run: | ||
name: install yamllint | ||
command: | | ||
sudo pip install yamllint | ||
- run: | ||
name: run yamllint | ||
command: ./script/test/yamllint.sh | ||
node: | ||
parallelism: 1 | ||
docker: | ||
- image: circleci/node:14 | ||
steps: | ||
- checkout | ||
- run: | ||
name: get test dependency | ||
command: npm install | ||
- run: | ||
name: run eslint | ||
command: ./script/test/eslint.sh | ||
|
||
workflows: | ||
version: 2 | ||
all: | ||
jobs: | ||
- python | ||
- node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
|
||
env: | ||
browser: true | ||
es6: true | ||
node: true | ||
jest/globals: true | ||
extends: | ||
- 'eslint:recommended' | ||
- 'plugin:vue/essential' | ||
- airbnb-base | ||
- 'plugin:prettier/recommended' | ||
globals: | ||
Atomics: readonly | ||
SharedArrayBuffer: readonly | ||
parserOptions: | ||
ecmaVersion: 2018 | ||
sourceType: module | ||
plugins: | ||
- vue | ||
- jest | ||
rules: | ||
prefer-destructuring: off | ||
no-console: off | ||
no-loop-func: off | ||
prettier/prettier: | ||
- error | ||
- singleQuote: true | ||
trailingComma: all | ||
arrowParens: always | ||
no-param-reassign: | ||
- error | ||
- props: false | ||
import/no-extraneous-dependencies: | ||
- error | ||
- devDependencies: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build/mac/bin/* filter=lfs diff=lfs merge=lfs -text | ||
build/win/bin/* filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
assets/dist/ | ||
!assets/dist/.keep | ||
|
||
dist | ||
!dist/.keep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
# proofreading-tool | ||
proofreading-tool | ||
=== | ||
|
||
GUIで動作する文書校正ツール | ||
|
||
# ビルド方法 | ||
|
||
## 開発環境構築 | ||
```bash | ||
# 依存関係の取得 | ||
npm install | ||
# webpackのビルド | ||
npm run webpack # or `npm run webpack-prod` or `npm run webpack-watch` | ||
``` | ||
|
||
## デバッグ実行 | ||
```bash | ||
npm start | ||
``` | ||
|
||
## テスト | ||
```bash | ||
npm run lint # or `npm run lint-fix` (prettierの機能でlint修正が自動適用される) | ||
``` | ||
|
||
## アプリのビルド | ||
```bash | ||
npm run dist # or `npm run dist-win` | ||
``` | ||
ビルドされたファイルは `dist/` フォルダ下に吐かれるはず。 | ||
|
||
# ライセンスについて | ||
このツールで使用している[xpdf(pdftotext)](https://www.xpdfreader.com/)がGPLv2 or v3 licenseのため、このツールを外部に再配布する際はGPLv2 or v3 licenseで配布する必要がある。 | ||
社内共有のみの場合は気にする必要はない。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import 'bootstrap/dist/css/bootstrap.min.css'; | ||
|
||
import Vue from 'vue'; | ||
import 'bootstrap'; | ||
|
||
import Mark from 'mark.js'; | ||
|
||
import { ipcRenderer } from 'electron'; | ||
|
||
Vue.directive('highlight-range', (el, binding) => { | ||
const markInstance = new Mark(el); | ||
const indices = binding.arg.ViolatedIndices; | ||
indices.forEach((index) => { | ||
markInstance.markRanges([{ start: index.Start, length: index.Length }]); | ||
}); | ||
}); | ||
|
||
const vue = new Vue({ | ||
data: { | ||
ok: false, | ||
proofreadResults: [], | ||
errorMsg: '', | ||
isUploading: false, | ||
fileName: '', | ||
}, | ||
methods: { | ||
onDrop(event) { | ||
if ( | ||
!event || | ||
!event.dataTransfer || | ||
event.dataTransfer.files.length === 0 | ||
) { | ||
return; | ||
} | ||
const file = event.dataTransfer.files[0]; | ||
this.ok = false; | ||
this.proofreadResults = []; | ||
this.fileName = ''; | ||
this.errorMsg = ''; | ||
this.isUploading = true; | ||
ipcRenderer.invoke('proofread', file.path).then((proofreadResult) => { | ||
console.log(proofreadResult); | ||
if (proofreadResult.errorMsg != null) { | ||
this.errorMsg = proofreadResult.errorMsg; | ||
this.isUploading = false; | ||
return; | ||
} | ||
this.ok = proofreadResult.ok; | ||
this.proofreadResults = proofreadResult.results; | ||
this.fileName = proofreadResult.fileName; | ||
this.isUploading = false; | ||
}); | ||
}, | ||
hasFileName() { | ||
return this.fileName.length > 0; | ||
}, | ||
openTextlintConfig() { | ||
ipcRenderer.send('openTextlintConfig'); | ||
}, | ||
}, | ||
}); | ||
vue.$mount('#vue'); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Git LFS file not shown
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
|
||
ignore: | | ||
textlint_config/textlint-rule-preset-icsmedia/ | ||
rules: | ||
braces: | ||
min-spaces-inside: 0 | ||
max-spaces-inside: 0 | ||
min-spaces-inside-empty: -1 | ||
max-spaces-inside-empty: -1 | ||
brackets: | ||
min-spaces-inside: 0 | ||
max-spaces-inside: 0 | ||
min-spaces-inside-empty: -1 | ||
max-spaces-inside-empty: -1 | ||
colons: | ||
max-spaces-before: 0 | ||
max-spaces-after: 1 | ||
commas: | ||
max-spaces-before: 0 | ||
min-spaces-after: 1 | ||
max-spaces-after: 1 | ||
comments: | ||
level: warning | ||
require-starting-space: true | ||
min-spaces-from-content: 2 | ||
comments-indentation: | ||
level: warning | ||
document-end: disable | ||
document-start: | ||
level: warning | ||
present: true | ||
empty-lines: | ||
max: 2 | ||
max-start: 0 | ||
max-end: 0 | ||
empty-values: | ||
forbid-in-block-mappings: false | ||
forbid-in-flow-mappings: false | ||
hyphens: | ||
max-spaces-after: 1 | ||
indentation: | ||
spaces: consistent | ||
indent-sequences: true | ||
check-multi-line-strings: false | ||
key-duplicates: enable | ||
key-ordering: disable | ||
line-length: | ||
max: 256 | ||
allow-non-breakable-words: true | ||
allow-non-breakable-inline-mappings: false | ||
new-line-at-end-of-file: enable | ||
new-lines: | ||
type: unix | ||
octal-values: | ||
forbid-implicit-octal: false | ||
forbid-explicit-octal: false | ||
trailing-spaces: enable | ||
truthy: disable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>文書校正ツール</title> | ||
</head> | ||
<style type="text/css">@import url("assets/dist/vendor.bundle.css");</style> | ||
<style type="text/css"> | ||
/* https://jp.vuejs.org/v2/api/index.html#v-cloak */ | ||
[v-cloak] { | ||
display: none; | ||
} | ||
</style> | ||
<body> | ||
<div id="vue" @dragleave.prevent @dragover.prevent @drop.prevent="onDrop" style="width:100vw;height:100vh"> | ||
<div class="text-center"> | ||
<button class="btn btn-primary btn-block" @click="openTextlintConfig()">設定ファイルを開く</button> | ||
</div> | ||
<div class="text-center" style="font-size:x-large;margin-top:2rem" v-if="!isUploading"> | ||
<span>ここにファイルをコピー&ペーストしてください</span> | ||
</div> | ||
<!-- スピナー --> | ||
<div style="margin-top:2rem;" class="text-center"> | ||
<div class="spinner-border" v-if="isUploading" role="status"> | ||
<span class="sr-only">Loading...</span> | ||
</div> | ||
</div> | ||
|
||
<div class="alert alert-dark" role="alert" v-cloak v-if="hasFileName()"><b>{{fileName}}</b> を校正しました</div> | ||
<ul class="list-group" v-if="ok"> | ||
<li class="list-group-item list-group-item-success" v-cloak> | ||
<h3>エラーはありません。</h3> | ||
</li> | ||
</ul> | ||
<ul class="list-group" v-else> | ||
<li class="list-group-item list-group-item-danger" v-for="result in proofreadResults" v-cloak> | ||
<h3>{{result.Description}}</h3> | ||
<ul class="list-group"> | ||
<li class="list-group-item" v-for="violation in result.Violations" v-cloak> | ||
<p>{{violation.Message}}</p> | ||
<small class="text-muted"> | ||
<p v-highlight-range:[violation]>{{violation.ViolatedSection}}</p> | ||
</small> | ||
</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
|
||
<p v-cloak style="white-space: pre;">{{errorMsg}}</p> | ||
</div> | ||
<style> | ||
mark { | ||
background: orange; | ||
} | ||
|
||
#dropzone { | ||
text-align: center; | ||
} | ||
</style> | ||
<script src="assets/dist/index.js"></script> | ||
<script src="assets/dist/vendor.bundle.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// https://ganeshrvel.medium.com/bundle-a-precompiled-binary-or-native-file-into-an-electron-app-beacc44322a9 | ||
|
||
const path = require('path'); | ||
const { rootPath } = require('electron-root-path'); | ||
const { isPackaged } = require('electron-is-packaged'); | ||
const { platform } = require('os'); | ||
|
||
const getPlatform = () => { | ||
switch (platform()) { | ||
case 'aix': | ||
case 'freebsd': | ||
case 'linux': | ||
case 'openbsd': | ||
case 'android': | ||
return 'linux'; | ||
case 'darwin': | ||
case 'sunos': | ||
return 'mac'; | ||
case 'win32': | ||
return 'win'; | ||
default: | ||
throw Error('invalid platform'); | ||
} | ||
}; | ||
|
||
const resourcesPath = (() => { | ||
if (!isPackaged) { | ||
return rootPath; | ||
} | ||
if (getPlatform() === 'mac') { | ||
return path.join(rootPath, './Contents', './Resources'); | ||
} | ||
return path.join(rootPath, './Resources'); // https://www.electron.build/configuration/contents#extraresources | ||
})(); | ||
|
||
exports.resourceFilePath = (contentFilePath) => | ||
path.resolve(path.join(resourcesPath, contentFilePath)); | ||
|
||
const binariesPath = isPackaged | ||
? path.join(resourcesPath, './bin') | ||
: path.join(resourcesPath, './build', getPlatform(), './bin'); | ||
|
||
exports.execFilePath = (execFile) => { | ||
const execFileName = getPlatform() === 'win' ? `${execFile}.exe` : execFile; | ||
return path.resolve(path.join(binariesPath, execFileName)); | ||
}; |
Oops, something went wrong.