Options
All
  • Public
  • Public/Protected
  • All
Menu

Used for parsing Locators and for creating Locator ranges.

Hierarchy

  • ILocatorFactory

Implemented by

Index

Methods

collapseRangeLocatorToEnd

  • Creates a new Locator with all selectors collapsed to their end positions. Selectors that are not representing a range are untouched.

    Parameters

    • rangeLocator: ILocator

      The locator to collapse.

    Returns ILocator

collapseRangeLocatorToStart

  • Creates a new Locator with all selectors collapsed to their start positions. Selectors that are not representing a range are untouched.

    Parameters

    • rangeLocator: ILocator

      The locator to collapse.

    Returns ILocator

createRangeLocator

  • Creates a new Locator representing the range between two Locators. The locators must share a common sourceUrl, otherwise null is returned.

    Parameters

    Returns ILocatorParseResult

getSelectorFactory

  • Get the factory used by this instance for parsing selectors.

    Returns ISelectorFactory

parse

  • Parses the given data into a new Locator by:

    • parsing an absolute URL, URI, URN or IRI (referred to as URL from now on.)
    • parsing a relative URL together with a base URL.
    • parsing an object compatible with the ILocatorData type.

    The ILocatorData is modeled after the "Resource" and "SpecificResource" types defined by the Web Annotations specification: https://www.w3.org/TR/annotation-model

    Legacy Colibrio ILegacyAnnotationTarget objects are not valid with the "External Web Resource" or "Specific Resource" types due to using "id" instead of "source" while also specifying a "selector". For backwards compatibility, these object can still be used with this method. If the ILegacyAnnotationTarget does not have an "id", you must provide a baseUrl.

    NOTE: JSON-LD processing is NOT supported. Ensure that the data passed to this method is compatible with the IWebAnnotationResourceData or IWebAnnotationSpecificResourceData type.

    NOTE: Specifying both the 'selector' property AND a fragment part in 'source' is strongly discouraged as this behaviour is not fully defined in the Web Annotations spec. Colibrio's behavior is to treat 'selector' as refinement selectors on the fragment selector.

    Selectors that cannot be parsed by the selector factory will be dropped.

    Parameters

    • data: ILocator | ILocatorData

      The data to parse into a Locator.

    • Optional baseUrl: string | URL

      The base URL to use if data is a relative URL, otherwise this parameter is unused.

    Returns ILocatorParseResult

    An object with a new Locator instance or the error that caused the parse to fail.

Generated using TypeDoc