Remove incorrect community example links - #310
Draft
sogaiu wants to merge 2 commits into
Draft
Conversation
Collaborator
Author
|
On a side note, there was likely a better way to do the file modifications, but for future reference (and possibly for adaptation purposes to address the rest of #309), below is a revised script I used to make changes. It also compares the lengths of the new files to the expected lengths based on computing the difference between the old length of each file and the number of bytes matched within the corresponding file. A summary of activities is output near the end of execution. Output included below. (defn process-files
[dir-name root-dir ver-dirs file-info]
(def files
(catseq [name :in ver-dirs
:let [dir (string root-dir "/" name "/api/" dir-name)]
:when (os/stat dir)]
(map |(string dir "/" $) (os/dir dir))))
(each f files
(def content (slurp f))
(def lines (string/split "\n" content))
(var bytes-changed 0)
(def new-lines
(seq [i :range [0 (length lines)]
:let [l (get lines i)]]
(peg/replace-all
~(sequence `<a href="https://janetdocs.com/`
(capture (to `"`))
`">Community Examples</a>`)
(fn [m & caps]
(+= bytes-changed (length m))
#(printf "match: %s" m)
#(pp ["captures:" caps])
"")
l)))
(spit f (string/join new-lines "\n"))
(when (> bytes-changed 0)
(def content-len (length content))
(put file-info f [content-len bytes-changed]))))
(defn main
[_]
(def root-dir "static")
(def ver-dirs
(filter |(peg/match :d $)
(os/dir root-dir)))
(def file-info @{})
(process-files "jpm" root-dir ver-dirs file-info)
(process-files "spork" root-dir ver-dirs file-info)
(each f (sort (keys file-info))
(def [old-len delta] (get file-info f))
(def new-len (length (slurp f)))
(prinf "%s: " f)
(if (= (- old-len delta)
new-len)
(print "ok")
(do
(print "NOT OK")
(eprintf "ERROR: %s: %n - %n != %n" f old-len delta new-len))))
(printf "files modified: %n" (length file-info)))outputstatic/1.25.1/api/jpm/cc.html: ok static/1.25.1/api/jpm/cgen.html: ok static/1.25.1/api/jpm/cli.html: ok static/1.25.1/api/jpm/commands.html: ok static/1.25.1/api/jpm/config.html: ok static/1.25.1/api/jpm/dagbuild.html: ok static/1.25.1/api/jpm/index.html: ok static/1.25.1/api/jpm/make-config.html: ok static/1.25.1/api/jpm/pm.html: ok static/1.25.1/api/jpm/rules.html: ok static/1.25.1/api/jpm/scaffold.html: ok static/1.25.1/api/jpm/shutil.html: ok static/1.25.1/api/spork/base64.html: ok static/1.25.1/api/spork/cron.html: ok static/1.25.1/api/spork/ev-utils.html: ok static/1.25.1/api/spork/fmt.html: ok static/1.25.1/api/spork/generators.html: ok static/1.25.1/api/spork/getline.html: ok static/1.25.1/api/spork/http.html: ok static/1.25.1/api/spork/httpf.html: ok static/1.25.1/api/spork/index.html: ok static/1.25.1/api/spork/json.html: ok static/1.25.1/api/spork/math.html: ok static/1.25.1/api/spork/misc.html: ok static/1.25.1/api/spork/msg.html: ok static/1.25.1/api/spork/netrepl.html: ok static/1.25.1/api/spork/path.html: ok static/1.25.1/api/spork/rawterm.html: ok static/1.25.1/api/spork/regex.html: ok static/1.25.1/api/spork/rpc.html: ok static/1.25.1/api/spork/schema.html: ok static/1.25.1/api/spork/tarray.html: ok static/1.25.1/api/spork/test.html: ok static/1.26.0/api/jpm/cc.html: ok static/1.26.0/api/jpm/cgen.html: ok static/1.26.0/api/jpm/cli.html: ok static/1.26.0/api/jpm/commands.html: ok static/1.26.0/api/jpm/config.html: ok static/1.26.0/api/jpm/dagbuild.html: ok static/1.26.0/api/jpm/index.html: ok static/1.26.0/api/jpm/make-config.html: ok static/1.26.0/api/jpm/pm.html: ok static/1.26.0/api/jpm/rules.html: ok static/1.26.0/api/jpm/scaffold.html: ok static/1.26.0/api/jpm/shutil.html: ok static/1.26.0/api/spork/argparse.html: ok static/1.26.0/api/spork/base64.html: ok static/1.26.0/api/spork/crc.html: ok static/1.26.0/api/spork/cron.html: ok static/1.26.0/api/spork/ev-utils.html: ok static/1.26.0/api/spork/fmt.html: ok static/1.26.0/api/spork/generators.html: ok static/1.26.0/api/spork/getline.html: ok static/1.26.0/api/spork/htmlgen.html: ok static/1.26.0/api/spork/http.html: ok static/1.26.0/api/spork/httpf.html: ok static/1.26.0/api/spork/index.html: ok static/1.26.0/api/spork/json.html: ok static/1.26.0/api/spork/math.html: ok static/1.26.0/api/spork/misc.html: ok static/1.26.0/api/spork/msg.html: ok static/1.26.0/api/spork/netrepl.html: ok static/1.26.0/api/spork/path.html: ok static/1.26.0/api/spork/rawterm.html: ok static/1.26.0/api/spork/regex.html: ok static/1.26.0/api/spork/rpc.html: ok static/1.26.0/api/spork/schema.html: ok static/1.26.0/api/spork/sh.html: ok static/1.26.0/api/spork/tarray.html: ok static/1.26.0/api/spork/test.html: ok static/1.26.0/api/spork/zip.html: ok static/1.27.0/api/jpm/cc.html: ok static/1.27.0/api/jpm/cgen.html: ok static/1.27.0/api/jpm/cli.html: ok static/1.27.0/api/jpm/commands.html: ok static/1.27.0/api/jpm/config.html: ok static/1.27.0/api/jpm/dagbuild.html: ok static/1.27.0/api/jpm/index.html: ok static/1.27.0/api/jpm/make-config.html: ok static/1.27.0/api/jpm/pm.html: ok static/1.27.0/api/jpm/rules.html: ok static/1.27.0/api/jpm/scaffold.html: ok static/1.27.0/api/jpm/shutil.html: ok static/1.27.0/api/spork/argparse.html: ok static/1.27.0/api/spork/base64.html: ok static/1.27.0/api/spork/crc.html: ok static/1.27.0/api/spork/cron.html: ok static/1.27.0/api/spork/ev-utils.html: ok static/1.27.0/api/spork/fmt.html: ok static/1.27.0/api/spork/generators.html: ok static/1.27.0/api/spork/getline.html: ok static/1.27.0/api/spork/htmlgen.html: ok static/1.27.0/api/spork/http.html: ok static/1.27.0/api/spork/httpf.html: ok static/1.27.0/api/spork/index.html: ok static/1.27.0/api/spork/json.html: ok static/1.27.0/api/spork/math.html: ok static/1.27.0/api/spork/misc.html: ok static/1.27.0/api/spork/msg.html: ok static/1.27.0/api/spork/netrepl.html: ok static/1.27.0/api/spork/path.html: ok static/1.27.0/api/spork/rawterm.html: ok static/1.27.0/api/spork/regex.html: ok static/1.27.0/api/spork/rpc.html: ok static/1.27.0/api/spork/schema.html: ok static/1.27.0/api/spork/sh.html: ok static/1.27.0/api/spork/tarray.html: ok static/1.27.0/api/spork/test.html: ok static/1.27.0/api/spork/zip.html: ok static/1.28.0/api/jpm/cc.html: ok static/1.28.0/api/jpm/cgen.html: ok static/1.28.0/api/jpm/cli.html: ok static/1.28.0/api/jpm/commands.html: ok static/1.28.0/api/jpm/config.html: ok static/1.28.0/api/jpm/dagbuild.html: ok static/1.28.0/api/jpm/index.html: ok static/1.28.0/api/jpm/make-config.html: ok static/1.28.0/api/jpm/pm.html: ok static/1.28.0/api/jpm/rules.html: ok static/1.28.0/api/jpm/scaffold.html: ok static/1.28.0/api/jpm/shutil.html: ok static/1.28.0/api/spork/argparse.html: ok static/1.28.0/api/spork/base64.html: ok static/1.28.0/api/spork/crc.html: ok static/1.28.0/api/spork/cron.html: ok static/1.28.0/api/spork/ev-utils.html: ok static/1.28.0/api/spork/fmt.html: ok static/1.28.0/api/spork/generators.html: ok static/1.28.0/api/spork/getline.html: ok static/1.28.0/api/spork/htmlgen.html: ok static/1.28.0/api/spork/http.html: ok static/1.28.0/api/spork/httpf.html: ok static/1.28.0/api/spork/index.html: ok static/1.28.0/api/spork/json.html: ok static/1.28.0/api/spork/math.html: ok static/1.28.0/api/spork/misc.html: ok static/1.28.0/api/spork/msg.html: ok static/1.28.0/api/spork/netrepl.html: ok static/1.28.0/api/spork/path.html: ok static/1.28.0/api/spork/rawterm.html: ok static/1.28.0/api/spork/regex.html: ok static/1.28.0/api/spork/rpc.html: ok static/1.28.0/api/spork/schema.html: ok static/1.28.0/api/spork/sh.html: ok static/1.28.0/api/spork/tarray.html: ok static/1.28.0/api/spork/test.html: ok static/1.28.0/api/spork/zip.html: ok static/1.29.1/api/jpm/cc.html: ok static/1.29.1/api/jpm/cgen.html: ok static/1.29.1/api/jpm/cli.html: ok static/1.29.1/api/jpm/commands.html: ok static/1.29.1/api/jpm/config.html: ok static/1.29.1/api/jpm/dagbuild.html: ok static/1.29.1/api/jpm/index.html: ok static/1.29.1/api/jpm/make-config.html: ok static/1.29.1/api/jpm/pm.html: ok static/1.29.1/api/jpm/rules.html: ok static/1.29.1/api/jpm/scaffold.html: ok static/1.29.1/api/jpm/shutil.html: ok static/1.29.1/api/spork/argparse.html: ok static/1.29.1/api/spork/base64.html: ok static/1.29.1/api/spork/crc.html: ok static/1.29.1/api/spork/cron.html: ok static/1.29.1/api/spork/ev-utils.html: ok static/1.29.1/api/spork/fmt.html: ok static/1.29.1/api/spork/generators.html: ok static/1.29.1/api/spork/getline.html: ok static/1.29.1/api/spork/htmlgen.html: ok static/1.29.1/api/spork/http.html: ok static/1.29.1/api/spork/httpf.html: ok static/1.29.1/api/spork/index.html: ok static/1.29.1/api/spork/json.html: ok static/1.29.1/api/spork/math.html: ok static/1.29.1/api/spork/misc.html: ok static/1.29.1/api/spork/msg.html: ok static/1.29.1/api/spork/netrepl.html: ok static/1.29.1/api/spork/path.html: ok static/1.29.1/api/spork/rawterm.html: ok static/1.29.1/api/spork/regex.html: ok static/1.29.1/api/spork/rpc.html: ok static/1.29.1/api/spork/schema.html: ok static/1.29.1/api/spork/sh.html: ok static/1.29.1/api/spork/tarray.html: ok static/1.29.1/api/spork/test.html: ok static/1.29.1/api/spork/zip.html: ok static/1.31.0/api/jpm/cc.html: ok static/1.31.0/api/jpm/cgen.html: ok static/1.31.0/api/jpm/cli.html: ok static/1.31.0/api/jpm/commands.html: ok static/1.31.0/api/jpm/config.html: ok static/1.31.0/api/jpm/dagbuild.html: ok static/1.31.0/api/jpm/index.html: ok static/1.31.0/api/jpm/make-config.html: ok static/1.31.0/api/jpm/pm.html: ok static/1.31.0/api/jpm/rules.html: ok static/1.31.0/api/jpm/scaffold.html: ok static/1.31.0/api/jpm/shutil.html: ok static/1.31.0/api/spork/argparse.html: ok static/1.31.0/api/spork/base64.html: ok static/1.31.0/api/spork/crc.html: ok static/1.31.0/api/spork/cron.html: ok static/1.31.0/api/spork/ev-utils.html: ok static/1.31.0/api/spork/fmt.html: ok static/1.31.0/api/spork/generators.html: ok static/1.31.0/api/spork/getline.html: ok static/1.31.0/api/spork/htmlgen.html: ok static/1.31.0/api/spork/http.html: ok static/1.31.0/api/spork/httpf.html: ok static/1.31.0/api/spork/index.html: ok static/1.31.0/api/spork/json.html: ok static/1.31.0/api/spork/math.html: ok static/1.31.0/api/spork/misc.html: ok static/1.31.0/api/spork/msg.html: ok static/1.31.0/api/spork/netrepl.html: ok static/1.31.0/api/spork/path.html: ok static/1.31.0/api/spork/rawterm.html: ok static/1.31.0/api/spork/regex.html: ok static/1.31.0/api/spork/rpc.html: ok static/1.31.0/api/spork/schema.html: ok static/1.31.0/api/spork/sh.html: ok static/1.31.0/api/spork/tarray.html: ok static/1.31.0/api/spork/test.html: ok static/1.31.0/api/spork/zip.html: ok static/1.34.0/api/jpm/cc.html: ok static/1.34.0/api/jpm/cgen.html: ok static/1.34.0/api/jpm/cli.html: ok static/1.34.0/api/jpm/commands.html: ok static/1.34.0/api/jpm/config.html: ok static/1.34.0/api/jpm/dagbuild.html: ok static/1.34.0/api/jpm/index.html: ok static/1.34.0/api/jpm/make-config.html: ok static/1.34.0/api/jpm/pm.html: ok static/1.34.0/api/jpm/rules.html: ok static/1.34.0/api/jpm/scaffold.html: ok static/1.34.0/api/jpm/shutil.html: ok static/1.34.0/api/spork/argparse.html: ok static/1.34.0/api/spork/base64.html: ok static/1.34.0/api/spork/crc.html: ok static/1.34.0/api/spork/cron.html: ok static/1.34.0/api/spork/ev-utils.html: ok static/1.34.0/api/spork/fmt.html: ok static/1.34.0/api/spork/generators.html: ok static/1.34.0/api/spork/getline.html: ok static/1.34.0/api/spork/htmlgen.html: ok static/1.34.0/api/spork/http.html: ok static/1.34.0/api/spork/httpf.html: ok static/1.34.0/api/spork/index.html: ok static/1.34.0/api/spork/json.html: ok static/1.34.0/api/spork/math.html: ok static/1.34.0/api/spork/misc.html: ok static/1.34.0/api/spork/msg.html: ok static/1.34.0/api/spork/netrepl.html: ok static/1.34.0/api/spork/path.html: ok static/1.34.0/api/spork/rawterm.html: ok static/1.34.0/api/spork/regex.html: ok static/1.34.0/api/spork/rpc.html: ok static/1.34.0/api/spork/schema.html: ok static/1.34.0/api/spork/sh.html: ok static/1.34.0/api/spork/tarray.html: ok static/1.34.0/api/spork/test.html: ok static/1.34.0/api/spork/utf8.html: ok static/1.34.0/api/spork/zip.html: ok static/1.35.0/api/spork/utf8.html: ok static/1.36.0/api/spork/utf8.html: ok static/1.37.1/api/spork/utf8.html: ok static/1.38.0/api/spork/utf8.html: ok files modified: 266 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is an attempt to address part of #309.
It turned out there were some pages for versions 1.35.0 - 1.38.0 that had links as well:
...so those were also attended to.
There are a lot of affected pages (at last count 266?) so I've done a number of things to try to ensure nothing was broken. I'm thinking to come up with some more things to try as well (suggestions welcome!) -- so I'll create this PR in draft form for the moment.
So far the kind of checking I did includes:
The script that made the changes to the files compares the new file lengths with differences between the old file lengths and the matched (and hence removed) number of bytes and prints a summary. I also observed all of the matched values via debugging output to verify they were of the form:
Manual inspection of some of the diffs before committing -- I did not check every last file though
Manual inspection of some of the web pages -- again, I did not look at every page, but below is a sample of links one might try if interested in verifying some:
Use ripgrep in the repository root to check for the existence and non-existence of strings before and after.
Before the changes:
After the changes: