Skip to content

Commit

Permalink
build: transform resources into submodule utils
Browse files Browse the repository at this point in the history
Since more documentation repositories will use the same build mechanism,
transforming the resources folder into a submodule utils is valuable.
  • Loading branch information
cebarobot committed Jan 13, 2025
1 parent d61cfd4 commit fb68c6c
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 997 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-pandoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Setup environment variables
run: |
Expand All @@ -20,7 +22,7 @@ jobs:
- name: Install dependency
run: |
./resources/dependency.sh
./utils/dependency.sh
- name: build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ build/
*.toc
*.tex
*.html
!resources/*

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "utils"]
path = utils
url = https://github.com/OpenXiangShan/docs-utils.git
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ SVG_FIGS := $(wildcard docs/figs/*.svg)
PDF_FIGS := $(patsubst docs/figs/%.svg, build/docs/figs/%.pdf, $(SVG_FIGS))

DEPS =
DEPS += $(wildcard resources/*.lua)
DEPS += resources/template.tex
DEPS += $(wildcard utils/*.lua)
DEPS += utils/template.tex

PANDOC_FLAGS += --variable=version:"$(VERSION)"
PANDOC_FLAGS += --from=markdown+table_captions+multiline_tables+grid_tables+header_attributes-implicit_figures
PANDOC_FLAGS += --table-of-contents
PANDOC_FLAGS += --number-sections
PANDOC_FLAGS += --lua-filter=include-files.lua
PANDOC_FLAGS += --metadata=include-auto
PANDOC_FLAGS += --lua-filter=resources/meta_vars.lua
PANDOC_FLAGS += --lua-filter=resources/remove_md_links.lua
PANDOC_FLAGS += --lua-filter=utils/pandoc_filters/replace_variables.lua
PANDOC_FLAGS += --lua-filter=utils/pandoc_filters/remove_md_links.lua
PANDOC_FLAGS += --filter pandoc-crossref

PANDOC_LATEX_FLAGS += --top-level-division=chapter
PANDOC_LATEX_FLAGS += --pdf-engine=xelatex
PANDOC_LATEX_FLAGS += --lua-filter=resources/svg_to_pdf.lua
PANDOC_LATEX_FLAGS += --template=resources/template.tex
PANDOC_LATEX_FLAGS += --lua-filter=utils/pandoc_filters/svg_to_pdf.lua
PANDOC_LATEX_FLAGS += --template=utils/template.tex

PANDOC_HTML_FLAGS += --embed-resources
PANDOC_HTML_FLAGS += --shift-heading-level-by=1
Expand Down
4 changes: 3 additions & 1 deletion pandoc-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
title: "香山开源处理器用户手册"
title-line1: "香山开源处理器"
title-line2: "用户手册"
# title: "XiangShan Open-Source Processor User Guide"
# title-line1: "XiangShan"
# title-line2: "Open-Source Processor"
# title-line3: "User Guide"
author: "香山团队·北京开源芯片研究院"
date: "\\today"
var_processor_name: "昆明湖 V2R2"
replace_variables:
var_processor_name: "昆明湖 V2R2"
figureTitle: ""
tableTitle: ""
listingTitle: "代码"
Expand Down
1 change: 0 additions & 1 deletion resources/.gitignore

This file was deleted.

22 changes: 0 additions & 22 deletions resources/dependency.sh

This file was deleted.

Binary file removed resources/figs/BOSC.pdf
Binary file not shown.
275 changes: 0 additions & 275 deletions resources/figs/BOSC.svg

This file was deleted.

Binary file removed resources/figs/XiangShan-Community.pdf
Binary file not shown.
103 changes: 0 additions & 103 deletions resources/figs/XiangShan-Community.svg

This file was deleted.

19 changes: 0 additions & 19 deletions resources/meta_vars.lua

This file was deleted.

7 changes: 0 additions & 7 deletions resources/remove_md_links.lua

This file was deleted.

6 changes: 0 additions & 6 deletions resources/svg_to_pdf.lua

This file was deleted.

Loading

0 comments on commit fb68c6c

Please sign in to comment.