File tree Expand file tree Collapse file tree 4 files changed +24
-8
lines changed Expand file tree Collapse file tree 4 files changed +24
-8
lines changed Original file line number Diff line number Diff line change
1
+ # sphinx_reredirects configuration for HTML builder.
2
+ # See also: https://documatt.com/sphinx-reredirects/usage.html
3
+
4
+ # source (docname): target (html page)
5
+ notes/6-lectures-on-sketch : /notes/zxsys/6-lectures-on-sketch.html
6
+ notes/leetcode/index : /notes/writeups/leetcode/index.html
7
+ notes/2021-interview/index : /notes/writeups/2021-interview/index.html
Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash
2
2
# set -x
3
3
4
4
root=$( git rev-parse --show-toplevel)
5
5
cd $root
6
6
7
7
eval " $( snippet integration --sh) "
8
- id=$( snippet_list --tags d --docname ' ronin/inbox/** ' )
8
+ id=$( snippet_list --tags d)
9
9
file=$( snippet get $id --file)
10
+ docname=$( snippet get $id --docname)
10
11
11
- mv $file $root /p/$( basename $file )
12
+ new_file=" $root /p/$( basename $file ) "
13
+ new_docname=" p/$( basename $docname ) "
14
+
15
+ mv $file $new_file
16
+ if [[ " $docname " != " ronin" * ]]; then
17
+ echo " $docname : /$new_docname .html" >> ./_conf/redirect.yml
18
+ fi
19
+
20
+ git add $file $new_file ./_conf/redirect.yml
21
+ git diff HEAD
Original file line number Diff line number Diff line change 15
15
import sys
16
16
from datetime import datetime
17
17
from enum import Enum , auto
18
+ import yaml
18
19
19
20
sys .path .insert (0 , os .path .abspath ('.' ))
20
21
@@ -466,11 +467,8 @@ def url(self) -> str:
466
467
if D .is_public ():
467
468
extensions .append ('sphinx_reredirects' )
468
469
# https://documatt.gitlab.io/sphinx-reredirects/usage.html
469
- redirects = {
470
- 'notes/6-lectures-on-sketch' : '/notes/zxsys/6-lectures-on-sketch.html' ,
471
- 'notes/leetcode/index' : '/notes/writeups/leetcode/index.html' ,
472
- 'notes/2021-interview/index' : '/notes/writeups/2021-interview/index.html' ,
473
- }
470
+ with open ('./_conf/redirect.yml' ) as data :
471
+ redirects = yaml .safe_load (data )
474
472
475
473
# extensions.append('sphinxcontrib.images')
476
474
# images_config = {
Original file line number Diff line number Diff line change @@ -26,3 +26,4 @@ sphinxnotes-comboroles
26
26
sphinxcontrib-globalsubs @ git+https://github.com/SilverRainZ/sphinxcontrib-globalsubs.git
27
27
sphinx_simplepdf
28
28
sphinxnotes-fasthtml
29
+ pyyaml
You can’t perform that action at this time.
0 commit comments