diff options
Diffstat (limited to 'support')
-rw-r--r-- | support/lacheck/config.h.in | 130 | ||||
-rwxr-xr-x | support/lacheck/configure.texk | 269 | ||||
-rw-r--r-- | support/latexindent/LatexIndent/BackUpFileProcedure.pm | 5 | ||||
-rw-r--r-- | support/latexindent/LatexIndent/Document.pm | 24 | ||||
-rw-r--r-- | support/latexindent/LatexIndent/GetYamlSettings.pm | 44 | ||||
-rw-r--r-- | support/latexindent/LatexIndent/LogFile.pm | 15 | ||||
-rw-r--r-- | support/latexindent/LatexIndent/UTF8CmdLineArgsFileOperation.pm | 23 | ||||
-rw-r--r-- | support/latexindent/LatexIndent/Version.pm | 4 | ||||
-rw-r--r-- | support/latexindent/README | 2 | ||||
-rw-r--r-- | support/latexindent/bin/linux/latexindent | bin | 7847351 -> 7847663 bytes | |||
-rw-r--r-- | support/latexindent/bin/macos/latexindent | bin | 7830592 -> 7564675 bytes | |||
-rw-r--r-- | support/latexindent/defaultSettings.yaml | 3 | ||||
-rw-r--r-- | support/latexindent/documentation/latexindent-yaml-schema.json | 2 | ||||
-rw-r--r-- | support/latexindent/documentation/latexindent.pdf | bin | 1285520 -> 1297746 bytes | |||
-rw-r--r-- | support/latexindent/documentation/latexindent.tex | 132 | ||||
-rwxr-xr-x | support/latexindent/latexindent.pl | 2 |
16 files changed, 602 insertions, 53 deletions
diff --git a/support/lacheck/config.h.in b/support/lacheck/config.h.in index c33573eadc..bcc05e2430 100644 --- a/support/lacheck/config.h.in +++ b/support/lacheck/config.h.in @@ -1,5 +1,38 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <minix/config.h> header file. */ +#undef HAVE_MINIX_CONFIG_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdio.h> header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the <wchar.h> header file. */ +#undef HAVE_WCHAR_H + /* Name of package */ #undef PACKAGE @@ -21,6 +54,103 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Define to 1 if all of the C89 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#undef STDC_HEADERS + +/* Enable extensions on AIX, Interix, z/OS. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by C23 Annex F. */ +#ifndef __STDC_WANT_IEC_60559_EXT__ +# undef __STDC_WANT_IEC_60559_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif + + /* Version number of package */ #undef VERSION diff --git a/support/lacheck/configure.texk b/support/lacheck/configure.texk index 2b11d1e732..06f1ce8f4e 100755 --- a/support/lacheck/configure.texk +++ b/support/lacheck/configure.texk @@ -609,6 +609,38 @@ PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' ac_unique_file="lacheck.l" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stddef.h> +#ifdef HAVE_STDIO_H +# include <stdio.h> +#endif +#ifdef HAVE_STDLIB_H +# include <stdlib.h> +#endif +#ifdef HAVE_STRING_H +# include <string.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_header_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS @@ -1490,6 +1522,41 @@ fi } # ac_fn_c_try_compile +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else case e in #( + e) eval "$3=no" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. @@ -1832,6 +1899,7 @@ printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" # Test code for whether the C compiler supports C89 (global declarations) ac_c_conftest_c89_globals=' /* Does the compiler advertise C89 conformance? @@ -2157,6 +2225,16 @@ main (int argc, char **argv) } " +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" +as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" # Auxiliary files required by this configure script. ac_aux_files="compile missing install-sh" @@ -4109,6 +4187,183 @@ fi +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test ${ac_cv_safe_to_define___extensions__+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_safe_to_define___extensions__=yes +else case e in #( + e) ac_cv_safe_to_define___extensions__=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 +printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } +if test ${ac_cv_should_define__xopen_source+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_should_define__xopen_source=no + if test $ac_cv_header_wchar_h = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <wchar.h> + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define _XOPEN_SOURCE 500 + #include <wchar.h> + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_should_define__xopen_source=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 +printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } + + printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h + + printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h + + printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h + + if test $ac_cv_header_minix_config_h = yes +then : + MINIX=yes + printf "%s\n" "#define _MINIX 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h + +else case e in #( + e) MINIX= ;; +esac +fi + if test $ac_cv_safe_to_define___extensions__ = yes +then : + printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h + +fi + if test $ac_cv_should_define__xopen_source = yes +then : + printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h + +fi + # Check whether --enable-compiler-warnings was given. if test ${enable_compiler_warnings+y} then : @@ -4129,6 +4384,8 @@ esac echo 'tldbg:KPSE_BASIC called (pkg=lacheck, amopt=)' >&5 +# +# am_init_automake if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." @@ -4255,6 +4512,8 @@ END fi +# am_maintainer_mode + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. @@ -4279,6 +4538,11 @@ fi MAINT=$MAINTAINER_MODE_TRUE + +# See comments in kpse-setup.m4 about system extensions. + + +# Check whether prototypes work. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler accepts prototypes" >&5 printf %s "checking whether the compiler accepts prototypes... " >&6; } if test ${kb_cv_c_prototypes+y} @@ -4312,6 +4576,8 @@ printf "%s\n" "$kb_cv_c_prototypes" >&6; } if test "x$kb_cv_c_prototypes" = xno; then as_fn_error $? "Sorry, your compiler does not understand prototypes." "$LINENO" 5 fi + +# kpse_compiler_warnings options. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking what warning flags to pass to the C compiler" >&5 printf %s "checking what warning flags to pass to the C compiler... " >&6; } if test ${kpse_cv_warning_cflags+y} @@ -4369,6 +4635,9 @@ WARNING_CFLAGS=$kpse_cv_warning_cflags +# end of kpse_basic macro. +echo 'tldbg:KPSE_BASIC done (pkg=lacheck, amopt=)' >&5 + for ac_prog in flex lex do diff --git a/support/latexindent/LatexIndent/BackUpFileProcedure.pm b/support/latexindent/LatexIndent/BackUpFileProcedure.pm index f88304fc6c..cba8435211 100644 --- a/support/latexindent/LatexIndent/BackUpFileProcedure.pm +++ b/support/latexindent/LatexIndent/BackUpFileProcedure.pm @@ -54,6 +54,11 @@ sub create_back_up_file { # add the user's backup directory to the backup path $backupFileNoExt = "${$self}{cruftDirectory}/$backupFileNoExt"; + $backupFileNoExt =~ s/\\/\//g; + $backupFileNoExt =~ s/\/{2,}/\//g; + if ( $^O eq 'MSWin32' ) { + $backupFileNoExt =~ s/\//\\/g; + } # local variables, determined from the YAML settings my $onlyOneBackUp = $mainSettings{onlyOneBackUp}; diff --git a/support/latexindent/LatexIndent/Document.pm b/support/latexindent/LatexIndent/Document.pm index b35795f70a..477c5da68f 100644 --- a/support/latexindent/LatexIndent/Document.pm +++ b/support/latexindent/LatexIndent/Document.pm @@ -272,12 +272,19 @@ sub output_logfile { if ${ $mainSettings{logFilePreferences} }{showGitHubInfoFooter}; # open log file - my $logfileName = $switches{logFileName} || "indent.log"; - my $logfilePossible = 1; - my $logfile = open_with_encode( '>:encoding(UTF-8)', "${$self}{cruftDirectory}/$logfileName" ) - or $logfilePossible = 0; + my $logfileName = $switches{logFileName} || "indent.log"; + + my $logfilePath; + $logfilePath = "${$self}{cruftDirectory}/$logfileName"; + $logfilePath =~ s/\\/\//g; + $logfilePath =~ s/\/{2,}/\//g; + if ( $^O eq 'MSWin32' ) { + $logfilePath =~ s/\//\\/g; + } + + my $logfile = open_with_encode( '>:encoding(UTF-8)', $logfilePath ); - if ($logfilePossible) { + if ($logfile) { foreach my $line ( @{LatexIndent::Logger::logFileLines} ) { print $logfile $line, "\n"; } @@ -285,7 +292,12 @@ sub output_logfile { # close log file close($logfile); } - + else { + if ( $switches{screenlog} ) { + print "WARN: Could not open the logfile $logfilePath \n"; + print " No logfile will be produced.\n"; + } + } } sub process_body_of_text { diff --git a/support/latexindent/LatexIndent/GetYamlSettings.pm b/support/latexindent/LatexIndent/GetYamlSettings.pm index 9e5ff7a853..4d4940371d 100644 --- a/support/latexindent/LatexIndent/GetYamlSettings.pm +++ b/support/latexindent/LatexIndent/GetYamlSettings.pm @@ -382,6 +382,46 @@ sub yaml_read_settings { $logger->info("Reading USER settings from $settings"); $userSettings = read_yaml_with_encode("$settings"); + # update the absolute paths + if ( $userSettings and ( ref( $userSettings->[0] ) eq 'HASH' ) and $userSettings->[0]->{paths} ) { + $logger->info("Reading path information from $settings"); + + # output the contents of indentconfig to the log file + $logger->info( Dump \%{ $userSettings->[0] } ); + + # change the encoding of the paths according to the field `encoding` + if ( $userSettings and ( ref( $userSettings->[0] ) eq 'HASH' ) and $userSettings->[0]->{encoding} ) { + use Encode; + my $encoding = $userSettings->[0]->{encoding}; + my $encodingObject = find_encoding($encoding); + + # Check if the encoding is valid. + if ( ref($encodingObject) ) { + $logger->info("*Encoding of the paths is $encoding"); + foreach ( @{ $userSettings->[0]->{paths} } ) { + my $temp = $encodingObject->encode("$_"); + $logger->info("Transform file encoding: $_ -> $temp"); + push( @absPaths, $temp ); + } + } + else { + $logger->warn("*encoding \"$encoding\" not found"); + $logger->warn("Ignore this setting and will take the default encoding."); + @absPaths = @{ $userSettings->[0]->{paths} }; + foreach ( @{ $userSettings->[0]->{paths} } ) { + push( @absPaths, $_ ); + } + } + } + else # No such setting, and will take the default + { + # $logger->info("*Encoding of the paths takes the default."); + foreach ( @{ $userSettings->[0]->{paths} } ) { + push( @absPaths, $_ ); + } + } + } + # if we can read userSettings if ($userSettings) { @@ -477,7 +517,9 @@ sub yaml_read_settings { } # if amalgamate is set to 1, then append - if ( ${ $mainSettings{$firstLevelKey}[0] }{amalgamate} ) { + if ( ref( $mainSettings{$firstLevelKey}[0] ) eq "HASH" + and ${ $mainSettings{$firstLevelKey}[0] }{amalgamate} ) + { # loop through the other settings foreach ( @{$firstLevelValue} ) { diff --git a/support/latexindent/LatexIndent/LogFile.pm b/support/latexindent/LatexIndent/LogFile.pm index 7418f1024c..da0c86af2a 100644 --- a/support/latexindent/LatexIndent/LogFile.pm +++ b/support/latexindent/LatexIndent/LogFile.pm @@ -135,6 +135,11 @@ ENDQUOTE # cruft directory ${$self}{cruftDirectory} = $switches{cruftDirectory} || ( dirname ${$self}{fileName} ); + ${$self}{cruftDirectory} =~ s/\\/\//g; + ${$self}{cruftDirectory} =~ s/\/{2,}/\//g; + if ( $^O eq 'MSWin32' ) { + ${$self}{cruftDirectory} =~ s/\//\\/g; + } my $cruftDirectoryCreation = 0; @@ -149,11 +154,13 @@ ENDQUOTE } $cruftDirectoryCreation = 1; } - my $logfileName = ( $switches{cruftDirectory} ? ${$self}{cruftDirectory} . "/" : '' ) . ( $switches{logFileName} || "indent.log" ); - - $logfileName = $logfileName; + $logfileName =~ s/\\/\//g; + $logfileName =~ s/\/{2,}/\//g; + if ( $^O eq 'MSWin32' ) { + $logfileName =~ s/\//\\/g; + } # details of the script to log file $logger->info("*$FindBin::Script version $versionNumber, $versionDate, a script to indent .tex files"); @@ -260,7 +267,7 @@ ENDQUOTE $switches{outputToFile} = 0; } - $logger->info("*Directory for backup files and $logfileName:"); + $logger->info("*Directory for backup files and log file $logfileName:"); $logger->info( $switches{cruftDirectory} ? ${$self}{cruftDirectory} : ${$self}{cruftDirectory} ); $logger->info("cruft directory creation: ${$self}{cruftDirectory}") if $cruftDirectoryCreation; diff --git a/support/latexindent/LatexIndent/UTF8CmdLineArgsFileOperation.pm b/support/latexindent/LatexIndent/UTF8CmdLineArgsFileOperation.pm index a2ba0b1d2f..45a2b6f538 100644 --- a/support/latexindent/LatexIndent/UTF8CmdLineArgsFileOperation.pm +++ b/support/latexindent/LatexIndent/UTF8CmdLineArgsFileOperation.pm @@ -66,12 +66,20 @@ sub open_with_encode { require Win32::Unicode::File; Win32::Unicode::File->import; $fh = Win32::Unicode::File->new; - open $fh, $mode, $filename or die "Can't open file: $!"; - return $fh; + if ( open $fh, $mode, $filename ) { + return $fh; + } + else { + return undef; + } } else { - open( $fh, $mode, $filename ) or die "Can't open file: $!"; - return $fh; + if ( open( $fh, $mode, $filename ) ) { + return $fh; + } + else { + return undef; + } } } @@ -79,7 +87,7 @@ sub read_yaml_with_encode { use YAML::Tiny; my $filename = shift; - my $fh = open_with_encode( '<:encoding(UTF-8)', $filename ) or die $!; + my $fh = open_with_encode( '<:encoding(UTF-8)', $filename ) or return undef; my $yaml_string = join( "", <$fh> ); return YAML::Tiny->read_string($yaml_string); } @@ -105,14 +113,13 @@ sub mkdir_with_encode { require Win32::Unicode::Dir; Win32::Unicode::Dir->import(qw(mkdirW)); - mkdirW($path) or die "Cannot create directory $path: $!"; + mkdirW($path); } else { require File::Path; File::Path->import(qw(make_path)); - my $created = make_path($path); - die "Cannot create directory $path" unless $created; + make_path($path); } } diff --git a/support/latexindent/LatexIndent/Version.pm b/support/latexindent/LatexIndent/Version.pm index bbfb2e7ea3..b42ea7bdaf 100644 --- a/support/latexindent/LatexIndent/Version.pm +++ b/support/latexindent/LatexIndent/Version.pm @@ -20,6 +20,6 @@ use warnings; use Exporter qw/import/; our @EXPORT_OK = qw/$versionNumber $versionDate/; -our $versionNumber = '3.23.9'; -our $versionDate = '2024-04-06'; +our $versionNumber = '3.24'; +our $versionDate = '2024-04-28'; 1 diff --git a/support/latexindent/README b/support/latexindent/README index 77bc3fb97f..6b589faadf 100644 --- a/support/latexindent/README +++ b/support/latexindent/README @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - latexindent.pl, version 3.23.9, 2024-04-06 + latexindent.pl, version 3.24, 2024-04-28 PERL script to indent code within environments, and align delimited environments in .tex files. diff --git a/support/latexindent/bin/linux/latexindent b/support/latexindent/bin/linux/latexindent Binary files differindex 6d04469090..60df957ca2 100644 --- a/support/latexindent/bin/linux/latexindent +++ b/support/latexindent/bin/linux/latexindent diff --git a/support/latexindent/bin/macos/latexindent b/support/latexindent/bin/macos/latexindent Binary files differindex 325a6fd9bb..3be492c85a 100644 --- a/support/latexindent/bin/macos/latexindent +++ b/support/latexindent/bin/macos/latexindent diff --git a/support/latexindent/defaultSettings.yaml b/support/latexindent/defaultSettings.yaml index 257216f6bd..1d281dd7fa 100644 --- a/support/latexindent/defaultSettings.yaml +++ b/support/latexindent/defaultSettings.yaml @@ -1,5 +1,5 @@ # -# latexindent.pl, version 3.23.9, 2024-04-06 +# latexindent.pl, version 3.24, 2024-04-28 # # defaultSettings.yaml, the default settings for latexindent.pl # @@ -228,6 +228,7 @@ lookForAlignDelims: tblr: 1 longtblr: 1 talltblr: 1 + spreadtab: 1 # if you want the script to look for \item commands # and format it, as follows (for example), diff --git a/support/latexindent/documentation/latexindent-yaml-schema.json b/support/latexindent/documentation/latexindent-yaml-schema.json index 56ffbc2409..397d577e92 100644 --- a/support/latexindent/documentation/latexindent-yaml-schema.json +++ b/support/latexindent/documentation/latexindent-yaml-schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/schema", "$id": "latexindent-yaml-schema.json", "title": "latexindent.pl YAML schema", - "description": "latexindent.pl YAML schema helper, V3.23.9 2024-04-06", + "description": "latexindent.pl YAML schema helper, V3.24 2024-04-28", "type": "object", "properties": { "fileExtensionPreference": { diff --git a/support/latexindent/documentation/latexindent.pdf b/support/latexindent/documentation/latexindent.pdf Binary files differindex 03fb4d7bd1..9555a30a14 100644 --- a/support/latexindent/documentation/latexindent.pdf +++ b/support/latexindent/documentation/latexindent.pdf diff --git a/support/latexindent/documentation/latexindent.tex b/support/latexindent/documentation/latexindent.tex index da46a04f09..fc96a1db9a 100644 --- a/support/latexindent/documentation/latexindent.tex +++ b/support/latexindent/documentation/latexindent.tex @@ -415,121 +415,121 @@ \lstdefinestyle{indentAfterItems}{ style=yaml-LST, - firstnumber=241,linerange={241-248}, + firstnumber=242,linerange={242-249}, numbers=left, } \lstdefinestyle{itemNames}{ style=yaml-LST, - firstnumber=254,linerange={254-256}, + firstnumber=255,linerange={255-257}, numbers=left, } \lstdefinestyle{specialBeginEnd}{ style=yaml-LST, - firstnumber=260,linerange={260-274}, + firstnumber=261,linerange={261-275}, numbers=left, } \lstdefinestyle{indentAfterHeadings}{ style=yaml-LST, - firstnumber=284,linerange={284-293}, + firstnumber=285,linerange={285-294}, numbers=left, } \lstdefinestyle{noAdditionalIndentGlobalEnv}{ style=yaml-LST, - firstnumber=342,linerange={342-343}, + firstnumber=343,linerange={343-344}, numbers=left, } \lstdefinestyle{noAdditionalIndentGlobal}{ style=yaml-LST, - firstnumber=342,linerange={342-354}, + firstnumber=343,linerange={343-355}, numbers=left, } \lstdefinestyle{indentRulesGlobalEnv}{ style=yaml-LST, - firstnumber=358,linerange={358-359}, + firstnumber=359,linerange={359-360}, numbers=left, } \lstdefinestyle{indentRulesGlobal}{ style=yaml-LST, - firstnumber=358,linerange={358-370}, + firstnumber=359,linerange={359-371}, numbers=left, } \lstdefinestyle{commandCodeBlocks}{ style=yaml-LST, - firstnumber=373,linerange={373-388}, + firstnumber=374,linerange={374-389}, numbers=left, } \lstdefinestyle{modifylinebreaks}{ style=yaml-LST, - firstnumber=501,linerange={501-503}, + firstnumber=502,linerange={502-504}, numbers=left, } \lstdefinestyle{textWrapOptions}{ style=yaml-LST, - firstnumber=531,linerange={531-532}, + firstnumber=532,linerange={532-533}, numbers=left, } \lstdefinestyle{textWrapOptionsAll}{ style=yaml-LST, - firstnumber=531,linerange={531-558}, + firstnumber=532,linerange={532-559}, numbers=left, } \lstdefinestyle{oneSentencePerLine}{ style=yaml-LST, - firstnumber=504,linerange={504-530}, + firstnumber=505,linerange={505-531}, numbers=left, } \lstdefinestyle{sentencesFollow}{ style=yaml-LST, - firstnumber=510,linerange={510-518}, + firstnumber=511,linerange={511-519}, numbers=left, } \lstdefinestyle{sentencesBeginWith}{ style=yaml-LST, - firstnumber=519,linerange={519-522}, + firstnumber=520,linerange={520-523}, numbers=left, } \lstdefinestyle{sentencesEndWith}{ style=yaml-LST, - firstnumber=523,linerange={523-528}, + firstnumber=524,linerange={524-529}, numbers=left, } \lstdefinestyle{sentencesDoNOTcontain}{ style=yaml-LST, - firstnumber=529,linerange={529-530}, + firstnumber=530,linerange={530-531}, numbers=left, } \lstdefinestyle{modifylinebreaksEnv}{ style=yaml-LST, - firstnumber=560,linerange={560-569}, + firstnumber=561,linerange={561-570}, numbers=left, } \lstdefinestyle{replacements}{ style=yaml-LST, - firstnumber=621,linerange={621-626}, + firstnumber=622,linerange={622-627}, numbers=left, } \lstdefinestyle{fineTuning}{ style=yaml-LST, - firstnumber=630,linerange={630-685}, + firstnumber=631,linerange={631-686}, numbers=left, } @@ -1805,7 +1805,7 @@ latexindent.pl myfile.tex are detailed in \cref{app:indentconfig:options}. \announce{2023-01-01}{indentconfig location options} -\subsection{indentconfig.yaml and .indentconfig.yaml} +\subsection{indentconfig.yaml and .indentconfig.yaml}\label{subsec:indentconfig} \texttt{latexindent.pl} will always check your home directory for \texttt{indentconfig.yaml} and \texttt{.indentconfig.yaml} (unless it is called with the \texttt{-d} switch), which @@ -1860,6 +1860,11 @@ latexindent.pl myfile.tex \texttt{indent.log}. \end{warning} + As of \announce*{2024-04-28}{paths within local YAML settings} you can specify the + \texttt{paths} field from \cref{lst:indentconfig} within any of your + \texttt{latexindent.yaml} and friends settings files. This can lead to creative nesting + of configuration files; a demonstration is given in \vref{sec:appendix:paths}. + If you find that \announce{2021-06-19}{encoding option for indentconfig.yaml} \texttt{latexindent.pl} does not read your YAML file, then it might be as a result of the default commandline encoding not being UTF-8; normally this will only occur for @@ -1968,6 +1973,9 @@ latexindent.pl -l=mysettings.yaml -y="verbatimEnvironments:cmhenvironment:0;myen latexindent.pl -m --yaml='modifyLineBreaks:oneSentencePerLine:sentencesEndWith:other:\;' \end{commandshell} + Note that the \texttt{paths} settings (see \vref{sec:appendix:paths}) can \emph{not} be + specified using the \texttt{-y} switch. + \subsection{Settings load order}\label{sec:loadorder} \texttt{latexindent.pl} loads the settings files in the following order: \index{switches!-l in relation to other settings} @@ -3265,7 +3273,7 @@ latexindent.pl special2.tex -l=middle1 For example, let’s consider the \texttt{.tex} file in \cref{lst:specialAlgo}. \index{specialBeginEnd!middle} \index{specialBeginEnd!Algorithms example} - \cmhlistingsfromfile*[basicstyle=\tiny]{demonstrations/specialAlgo.tex}[enhanced jigsaw,breakable]{\texttt{specialAlgo.tex}}{lst:specialAlgo} + \cmhlistingsfromfile[basicstyle=\tiny]{demonstrations/specialAlgo.tex}[enhanced jigsaw,breakable]{\texttt{specialAlgo.tex}}{lst:specialAlgo} Upon saving the YAML settings in \cref{lst:algo-yaml} and running the command \index{switches!-l demonstration} @@ -3277,8 +3285,8 @@ latexindent.pl -l=algo.yaml specialAlgo.tex then we obtain the output given in \cref{lst:specialAlgo-mod1}. \begin{cmhtcbraster} - \cmhlistingsfromfile*[basicstyle=\tiny]{demonstrations/specialAlgo-mod1.tex}{\texttt{specialAlgo.tex} using \cref{lst:algo-yaml}}{lst:specialAlgo-mod1} - \cmhlistingsfromfile*[style=yaml-LST,basicstyle=\tiny,commentstyle=\color{blue}\ttfamily\tiny]{demonstrations/algo.yaml}[yaml-TCB]{\texttt{algo.yaml}}{lst:algo-yaml} + \cmhlistingsfromfile[basicstyle=\tiny]{demonstrations/specialAlgo-mod1.tex}{\texttt{specialAlgo.tex} using \cref{lst:algo-yaml}}{lst:specialAlgo-mod1} + \cmhlistingsfromfile[style=yaml-LST,basicstyle=\tiny,commentstyle=\color{blue}\ttfamily\tiny]{demonstrations/algo.yaml}[yaml-TCB]{\texttt{algo.yaml}}{lst:algo-yaml} \end{cmhtcbraster} \end{example} @@ -8414,10 +8422,10 @@ latexindent.pl finetuning5.tex -l=fine-tuning3.yaml We can use the \texttt{fineTuning} settings to tweak how \texttt{latexindent.pl} finds environments. - We begin with the file in \cref{lst:finetuning6}.\announce*{2023-10-13}{fineTuning + We begin with the file in \cref{lst:finetuning6}.\announce{2023-10-13}{fineTuning environments} - \cmhlistingsfromfile*{demonstrations/finetuning6.tex}{\texttt{finetuning6.tex}}{lst:finetuning6} + \cmhlistingsfromfile{demonstrations/finetuning6.tex}{\texttt{finetuning6.tex}}{lst:finetuning6} Using the settings in \cref{lst:fine-tuning4} and running the command @@ -8433,8 +8441,8 @@ latexindent.pl finetuning6.tex -m -l=fine-tuning4.yaml raster column 1/.style={add to width=-.1\textwidth}, raster column 2/.style={add to width=-.3\textwidth}, ] - \cmhlistingsfromfile*{demonstrations/finetuning6-mod1.tex}{\texttt{finetuning6-mod1.tex}}{lst:finetuning6-mod1} - \cmhlistingsfromfile*[style=yaml-LST]{demonstrations/fine-tuning4.yaml}[MLB-TCB]{\texttt{fine-tuning4.yaml}}{lst:fine-tuning4} + \cmhlistingsfromfile{demonstrations/finetuning6-mod1.tex}{\texttt{finetuning6-mod1.tex}}{lst:finetuning6-mod1} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/fine-tuning4.yaml}[MLB-TCB]{\texttt{fine-tuning4.yaml}}{lst:fine-tuning4} \end{cmhtcbraster} By using the settings in \cref{lst:fine-tuning4} it means that the default poly-switch @@ -9307,6 +9315,74 @@ echo 'export LATEXINDENT_CONFIG="/your/config/path"' >> ~/.profile stored in \texttt{\$HOME/.profile}). All commands in this file a run after login, so the environment variable will be set after your next login. + \section{paths demonstration}\label{sec:appendix:paths} + + As detailed in \vref{subsec:indentconfig} \announce*{2024-04-28}{nested paths + demonstration}, the \texttt{paths} field can be specified in any of your \texttt{YAML} + files. + + We will use the file in \cref{lst:paths-demo} for demonstration in what follows. + + \cmhlistingsfromfile*{demonstrations/paths-demo.tex}{\texttt{paths-demo.tex}}{lst:paths-demo} + + \begin{example} + Consider the settings given in \cref{lst:path1-yaml} and \cref{lst:path2-yaml}. + + \begin{cmhtcbraster}[raster column skip=.1\linewidth] + \cmhlistingsfromfile*[style=yaml-LST]{demonstrations/path1.yaml}[yaml-TCB]{\texttt{path1.yaml}}{lst:path1-yaml} + \cmhlistingsfromfile*[style=yaml-LST,showspaces=true]{demonstrations/path2.yaml}[yaml-TCB]{\texttt{path2.yaml}}{lst:path2-yaml} + \end{cmhtcbraster} + + Upon calling + + \begin{commandshell} +latexindent.pl -l=path1.yaml paths-demo.tex +\end{commandshell} + + then we will receive the output given in \cref{lst:paths-demo-mod1}. + + \cmhlistingsfromfile*[showspaces=true]{demonstrations/paths-demo-mod1.tex}{\texttt{paths-demo-mod1.tex}}{lst:paths-demo-mod1} + + We note that the settings from \cref{lst:path2-yaml} have been called from + \cref{lst:path1-yaml}. + + On inspection of \texttt{indent.log} from the above call, we see the details of this + part of the process given in \cref{lst:path-test1:txt}. + + \cmhlistingsfromfile*{demonstrations/path-test1.txt}{\texttt{path-test1.txt}}{lst:path-test1:txt} + \end{example} + + \begin{example} + Consider the settings given in \cref{lst:path3-yaml} to \cref{lst:path5-yaml}. + + \begin{cmhtcbraster}[raster columns=3, + raster left skip=-3.5cm, + raster right skip=-2cm, + raster column skip=.03\linewidth] + \cmhlistingsfromfile*[style=yaml-LST]{demonstrations/path3.yaml}[yaml-TCB]{\texttt{path3.yaml}}{lst:path3-yaml} + \cmhlistingsfromfile*[style=yaml-LST,showspaces=true]{demonstrations/path4.yaml}[yaml-TCB]{\texttt{path4.yaml}}{lst:path4-yaml} + \cmhlistingsfromfile*[style=yaml-LST,showspaces=true]{demonstrations/path5.yaml}[yaml-TCB]{\texttt{path5.yaml}}{lst:path5-yaml} + \end{cmhtcbraster} + + Upon calling + + \begin{commandshell} +latexindent.pl -l=path3.yaml paths-demo.tex +\end{commandshell} + + then we will receive the output given in \cref{lst:paths-demo-mod3}. + + \cmhlistingsfromfile*[showspaces=true]{demonstrations/paths-demo-mod3.tex}{\texttt{paths-demo-mod3.tex}}{lst:paths-demo-mod3} + + We see that \texttt{path3.yaml} calls \texttt{path4.yaml} which in turn calls + \texttt{path5.yaml}. + + On inspection of \texttt{indent.log} from the above call, we see the details of this + part of the process given in \cref{lst:path-test3:txt}. + + \cmhlistingsfromfile*{demonstrations/path-test3.txt}{\texttt{path-test3.txt}}{lst:path-test3:txt} + \end{example} + \section{logFilePreferences}\label{app:logfile-demo} \Vref{lst:logFilePreferences} describes the options for customising the information given to the log file, and we provide a few demonstrations here. diff --git a/support/latexindent/latexindent.pl b/support/latexindent/latexindent.pl index 194b130595..2c2232a046 100755 --- a/support/latexindent/latexindent.pl +++ b/support/latexindent/latexindent.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl # -# latexindent.pl, version 3.23.9, 2024-04-06 +# latexindent.pl, version 3.24, 2024-04-28 # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by |