Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-image-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache,mode=max \
--tag ghcr.io/ximeraproject/ximeralatex:latest \
--file docker/Dockerfile \
--file docker/Dockerfile.full \
--push .

# - name: Build and Push full Docker image
Expand Down
3 changes: 3 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ RUN tlmgr update --self; \
needspace \
ninecolors


RUN apt-get install -y mupdf-tools lsof

# make4ht is not in /usr/local/bin if installed with tlmgr!!!
ENV PATH="$PATH:/usr/local/texlive/2024/bin/x86_64-linux"

Expand Down
3 changes: 3 additions & 0 deletions docker/Dockerfile.full
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ RUN apt-get update -y; \
ADD docker/hashcash_1.22-1_amd64.deb .
RUN dpkg -i hashcash_1.22-1_amd64.deb

RUN apt-get install -y mupdf-tools lsof


# Add this complete ximeraLatex repo (is overkill, but allows bugfixing/editing inside the docker image!
# It automatically adds the luaxake and xmlatex scripts
RUN mkdir -p /root/texmf/tex/latex
Expand Down
34 changes: 30 additions & 4 deletions luaxake/luaxake
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ Options:
--compile (default none) Compile sequence (default 'pdf,html', or as set in settings)
--settingsfile (default none) Luaxake settings script
--configfile (default none) TeX4ht config file
-j,--jobs (optional 1..1000) Number of compile jobs to run in parallel
-j,--jobs (optional 1..1000) Number of compile jobs to run in parallel
--img_format (default svg) Either svg or png for image-format in HTML

Possible commands:
bake
Expand Down Expand Up @@ -171,6 +172,16 @@ config = {
output_format = "html",
infix = "draft" ,
},
["htmlexport"] = { -- NEW, TEST
-- command = 'pdflatex -interaction=nonstopmode -file-line-error -shell-escape -jobname @{basename}.handout "\\PassOptionsToClass{handout}{ximera}\\PassOptionsToClass{handout}{xourse}\\input{@{filename}}"',
command = "make4ht -l -c @{configfile} -f html5 -m draft -d build -j @{basename} -s @{make4ht_extraoptions} @{filename} 'svg,htex4ht,mathjax,-css' '' '' '--interaction=nonstopmode -shell-escape -file-line-error'",
check_log = true, -- check log
status = 0, -- check that the latex command return 0
post_command = 'post_process_html',
extension = "html",
output_format = "html",
infix = "" ,
},
["make4ht.html"] = {
command = "make4ht -l -c @{configfile} -f html5+dvisvgm_hashes -j @{basename}.make4ht -s @{make4ht_extraoptions} @{filename} 'svg,htex4ht,mathjax,-css' '' '' '--interaction=nonstopmode -shell-escape -file-line-error'",
check_log = true, -- check log
Expand All @@ -188,7 +199,7 @@ config = {
post_command = 'post_process_html',
extension = "html",
output_format = "html",
infix = "draft" ,
infix = "tikz" ,
},
["test.html"] = {
-- command = "make4ht -f html5+dvisvgm_hashes -c @{configfile} -sm draft @{filename}",
Expand All @@ -201,7 +212,6 @@ config = {
output_format = "html",
infix = "make4ht" ,
},

-- sage not tested/implemented !!!!
["sagetex.sage"] = {
command = "sage @{output_file}",
Expand All @@ -210,6 +220,20 @@ config = {
status = 0, -- check that the latex command return 0
extension = "sage", -- ?
},
["pdfexport"] = { -- NEW, TEST
-- this doesn't work well
command = 'pdflatex -j @{basename} -interaction=nonstopmode -file-line-error -shell-escape "\\PassOptionsToClass{tikzexport}{ximera}\\PassOptionsToClass{tikzexport}{ximera}\\PassOptionsToClass{tikzexport}{xourse}\\nonstopmode\\input{@{filename}}"',
-- command = 'pdflatex -interaction=nonstopmode -file-line-error -shell-escape "\\PassOptionsToClass{xake}{ximera}\\PassOptionsToClass{xake}{xourse}\\input{@{filename}}"',
check_log = true, -- check log
status = 0, -- check that the latex command return 0
infix = "" , -- used for .handout, and .make4k4
extension = "pdf", -- not used ????
output_format = "pdf",-- the extension of the 'final' output file, that is eg checked for uptodate-ness
post_command = 'post_process_pdf',
download_folder = 'ximera-downloads/pdfexport',
-- post_command = 'post_process_pdf',
-- download_folder = 'ximera-downloads/with-answers',
},
-- a dummy test: create .ddd files that contain the date ..
ddd = {
command = 'date >@{basename}.ddd',
Expand Down Expand Up @@ -276,6 +300,7 @@ config = {
-- number of lines in tex files where we should look for \documentclass
-- dump_fileinfo = "aFirstXourse.tex",
jobs = 2,
img_format = "svg",
}


Expand Down Expand Up @@ -326,6 +351,7 @@ config.noclean = args.noclean or os.getenv("XM_NOCLEAN") or co
config.nodependencies = args.nodependencies or os.getenv("XM_NODEPENDENCIES") or config.nodependencies
config.force = args.force or os.getenv("XM_FORCE") or config.force
config.jobs = args.jobs or os.getenv("XM_JOBS") or config.jobs
config.img_format = args.img_format or os.getenv("XM_IMG_FORMAT") or config.img_format

if args.configfile ~= "none" then
config.configfile = args.configfile
Expand Down Expand Up @@ -663,4 +689,4 @@ if command == "extrainfo" then
log:infof("Potentially duplicate labels:")
require 'pl.pretty'.dump(all_labels)
end
end
end
2 changes: 1 addition & 1 deletion luaxake/luaxake-files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ local function update_output_files(metadata, extensions)
end
metadata.needs_compilation = needs_compilation

log:infof( "Marked source %-12s %-18s for %s", metadata.extension, needs_compilation and 'NEEDS_COMPILATIONS' or 'NO_COMPILATION', metadata.relative_path)
log:debugf( "Marked source %-12s %-18s for %s", metadata.extension, needs_compilation and 'NEEDS_COMPILATIONS' or 'NO_COMPILATION', metadata.relative_path)

if metadata.tex_documentclass == "ximera" or metadata.tex_documentclass == "xourse"
then
Expand Down
31 changes: 24 additions & 7 deletions luaxake/luaxake-transform-html.lua
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,18 @@ local function get_associated_files(dom, file)

ass_files[#ass_files+1] = src

-- local u = url.parse(src)
-- if false and get_extension(u.path) == "svg"
-- then
-- local png = u.path:gsub(".svg$", ".png")
-- log:debug("also adding "..png)
-- ass_files[#ass_files+1] = png
-- end
local u = url.parse(src)
if get_extension(u.path) == "svg"
then
local png = u.path:gsub(".svg$", ".png")
log:debugf("also adding PNG %s", png)
ass_files[#ass_files+1] = png
elseif get_extension(u.path) == "png"
then
local svg = u.path:gsub(".png$", ".svg")
log:debugf("also adding SVG %s", svg)
ass_files[#ass_files+1] = svg
end

::next_image::
end
Expand Down Expand Up @@ -463,6 +468,18 @@ local function post_process_html(cmd)
cmd.error = msg
return cmd
end

-- find all <img> elements
for _, img in ipairs(dom:query_selector("img")) do
local src = img:get_attribute("src")
if src then
local pat = file.basename .. "(%d+)x%.svg"
local new = src:gsub(pat, "tikz/"..file.basename.."-figure%1." .. config.img_format)
log:debugf("Set src in %s to %s (from %s).", file.basename, new, src)

img:set_attribute("src", new)
end
end


local ret, msg = update_html_fileinfo(file, dom) -- not really 'post-processing', but implicit checking-of-generated-images
Expand Down
11 changes: 8 additions & 3 deletions xmScripts/xmlatex
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ if [[ -d .ximera_local ]]; then
if [[ -f .ximera_local/xmScripts/xmlatex ]]; then
PATH=.ximera_local/xmScripts/:$PATH
echo "USING local xmlatex script ($(type xmlatex))"
# THIS CAN NOT POSSIBLY WORK: the script is running already !!!
fi
fi

Expand Down Expand Up @@ -843,11 +844,15 @@ then
echo "Starting name (from bash script $0)"
xake_name
## TODO?: get rid of these combinations, and put them in luaxake ... ?
elif [[ "$COMMAND" == "all" ]]
elif [[ "$COMMAND" == "all" ]] # OPTION USED FOR ADHOC CALCULUS DEPLOYMENT 2025/09/02
then
echo "Starting all (bake/name/frost/serve)"
echo "Starting all (bake pdfexport/bake htmlexport/name/frost/serve; no ximera-downloads)"
shift
$LUAXAKE bake $* || error "Problem with 'bake'; Exiting..."
# HACK: split
$LUAXAKE bake --compile pdfexport $* || error "Problem with 'bake'; Exiting..."
$LUAXAKE bake --compile htmlexport $* || error "Problem with 'bake'; Exiting..."

rm -rf ximera-downloads/* # contains pdfexport versions

# git remote show ximera 2>/dev/null || xake_name

Expand Down