482 Manage or perform copyinstructions for media files #557
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because handling of media files can be difficult, the stylesheets offer two levels of support, depending on environment. In this PR the support is implemented for
imageobject
s only, but the same principle can be applied to other mediaobjects as well.An explicit request is required by setting the new parameter
$copyinstructions-uri
to a valid file path. The HTML elements that correspond to a DocBook mediaobject (onlyimg
up to now) get an additional attributeghost:sourcefile
with the the computed absolute URI of the input data,$info?uri
. A new templatetp:mediaobjects-copyinstructions
is called with a sequence of all HTML elements which contain this attribute. It computes the absolute URI of the copy destination by resolving the relative URIimg/@src
against the the mediaobjects base directory which is$v:mediaobject-output-base-uri
when set; or$vp:chunk-output-base-uri
when chunk is requested; orcurrent-output-uri()
.What happens with the sequence of copyinstructions depends on the availability of
file:copy
from EXPATH.file:copy
is available, copy operations are performed. The file atcopyinstructions-uri
is in fact a log file.file:copy
is not available, the file atcopyinstructions-uri
contains instructions which should be executed in some way independently of the stylesheets. The templatet:write-copyinstructions
is responsible for writing the file. It can be customized to generate a batch file in UNIX® or Windows style.The last step is to remove all attributes in the
ghost
namespace from HTML result.