Created
June 10, 2020 12:26
-
-
Save tomasnorre/6c2da11d33510c4a7fa36c28b863d6d1 to your computer and use it in GitHub Desktop.
scroll-to attribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lib.parseFunc_RTE { | |
tags.a { | |
# Add scroll-to directive to anchor links on the current page | |
# * href uses the linkhandler t3:// URL scheme, with page and anchor id separated by "#", e.g. t3://page?uid=283287#6613007 | |
# * when splitting the href by "#", the second list item contains the target anchor id | |
# * the if.equals block extracts the target page uid from the link and compares it to the page id being processed | |
# * By using append.required = 1, the scroll-to directive will only be added if the stdWrap returns an anchor id | |
typolink.ATagParams.append = TEXT | |
typolink.ATagParams.append { | |
stdWrap { | |
data = parameters:href | |
split.token = # | |
split.returnKey = 1 | |
if.value.data = page:uid | |
if.equals.stdWrap { | |
data = parameters:href | |
split.token = = | |
split.returnKey = 1 | |
listNum = 0 | |
listNum.splitChar = # | |
} | |
intval = 1 | |
} | |
required = 1 | |
noTrimWrap = | scroll-to="|"| | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment