Closed pgaskin closed 3 years ago
@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.
@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.
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.
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.
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.
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.
:+1:
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).
And make the fact that "nothing" is a valid token outside of an example ;).
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
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.
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).
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}
Indeed it is, the keyboard showing up in particular was fairly annoying ;).
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>
.
@NiLuJe, can you have one last look at this before I merge it?
After I merge this, I'll add @NiLuJe's TLFi example, and after I release this, I'll update the thread and webpage.
Still working fine, I like the new tokens ;). :+1:
closes #93