Ubiquity unable to distinguish between argument and delimiter

0 views
Skip to first unread message
Message has been deleted
Message has been deleted

Bhagwad

unread,
Oct 16, 2009, 7:29:01 PM10/16/09
to ubiquity-firefox
I'm trying to create a command "HTML Tag" that has two arguments:

1. A Noun
2. URL

The URL has the "instrument" role so the command is: "HTML Tag a with
www.bhagwad.com".

As long as I don't have a selection on the screen, "a" is correctly
taken as the noun and www.bhagwad.com is correctly taken as the URL .

But when I have a selection on screen, Ubiquity suddenly thinks that
"a with" is the noun! It doesn't seem to be able to realize that
"with" is a delimiter.

Does anyone have an idea as to why this is happening?

Thanks in advance.

Bhagwad

unread,
Oct 16, 2009, 7:32:03 PM10/16/09
to ubiquity-firefox
Or rather, it seems to think that when I make a selection, the
selection is the "instrument" argument. I don't want that to happen.

How do we change this behavior?

satyr

unread,
Oct 17, 2009, 5:28:29 AM10/17/09
to ubiquity...@googlegroups.com
You'd have to write a custom noun of your own, like this:

var noun_type_url_noselection = {
label: "URL",
suggest: function ntun_suggest(txt, htm, cb, selectionIndices) {
if (selectionIndices) return []; // suggest none for selection
if (/^(?!\w+:)/.test(txt)) txt = "http://" + txt;
return [CmdUtils.makeSugg(txt, null, null, .5)];
},
};

Bhagwad

unread,
Oct 18, 2009, 5:56:44 PM10/18/09
to ubiquity-firefox
Wow! That's quite a suggestion!

Thanks - I'll try and decipher the code and see what I come up with :)

In the meantime, I've found a workaround. I've defined the object to
accept only an array of discrete values - a, em, i, h1, li etc. This
seems to work. Here is the result:
http://www.bhagwad.com/blog/2009/technology/inserting-html-tags-using-firefox-ubiquity.html
- the code is updated. Need to change the post to allow users to put
the URL for the "link" tag.

On Oct 17, 4:28 am, satyr <murky.sa...@gmail.com> wrote:
> You'd have to write a custom noun of your own, like this:
>
> var noun_type_url_noselection = {
>   label: "URL",
>   suggest: function ntun_suggest(txt, htm, cb, selectionIndices) {
>     if (selectionIndices) return []; // suggest none for selection
>     if (/^(?!\w+:)/.test(txt)) txt = "http://" + txt;
>     return [CmdUtils.makeSugg(txt, null, null, .5)];
>   },
>
> };

Bhagwad

unread,
Oct 18, 2009, 7:15:40 PM10/18/09
to ubiquity-firefox
I tried to implement the new noun type, but I didn't quite know where
to put the code...

When I put it above my "CreateCommand" code, Ubiquity doesn't see it
meaning there's some syntax error somewhere...

On Oct 17, 4:28 am, satyr <murky.sa...@gmail.com> wrote:
> You'd have to write a custom noun of your own, like this:
>
> var noun_type_url_noselection = {
>   label: "URL",
>   suggest: function ntun_suggest(txt, htm, cb, selectionIndices) {
>     if (selectionIndices) return []; // suggest none for selection
>     if (/^(?!\w+:)/.test(txt)) txt = "http://" + txt;
>     return [CmdUtils.makeSugg(txt, null, null, .5)];
>   },
>
> };
Reply all
Reply to author
Forward
0 new messages