Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "lib/utils"

Index

Variables

Const serialize

serialize: any = require("w3c-xmlserializer")

Functions

date_to_string

  • date_to_string(date: string): string
  • Convert an ISO formatted date to a more readable format.

    Parameters

    • date: string

      date is ISO format

    Returns string

de_xml

  • de_xml(inp: string): string
  • Remove any XML/HTML tags from the input; <br/> tags are replaced by space and all other tags are removed.

    Used when the title may include XML tags but the metadata item should not...

    Parameters

    • inp: string

      input string

    Returns string

    input string free of XML tags

remove_entities

  • remove_entities(inp: string): string
  • Filter XML entities in an xhtml code, and turn them into their equivalent hexadecimal Unicode point

    Parameters

    • inp: string

      input string

    Returns string

slice_text

  • slice_text(inp: string): string
  • “Slice” a long text into lines separated by the (HTML) <br/> tag. Used as a rudimentary tool when adding the title lines to an SVG content.

    Note that if the incoming string includes the <br/> tag already, the function returns the text unchanged. This allows the end-user to control the input, if required.

    Parameters

    • inp: string

      Input text

    Returns string

    “sliced” text

to_xhtml

  • to_xhtml(dom: JSDOM | string): string
  • Convert an HTML5 content (in text or as a DOM) into XHTML5.

    Parameters

    • dom: JSDOM | string

      the original content

    Returns string

    • Same content serialized as XHTML, with entities removed