Quick follow up - I was working with Watexy, which replaces text with LaTex rendered images of the same text (you surround the string to be replaced with $$), and it looks like images may take up 0 character "spaces." If you experiment with the Watexy bot, you'll find that if you replace 2 separate equations in a single line of text, one of them - the first - will work properly, and the second will not. However, if you count the length of the _text_ in each, the difference comes out to the total length of the replaced text..
The text I used to test was the 34 character string: Testing $$10x2=20$$ and $$3^2 = 9$$ When modified by Watexy, you get 12 characters of text, with the images inserted where noted. Testing (Image) a(Image)9$$ The total length of the text replaced by Watexy is 22 characters, which means - if I've got my head on straight - the two images take up no string space. Thus, your offset would be based solely on the length of the URL's being replaced, and doesn't have to account for the size of the image. Hope a) I got that right, and b) it helps! On Oct 15, 10:37 am, "Chris C." <[email protected]> wrote: > I have no idea. Images may count as one "character" position, but I'm > not sure. You could experiment on that basis, and just subtract from > the start point of each match the cumulative length of all previous > matches, and see if that works. I basically had to mess with numbers > and offsets (and do manual counting of characters to see how things > moved) to get it right for my robot. > > I think that one of the things that would be most helpful - especially > for me, as an amateur, but probably for everyone - is more clarity on > what kind of content is being seen. I know that we only want to work > through the interfaces provided - and that Wave is changing under the > hood all the time - but some more information on document structure, > annotation capabilities, available markup, etc. would be a great > resource. > > On Oct 15, 3:56 am, Chris Searle <[email protected]> wrote: > > > > > On Oct 14, 4:46 pm, "Chris C." <[email protected]> wrote: > > > > I was going to suggest an offset variable, but as you say, it appears > > > that the subsequent regex search is on the just-updated text. I'm not > > > sure what the issue is (I have a dice rolling bot that uses regex and > > > inserts results after the relevant dice expression, and I use an > > > offset variable to adjust the insertion points by an amount equal to > > > the length of what was inserted on the previous iteration). Perhaps > > > there's a mutability issue with doc.getText()? I use Java, so I don't > > > know how that works. > > > I could try this - but - how much offset is an image? > > > It seems a little strange to me - but - then I feel a little unclear > > about the blip's document structure. What is the result of getText() > > when the blip contains media for example. The same applies to knowing > > what formatting you can add (want to have a nice title, the image and > > a couple of links - one to the image page one to the image license - > > but I don't yet know how to apply this kind of formatting > > programatically). > > > I could do the "get all matches in list, reverse it and then apply" - > > but that seems less elegant. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~----------~----~----~----~------~----~------~--~---
