Translate metadata to field content
ambassador at fourthworld.com
Mon Feb 17 16:59:33 EST 2020
J. Landman Gay wrote:
> I'm still working on htmltext in a field. There are anchors that indicate positions elsewhere
> in the file. A browser will automatically find and scroll to the right place in the text. I
> need to reproduce that.
> Is there a way to translate an anchor like "#12345" to the location in the visible field text
> it links to?
> I've thought of a couple of alternate ways to do it involving lookup files, but it would be
> better to do a direct translation to avoid the extra overhead.
The closest I have doesn't account for softwraps, but FWIW:
function fwAnchorTagLine pFldObj, pTag
put the styledText of pFldObj into tA
put item 2 of extents(tA) into tLastLine
repeat with i = 1 to tLastLine
put item 2 of extents(tA[i]["runs"]) into tNumRuns
repeat with j = 1 to tNumRuns
if pTag is in tA[i]["runs"][j]["style"]["linkText"] \
AND "link" is not in \
Fourth World Systems
Software Design and Development for the Desktop, Mobile, and the Web
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode