-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Amend relative URLs for PDF processing
- Loading branch information
Showing
3 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* This file is part of the DITA Passthrough Plug-in project. | ||
* See the accompanying LICENSE file for applicable licenses. | ||
*/ | ||
|
||
// | ||
// Converts a value to relative path | ||
// | ||
// @param path - The relative path of the file | ||
// @param href - The relative path of the image | ||
// | ||
|
||
var path = attributes.get("path"); | ||
var href = attributes.get("href"); | ||
|
||
var hrefElements = href.split('/'); | ||
var pathElements = path.split('/'); | ||
var fullPath = []; | ||
|
||
for each (var elem in pathElements) { | ||
if (elem !== ''){ | ||
fullPath.push(elem) | ||
} | ||
} | ||
|
||
|
||
for each (var elem in hrefElements) { | ||
if (elem === ''){ | ||
} else if (elem === '..'){ | ||
fullPath.pop() | ||
} else { | ||
fullPath.push(elem) | ||
} | ||
} | ||
|
||
project.setProperty(attributes.get("to"), fullPath.join('/')); |
This file contains 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
File renamed without changes.