Skip to content

Commit

Permalink
feat: add pandoc support
Browse files Browse the repository at this point in the history
Former-commit-id: c2c2a4d
  • Loading branch information
RalXYZ committed Nov 7, 2021
1 parent ad496bd commit e9679b9
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 23 deletions.
54 changes: 32 additions & 22 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,65 @@ 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, $(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; \
else \
scss --sourcemap=none $(working_dir)/$(1)-$(2).scss $(target_dir)/$(1)/target/latex-$(2).css; \
fi;
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
scss --sourcemap=none $(working_dir)/$(1)-$(2)-$(3).scss $(target_dir)/$(1)-$(2)/target/latex-$(3).css
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
cd $(target_dir)/$(1)-$(typora); zip -r $(target_dir)/latex-theme-$(1).zip ./*
endef

define build-pandoc
$(call build,$(linux),$(pandoc),light)
$(call build,$(linux),$(pandoc),dark)
cd $(target_dir)/$(1)-$(pandoc); zip -r $(target_dir)/latex-theme-$(1)-$(pandoc).zip ./*
endef

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

.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
12 changes: 11 additions & 1 deletion src/latex-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,17 @@ strong {
}

/* 正文区基本属性 */
#write {
@if $tool == "typora" {
#write {
@extend %base;
}
} @else if $tool == "pandoc" {
body {
@extend %base;
}
}

%base {
font-family: var(--base-Latin-font), var(--base-Chinese-font), serif;
font-size: var(--base-font-size);
max-width: 21cm; /* A4标准宽度 */
Expand Down

0 comments on commit e9679b9

Please sign in to comment.