Open
Conversation
This felt simpler than rebasing, plus I wanted to preserve my commit from years ago.
The number gets parsed from the HTML only once. This keeps things simple, even though it is possible that the total number of pages could change during browse, resulting in unreachable pages until vimgolf.el is reloaded. To ensure all pages are reachable, we could make the request without storing/checking an upper bound. If the request yields no challenges parsed, then we retain the previous page results.
There is no checking that the number of the last page is non-nil. Parsing could fail silently and we wouldn't know here. We could raise an error here, or leave it as is.
I am fairly certain there is no API for browsing all of the challenges. The vimgolf docs say to use your browser to pick a challenge. I could find no functionality to browse challenges in the official CLI.
Owner
|
Thanks this looks great. :) |
Owner
|
@thoelze1 Could you rebase the branch and clean up the history a bit. After that I'm happy to merge and release this. |
Owner
|
Also I think we should cut 0.11.0 with this. Can you make the final two commits first the 0.11.0 cut and then the 0.11.1-SNAPSHOT change? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This branch adds the ability to browse all pages of challenges. Before this branch, only the first page of challenges is available.
There are at most a couple of design choices to mention. First, bounds checking is performed by parsing the last page number from the HTML navigation panel during the first call to
url-retrieve. I prefer this method over trial-and-error (i.e. don't store a last page number: always try to get the next page, and if no challenges can be parsed then go back) because it is simple. Second, we don't verify that the regex used for parsing the last page number actually succeeds with a match (which is also true of the challenge parsing).Also, I removed a TODO about using an API to browse challenges. As I mention in the relevant commit, I am fairly certain there is no such API based on the VimGolf docs and CLI code.
@timvisher we emailed about this feature in 2019. Here it is :) Thanks and all the best