diff options
author | Norbert Preining <norbert@preining.info> | 2023-09-14 03:01:37 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-09-14 03:01:37 +0000 |
commit | 527001b634c06d34f92d1809f507add012c320f6 (patch) | |
tree | 17d54020bd8e320a65d118c5036beed8e4e18cb9 /support/runtexshebang | |
parent | de0fb15550a55ba5685a755fec7326e21a79fccd (diff) |
CTAN sync 202309140301
Diffstat (limited to 'support/runtexshebang')
-rw-r--r-- | support/runtexshebang/README.md | 7 | ||||
-rwxr-xr-x | support/runtexshebang/runtexshebang.lua | 60 |
2 files changed, 60 insertions, 7 deletions
diff --git a/support/runtexshebang/README.md b/support/runtexshebang/README.md index e96825b9c1..7c3f233b2d 100644 --- a/support/runtexshebang/README.md +++ b/support/runtexshebang/README.md @@ -158,8 +158,15 @@ You can typeset a LaTeX document file in a Docker container as below. ## References +### Commentary + * [TeXworks、TeXShop、VSCodeでTeX-style shebangしてみた - Qiita](https://qiita.com/munepi/items/a30c68133cfffbf4d189) (in Japanese) +### Tools supporting `%#!` + +* [YaTeX](https://www.yatex.org/): Yet Another TeX mode for Emacs +* [llmk](https://github.com/wtsnjp/llmk): Light LaTeX Make + Enjoy Happy TeXing! diff --git a/support/runtexshebang/runtexshebang.lua b/support/runtexshebang/runtexshebang.lua index 11240adfe0..670bdc2b33 100755 --- a/support/runtexshebang/runtexshebang.lua +++ b/support/runtexshebang/runtexshebang.lua @@ -22,15 +22,61 @@ -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -if not ( #arg == 1 ) then - print("runtexshebang 20230909 v0.3") - print("") - print("Usage: runtexshebang [input.tex]") - os.exit(0) +NAME = "runtexshebang" +VERSION = "20230913 v0.4" +USAGE = [[ +Usage: runtexshebang [input.tex] + +Options: + -h, --help print help + -v, --version print version + +See also: +The command + texdoc runtexshebang +should give you access to the README. +]] + +function whoami() + print(NAME .. " " .. VERSION) end -local line_ctr = 0 -for line in io.lines(arg[1]) do +function help() + whoami() + print() + print(USAGE) +end + +if #arg == 0 then + help() + os.exit(0) +end + +-- +texfilename = "" +narg = 1 +repeat + this_arg = arg[narg] + -- replace double dash by single dash at the beginning + this_arg = string.gsub(this_arg, "^%-%-", "-") + + if this_arg == "-h" or this_arg == "-help" then + help() + os.exit(0) + elseif this_arg == "-v" or this_arg == "-version" then + whoami() + os.exit(0) + else + texfilename = this_arg + end --if this_arg == ... + narg = narg+1 +until narg > #arg + +-- main process +whoami() + +line_ctr = 0 +for line in io.lines(texfilename) do line_ctr = line_ctr + 1 if line_ctr > 20 then break end |