Anon-Planet / thgtoa

The comprehensive guide for online anonymity and OpSec.
https://anonymousplanet.org/
Other
360 stars 40 forks source link

Get rid of Archive.org, Wikiless, Nitter, and Invidious cross-references #212

Closed ghost closed 2 years ago

ghost commented 2 years ago

Probably the last super large PR, unavoidable I'm afraid.

Getting rid of Archive.org , Wikiless , Nitter , Invidious (and a few others) cross-references. See #129.

This should get rid of the remains of word processors (except some tables) and also help in exporting to other formats.

Command used:

gawk -v RS='</sup>|\n' -F ': ' '{sub(/\r$/, "")} FNR==NR {if (NF==2 && $1 ~ /^[[:blank:]]*\[[0-9]+]$/) map[gensub(/^[[:blank:]]+/, "", "1", $1)]=$2; next} match($0, /\[\[[^]]+]](\[[0-9]+])/, a) && a[1] in map {$0 = substr($0, 1, RSTART+RLENGTH-length(a[1])-1) "(" map[a[1]] ")" substr($0, RSTART+RLENGTH)} ORS=RT' file file > result

Ready for final review

Doing it section by section is not convenient/useful since you'd have to isolate the section AND the references that might be used by other links. Making the whole thing complicated.

Now this is just "checking one by one" instead of "doing it manually"

nopeitsnothing commented 2 years ago

Does what it's supposed to. LGTM. I'm checking links before approving.

ghost commented 2 years ago

Please @dan-kir and @NobodySpecial256 , have a review at this as it modifies the entire document and simplifies it. And makes the document 1300 lines shorter. I'm certain we will have significant less issues with exporting to PDF after getting rid of all non numbered end-notes of type, leaving only the actual references [^number]. Now the credit doesn't go to me. I made some initial regexes and a basic sed commands without success. Someone from StackOverFlow changed it to awk and then to gawk which had to be updated to the latest version (Ubuntu 22.04 install, easy with Windows WSL). And then it took like 3 hours to finally reach the "right command", even for that cool person. But in the end. It's done. This would have taken weeks by hand.

nopeitsnothing commented 2 years ago

Appendix B6 isn't in master yet.

ghost commented 2 years ago

I know, working on it

nopeitsnothing commented 2 years ago

Cool. Actually, it is, just not the ToC.

ghost commented 2 years ago

All should be okay now