Skip to content

Instantly share code, notes, and snippets.

Avatar

Takahiko Ito takahi-i

View GitHub Profile
@takahi-i
takahi-i / machine-dependent-character-validator.md
Created April 8, 2017 14:42
RedPen で機種依存文字を検知するためのValidatorサンプル
View machine-dependent-character-validator.md

機種依存文字を検知するValidator ファイル

var dependentCharacters = RegExp(/[①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡㍻〝〟№㏍℡㊤㊥㊦㊧㊨㈱㈲㈹㍾㍽㍼]/g);

function validateSentence(sentence) {
    var content = sentence.getContent();
    while ((match = dependentCharacters.exec(content)) != null) {
      addError("Found machine dependent character: " + "\'"+ match[0] + "\'", sentence);
View redpen_plugin.md

RedPen plugin command have three roles

  1. install plugin
  2. test plugin
  3. uninstall plugin

command Usage

View redpen-conf.md

Configuration

<redpen-conf lang="en">
    <validators>
        <validator name="SentenceLength" level="warn" >
            <property name="max_len" value="200"/>
        </validator>
        <validator name="InvalidSymbol" level="info" />
View redpen-conf.md
<redpen-conf lang="en">
    <validators>
        <validator name="SentenceLength" level="warn" >
            <property name="max_len" value="200"/>
        </validator>
        <validator name="InvalidSymbol" level="info" />
        <validator name="SpaceWithSymbol" level="error" />
        <validator name="SectionLength">
 
View suppress-errors.md

Suppress RedPen errors with annotation

Writers want to suppress errors from RedPen. In such cases, writers list up the error types they want to suppress. The list of the errors are written down to the beginning of sections or paragraphs where they want to suppress the spcified errors.

The following is a sample of AsciiDoc section which suppress two error types. In the section, the specified errors are suppressed even when RedPen detect errors.

View rulevalidator.md

Rule Validator

This validator checks a set of rules writers should adherre. The rules are written in the YAML format.

Format of Rules

In the rule file there are three block lang, name and pattern.

View katakanaspellcheck.md

KakatanaSpellCheckにユーザ辞書を登録する方法

KatakanaSpecllCheck のプロパティに辞書ファイルへのパス(パスはカレントディレクトリからの相対パス)を記述する。

<redpen-conf lang="ja">
    <validators>
@takahi-i
takahi-i / markdown
Last active August 29, 2015 14:20
Image of JSON with symbol setting for RedPen server
View markdown
{
"document": "Theyre is a blak rownd borl.",
"format": "json2",
"documentParser": "PLAIN",
"config": {
"lang" : "en",
"validators" : {
"CommaNumber": {},
"Contraction": {},
"DoubledWord": {},
@takahi-i
takahi-i / gist:f7b75bcd8c02f9ed2ae7
Last active August 29, 2015 14:16
image of cleanup configuraiton of walter
View gist:f7b75bcd8c02f9ed2ae7

Possible Solutions

Add cleanup steps in pipeline target.

Configuration Image 1

Add cleanup as a element of a array in pipeline.

Sample