Skip to content

Commit

Permalink
Merge branch 'master' into childv2
Browse files Browse the repository at this point in the history
  • Loading branch information
takahashim committed Sep 27, 2020
2 parents 7a05510 + bedf70a commit f4b08cd
Show file tree
Hide file tree
Showing 99 changed files with 4,598 additions and 1,353 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/ruby-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,23 @@ jobs:
gem install bundler --no-document
bundle install --retry 3
bundle exec ruby test/run_test.rb --max-diff-target-string-size=10000 --verbose=v
- name: Test with epubcheck-ruby
- name: install Re:VIEW and epubcheck-ruby
shell: bash
run: |
gem install -N epubcheck-ruby
ruby bin/review-init hello
rake install
- name: Test with epubcheck-ruby
shell: bash
run: |
review-init hello
cd hello
ruby ../bin/review-epubmaker config.yml
ruby -e 'Dir.glob("*.re"){|path| File.write(path, File.read(path).gsub("=", "= foo")) }'
review-epubmaker config.yml
epubcheck book.epub
cd ..
ruby bin/review-init hello2 --epub-version 2
review-init hello2 --epub-version 2
cd hello2
ruby ../bin/review-epubmaker config.yml
ruby -e 'Dir.glob("*.re"){|path| File.write(path, File.read(path).gsub("=", "= foo")) }'
review-epubmaker config.yml
epubcheck book.epub
cd ..
140 changes: 116 additions & 24 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ AllCops:
- lib/lineinput.rb
- lib/uuid.rb
- test/syntax-book/*
- tmp/*
DisplayCopNames: true
NewCops: enable

require:
- rubocop-performance

inherit_from: .rubocop_todo.yml

#### Lint

Lint/EmptyWhen:
Expand All @@ -25,9 +25,6 @@ Lint/AssignmentInCondition:
Lint/ParenthesesAsGroupedExpression:
Enabled: true

#Lint/RescueWithoutErrorClass:
# Enabled: false

Lint/UnderscorePrefixedVariableName:
Enabled: true

Expand All @@ -43,6 +40,18 @@ Lint/UselessAssignment:
Lint/ErbNewArguments:
Enabled: false

Lint/DeprecatedOpenSSLConstant:
Enabled: true

Lint/MixedRegexpCaptureTypes:
Enabled: true

Lint/RaiseException:
Enabled: true

Lint/StructNewOverride:
Enabled: true

#### Performance

Performance/RegexpMatch:
Expand All @@ -58,6 +67,39 @@ Performance/StringReplacement:
Performance/RangeInclude:
Enabled: true

Performance/DeletePrefix:
Enabled: false

Performance/RedundantMerge:
Enabled: true

Performance/AncestorsInclude:
Enabled: true

Performance/BigDecimalWithNumericArgument:
Enabled: true

Performance/RedundantSortBlock:
Enabled: true

Performance/RedundantStringChars:
Enabled: true

Performance/ReverseFirst:
Enabled: true

Performance/SortReverse:
Enabled: true

Performance/Squeeze:
Enabled: true

Performance/StringInclude:
Enabled: false

Performance/CollectionLiteralInLoop:
Enabled: false

#### Style

Style/AccessModifierDeclarations:
Expand All @@ -72,7 +114,7 @@ Style/Alias:
Enabled: true

Style/AndOr:
Enabled: false
Enabled: true

Style/BarePercentLiterals:
EnforcedStyle: percent_q
Expand All @@ -81,9 +123,6 @@ Style/BarePercentLiterals:
Style/BlockDelimiters:
Enabled: true

Style/BracesAroundHashParameters:
Enabled: false

Style/CaseEquality:
Enabled: false

Expand Down Expand Up @@ -120,7 +159,7 @@ Style/EmptyElse:
Enabled: true

Style/EvalWithLocation:
Enabled: false
Enabled: true

Style/FormatString:
EnforcedStyle: sprintf
Expand All @@ -141,13 +180,10 @@ Style/IfUnlessModifier:
Style/MutableConstant:
Enabled: false

#Style/MultipleComparison:
# Enabled: true

Style/RedundantInterpolation:
Style/MultipleComparison:
Enabled: true

Performance/RedundantMerge:
Style/RedundantInterpolation:
Enabled: true

Style/ZeroLengthPredicate:
Expand Down Expand Up @@ -216,6 +252,9 @@ Style/MethodCallWithArgsParentheses:
- 'source'
- 'assert'
- 'assert_equal'
- 'assert_raise'
- 'assert_raises'
- 'assert_nothing_raised'
- 'sh'
- 'mv'
- 'rm_rf'
Expand Down Expand Up @@ -310,8 +349,50 @@ Style/RedundantPercentQ:
Style/WhileUntilModifier:
Enabled: false

#Style/YodaCondition:
# Enabled: true
Style/YodaCondition:
Enabled: true

Style/ExponentialNotation:
Enabled: true

Style/HashEachMethods:
Enabled: true

Style/HashTransformKeys:
Enabled: true

Style/HashTransformValues:
Enabled: true

Style/RedundantFetchBlock:
Enabled: true

Style/RedundantRegexpCharacterClass:
Enabled: true

Style/RedundantRegexpEscape:
Enabled: true

Style/SlicingWithRange:
Enabled: false

Style/AccessorGrouping:
Enabled: false

Style/CaseLikeIf:
Enabled: false

Style/StringConcatenation:
Enabled: false

Style/OptionalBooleanParameter:
Enabled: false

Style/SoleNestedConditional:
Enabled: false

Style/CombinableLoops:
Enabled: false

### Layout

Expand Down Expand Up @@ -422,6 +503,17 @@ Layout/TrailingWhitespace:
Enabled: true
AllowInHeredoc: true

Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true

Layout/SpaceAroundMethodCallOperator:
Enabled: true

Layout/LineLength:
Max: 256
Exclude:
- "test/**/*"

#### Metrics

Metrics/BlockNesting:
Expand All @@ -441,11 +533,6 @@ Metrics/ClassLength:
Exclude:
- 'test/*.rb'

Metrics/LineLength:
Max: 256
Exclude:
- "test/**/*"

### should be < 50
Metrics/MethodLength:
Max: 100
Expand Down Expand Up @@ -480,8 +567,8 @@ Naming/AccessorMethodName:
Enabled: true

# When defining the == operator, name its argument other.
#Style/BinaryOperatorParameterName:
# Enabled: true
Naming/BinaryOperatorParameterName:
Enabled: true

Naming/FileName:
Enabled: false
Expand Down Expand Up @@ -510,3 +597,8 @@ Naming/VariableNumber:

Security/YAMLLoad:
Enabled: true

#### Gemspec

Gemspec/RequiredRubyVersion:
Enabled: false
7 changes: 0 additions & 7 deletions .rubocop_todo.yml

This file was deleted.

29 changes: 29 additions & 0 deletions NEWS.ja.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# Version 4.2.0
## 新機能
* 図・表・リスト・式のキャプションの位置を内容の上側・下側どちらにするかを指定する `caption_position` パラメータを追加しました。`caption_position` の下位パラメータとして `image``table``list``equation` のパラメータがあり、値として `top` (上側) または `bottom` (下側) を指定します。デフォルトは `image` のみ `bottom`、ほかは `top` です ([#1320])

## 非互換の変更
* review-vol を再構成しました。部の処理や見出し内のインライン命令の処理を正しました。表示形式をわかりやすい形に変更しました。部を指定したときに部のボリュームではなく、部ファイル単体のボリュームを返すようにしました。`-P`, `--directory` オプションは廃止しました ([#1485])
* review-index を再構成しました。オプション名を大幅に変更しています。行数・文字数は `-d` オプションを指定したときのみ表示するようにしました。また、ファイルの行数・文字数ではなく、PLAINTEXTBuilder を利用して、変換結果に近い行数・文字数を返すようにしました (review-vol よりも正確です)。特定の章は `-y` オプションで複数指定できるようにしました ([#1485])

## バグ修正
* 重複する `@non_parsed_commands` 宣言を削除しました ([#1499])
* WebMaker、TextMaker で数式画像が作成されない問題を修正しました ([#1501])

## 機能強化
* imgmath での数式画像の作成処理を最適化し、高速化しました ([#1488])
* デフォルト以外の固有の YAML 設定を PDFMaker に引き渡したいときのために、`layouts/config-local.tex.erb` ファイルが存在すればそれを評価・読み込みするようにしました ([#1505])

## その他
* GitHub Actions を eregon/use-ruby-action から ruby/setup-ruby に切り替えました ([#1490])
* テストの際、samples フォルダ内にあるビルド成果物を無視するようにしました ([#1504])

[#1320]: https://github.com/kmuto/review/issues/1320
[#1485]: https://github.com/kmuto/review/issues/1485
[#1488]: https://github.com/kmuto/review/issues/1488
[#1490]: https://github.com/kmuto/review/pull/1490
[#1499]: https://github.com/kmuto/review/issues/1499
[#1501]: https://github.com/kmuto/review/pull/1501
[#1504]: https://github.com/kmuto/review/pull/1504
[#1505]: https://github.com/kmuto/review/issues/1505

# Version 4.1.0
## 新機能
* 表のセル区切りの文字を `table_row_separator` パラメータで変更できるようにしました。指定可能な値は tabs (1個以上のタブ、デフォルト)、singletab (1文字のタブ文字区切り)、spaces (1文字以上のスペースまたはタブ文字の区切り)、 verticalbar ("0個以上の空白 | 0個以上の空白" の区切り) です ([#1420])
Expand Down
29 changes: 29 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# Version 4.2.0
## New Features
* introduce `caption_position` parameter to specify a caption position of image, table, list, and equation. `caption_position` has child parameters `image`, `table`, `list`, and `equation` and the value is `top` or `bottom` ([#1320])

## Breaking Changes
* review-vol is rewritten. Improved processing of parts and inline instructions in headings. Changed display format. When a part is specified, the volume of the part file itself is returned instead of the volume of the part. The `-P` and `--directory` options have been removed ([#1485])
* review-index is rewritten. Most option names have been changed. The number of lines and characters are now displayed only when `-d` option is specified. review-index uses PLAINTEXTBuilder to return accurate line and character counts. `-y` option is provided to specify a target chapter ([#1485])

## Bug Fixes
* remove duplicated `@non_parsed_commands` declaration ([#1499])
* mathematical images not being created in WebMaker and TextMaker has been fixed ([#1501])

## Enhancements
* improve a performance of building math figures on imgmath ([#1488])
* for those times when you want to hand over non-default YAML parameters to PDFMaker, you can write your own `layouts/config-local.tex.erb` file ([#1505])

## Others
* GitHub Actions: use `ruby/setup-ruby` instead of `eregon/use-ruby-action` ([#1490])
* skip artifacts in the sample folder during testing ([#1504])

[#1320]: https://github.com/kmuto/review/issues/1320
[#1485]: https://github.com/kmuto/review/issues/1485
[#1488]: https://github.com/kmuto/review/issues/1488
[#1490]: https://github.com/kmuto/review/pull/1490
[#1499]: https://github.com/kmuto/review/issues/1499
[#1501]: https://github.com/kmuto/review/pull/1501
[#1504]: https://github.com/kmuto/review/pull/1504
[#1505]: https://github.com/kmuto/review/issues/1505

# Version 4.1.0
## New Features
* add `table_row_separator` to specify a separator that separates table rows. Accceptable value: tabs (means `\t+`, default), `singletab` (means `\t`), spaces (means `\s+`), verticalbar (means `\s*\|\s*`) ([#1420])
Expand Down
2 changes: 1 addition & 1 deletion bin/review-catalog-converter
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def parse_postdef(str, to_appendix = false)
end

def parse_parts(parts_str, chaps_str)
if parts_str.blank? or chaps_str.blank?
if parts_str.blank? || chaps_str.blank?
return "CHAPS:\n\n"
end

Expand Down
6 changes: 2 additions & 4 deletions bin/review-check
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ end

def main
@config = ReVIEW::Configure.values
@book = ReVIEW::Book::Base.load
@book.config = @config

@book = ReVIEW::Book::Base.new(config: @config)
@logger = ReVIEW.logger

modes = nil
Expand Down Expand Up @@ -87,7 +85,7 @@ def check_text(files)
s = para.join
m = re.match(s)
next if m.nil? || m[0] == @review_utils_word_ok
next if neg and neg =~ s
next if neg && neg =~ s
str, offset = find_line(para, re)
out = sprintf("%s:%d: %s\n", path, lineno + offset, str)
print out
Expand Down
2 changes: 1 addition & 1 deletion bin/review-checkdep
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def main
when /\A\#@provide\((.*)\)/
provide($1)
else
line.scan(/@<kw>\{(.*?)[,\}]/) { provide $1 }
line.scan(/@<kw>\{(.*?)[,}]/) { provide($1) }
end
end
end
Expand Down
Loading

0 comments on commit f4b08cd

Please sign in to comment.