-
-
Save stormvirux/1ae3dc19a116964f03abdf6ee0934738 to your computer and use it in GitHub Desktop.
Revisions
-
stormvirux revised this gist
May 30, 2022 . 1 changed file with 7 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ ## Clean-up Comments from Latex Source Files ## Copyright (c) 2020 Ali Parsai [email protected] ## Copyright (c) 2021 Thaha Mohammed ## ## Dependencies: sponge from moreutils, latexpand, sed, cat, mv, date, cp ## @@ -42,12 +43,12 @@ check_dependency latexpand #dt=$(date '+%d%m%Y-%H%M%S') #for src in "$@" # do # backup="${src}.bak.${dt}" # cp -v "$src" "$backup" # done for src in "$@" do -
aliparsai revised this gist
Jan 23, 2020 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,7 @@ check_dependency () { if type $1 ; then echo "==> $1 found." else echo "==> $1 not found. Exitting." exit 1 fi } @@ -41,7 +41,8 @@ check_dependency sponge check_dependency latexpand dt=$(date '+%d%m%Y-%H%M%S') for src in "$@" do backup="${src}.bak.${dt}" -
aliparsai revised this gist
Jan 23, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,6 +45,7 @@ dt=$(date '+%d/%m/%Y %H:%M:%S') for src in "$@" do backup="${src}.bak.${dt}" cp -v "$src" "$backup" done for src in "$@" -
aliparsai created this gist
Jan 23, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ #!/bin/bash ## Clean-up Comments from Latex Source Files ## Copyright (c) 2020 Ali Parsai [email protected] ## ## Dependencies: sponge from moreutils, latexpand, sed, cat, mv, date, cp ## ## CAUTION: Use version control or backup your files before using this script. ## ## How to use: comment-cleanup.sh TEX_FILE(S) ## ## 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 ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program. If not, see <https://www.gnu.org/licenses/>. ## check_dependency () { if type $1 ; then echo "==> $1 found." else date "==> $1 not found. Exitting." exit 1 fi } check_dependency mv check_dependency cp check_dependency date check_dependency cat check_dependency sed check_dependency sponge check_dependency latexpand dt=$(date '+%d/%m/%Y %H:%M:%S') for src in "$@" do backup="${src}.bak.${dt}" done for src in "$@" do dest="${src/.tex/-stripped.tex}" latexpand --empty-comments --keep-includes "$src" > "$dest" sed -i '/^\s*%/d' "$dest" cat -s "$dest" | sponge "$dest" mv "$dest" "$src" echo "==> Processed: $src" done