Resolver

public final class Resolver

Class used to resolve nodes to tags based on customizable rules.

  • Rule describing how to resolve tags from regex patterns.

    See more

    Declaration

    Swift

    public struct Rule
  • The rules used by this resolver to resolve nodes to tags.

    Declaration

    Swift

    public let rules: [Rule]
  • Resolve a tag name from a given node.

    Declaration

    Swift

    public func resolveTag(of node: Node) -> Tag.Name

    Parameters

    node

    Node whose tag should be resolved.

    Return Value

    The resolved tag name.

  • Returns a Resolver constructed by appending rule.

    Declaration

    Swift

    public func appending(_ rule: Rule) -> Resolver
  • Returns a Resolver constructed by appending pattern for tag.

    Declaration

    Swift

    public func appending(_ tag: Tag.Name, _ pattern: String) throws -> Resolver
  • Returns a Resolver constructed by replacing rule.

    Declaration

    Swift

    public func replacing(_ rule: Rule) -> Resolver
  • Returns a Resolver constructed by replacing pattern for tag.

    Declaration

    Swift

    public func replacing(_ tag: Tag.Name, with pattern: String) throws -> Resolver
  • Returns a Resolver constructed by removing pattern for tag.

    Declaration

    Swift

    public func removing(_ tag: Tag.Name) -> Resolver

Defaults

  • Resolver with no rules.

    Declaration

    Swift

    public static let basic: Resolver
  • Resolver with a default set of rules.

    Declaration

    Swift

    public static let `default`: Resolver