{ "standalone": { "doc": [ "A standalone latex run" , "" , "Define a pdf file as the output of running pdflatex. A correct staging" , "of the needed files has to be given through the runfiles of \"deps\"." ] , "target_fields": ["deps", "srcs"] , "string_fields": ["main", "stage"] , "field_doc": { "srcs": ["The files needed for the latex run."] , "stage": [ "The directory the \"srcs\" logically reside in." , "Entries are joined with \"/\"." ] , "deps": ["Runfiles needed for the run of the standalone latex invocation"] , "main": [ "The entry point for the latex run; should be the base name" , "of a .tex file in \"srcs\"; the \"stage\" is prepended automatically." ] } , "config_vars": ["env", "latex", "TYPESETTING_EXECUTION_PROPERTIES"] , "config_doc": { "latex": ["Name of the latex command, defaults to \"pdflatex\"."] , "env": [ "Any override to the default environment which sets only" , "PATH and SOURCE_DATE_EPOCH" ] , "TYPESETTING_EXECUTION_PROPERTIES": [ "Map of additional remote-execution properties to add for the typesetting" , "actions; defaults to the empty map." ] } , "implicit": {"runner": ["latex_runner.sh"]} , "imports": { "singleton": ["./", "..", "stage_singleton_field"] , "call latex": "call latex" } , "expression": { "type": "let*" , "bindings": [ ["srcs", {"type": "FIELD", "name": "srcs"}] , ["main", {"type": "FIELD", "name": "main"}] , ["deps", {"type": "FIELD", "name": "deps"}] , ["stage", {"type": "FIELD", "name": "stage"}] , ["output file extension", [".pdf"]] , [ "env" , {"type": "var", "name": "env", "default": {"type": "empty_map"}} ] , ["executable", {"type": "var", "name": "latex", "default": "pdflatex"}] , [ "runner" , { "type": "let*" , "bindings": [["fieldname", "runner"], ["location", "runner"]] , "body": {"type": "CALL_EXPRESSION", "name": "singleton"} } ] , ["runner type", "standalone"] ] , "body": {"type": "CALL_EXPRESSION", "name": "call latex"} } } , "verbatim": { "doc": ["Add \\begin{verbatim}...\\end{verbatim} around files"] , "target_fields": ["srcs"] , "string_fields": ["prefix", "stage"] , "field_doc": { "srcs": [ "The files to transform to tex files containing them verbatim." , "In the output file, the ending is changed to .tex" ] , "prefix": ["Additional prefix to add to the output file name"] , "stage": ["The logical directory to stage the outputs to"] } , "expression": { "type": "let*" , "bindings": [ [ "srcs" , { "type": "disjoint_map_union" , "msg": "Source files must not overlap, as this would lead to overlapping output" , "$1": { "type": "foreach" , "var": "src" , "range": {"type": "FIELD", "name": "srcs"} , "body": {"type": "DEP_ARTIFACTS", "dep": {"type": "var", "name": "src"}} } } ] , [ "verbatim files" , { "type": "disjoint_map_union" , "msg": [ "Outputfiles must not overlap" , "Input file names:" , {"type": "keys", "map": {"type": "var", "name": "srcs"}} ] , "$1": { "type": "foreach_map" , "var_key": "src" , "var_val": "input" , "range": {"type": "var", "name": "srcs"} , "body": { "type": "let*" , "bindings": [ [ "action out" , { "type": "ACTION" , "inputs": { "type": "map_union" , "$1": [ { "type": "singleton_map" , "key": "in" , "value": {"type": "var", "name": "input"} } , { "type": "singleton_map" , "key": "begin" , "value": {"type": "BLOB", "data": "\\begin{verbatim}\n"} } , { "type": "singleton_map" , "key": "end" , "value": {"type": "BLOB", "data": "\\end{verbatim}\n"} } ] } , "outs": ["out"] , "cmd": ["sh", "-c", "cat begin in end > out"] } ] , [ "out" , { "type": "lookup" , "map": {"type": "var", "name": "action out"} , "key": "out" } ] , [ "out name" , { "type": "join" , "$1": [ { "type": "join" , "$1": {"type": "FIELD", "name": "prefix"} } , { "type": "change_ending" , "ending": ".tex" , "$1": {"type": "var", "name": "src"} } ] } ] ] , "body": { "type": "singleton_map" , "key": {"type": "var", "name": "out name"} , "value": {"type": "var", "name": "out"} } } } } ] , [ "stage" , { "type": "join" , "separator": "/" , "$1": {"type": "FIELD", "name": "stage"} } ] , [ "staged verbatim files" , { "type": "to_subdir" , "subdir": {"type": "var", "name": "stage"} , "$1": {"type": "var", "name": "verbatim files"} } ] ] , "body": { "type": "RESULT" , "artifacts": {"type": "var", "name": "staged verbatim files"} , "runfiles": {"type": "var", "name": "staged verbatim files"} } } } , "latexmk": { "doc": [ "A latexmk run" , "" , "Call latexmk passing main as the entry point. A correct staging" , "of the needed files has to be given through the runfiles of \"deps\"." ] , "target_fields": ["deps", "srcs"] , "string_fields": ["main", "stage", "opts", "output extension"] , "field_doc": { "srcs": ["The files needed for the latexmk run."] , "stage": [ "The directory the \"srcs\" logically reside in." , "Entries are joined with \"/\"." ] , "deps": ["Runfiles needed for the run of the standalone latex invocation"] , "main": [ "The entry point for the latex run; should be the base name" , "of a .tex file in \"srcs\"; the \"stage\" is prepended automatically." ] , "opts": ["The latexmk options to be used.", "If omitted, \"-pdf\" is assumed"] , "output extension": [ "The extension of the output to be produced (e.g., \".ps\", \".pdf\")." , "If omitted, \".pdf\" is assumed." ] } , "config_vars": ["env", "latexmk", "TYPESETTING_EXECUTION_PROPERTIES"] , "config_doc": { "env": [ "Any override to the default environment which sets only" , "PATH and SOURCE_DATE_EPOCH" ] , "latexmk": ["Name of the latexmk command, defaults to \"latexmk\"."] , "TYPESETTING_EXECUTION_PROPERTIES": [ "Map of additional remote-execution properties to add for the typesetting" , "actions; defaults to the empty map." ] } , "imports": {"call latex": "call latex"} , "expression": { "type": "let*" , "bindings": [ ["srcs", {"type": "FIELD", "name": "srcs"}] , ["main", {"type": "FIELD", "name": "main"}] , ["deps", {"type": "FIELD", "name": "deps"}] , ["stage", {"type": "FIELD", "name": "stage"}] , [ "output file extension" , { "type": "if" , "cond": {"type": "FIELD", "name": "output extension"} , "then": {"type": "FIELD", "name": "output extension"} , "else": [".pdf"] } ] , [ "env" , {"type": "var", "name": "env", "default": {"type": "empty_map"}} ] , [ "executable" , {"type": "var", "name": "latexmk", "default": "latexmk"} ] , ["opts", {"type": "FIELD", "name": "opts"}] , [ "runner" , { "type": "singleton_map" , "key": "runner" , "value": { "type": "BLOB" , "data": { "type": "join" , "separator": "\n" , "$1": [ "set -e" , "LATEXMK=\"$1\"" , "shift" , "MAIN=\"$1\"" , "shift" , "cd work" , "\"$LATEXMK\" -output-directory=\"$(dirname \"$MAIN\")\" \"$@\" \"$MAIN\" > log 2>&1 || (cat log && exit 1)" ] } } } ] , ["runner type", "latexmk"] ] , "body": {"type": "CALL_EXPRESSION", "name": "call latex"} } } }