Skip to content

Commit

Permalink
Merge pull request #953 from lean-ja/changeDir
Browse files Browse the repository at this point in the history
ディレクトリ名変更: `Examples` → `LeanByExample`
  • Loading branch information
Seasawher authored Oct 6, 2024
2 parents e2c9f83 + bcc2ab1 commit 353f081
Show file tree
Hide file tree
Showing 178 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
## 開発の流れ

* このリポジトリは mathlib に依存しているので、このリポジトリを clone した後に `lake exe cache get` を実行してください。
* `Exercise` ディレクトリ配下のファイルは `mk_exercise` により `Examples/Solution` の内容から自動生成されるので、手動で編集しないでください。
* `Exercise` ディレクトリ配下のファイルは `mk_exercise` により `LeanByExample/Solution` の内容から自動生成されるので、手動で編集しないでください。
* 本文の markdown ファイルは [mdgen](https://github.com/Seasawher/mdgen) を用いて Lean ファイルから生成します。Lean ファイルを編集した後、`lake run build` コマンドを実行すれば mk_exercise の実行と markdown の生成と `mdbook build` が一括実行されます。

## ルール
Expand All @@ -25,7 +25,7 @@
* 読点には `` を、句点には `` を使用します。ただし例外として、直前の文字が半角文字であるときには `` の代わりに半角カンマ `,` を使用します。
* 見出し語 `foo` に対して、目次の中での記事の名前は `foo: (日本語による一言説明)` とします。可能な限り1行に収まるようにしてください。
* 目次である `booksrc/SUMMARY.md` の内の記事は、カテゴリごとにアルファベット昇順に並べてください。VSCode だと [Tyriar.sort-lines](https://marketplace.visualstudio.com/items?itemName=Tyriar.sort-lines) という拡張機能があって、並び替えを自動で行うことができます。
* Lean コードは、コンパイルが通るようにして `Examples` 配下に配置します。
* Lean コードは、コンパイルが通るようにして `LeanByExample` 配下に配置します。
* 「エラーになる例」を紹介したいときであっても `try``#guard_msgs``fail_if_success` などを使ってコンパイルが通るようにしてください。コード例が正しいかチェックする際にその方が楽だからです。
* Lean ファイルのファイル名は、パスカルケースで命名して下さい。
* ただしファイル名は、`README` 以外は大文字が連続しないようにします。
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"material-icon-theme.folders.associations": {
"booksrc": "markdown",
"Command": "",
"Examples": "Content",
"LeanByExample": "Content",
"Option": "",
},

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 7 additions & 4 deletions assets/filePlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ function filePlay() {
// 拡張子が `.md` になっているので `.lean` に修正する
editButtonLink.href = editButtonLink.href.replace(/\.md$/, ".lean");

// Lean ファイルがあるのは `booksrc` ではなく `Examples` ディレクトリ
editButtonLink.href = editButtonLink.href.replace("/booksrc/", "/Examples/");
// Lean ファイルがあるのは `booksrc` ではなく `LeanByExample` ディレクトリ
editButtonLink.href = editButtonLink.href.replace(
"/booksrc/",
"/LeanByExample/",
);

// 演習問題のファイルのみ、`Examples` ディレクトリではなくて `Exercise` ディレクトリにある
// 演習問題のファイルのみ、`LeanByExample` ディレクトリではなくて `Exercise` ディレクトリにある
editButtonLink.href = editButtonLink.href.replace(
"/Examples/Exercise/",
"/LeanByExample/Exercise/",
"/Exercise/",
);

Expand Down
10 changes: 5 additions & 5 deletions lakefile.lean
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ require mathlib from git
"https://github.com/leanprover-community/mathlib4.git" @ "master"

@[default_target]
lean_lib Examples where
lean_lib LeanByExample where
-- `lake build` の実行時にビルドされるファイルの設定
-- `.submodules` と指定すると、そのディレクトリ以下の全ての Lean ファイルがビルドされる
globs := #[.submodules `Examples]
globs := #[.submodules `LeanByExample]

section Script

Expand All @@ -46,7 +46,7 @@ def runCmd (input : String) : IO Unit := do
/-- mk_exercise を実行し、演習問題の解答に
解答部分を sorry に置き換えるなどの処理を施して演習問題ファイルを生成する。-/
script mk_exercise do
runCmd "lake exe mk_exercise Examples/Solution Exercise"
runCmd "lake exe mk_exercise LeanByExample/Solution Exercise"
return 0

syntax (name := with_time) "with_time" "running" str doElem : doElem
Expand All @@ -65,10 +65,10 @@ Lean ファイルから Markdown ファイルと HTML ファイルを生成す
script build do
-- `lake run mk_exercise` を使用すると遅くなってしまうのでコピペしている
with_time running "mk_exercise"
runCmd "lake exe mk_exercise Examples/Solution Exercise"
runCmd "lake exe mk_exercise LeanByExample/Solution Exercise"

with_time running "mdgen"
runCmd "lake exe mdgen Examples booksrc";
runCmd "lake exe mdgen LeanByExample booksrc";
runCmd "lake exe mdgen Exercise booksrc/Exercise"

with_time running "mdbook"
Expand Down
4 changes: 2 additions & 2 deletions scripts/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
lake を介することで実行が遅くなってしまうので、
lake を介することなく実行ファイルを直接叩く。 #>

./.lake/packages/mk-exercise/.lake/build/bin/mk_exercise.exe Examples/Solution Exercise
./.lake/packages/mk-exercise/.lake/build/bin/mk_exercise.exe LeanByExample/Solution Exercise

./.lake/packages/mdgen/.lake/build/bin/mdgen.exe Exercise booksrc/Exercise
./.lake/packages/mdgen/.lake/build/bin/mdgen.exe Examples booksrc
./.lake/packages/mdgen/.lake/build/bin/mdgen.exe LeanByExample booksrc

mdbook build

0 comments on commit 353f081

Please sign in to comment.