Skip to content

Commit

Permalink
replacement switch further work, #503
Browse files Browse the repository at this point in the history
  • Loading branch information
cmhughes committed Jan 13, 2024
1 parent 713b9e6 commit 8464a49
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/batch-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,60 @@ jobs:
run: |
$files = Get-ChildItem test-cases\check-switch-tests\*tex
foreach ($file in $files) {perl latexindent.pl --check -s $file}
cjk-windows-exe-test:
needs: check-pm-files-changed
if: ${{fromJSON(needs.check-pm-files-changed.outputs.anychanged)}}
name: 'create Windows executable latexindent.exe using Strawberry Perl 5.32 on Windows'
runs-on: 'windows-latest'
steps:
#
# checkout github.com/cmhughes/latexindent.pl
# https://github.com/actions/checkout
#
- name: load the "base actions/checkout" so as to access latexindent.pl
uses: actions/checkout@v4
#
# https://github.com/marketplace/actions/setup-perl-environment
#
- name: install Strawberry Perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: '5.32'
distribution: strawberry
- name: install Perl modules using cpan
run: |
wmic os get osarchitecture
cpanm -f PAR::Packer
cpanm YAML::Tiny
cpanm File::HomeDir
cpanm Unicode::GCString
- name: preparations for PAR packer
run: |
sed -i'.bak' -r 's,eval\s\"use\sUnicode::GCString\"\sif\s\$switches\{GCString\},use Unicode::GCString,' latexindent.pl
SET PAR_VERBATIM=1
#
# https://metacpan.org/pod/pp
# https://github.com/plk/biber/blob/dev/dist/MSWIN64/build.bat
#
- name: create latexindent.exe using PAR Packer
run: >-
pp
--addfile="defaultSettings.yaml;lib/LatexIndent/defaultSettings.yaml"
--cachedeps=scancache
--output latexindent.exe
latexindent.pl
- name: latexindent.exe help
run: |
./latexindent.exe --help
- name: latexindent.exe replacement test, issue 503
# https://github.com/cmhughes/latexindent.pl/issues/503
run: |
cd test-cases/replacements/
./latexindent.exe -l issue-503b.yaml -r issue-503a.tex
cat indent.log
- name: latexindent.exe cjk test, issue 505
# https://github.com/cmhughes/latexindent.pl/issues/505
run: |
cd ../../test-cases/back-up-tests/
./latexindent.exe -w 新建.tex -y 'onlyOneBackUp:1'
cat indent.log
2 changes: 1 addition & 1 deletion LatexIndent/Replacement.pm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ sub make_replacements {
#
my $this = quotemeta( ${$_}{this} );
my $that = ( defined ${$_}{that} ) ? qq{${$_}{that}} : q();
${$self}{body} = join( $that, split( $this, ${$self}{body} ) );
${$self}{body} = join( $that, split( /$this/, ${$self}{body}, -1 ) );
}
else {
#
Expand Down
2 changes: 1 addition & 1 deletion test-cases/back-up-tests/back-up-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ latexindent.pl -s -wd -l backup2.yaml -g three.log myfile
cp three.log backup-info3.txt
perl -p0i -e 's/.*?(INFO:\s*\-wd)/$1/s' backup-info3.txt

latexindent.pl -w 新建.tex -g issue-505.log -y 'onlyOneBackUp:1'
latexindent.pl -s -w 新建.tex -g issue-505.log -y 'onlyOneBackUp:1'
cp issue-505.log issue-505.txt
perl -p0i -e 's/.*?(INFO:\s*Backup)/$1/s' issue-505.txt

Expand Down

0 comments on commit 8464a49

Please sign in to comment.