redpen-cc / redpen

RedPen is an open source proofreading tool to check if your technical documents meet the writing standard. RedPen supports various markup text formats (Markdown, Textile, AsciiDoc, Re:VIEW, reStructuredText and LaTeX).
https://redpen.cc
Apache License 2.0
567 stars 74 forks source link

Fix redpen-server UI problem when we specify RedPen configuration file #820

Closed takahi-i closed 6 years ago

takahi-i commented 6 years ago

Ref https://gitter.im/redpen-cc/redpen/redpen-ja?at=5a740acba3447aac752f59d9

takahi-i commented 6 years ago

Seems that JSON from JS does not contain any validators... 🤔

13556 [qtp1270855946-24] INFO  cc.redpen.server.api.RedPenService - In getredpenfromJson: requestJSOn={"document":"<!-- @suppress SpaceBetweenAlphabeticalWord -->\n# 分散処理\n最近利用されているソフトウェアの中には複数の計算機上で動作(分散)するものが多く存在し、このよ\\
うな分散ソフトウェアは複数の計算機で動作することで一台では処理が追いつかない大量のデータを扱えたり、\n高負荷な状況に対処できたり、可用性を向上できたりします。本稿では,複数の計算機(Cluster)でで動作する各サーバーを**インスタンス**と呼びます。\nたとえば検索エンジンやデータ\
ベースではインデックスを複数のインスタンスで分割して保持します。\nこのような場合、クラスターの各インデクスが返す結果をマージしてクライアントにわたす機構が必要です。\n","format":"json2","config":{"validators":{},"lang":"ja","symbols":{"DIGIT_SEVEN":{"after_space":false,"b\
efore_space":false,"value":"7","invalid_chars":""},"RIGHT_SINGLE_QUOTATION_MARK":{"after_space":false,"before_space":false,"value":"\u2019","invalid_chars":""},"DIGIT_ZERO":{"after_space":false,"before_space":false,"value":"0","invalid_chars":""},"DIGIT_THREE":{"after_sp\
ace":false,"before_space":false,"value":"3","invalid_chars":""},"RIGHT_PARENTHESIS":{"after_space":false,"before_space":false,"value":")","invalid_chars":")"},"DIGIT_EIGHT":{"after_space":false,"before_space":false,"value":"8","invalid_chars":""},"DIGIT_FOUR":{"after_sp\
ace":false,"before_space":false,"value":"4","invalid_chars":""},"DIGIT_SIX":{"after_space":false,"before_space":false,"value":"6","invalid_chars":""},"LEFT_CURLY_BRACKET":{"after_space":false,"before_space":false,"value":"{","invalid_chars":""},"DIGIT_ONE":{"after_space\
":false,"before_space":false,"value":"1","invalid_chars":""},"LEFT_SQUARE_BRACKET":{"after_space":false,"before_space":false,"value":"「","invalid_chars":""},"SPACE":{"after_space":false,"before_space":false,"value":" ","invalid_chars":""},"QUESTION_MARK":{"after_space"\
:false,"before_space":false,"value":"?","invalid_chars":"?"},"GREATER_THAN_SIGN":{"after_space":false,"before_space":false,"value":">","invalid_chars":""},"LESS_THAN_SIGN":{"after_space":false,"before_space":false,"value":"<","invalid_chars":""},"BACKSLASH":{"after_sp\
ace":false,"before_space":false,"value":"¥","invalid_chars":"\\"},"SEMICOLON":{"after_space":false,"before_space":false,"value":";","invalid_chars":""},"EXCLAMATION_MARK":{"after_space":false,"before_space":false,"value":"!","invalid_chars":"!"},"FULL_STOP":{"after_spa\
ce":false,"before_space":false,"value":"。","invalid_chars":"."},"LEFT_SINGLE_QUOTATION_MARK":{"after_space":false,"before_space":false,"value":"\u201c","invalid_chars":""},"RIGHT_DOUBLE_QUOTATION_MARK":{"after_space":false,"before_space":false,"value":"\u201d","invalid\
_chars":""},"AMPERSAND":{"after_space":false,"before_space":false,"value":"&","invalid_chars":""},"COMMA":{"after_space":false,"before_space":false,"value":"、","invalid_chars":",,"},"DIGIT_TWO":{"after_space":false,"before_space":false,"value":"2","invalid_chars":""},\
"NUMBER_SIGN":{"after_space":false,"before_space":false,"value":"#","invalid_chars":"#"},"VERTICAL_BAR":{"after_space":false,"before_space":false,"value":"|","invalid_chars":"|"},"LOW_LINE":{"after_space":false,"before_space":false,"value":"_","invalid_chars":""},"SLA\
SH":{"after_space":false,"before_space":false,"value":"/","invalid_chars":""},"ASTERISK":{"after_space":false,"before_space":false,"value":"*","invalid_chars":""},"RIGHT_SQUARE_BRACKET":{"after_space":false,"before_space":false,"value":"」","invalid_chars":""},"CIRCUMF\
LEX_ACCENT":{"after_space":false,"before_space":false,"value":"^","invalid_chars":""},"COLON":{"after_space":false,"before_space":false,"value":":","invalid_chars":""},"HYPHEN_SIGN":{"after_space":false,"before_space":false,"value":"ー","invalid_chars":""},"LEFT_PARENT\
HESIS":{"after_space":false,"before_space":false,"value":"(","invalid_chars":"("},"PERCENT_SIGN":{"after_space":false,"before_space":false,"value":"%","invalid_chars":""},"DIGIT_NINE":{"after_space":false,"before_space":false,"value":"9","invalid_chars":""},"AT_MARK":{\
"after_space":false,"before_space":false,"value":"@","invalid_chars":""},"PLUS_SIGN":{"after_space":false,"before_space":false,"value":"+","invalid_chars":""},"EQUAL_SIGN":{"after_space":false,"before_space":false,"value":"=","invalid_chars":""},"DIGIT_FIVE":{"after_s\
pace":false,"before_space":false,"value":"5","invalid_chars":""},"DOLLAR_SIGN":{"after_space":false,"before_space":false,"value":"$","invalid_chars":"$"},"TILDE":{"after_space":false,"before_space":false,"value":"〜","invalid_chars":"~"},"RIGHT_CURLY_BRACKET":{"after_sp\
ace":false,"before_space":false,"value":"}","invalid_chars":""}}},"documentParser":"MARKDOWN"}
takahi-i commented 6 years ago

Any validators are not shown in the right configuration box..

screen shot 2018-02-10 at 23 16 11

takahi-i commented 6 years ago

Looks like no validator is returned from rest/config/redpens for specified validators.

      "tokenizer": "cc.redpen.tokenizer.NeologdJapaneseTokenizer",
      "validators": {},
      "variant": "zenkaku"
takahi-i commented 6 years ago

Need to run redpen.validate(emptyDocuments); to generate registered validators after RedPen object is created.

https://github.com/redpen-cc/redpen/blob/master/redpen-server/src/main/java/cc/redpen/server/api/RedPenService.java#L70

takahi-i commented 6 years ago

This issue is fixed with #821

I confirmed that RedPen server with specified configuration file works as expected.

The following image shows the RePen UI with Japanese configuration which only activates three validators.

screen shot 2018-02-12 at 20 48 46