├── .formatter.exs ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── lib └── easyhtml.ex ├── mix.exs ├── mix.lock └── test ├── easyhtml_test.exs └── test_helper.exs /.formatter.exs: -------------------------------------------------------------------------------- 1 | # Used by "mix format" 2 | [ 3 | inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] 4 | ] 5 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | pull_request: 4 | push: 5 | branches: 6 | - main 7 | jobs: 8 | test: 9 | runs-on: ubuntu-20.04 10 | env: 11 | MIX_ENV: test 12 | strategy: 13 | fail-fast: false 14 | matrix: 15 | include: 16 | - pair: 17 | elixir: "1.15" 18 | otp: "24.3.4.10" 19 | - pair: 20 | elixir: "1.16.0-rc.0" 21 | otp: "26.1.2" 22 | lint: lint 23 | steps: 24 | - uses: actions/checkout@v3 25 | 26 | - uses: erlef/setup-beam@main 27 | with: 28 | otp-version: ${{ matrix.pair.otp }} 29 | elixir-version: ${{ matrix.pair.elixir }} 30 | version-type: strict 31 | 32 | - uses: actions/cache@v3 33 | with: 34 | path: deps 35 | key: mix-deps-${{ hashFiles('**/mix.lock') }} 36 | 37 | - run: mix deps.get 38 | 39 | - run: mix format --check-formatted 40 | if: ${{ matrix.lint }} 41 | 42 | - run: mix deps.unlock --check-unused 43 | if: ${{ matrix.lint }} 44 | 45 | - run: mix deps.compile 46 | 47 | - run: mix compile --no-optional-deps --warnings-as-errors 48 | if: ${{ matrix.lint }} 49 | 50 | - run: mix test --slowest 5 51 | if: ${{ ! matrix.lint }} 52 | 53 | - run: mix test --slowest 5 --warnings-as-errors 54 | if: ${{ matrix.lint }} 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # The directory Mix will write compiled artifacts to. 2 | /_build/ 3 | 4 | # If you run "mix test --cover", coverage assets end up here. 5 | /cover/ 6 | 7 | # The directory Mix downloads your dependencies sources to. 8 | /deps/ 9 | 10 | # Where third-party dependencies like ExDoc output generated docs. 11 | /doc/ 12 | 13 | # Ignore .fetch files in case you like to edit your project deps locally. 14 | /.fetch 15 | 16 | # If the VM crashes, it generates a dump, let's ignore it too. 17 | erl_crash.dump 18 | 19 | # Also ignore archive artifacts (built via "mix archive.build"). 20 | *.ez 21 | 22 | # Ignore package tarball (built via "mix hex.build"). 23 | easyhtml-*.tar 24 | 25 | # Temporary files, for example, from tests. 26 | /tmp/ 27 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | 3 | ## v0.3.1 (2023-12-11) 4 | 5 | * Make comparisons work for nested tags 6 | 7 | ## v0.3.0 (2023-06-01) 8 | 9 | * Add `~HTML` sigil 10 | 11 | ## v0.2.0 (2023-05-19) 12 | 13 | * `doc[selector]` now returns `nil` if no nodes were found. 14 | 15 | ## v0.1.1 (2022-12-22) 16 | 17 | * Relax Floki dependency. 18 | 19 | ## v0.1.0 (2022-08-24) 20 | 21 | * Initial release. 22 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2022 Wojtek Mach 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EasyHTML 2 | 3 | [](https://hex.pm/packages/easyhtml) 4 | [](https://github.com/wojtekmach/easyhtml/actions/workflows/ci.yml) 5 | 6 | EasyHTML makes working with HTML easy. 7 | 8 | It is a tiny wrapper around [Floki](https://hex.pm/packages/floki) that adds conveniences: 9 | 10 | * An `Inspect` implementation to pretty-print them 11 | * An `Access` implementation to search them 12 | * An `Enumerable` implementation to traverse them 13 | * A `String.Chars` implementation to convert them to text 14 | 15 | ## Usage 16 | 17 | ```elixir 18 | Mix.install([ 19 | {:easyhtml, "~> 0.3.0"} 20 | ]) 21 | 22 | doc = EasyHTML.parse!("
Hello, world!
") 23 | #=> ~HTML[Hello, world!
] 24 | 25 | doc["em"] 26 | #=> ~HTML[world] 27 | 28 | to_string(doc) 29 | #=> "Hello, world!" 30 | 31 | import EasyHTML, only: :sigils 32 | doc = ~HTML[Hello, world!
") 15 | ~HTML[Hello, world!
] 16 | iex> doc["em"] 17 | ~HTML[world] 18 | iex> to_string(doc) 19 | "Hello, world!" 20 | 21 | iex> import EasyHTML, only: :sigils 22 | iex> doc = ~HTML[Hello, World!
] 35 | """ 36 | defmacro sigil_HTML(string, modifiers) 37 | 38 | defmacro sigil_HTML({:<<>>, _, [binary]}, []) do 39 | Macro.escape(parse!(binary)) 40 | end 41 | 42 | @doc """ 43 | Parses a string into an EasyHTML struct. 44 | 45 | ## Examples 46 | 47 | iex> EasyHTML.parse!("Hello, World!
") 48 | ~HTML[Hello, World!
] 49 | """ 50 | def parse!(html) do 51 | %__MODULE__{nodes: Floki.parse_document!(html, attributes_as_maps: true)} 52 | end 53 | 54 | @doc false 55 | def fetch(%__MODULE__{} = struct, selector) when is_binary(selector) do 56 | case Floki.find(struct.nodes, selector) do 57 | [] -> :error 58 | nodes -> {:ok, %__MODULE__{nodes: nodes}} 59 | end 60 | end 61 | 62 | @doc """ 63 | Extracts text from the EasyHTML struct. 64 | 65 | ## Examples 66 | 67 | iex> EasyHTML.to_string(~HTML[Hello, World!
]) 68 | "Hello, World!" 69 | """ 70 | def to_string(%__MODULE__{} = struct) do 71 | Floki.text(struct.nodes) 72 | end 73 | end 74 | 75 | defimpl Inspect, for: EasyHTML do 76 | import Inspect.Algebra 77 | 78 | def inspect(struct, opts) do 79 | open = "~HTML[" 80 | close = "]" 81 | container_opts = [separator: "", break: :flex] 82 | container_doc(open, struct.nodes, close, opts, &fun/2, container_opts) 83 | end 84 | 85 | defp fun({tag, attributes, content}, opts) do 86 | tag_color = :map 87 | attribute_color = :map 88 | 89 | attributes = 90 | for {name, value} <- attributes do 91 | concat([ 92 | color(" #{name}=", attribute_color, opts), 93 | color("\"#{value}\"", :string, opts) 94 | ]) 95 | end 96 | |> concat() 97 | 98 | open = 99 | concat([ 100 | color("<#{tag}", tag_color, opts), 101 | attributes, 102 | color(">", tag_color, opts) 103 | ]) 104 | 105 | close = color("#{tag}>", tag_color, opts) 106 | container_opts = [separator: "", break: :strict] 107 | container_doc(open, content, close, opts, &fun/2, container_opts) 108 | end 109 | 110 | defp fun({:comment, content}, opts) do 111 | color("", :comment, opts) 112 | end 113 | 114 | defp fun(string, opts) when is_binary(string) do 115 | color(string, :string, opts) 116 | end 117 | 118 | defp fun(other, _opts) do 119 | raise inspect(other) 120 | end 121 | end 122 | 123 | defimpl String.Chars, for: EasyHTML do 124 | def to_string(struct) do 125 | Floki.text(struct.nodes) 126 | end 127 | end 128 | 129 | defimpl Enumerable, for: EasyHTML do 130 | def count(_), do: {:error, __MODULE__} 131 | def member?(_, _), do: {:error, __MODULE__} 132 | def slice(_), do: {:error, __MODULE__} 133 | 134 | def reduce(%EasyHTML{nodes: nodes}, acc, fun) do 135 | do_reduce(nodes, acc, fun) 136 | end 137 | 138 | def do_reduce(_list, {:halt, acc}, _fun) do 139 | {:halted, acc} 140 | end 141 | 142 | def do_reduce([], {:cont, acc}, _fun) do 143 | {:done, acc} 144 | end 145 | 146 | def do_reduce([node | rest], {:cont, acc}, fun) do 147 | do_reduce(rest, fun.(%EasyHTML{nodes: [node]}, acc), fun) 148 | end 149 | end 150 | -------------------------------------------------------------------------------- /mix.exs: -------------------------------------------------------------------------------- 1 | defmodule EasyHTML.MixProject do 2 | use Mix.Project 3 | 4 | def project do 5 | [ 6 | app: :easyhtml, 7 | version: "0.3.2", 8 | elixir: "~> 1.12", 9 | start_permanent: Mix.env() == :prod, 10 | deps: deps(), 11 | docs: [ 12 | main: "readme", 13 | extras: ["README.md", "CHANGELOG.md"] 14 | ], 15 | package: [ 16 | description: "EasyHTML makes working with HTML easy.", 17 | licenses: ["Apache-2.0"], 18 | links: %{ 19 | "GitHub" => "https://github.com/wojtekmach/easyhtml" 20 | } 21 | ] 22 | ] 23 | end 24 | 25 | def cli do 26 | [ 27 | preferred_envs: [ 28 | docs: :docs, 29 | "hex.publish": :docs 30 | ] 31 | ] 32 | end 33 | 34 | def application do 35 | [ 36 | extra_applications: [:logger] 37 | ] 38 | end 39 | 40 | defp deps do 41 | [ 42 | {:floki, "~> 0.35"}, 43 | {:ex_doc, ">= 0.0.0", only: :docs} 44 | ] 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /mix.lock: -------------------------------------------------------------------------------- 1 | %{ 2 | "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, 3 | "ex_doc": {:hex, :ex_doc, "0.31.1", "8a2355ac42b1cc7b2379da9e40243f2670143721dd50748bf6c3b1184dae2089", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "3178c3a407c557d8343479e1ff117a96fd31bafe52a039079593fb0524ef61b0"}, 4 | "floki": {:hex, :floki, "0.36.0", "544d5dd8a3107f660633226b5805e47c2ac1fabd782fae86e3b22b02849b20f9", [:mix], [], "hexpm", "ab1ca4b1efb0db00df9a8e726524e2c85be88cf65ac092669186e1674d34d74c"}, 5 | "makeup": {:hex, :makeup, "1.1.1", "fa0bc768698053b2b3869fa8a62616501ff9d11a562f3ce39580d60860c3a55e", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5dc62fbdd0de44de194898b6710692490be74baa02d9d108bc29f007783b0b48"}, 6 | "makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"}, 7 | "makeup_erlang": {:hex, :makeup_erlang, "0.1.5", "e0ff5a7c708dda34311f7522a8758e23bfcd7d8d8068dc312b5eb41c6fd76eba", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "94d2e986428585a21516d7d7149781480013c56e30c6a233534bedf38867a59a"}, 8 | "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, 9 | } 10 | -------------------------------------------------------------------------------- /test/easyhtml_test.exs: -------------------------------------------------------------------------------- 1 | defmodule EasyHTMLTest do 2 | use ExUnit.Case, async: true 3 | import EasyHTML, only: [sigil_HTML: 2] 4 | doctest EasyHTML 5 | 6 | test "it works" do 7 | html = ~HTML""" 8 | 9 | 10 | 11 |Hello, World!
12 | 13 | 14 | """ 15 | 16 | assert inspect(html) == 17 | ~s|~HTML[Hello, World!
]| 18 | 19 | assert inspect(html["p.headline"]) == 20 | ~s|~HTML[Hello, World!
]| 21 | 22 | assert ~HTML[Hello, World!
] = html["p.headline"] 23 | assert ~HTML[Hello, World!
] = html["p.headline"] 24 | 25 | refute html["#bad"] 26 | 27 | assert to_string(html) == "Hello, World!" 28 | end 29 | 30 | test "nested attributes work" do 31 | html = ~HTML""" 32 | 33 | 34 | 35 |Hello, World!
36 | 37 | 38 | """ 39 | 40 | assert inspect(html) == 41 | ~s|~HTML[Hello, World!
]| 42 | 43 | assert inspect(html["p.headline"]) == 44 | ~s|~HTML[Hello, World!
]| 45 | 46 | assert ~HTML[Hello, World!
] = 47 | html["p.headline"] 48 | 49 | assert ~HTML[Hello, World!
] = html["p.headline"] 50 | 51 | refute html["#bad"] 52 | 53 | assert to_string(html) == "Hello, World!" 54 | end 55 | 56 | @tag :skip 57 | test "inspect" do 58 | html = ~HTML[Hello, world!
] 59 | assert inspect(html) == ~s|~HTML[Hello, world!
]| 60 | end 61 | 62 | test "enumarble" do 63 | html = ~HTML[ 64 |A | 67 |1 | 68 |
B | 71 |2 | 72 |