Skip to content

Commit

Permalink
improved documentation and website publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasWeise committed Dec 3, 2023
1 parent 91e34d5 commit 224c8f6
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 10 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
scheme: full
run: |
apk add make python3 py3-pip
pip install latexgit
make
# deploy to github pages
- name: deploy documentation
Expand Down
41 changes: 36 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,18 @@ pre_clean: status
rm -rf examples/*.pdf &&\
echo "$(NOW): Done deleting all temporary, intermediate, and generated files before the build."

post_clean: build_documentation build_examples extract pre_clean status

# Initialization: Install all Python requirements, both for executing and building the library.
python_dependencies: pre_clean
echo "$(NOW): Initialization: first install required packages from requirements.txt." && \
pip install --no-input --timeout 360 --retries 100 -r requirements.txt && ## nosem \
echo "$(NOW): Finished installing required packages from requirements.txt, now installing packages required for development from requirements-dev.txt." && \
pip install --no-input --timeout 360 --retries 100 -r requirements-dev.txt && ## nosem \
echo "$(NOW): Finished installing requirements from requirements-dev.txt, now printing all installed packages." &&\
pip freeze &&\
echo "$(NOW): Finished printing all installed packages."

post_clean: extract build_documentation build_examples build_website pre_clean python_dependencies status
echo "$(NOW): Deleting all temporary and intermediate files after the build." && \
rm latexgit.aux &&\
rm latexgit.glo &&\
Expand All @@ -61,7 +72,7 @@ extract: pre_clean
rm latexgit.log &&\
echo "$(NOW): Finished extracting the package."

build_examples: extract
build_examples: extract python_dependencies
echo "$(NOW): Now building the examples." &&\
cp latexgit.sty examples &&\
cd examples &&\
Expand Down Expand Up @@ -94,18 +105,38 @@ build_documentation: extract build_examples
build_website: build_documentation
echo "$(NOW): Now building the website." &&\
mkdir -p website &&\
echo "$(NOW): Now copying LICENSE and other files." &&\
pygmentize -f html -l latex -O full -O style=default -o website/latexgit_sty.html latexgit.sty &&\
pygmentize -f html -l latex -O full -O style=default -o website/latexgit_dtx.html latexgit.dtx &&\
pygmentize -f html -l latex -O full -O style=default -o website/latexgit_ins.html latexgit.ins &&\
pygmentize -f html -l text -O full -O style=default -o website/LICENSE.html LICENSE &&\
pygmentize -f html -l text -O full -O style=default -o website/requirements.html requirements.txt &&\
pygmentize -f html -l text -O full -O style=default -o website/requirements-dev.html requirements-dev.txt &&\
pygmentize -f html -l make -O full -O style=default -o website/Makefile.html Makefile &&\
echo "$(NOW): Finished creating additional files, now building index.html from README.md." &&\
export PART_A='<!DOCTYPE html><html><title>' &&\
export PART_B='</title><body>' &&\
export PART_C='</body></html>' &&\
export BASE_URL='https\:\/\/thomasweise\.github\.io\/latexgit_tex\/' &&\
echo "$${PART_A}Contributing to latexgit$${PART_B}$(shell (python3 -m markdown -o html ./README.md))$$PART_C" > ./website/index.html &&\
sed -i "s/\"$$BASE_URL/\".\//g" ./website/index.html &&\
sed -i "s/=$$BASE_URL/=.\//g" ./website/index.html &&\
echo "$(NOW): Finished copying README.md to index.html, now minifying all files." &&\
cd "website/" &&\
find -type f -name "*.html" -exec python3 -c "print('{}');import minify_html;f=open('{}','r');s=f.read();f.close();s=minify_html.minify(s,do_not_minify_doctype=True,ensure_spec_compliant_unquoted_attribute_values=True,keep_html_and_head_opening_tags=False,minify_css=True,minify_js=True,remove_bangs=True,remove_processing_instructions=True);f=open('{}','w');f.write(s);f.close()" \; &&\
cd "../" &&\
echo "$(NOW): Finished minifying all files, now copying or moving remaining files." &&\
mv latexgit.sty website &&\
mv latexgit.pdf website &&\
cp latexgit.dtx website &&\
cp latexgit.ins website &&\
touch website/.nojekyll &&\
echo "$(NOW): Done building the website."


# The meta-goal for a full build
build: build_documentation build_examples build_website status pre_clean extract post_clean
build: build_documentation build_examples build_website extract status pre_clean post_clean python_dependencies
echo "$(NOW): The build has completed."

# .PHONY means that the targets init and test are not associated with files.
# see https://stackoverflow.com/questions/2145590
.PHONY: build build_documentation build_examples build_website status pre_clean extract post_clean
.PHONY: build build_documentation build_examples build_website extract status pre_clean post_clean python_dependencies
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

`latexgit` is a LaTeX package that works in combination with a [preprocessor](https://thomasweise.github.io/latexgit_py) for accessing files from `git` repositories from `LaTeX`.

## 2. Installation and Usage

## 2. Installation

TODO

1. Install the Python package `latexgit` via `pip install latexgit`.
2. Download and copy [`latexgit.sty`](https://thomasweise.github.io/latexgit_tex/latexgit.sty) from <https://thomasweise.github.io/latexgit_tex/latexgit.sty> into the folder of your LaTeX project.
3. Find the usage of the `latexgit` LaTeX package described in [`latexgit.pdf`](https://thomasweise.github.io/latexgit_tex/latexgit.pdf`) at <https://thomasweise.github.io/latexgit_tex/latexgit.pdf>.
4. Optionally: Read the [documentation](https://thomasweise.github.io/latexgit_py) of the `latexgit` Python companion at <https://thomasweise.github.io/latexgit_py>.

## 3. License
[`latexgit`](https://thomasweise.github.io/latexgit_py) is a tool for accessing files in `git` repositories from `LaTeX`.
Expand Down
12 changes: 12 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Dependencies Required to Build `latexgit`
#

# minify_html is needed to minify html output.
minify_html == 0.11.1

# for converting the additional markdown files to HTML
markdown == 3.5

# for converting files to HTML
Pygments==2.16.1
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Dependencies Required to Use `latexgit`
#

# Basically, we only need the `latexgit` Python companion package.
# You can find it at https://thomasweise.github.io/latexgit_py,
# https://github.com/thomasWeise/latexgit_py, or at
# https://pypi.org/project/latexgit.
latexgit == 0.8.2

0 comments on commit 224c8f6

Please sign in to comment.