Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

482 Manage or perform copyinstructions for media files #557

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

fsteimke
Copy link
Contributor

@fsteimke fsteimke commented Nov 6, 2024

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 imageobjects 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 (only img up to now) get an additional attribute ghost:sourcefile with the the computed absolute URI of the input data, $info?uri. A new template tp: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 URI img/@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; or
  • the current output directory, calculated from current-output-uri().

What happens with the sequence of copyinstructions depends on the availability of file:copy from EXPATH.

  • When function file:copyis available, copy operations are performed. The file at copyinstructions-uri is in fact a log file.
  • When function file:copyis not available, the file at copyinstructions-uri contains instructions which should be executed in some way independently of the stylesheets. The template t: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.

@fsteimke fsteimke force-pushed the 482-copyinstructions branch from a2fc1dd to 42d4838 Compare November 6, 2024 05:41
@fsteimke fsteimke force-pushed the 482-copyinstructions branch from 42d4838 to 4b5d91f Compare November 6, 2024 05:54
@fsteimke fsteimke force-pushed the 482-copyinstructions branch from 9214203 to 1843a58 Compare November 19, 2024 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants