File tree 2 files changed +53
-1
lines changed
2 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ This static copy was created by:
23
23
- [GNU Wget Manual](http://www.gnu.org/software/wget/manual/wget.html)
24
24
2. Updating the files using GNU sed
25
25
` ` ` shell
26
- ./bin/update_for_static .sh
26
+ ./bin/create_static_site .sh
27
27
` ` `
28
28
- [sed, a stream editor](https://www.gnu.org/software/sed/manual/sed.html)
29
29
(manual)
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -o errtrace
3
+ set -o nounset
4
+
5
+
6
+ if command -v gsed > /dev/null; then
7
+ SED=gsed
8
+ elif sed --version > /dev/null; then
9
+ SED=sed
10
+ else
11
+ echo ' GNU sed is required. If on macOS install `gnu-sed` via brew.' 1>&2
12
+ exit 1
13
+ fi
14
+
15
+
16
+ function _change_to_repo_dir {
17
+ cd " ${0%/* } /.." > /dev/null
18
+ }
19
+
20
+
21
+ function _recreate_docs_dir {
22
+ rm -rf docs
23
+ cp -a temp_download docs
24
+ touch docs/.nojekyll
25
+ printf ' stateof.creativecommons.org' > docs/CNAME
26
+ }
27
+
28
+
29
+ function _convert_urls_to_absolute_paths {
30
+ # Non-escaped URLs
31
+ for _pattern in ' http://stateof\.creativecommons\.org/' \
32
+ ' https://stateof\.creativecommons\.org/'
33
+ do
34
+ for _file in $( grep --files-with-matches --max-count=1 \
35
+ --recursive " ${_pattern} " docs)
36
+ do
37
+ gsed --in-place -e" s#${_pattern} #/#g" " ${_file} "
38
+ done
39
+ done
40
+ # Escaped URL
41
+ for _file in $( grep --fixed-strings --files-with-matches --max-count=1 \
42
+ --recursive ' https:\/\/stateof.creativecommons.org\/' docs)
43
+ do
44
+ gsed --in-place \
45
+ -e' s#https:\\/\\/stateof\.creativecommons\.org\\/#\\/#g' " ${_file} "
46
+ done
47
+ }
48
+
49
+
50
+ _change_to_repo_dir # must be called first
51
+ _recreate_docs_dir
52
+ _convert_urls_to_absolute_paths
You can’t perform that action at this time.
0 commit comments