pelican-plugins / search

Pelican plugin that adds site search capability
49 stars 9 forks source link

safely wrap `title:` contents using json `dumps` #23

Closed maphew closed 1 year ago

maphew commented 1 year ago

This should handle any arbitrary punctuation marks which may happen to be in the Title - ",',\,*,...etc.

I don't undersand why this works, since we're not doing anything with json. I just know that everything I've thrown at it comes out safely.

I left the change from #15 intact, though json.dumps makes it unnecessary. Using them both at the same time doesn't seem to change results. I've tested and verified that " don't become double escaped

Pull Request Checklist

Resolves: #20

Note: as mentioned in closed PR #22 I can't run the linting during commit since my system hates it. For this PR I edited and tested and linted search.py on my local machine and then manually copied the changes via Github website editor. However I can't guarantee some mistake did not happen in the middle.

Doc updates believed unnecessary.

maphew commented 1 year ago

Status: contrary to opening comment #15 was removed in the end since the changes did conflict. IMO this PR is better than 15 in that it handles many special characters in title and not just ("), but whatever you decide is fine. (No more changes from me planned.)

justinmayer commented 1 year ago

I manually merged this change and released it in version 1.0.2. Many thanks for the improvement, Matt. 🏅