Documentation

Lean.Data.Html.Syntax

Parsers for HTML syntax #

Helpers #

Character references #

Decodes one character reference starting at i, which must point at at the character & in s. Returns the decoded string, and the position just after ;.

Errors are reported at refAt, which should produce the subsyntax between two offsets into s.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    Decodes HTML character references in ref, leaving other characters unchanged.

    Equations
    Instances For

      Raw symbols #

      def Lean.Html.Syntax.rawSymbol (sym : String) (trailingWs : Bool := false) (expected : List String := [toString "'" ++ toString sym ++ toString "'"]) :

      Parses sym as an atom. Unlike symbol, this parser does not consult the token table, and sym is not registered as a token.

      Trailing whitespace (including Lean-style comments) is consumed and stored in the atom only if trailingWs is set; otherwise it is left to the next parser.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Interpolations #

        def Lean.Html.Syntax.interpWith (kind : SyntaxNodeKind) (openSym : String) (trailingWs : Bool) :

        Parses an interpolation: a Lean term between openSym and }. Trailing whitespace is consumed only if trailingWs is set.

        Equations
        Instances For
          Equations
          Instances For
            Equations
            Instances For
              @[reducible, inline]
              Equations
              Instances For
                @[reducible, inline]
                abbrev Lean.Html.Syntax.Interp (isMany : Bool) :
                Equations
                Instances For
                  structure Lean.Html.Syntax.InterpView (isMany : Bool) :

                  A single-element { term } or many-element {... term } interpolation.

                  • openBrace : Syntax

                    { or {....

                  • term : Term

                    The interpolated term.

                  • closeBrace : Syntax

                    }.

                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def Lean.Html.Syntax.instBEqInterpView.beq {isMany✝ : Bool} :
                      InterpView isMany✝ → InterpView isMany✝ → Bool
                      Equations
                      Instances For
                        def Lean.Html.Syntax.Interp.view {m : Type → Type} {isMany : Bool} [Monad m] [MonadError m] (stx : Interp isMany) :
                        m (InterpView isMany)
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          def Lean.Html.Syntax.InterpView.of {m : Type → Type} {isMany : Bool} [Monad m] [MonadError m] (stx : Interp isMany) :
                          m (InterpView isMany)
                          Equations
                          Instances For

                            Text content #

                            HTML text content.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              @[reducible, inline]
                              Equations
                              Instances For

                                Comments #

                                @[reducible, inline]
                                Equations
                                Instances For

                                  Text contents of an HTML comment, excluding start and end markers.

                                  Equations
                                  Instances For

                                    Tag names #

                                    An HTML tag name: an ASCII letter followed by characters other than ASCII whitespace, U+0000 NULL, /, >. This includes custom element names.

                                    Equations
                                    Instances For
                                      @[reducible, inline]
                                      Equations
                                      Instances For

                                        Attribute names #

                                        An HTML attribute name. Attribute names may not start with { (which would conflict with interpolation).

                                        Equations
                                        Instances For
                                          @[reducible, inline]
                                          Equations
                                          Instances For

                                            Attribute values #

                                            @[reducible, inline]
                                            Equations
                                            Instances For
                                              Instances For
                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For

                                                  Provides a view on the attribute value, decoding character references when the value is a string literal.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For

                                                    Attributes #

                                                    An HTML attribute. We support double-quoted attribute values <tag name="val">, empty attributes <tag name>, interpolations of one value <tag name={ term }>, and interpolations of a sequence of attributes <tag {... term }/>. Character references are decoded in double-quoted values.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      @[reducible, inline]
                                                      Equations
                                                      Instances For
                                                        Instances For
                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            Equations
                                                            Instances For
                                                              Instances For
                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For

                                                                    Elements and content #

                                                                    Content is not a syntax category because a category parser starts by reading a Lean token, which fails on text that begins with whitespace or, for example, '. Instead, contentItemFn dispatches to item parsers based on the next character.

                                                                    @[reducible, inline]
                                                                    Equations
                                                                    Instances For
                                                                      @[reducible, inline]
                                                                      Equations
                                                                      Instances For
                                                                        @[reducible, inline]

                                                                        A sequence of HTML text nodes, comments, elements, and interpolations.

                                                                        Equations
                                                                        Instances For
                                                                          Equations
                                                                          • One or more equations did not get rendered due to their size.
                                                                          Instances For
                                                                            Instances For
                                                                              Equations
                                                                              • One or more equations did not get rendered due to their size.
                                                                              Instances For
                                                                                Equations
                                                                                Instances For
                                                                                  Instances For
                                                                                    Equations
                                                                                    • One or more equations did not get rendered due to their size.
                                                                                    Instances For
                                                                                      Equations
                                                                                      Instances For
                                                                                        Equations
                                                                                        • One or more equations did not get rendered due to their size.
                                                                                        Instances For
                                                                                          Equations
                                                                                          • One or more equations did not get rendered due to their size.
                                                                                          Instances For

                                                                                            A sequence of HTML content nodes: text contents, comments, elements, single-item interpolations { term }, and many-item interpolations {... term } (see interpMany).

                                                                                            Equations
                                                                                            Instances For

                                                                                              An HTML element: <tag attr*/> or <tag attr*>content</tag>.

                                                                                              Tags must be closed: void element syntax such as <br>, and implied end tags such as <ul><li>item</ul>, are not supported.

                                                                                              Equations
                                                                                              Instances For

                                                                                                Consecutive run of text nodes and comments.

                                                                                                Instances For
                                                                                                  Equations
                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                  Instances For

                                                                                                    Returns the normalized text contents of this sequence of text nodes and comments:

                                                                                                    • Whitespace that contains a newline (U+000A or U+000D), and is not surrounded by text on both sides, is removed.

                                                                                                    • Other consecutive whitespace is collapsed into a single space (U+0020).

                                                                                                    • HTML character references are decoded into the Unicode characters they represent.

                                                                                                    Throws if an invalid character reference is encountered in the text.

                                                                                                    Equations
                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                    Instances For

                                                                                                      A syntax spanning all nodes in this view. Useful for reporting elaboration errors.

                                                                                                      Equations
                                                                                                      Instances For
                                                                                                        Instances For
                                                                                                          Equations
                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                          Instances For

                                                                                                            Returns the sequence of items in an HTML content node.

                                                                                                            Runs of text interspersed with comments are merged into a single item. This is because their text must be processed together into a single output (see TextCommentsView.getText).

                                                                                                            Equations
                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                            Instances For

                                                                                                              An HTML literal.

                                                                                                              Equations
                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                              Instances For