made wiki query slightly smarter #1
Open
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.
I, obviously, could not test this, but it should work.
It first tries the vanilla query, then tries to capitalize all individual words in the query, then it tries to match only the first word in the submitted query. The first time it hits a 200 OK request, it will return content back, and otherwise raise an exception.
Potential issues:
in rare cases, an unintended mismatch may occur when a word containing another valid word can be queried, but the full page title cannot be accessed. Currently don't know how to solve for this edge case. Probably not a big deal. Might happen one in a million natural times.
There is a slight bit of overhead from assuming that everything is already well-capitalized. Should not cause problems.
Notes:
Albaninto the url, it will redirect you toAlban Knights Training Grounds.