Media
in package
implements
NodeRule
FinalYes
Media files by the 7.0 types:
- FORM, a file extension in 5.5.1, becomes a media type: known extensions their registered
type (jpg → image/jpeg, wav → audio/wav), others application/x-
, as gedcom7code does (other → application/x-other); a value that already is a media type stays; - FILE becomes a URL or a relative path with "/" separators: /x → file:///x, c:\x → file:///c:/x, \server\x → file://server/x, a\b → a/b; spaces, "%" (but in a percent-encoding: a%C3%AB stays, as 7.0 → 5.5.1 writes it), "?", "#", "[", "]" and characters a URL cannot hold are percent-encoded, as is ":" in the first segment of a relative path (https:/x is not a URL). A URL of ftp, http or https only has spaces and such characters encoded, a file: URL its backslashes turned into "/" too (file://C:\x → file:///C:/x); ".." stays, though 7.0 does not allow it. A URI of another scheme (mailto:, urn:isbn:), which 7.0 FILE does not support, is an extension, _FILE (KL3001).
Table of Contents
Interfaces
- NodeRule
- A rule for one structure at a time. Rules that look at every line of a record are grouped in {@see Rule\Nodes}, which walks each record once for all of them.
Methods
- extensions() : array<int, string>
- mediaType() : string
- needsPrepass() : bool
- Whether the rule needs Context::prepass(): facts about the whole input before the first record.
- node() : bool
- Converts one structure (a record or a substructure; never a CONC/CONT line) with one of the rule's tags, as the structure is tagged when the walk reaches it, in place. Its substructures are visited after it, as they are when this returns.
- tags() : array<int, string>|null
- url() : string
Methods
extensions()
public
extensions(string $type) : array<int, string>
Parameters
- $type : string
Return values
array<int, string> —the file extensions of a media type ("image/jpeg" → jpeg, jpg)
mediaType()
public
mediaType(string $value) : string
Parameters
- $value : string
Return values
stringneedsPrepass()
Whether the rule needs Context::prepass(): facts about the whole input before the first record.
public
needsPrepass() : bool
Return values
boolnode()
Converts one structure (a record or a substructure; never a CONC/CONT line) with one of the rule's tags, as the structure is tagged when the walk reaches it, in place. Its substructures are visited after it, as they are when this returns.
public
node(Document $document, int $id, Context $context) : bool
Parameters
Return values
bool —false when the rule removed the structure: the rules after it and its substructures are skipped
tags()
public
tags() : array<int, string>|null
Return values
array<int, string>|null —the tags of the structures the rule converts; null for every structure
url()
public
url(string $value) : string
Parameters
- $value : string