1HTMLDocument.addInlineElementAKta(y3akamyoad)uleHrTeMfLeDroecnucmeent.addInlineElementAt(3kaya)
2
3
4

NAME

6       HTMLDocument::addInlineElementAt - Wrap existing text in an inline ele‐
7       ment
8

SYNOPSIS

10       ElementTree  addInlineElementAt(   ElementTree   block,   InlineElement
11       inline, Int startpos, Int endpos )
12

ARGUMENTS

14       block The element to add to
15
16       inline The inline element to add
17
18       startpos The start position for the inline element
19
20       endpos The end position for the inline element
21

DESCRIPTION

23       Encloses  existing text within an element within an inline element. The
24       characters from startpos to endpos inclusive (with a starting index  of
25       zero) will be included in the inline element.
26
27
28    p = addParagraph(parent,"abcdefghijklmnopqrstuvwxyz");
29    void(addInlineElementAt(p,Emphasis,5,10));
30    void(addInlineElementAt(p,StrongEmphasis,6,8));
31    // <p>abcde<em>f<strong>ghi</strong>jk</em>lmnopqrstuvwxyz</p>
32
33       An  HTMLDocument.InvalidNesting (3kaya) Exception will be thrown if the
34       element being added to cannot contain inline elements, or an impossible
35       nesting   situation  would  be  created.  An  HTMLDocument.InvalidRange
36       (3kaya) Exception will be thrown if the startpos or endpos are  outside
37       the text contents of the block.
38
39
40    p = addParagraph(parent,"abcdefghijklmnopqrstuvwxyz");
41    void(addInlineElementAt(p,Emphasis,5,10));
42    void(addInlineElementAt(p,StrongEmphasis,6,15));
43    // exception thrown
44
45       The  firstOccurs  function is useful for highlighting a particular word
46       within a string.
47
48
49    haystack = getAllText(element);
50    npos = firstOccurs(needle,haystack);
51    if (npos < length(haystack)) {
52        try {
53            added =  addInlineElementAt(element,Emphasis,npos,npos+length(nee‐
54   dle)+1);
55        } catch(InvalidNesting(details)) {
56            // probably overlapping elements
57        }
58    }
59

AUTHORS

61       Kaya   standard  library  by  Edwin  Brady,  Chris  Morris  and  others
62       (kaya@kayalang.org). For further information see http://kayalang.org/
63

LICENSE

65       The Kaya standard library is free software;  you  can  redistribute  it
66       and/or  modify  it  under  the  terms  of the GNU Lesser General Public
67       License (version 2.1 or any later version) as  published  by  the  Free
68       Software Foundation.
69
71       HTMLDocument.InlineElement (3kaya)
72       HTMLDocument.appendInlineElement (3kaya)
73       Strings.firstOccurs_1 (3kaya)
74
75
76
77Kaya                             DecemberHT2M0L1D0ocument.addInlineElementAt(3kaya)
Impressum