Skip to content

Commit

Permalink
Install dvisvgm manually and fix ruby encodign issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hendricius committed Nov 24, 2023
1 parent 6b825d3 commit a850d5e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
34 changes: 32 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,51 @@ RUN apt-get update && \
make \
tidy \
pandoc \
dvisvgm \
zip \
git \
wget \
ruby3.1 \
ruby-dev \
imagemagick \
build-essential
rsync \
wget \
perl \
xzdec \
# dvisvgm dependencies
build-essential \
fonts-texgyre \
fontconfig \
libfontconfig1 \
libkpathsea-dev \
libptexenc-dev \
libsynctex-dev \
libx11-dev \
libxmu-dev \
libxaw7-dev \
libxt-dev \
libxft-dev \
libwoff-dev

# Install TeX
RUN apt-get update && \
apt-get install -y --no-install-recommends \
texlive-full \
texlive-luatex

# Compile latest dvisvgm
RUN wget https://github.com/mgieseki/dvisvgm/releases/download/3.1.2/dvisvgm-3.1.2.tar.gz && \
mv dvisvgm-3.1.2.tar.gz dvisvgm.tar.gz && \
tar -xzf dvisvgm.tar.gz && \
cd dvisvgm-* && \
./configure && \
make && \
make install

# Make sure everything is UTF-8
RUN echo "export LC_ALL=en_US.UTF-8" >> /root/.bashrc && \
echo "export LANG=en_US.UTF-8" >> /root/.bashrc


WORKDIR /root

# Install ruby for the website build process
Expand Down
6 changes: 3 additions & 3 deletions website/modify_build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def create_sitemap
html_file_name = fn.split("/")[-1]
content += "#{HOST}/#{html_file_name}\n"
end
File.open("#{build_dir}/sitemap.txt", 'w') { |file| file.write(content) }
File.open("#{build_dir}/sitemap.txt", 'w:UTF-8') { |file| file.write(content) }
end

def build_latex_html
Expand All @@ -41,7 +41,7 @@ def build_latex_html
end

def modify_file(filename)
orig_text = File.read(filename)
orig_text = File.read(filename, encoding: "UTF-8")
text = fix_double_slashes(orig_text)
text = fix_navigation_bar(text)
text = fix_titles(text)
Expand All @@ -61,7 +61,7 @@ def modify_file(filename)
text = add_anchors_to_headers(text)
text = fix_menus_list_figures_tables(text) if is_list_figures_tables?(filename)
text = fix_list_of_figures_tables_display(text) if is_list_figures_tables?(filename)
File.open(filename, "w") {|file| file.puts text }
File.open(filename, "w:UTF-8") {|file| file.puts text }
end

def is_cover_page?(filename)
Expand Down

0 comments on commit a850d5e

Please sign in to comment.