Skip to content

Commit

Permalink
👷 Add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Oct 23, 2022
1 parent 27afe79 commit 5dc2111
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 176 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# yamllint disable-line rule:truthy
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"

env:
path: build/distrib/*/*.zip

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: xu-cheng/texlive-action/full@v1
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
with:
run: |
l3build ctan
- uses: actions/upload-artifact@v3
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
with:
path: |
${{ env.path }}
- uses: xu-cheng/texlive-action/full@v1
if: startsWith(github.ref, 'refs/tags/')
with:
run: |
apk add git
git config --global --add safe.directory '*'
l3build tag $(git tag | tail -n1)
l3build ctan
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ env.path }}
27 changes: 12 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
*.sty
*.cls
/build/
*.zip
*.curlopt
*.hd
*.markdown.lua
_markdown_*/

# create by https://github.com/iamcco/coc-gitignore (Mon Oct 24 2022 03:20:48 GMT+0800 (China Standard Time))
# TeX.gitignore:
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
Expand All @@ -24,8 +31,6 @@
*.ps
*.eps
*.pdf
*.sty
*.cls

## Generated if empty string is given at "Please type another file name for output:"
.pdf
Expand Down Expand Up @@ -115,11 +120,9 @@ acs-*.bib
*.glo
*.gls
*.glsdefs
*.lzo
*.lzs

# uncomment this for glossaries-extra (will ignore makeindex's style files!)
*.ist
# *.ist

# gnuplottex
*-gnuplottex-*
Expand Down Expand Up @@ -234,9 +237,8 @@ pythontex-files-*/
# xindy
*.xdy

# xypic precompiled matrices and outlines
# xypic precompiled matrices
*.xyc
*.xyd

# endfloat
*.ttt
Expand All @@ -259,15 +261,9 @@ TSWLatexianTemp*
# Kile
*.backup

# gummi
.*.swp

# KBibTeX
*~[0-9]*

# TeXnicCenter
*.tps

# auto folder when using emacs and auctex
./auto/*
*.el
Expand All @@ -278,5 +274,6 @@ TSWLatexianTemp*
# standalone packages
*.sta

# Makeindex log files
*.lpz
# TeX.patch:
# glossaries
*.glstex
4 changes: 4 additions & 0 deletions .gitlint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[ignore-by-title]
regex=.*
ignore=body-is-missing
# ex: filetype=dosini
57 changes: 17 additions & 40 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: fix-byte-order-marker
Expand All @@ -21,72 +21,49 @@ repos:
- id: check-toml
- id: check-json
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.11
rev: v1.3.1
hooks:
- id: remove-crlf
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
rev: v2.2.2
hooks:
- id: codespell
additional_dependencies:
- tomli
- repo: https://github.com/jorisroovers/gitlint
rev: v0.17.0
hooks:
- id: gitlint
args: [--ignore=body-is-missing, --msg-filename]
args:
- --msg-filename
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.4.0
rev: 2.6.1
hooks:
- id: editorconfig-checker
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 2.1.5
rev: 3.0.0
hooks:
- id: check-mailmap
- id: shellcheck
args: ["-eSC1008,SC1113", -x]
exclude: ^\.z(profile|shrc)|^\.config/git|^.*\.zsh
- id: shfmt
args: [-i, "2"]
exclude: ^\.z(profile|shrc)|^\.config/git|^.*\.zsh
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.13
rev: 0.7.16
hooks:
- id: mdformat
args: [--number]
args:
- --number
additional_dependencies:
- mdformat-gfm
- mdformat-myst
- mdformat-tables
- mdformat-toc
- mdformat-footnote
- mdformat-frontmatter
- mdformat-deflist
- mdformat-beautysh
- mdformat-black
- mdformat-shfmt
- mdformat-config
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.4.0
rev: v0.5.1
hooks:
- id: markdownlint-cli2
additional_dependencies:
- markdown-it-texmath@0.9.1
- repo: https://github.com/PyCQA/doc8
rev: 0.10.1
hooks:
- id: doc8
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
hooks:
- id: prettier
additional_dependencies:
- prettier@2.1.2
- "@prettier/plugin-xml@0.12.0"
- repo: https://github.com/vimjas/vint
rev: v0.4a3
hooks:
- id: vint
args: [-e]
- repo: https://github.com/kumaraditya303/mirrors-pyright
rev: v1.1.217
hooks:
- id: pyright
- repo: https://github.com/pycqa/pydocstyle
rev: 6.1.1
hooks:
- id: pydocstyle
157 changes: 39 additions & 118 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,138 +1,59 @@
# njustthesis

Thesis template for [NJUST](https://njust.edu.cn).

## License
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Freed-Wu/njustthesis/master.svg)](https://results.pre-commit.ci/latest/github/Freed-Wu/njustthesis/master)
[![github/workflow](https://github.com/Freed-Wu/njustthesis/actions/workflows/main.yml/badge.svg)](https://github.com/Freed-Wu/njustthesis/actions)

[![github/downloads](https://shields.io/github/downloads/Freed-Wu/njustthesis/total)](https://github.com/Freed-Wu/njustthesis/releases)
[![github/downloads/latest](https://shields.io/github/downloads/Freed-Wu/njustthesis/latest/total)](https://github.com/Freed-Wu/njustthesis/releases/latest)
[![github/issues](https://shields.io/github/issues/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/issues)
[![github/issues-closed](https://shields.io/github/issues-closed/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/issues?q=is%3Aissue+is%3Aclosed)
[![github/issues-pr](https://shields.io/github/issues-pr/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/pulls)
[![github/issues-pr-closed](https://shields.io/github/issues-pr-closed/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/pulls?q=is%3Apr+is%3Aclosed)
[![github/discussions](https://shields.io/github/discussions/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/discussions)
[![github/milestones](https://shields.io/github/milestones/all/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/milestones)
[![github/forks](https://shields.io/github/forks/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/network/members)
[![github/stars](https://shields.io/github/stars/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/stargazers)
[![github/watchers](https://shields.io/github/watchers/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/watchers)
[![github/contributors](https://shields.io/github/contributors/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/graphs/contributors)
[![github/commit-activity](https://shields.io/github/commit-activity/w/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/graphs/commit-activity)
[![github/last-commit](https://shields.io/github/last-commit/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/commits)
[![github/release-date](https://shields.io/github/release-date/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/releases/latest)

[![github/license](https://shields.io/github/license/Freed-Wu/njustthesis)](https://github.com/Freed-Wu/njustthesis/blob/master/LICENSE)
![github/languages](https://shields.io/github/languages/count/Freed-Wu/njustthesis)
![github/languages/top](https://shields.io/github/languages/top/Freed-Wu/njustthesis)
![github/directory-file-count](https://shields.io/github/directory-file-count/Freed-Wu/njustthesis)
![github/code-size](https://shields.io/github/languages/code-size/Freed-Wu/njustthesis)
![github/repo-size](https://shields.io/github/repo-size/Freed-Wu/njustthesis)
![github/v](https://shields.io/github/v/release/Freed-Wu/njustthesis)

This work may be distributed and/or modified under the conditions of GPLv3+.
Thesis template for [NJUST](https://njust.edu.cn).

## Dependent
<!-- mdformat-toc start --slug=github --no-anchors --maxlevel=6 --minlevel=2 -->

### Required
- [Install](#install)
- [Use Package Manager](#use-package-manager)
- [Install From Source Code](#install-from-source-code)
- [Usage](#usage)

- A `LaTex` distribution. Such as
[texlive](https://github.com/TeX-Live/texlive-source).
- [cnlogo](https://github.com/yuxtech/cnlogo/) provides the logos of many
Chinese Universities.
<!-- mdformat-toc end -->

## Install

### Use Package Manager

```shell
```sh
tlmgr install njustthesis
```

### Install From Source Code

```shell
```sh
git clone --depth=1 https://github.com/Freed-Wu/njustthesis
cd njustthesis
l3build install
```

## Customize

Default values:

```latex
\njustsetup{
logo = \njustwhole[njust][0.5], % depend on cnlogo
cover-title = 毕业设计说明书,
author = 佚名,
id = 916101630000,
department = 电子工程与光电技术学院,
discipline = 电子工程与光电技术,
title = ,
subtitle = ,
supervisor = 张三,
associate-supervisor = 李四,
judge = 王五,
supervisor-title = 教授,
associate-supervisor-title = 教授,
judge-title = 教授,
year = \the\year, % the time of paper
month = \the\month,
day = \the\day,
abstract-prefix = 毕业论文,
signature = ,
signature* = , % star means english
abstract-prefix = 毕业论文,
title* = ,
subtitle* = ,
header-title = 本科毕业设计说明书,
}
```

**Note**: Add `{}` around the string which contain ' ','=', and','.

Example:

```latex
\documentclass{njustthesis}
\njustsetup{%
author = 张不三,
id = 916101630000,
discipline = 电子信息工程,
title = {论文名字带逗号,或空格 },
subtitle = 所以加花括弧括起来,
title* = {English name},
supervisor = ,
supervisor-title = 教授,
judge = ,
% signature = \includegraphics{signature.pdf},
judge-title = 教授,
}
\usepackage{subfiles}
\begin{document}
\maketitle
\frontmatter
\tableofcontents
\listoffigures
\listoftables
\mainmatter%
% \subfile{subfiles/chapter1.tex}
\backmatter%
% \bibliography{refs/main.bib}
\appendix
% \subfile{subfiles/appendix1.tex}
\end{document}
```

See more [examples](https://github.com/Freed-Wu?tab=repositories&q=njust&language=tex).

## Tips

```shell
texdoc njusthesis
```

## Todo

- [pandoc](https://github.com/jgm/pandoc) template for user can
write markdown then convert it to latex.
- Change format from `ctexbook` to `ctexart` in order to use
`beamerarticle.sty` more conveniently.

## FAQ

Q: Why another wheel?

A: Because former wheels cannot satisfy me. Some even only provide a
`*.tex` not `*.cls`. So crude.

Q: 100% compatible with official `docx` template?

A: If you find something unreasonable, welcome to pull request!

More questions see [issues](https://github.com/Freed-Wu/njustthesis/issues).

## Reference
## Usage

- [thuthesis](https://github.com/tuna/thuthesis) May be the best thesis
template among all Chinese theses. Any one can learn something from it. Such
as literate programming, separation of content and presentation, etc.
See [config](docs/config.md).
Loading

0 comments on commit 5dc2111

Please sign in to comment.