Last change
on this file since 5800 was 5800, checked in by cs025, 21 years ago |
Adding gs3build
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1004 bytes
|
Line | |
---|
1 | package org.greenstone.gsdl3.gs3build.util;
|
---|
2 |
|
---|
3 | public class HTMLLocalAnchor
|
---|
4 | {
|
---|
5 | public static int anchorRef(HTMLBlockList anchors, String name)
|
---|
6 | { int loop;
|
---|
7 | String idvalue;
|
---|
8 |
|
---|
9 | for (loop = 0; loop < anchors.size(); loop ++)
|
---|
10 | { idvalue = anchors.tagBlock(loop).headTag().idValue("name");
|
---|
11 | if (idvalue != null && idvalue.equalsIgnoreCase(name)) //TODO: check if this should be case senstitive
|
---|
12 | { return loop;
|
---|
13 | }
|
---|
14 | }
|
---|
15 | return -1;
|
---|
16 | }
|
---|
17 |
|
---|
18 | public static int header(HTMLDoc doc, String local)
|
---|
19 | { HTMLBlockList anchors;
|
---|
20 | int heading;
|
---|
21 | HTMLBlock headingblock;
|
---|
22 | int anchor;
|
---|
23 | HTMLBlock anchorblock;
|
---|
24 |
|
---|
25 | anchors = HTMLBlockList.anchorlist(doc);
|
---|
26 | anchor = anchorRef(anchors, local);
|
---|
27 | if (anchor < 0)
|
---|
28 | { return -1;
|
---|
29 | }
|
---|
30 |
|
---|
31 | anchorblock = anchors.tagBlock(anchor);
|
---|
32 | for (heading = 0; heading < doc.headerBlocks().size(); heading ++)
|
---|
33 | { headingblock = doc.headerBlocks().tagBlock(heading);
|
---|
34 |
|
---|
35 | if (headingblock.startPos() > anchorblock.endPos())
|
---|
36 | { break;
|
---|
37 | }
|
---|
38 | }
|
---|
39 | return heading - 1;
|
---|
40 | }
|
---|
41 |
|
---|
42 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.