Skip to content

Commit

Permalink
Revamp HTML in postprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
viperehonchuk committed Jan 9, 2024
1 parent e7075cc commit 65e1ff9
Show file tree
Hide file tree
Showing 17 changed files with 227 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
run: cd revamp/preprocessors/src/writer && go build -o ../../../../exe/
- name: Build fix-interactive-examples postprocessor
run: cd revamp/postprocessors/src/fix-interactive-examples && go build -o ../../../../exe/
- name: Build revamp-html postprocessor
run: cd revamp/postprocessors/src/revamp-html && go build -o ../../../../exe/
- name: Build move-media postprocessor
run: cd revamp/postprocessors/src/move-media && go build -o ../../../../exe/
- name: Build populate-algolia postprocessor
Expand Down Expand Up @@ -95,6 +97,7 @@ jobs:
name: interactive-examples
path: book/interactive-examples
- run: chmod +x ./revamp/exe/fix-interactive-examples && ./revamp/exe/fix-interactive-examples
- run: chmod +x ./revamp/exe/revamp-html && ./revamp/exe/revamp-html
- run: chmod +x ./revamp/exe/move-media && ./revamp/exe/move-media
- run: sudo apt install rename
# Recursively replace all asterisks in folder names with "_asterisk_"
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ endif

book: book/uk interactive-examples/docs

book/uk: book.toml content content/files/uk/index.md content/files/uk/SUMMARY.md original-content revamp/exe/move-media revamp/exe/format-links revamp/exe/inject-authors revamp/exe/rewire-paths revamp/exe/run-macros revamp/exe/strip-frontmatter revamp/exe/writer src
book/uk: book.toml content content/files/uk/index.md content/files/uk/SUMMARY.md original-content revamp/exe/move-media revamp/exe/format-links revamp/exe/inject-authors revamp/exe/revamp-html revamp/exe/rewire-paths revamp/exe/run-macros revamp/exe/strip-frontmatter revamp/exe/writer src
mdbook build
./revamp/exe/revamp-html
./revamp/exe/move-media

book/interactive-examples: interactive-examples/docs revamp/exe/fix-interactive-examples
Expand Down Expand Up @@ -85,6 +86,9 @@ revamp/exe/format-links: revamp/preprocessors/src/format-links revamp/preprocess
revamp/exe/inject-authors: revamp/preprocessors/src/inject-authors revamp/preprocessors/src/preprocessor
cd revamp/preprocessors/src/inject-authors && go build -o ../../../exe/

revamp/exe/revamp-html: revamp/postprocessors/src/revamp-html revamp/postprocessors/src/helpers
cd revamp/postprocessors/src/revamp-html && go build -o ../../../exe/

revamp/exe/rewire-paths: revamp/preprocessors/src/rewire-paths revamp/preprocessors/src/helpers revamp/preprocessors/src/preprocessor
cd revamp/preprocessors/src/rewire-paths && go build -o ../../../exe/

Expand Down
2 changes: 1 addition & 1 deletion content
Submodule content updated 102 files
19 changes: 10 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,33 @@ require (
github.com/adrg/frontmatter v0.2.0
github.com/algolia/algoliasearch-client-go/v3 v3.31.0
github.com/fre5h/transliteration-go v1.2.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
github.com/grokify/html-strip-tags-go v0.1.0
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc
golang.org/x/net v0.20.0
golang.org/x/text v0.14.0
)

require (
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/creack/pty v1.1.20 // indirect
github.com/creack/pty v1.1.21 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/pty v1.1.8 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/stretchr/objx v0.5.1 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/yuin/goldmark v1.6.0 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.14.0 // indirect
golang.org/x/tools v0.15.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/tools v0.16.1 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
20 changes: 20 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.20 h1:VIPb/a2s17qNeQgDnkfZC35RScx+blkKF8GV68n80J4=
github.com/creack/pty v1.1.20/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0=
github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fre5h/transliteration-go v1.2.0 h1:vnTyX1n8s4FnphYU3HrG1pz7j22pn0TdQqNXkXzpfBI=
github.com/fre5h/transliteration-go v1.2.0/go.mod h1:Lj7ckYuXFHSP9SNqsy9MIXA6RZ48YkETKtOxz6N97/Q=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4=
github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
Expand All @@ -37,6 +41,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand All @@ -55,8 +61,12 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM=
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
Expand All @@ -70,11 +80,15 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -85,12 +99,16 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8=
golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww=
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand All @@ -105,6 +123,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8=
golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk=
golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA=
golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU=
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
Expand Down
2 changes: 1 addition & 1 deletion hashes.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion original-content
Submodule original-content updated 94 files
+0 −1 files/en-us/games/techniques/3d_on_the_web/building_up_a_basic_demo_with_a-frame/index.md
+1 −1 files/en-us/games/techniques/3d_on_the_web/webxr/index.md
+10 −4 files/en-us/learn/tools_and_testing/cross_browser_testing/your_own_automation_environment/index.md
+41 −0 files/en-us/mozilla/firefox/experimental_features/index.md
+3 −0 files/en-us/mozilla/firefox/releases/121/index.md
+6 −6 files/en-us/mozilla/firefox/releases/30/index.md
+1 −1 files/en-us/web/accessibility/aria/roles/document_role/index.md
+1 −1 files/en-us/web/api/fedcm_api/index.md
+1 −2 files/en-us/web/api/gamepad/displayid/index.md
+1 −2 files/en-us/web/api/hmdvrdevice/geteyeparameters/index.md
+1 −2 files/en-us/web/api/hmdvrdevice/index.md
+1 −2 files/en-us/web/api/hmdvrdevice/setfieldofview/index.md
+1 −3 files/en-us/web/api/navigator/activevrdisplays/index.md
+1 −2 files/en-us/web/api/positionsensorvrdevice/getimmediatestate/index.md
+1 −2 files/en-us/web/api/positionsensorvrdevice/getstate/index.md
+1 −2 files/en-us/web/api/positionsensorvrdevice/index.md
+1 −2 files/en-us/web/api/positionsensorvrdevice/resetsensor/index.md
+1 −2 files/en-us/web/api/vrdisplay/cancelanimationframe/index.md
+1 −2 files/en-us/web/api/vrdisplay/capabilities/index.md
+1 −2 files/en-us/web/api/vrdisplay/depthfar/index.md
+1 −2 files/en-us/web/api/vrdisplay/depthnear/index.md
+1 −2 files/en-us/web/api/vrdisplay/displayid/index.md
+1 −2 files/en-us/web/api/vrdisplay/displayname/index.md
+1 −2 files/en-us/web/api/vrdisplay/exitpresent/index.md
+1 −2 files/en-us/web/api/vrdisplay/geteyeparameters/index.md
+1 −2 files/en-us/web/api/vrdisplay/getframedata/index.md
+1 −2 files/en-us/web/api/vrdisplay/getimmediatepose/index.md
+1 −2 files/en-us/web/api/vrdisplay/getlayers/index.md
+1 −2 files/en-us/web/api/vrdisplay/getpose/index.md
+1 −2 files/en-us/web/api/vrdisplay/index.md
+1 −2 files/en-us/web/api/vrdisplay/isconnected/index.md
+1 −2 files/en-us/web/api/vrdisplay/ispresenting/index.md
+1 −2 files/en-us/web/api/vrdisplay/requestanimationframe/index.md
+1 −2 files/en-us/web/api/vrdisplay/requestpresent/index.md
+1 −2 files/en-us/web/api/vrdisplay/resetpose/index.md
+1 −2 files/en-us/web/api/vrdisplay/stageparameters/index.md
+1 −2 files/en-us/web/api/vrdisplay/submitframe/index.md
+1 −2 files/en-us/web/api/vrdisplaycapabilities/canpresent/index.md
+1 −2 files/en-us/web/api/vrdisplaycapabilities/hasexternaldisplay/index.md
+1 −2 files/en-us/web/api/vrdisplaycapabilities/hasorientation/index.md
+1 −2 files/en-us/web/api/vrdisplaycapabilities/hasposition/index.md
+1 −2 files/en-us/web/api/vrdisplaycapabilities/index.md
+1 −2 files/en-us/web/api/vrdisplaycapabilities/maxlayers/index.md
+1 −2 files/en-us/web/api/vrdisplayevent/display/index.md
+1 −2 files/en-us/web/api/vrdisplayevent/index.md
+1 −2 files/en-us/web/api/vrdisplayevent/reason/index.md
+1 −2 files/en-us/web/api/vrdisplayevent/vrdisplayevent/index.md
+1 −2 files/en-us/web/api/vreyeparameters/fieldofview/index.md
+1 −2 files/en-us/web/api/vreyeparameters/index.md
+1 −2 files/en-us/web/api/vreyeparameters/maximumfieldofview/index.md
+1 −2 files/en-us/web/api/vreyeparameters/minimumfieldofview/index.md
+1 −2 files/en-us/web/api/vreyeparameters/offset/index.md
+1 −2 files/en-us/web/api/vreyeparameters/renderheight/index.md
+1 −2 files/en-us/web/api/vreyeparameters/renderwidth/index.md
+1 −2 files/en-us/web/api/vrfieldofview/downdegrees/index.md
+1 −2 files/en-us/web/api/vrfieldofview/index.md
+1 −2 files/en-us/web/api/vrfieldofview/leftdegrees/index.md
+1 −2 files/en-us/web/api/vrfieldofview/rightdegrees/index.md
+1 −2 files/en-us/web/api/vrfieldofview/updegrees/index.md
+1 −2 files/en-us/web/api/vrframedata/index.md
+1 −2 files/en-us/web/api/vrframedata/leftprojectionmatrix/index.md
+1 −2 files/en-us/web/api/vrframedata/leftviewmatrix/index.md
+1 −2 files/en-us/web/api/vrframedata/pose/index.md
+1 −2 files/en-us/web/api/vrframedata/rightprojectionmatrix/index.md
+1 −2 files/en-us/web/api/vrframedata/rightviewmatrix/index.md
+1 −2 files/en-us/web/api/vrframedata/timestamp/index.md
+1 −2 files/en-us/web/api/vrframedata/vrframedata/index.md
+1 −2 files/en-us/web/api/vrlayerinit/index.md
+1 −2 files/en-us/web/api/vrlayerinit/leftbounds/index.md
+1 −2 files/en-us/web/api/vrlayerinit/rightbounds/index.md
+1 −2 files/en-us/web/api/vrlayerinit/source/index.md
+1 −2 files/en-us/web/api/vrpose/angularacceleration/index.md
+1 −2 files/en-us/web/api/vrpose/angularvelocity/index.md
+1 −2 files/en-us/web/api/vrpose/index.md
+1 −2 files/en-us/web/api/vrpose/linearacceleration/index.md
+1 −2 files/en-us/web/api/vrpose/linearvelocity/index.md
+1 −2 files/en-us/web/api/vrpose/orientation/index.md
+1 −2 files/en-us/web/api/vrpose/position/index.md
+1 −2 files/en-us/web/api/vrstageparameters/index.md
+1 −2 files/en-us/web/api/vrstageparameters/sittingtostandingtransform/index.md
+1 −2 files/en-us/web/api/vrstageparameters/sizex/index.md
+1 −2 files/en-us/web/api/vrstageparameters/sizey/index.md
+1 −1 files/en-us/web/api/webvr_api/concepts/index.md
+0 −1 files/en-us/web/api/webvr_api/index.md
+1 −1 files/en-us/web/api/webxr_device_api/startup_and_shutdown/index.md
+1 −2 files/en-us/web/api/window/vrdisplayactivate_event/index.md
+1 −2 files/en-us/web/api/window/vrdisplayconnect_event/index.md
+1 −2 files/en-us/web/api/window/vrdisplaydeactivate_event/index.md
+1 −2 files/en-us/web/api/window/vrdisplaydisconnect_event/index.md
+1 −2 files/en-us/web/api/window/vrdisplaypresentchange_event/index.md
+0 −6 files/en-us/web/css/text-align/index.md
+14 −11 files/en-us/web/css/text-wrap/index.md
+1 −1 files/en-us/web/demos/index.md
+1 −12 files/en-us/web/http/basics_of_http/mime_types/index.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
package preprocessor_helpers
package helpers

import (
"html"
"regexp"
"strings"

"github.com/fre5h/transliteration-go"
strip "github.com/grokify/html-strip-tags-go"
)

var CHARACTERS_TO_REMOVE = regexp.MustCompile(`[^a-z0-9-]`)


func GetSectionId(text string) string {
text = strip.StripTags(text)
text = html.UnescapeString(text)
text = transliteration.UkrToLat(text)
text = strings.ToLower(text)
Expand Down
7 changes: 7 additions & 0 deletions revamp/postprocessors/src/move-media/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ func copyFileToFolder(filePath string, folderPath string) error {
func replaceInFile(filePath string, old string, new string) error {
file, err := os.ReadFile(filePath)
if err != nil {
// if file doesn't exist, return nil
if os.IsNotExist(err) {
return nil
}
return err
}
fileAsString := string(file)
Expand All @@ -45,6 +49,9 @@ func processFile(path string, info os.FileInfo, err error) error {
if info.Name() == "." || info.Name() == ".." {
return nil
}
if strings.HasSuffix(path, ".html") {
return nil
}
// fullFilePath := path + "/" + info.Name()
if info.IsDir() {
return nil
Expand Down
31 changes: 31 additions & 0 deletions revamp/postprocessors/src/revamp-html/fix-cyrillic-ids.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

import (
"strings"
"webdoky3/revamp/helpers"

"github.com/PuerkitoBio/goquery"
)

func fixCyrillicIds(doc *goquery.Document) error {
doc.Find("[id]").Each(func(i int, selection *goquery.Selection) {
id, _ := selection.Attr("id")
// if id has a cyrillic letter
if strings.ContainsAny(id, "абвгдеєжзиіїйклмнопрстуфхцчшщьюя") {
fixedId := helpers.GetSectionId(id)
selection.SetAttr("id", fixedId)
}
})
// Also fix Cyrillic anchor links
doc.Find("a[href^=\"#\"]").Each(func(i int, selection *goquery.Selection) {
href, _ := selection.Attr("href")
id := strings.TrimPrefix(href, "#")
// if id has a cyrillic letter
if strings.ContainsAny(id, "абвгдеєжзиіїйклмнопрстуфхцчшщьюя") {
fixedId := helpers.GetSectionId(id)
selection.SetAttr("href", "#"+fixedId)
}
})

return nil
}
86 changes: 86 additions & 0 deletions revamp/postprocessors/src/revamp-html/fix-definitions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package main

import (
"log"
"strings"
"webdoky3/revamp/helpers"

"github.com/PuerkitoBio/goquery"
"golang.org/x/exp/slices"
"golang.org/x/net/html"
)

func fixDefinitions(doc *goquery.Document) error {
lis := doc.Find("li")
pseudoDls := []*goquery.Selection{}
lis.Each(func(i int, li *goquery.Selection) {
// if li starts with ": "
if !strings.HasPrefix(li.Text(), ": ") {
return
}
pseudoDl := li.Closest("ul").Parent().Closest("ul")
if !slices.Contains(pseudoDls, pseudoDl) {
pseudoDls = append(pseudoDls, pseudoDl)
}
})
for _, pseudoDl := range pseudoDls {
dlHtml := ""
pseudoDefinitions := pseudoDl.ChildrenFiltered("li")
successMarker := true
pseudoDefinitions.Each(func(i int, pseudoDefinition *goquery.Selection) {
term := ""
definition := ""
htmlCode, err := pseudoDefinition.Html()
if err != nil {
log.Fatal(err)
}
pseudoDefinition.Contents().Each(func(i int, selection *goquery.Selection) {
nodeHtml, err := selection.Html()
if err != nil {
log.Fatal(err)
}
if nodeHtml == "" {
nodeHtml = selection.Text()
}
log.Printf("selection, %d: %s", selection.Nodes[0].Type, nodeHtml)
if selection.Nodes[0].Type != html.ElementNode || !selection.Is("ul") {
term += nodeHtml
} else {
selection.Find("ul > li").Each(func(i int, li *goquery.Selection) {
li.AddSelection(li.Find("p")).Each(func(i int, textContainer *goquery.Selection) {
if strings.HasPrefix(textContainer.Text(), ": ") {
textHtml, err := textContainer.Html()
if err != nil {
log.Fatal(err)
}
textContainer.SetHtml(strings.TrimPrefix(textHtml, ": "))
}
})

liHtml, err := li.Html()
if err != nil {
log.Fatal(err)
}
definition += liHtml
})
}
})
if term == "" {
log.Println("term is empty. " + htmlCode)
successMarker = false
}
if definition == "" {
log.Println("definition is empty. " + htmlCode)
successMarker = false
}
dlHtml += "<dt id=\"" + helpers.GetSectionId(term) + "\">" + term + "</dt><dd>" + definition + "</dd>"
})
dlHtml = "<dl>" + dlHtml + "</dl>"
if !successMarker {
continue
}
// Replace pseudoDl with dlHtml
pseudoDl.ReplaceWithHtml(dlHtml)
}
return nil
}
51 changes: 51 additions & 0 deletions revamp/postprocessors/src/revamp-html/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package main

import (
"log"
"os"
"path/filepath"
"strings"

"github.com/PuerkitoBio/goquery"
)

func main() {
err := filepath.Walk("book/uk/docs", func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if info.Name() != "index.html" {
return nil
}
log.Println(path)
htmlCode, err := os.ReadFile(path)
if err != nil {
return err
}
page, err := goquery.NewDocumentFromReader(strings.NewReader(string(htmlCode)))
if err != nil {
return err
}
err = fixDefinitions(page)
if err != nil {
return err
}
err = fixCyrillicIds(page)
if err != nil {
return err
}
// Write page back into file
html, err := page.Html()
if err != nil {
return err
}
err = os.WriteFile(path, []byte(html), 0644)
if err != nil {
return err
}
return nil
})
if err != nil {
log.Fatal(err)
}
}
2 changes: 1 addition & 1 deletion revamp/preprocessors/src/format-links/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func getClassForLink(href string) string {
}
} else {
classes = append(classes, "internal-link")
if !bookHasPath(href + "/index.md") {
if !strings.HasPrefix(href, "#") && !bookHasPath(href+"/index.md") {
log.Println("Missing link: " + href)
classes = append(classes, "missing-link")
}
Expand Down
Loading

0 comments on commit 65e1ff9

Please sign in to comment.