Skip to content

Commit

Permalink
#105 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed May 3, 2024
1 parent 48328f5 commit 80866da
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 11 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# The MIT License (MIT)
#
# Copyright (c) 2022-2024 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
name: actionlint
'on':
push:
branches:
- master
pull_request:
branches:
- master
jobs:
actionlint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: raven-actions/actionlint@v1
22 changes: 22 additions & 0 deletions .github/workflows/l3build.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# The MIT License (MIT)
#
# Copyright (c) 2022-2024 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
name: l3build
on:
push:
Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
# The MIT License (MIT)
#
# Copyright (c) 2022-2024 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
name: markdown-lint
on:
'on':
push:
jobs:
markdown-lint:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# The MIT License (MIT)
#
# Copyright (c) 2022-2024 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
name: yamllint
'on':
push:
branches:
- master
pull_request:
branches:
- master
jobs:
yamllint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ibiqlik/action-yamllint@v3
22 changes: 22 additions & 0 deletions .rultor.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# The MIT License (MIT)
#
# Copyright (c) 2022-2024 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
docker:
image: yegor256/rultor-image:1.23.1
install: |-
Expand Down
22 changes: 12 additions & 10 deletions bibcop.pl
Original file line number Diff line number Diff line change
Expand Up @@ -659,26 +659,28 @@ sub fix_capitalization {
if (not $word =~ /^[A-Za-z]/) {
next;
}
my $lc = lc($word);
if (exists $minors{$lc} and $pos > 1) {
my $start = 1;
if ($pos > 1) {
my $before = $words[$pos - 2];
if (not $before =~ /(:|\?|!|;)$/) {
$word = $lc;
next;
if (not $before =~ /(:|\?|!|;|-)$/) {
$start = 0;
}
}
if ($word =~ /^[a-z].*/) {
$word =~ s/^([a-z])/\U$1/g;
}
my @parts = split(/-/, $word, -1);
my $p = 0;
foreach my $part (@parts) {
$p += 1;
if (exists $minors{lc($part)}) {
my $lcp = lc($part);
if (exists $minors{$lcp}) {
if ($p > 1) {
my $pre = $parts[$p - 2];
if (not $pre eq '') {
$part = lc($part);
$part = $lcp;
next;
}
} elsif (@parts+0 == 1) {
if (not $start) {
$part = $lcp;
next;
}
}
Expand Down
2 changes: 2 additions & 0 deletions perl-tests/fixing.pl
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ package bibcop;
fixes('title', 'long question---short answer', 'Long Question --- Short Answer');
fixes('title', 'long question --- short answer', 'Long Question --- Short Answer');
fixes('title', 'does it work?---of course!', 'Does It Work? --- Of Course!');
fixes('title', 'does it work? --- of course!', 'Does It Work? --- Of Course!');
fixes('title', 'GitHub Audience?---a Thematic Analysis', 'GitHub Audience? --- A Thematic Analysis');
fixes('title', 'our in-house rules', 'Our In-House Rules');
fixes('title', 'user\'s story', 'User\'s Story');
fixes('title', 'GitHub Audience? --- a Thematic Analysis', 'GitHub Audience? --- A Thematic Analysis');

fixes('booktitle', 'Proceedings Of IEEE Symposium On Art', 'Proceedings of Symposium on Art');
fixes('booktitle', 'Symposium on Computers', 'Proceedings of the Symposium on Computers');
Expand Down

0 comments on commit 80866da

Please sign in to comment.