Skip to content

Instantly share code, notes, and snippets.

@tomasnorre
Created June 10, 2020 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomasnorre/6c2da11d33510c4a7fa36c28b863d6d1 to your computer and use it in GitHub Desktop.
Save tomasnorre/6c2da11d33510c4a7fa36c28b863d6d1 to your computer and use it in GitHub Desktop.
scroll-to attribute
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