Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.d.ts 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. // TypeScript Version: 3.4
  2. declare namespace parseEntities {
  3. interface ParseEntitiesOptions<
  4. WC = typeof globalThis,
  5. TC = typeof globalThis,
  6. RC = typeof globalThis
  7. > {
  8. /**
  9. * Additional character to accept (`string?`, default: `''`).
  10. * This allows other characters, without error, when following an ampersand.
  11. */
  12. additional: string
  13. /**
  14. * Whether to parse `value` as an attribute value (`boolean?`, default: `false`).
  15. */
  16. attribute: boolean
  17. /**
  18. * Whether to allow non-terminated entities (`boolean`, default: `true`).
  19. * For example, `&copycat` for `©cat`. This behaviour is spec-compliant but can lead to unexpected results.
  20. */
  21. nonTerminated: boolean
  22. /**
  23. * Error handler (`Function?`).
  24. */
  25. warning: ErrorHandler<WC>
  26. /**
  27. * Text handler (`Function?`).
  28. */
  29. text: TextHandler<TC>
  30. /**
  31. * Reference handler (`Function?`).
  32. */
  33. reference: ReferenceHandler<RC>
  34. /**
  35. * Context used when invoking `warning` (`'*'`, optional).
  36. */
  37. warningContext: WC
  38. /**
  39. * Context used when invoking `text` (`'*'`, optional).
  40. */
  41. textContext: TC
  42. /**
  43. * Context used when invoking `reference` (`'*'`, optional)
  44. */
  45. referenceContext: RC
  46. /**
  47. * Starting `position` of `value` (`Location` or `Position`, optional). Useful when dealing with values nested in some sort of syntax tree.
  48. */
  49. position: Position
  50. }
  51. /**
  52. * Error handler.
  53. */
  54. type ErrorHandler<C> = (
  55. /**
  56. * `this` refers to `warningContext` when given to `parseEntities`.
  57. */
  58. this: C,
  59. /**
  60. * Human-readable reason for triggering a parse error (`string`).
  61. */
  62. reason: string,
  63. /**
  64. * Place at which the parse error occurred (`Position`).
  65. */
  66. position: Position,
  67. /**
  68. * Identifier of reason for triggering a parse error (`number`).
  69. */
  70. code: number
  71. ) => void
  72. /**
  73. * Text handler.
  74. */
  75. type TextHandler<C> = (
  76. /**
  77. * `this` refers to `textContext` when given to `parseEntities`.
  78. */
  79. this: C,
  80. /**
  81. * String of content (`string`).
  82. */
  83. value: string,
  84. /**
  85. * Location at which `value` starts and ends (`Location`).
  86. */
  87. location: Location
  88. ) => void
  89. /**
  90. * Character reference handler.
  91. */
  92. type ReferenceHandler<C> = (
  93. /**
  94. * `this` refers to `textContext` when given to `parseEntities`.
  95. */
  96. this: C,
  97. /**
  98. * String of content (`string`).
  99. */
  100. value: string,
  101. /**
  102. * Location at which `value` starts and ends (`Location`).
  103. */
  104. location: Location,
  105. /**
  106. * Source of character reference (`Location`).
  107. */
  108. source: Location
  109. ) => void
  110. interface Position {
  111. line: number
  112. column: number
  113. offset: number
  114. indent?: number[]
  115. }
  116. interface Location {
  117. start: Position
  118. end: Position
  119. }
  120. }
  121. /**
  122. * Decode special characters in `value`.
  123. */
  124. declare function parseEntities<
  125. WC = typeof globalThis,
  126. TC = typeof globalThis,
  127. RC = typeof globalThis
  128. >(
  129. value: string,
  130. options?: Partial<parseEntities.ParseEntitiesOptions<WC, TC, RC>>
  131. ): string
  132. export = parseEntities