..
/
download
.\" Automatically generated by Pandoc 2.9.2.1
.\"
.TH "s1kd-refs" "1" "2021-04-16" "" "s1kd-tools"
.hy
.SH NAME
.PP
s1kd-refs - Manage references between CSDB objects
.SH SYNOPSIS
.IP
.nf
\f[C]
s1kd-refs [-aBCcDEFfGHIiKLlmNnoPqRrSsTUuvwXxYZ\[ha]h?] [-b <SNS>]
[-d <dir>] [-e <cmd>] [-J <ns=URL>] [-j <xpath>]
[-k <pattern>] [-t <fmt>] [-3 <file>] [<object>...]
\f[R]
.fi
.SH DESCRIPTION
.PP
The \f[I]s1kd-refs\f[R] tool lists external references in CSDB objects,
optionally matching them to a filename in the CSDB directory hierarchy.
.PP
This allows you to:
.IP \[bu] 2
obtain a list of dependencies for CSDB objects, such as ICNs, to ensure
they are delivered together
.IP \[bu] 2
check for references to objects which do not exist in the current CSDB
.IP \[bu] 2
update reference metadata, such as titles, from the matched objects
.SH OPTIONS
.TP
-a, --all
List all references, both matched and unmatched.
.TP
-B, -C, -D, -E, -G, -H, -K, -L, -P, -S, -T, -Y, -Z
List references to IPDs, comments, data modules, external publications,
ICNs, hotspots, CSNs, data management lists, publication modules, SCORM
content packages, referred fragments, repository source DMs and source
objects respectively.
If none are specified, -BCDEGHKLPSTYZ is assumed.
.RS
.PP
The following long options can also be used for each: --ipd, --com,
--dm, --epr, --icn, --hotspot, --csn, --dml, --pm, --smc, --fragment,
--repository, --source.
.RE
.TP
-b, --ipd-sns <SNS>
Specify the SNS for non-chapterized IPD data modules, in the form of
SYSTEM-SUBSYSTEM-ASSY (for example, \[dq]ZD-00-35\[dq]).
This code is used to resolve non-chapterized CSN references.
.RS
.PP
If \[dq]-\[dq] is given for <SNS>, then the SNS will be derived from
current data module.
.RE
.TP
-c, --content
List references in the \f[C]content\f[R] section of a CSDB object only.
.TP
-d, --dir <dir>
Directory to search for matches to references in.
By default, the current directory is used.
.TP
-e, --exec <cmd>
Execute a command for each referenced CSDB object matched.
The string \[dq]{}\[dq] is replaced by the current CSDB object file name
everywhere it occurs in the arguments to the command.
.TP
-F, --overwrite
When using the -U or -X options, overwrite the input objects that have
been updated or tagged.
.TP
-f, --filename
Include the filename of the source object where each reference was found
in the output.
.TP
-h, -?, --help
Show help/usage message.
.TP
-I, --update-issue
Update the issue number, issue date, language, and title of references
to that of the latest matched object.
This option implies the -U and -i options.
.TP
-i, --ignore-issue
Ignore issue info when matching.
This will always match the latest issue of an object found, regardless
of the issue specified in the reference.
.TP
-J <ns=URL>
Registers an XML namespace prefix, which can then be used in the hotspot
XPath expression (-j).
Multiple namespaces can be registered by specifying this option multiple
times.
.TP
-j <xpath>
Specify a custom XPath expression to use when matching hotspots (-H) in
XML-based ICN formats.
.TP
-k, --ipd-dcv <pattern>
Specify a pattern used to determine the disassembly code variant for IPD
data modules when resolving CSN references.
.RS
.PP
Within the pattern, the following characters have special meaning:
.IP \[bu] 2
% - The figure number variant code.
.IP \[bu] 2
?
- A wildcard that matches any single character.
.PP
The default pattern is \[dq]%\[dq], which means the disassembly code
variant is exactly the same as the figure number variant.
Projects that use a 2- or 3-character disassembly code variant must
specify a pattern of the appropriate length in order for their IPD DMs
to be matched (for example, \[dq]%?\[dq] or \[dq]%??\[dq]).
.RE
.TP
-l, --list
Treat input (stdin or arguments) as lists of filenames of CSDB objects
to list references in, rather than CSDB objects themselves.
.TP
-m, --strict-match
Be more strict when matching codes of CSDB objects to filenames.
By default, the name of a file (minus the extension) only needs to start
with the code to be matched.
When this option is specified, the name must match the code exactly.
.RS
.PP
For example, the code \[dq]ABC\[dq] will normally match either of the
files \[dq]ABC.PDF\[dq] or \[dq]ABC_1.PDF\[dq], but when strict matching
is enabled, it will only match the former.
.RE
.TP
-N, --omit-issue
Assume filenames of referenced CSDB objects omit the issue info, i.e.
they were created with the -N option to the s1kd-new* tools.
.TP
-n, --lineno
Include the filename of the source object where each reference was
found, and display the line number where the reference occurs in the
source file after its filename.
.TP
-o, --output-valid
Output valid CSDB objects to stdout.
.TP
-q, --quiet
Quiet mode.
Errors are not printed.
.TP
-R, --recursively
List references in matched objects recursively.
.TP
-r, --recursive
Search for matches to references in directories recursively.
.TP
-s, --include-src
Include the source object as a reference.
This is helpful when the output of this tool is used to apply some
operation to a source object and all its dependencies together.
.TP
-t, --format <fmt>
Specify a custom format for printed references.
<fmt> is a format string, where the following variables can be given:
.RS
.IP \[bu] 2
%file% - The filename of the referenced object (nothing is printed if no
file is matched).
.IP \[bu] 2
%line% - The line number where the reference occurs in the source.
.IP \[bu] 2
%ref% - The reference.
May be a code (if no file is matched), a file name (for objects where a
file is matched) or a file name + fragment name.
.IP \[bu] 2
%src% - The source of the reference.
.IP \[bu] 2
%xpath% - The XPath denoting where the reference occurs in the source.
.PP
For example, \f[C]-t \[aq]%src% (%line%): %ref%\[aq]\f[R] is equivalent
to the -n option.
.RE
.TP
-U, --update
Update the title of matched references from the corresponding object.
.TP
-u, --unmatched
Show only unmatched reference errors, or unmatched codes if combined
with the -a option.
.TP
-v, --verbose
Verbose output.
Specify multiple times to increase the verbosity.
.TP
-w, --where-used
Instead of listing references contained within specified objects, list
places within other objects where the specified objects are referenced.
.RS
.PP
In this case, <object> may also be a code (with the appropriate prefix)
instead of an actual file.
For example: \f[C]s1kd-refs -w DMC-TEST-A-00-00-00-00A-040A-D\f[R]
.RE
.TP
-X, --tag-unmatched
Tag unmatched references with the processing instruction
\f[C]<?unmatched?>\f[R].
.TP
-x, --xml
Output a detailed XML report instead of plain text messages.
.TP
-3, --externalpubs <file>
Use a custom \f[C].externalpubs\f[R] file.
.TP
-\[ha], --remove-deleted
List references with elements that have a change type of
\[dq]delete\[dq] removed.
.TP
--version
Show version information.
.TP
<object>...
CSDB object(s) to list references in.
If none are specified, the tool will read from stdin.
.PP
In addition, the following options allow configuration of the XML
parser:
.TP
--dtdload
Load the external DTD.
.TP
--huge
Remove any internal arbitrary parser limits.
.TP
--net
Allow network access to load external DTD and entities.
.TP
--noent
Resolve entities.
.TP
--parser-errors
Emit errors from parser.
.TP
--parser-warnings
Emit warnings from parser.
.TP
--xinclude
Do XInclude processing.
.TP
--xml-catalog <file>
Use an XML catalog when resolving entities.
Multiple catalogs may be loaded by specifying this option multiple
times.
.SS \f[C].externalpubs\f[R] file
.PP
The \f[C].externalpubs\f[R] file contains definitions of external
publication references.
This can be used to update external publication references in CSDB
objects with -U.
.PP
By default, the tool will search the current directory and parent
directories for a file named .externalpubs, but any file can be
specified by using the -e option.
.PP
Example of a \f[C].externalpubs\f[R] file:
.IP
.nf
\f[C]
<externalPubs>
<externalPubRef>
<externalPubRefIdent>
<externalPubCode>ABC</externalPubCode>
<externalPubTitle>ABC Manual</externalPubTitle>
</externalPubRefIdent>
</externalPubRef>
</externalPubs>
\f[R]
.fi
.PP
External publication references will be updated whether they are matched
to a file or not.
.SS Hotspot matching (-H)
.PP
Hotspots can be matched in XML-based ICN formats, such as SVG or X3D.
By default, matching is based on the APS ID of the hotspot and the
following attributes:
.TP
SVG
\f[C]\[at]id\f[R]
.TP
X3D
\f[C]\[at]DEF\f[R]
.PP
If hotspots are identified in a different way in a project\[aq]s ICNs, a
custom XPath expression can be specified with the -j option.
In this XPath expression, the variable \f[C]$id\f[R] represents the
hotspot APS ID:
.IP
.nf
\f[C]
$ s1kd-refs -H -j \[dq]//*[\[at]attr = $id]\[dq] <DM>
\f[R]
.fi
.SH EXIT STATUS
.TP
0
No errors, all references were matched.
.TP
1
Some references were unmatched.
.TP
2
The number of objects found in a recursive check (-R) exceeded the
available memory.
.TP
3
stdin did not contain valid XML and not in list mode (-l).
.TP
4
The non-chapterized SNS specified (-b) is not valid.
.SH EXAMPLES
.SS General
.IP
.nf
\f[C]
$ s1kd-refs DMC-EX-A-00-00-00-00A-040A-D_000-01_EN-CA.XML
DMC-EX-A-00-00-00-00A-022A-D_001-00_EN-CA.XML
DMC-EX-A-01-00-00-00A-040A-D_000-01_EN-CA.XML
ICN-12345-00001-001-01.JPG
\f[R]
.fi
.SS CSN references
.PP
These examples are based on the following CSN reference:
.IP
.nf
\f[C]
<catalogSeqNumberRef figureNumber=\[dq]01\[dq] item=\[dq]004\[dq]/>
\f[R]
.fi
.PP
in the following data module:
.IP
.nf
\f[C]
DM=DMC-EX-A-00-00-00-00AA-100A-D_001-00_EN-CA.XML
\f[R]
.fi
.PP
Because the CSN reference is not chapterized, it cannot be matched to an
IPD DM without more information:
.IP
.nf
\f[C]
$ s1kd-refs -K $DM
Unmatched reference: Fig 01 Item 004
\f[R]
.fi
.PP
The SNS for non-chapterized IPDs can be specified with -b.
In this case, the project uses the SNS \[dq]ZD-00-35\[dq] for their
IPDs:
.IP
.nf
\f[C]
$ s1kd-refs -K -b ZD-00-35 $DM
Unmatched reference: DMC-EX-A-ZD-00-35-010-941A-D Item 004
\f[R]
.fi
.PP
This project uses a 2-character disassembly code variant, so the figure
number variant is not sufficient to resolve the DMC of the referenced
IPD data module.
The -k option can be used in this case to specify the pattern for the
disassembly code variant of IPDs.
Since the second character of the disassembly code variant of all IPD
DMs in this project is A, the pattern \[dq]%A\[dq] can be used:
.IP
.nf
\f[C]
$ s1kd-refs -K -b ZD-00-35 -k %A $DM
DMC-EX-A-ZD-00-35-010A-941A-D_001-00_EN-CA.XML Item 004
\f[R]
.fi
.SH AUTHORS
khzae.net.
gopher://khzae.net/0/s1000d/s1kd-tools/src/tools/s1kd-refs/doc/s1kd-refs.1