Skip to content

Instantly share code, notes, and snippets.

View takahi-i's full-sized avatar

Takahiko Ito takahi-i

View GitHub Profile
test do
system "#{bin}/redpen", "-version"
file_name = "sampledoc-en.txt"
path = "#{libexec}/sample-doc/en/#{file_name}"
output = `#{bin}/redpen -c #{libexec}/conf/redpen-conf-en.xml #{path}`
errors = output.split("\n").select { |line| line.start_with?(file_name) }
assert errors.find{|e|(e.start_with?("#{file_name}:1: ValidationError[SymbolWithSpace]"))}
end
@takahi-i
takahi-i / gist:f1a91f27044d7d0696f3
Last active August 29, 2015 14:13
Walter GitHub 連携

設定

service:
    type: github
    token: token
    from: user name
   
pipeline:
  • stage_name: command_stage_1
@takahi-i
takahi-i / gist:54e6ce5b87fc5218018f
Last active August 29, 2015 14:15
Walter: Support Environment Variable

Load the environment variable to the Walter configuration files.

We follow the format of environment varibale as the discussion in terraform

Sample

messenger:

type: ${env.MESSENGER_TYPE}

@takahi-i
takahi-i / gist:f7b75bcd8c02f9ed2ae7
Last active August 29, 2015 14:16
image of cleanup configuraiton of walter

Possible Solutions

Add cleanup steps in pipeline target.

Configuration Image 1

Add cleanup as a element of a array in pipeline.

Sample

@takahi-i
takahi-i / markdown
Last active August 29, 2015 14:20
Image of JSON with symbol setting for RedPen server
{
"document": "Theyre is a blak rownd borl.",
"format": "json2",
"documentParser": "PLAIN",
"config": {
"lang" : "en",
"validators" : {
"CommaNumber": {},
"Contraction": {},
"DoubledWord": {},

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

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

<redpen-conf lang="ja">
    <validators>

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.

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.

<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">
 

Configuration

<redpen-conf lang="en">
    <validators>
        <validator name="SentenceLength" level="warn" >
            <property name="max_len" value="200"/>
        </validator>
        <validator name="InvalidSymbol" level="info" />