Skip to content

Add a search box to the Sample Problems page and a script to build a search file #2733

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

Draft
wants to merge 4 commits into
base: WeBWorK-2.20
Choose a base branch
from

Conversation

pstaabp
Copy link
Member

@pstaabp pstaabp commented May 27, 2025

This PR has two related features

  1. A script in bin/dev_scripts to parse all of the sample problems and the POD to build up a "database" (JSON file) of non-common words for a given problem/POD page. The JSON file contains information to be searched on within the browser using the package MiniSearch.
  2. Add search boxes to the sample-problems/POD pages to return pages that match the search criteria. The searching is done using MiniSearch.

There is a file htdocs/DATA/search.json that is provided that will be used while searching. This is not complete but currently should give some sense about how this works. The script will rebuild this file as needed.

Note: a subsequent PR will be posted to update the POD in the macros to give the search tools needed terms.

This PR has two related features
1. A script in `dev_scripts` to parse all of the sample problems and the POD to build up a "database" of non-common words for a given problem/POD page.
2. Add search boxes to the sample-problems/POD pages to return pages that match the search criteria.
@pstaabp
Copy link
Member Author

pstaabp commented Jun 10, 2025

Updated the script to parse the POD in macro files to

  1. parse the =head1 NAME section to extract the filename and short description of the macro. (Note: Restructure the POD of macros pg#1244 has an update on all macros to fix formats for this script to better parse).
  2. parse the =head2 blocks where method and function names have been included. This will allow to search for the documentation of a particular function name.

@dlglin
Copy link
Member

dlglin commented Jun 17, 2025

When I start typing I get suggestions, but if I type more after that then the suggestions disappear. Then if I type even more they reappear.

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.

2 participants