Skip to content

Commit

Permalink
Merge pull request Keldos-Li#40 from Keldos-Li/develop
Browse files Browse the repository at this point in the history
Add special exception, fix bug and style
  • Loading branch information
RalXYZ authored Nov 11, 2021
2 parents bad31c6 + e886c56 commit a028f5e
Show file tree
Hide file tree
Showing 4 changed files with 611 additions and 484 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
- name: Install Dependencies
run: |
sudo apt install ruby sass -y
- name: Compile
Expand All @@ -22,4 +22,4 @@ jobs:
with:
name: my-artifact
path: |
./src/latex-theme/*.zip
./src/latex-theme/*
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
- name: Install Dependencies
run: |
sudo apt install ruby sass -y
- name: Compile
run: |
cd ./src; make
cd ./src; make all-and-compress
- name: Release
uses: marvinpinto/action-automatic-releases@latest
with:
Expand Down
62 changes: 41 additions & 21 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,75 @@ working_dir = $(base_dir)/build
windows = windows
macos = macos
linux = linux
typora = typora
pandoc = pandoc

$(shell mkdir -p $(working_dir))
$(shell mkdir -p $(target_dir))

# $(1) is the name of operating system, $(2) is light or dark theme
# $(1) is the name of operating system, $(2) is typora or pandoc, $(3) is light or dark theme
define build
mkdir -p $(target_dir)/$(1)
mkdir -p $(target_dir)/$(1)/target
echo '$$theme: "$(2)";' >> $(working_dir)/$(1)-$(2).scss
echo '$$os: "$(1)";' >> $(working_dir)/$(1)-$(2).scss
cat $(base_dir)/latex-theme.scss >> $(working_dir)/$(1)-$(2).scss
if [ "$(2)" = "light" ]; then \
scss --sourcemap=none $(working_dir)/$(1)-$(2).scss $(target_dir)/$(1)/target/latex.css; \
mkdir -p $(target_dir)/$(1)-$(2)
mkdir -p $(target_dir)/$(1)-$(2)/target
echo '$$os: "$(1)";' >> $(working_dir)/$(1)-$(2)-$(3).scss
echo '$$tool: "$(2)";' >> $(working_dir)/$(1)-$(2)-$(3).scss
echo '$$theme: "$(3)";' >> $(working_dir)/$(1)-$(2)-$(3).scss
cat $(base_dir)/latex-theme.scss >> $(working_dir)/$(1)-$(2)-$(3).scss
if [ "$(3)" = "light" ]; then \
scss --sourcemap=none --style expanded $(working_dir)/$(1)-$(2)-$(3).scss $(target_dir)/$(1)-$(2)/target/latex.css; \
else \
scss --sourcemap=none $(working_dir)/$(1)-$(2).scss $(target_dir)/$(1)/target/latex-$(2).css; \
fi;
scss --sourcemap=none --style expanded $(working_dir)/$(1)-$(2)-$(3).scss $(target_dir)/$(1)-$(2)/target/latex-$(3).css; \
fi
endef

# $(1) is the name of operating system
define build-os
$(call build,$(1),light)
$(call build,$(1),dark)
define build-typora
$(call build,$(1),$(typora),light)
$(call build,$(1),$(typora),dark)
if [ "$(1)" = "$(windows)" ]; then \
cp $(base_dir)/install.ps1 $(target_dir)/$(1); \
cp $(base_dir)/install.ps1 $(target_dir)/$(1)-$(typora); \
else \
cp $(base_dir)/install.sh $(target_dir)/$(1); \
cp $(base_dir)/install.sh $(target_dir)/$(1)-$(typora); \
fi;
cp $(base_dir)/README.md $(target_dir)/$(1)
cp -r $(base_dir)/../Supplemental $(target_dir)/$(1)/Supplemental
cd $(target_dir)/$(1); zip -r $(target_dir)/latex-theme-$(1).zip ./*
cp $(base_dir)/README.md $(target_dir)/$(1)-$(typora)
cp -r $(base_dir)/../Supplemental $(target_dir)/$(1)-$(typora)/Supplemental
endef

define build-pandoc
$(call build,$(linux),$(pandoc),light)
$(call build,$(linux),$(pandoc),dark)
endef

.PHONY: all
all:
make windows
make macos
make linux
make pandoc

.PHONY: all-and-compress
all-and-compress:
make all
cd $(target_dir)/$(windows)-$(typora); zip -r $(target_dir)/latex-theme-$(windows).zip ./*
cd $(target_dir)/$(macos)-$(typora); zip -r $(target_dir)/latex-theme-$(macos).zip ./*
cd $(target_dir)/$(linux)-$(typora); zip -r $(target_dir)/latex-theme-$(linux).zip ./*
# cd $(target_dir)/$(pandoc)-$(typora); zip -r $(target_dir)/latex-theme-$(pandoc).zip ./*

.PHONY: windows
windows:
$(call build-os,$(windows))
$(call build-typora,$(windows))

.PHONY: macos
macos:
$(call build-os,$(macos))
$(call build-typora,$(macos))

.PHONY: linux
linux:
$(call build-os,$(linux))
$(call build-typora,$(linux))

.PHONY: pandoc
pandoc:
$(call build-pandoc,$(linux))

.PHONY: clean
clean:
Expand Down
Loading

0 comments on commit a028f5e

Please sign in to comment.