Make highlight script path relative
This commit is contained in:
@ -304,15 +304,15 @@ extension Element {
|
||||
}
|
||||
|
||||
/**
|
||||
Create a relative link to another page in the tree.
|
||||
- Parameter pageUrl: The full page url of the target page, including localization
|
||||
- Returns: The relative url from a localized page of the element to the target page.
|
||||
Create a relative link to another file in the tree.
|
||||
- Parameter file: The full path of the target file, including localization
|
||||
- Returns: The relative url from a localized page of the element to the target file.
|
||||
*/
|
||||
func relativePathToOtherSiteElement(pageUrl: String) -> String {
|
||||
func relativePathToOtherSiteElement(file: String) -> String {
|
||||
// Note: The element `path` is missing the last component
|
||||
// i.e. travel/alps instead of travel/alps/en.html
|
||||
let ownParts = path.components(separatedBy: "/")
|
||||
let pageParts = pageUrl.components(separatedBy: "/")
|
||||
let pageParts = file.components(separatedBy: "/")
|
||||
|
||||
// Find the common elements of the path, which can be discarded
|
||||
var index = 0
|
||||
|
Reference in New Issue
Block a user