Skip to content

Refactor WebLinkMatcher.ts and add additional.#1924

Merged
FinnRG merged 22 commits intoVocaDB:mainfrom
Calamitish:refactor-ExtLinks-and-add-additional
Apr 27, 2025
Merged

Refactor WebLinkMatcher.ts and add additional.#1924
FinnRG merged 22 commits intoVocaDB:mainfrom
Calamitish:refactor-ExtLinks-and-add-additional

Conversation

@Calamitish
Copy link
Copy Markdown
Contributor

@Calamitish Calamitish commented Apr 24, 2025

ExtLinks.css:

  • Replace all double quotes with single quotes for consistency.
  • Add trailing slashes to all URLs for consistency.
  • Clean up usage of background-image vs background.
  • Unify http and https checks. Before this, some icons would only match with http URLs and some only with https URLs.
  • Make bracket usage consistent.
  • Remove or combine duplicate entries.
  • Removed a dead comment.
  • Re-order ExtLinks.css by logo image name alphabetically.
    • With exception for those those that have a logo in a different repository, move those to the top.
  • Rename fasic and thbwiki to Fasic and THBWiki to match actual filenames. naming convention for files could be a discussion point for a future PR.
  • Add icon matching with links that did have icons, but were not being used.
  • Add additional icon matching with new icons (see: Add additional website logos. ExtIcons#7)
  • Icon matching via ^ match or * match has been left mostly the same, could still be a discussion point for a future PR.

WebLinkMatcher.ts

# ExtLinks.css:
- Re-order ExtLinks.css by logo image name alphabetically.
- - With exception for those those that have a logo in a different repository, move those to the top.
- Clean up usage of background-image vs background.
- Fix icon matching with links that only matched to http:// to also work with https://
- Add icon matching with links that did have icons, but were not being used.
- Add additional icon matching with new icons (see: VocaDB/ExtIcons#7)
- Icon matching via ^ match or * match has been left mostly the same, could still be a discussion point.
- Clean up styling.

# WebLinkMatcher.ts
- Add additonal Weblink matchers relating to VocaDB/ExtIcons#7
Copy link
Copy Markdown
Collaborator

@Susko3 Susko3 left a comment

Choose a reason for hiding this comment

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

To me, this PR is impossible to review. It's possible that you accidentally changed a link category or dropped some icon. It would be way easier to check that if this PR was split into separate commits that do one of the steps you mention in the description.

Also, every line in the diff is marked as changed, even if it remained the same. Have the line-endings accidentally been changed? Maybe make the line-ending change a separate commit, or don't do it. https://docs.github.com/en/get-started/git-basics/configuring-git-to-handle-line-endings

@Calamitish
Copy link
Copy Markdown
Contributor Author

Calamitish commented Apr 26, 2025

every line in the diff is marked as changed

Seems like the project is operating with LF line endings which automatically got converted to CRLF on my end.
Will revert and separate in different commits.

That last one's still going to be a pain to review just by nature of sorting all of the ExtLinks alphabetically.

Comment thread VocaDbWeb/Scripts/styles/ExtLinks.css Outdated
background-image: url('/Content/ExtIcons/ototoy.png');
}

a.extLink[href^='http(s?)://potune.jp/']
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have also removed the incorrect a.extLink[href^='http://ototoy.jp/'] here.

See: VocaDB/ExtIcons#7
- ah-soft
- ai-voice
- bandlab
- dreamtonics
- genius
- github
- marshmallow-qa
- musixmatch
- project sekai fandom wiki
- reddit
- voicevox
- voisona
@Calamitish
Copy link
Copy Markdown
Contributor Author

PR updated and everything is now split into separate commits.
Let me know if I've missed something.

Something to note:
It seems that the project either inconsistently uses LF and CRLF line-endings or only uses LF.
(It's very hard for me to tell, in all honesty)
It's probably a good idea to either outline this in the wiki entry for windows development environment or the project readme.
It's currently easy to miss this difference for any contributors.
Might also be a good idea to sweep the entire project and double check that all files consistently use the same line-endings.

Copy link
Copy Markdown
Collaborator

@Susko3 Susko3 left a comment

Choose a reason for hiding this comment

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

I've checked that the individual commits make changer per their description. Everything else seems fine, apart from the following:

Comment thread VocaDbWeb/Scripts/styles/ExtLinks.css Outdated
Comment thread VocaDbWeb/Scripts/styles/ExtLinks.css Outdated
Comment thread VocaDbWeb/Scripts/styles/ExtLinks.css Outdated
- Re-add accidentally removed link matchers.
- Fix brace.
Comment thread VocaDbWeb/Scripts/styles/ExtLinks.css Outdated
}

/* image outside of ExtIcons folder because it is also used elsewhere*/
a.extLink[href^='http(s?)://soundcloud.com/'],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Have you tested this? Regex doesn't seem to be supported in CSS attribute selectors.

slika

I suggest you either
a) go back to separate http:// and https://
b) change the matcher to be [href*='://soundcloud.com/'] (anywhere in url, but including :// to avoid false-positives)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Went with b as to not have unnecessary duplication.

Comment thread VocaDbWeb/Scripts/styles/ExtLinks.css
Comment thread VocaDbWeb/Scripts/styles/ExtLinks.css
@Susko3
Copy link
Copy Markdown
Collaborator

Susko3 commented Apr 26, 2025

Whoops, the review went wrongly, just search for "?" and you'll see the problems.

@Calamitish
Copy link
Copy Markdown
Contributor Author

Got them!
Here's to writing code when you're tired :D
I probably typo'd those originally so they didn't get caught be the replace.

Comment thread VocaDbWeb/Scripts/styles/ExtLinks.css Outdated
Copy link
Copy Markdown
Collaborator

@Susko3 Susko3 left a comment

Choose a reason for hiding this comment

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

Seems to be good now!

Copy link
Copy Markdown
Member

@FinnRG FinnRG left a comment

Choose a reason for hiding this comment

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

Thank you both for your work on this.

@FinnRG FinnRG merged commit 22955f5 into VocaDB:main Apr 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants