Skip to content

Conversation

@pgaskin
Copy link
Owner

@pgaskin pgaskin commented Nov 15, 2020

closes #93

@pgaskin pgaskin added this to the v0.5.0 milestone Nov 15, 2020
@pgaskin pgaskin marked this pull request as ready for review November 15, 2020 04:11
@pgaskin
Copy link
Owner Author

pgaskin commented Nov 15, 2020

@shermp, @NiLuJe, @jackiew1: This is ready for review if any of you want to look at the code or test it out. If you have any suggestions for more examples or additional escaping or transformation flags, I'd be happy to hear them.

https://nm.storage.geek1011.net/artifacts/commit/53bbc2a5d54460699fd414d6d4089ca54b446bdb/KoboRoot.tgz

@jackiew1
Copy link
Collaborator

@shermp, @NiLuJe, @jackiew1: This is ready for review if any of you want to look at the code or test it out. If you have any suggestions for more examples or additional escaping or transformation flags, I'd be happy to hear them.

@pgaskin I'm afraid I have no idea what this feature is, so not sure what you want me to do.

@pgaskin
Copy link
Owner Author

pgaskin commented Nov 15, 2020

This is for adding items to the selection menu, with support for substituting the selection (with many options) into action arguments. See the documentation in the changes tab.

@NiLuJe
Copy link
Collaborator

NiLuJe commented Nov 15, 2020

A quick test w/ menu_item :selection :Wiktionary :nickel_browser :modal:https://en.wiktionary.org/wiki/{a|C|%}#English worked out just fine.

Wiktionary appears to handle url encoding just fine, despite the pages themselves being stored with underscores in place of spaces.

@pgaskin
Copy link
Owner Author

pgaskin commented Nov 15, 2020

A quick test w/ menu_item :selection :Wiktionary :nickel_browser :modal:https://en.wiktionary.org/wiki/{a|C|%}#English worked out just fine.

I'll add that as an example (I might also add some custom CSS to clean it up a bit). How did you find the documentation from the perspective of a user?

Also, how many items can the screen on your Forma fit at once? I can fit around 4 on my Aura2, and I haven't tested it on my Clara yet.

underscores in place of spaces.

That gave me an idea: transformation flags for title-case, space-removal, and spaces-to-underscores. This'll be useful for a bunch of wikis and so on.

@NiLuJe
Copy link
Collaborator

NiLuJe commented Nov 15, 2020

A quick test w/ menu_item :selection :Wiktionary :nickel_browser :modal:https://en.wiktionary.org/wiki/{a|C|%}#English worked out just fine.

I'll add that as an example (I might also add some custom CSS to clean it up a bit). How did you find the documentation from the perspective of a user?

The examples definitely help, which means viewing it as a diff with both close together did, too, so, maybe a human-readable recap at the end of the token listing might be helpful, e.g. {a|C|%} will url-encode the selected text after normalizing the spacing, or something?

Also, how many items can the screen on your Forma fit at once? I can fit around 4 on my Aura2, and I haven't tested it on my Clara yet.

No idea, that was on the H2O ;p. That menu probably has weird positioning constraints, though, so it's probably hard to give a definite answer besides "not many". Not that it needs much, anyway ;).

That gave me an idea: transformation flags for title-case, space-removal, and spaces-to-underscores. This'll be useful for a bunch of wikis and so on.

👍

@NiLuJe
Copy link
Collaborator

NiLuJe commented Nov 15, 2020

Also, possibly naming the token groups with something other than letters that can be used inside of some of them might help avoid confusion? (say, 1, 2, 3 instead of A, B, C).

@NiLuJe
Copy link
Collaborator

NiLuJe commented Nov 15, 2020

And make the fact that "nothing" is a valid token outside of an example ;).

@NiLuJe
Copy link
Collaborator

NiLuJe commented Nov 15, 2020

Random other idea: possibly naming the token themselves with something vaguely related to what they do (like the escape ones), àla ZSH: http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion

@jackiew1
Copy link
Collaborator

This is for adding items to the selection menu, with support for substituting the selection (with many options) into action arguments. See the documentation in the changes tab.

I had already read the doc changes! 😄 If this is aimed at the mini-menu which pops up when you long-press a word then it's not surprising it's not resonating with me. The only thing I've ever used that for is to undo a highlight I accidently added when I meant to turn the page. I've never annotated nor connected any reader to the internet so the various searches are never used.

Anyway, I see NiLuJe has now responded so hopefully he can be more helpful.

@NiLuJe
Copy link
Collaborator

NiLuJe commented Nov 25, 2020

Another example for French readers (or simply readers of French ;p), since the monolingual dictionary still isn't all that great for French:

menu_item :selection :TLFi :nickel_browser :modal:https://www.cnrtl.fr/definition/{1|C|%}

(This is a frontend, I didn't bother trying to use the TLFi directly, since it appears to require POSTing a form).

@pgaskin
Copy link
Owner Author

pgaskin commented Nov 25, 2020

Is this even better?

menu_item :selection :TLFi :nickel_browser :modal:https://www.cnrtl.fr/definition/{1|C|%} #menubox,#header,#nav,#footer,td>.box.bottombox{display:none} #wrap{max-width:100%;width:auto;border-width:0} .tab_box a{padding:8px 6px !important;margin-right:0 !important;border:none !important;background:0 0 !important} .tab_box{padding-bottom:8px} a[href*="/proxemie/"],a[href*="/aide/"]{display:none}

@NiLuJe
Copy link
Collaborator

NiLuJe commented Nov 25, 2020

Indeed it is, the keyboard showing up in particular was fairly annoying ;).

@pgaskin
Copy link
Owner Author

pgaskin commented Dec 2, 2020

In the future, I might add an option to filter the selection menu items based on characteristics of the selected text (e.g. how many words selected) or based on the book title/author/series/path. It would look something like selection_filter:<substitution>:<op>:<arg>. <substitution> is a string which will have substitutions applied. <op> is regexp, contains, equals, prefix, or suffix, optionally prefixed with ! to negate it. <arg> is the string passed to <op>.

@pgaskin
Copy link
Owner Author

pgaskin commented Dec 2, 2020

@NiLuJe, can you have one last look at this before I merge it?

@pgaskin
Copy link
Owner Author

pgaskin commented Dec 3, 2020

After I merge this, I'll add @NiLuJe's TLFi example, and after I release this, I'll update the thread and webpage.

@NiLuJe
Copy link
Collaborator

NiLuJe commented Dec 3, 2020

Still working fine, I like the new tokens ;). 👍

Copy link
Owner Author

@pgaskin pgaskin left a comment

Choose a reason for hiding this comment

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

Tested on Aura2, Clara, and Mini with most actions and placeholders.

@pgaskin pgaskin merged commit df652ee into master Dec 3, 2020
@pgaskin pgaskin deleted the pgaskin/selection-menu branch December 3, 2020 18:18
pgaskin added a commit that referenced this pull request Jan 16, 2021
)

This fixes the regression introduced by #94 in v0.5.0 which caused
the built-in Wikipedia search to fail to load when NM is installed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selection menu

4 participants