map-style-names

Repository
Git URL https://github.com/transpect/map-style-names.git
SVN URL https://github.com/transpect/map-style-names
Base URI http://transpect.io/map-style-names/

Source ⬇

css:consolidate-maps

Style maps will be consolidated such that the most specific mappings come first. If less specific mappings have the same matching pattern (2nd columns literally equal), they won’t be included. A rule (HTML tr element) may optionally have classes 'initial' or 'final'. The initial rules will be consolidated to the beginning of the consolidated map, in reverse-specificity order (most general map file first, within each file still in document order). In case of identical matching regexes, the least specific rule will win for initial classes. The class 'final' will probably be attached to specific rules. Its effect will be that these rules come after the more generic rules, in contrast to ordinary sort order. That means that they will be applied last. With final rules, the sort order is also from generic to specific files, as for initial rules. In case of matching pattern identity, the most specific rule will win.

Import

<p:import href="http://transpect.io/map-style-names/xpl/map-style-names.xpl"/>

Dependencies

Synopsis

<css:consolidate-maps xmlns:css="http://www.w3.org/1996/css">
  <p:input port="source" sequence="true" primary="true"/>
  <p:output port="result" primary="true"/>
  <p:option name="debug" required="false" select="'no'"/>
  <p:option name="debug-dir-uri" required="false" select="'debug'"/>
  <p:option name="status-dir-uri" required="false" select="'debug/status'"/>
</css:consolidate-maps>

css:apply-map

Import

<p:import href="http://transpect.io/map-style-names/xpl/map-style-names.xpl"/>

Synopsis

<css:apply-map xmlns:css="http://www.w3.org/1996/css">
  <p:input port="source" primary="true"/>
  <p:input port="rule-name-mapping-xsl"/>
  <p:input port="generating-xsl"/>
  <p:input port="map"/>
  <p:output port="result" primary="true"/>
  <p:option name="debug" required="false" select="'no'"/>
  <p:option name="debug-dir-uri" required="false" select="'debug'"/>
  <p:option name="status-dir-uri" required="false" select="'debug/status'"/>
  <p:option name="remove-border-styles" required="false" select="'no'"/>
  <p:option name="map-textbox-styles" required="false" select="'no'"/>
  <p:option name="textbox-style" required="false" select="'Textbox-Style'"/>
  <p:option name="remove-textboxes" required="false" select="'no'"/>
  <p:option name="color-mapping" select="'yes'"/>
</css:apply-map>

css:map-styles

A wrapper for the individual other steps in this library.

Here’s an explanation of the style mapping concept:

  • The tilde ('~') and the string '_-_' may be used interchangeably in both first columns. They are called “tilde metacharacters”.
  • Table rows without td will be ignored.
  • Otherwise the first td in a row needs to hold the canonical (system) style name, while the second td contains the user-defined style name that is found in the actual content and that should be mapped to the system name.
  • Both names may contain tilde metacharacters.
  • The first table in the body will be used for mapping purposes.
  • The user style name values in the second column are regular expressions. Likewise, the first column contains replacements. You may refer to matching groups by $1, $2, etc.
  • All mappings will be applied to each style, sequentially from top to bottom.
  • A given mapping instruction will first be tested against css:rule/@native-name then against css:rule/@name. If native-name matches, the replacement is taken from first column and applied to native-name. The name attribute will then be generated from the updated native-name attribute.
  • The comment column is irrelevant to the mapping process.
  • If there are multiple style maps in a configuration hierarchy, they will be merged. If the regexes (2nd columne) of two rows match, the row from the more specific map file will win (except when the table row of the more generic file has an 'initial' class, see next item.
  • There are two meaningful class attributes for the tr elements, 'initial' and 'final'. Their use case and effect is described in the documentation of css:consolidate-maps in this library.
  • The merged file will appear in the debug dir als map-style-names/consolidated-map.xhtml. It will contain provenance information in the first, all-th column, as links to the source map file for each rule.
  • It also possible to map color codes (applied on border styles or background) to style names.
  • The mapping can be expanded by using external txt files

Import

<p:import href="http://transpect.io/map-style-names/xpl/map-style-names.xpl"/>

Synopsis

<css:map-styles xmlns:css="http://www.w3.org/1996/css">
  <p:input port="source" sequence="true" primary="true"/>
  <p:input port="paths" primary="true"/>
  <p:output port="result" sequence="true" primary="true"/>
  <p:option name="debug" required="false" select="'no'"/>
  <p:option name="debug-dir-uri" required="false" select="'debug'"/>
  <p:option name="map-name" required="false" select="'styles/map.xhtml'"/>
  <p:option name="status-dir-uri" required="false" select="'debug/status'"/>
  <p:option name="remove-border-styles" required="false" select="'no'"/>
  <p:option name="map-textbox-styles" required="false" select="'no'"/>
  <p:option name="textbox-style" required="false" select="'Textbox-Style'"/>
  <p:option name="remove-textboxes" required="false" select="'no'"/>
  <p:option name="color-mapping" select="'yes'"/>
</css:map-styles>

GitHub sync date: 2024-04-23+02:00