texlive[56122] trunk: tikztosvg (16aug20)

commits+karl at tug.org commits+karl at tug.org
Sun Aug 16 23:36:48 CEST 2020


Revision: 56122
          http://tug.org/svn/texlive?view=revision&revision=56122
Author:   karl
Date:     2020-08-16 23:36:48 +0200 (Sun, 16 Aug 2020)
Log Message:
-----------
tikztosvg (16aug20)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/tikztosvg/tikztosvg
    trunk/Master/texmf-dist/doc/man/man1/tikztosvg.1
    trunk/Master/texmf-dist/doc/man/man1/tikztosvg.man1.pdf
    trunk/Master/texmf-dist/doc/support/tikztosvg/README.md
    trunk/Master/texmf-dist/doc/support/tikztosvg/install.sh
    trunk/Master/texmf-dist/doc/support/tikztosvg/man.adoc
    trunk/Master/texmf-dist/scripts/tikztosvg/tikztosvg
    trunk/Master/tlpkg/libexec/ctan2tds

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.adoc
    trunk/Master/texmf-dist/doc/support/tikztosvg/Makefile
    trunk/Master/texmf-dist/doc/support/tikztosvg/tikztosvg.pdf

Modified: trunk/Build/source/texk/texlive/linked_scripts/tikztosvg/tikztosvg
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/tikztosvg/tikztosvg	2020-08-16 08:10:47 UTC (rev 56121)
+++ trunk/Build/source/texk/texlive/linked_scripts/tikztosvg/tikztosvg	2020-08-16 21:36:48 UTC (rev 56122)
@@ -1,181 +1,203 @@
-#!/bin/bash
+#!/bin/sh
 
 puts() 
 {
-    echo "[$1] $2"
+  printf "\033[1m\033[38;5;%sm[%s]\033[m %s\n" "$3" "$1" "$2"
 }
 
 error()
 {
-    puts "ERROR" "$1" r
+  puts "ERROR" "$1" "9"
 
-    if [ -n "$2" ]
-    then
-        exit $2
-    else
-        exit 1
-    fi
+  if [ -n "$2" ]
+  then
+    exit "$2"
+  else
+    exit 1
+  fi
 }
 
 message()
 {
-    puts "TIKZTOSVG" "$1" g
+  puts "TIKZTOSVG" "$1" "2"
 }
 
 showHelp()
 {
-    man tikztosvg
-    exit 0
+  man tikztosvg
+  exit 0
 }
 
 showVersion()
 {
-    echo 0.1.0
-    exit 0
+  echo 0.1.2
+  exit 0
 }
 
-if [ -z "$(which xelatex)" ]
+if ! [ -x "$(command -v xelatex)" ]
 then
-    error "xelatex could not be found"
+  error "xelatex could not be found"
 fi
 
-if [ -z "$(which pdf2svg)" ]
+if ! [ -x "$(command -v pdf2svg)" ]
 then
-    error "pdf2svg could not be found"
+  error "pdf2svg could not be found"
 fi
 
 # Parsing the arguments
-PACKAGES=()
+PACKAGES=""
 while [ $# -gt 1 ]
 do
-    case "$1" in
-        -h|--help)
-            showHelp
-            ;;
-        -v|--version)
-            showVersion
-            ;;
-        -p|--package)
-            if [ -z "$2" ]
-            then
-                error "Unnexpected EOF"
-            else
-                PACKAGES+=("$2")
-                shift
-                shift
-            fi
-            ;;
-        -o|--output)
-            if [ -n "$OUTPUT" ]
-            then
-                error "The output path was specified multiple times"
-            else if [ -z "$2" ]
-            then
-                error "Unexpected EOF"
-                exit 1
-            else
-                OUTPUT="$2"
-                shift
-                shift
-            fi
-            fi
-            ;;
-        -q|--quit)
-            QUIET=1
-            shift
-            ;;
-        *) 
-            error "Unexpected token: \"$1\""
-            ;;
-    esac
+  case "$1" in
+    -h|--help)
+      showHelp
+      ;;
+    -v|--version)
+      showVersion
+      ;;
+    -p|--package)
+      case "$2" in
+        "")
+          error "Unnexpected EOF"
+          ;;
+        # Check if the name of the package is valid
+        *" "*) 
+          error "Invalid package name. LaTeX package names cannot contain scapes!" 
+          ;;
+        *)
+          PACKAGES="$PACKAGES $2"
+          shift
+          shift
+      esac
+      ;;
+    -o|--output)
+      if [ -n "$OUTPUT" ]
+      then
+        error "The output path was specified multiple times"
+      elif [ -z "$2" ]
+      then
+        error "Unexpected EOF"
+      else
+        OUTPUT="$2"
+        shift
+        shift
+      fi
+      ;;
+    -q|--quit)
+      QUIET=1
+      shift
+      ;;
+    *) 
+      error "Unexpected token: \"$1\""
+      ;;
+  esac
 done
 
 case "$1" in
-    -h|--help)
-        showHelp
-        ;;
-    -v|--version)
-        showVersion
-        ;;
-    "")
-        error "No input path provided"
-        ;;
-    *)
-        INPUT="$1"
+  -h|--help)
+    showHelp
+    ;;
+  -v|--version)
+    showVersion
+    ;;
+  "")
+    error "No input path provided"
+    ;;
+  "-")
+    INPUT=/dev/stdin
+    ;;
+  *)
+    INPUT="$1"
+    ;;
 esac
 
-if [ -z "$OUTPUT" ]
-then
-    OUTPUT="$(echo $(basename $INPUT) | cut -d "." -f1)"
-fi
+case "$OUTPUT" in
+  # Set the output to stdout
+  -)
+    QUIET=1
+    OUTPUT=/dev/stdout
+    ;;
 
+  # If no output path is provided, use the basename of the input
+  "") 
+    if [ -x "$(command -v dirname)" ]
+    then
+      OUTPUT="$(dirname "$INPUT")/$(basename "$INPUT" | cut -d "." -f1).svg" 
+    fi
+    ;;
+
+  # If the output path is provided, but it resolves to directory, output a 
+  # a file with the same basename as the input in the target directory
+  */) 
+    OUTPUT="$OUTPUT$(basename "$INPUT" | cut -d "." -f1).svg" 
+    ;;
+esac
+
 TEMP_DIR="$(mktemp -d)"
 TEX_FILE="$TEMP_DIR/tmp.tex"
 
 # Generate the LaTeX document
-echo "\documentclass[crop,tikz,multi=false]{standalone}" > $TEX_FILE
+printf "\documentclass[crop,tikz,multi=false]{standalone}\n" > "$TEX_FILE"
 
-for PACKAGE in "${PACKAGES[@]}"
+for PACKAGE in $PACKAGES
 do
-    echo "\usepackage{$PACKAGE}" >> $TEX_FILE
+  printf "\usepackage{%s}\n" "$PACKAGE" >> "$TEX_FILE"
 done
 
-echo "\begin{document}" >> $TEX_FILE
-echo "\huge" >> $TEX_FILE
+printf "\\\begin{document} \huge\n" >> "$TEX_FILE"
+cat "$INPUT" >> "$TEX_FILE"
 
-cat $INPUT >> $TEX_FILE
-
 if [ $? -ne 0 ]
 then
-    rm $TEMP_DIR -r
-    error "File not found: $INPUT"
+  rm "$TEMP_DIR" -r
+  error "File not found: $INPUT"
 fi
 
-echo "\end{document}" >> $TEX_FILE
+printf "\\\end{document}\n" >> "$TEX_FILE"
 
 if [ -z "$QUIET" ]
 then
-    message "Rendering the LaTeX document. . ."
-    xelatex -output-directory=$TEMP_DIR $TEX_FILE
+  message "Rendering the LaTeX document. . ."
+  xelatex -halt-on-error -output-directory="$TEMP_DIR" "$TEX_FILE"
 else
-    xelatex -halt-on-error -output-directory=$TEMP_DIR $TEX_FILE 1> /dev/null 2>&1
+  xelatex -halt-on-error -output-directory="$TEMP_DIR" "$TEX_FILE" 1> /dev/null 2>&1
 fi
 
 S=$?
 if [ $S -ne 0 ]
 then
-    rm $TEMP_DIR -r
-    if [ -z "$QUIET" ]
-    then
-        error "xelatex exited with code $S" $S
-    else
-        exit $S
-    fi
+  rm "$TEMP_DIR" -r
+  if [ -z "$QUIET" ]
+  then
+    error "xelatex exited with code $S" $S
+  else
+    exit $S
+  fi
 fi
 
 if [ -z "$QUIET" ]
 then
-    message "Converting the output to SVG. . ."
+  message "Converting the output to SVG. . ."
 fi
 
-pdf2svg "$TEMP_DIR/tmp.pdf" $OUTPUT 1
+pdf2svg "$TEMP_DIR/tmp.pdf" "$OUTPUT" 1
 
 S=$?
 if [ $S -ne 0 ]
 then
-    rm $TEMP_DIR -r
-    if [ -z "$QUIET" ]
-    then
-        error "pdf2svg exited with code $S" $S
-    else
-        exit $S
-    fi
+  rm "$TEMP_DIR" -r
+  if [ -z "$QUIET" ]
+  then
+    error "pdf2svg exited with code $S" $S
+  else
+    exit $S
+  fi
 fi
 
 if [ -z "$QUIET" ]
 then
-    message "Done!"
+  message "Done!"
 fi
 
-rm "$TEMP_DIR" -r
+rm "$TEMP_DIR" -rf
 

Modified: trunk/Master/texmf-dist/doc/man/man1/tikztosvg.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/tikztosvg.1	2020-08-16 08:10:47 UTC (rev 56121)
+++ trunk/Master/texmf-dist/doc/man/man1/tikztosvg.1	2020-08-16 21:36:48 UTC (rev 56122)
@@ -1,13 +1,13 @@
 '\" t
 .\"     Title: tikzsvg
 .\"    Author: [see the "AUTHOR(S)" section]
-.\" Generator: Asciidoctor 1.5.8
-.\"      Date: 2020-05-11
-.\"    Manual: TikzToSvg Manual
-.\"    Source: TikzToSvg 0.1.0
+.\" Generator: Asciidoctor 2.0.10
+.\"      Date: 2020-08-16
+.\"    Manual: \ \&
+.\"    Source: \ \&
 .\"  Language: English
 .\"
-.TH "TIKZSVG" "1" "2020-05-11" "TikzToSvg 0.1.0" "TikzToSvg Manual"
+.TH "TIKZSVG" "1" "2020-08-16" "\ \&" "\ \&"
 .ie \n(.g .ds Aq \(aq
 .el       .ds Aq '
 .ss \n[.ss] 0
@@ -35,11 +35,14 @@
 .SH "DESCRIPTION"
 .sp
 The tikzsvg(1) command renders TikZ diagrams to SVG.
+.sp
+If \fIINPUT_PATH\fP is set to \fI\-\fP the input will be read from stdin.
 .SH "OPTIONS"
 .sp
 \fB\-o, \-\-output\fP=\fIOUTPUT_PATH\fP
 .RS 4
 Write output to file \fIOUTPUT_PATH\fP.
+If set to \fI\-\fP the output will be written to stdout.
 Defaults to the base name of the input file suffixed with the \fI.svg\fP
 extension. The file is resolved relative to the working directory.
 .RE
@@ -65,7 +68,7 @@
 .RE
 .SH "ENVIRONMENT"
 .sp
-\fBTikzToSvg\fP requires \fIbash\fP, \fIxetex\fP and \fIpdf2svg\fP to be installed. Make sure
+\fBtikztosvg\fP requires \fIxetex\fP and \fIpdf2svg\fP to be installed. Make sure
 any additional LaTeX packages are installed before using them in a diagram.
 .SH "EXIT STATUS"
 .sp
@@ -79,13 +82,14 @@
 Failure (syntax or usage error; configuration error).
 .RE
 .sp
-\fBn\fP
+\fB[n]\fP
 .RS 4
 Failure (document processing failure).
 .RE
 .SH "AUTHORS"
 .sp
-\fBTikzToSvg\fP was written by Pablo Emílio Escobar Gavira <\c
+\fBtikztosvg\fP was written by Pablo Emilio Escobar Gaviria
+<\c
 .MTO "pablo\-escobar\(atriseup.net" "" ">."
 .sp
 \fBpdf2svg\fP was written by David Barton <\c
@@ -95,9 +99,9 @@
 .MTO "matthew.flaschen\(atgatech.edu" "" ">."
 .SH "RESOURCES"
 .sp
-\fBGit source repository on GitHub:\fP \c
-.URL "https://github.com/GarkGarcia/tikzsvg" "" ""
+\fBGit source repository on GitLab:\fP \c
+.URL "https://gitlab.com/pablo\-escobar/tikztosvg" "" ""
 .SH "COPYING"
 .sp
-Copyright (C) 2020 Pablo Emílio Escobar Gaviria.
+Copyright (C) 2020 Pablo Emilio Escobar Gaviria.
 Free use of this software is granted under the terms of the GPL\-3.0 License.
\ No newline at end of file

Modified: trunk/Master/texmf-dist/doc/man/man1/tikztosvg.man1.pdf
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.adoc
===================================================================
--- trunk/Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.adoc	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.adoc	2020-08-16 21:36:48 UTC (rev 56122)
@@ -0,0 +1,7 @@
+== Release 0.1.2
+
+* The script is now posix-complient (it doesn't use bash anymore)
+* Messages in the log output are now color-coded
+* The script now support `stdin` input and `stdout` output
+* The documentation is now rendered to PDF
+* The documentation was updated

Added: trunk/Master/texmf-dist/doc/support/tikztosvg/Makefile
===================================================================
--- trunk/Master/texmf-dist/doc/support/tikztosvg/Makefile	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/support/tikztosvg/Makefile	2020-08-16 21:36:48 UTC (rev 56122)
@@ -0,0 +1,35 @@
+# Packages the application for CTAN
+package:
+	# Render the manpage
+	asciidoctor -b manpage -o man/tikztosvg.1 man/man.adoc
+	 
+	# Render the README as PDF
+	asciidoctor -r asciidoctor-pdf -b pdf -o tikztosvg.pdf README.adoc
+	
+	# Render the README as Markdown
+	asciidoctor -b docbook -a leveloffset=+1 -o - README.adoc \
+		| pandoc --atx-headers \
+						 --wrap=preserve \
+						 -t markdown_github \
+						 -f docbook - \
+		| comby '![:[name]](:[link])' \
+						'![:[name]](examples/:[link])' \
+						-stdin \
+						-stdout \
+						-m .md \
+		| comby  ':imagesdir: :[[value]]' '' -stdin -stdout -m .md \
+		| comby  ':source-highlighter: :[[value]]' '' -stdin -stdout -m .md \
+		> README.md
+	
+	# Package the repository as a tar file
+	tar -cvO \
+			--directory=.. \
+			--exclude='.*' \
+			--exclude='*.tar.gz' \
+			--exclude='README.adoc' \
+			tikztosvg \
+		| gzip -c /dev/stdin > tikztosvg.tar.gz
+
+install:
+	sh install.sh
+


Property changes on: trunk/Master/texmf-dist/doc/support/tikztosvg/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/support/tikztosvg/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/tikztosvg/README.md	2020-08-16 08:10:47 UTC (rev 56121)
+++ trunk/Master/texmf-dist/doc/support/tikztosvg/README.md	2020-08-16 21:36:48 UTC (rev 56122)
@@ -1,79 +1,67 @@
 # tikztosvg(1)
-Pablo Emílio Escobar Gaviria <pablo-escobar at riseup.net>
 
-The `tikztosvg(1)` command renders TikZ diagrams to SVG, using 
-[`bash`](https://www.gnu.org/software/bash/), [`xetex`](http://xetex.sourceforge.net/) and 
-[`pdf2svg`](https://github.com/dawbarton/pdf2svg).
+Pablo Emilio Escobar Gaviria <<pablo-escobar at riseup.net>>  
 
+The `tikztosvg(1)` command renders TikZ diagrams to SVG, using [`xetex`](http://xetex.sourceforge.net/) and [`pdf2svg`](https://github.com/dawbarton/pdf2svg).
+
 ## Usage
 
-```
-tikztosvg [OPTION]... INPUT_PATH
-```
+    tikztosvg [OPTION]... INPUT_PATH
 
+If *INPUT\_PATH* is set to *-* the input will be read from stdin.
+
 ### Options
 
-**-o, --output=OUTPUT_PATH**
-* Write output to file *OUTPUT_PATH*.
-  Defaults to the base name of the input file suffixed with the _.svg_ 
-  extension. The file is resolved relative to the working directory.
+**-o, --output**=*OUTPUT\_PATH*  
+Write output to file *OUTPUT\_PATH*. If set to *-* the output will be written to stdout. Defaults to the base name of the input file suffixed with the *.svg* extension. The file is resolved relative to the working directory.
 
-**-p, --package=+PACKAGE**
-* Include `\usepackage{PACKAGE}` when rendering the diagram.
+**-p, --package**=+*PACKAGE*  
+Include `\usepackage{PACKAGE}` when rendering the diagram.
 
-**-q, --quiet**
-* Silence application log messages and script warnings.
+**-q, --quiet**  
+Silence application log messages and script warnings.
 
-**-h, --help**
-* Print a help message.
+**-h, --help**  
+Print a help message.
 
-**-v, --version**
-* Print version information.
+**-v, --version**  
+Print version information.
 
 ## Example
 
-Let's say you want to convert the file `exemple.tikz` to SVG:
+Let’s say you want to convert the file `example.tikz` to SVG:
 
-```tex
+``` latex
 \begin{tikzcd}
     G \arrow[r, "\varphi"] \arrow[d, "\psi"', two heads] & H \\
-    \sfrac{G}{\ker \varphi} \arrow[ru, dotted]           &  
+    \sfrac{G}{\ker \varphi} \arrow[ru, dotted]           &
 \end{tikzcd}
 ```
 
 You could achieve that by running the following command:
 
-```
-tikztosvg -p tikz-cd -p xfrac example.tikz
-```
+    tikztosvg -p tikz-cd -p xfrac example.tikz
 
 The results will be stored in the file `example.svg`:
 
-![example](https://github.com/GarkGarcia/tikztosvg/raw/master/example/example.svg)
+![example](examples/example.svg)
 
 ## Installation
 
-The `tikztosvg(1)` command and it's man page can be installed in Unix systems by 
-running:
+The `tikztosvg(1)` command and it’s man page can be installed in Unix systems by running:
 
-```
-$ curl -s https://raw.githubusercontent.com/GarkGarcia/tikztosvg/master/install.sh | sudo sh
-```
+    $ curl -s https://gitlab.com/pablo-escobar/tikztosvg/-/raw/master/install.sh | sudo sh
 
-The executable is installed in `$HOME/.local/bin/` and the man-page is 
-installed in `$HOME/.local/share/man/man1/`.
+The executable is installed in `$HOME/.local/bin/` and the man-page is installed in `$HOME/.local/share/man/man1/`.
 
 ## Authors
 
-**TikzToSvg** was written by 
-[Pablo Emílio Escobar Gavira](mailto:pablo-escobar at riseup.net).
+**tikztosvg** was written by [Pablo Emilio Escobar Gaviria](mailto:pablo-escobar at riseup.net).
 
-**pdf2svg** was written by [David Barton](mailto:davebarton at cityinthesky.co.uk) 
-and [Matthew Flaschen](mailto:matthew.flaschen at gatech.edu).
+**pdf2svg** was written by [David Barton](mailto:davebarton at cityinthesky.co.uk) and [Matthew Flaschen](mailto:matthew.flaschen at gatech.edu).
 
 ## License
 
-© 2020 Pablo Emílio Escobar Gaviria.
+© 2020 Pablo Emilio Escobar Gaviria.
 
 Free use of this software is granted under the terms of the GPL-3.0 License.
-

Modified: trunk/Master/texmf-dist/doc/support/tikztosvg/install.sh
===================================================================
--- trunk/Master/texmf-dist/doc/support/tikztosvg/install.sh	2020-08-16 08:10:47 UTC (rev 56121)
+++ trunk/Master/texmf-dist/doc/support/tikztosvg/install.sh	2020-08-16 21:36:48 UTC (rev 56122)
@@ -1,66 +1,63 @@
+#!/bin/sh
+
+puts ()
+{
+    printf "\033[1m\033[38;5;%sm[%s]\033[m %s\n\n" "$3" "$1" "$2"
+}
+
 error ()
 {
-    echo "ERROR: $1"
+    puts ERROR "$1" 9
     exit 1
 }
 
-dependecyError () 
+dependencyWarning () 
 {
-    echo "ERROR: The command '$1' could not be found."
-    echo "Please make sure it is included in the \$PATH enviroment variable or follow the installation instructions on $2."
-    exit 1
+    puts WARNING "$(printf "The command '%s' could not be found.\nPlease make sure it is included in the \$PATH enviroment variable or follow the installation instructions on %s." "$1" "$2")" 3
 }
 
-if [ "$(id -u)" -ne "0" ]; then
+message ()
+{
+    puts INSTALLER "$1" 2
+}
+
+if [ "$(id -u)" -ne "0" ]
+then
     error "This script requires administrator-privileges"
 fi
 
-if [ -z "$(which bash)" ]; then
-    dependencyError "bash" "https://www.gnu.org/software/bash//"
+if ! [ -x "$(command -v xelatex)" ]
+then
+    dependencyWarning "xelatex" "https://tug.org/texlive/"
 fi
 
-if [ -z "$(which xelatex)" ]; then
-    dependencyError "xelatex" "https://tug.org/texlive/"
+if ! [ -x "$(command -v pdf2svg)" ]
+then
+    dependencyWarning "pdf2svg" "https://github.com/dawbarton/pdf2svg"
 fi
 
-if [ -z "$(which pdf2svg)" ]; then
-    dependencyError "pdf2svg" "https://github.com/dawbarton/pdf2svg"
+message "Installing tikztosvg(1)"
+
+if [ -f "$HOME/.local/bin/tikztosvg" ]
+then
+    rm "$HOME/.local/bin/tikztosvg"
 fi
 
-printf "INSTALLING tikztosvg(1):\n\n"
+wget https://gitlab.com/pablo-escobar/tikztosvg/-/raw/master/tikztosvg -P "$HOME/.local/bin/"\
+    && chmod +x "$HOME/.local/bin/tikztosvg"\
+    || exit 1
 
-if [ -f $HOME/.local/bin/tikztosvg ]; then
-    rm $HOME/.local/bin/tikztosvg
-fi
+tmp="$(mktemp -d)"
+message "Installing manual entry for tikztosvg(1)"
+wget https://gitlab.com/pablo-escobar/tikztosvg/-/raw/master/man/tikztosvg.1 -P "$tmp"\
+    && install -g 0 -o 0 -m 0644 "$tmp/tikztosvg.1" "$HOME/.local/share/man/man1/"\
+    || exit 1
 
-wget https://raw.githubusercontent.com/GarkGarcia/tikztosvg/master/tikztosvg -P $HOME/.local/bin/
-
-if [ "$?" -ne "0" ]; then
-    exit 1
+if [ -f "$HOME/.local/share/man/man1/tikztosvg.1.gz" ]
+then
+    rm "$HOME/.local/share/man/man1/tikztosvg.1.gz"
 fi
 
-chmod +x $HOME/.local/bin/tikztosvg
+gzip "$HOME/.local/share/man/man1/tikztosvg.1"
+rm "$tmp" -r
 
-man "tikztosvg" > /dev/null 2>&1
-if [ "$?" -ne "0" ]; then
-    tmp="$(mktemp -d)"
-    printf "INSTALLING MANUAL ENTRY FOR tikztosvg(1):\n\n"
-    wget https://raw.githubusercontent.com/GarkGarcia/tikztosvg/master/man/tikztosvg.1 -P "$tmp"
-    install -g 0 -o 0 -m 0644 "$tmp/tikztosvg.1" $HOME/.local/share/man/man1/
-    
-    if [ "$?" -ne "0" ]; then
-        exit 1
-    fi
-
-    if [ -f $HOME/.local/share/man/man1/tikztosvg.1.gz ]; then
-        rm $HOME/.local/share/man/man1/tikztosvg.1.gz
-    fi
-
-        gzip $HOME/.local/share/man/man1/tikztosvg.1
-    rm "$tmp" -r
-    
-    if [ "$?" -ne "0" ]; then
-        exit 1
-    fi
-fi
-

Modified: trunk/Master/texmf-dist/doc/support/tikztosvg/man.adoc
===================================================================
--- trunk/Master/texmf-dist/doc/support/tikztosvg/man.adoc	2020-08-16 08:10:47 UTC (rev 56121)
+++ trunk/Master/texmf-dist/doc/support/tikztosvg/man.adoc	2020-08-16 21:36:48 UTC (rev 56122)
@@ -1,7 +1,7 @@
 = tikzsvg(1)
 :doctype: manpage
-:man manual: TikzToSvg Manual
-:man source: TikzToSvg 0.1.0
+:man-manual: tikztosvg Manual
+:man-source: tikztosvg 0.1.2
 :page-layout: base
 
 == NAME
@@ -16,10 +16,13 @@
 
 The tikzsvg(1) command renders TikZ diagrams to SVG.
 
+If _INPUT_PATH_ is set to _-_ the input will be read from stdin.
+
 == OPTIONS
 
 *-o, --output*=_OUTPUT_PATH_::
   Write output to file _OUTPUT_PATH_.
+  If set to _-_ the output will be written to stdout.
   Defaults to the base name of the input file suffixed with the _.svg_ 
   extension. The file is resolved relative to the working directory.
 
@@ -37,7 +40,7 @@
 
 == ENVIRONMENT
 
-*TikzToSvg* requires _bash_, _xetex_ and _pdf2svg_ to be installed. Make sure 
+*tikztosvg* requires _xetex_ and _pdf2svg_ to be installed. Make sure 
 any additional LaTeX packages are installed before using them in a diagram.
 
 == EXIT STATUS
@@ -48,12 +51,13 @@
 *1*::
   Failure (syntax or usage error; configuration error).
 
-*n*::
+*[n]*::
   Failure (document processing failure).
 
 == AUTHORS
 
-*TikzToSvg* was written by Pablo Emílio Escobar Gavira <pablo-escobar at riseup.net>.
+*tikztosvg* was written by Pablo Emilio Escobar Gaviria 
+<pablo-escobar at riseup.net>.
 
 *pdf2svg* was written by David Barton <davebarton at cityinthesky.co.uk> and 
 Matthew Flaschen <matthew.flaschen at gatech.edu>.
@@ -60,10 +64,10 @@
 
 == RESOURCES
 
-*Git source repository on GitHub:* https://github.com/GarkGarcia/tikzsvg
+*Git source repository on GitLab:* https://gitlab.com/pablo-escobar/tikztosvg
 
 == COPYING
 
-Copyright \(C) 2020 Pablo Emílio Escobar Gaviria.
+Copyright \(C) 2020 Pablo Emilio Escobar Gaviria.
 Free use of this software is granted under the terms of the GPL-3.0 License.
 

Added: trunk/Master/texmf-dist/doc/support/tikztosvg/tikztosvg.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/support/tikztosvg/tikztosvg.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/support/tikztosvg/tikztosvg.pdf	2020-08-16 08:10:47 UTC (rev 56121)
+++ trunk/Master/texmf-dist/doc/support/tikztosvg/tikztosvg.pdf	2020-08-16 21:36:48 UTC (rev 56122)

Property changes on: trunk/Master/texmf-dist/doc/support/tikztosvg/tikztosvg.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/scripts/tikztosvg/tikztosvg
===================================================================
--- trunk/Master/texmf-dist/scripts/tikztosvg/tikztosvg	2020-08-16 08:10:47 UTC (rev 56121)
+++ trunk/Master/texmf-dist/scripts/tikztosvg/tikztosvg	2020-08-16 21:36:48 UTC (rev 56122)
@@ -1,181 +1,203 @@
-#!/bin/bash
+#!/bin/sh
 
 puts() 
 {
-    echo "[$1] $2"
+  printf "\033[1m\033[38;5;%sm[%s]\033[m %s\n" "$3" "$1" "$2"
 }
 
 error()
 {
-    puts "ERROR" "$1" r
+  puts "ERROR" "$1" "9"
 
-    if [ -n "$2" ]
-    then
-        exit $2
-    else
-        exit 1
-    fi
+  if [ -n "$2" ]
+  then
+    exit "$2"
+  else
+    exit 1
+  fi
 }
 
 message()
 {
-    puts "TIKZTOSVG" "$1" g
+  puts "TIKZTOSVG" "$1" "2"
 }
 
 showHelp()
 {
-    man tikztosvg
-    exit 0
+  man tikztosvg
+  exit 0
 }
 
 showVersion()
 {
-    echo 0.1.0
-    exit 0
+  echo 0.1.2
+  exit 0
 }
 
-if [ -z "$(which xelatex)" ]
+if ! [ -x "$(command -v xelatex)" ]
 then
-    error "xelatex could not be found"
+  error "xelatex could not be found"
 fi
 
-if [ -z "$(which pdf2svg)" ]
+if ! [ -x "$(command -v pdf2svg)" ]
 then
-    error "pdf2svg could not be found"
+  error "pdf2svg could not be found"
 fi
 
 # Parsing the arguments
-PACKAGES=()
+PACKAGES=""
 while [ $# -gt 1 ]
 do
-    case "$1" in
-        -h|--help)
-            showHelp
-            ;;
-        -v|--version)
-            showVersion
-            ;;
-        -p|--package)
-            if [ -z "$2" ]
-            then
-                error "Unnexpected EOF"
-            else
-                PACKAGES+=("$2")
-                shift
-                shift
-            fi
-            ;;
-        -o|--output)
-            if [ -n "$OUTPUT" ]
-            then
-                error "The output path was specified multiple times"
-            else if [ -z "$2" ]
-            then
-                error "Unexpected EOF"
-                exit 1
-            else
-                OUTPUT="$2"
-                shift
-                shift
-            fi
-            fi
-            ;;
-        -q|--quit)
-            QUIET=1
-            shift
-            ;;
-        *) 
-            error "Unexpected token: \"$1\""
-            ;;
-    esac
+  case "$1" in
+    -h|--help)
+      showHelp
+      ;;
+    -v|--version)
+      showVersion
+      ;;
+    -p|--package)
+      case "$2" in
+        "")
+          error "Unnexpected EOF"
+          ;;
+        # Check if the name of the package is valid
+        *" "*) 
+          error "Invalid package name. LaTeX package names cannot contain scapes!" 
+          ;;
+        *)
+          PACKAGES="$PACKAGES $2"
+          shift
+          shift
+      esac
+      ;;
+    -o|--output)
+      if [ -n "$OUTPUT" ]
+      then
+        error "The output path was specified multiple times"
+      elif [ -z "$2" ]
+      then
+        error "Unexpected EOF"
+      else
+        OUTPUT="$2"
+        shift
+        shift
+      fi
+      ;;
+    -q|--quit)
+      QUIET=1
+      shift
+      ;;
+    *) 
+      error "Unexpected token: \"$1\""
+      ;;
+  esac
 done
 
 case "$1" in
-    -h|--help)
-        showHelp
-        ;;
-    -v|--version)
-        showVersion
-        ;;
-    "")
-        error "No input path provided"
-        ;;
-    *)
-        INPUT="$1"
+  -h|--help)
+    showHelp
+    ;;
+  -v|--version)
+    showVersion
+    ;;
+  "")
+    error "No input path provided"
+    ;;
+  "-")
+    INPUT=/dev/stdin
+    ;;
+  *)
+    INPUT="$1"
+    ;;
 esac
 
-if [ -z "$OUTPUT" ]
-then
-    OUTPUT="$(echo $(basename $INPUT) | cut -d "." -f1)"
-fi
+case "$OUTPUT" in
+  # Set the output to stdout
+  -)
+    QUIET=1
+    OUTPUT=/dev/stdout
+    ;;
 
+  # If no output path is provided, use the basename of the input
+  "") 
+    if [ -x "$(command -v dirname)" ]
+    then
+      OUTPUT="$(dirname "$INPUT")/$(basename "$INPUT" | cut -d "." -f1).svg" 
+    fi
+    ;;
+
+  # If the output path is provided, but it resolves to directory, output a 
+  # a file with the same basename as the input in the target directory
+  */) 
+    OUTPUT="$OUTPUT$(basename "$INPUT" | cut -d "." -f1).svg" 
+    ;;
+esac
+
 TEMP_DIR="$(mktemp -d)"
 TEX_FILE="$TEMP_DIR/tmp.tex"
 
 # Generate the LaTeX document
-echo "\documentclass[crop,tikz,multi=false]{standalone}" > $TEX_FILE
+printf "\documentclass[crop,tikz,multi=false]{standalone}\n" > "$TEX_FILE"
 
-for PACKAGE in "${PACKAGES[@]}"
+for PACKAGE in $PACKAGES
 do
-    echo "\usepackage{$PACKAGE}" >> $TEX_FILE
+  printf "\usepackage{%s}\n" "$PACKAGE" >> "$TEX_FILE"
 done
 
-echo "\begin{document}" >> $TEX_FILE
-echo "\huge" >> $TEX_FILE
+printf "\\\begin{document} \huge\n" >> "$TEX_FILE"
+cat "$INPUT" >> "$TEX_FILE"
 
-cat $INPUT >> $TEX_FILE
-
 if [ $? -ne 0 ]
 then
-    rm $TEMP_DIR -r
-    error "File not found: $INPUT"
+  rm "$TEMP_DIR" -r
+  error "File not found: $INPUT"
 fi
 
-echo "\end{document}" >> $TEX_FILE
+printf "\\\end{document}\n" >> "$TEX_FILE"
 
 if [ -z "$QUIET" ]
 then
-    message "Rendering the LaTeX document. . ."
-    xelatex -output-directory=$TEMP_DIR $TEX_FILE
+  message "Rendering the LaTeX document. . ."
+  xelatex -halt-on-error -output-directory="$TEMP_DIR" "$TEX_FILE"
 else
-    xelatex -halt-on-error -output-directory=$TEMP_DIR $TEX_FILE 1> /dev/null 2>&1
+  xelatex -halt-on-error -output-directory="$TEMP_DIR" "$TEX_FILE" 1> /dev/null 2>&1
 fi
 
 S=$?
 if [ $S -ne 0 ]
 then
-    rm $TEMP_DIR -r
-    if [ -z "$QUIET" ]
-    then
-        error "xelatex exited with code $S" $S
-    else
-        exit $S
-    fi
+  rm "$TEMP_DIR" -r
+  if [ -z "$QUIET" ]
+  then
+    error "xelatex exited with code $S" $S
+  else
+    exit $S
+  fi
 fi
 
 if [ -z "$QUIET" ]
 then
-    message "Converting the output to SVG. . ."
+  message "Converting the output to SVG. . ."
 fi
 
-pdf2svg "$TEMP_DIR/tmp.pdf" $OUTPUT 1
+pdf2svg "$TEMP_DIR/tmp.pdf" "$OUTPUT" 1
 
 S=$?
 if [ $S -ne 0 ]
 then
-    rm $TEMP_DIR -r
-    if [ -z "$QUIET" ]
-    then
-        error "pdf2svg exited with code $S" $S
-    else
-        exit $S
-    fi
+  rm "$TEMP_DIR" -r
+  if [ -z "$QUIET" ]
+  then
+    error "pdf2svg exited with code $S" $S
+  else
+    exit $S
+  fi
 fi
 
 if [ -z "$QUIET" ]
 then
-    message "Done!"
+  message "Done!"
 fi
 
-rm "$TEMP_DIR" -r
+rm "$TEMP_DIR" -rf
 

Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds	2020-08-16 08:10:47 UTC (rev 56121)
+++ trunk/Master/tlpkg/libexec/ctan2tds	2020-08-16 21:36:48 UTC (rev 56122)
@@ -2677,6 +2677,7 @@
  'texdraw',		'NULL',
  'texosquery',		'java|\.batch$|' . $standardsource,
  'thailatex',           'NULL',                 # no gain in splitting up
+ 'tikztosvg',		'NULL',			# not Makefile
  'tlcockpit',		'TODO|build|project|src',
  'translation-array-fr',        'NULL',         # doc
  'translation-chemsym-de',      'NULL',         # doc



More information about the tex-live-commits mailing list.