Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts/set-page-title.py: add script #12732

Merged
merged 10 commits into from May 9, 2024
Merged

scripts/set-page-title.py: add script #12732

merged 10 commits into from May 9, 2024

Conversation

sebastiaanspeck
Copy link
Member

I found out, when running wrong-filename.sh, that there were translated pages that translated the title of the page. This makes the page unfindable when using a client.

Therefore I decided to create a Python-script, inspired on set-more-info-link, to sync the titles.

Right now there are 290 pages for which the title does not match the English title.

This includes two scenarios:

  1. The translation page has translated the title (e.g. pages.es/common/type.md)
  2. The translated pages use another title in a consistent way (e.g. fossil-ci.md)

The first scenario definitely needs to be fixed, but for the second scenario we could argue if the English page is “incorrect”.

The dry-run output (unsorted)
pages.nl/windows/sc-config.md title will be updated
pages.ta/windows/choco-apikey.md title will be updated
pages.nl/windows/sc-create.md title will be updated
pages.nl/windows/sc-query.md title will be updated
pages.nl/windows/sc-delete.md title will be updated
pages.nl/linux/unmount.md title will be updated
pages.nl/linux/shntool-split.md title will be updated
pages.de/linux/esa-snap.md title will be updated
pages.de/linux/httpie.md title will be updated
pages.da/linux/ip-route-list.md title will be updated
pages.it/linux/ip-route-list.md title will be updated
pages.es/linux/ip-route-list.md title will be updated
pages.sv/linux/ip-route-list.md title will be updated
pages.lo/linux/ip-route-list.md title will be updated
pages.pl/linux/ip-route-list.md title will be updated
pages.pt_BR/linux/ip-route-list.md title will be updated
pages.ko/linux/ip-route-list.md title will be updated
pages.ml/linux/ip-route-list.md title will be updated
pages.nl/linux/ip-route-list.md title will be updated
pages.ja/linux/ip-route-list.md title will be updated
pages.ta/linux/ip-route-list.md title will be updated
pages.ar/linux/ip-route-list.md title will be updated
pages.th/linux/ip-route-list.md title will be updated
pages.hi/linux/ip-route-list.md title will be updated
pages.zh_TW/linux/ip-route-list.md title will be updated
pages.zh/linux/ip-route-list.md title will be updated
pages.pt_PT/linux/ip-route-list.md title will be updated
pages.id/linux/ip-route-list.md title will be updated
pages.uk/linux/ip-route-list.md title will be updated
pages.ne/linux/ip-route-list.md title will be updated
pages.ru/linux/ip-route-list.md title will be updated
pages.no/linux/ip-route-list.md title will be updated
pages.de/linux/ip-route-list.md title will be updated
pages.bs/linux/ip-route-list.md title will be updated
pages.tr/linux/ip-route-list.md title will be updated
pages.ca/linux/ip-route-list.md title will be updated
pages.da/common/fossil-forget.md title will be updated
pages.it/common/fossil-forget.md title will be updated
pages.es/common/fossil-forget.md title will be updated
pages.sv/common/fossil-forget.md title will be updated
pages.lo/common/fossil-forget.md title will be updated
pages.pl/common/fossil-forget.md title will be updated
pages.pt_BR/common/fossil-forget.md title will be updated
pages.ko/common/fossil-forget.md title will be updated
pages.ml/common/fossil-forget.md title will be updated
pages.nl/common/fossil-forget.md title will be updated
pages.fr/common/fossil-forget.md title will be updated
pages.ja/common/fossil-forget.md title will be updated
pages.ta/common/fossil-forget.md title will be updated
pages.ar/common/fossil-forget.md title will be updated
pages.th/common/fossil-forget.md title will be updated
pages.hi/common/fossil-forget.md title will be updated
pages.zh_TW/common/fossil-forget.md title will be updated
pages.zh/common/fossil-forget.md title will be updated
pages.pt_PT/common/fossil-forget.md title will be updated
pages.id/common/fossil-forget.md title will be updated
pages.uk/common/fossil-forget.md title will be updated
pages.ne/common/fossil-forget.md title will be updated
pages.ru/common/fossil-forget.md title will be updated
pages.no/common/fossil-forget.md title will be updated
pages.de/common/fossil-forget.md title will be updated
pages.bs/common/fossil-forget.md title will be updated
pages.tr/common/fossil-forget.md title will be updated
pages.ca/common/fossil-forget.md title will be updated
pages.nl/common/git-stage.md title will be updated
pages.da/common/fossil-delete.md title will be updated
pages.it/common/fossil-delete.md title will be updated
pages.es/common/fossil-delete.md title will be updated
pages.sv/common/fossil-delete.md title will be updated
pages.lo/common/fossil-delete.md title will be updated
pages.pl/common/fossil-delete.md title will be updated
pages.pt_BR/common/fossil-delete.md title will be updated
pages.ko/common/fossil-delete.md title will be updated
pages.ml/common/fossil-delete.md title will be updated
pages.nl/common/fossil-delete.md title will be updated
pages.fr/common/fossil-delete.md title will be updated
pages.ja/common/fossil-delete.md title will be updated
pages.ta/common/fossil-delete.md title will be updated
pages.ar/common/fossil-delete.md title will be updated
pages.th/common/fossil-delete.md title will be updated
pages.hi/common/fossil-delete.md title will be updated
pages.zh_TW/common/fossil-delete.md title will be updated
pages.zh/common/fossil-delete.md title will be updated
pages.pt_PT/common/fossil-delete.md title will be updated
pages.id/common/fossil-delete.md title will be updated
pages.uk/common/fossil-delete.md title will be updated
pages.ne/common/fossil-delete.md title will be updated
pages.ru/common/fossil-delete.md title will be updated
pages.no/common/fossil-delete.md title will be updated
pages.de/common/fossil-delete.md title will be updated
pages.bs/common/fossil-delete.md title will be updated
pages.tr/common/fossil-delete.md title will be updated
pages.ca/common/fossil-delete.md title will be updated
pages.da/common/fossil-new.md title will be updated
pages.it/common/fossil-new.md title will be updated
pages.es/common/fossil-new.md title will be updated
pages.sv/common/fossil-new.md title will be updated
pages.lo/common/fossil-new.md title will be updated
pages.pl/common/fossil-new.md title will be updated
pages.pt_BR/common/fossil-new.md title will be updated
pages.ko/common/fossil-new.md title will be updated
pages.ml/common/fossil-new.md title will be updated
pages.nl/common/fossil-new.md title will be updated
pages.fr/common/fossil-new.md title will be updated
pages.ja/common/fossil-new.md title will be updated
pages.ta/common/fossil-new.md title will be updated
pages.ar/common/fossil-new.md title will be updated
pages.th/common/fossil-new.md title will be updated
pages.hi/common/fossil-new.md title will be updated
pages.zh_TW/common/fossil-new.md title will be updated
pages.zh/common/fossil-new.md title will be updated
pages.pt_PT/common/fossil-new.md title will be updated
pages.id/common/fossil-new.md title will be updated
pages.uk/common/fossil-new.md title will be updated
pages.ne/common/fossil-new.md title will be updated
pages.ru/common/fossil-new.md title will be updated
pages.no/common/fossil-new.md title will be updated
pages.de/common/fossil-new.md title will be updated
pages.bs/common/fossil-new.md title will be updated
pages.tr/common/fossil-new.md title will be updated
pages.ca/common/fossil-new.md title will be updated
pages.da/common/gh-cs.md title will be updated
pages.it/common/gh-cs.md title will be updated
pages.es/common/gh-cs.md title will be updated
pages.sv/common/gh-cs.md title will be updated
pages.lo/common/gh-cs.md title will be updated
pages.pl/common/gh-cs.md title will be updated
pages.pt_BR/common/gh-cs.md title will be updated
pages.ko/common/gh-cs.md title will be updated
pages.ml/common/gh-cs.md title will be updated
pages.nl/common/gh-cs.md title will be updated
pages.fr/common/gh-cs.md title will be updated
pages.ja/common/gh-cs.md title will be updated
pages.ta/common/gh-cs.md title will be updated
pages.ar/common/gh-cs.md title will be updated
pages.th/common/gh-cs.md title will be updated
pages.hi/common/gh-cs.md title will be updated
pages.zh_TW/common/gh-cs.md title will be updated
pages.zh/common/gh-cs.md title will be updated
pages.pt_PT/common/gh-cs.md title will be updated
pages.id/common/gh-cs.md title will be updated
pages.uk/common/gh-cs.md title will be updated
pages.ne/common/gh-cs.md title will be updated
pages.ru/common/gh-cs.md title will be updated
pages.no/common/gh-cs.md title will be updated
pages.de/common/gh-cs.md title will be updated
pages.bs/common/gh-cs.md title will be updated
pages.tr/common/gh-cs.md title will be updated
pages.ca/common/gh-cs.md title will be updated
pages.nl/common/azure-cli.md title will be updated
pages.es/common/type.md title will be updated
pages.da/common/clamav.md title will be updated
pages.it/common/clamav.md title will be updated
pages.sv/common/clamav.md title will be updated
pages.lo/common/clamav.md title will be updated
pages.pl/common/clamav.md title will be updated
pages.pt_BR/common/clamav.md title will be updated
pages.ko/common/clamav.md title will be updated
pages.ml/common/clamav.md title will be updated
pages.fr/common/clamav.md title will be updated
pages.ja/common/clamav.md title will be updated
pages.ta/common/clamav.md title will be updated
pages.ar/common/clamav.md title will be updated
pages.hi/common/clamav.md title will be updated
pages.zh_TW/common/clamav.md title will be updated
pages.zh/common/clamav.md title will be updated
pages.pt_PT/common/clamav.md title will be updated
pages.uk/common/clamav.md title will be updated
pages.ne/common/clamav.md title will be updated
pages.ru/common/clamav.md title will be updated
pages.no/common/clamav.md title will be updated
pages.de/common/clamav.md title will be updated
pages.bs/common/clamav.md title will be updated
pages.tr/common/clamav.md title will be updated
pages.da/common/gnmic-sub.md title will be updated
pages.it/common/gnmic-sub.md title will be updated
pages.es/common/gnmic-sub.md title will be updated
pages.sv/common/gnmic-sub.md title will be updated
pages.lo/common/gnmic-sub.md title will be updated
pages.pl/common/gnmic-sub.md title will be updated
pages.pt_BR/common/gnmic-sub.md title will be updated
pages.ko/common/gnmic-sub.md title will be updated
pages.ml/common/gnmic-sub.md title will be updated
pages.nl/common/gnmic-sub.md title will be updated
pages.fr/common/gnmic-sub.md title will be updated
pages.ja/common/gnmic-sub.md title will be updated
pages.ta/common/gnmic-sub.md title will be updated
pages.ar/common/gnmic-sub.md title will be updated
pages.th/common/gnmic-sub.md title will be updated
pages.hi/common/gnmic-sub.md title will be updated
pages.zh_TW/common/gnmic-sub.md title will be updated
pages.zh/common/gnmic-sub.md title will be updated
pages.pt_PT/common/gnmic-sub.md title will be updated
pages.id/common/gnmic-sub.md title will be updated
pages.uk/common/gnmic-sub.md title will be updated
pages.ne/common/gnmic-sub.md title will be updated
pages.ru/common/gnmic-sub.md title will be updated
pages.no/common/gnmic-sub.md title will be updated
pages.de/common/gnmic-sub.md title will be updated
pages.bs/common/gnmic-sub.md title will be updated
pages.tr/common/gnmic-sub.md title will be updated
pages.ca/common/gnmic-sub.md title will be updated
pages.id/common/!.md title will be updated
pages.fr/common/adb-logcat.md title will be updated
pages.zh/common/adb-logcat.md title will be updated
pages.id/common/adb-logcat.md title will be updated
pages.da/common/pio-init.md title will be updated
pages.it/common/pio-init.md title will be updated
pages.es/common/pio-init.md title will be updated
pages.sv/common/pio-init.md title will be updated
pages.lo/common/pio-init.md title will be updated
pages.pl/common/pio-init.md title will be updated
pages.pt_BR/common/pio-init.md title will be updated
pages.ko/common/pio-init.md title will be updated
pages.ml/common/pio-init.md title will be updated
pages.nl/common/pio-init.md title will be updated
pages.fr/common/pio-init.md title will be updated
pages.ja/common/pio-init.md title will be updated
pages.ta/common/pio-init.md title will be updated
pages.ar/common/pio-init.md title will be updated
pages.th/common/pio-init.md title will be updated
pages.hi/common/pio-init.md title will be updated
pages.zh_TW/common/pio-init.md title will be updated
pages.zh/common/pio-init.md title will be updated
pages.pt_PT/common/pio-init.md title will be updated
pages.id/common/pio-init.md title will be updated
pages.uk/common/pio-init.md title will be updated
pages.ne/common/pio-init.md title will be updated
pages.ru/common/pio-init.md title will be updated
pages.no/common/pio-init.md title will be updated
pages.de/common/pio-init.md title will be updated
pages.tr/common/pio-init.md title will be updated
pages.ca/common/pio-init.md title will be updated
pages.da/common/tlmgr-arch.md title will be updated
pages.it/common/tlmgr-arch.md title will be updated
pages.es/common/tlmgr-arch.md title will be updated
pages.sv/common/tlmgr-arch.md title will be updated
pages.lo/common/tlmgr-arch.md title will be updated
pages.pl/common/tlmgr-arch.md title will be updated
pages.pt_BR/common/tlmgr-arch.md title will be updated
pages.ko/common/tlmgr-arch.md title will be updated
pages.ml/common/tlmgr-arch.md title will be updated
pages.nl/common/tlmgr-arch.md title will be updated
pages.fr/common/tlmgr-arch.md title will be updated
pages.ja/common/tlmgr-arch.md title will be updated
pages.ta/common/tlmgr-arch.md title will be updated
pages.ar/common/tlmgr-arch.md title will be updated
pages.th/common/tlmgr-arch.md title will be updated
pages.hi/common/tlmgr-arch.md title will be updated
pages.zh_TW/common/tlmgr-arch.md title will be updated
pages.zh/common/tlmgr-arch.md title will be updated
pages.pt_PT/common/tlmgr-arch.md title will be updated
pages.id/common/tlmgr-arch.md title will be updated
pages.uk/common/tlmgr-arch.md title will be updated
pages.ne/common/tlmgr-arch.md title will be updated
pages.ru/common/tlmgr-arch.md title will be updated
pages.no/common/tlmgr-arch.md title will be updated
pages.de/common/tlmgr-arch.md title will be updated
pages.tr/common/tlmgr-arch.md title will be updated
pages.ca/common/tlmgr-arch.md title will be updated
pages.da/common/fossil-ci.md title will be updated
pages.it/common/fossil-ci.md title will be updated
pages.sv/common/fossil-ci.md title will be updated
pages.lo/common/fossil-ci.md title will be updated
pages.pl/common/fossil-ci.md title will be updated
pages.pt_BR/common/fossil-ci.md title will be updated
pages.ko/common/fossil-ci.md title will be updated
pages.ml/common/fossil-ci.md title will be updated
pages.nl/common/fossil-ci.md title will be updated
pages.fr/common/fossil-ci.md title will be updated
pages.ja/common/fossil-ci.md title will be updated
pages.ta/common/fossil-ci.md title will be updated
pages.ar/common/fossil-ci.md title will be updated
pages.th/common/fossil-ci.md title will be updated
pages.hi/common/fossil-ci.md title will be updated
pages.zh_TW/common/fossil-ci.md title will be updated
pages.zh/common/fossil-ci.md title will be updated
pages.pt_PT/common/fossil-ci.md title will be updated
pages.id/common/fossil-ci.md title will be updated
pages.uk/common/fossil-ci.md title will be updated
pages.ne/common/fossil-ci.md title will be updated
pages.ru/common/fossil-ci.md title will be updated
pages.no/common/fossil-ci.md title will be updated
pages.de/common/fossil-ci.md title will be updated
pages.bs/common/fossil-ci.md title will be updated
pages.tr/common/fossil-ci.md title will be updated
pages.fr/common/docker-build.md title will be updated
pages.pl/common/r.md title will be updated
pages.fr/common/r.md title will be updated
pages.ta/common/podman.md title will be updated

@github-actions github-actions bot added documentation Issues/PRs modifying the documentation. tooling Helper tools, scripts and automated processes. labels May 5, 2024
scripts/set-title.py Outdated Show resolved Hide resolved
@CleanMachine1
Copy link
Member

Very good find, but does this effect the finding of it? Some clients must be using file names as their command finder.

@sebastiaanspeck
Copy link
Member Author

Very good find, but does this effect the finding of it? Some clients must be using file names as their command finder.

My thought was that they would use the title. With tlrc I was able to find the pages with and without a dash in between (e.g. tldr fossil-ci vs tldr fossil ci). I would suggest to keep a title, just like the more-info links consist between a translation and the English page.

@acuteenvy
Copy link
Member

My thought was that they would use the title. With tlrc I was able to find the pages with and without a dash in between (e.g. tldr fossil-ci vs tldr fossil ci).

tldr fossil ci is the same as tldr fossil-ci by the client specification. The title and other contents of the page are irrelevant.

https://github.com/tldr-pages/tldr/blob/main/CLIENT-SPECIFICATION.md#page-names

Page names MAY contain spaces (e.g. git status), and such page names MUST be transparently concatenated with dashes (-). For example, the page name git checkout becomes git-checkout.

@sebastiaanspeck
Copy link
Member Author

My thought was that they would use the title. With tlrc I was able to find the pages with and without a dash in between (e.g. tldr fossil-ci vs tldr fossil ci).

tldr fossil ci is the same as tldr fossil-ci by the client specification. The title and other contents of the page are irrelevant.

main/CLIENT-SPECIFICATION.md#page-names

Page names MAY contain spaces (e.g. git status), and such page names MUST be transparently concatenated with dashes (-). For example, the page name git checkout becomes git-checkout.

But for consistency it seems better to me to keep the title of a translated page the same as the English one

@Waples
Copy link
Member

Waples commented May 6, 2024

Very fun 'first in a few months' issue to dive into, thanks @sebastiaanspeck. If you can update the branch again, I'll have a look tonight / tomorrow.

@sebastiaanspeck
Copy link
Member Author

Very fun 'first in a few months' issue to dive into, thanks @sebastiaanspeck. If you can update the branch again, I'll have a look tonight / tomorrow.

Done! Although there was no need to update the branch as there were no conflicts

Copy link
Member

@vitorhcl vitorhcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after this minor suggestion and also the previous suggestion about the get_tldr_root() are applied.

scripts/set-page-title.py Outdated Show resolved Hide resolved
@sebastiaanspeck
Copy link
Member Author

LGTM after this minor suggestion and also the previous suggestion about the get_tldr_root() are applied.

About the get_tldr_root() is fixed for the two other scripts in this PR. I will apply the same fix here.

scripts/set-page-title.py Outdated Show resolved Hide resolved
scripts/set-page-title.py Outdated Show resolved Hide resolved
scripts/set-page-title.py Outdated Show resolved Hide resolved
scripts/set-page-title.py Outdated Show resolved Hide resolved
Copy link
Member

@vitorhcl vitorhcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current tldr root checking based on the current path can raise an exception caused by the if condition.

scripts/set-page-title.py Outdated Show resolved Hide resolved
scripts/set-page-title.py Outdated Show resolved Hide resolved
Co-authored-by: Vítor Henrique <87824454+vitorhcl@users.noreply.github.com>
@tldr-bot

This comment was marked as resolved.

Copy link
Member

@vitorhcl vitorhcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a non-blocking suggestion that we can apply in another PR as it is a bit bigger. It is targeted to new contributors/mantainers.

We should probably do this after we create _common.py.

scripts/set-page-title.py Show resolved Hide resolved
Copy link
Member

@vitorhcl vitorhcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Details aside, this PR LGTM after we resolve the discussion about the persistence of the symlink problem.

Thank you for your contribution and for your patience!

@sebastiaanspeck
Copy link
Member Author

Details aside, this PR LGTM after we resolve the discussion about the persistence of the symlink problem.

As mentioned before, I do not have any experience/issues with the symlink problem. I rely on @kbdharun and @acuteenvy on this.

@kbdharun kbdharun self-assigned this May 9, 2024
@kbdharun
Copy link
Member

kbdharun commented May 9, 2024

Details aside, this PR LGTM after we resolve the discussion about the persistence of the symlink problem.

As mentioned before, I do not have any experience/issues with the symlink problem. I rely on kbdharun and acuteenvy on this.

Tested the script locally and the symlink issue isn't present on Windows, just a minor fix to the example in docs and this PR is GTG.

scripts/set-page-title.py Outdated Show resolved Hide resolved
sebastiaanspeck and others added 2 commits May 9, 2024 13:18
Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
@kbdharun kbdharun removed their assignment May 9, 2024
@sebastiaanspeck sebastiaanspeck merged commit 150f027 into main May 9, 2024
8 checks passed
@sebastiaanspeck sebastiaanspeck deleted the set-title-page branch May 9, 2024 11:24
@acuteenvy acuteenvy removed their request for review May 9, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issues/PRs modifying the documentation. tooling Helper tools, scripts and automated processes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants