Options
All
  • Public
  • Public/Protected
  • All
Menu

Contains various validation and correction methods to repair broken EPUB CFIs.

Index

Functions

addExplicitCharacterOffsets

  • Adds explicit character offsets to paths that end with a TextStep

    Parameters

    Returns boolean

    true if AST was modified, false otherwise

checkEmptyParentPathAndRangeEnd

  • checkEmptyParentPathAndRangeEnd(rootNode: IEpubCfiRootNode, skipErrorReporting?: boolean): boolean
  • Check that parentPath is not missing or empty. Checks that rangeEnd is set if rangeStart is set.

    Parameters

    Returns boolean

    true if AST was modified, false otherwise

expandEmptyIndirectionLocalPaths

  • expandEmptyIndirectionLocalPaths(rootNode: IEpubCfiRootNode, skipErrorReporting?: boolean): boolean
  • EpubCFI spec does not allow paths ending with !, like: epubcfi(/6/4!) and epubcfi(/6/4!/4/2!,/0,/6) Fix those by converting it to: epubcfi(/6/4!/0) and epubcfi(/6/4!/4/2,!/0,!/6)

    This method does not touch indirections that is immediately followed by an offset.

    Parameters

    Returns boolean

    true if AST was modified, false otherwise

removeEmptyIndirectionBeforeOffsets

  • removeEmptyIndirectionBeforeOffsets(rootNode: IEpubCfiRootNode, skipErrorReporting?: boolean): boolean
  • EpubCFI grammar allows for indirections before offsets but does not really specify what it should be used for. Remove indirections from those offsets

    Parameters

    Returns boolean

    true if AST was modified, false otherwise

removeIncompatibleRangeOffsets

  • removeIncompatibleRangeOffsets(rootNode: IEpubCfiRootNode, skipErrorReporting?: boolean): boolean
  • Removes rangeStart and rangeEnd offsets if their type is incompatible

    Parameters

    Returns boolean

    true if AST was modified, false otherwise

removeInitialIndirectionFromParentPath

  • removeInitialIndirectionFromParentPath(rootNode: IEpubCfiRootNode, skipErrorReporting?: boolean): boolean
  • Removes any initial indirection from parent path if set, like epubcfi(!/6/4....)

    Parameters

    Returns boolean

    true if AST was modified, false otherwise

removeInvalidRangeAfterParentPathOffset

  • removeInvalidRangeAfterParentPathOffset(rootNode: IEpubCfiRootNode, skipErrorReporting?: boolean): boolean
  • Remove local paths and offsets from rangeStart and rangeEnd if it is incompatible with parentPath offset.

    Parameters

    Returns boolean

    true if AST was modified, false otherwise

removeStepsAfterTextSteps

  • removeStepsAfterTextSteps(rootNode: IEpubCfiRootNode, skipErrorReporting?: boolean): boolean
  • Cut away all nodes that occur after text steps. If the parentPath is modified by this action, rangeStart and rangeEnd will be set to null.

    Parameters

    Returns boolean

    true if AST was modified, false otherwise

runAllValidations

  • runAllValidations(rootNode: IEpubCfiRootNode, skipErrorReporting?: boolean): boolean
  • Run all epubcfi validations

    Parameters

    Returns boolean

    true if AST was modified, false otherwise

Generated using TypeDoc