From a025e035a6a57f6edb512f12b9814597f225456c Mon Sep 17 00:00:00 2001 From: Janice Shiu <16640692+contrepoint@users.noreply.github.com> Date: Wed, 11 Nov 2020 17:21:34 +0800 Subject: [PATCH 1/5] add support for phoenix 1.5 --- mix.exs | 2 +- mix.lock | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/mix.exs b/mix.exs index 4646472..b111563 100644 --- a/mix.exs +++ b/mix.exs @@ -49,7 +49,7 @@ defmodule ScrivenerHtml.Mixfile do [ {:scrivener, "~> 1.2 or ~> 2.0"}, {:phoenix_html, "~> 2.2"}, - {:phoenix, "~> 1.0 and < 1.5.0", optional: true}, + {:phoenix, "~> 1.0", optional: true}, {:plug, "~> 1.1"}, {:ex_doc, "~> 0.19", only: :dev}, {:earmark, "~> 1.1", only: :dev} diff --git a/mix.lock b/mix.lock index 60a41fe..8d56849 100644 --- a/mix.lock +++ b/mix.lock @@ -1,20 +1,20 @@ %{ "decimal": {:hex, :decimal, "1.1.2", "79a769d4657b2d537b51ef3c02d29ab7141d2b486b516c109642d453ee08e00c", [:mix], []}, - "earmark": {:hex, :earmark, "1.3.1", "73812f447f7a42358d3ba79283cfa3075a7580a3a2ed457616d6517ac3738cb9", [:mix], [], "hexpm"}, + "earmark": {:hex, :earmark, "1.3.1", "73812f447f7a42358d3ba79283cfa3075a7580a3a2ed457616d6517ac3738cb9", [:mix], [], "hexpm", "000aaeff08919e95e7aea13e4af7b2b9734577b3e6a7c50ee31ee88cab6ec4fb"}, "ecto": {:hex, :ecto, "1.1.8", "0f0348e678fa5a450c266d69816808f97fbd82ade32cf88d4b09bbe8f8c27545", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, optional: false]}, {:mariaex, "~> 0.5.0 or ~> 0.6.0", [hex: :mariaex, optional: true]}, {:poison, "~> 1.0 or ~> 2.0", [hex: :poison, optional: true]}, {:poolboy, "~> 1.4", [hex: :poolboy, optional: false]}, {:postgrex, "~> 0.11.0", [hex: :postgrex, optional: true]}, {:sbroker, "~> 0.7", [hex: :sbroker, optional: true]}]}, - "ex_doc": {:hex, :ex_doc, "0.19.3", "3c7b0f02851f5fc13b040e8e925051452e41248f685e40250d7e40b07b9f8c10", [:mix], [{:earmark, "~> 1.2", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.10", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"}, - "makeup": {:hex, :makeup, "0.8.0", "9cf32aea71c7fe0a4b2e9246c2c4978f9070257e5c9ce6d4a28ec450a839b55f", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.13.0", "be7a477997dcac2e48a9d695ec730b2d22418292675c75aa2d34ba0909dcdeda", [:mix], [{:makeup, "~> 0.8", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"}, + "ex_doc": {:hex, :ex_doc, "0.19.3", "3c7b0f02851f5fc13b040e8e925051452e41248f685e40250d7e40b07b9f8c10", [:mix], [{:earmark, "~> 1.2", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.10", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "0e11d67e662142fc3945b0ee410c73c8c956717fbeae4ad954b418747c734973"}, + "makeup": {:hex, :makeup, "0.8.0", "9cf32aea71c7fe0a4b2e9246c2c4978f9070257e5c9ce6d4a28ec450a839b55f", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5fbc8e549aa9afeea2847c0769e3970537ed302f93a23ac612602e805d9d1e7f"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.13.0", "be7a477997dcac2e48a9d695ec730b2d22418292675c75aa2d34ba0909dcdeda", [:mix], [{:makeup, "~> 0.8", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "adf0218695e22caeda2820eaba703fa46c91820d53813a2223413da3ef4ba515"}, "meck": {:hex, :meck, "0.8.4", "59ca1cd971372aa223138efcf9b29475bde299e1953046a0c727184790ab1520", [:rebar, :make], []}, - "mime": {:hex, :mime, "1.3.0", "5e8d45a39e95c650900d03f897fbf99ae04f60ab1daa4a34c7a20a5151b7a5fe", [:mix], [], "hexpm"}, - "nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm"}, + "mime": {:hex, :mime, "1.3.0", "5e8d45a39e95c650900d03f897fbf99ae04f60ab1daa4a34c7a20a5151b7a5fe", [:mix], [], "hexpm", "5e839994289d60326aa86020c4fbd9c6938af188ecddab2579f07b66cd665328"}, + "nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm", "5c040b8469c1ff1b10093d3186e2e10dbe483cd73d79ec017993fb3985b8a9b3"}, "pavlov": {:git, "https://github.com/sproutapp/pavlov.git", "7f3c0d7c75c8c2875e21b495511a291194bfc85a", []}, - "phoenix": {:hex, :phoenix, "1.4.0", "56fe9a809e0e735f3e3b9b31c1b749d4b436e466d8da627b8d82f90eaae714d2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm"}, - "phoenix_html": {:hex, :phoenix_html, "2.9.3", "1b5a2122cbf743aa242f54dced8a4f1cc778b8bd304f4b4c0043a6250c58e258", [:mix], [{:plug, "~> 1.0", [hex: :plug, optional: false]}]}, - "phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.1", "6668d787e602981f24f17a5fbb69cc98f8ab085114ebfac6cc36e10a90c8e93c", [:mix], [], "hexpm"}, - "plug": {:hex, :plug, "1.7.1", "8516d565fb84a6a8b2ca722e74e2cd25ca0fc9d64f364ec9dbec09d33eb78ccd", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}], "hexpm"}, - "plug_crypto": {:hex, :plug_crypto, "1.0.0", "18e49317d3fa343f24620ed22795ec29d4a5e602d52d1513ccea0b07d8ea7d4d", [:mix], [], "hexpm"}, + "phoenix": {:hex, :phoenix, "1.4.0", "56fe9a809e0e735f3e3b9b31c1b749d4b436e466d8da627b8d82f90eaae714d2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm", "22da8f659cf13d3ba73b767f66b8c389113ddf0ef7b94225cc84e94b85eac90e"}, + "phoenix_html": {:hex, :phoenix_html, "2.9.3", "1b5a2122cbf743aa242f54dced8a4f1cc778b8bd304f4b4c0043a6250c58e258", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "f090e3a75de4efd72ae2b9b016909fe673512ef04e6b72d7bf039031a64d4a52"}, + "phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.1", "6668d787e602981f24f17a5fbb69cc98f8ab085114ebfac6cc36e10a90c8e93c", [:mix], [], "hexpm", "a3d890aaa3156d51056179dcaaadaf32b844f71656bb27c58756f2b97875c36c"}, + "plug": {:hex, :plug, "1.7.1", "8516d565fb84a6a8b2ca722e74e2cd25ca0fc9d64f364ec9dbec09d33eb78ccd", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}], "hexpm", "daa5fee4209c12c3c48b05a96cf88c320b627c9575f987554dcdc1fdcdf2c15e"}, + "plug_crypto": {:hex, :plug_crypto, "1.0.0", "18e49317d3fa343f24620ed22795ec29d4a5e602d52d1513ccea0b07d8ea7d4d", [:mix], [], "hexpm", "73c1682f0e414cfb5d9b95c8e8cd6ffcfdae699e3b05e1db744e58b7be857759"}, "poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], [], "hexpm"}, "poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], []}, - "scrivener": {:hex, :scrivener, "2.2.1", "5a84cdfc042e3c318a03f965d8197b8294676a8fff7c4a29e482a90c467ebf19", [:mix], []}, + "scrivener": {:hex, :scrivener, "2.2.1", "5a84cdfc042e3c318a03f965d8197b8294676a8fff7c4a29e482a90c467ebf19", [:mix], [], "hexpm", "a9cc85e580925b13cdb5265cead4594ddb3cc7fb23eea8843c219827165f6c4f"}, } From 3c4df45714b81893bbc5be78bade0fdd7b0bff72 Mon Sep 17 00:00:00 2001 From: Anton Satin Date: Wed, 9 Feb 2022 10:04:30 +0200 Subject: [PATCH 2/5] Support phoenix_html v3 (#2) * Allow phoenix_html 3.x * wip * seo test fix * html test fix --- config/config.exs | 2 +- mix.exs | 2 +- mix.lock | 9 +- test/scrivener/html/seo_test.exs | 8 +- test/scrivener/html_test.exs | 650 ++++++++++++++++++++----------- 5 files changed, 427 insertions(+), 244 deletions(-) diff --git a/config/config.exs b/config/config.exs index 136603b..3178df9 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,6 +1,6 @@ # This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. -use Mix.Config +import Config # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this diff --git a/mix.exs b/mix.exs index b111563..d8c0167 100644 --- a/mix.exs +++ b/mix.exs @@ -48,7 +48,7 @@ defmodule ScrivenerHtml.Mixfile do defp deps do [ {:scrivener, "~> 1.2 or ~> 2.0"}, - {:phoenix_html, "~> 2.2"}, + {:phoenix_html, "~> 2.2 or ~> 3.0"}, {:phoenix, "~> 1.0", optional: true}, {:plug, "~> 1.1"}, {:ex_doc, "~> 0.19", only: :dev}, diff --git a/mix.lock b/mix.lock index 8d56849..3772d87 100644 --- a/mix.lock +++ b/mix.lock @@ -6,15 +6,16 @@ "makeup": {:hex, :makeup, "0.8.0", "9cf32aea71c7fe0a4b2e9246c2c4978f9070257e5c9ce6d4a28ec450a839b55f", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5fbc8e549aa9afeea2847c0769e3970537ed302f93a23ac612602e805d9d1e7f"}, "makeup_elixir": {:hex, :makeup_elixir, "0.13.0", "be7a477997dcac2e48a9d695ec730b2d22418292675c75aa2d34ba0909dcdeda", [:mix], [{:makeup, "~> 0.8", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "adf0218695e22caeda2820eaba703fa46c91820d53813a2223413da3ef4ba515"}, "meck": {:hex, :meck, "0.8.4", "59ca1cd971372aa223138efcf9b29475bde299e1953046a0c727184790ab1520", [:rebar, :make], []}, - "mime": {:hex, :mime, "1.3.0", "5e8d45a39e95c650900d03f897fbf99ae04f60ab1daa4a34c7a20a5151b7a5fe", [:mix], [], "hexpm", "5e839994289d60326aa86020c4fbd9c6938af188ecddab2579f07b66cd665328"}, + "mime": {:hex, :mime, "2.0.2", "0b9e1a4c840eafb68d820b0e2158ef5c49385d17fb36855ac6e7e087d4b1dcc5", [:mix], [], "hexpm", "e6a3f76b4c277739e36c2e21a2c640778ba4c3846189d5ab19f97f126df5f9b7"}, "nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm", "5c040b8469c1ff1b10093d3186e2e10dbe483cd73d79ec017993fb3985b8a9b3"}, "pavlov": {:git, "https://github.com/sproutapp/pavlov.git", "7f3c0d7c75c8c2875e21b495511a291194bfc85a", []}, "phoenix": {:hex, :phoenix, "1.4.0", "56fe9a809e0e735f3e3b9b31c1b749d4b436e466d8da627b8d82f90eaae714d2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm", "22da8f659cf13d3ba73b767f66b8c389113ddf0ef7b94225cc84e94b85eac90e"}, - "phoenix_html": {:hex, :phoenix_html, "2.9.3", "1b5a2122cbf743aa242f54dced8a4f1cc778b8bd304f4b4c0043a6250c58e258", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "f090e3a75de4efd72ae2b9b016909fe673512ef04e6b72d7bf039031a64d4a52"}, + "phoenix_html": {:hex, :phoenix_html, "3.2.0", "1c1219d4b6cb22ac72f12f73dc5fad6c7563104d083f711c3fcd8551a1f4ae11", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "36ec97ba56d25c0136ef1992c37957e4246b649d620958a1f9fa86165f8bc54f"}, "phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.1", "6668d787e602981f24f17a5fbb69cc98f8ab085114ebfac6cc36e10a90c8e93c", [:mix], [], "hexpm", "a3d890aaa3156d51056179dcaaadaf32b844f71656bb27c58756f2b97875c36c"}, - "plug": {:hex, :plug, "1.7.1", "8516d565fb84a6a8b2ca722e74e2cd25ca0fc9d64f364ec9dbec09d33eb78ccd", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}], "hexpm", "daa5fee4209c12c3c48b05a96cf88c320b627c9575f987554dcdc1fdcdf2c15e"}, - "plug_crypto": {:hex, :plug_crypto, "1.0.0", "18e49317d3fa343f24620ed22795ec29d4a5e602d52d1513ccea0b07d8ea7d4d", [:mix], [], "hexpm", "73c1682f0e414cfb5d9b95c8e8cd6ffcfdae699e3b05e1db744e58b7be857759"}, + "plug": {:hex, :plug, "1.12.1", "645678c800601d8d9f27ad1aebba1fdb9ce5b2623ddb961a074da0b96c35187d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d57e799a777bc20494b784966dc5fbda91eb4a09f571f76545b72a634ce0d30b"}, + "plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"}, "poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], [], "hexpm"}, "poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], []}, "scrivener": {:hex, :scrivener, "2.2.1", "5a84cdfc042e3c318a03f965d8197b8294676a8fff7c4a29e482a90c467ebf19", [:mix], [], "hexpm", "a9cc85e580925b13cdb5265cead4594ddb3cc7fb23eea8843c219827165f6c4f"}, + "telemetry": {:hex, :telemetry, "1.0.0", "0f453a102cdf13d506b7c0ab158324c337c41f1cc7548f0bc0e130bbf0ae9452", [:rebar3], [], "hexpm", "73bc09fa59b4a0284efb4624335583c528e07ec9ae76aca96ea0673850aec57a"}, } diff --git a/test/scrivener/html/seo_test.exs b/test/scrivener/html/seo_test.exs index b5cbad7..bc2e56f 100644 --- a/test/scrivener/html/seo_test.exs +++ b/test/scrivener/html/seo_test.exs @@ -33,7 +33,7 @@ defmodule Scrivener.HTML.SEOTest do [ 60, "link", - [[32, "href", 61, 34, "?page=2", 34], [32, "rel", 61, 34, "next", 34]], + [32, "href", 61, 34, "?page=2", 34, 32, "rel", 61, 34, "next", 34], 62, [], 60, @@ -49,7 +49,7 @@ defmodule Scrivener.HTML.SEOTest do [ 60, "link", - [[32, "href", 61, 34, "?page=9", 34], [32, "rel", 61, 34, "prev", 34]], + [32, "href", 61, 34, "?page=9", 34, 32, "rel", 61, 34, "prev", 34], 62, [], 60, @@ -66,7 +66,7 @@ defmodule Scrivener.HTML.SEOTest do [ 60, "link", - [[32, "href", 61, 34, "?page=4", 34], [32, "rel", 61, 34, "prev", 34]], + [32, "href", 61, 34, "?page=4", 34, 32, "rel", 61, 34, "prev", 34], 62, [], 60, @@ -78,7 +78,7 @@ defmodule Scrivener.HTML.SEOTest do [ 60, "link", - [[32, "href", 61, 34, "?page=6", 34], [32, "rel", 61, 34, "next", 34]], + [32, "href", 61, 34, "?page=6", 34, 32, "rel", 61, 34, "next", 34], 62, [], 60, diff --git a/test/scrivener/html_test.exs b/test/scrivener/html_test.exs index 480c910..0f367b5 100644 --- a/test/scrivener/html_test.exs +++ b/test/scrivener/html_test.exs @@ -331,15 +331,15 @@ defmodule Scrivener.HTMLTest do [ 60, "ul", - [[32, "class", 61, 34, "pagination", 34]], + [" class=\"", "pagination", 34], 62, [ [ 60, "li", - [[32, "class", 61, 34, "active", 34]], + [" class=\"", "active", 34], 62, - [60, "a", [[32, "class", 61, 34, "", 34]], 62, "1", 60, 47, "a", 62], + [60, "a", [" class=\"", [], 34], 62, "1", 60, 47, "a", 62], 60, 47, "li", @@ -394,9 +394,9 @@ defmodule Scrivener.HTMLTest do [ 60, "div", - [[32, "class", 61, 34, "ui pagination menu", 34]], + [" class=\"", "ui pagination menu", 34], 62, - [[60, "a", [[32, "class", 61, 34, "active item", 34]], 62, "1", 60, 47, "a", 62]], + [[60, "a", [" class=\"", "active item", 34], 62, "1", 60, 47, "a", 62]], 60, 47, "div", @@ -416,62 +416,96 @@ defmodule Scrivener.HTMLTest do end test "renders Foundation for Sites 6.x styling" do - assert {:safe, + expected_content = { + :safe, + [ + 60, + "ul", + [ + " class=\"", + "pagination", + 34, + 32, + "role", + 61, + 34, + "pagination", + 34 + ], + 62, + [ + [ + 60, + "li", + [" class=\"", "current", 34], + 62, [ 60, - "ul", - [[32, "class", 61, 34, "pagination", 34], [32, "role", 61, 34, "pagination", 34]], + "span", + [" class=\"", [], 34], 62, - [ - [ - 60, - "li", - [[32, "class", 61, 34, "current", 34]], - 62, - [60, "span", [[32, "class", 61, 34, "", 34]], 62, "1", 60, 47, "span", 62], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "", 34]], - 62, - [60, "span", [[32, "class", 61, 34, "", 34]], 62, "2", 60, 47, "span", 62], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "", 34]], - 62, - [ - 60, - "span", - [[32, "class", 61, 34, "", 34]], - 62, - ">>", - 60, - 47, - "span", - 62 - ], - 60, - 47, - "li", - 62 - ] - ], + "1", 60, 47, - "ul", + "span", 62 - ]} = + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", [], 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + "2", + 60, + 47, + "span", + 62 + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", [], 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + [[[] | ">"] | ">"], + 60, + 47, + "span", + 62 + ], + 60, + 47, + "li", + 62 + ] + ], + 60, + 47, + "ul", + 62 + ] + } + + assert expected_content == HTML.pagination_links( build_conn(), %Page{ @@ -486,171 +520,285 @@ defmodule Scrivener.HTMLTest do end test "renders Foundation for Sites 6.x styling with ellipsis" do - assert {:safe, + expected_result = { + :safe, + [ + 60, + "ul", + [ + " class=\"", + "pagination", + 34, + 32, + "role", + 61, + 34, + "pagination", + 34 + ], + 62, + [ + [ + 60, + "li", + [" class=\"", [], 34], + 62, [ 60, - "ul", - [[32, "class", 61, 34, "pagination", 34], [32, "role", 61, 34, "pagination", 34]], + "span", + [" class=\"", [], 34], 62, - [ - [ - 60, - "li", - [[32, "class", 61, 34, "", 34]], - 62, - [ - 60, - "span", - [[32, "class", 61, 34, "", 34]], - 62, - "<<", - 60, - 47, - "span", - 62 - ], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "", 34]], - 62, - [60, "span", [[32, "class", 61, 34, "", 34]], 62, "1", 60, 47, "span", 62], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "", 34]], - 62, - [60, "span", [[32, "class", 61, 34, "", 34]], 62, "2", 60, 47, "span", 62], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "current", 34]], - 62, - [60, "span", [[32, "class", 61, 34, "", 34]], 62, "3", 60, 47, "span", 62], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "", 34]], - 62, - [60, "span", [[32, "class", 61, 34, "", 34]], 62, "4", 60, 47, "span", 62], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "", 34]], - 62, - [60, "span", [[32, "class", 61, 34, "", 34]], 62, "5", 60, 47, "span", 62], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "", 34]], - 62, - [60, "span", [[32, "class", 61, 34, "", 34]], 62, "6", 60, 47, "span", 62], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "", 34]], - 62, - [60, "span", [[32, "class", 61, 34, "", 34]], 62, "7", 60, 47, "span", 62], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "", 34]], - 62, - [60, "span", [[32, "class", 61, 34, "", 34]], 62, "8", 60, 47, "span", 62], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "ellipsis", 34]], - 62, - [60, "span", [[32, "class", 61, 34, "", 34]], 62, "", 60, 47, "span", 62], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "", 34]], - 62, - [60, "span", [[32, "class", 61, 34, "", 34]], 62, "10", 60, 47, "span", 62], - 60, - 47, - "li", - 62 - ], - [ - 60, - "li", - [[32, "class", 61, 34, "", 34]], - 62, - [ - 60, - "span", - [[32, "class", 61, 34, "", 34]], - 62, - ">>", - 60, - 47, - "span", - 62 - ], - 60, - 47, - "li", - 62 - ] - ], + [[[] | "<"] | "<"], 60, 47, - "ul", + "span", + 62 + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", [], 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + "1", + 60, + 47, + "span", 62 - ]} == + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", [], 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + "2", + 60, + 47, + "span", + 62 + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", "current", 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + "3", + 60, + 47, + "span", + 62 + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", [], 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + "4", + 60, + 47, + "span", + 62 + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", [], 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + "5", + 60, + 47, + "span", + 62 + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", [], 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + "6", + 60, + 47, + "span", + 62 + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", [], 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + "7", + 60, + 47, + "span", + 62 + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", [], 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + "8", + 60, + 47, + "span", + 62 + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", "ellipsis", 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + [], + 60, + 47, + "span", + 62 + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", [], 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + "10", + 60, + 47, + "span", + 62 + ], + 60, + 47, + "li", + 62 + ], + [ + 60, + "li", + [" class=\"", [], 34], + 62, + [ + 60, + "span", + [" class=\"", [], 34], + 62, + [[[] | ">"] | ">"], + 60, + 47, + "span", + 62 + ], + 60, + 47, + "li", + 62 + ] + ], + 60, + 47, + "ul", + 62 + ] + } + + assert expected_result == HTML.pagination_links( build_conn(), %Page{ @@ -670,23 +818,23 @@ defmodule Scrivener.HTMLTest do [ 60, "nav", - [[32, "aria-label", 61, 34, "Page navigation", 34]], + [32, "aria-label", 61, 34, "Page navigation", 34], 62, [ 60, "ul", - [[32, "class", 61, 34, "pagination", 34]], + [" class=\"", "pagination", 34], 62, [ [ 60, "li", - [[32, "class", 61, 34, "active page-item", 34]], + [" class=\"", "active page-item", 34], 62, [ 60, "a", - [[32, "class", 61, 34, "page-link", 34]], + [" class=\"", "page-link", 34], 62, "1", 60, @@ -728,15 +876,25 @@ defmodule Scrivener.HTMLTest do [ 60, "ul", - [[32, "class", 61, 34, "pagination", 34]], + [" class=\"", "pagination", 34], 62, [ [ 60, "li", - [[32, "class", 61, 34, "active", 34]], + [" class=\"", "active", 34], 62, - [60, "a", [[32, "class", 61, 34, "", 34]], 62, "1", 60, 47, "a", 62], + [ + 60, + "a", + [" class=\"", [], 34], + 62, + "1", + 60, + 47, + "a", + 62 + ], 60, 47, "li", @@ -745,9 +903,19 @@ defmodule Scrivener.HTMLTest do [ 60, "li", - [[32, "class", 61, 34, "waves-effect", 34]], + [" class=\"", "waves-effect", 34], 62, - [60, "a", [[32, "class", 61, 34, "", 34]], 62, "2", 60, 47, "a", 62], + [ + 60, + "a", + [" class=\"", [], 34], + 62, + "2", + 60, + 47, + "a", + 62 + ], 60, 47, "li", @@ -756,9 +924,19 @@ defmodule Scrivener.HTMLTest do [ 60, "li", - [[32, "class", 61, 34, "waves-effect", 34]], + [" class=\"", "waves-effect", 34], 62, - [60, "a", [[32, "class", 61, 34, "", 34]], 62, ">>", 60, 47, "a", 62], + [ + 60, + "a", + [" class=\"", [], 34], + 62, + [[[] | ">"] | ">"], + 60, + 47, + "a", + 62 + ], 60, 47, "li", @@ -788,23 +966,27 @@ defmodule Scrivener.HTMLTest do [ 60, "nav", - [[32, "class", 61, 34, "pagination is-centered", 34]], + [" class=\"", "pagination is-centered", 34], 62, [ 60, "ul", - [[32, "class", 61, 34, "pagination-list", 34]], + [" class=\"", "pagination-list", 34], 62, [ [ 60, "li", - [[32, "class", 61, 34, "", 34]], + [" class=\"", [], 34], 62, [ 60, "a", - [[32, "class", 61, 34, "pagination-link is-current", 34]], + [ + " class=\"", + "pagination-link is-current", + 34 + ], 62, "1", 60, @@ -820,12 +1002,12 @@ defmodule Scrivener.HTMLTest do [ 60, "li", - [[32, "class", 61, 34, "", 34]], + [" class=\"", [], 34], 62, [ 60, "a", - [[32, "class", 61, 34, "pagination-link", 34]], + [" class=\"", "pagination-link", 34], 62, "2", 60, @@ -841,14 +1023,14 @@ defmodule Scrivener.HTMLTest do [ 60, "li", - [[32, "class", 61, 34, "", 34]], + [" class=\"", [], 34], 62, [ 60, "a", - [[32, "class", 61, 34, "pagination-link", 34]], + [" class=\"", "pagination-link", 34], 62, - ">>", + [[[] | ">"] | ">"], 60, 47, "a", From 63486e69aa3aca568f459a2aac851407474fe07d Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Mon, 18 Sep 2023 12:58:30 +0300 Subject: [PATCH 3/5] Support phoenix_html 3.3.x --- config/config.exs | 2 ++ mix.exs | 10 ++++++---- mix.lock | 32 +++++++++++++++++++------------- test/scrivener/html_test.exs | 6 ++---- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/config/config.exs b/config/config.exs index 3178df9..90e09d5 100644 --- a/config/config.exs +++ b/config/config.exs @@ -8,6 +8,8 @@ import Config # if you want to provide default values for your application for third- # party users, it should be done in your mix.exs file. +config :phoenix, json_library: Jason + # Sample configuration: # # config :logger, diff --git a/mix.exs b/mix.exs index d8c0167..967475b 100644 --- a/mix.exs +++ b/mix.exs @@ -1,12 +1,12 @@ defmodule ScrivenerHtml.Mixfile do use Mix.Project - @version "1.8.1" + @version "1.9.0" def project do [ app: :scrivener_html, version: @version, - elixir: "~> 1.2", + elixir: "~> 1.14", name: "scrivener_html", source_url: "https://github.com/mgwidmann/scrivener_html", homepage_url: "https://github.com/mgwidmann/scrivener_html", @@ -29,7 +29,8 @@ defmodule ScrivenerHtml.Mixfile do # Type `mix help compile.app` for more information def application do [ - applications: [:logger] + applications: [:logger], + extra_applications: [:phoenix, :phoenix_html, :scrivener] ] end @@ -49,7 +50,8 @@ defmodule ScrivenerHtml.Mixfile do [ {:scrivener, "~> 1.2 or ~> 2.0"}, {:phoenix_html, "~> 2.2 or ~> 3.0"}, - {:phoenix, "~> 1.0", optional: true}, + {:phoenix, "~> 1.2"}, + {:jason, "~> 1.2", only: [:test]}, {:plug, "~> 1.1"}, {:ex_doc, "~> 0.19", only: :dev}, {:earmark, "~> 1.1", only: :dev} diff --git a/mix.lock b/mix.lock index 3772d87..3a6bc34 100644 --- a/mix.lock +++ b/mix.lock @@ -1,21 +1,27 @@ %{ + "castore": {:hex, :castore, "1.0.3", "7130ba6d24c8424014194676d608cb989f62ef8039efd50ff4b3f33286d06db8", [:mix], [], "hexpm", "680ab01ef5d15b161ed6a95449fac5c6b8f60055677a8e79acf01b27baa4390b"}, "decimal": {:hex, :decimal, "1.1.2", "79a769d4657b2d537b51ef3c02d29ab7141d2b486b516c109642d453ee08e00c", [:mix], []}, - "earmark": {:hex, :earmark, "1.3.1", "73812f447f7a42358d3ba79283cfa3075a7580a3a2ed457616d6517ac3738cb9", [:mix], [], "hexpm", "000aaeff08919e95e7aea13e4af7b2b9734577b3e6a7c50ee31ee88cab6ec4fb"}, + "earmark": {:hex, :earmark, "1.4.40", "ff1a0f8bf3b298113c2a257c4e7a8b29ba9db5d35f5ee6d29291cb8caa09a071", [:mix], [{:earmark_parser, "~> 1.4.35", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "5fb622d5e36046bc313a426211e8bf769ba50db7720744859a21932c6470d75c"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.35", "437773ca9384edf69830e26e9e7b2e0d22d2596c4a6b17094a3b29f01ea65bb8", [:mix], [], "hexpm", "8652ba3cb85608d0d7aa2d21b45c6fad4ddc9a1f9a1f1b30ca3a246f0acc33f6"}, "ecto": {:hex, :ecto, "1.1.8", "0f0348e678fa5a450c266d69816808f97fbd82ade32cf88d4b09bbe8f8c27545", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, optional: false]}, {:mariaex, "~> 0.5.0 or ~> 0.6.0", [hex: :mariaex, optional: true]}, {:poison, "~> 1.0 or ~> 2.0", [hex: :poison, optional: true]}, {:poolboy, "~> 1.4", [hex: :poolboy, optional: false]}, {:postgrex, "~> 0.11.0", [hex: :postgrex, optional: true]}, {:sbroker, "~> 0.7", [hex: :sbroker, optional: true]}]}, - "ex_doc": {:hex, :ex_doc, "0.19.3", "3c7b0f02851f5fc13b040e8e925051452e41248f685e40250d7e40b07b9f8c10", [:mix], [{:earmark, "~> 1.2", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.10", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "0e11d67e662142fc3945b0ee410c73c8c956717fbeae4ad954b418747c734973"}, - "makeup": {:hex, :makeup, "0.8.0", "9cf32aea71c7fe0a4b2e9246c2c4978f9070257e5c9ce6d4a28ec450a839b55f", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5fbc8e549aa9afeea2847c0769e3970537ed302f93a23ac612602e805d9d1e7f"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.13.0", "be7a477997dcac2e48a9d695ec730b2d22418292675c75aa2d34ba0909dcdeda", [:mix], [{:makeup, "~> 0.8", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "adf0218695e22caeda2820eaba703fa46c91820d53813a2223413da3ef4ba515"}, + "ex_doc": {:hex, :ex_doc, "0.30.6", "5f8b54854b240a2b55c9734c4b1d0dd7bdd41f71a095d42a70445c03cf05a281", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "bd48f2ddacf4e482c727f9293d9498e0881597eae6ddc3d9562bd7923375109f"}, + "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, + "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [: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", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"}, + "makeup_erlang": {:hex, :makeup_erlang, "0.1.2", "ad87296a092a46e03b7e9b0be7631ddcf64c790fa68a9ef5323b6cbb36affc72", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f3f5a1ca93ce6e092d92b6d9c049bcda58a3b617a8d888f8e7231c85630e8108"}, "meck": {:hex, :meck, "0.8.4", "59ca1cd971372aa223138efcf9b29475bde299e1953046a0c727184790ab1520", [:rebar, :make], []}, - "mime": {:hex, :mime, "2.0.2", "0b9e1a4c840eafb68d820b0e2158ef5c49385d17fb36855ac6e7e087d4b1dcc5", [:mix], [], "hexpm", "e6a3f76b4c277739e36c2e21a2c640778ba4c3846189d5ab19f97f126df5f9b7"}, - "nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm", "5c040b8469c1ff1b10093d3186e2e10dbe483cd73d79ec017993fb3985b8a9b3"}, + "mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, "pavlov": {:git, "https://github.com/sproutapp/pavlov.git", "7f3c0d7c75c8c2875e21b495511a291194bfc85a", []}, - "phoenix": {:hex, :phoenix, "1.4.0", "56fe9a809e0e735f3e3b9b31c1b749d4b436e466d8da627b8d82f90eaae714d2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm", "22da8f659cf13d3ba73b767f66b8c389113ddf0ef7b94225cc84e94b85eac90e"}, - "phoenix_html": {:hex, :phoenix_html, "3.2.0", "1c1219d4b6cb22ac72f12f73dc5fad6c7563104d083f711c3fcd8551a1f4ae11", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "36ec97ba56d25c0136ef1992c37957e4246b649d620958a1f9fa86165f8bc54f"}, - "phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.1", "6668d787e602981f24f17a5fbb69cc98f8ab085114ebfac6cc36e10a90c8e93c", [:mix], [], "hexpm", "a3d890aaa3156d51056179dcaaadaf32b844f71656bb27c58756f2b97875c36c"}, - "plug": {:hex, :plug, "1.12.1", "645678c800601d8d9f27ad1aebba1fdb9ce5b2623ddb961a074da0b96c35187d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d57e799a777bc20494b784966dc5fbda91eb4a09f571f76545b72a634ce0d30b"}, - "plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"}, + "phoenix": {:hex, :phoenix, "1.6.16", "e5bdd18c7a06da5852a25c7befb72246de4ddc289182285f8685a40b7b5f5451", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "e15989ff34f670a96b95ef6d1d25bad0d9c50df5df40b671d8f4a669e050ac39"}, + "phoenix_html": {:hex, :phoenix_html, "3.3.2", "d6ce982c6d8247d2fc0defe625255c721fb8d5f1942c5ac051f6177bffa5973f", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "44adaf8e667c1c20fb9d284b6b0fa8dc7946ce29e81ce621860aa7e96de9a11d"}, + "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"}, + "phoenix_template": {:hex, :phoenix_template, "1.0.3", "32de561eefcefa951aead30a1f94f1b5f0379bc9e340bb5c667f65f1edfa4326", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "16f4b6588a4152f3cc057b9d0c0ba7e82ee23afa65543da535313ad8d25d8e2c"}, + "phoenix_view": {:hex, :phoenix_view, "2.0.2", "6bd4d2fd595ef80d33b439ede6a19326b78f0f1d8d62b9a318e3d9c1af351098", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}], "hexpm", "a929e7230ea5c7ee0e149ffcf44ce7cf7f4b6d2bfe1752dd7c084cdff152d36f"}, + "plug": {:hex, :plug, "1.14.2", "cff7d4ec45b4ae176a227acd94a7ab536d9b37b942c8e8fa6dfc0fff98ff4d80", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "842fc50187e13cf4ac3b253d47d9474ed6c296a8732752835ce4a86acdf68d13"}, + "plug_crypto": {:hex, :plug_crypto, "1.2.5", "918772575e48e81e455818229bf719d4ab4181fcbf7f85b68a35620f78d89ced", [:mix], [], "hexpm", "26549a1d6345e2172eb1c233866756ae44a9609bd33ee6f99147ab3fd87fd842"}, "poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], [], "hexpm"}, "poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], []}, - "scrivener": {:hex, :scrivener, "2.2.1", "5a84cdfc042e3c318a03f965d8197b8294676a8fff7c4a29e482a90c467ebf19", [:mix], [], "hexpm", "a9cc85e580925b13cdb5265cead4594ddb3cc7fb23eea8843c219827165f6c4f"}, - "telemetry": {:hex, :telemetry, "1.0.0", "0f453a102cdf13d506b7c0ab158324c337c41f1cc7548f0bc0e130bbf0ae9452", [:rebar3], [], "hexpm", "73bc09fa59b4a0284efb4624335583c528e07ec9ae76aca96ea0673850aec57a"}, + "scrivener": {:hex, :scrivener, "2.7.2", "1d913c965ec352650a7f864ad7fd8d80462f76a32f33d57d1e48bc5e9d40aba2", [:mix], [], "hexpm", "7866a0ec4d40274efbee1db8bead13a995ea4926ecd8203345af8f90d2b620d9"}, + "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, } diff --git a/test/scrivener/html_test.exs b/test/scrivener/html_test.exs index 0f367b5..cb4fc1f 100644 --- a/test/scrivener/html_test.exs +++ b/test/scrivener/html_test.exs @@ -6,6 +6,8 @@ defmodule Scrivener.HTMLTest do import Scrivener.Support.HTML alias Scrivener.Page + import Phoenix.ConnTest + setup do Application.put_env(:scrivener_html, :view_style, :bootstrap) Application.put_env(:scrivener_html, :routes_helper, MyApp.Router.Helpers) @@ -318,7 +320,6 @@ defmodule Scrivener.HTMLTest do describe "Phoenix conn()" do test "handles no entries" do - use Phoenix.ConnTest Application.put_env(:scrivener_html, :view_style, :bootstrap) Application.put_env(:scrivener_html, :routes_helper, MyApp.Router.Helpers) @@ -366,7 +367,6 @@ defmodule Scrivener.HTMLTest do end test "allows other url parameters" do - use Phoenix.ConnTest Application.put_env(:scrivener_html, :view_style, :bootstrap) Application.put_env(:scrivener_html, :routes_helper, MyApp.Router.Helpers) @@ -387,8 +387,6 @@ defmodule Scrivener.HTMLTest do end describe "View Styles" do - use Phoenix.ConnTest - test "renders Semantic UI styling" do assert {:safe, [ From abe39179763fafe67b84af60c2824f0401c21618 Mon Sep 17 00:00:00 2001 From: Arpan Date: Mon, 8 Jul 2024 14:22:09 +0530 Subject: [PATCH 4/5] Update for elixir 1.17 --- lib/scrivener/html.ex | 9 ++++----- lib/scrivener/html/seo.ex | 2 +- mix.exs | 20 ++++++++++---------- mix.lock | 31 +++++++++++++++++-------------- test/scrivener/html_test.exs | 5 ++++- 5 files changed, 36 insertions(+), 31 deletions(-) diff --git a/lib/scrivener/html.ex b/lib/scrivener/html.ex index 7cb0835..63bfabd 100644 --- a/lib/scrivener/html.ex +++ b/lib/scrivener/html.ex @@ -1,5 +1,6 @@ defmodule Scrivener.HTML do - use Phoenix.HTML + import Phoenix.HTML + use PhoenixHTMLHelpers @defaults [view_style: :bootstrap, action: :index, page_param: :page, hide_single: false] @view_styles [:bootstrap, :semantic, :foundation, :bootstrap_v4, :materialize, :bulma] @raw_defaults [ @@ -185,10 +186,8 @@ defmodule Scrivener.HTML do page_param: _page_param, params: _params ) - when not (style in @view_styles) do - raise "Scrivener.HTML: View style #{inspect(style)} is not a valid view style. Please use one of #{ - inspect(@view_styles) - }" + when style not in @view_styles do + raise "Scrivener.HTML: View style #{inspect(style)} is not a valid view style. Please use one of #{inspect(@view_styles)}" end # Bootstrap implementation diff --git a/lib/scrivener/html/seo.ex b/lib/scrivener/html/seo.ex index 6b0c689..ff17e80 100644 --- a/lib/scrivener/html/seo.ex +++ b/lib/scrivener/html/seo.ex @@ -12,7 +12,7 @@ defmodule Scrivener.HTML.SEO do for help with how to do that. The recommended option is to use `render_existing/2` in your layout file and add a separate view to render that. """ alias Scrivener.Page - use Phoenix.HTML + use PhoenixHTMLHelpers @defaults Keyword.drop(Scrivener.HTML.defaults(), [:view_style]) diff --git a/mix.exs b/mix.exs index 967475b..bd6c76c 100644 --- a/mix.exs +++ b/mix.exs @@ -1,12 +1,12 @@ defmodule ScrivenerHtml.Mixfile do use Mix.Project - @version "1.9.0" + @version "1.2.0" def project do [ app: :scrivener_html, version: @version, - elixir: "~> 1.14", + elixir: "~> 1.17", name: "scrivener_html", source_url: "https://github.com/mgwidmann/scrivener_html", homepage_url: "https://github.com/mgwidmann/scrivener_html", @@ -29,7 +29,6 @@ defmodule ScrivenerHtml.Mixfile do # Type `mix help compile.app` for more information def application do [ - applications: [:logger], extra_applications: [:phoenix, :phoenix_html, :scrivener] ] end @@ -48,13 +47,14 @@ defmodule ScrivenerHtml.Mixfile do # Type `mix help deps` for more examples and options defp deps do [ - {:scrivener, "~> 1.2 or ~> 2.0"}, - {:phoenix_html, "~> 2.2 or ~> 3.0"}, - {:phoenix, "~> 1.2"}, - {:jason, "~> 1.2", only: [:test]}, - {:plug, "~> 1.1"}, - {:ex_doc, "~> 0.19", only: :dev}, - {:earmark, "~> 1.1", only: :dev} + {:scrivener, "~> 2.7"}, + {:phoenix_html, "~> 4.1"}, + {:phoenix_html_helpers, "~> 1.0"}, + {:phoenix, "~> 1.7"}, + {:plug, "~> 1.16"}, + {:jason, "~> 1.4"}, + {:ex_doc, "~> 0.34.1", only: :dev}, + {:earmark, "~> 1.4", only: :dev} ] end diff --git a/mix.lock b/mix.lock index 3a6bc34..6bf3614 100644 --- a/mix.lock +++ b/mix.lock @@ -1,27 +1,30 @@ %{ - "castore": {:hex, :castore, "1.0.3", "7130ba6d24c8424014194676d608cb989f62ef8039efd50ff4b3f33286d06db8", [:mix], [], "hexpm", "680ab01ef5d15b161ed6a95449fac5c6b8f60055677a8e79acf01b27baa4390b"}, + "castore": {:hex, :castore, "1.0.8", "dedcf20ea746694647f883590b82d9e96014057aff1d44d03ec90f36a5c0dc6e", [:mix], [], "hexpm", "0b2b66d2ee742cb1d9cb8c8be3b43c3a70ee8651f37b75a8b982e036752983f1"}, "decimal": {:hex, :decimal, "1.1.2", "79a769d4657b2d537b51ef3c02d29ab7141d2b486b516c109642d453ee08e00c", [:mix], []}, "earmark": {:hex, :earmark, "1.4.40", "ff1a0f8bf3b298113c2a257c4e7a8b29ba9db5d35f5ee6d29291cb8caa09a071", [:mix], [{:earmark_parser, "~> 1.4.35", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "5fb622d5e36046bc313a426211e8bf769ba50db7720744859a21932c6470d75c"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.35", "437773ca9384edf69830e26e9e7b2e0d22d2596c4a6b17094a3b29f01ea65bb8", [:mix], [], "hexpm", "8652ba3cb85608d0d7aa2d21b45c6fad4ddc9a1f9a1f1b30ca3a246f0acc33f6"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.40", "f3534689f6b58f48aa3a9ac850d4f05832654fe257bf0549c08cc290035f70d5", [:mix], [], "hexpm", "cdb34f35892a45325bad21735fadb88033bcb7c4c296a999bde769783f53e46a"}, "ecto": {:hex, :ecto, "1.1.8", "0f0348e678fa5a450c266d69816808f97fbd82ade32cf88d4b09bbe8f8c27545", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, optional: false]}, {:mariaex, "~> 0.5.0 or ~> 0.6.0", [hex: :mariaex, optional: true]}, {:poison, "~> 1.0 or ~> 2.0", [hex: :poison, optional: true]}, {:poolboy, "~> 1.4", [hex: :poolboy, optional: false]}, {:postgrex, "~> 0.11.0", [hex: :postgrex, optional: true]}, {:sbroker, "~> 0.7", [hex: :sbroker, optional: true]}]}, - "ex_doc": {:hex, :ex_doc, "0.30.6", "5f8b54854b240a2b55c9734c4b1d0dd7bdd41f71a095d42a70445c03cf05a281", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "bd48f2ddacf4e482c727f9293d9498e0881597eae6ddc3d9562bd7923375109f"}, - "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, - "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [: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", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"}, - "makeup_erlang": {:hex, :makeup_erlang, "0.1.2", "ad87296a092a46e03b7e9b0be7631ddcf64c790fa68a9ef5323b6cbb36affc72", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f3f5a1ca93ce6e092d92b6d9c049bcda58a3b617a8d888f8e7231c85630e8108"}, + "ex_doc": {:hex, :ex_doc, "0.34.1", "9751a0419bc15bc7580c73fde506b17b07f6402a1e5243be9e0f05a68c723368", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "d441f1a86a235f59088978eff870de2e815e290e44a8bd976fe5d64470a4c9d2"}, + "jason": {:hex, :jason, "1.4.3", "d3f984eeb96fe53b85d20e0b049f03e57d075b5acda3ac8d465c969a2536c17b", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "9a90e868927f7c777689baa16d86f4d0e086d968db5c05d917ccff6d443e58a3"}, + "makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"}, + "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"}, + "makeup_erlang": {:hex, :makeup_erlang, "1.0.0", "6f0eff9c9c489f26b69b61440bf1b238d95badae49adac77973cbacae87e3c2e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "ea7a9307de9d1548d2a72d299058d1fd2339e3d398560a0e46c27dab4891e4d2"}, "meck": {:hex, :meck, "0.8.4", "59ca1cd971372aa223138efcf9b29475bde299e1953046a0c727184790ab1520", [:rebar, :make], []}, - "mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, + "mime": {:hex, :mime, "2.0.6", "8f18486773d9b15f95f4f4f1e39b710045fa1de891fada4516559967276e4dc2", [:mix], [], "hexpm", "c9945363a6b26d747389aac3643f8e0e09d30499a138ad64fe8fd1d13d9b153e"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, "pavlov": {:git, "https://github.com/sproutapp/pavlov.git", "7f3c0d7c75c8c2875e21b495511a291194bfc85a", []}, - "phoenix": {:hex, :phoenix, "1.6.16", "e5bdd18c7a06da5852a25c7befb72246de4ddc289182285f8685a40b7b5f5451", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "e15989ff34f670a96b95ef6d1d25bad0d9c50df5df40b671d8f4a669e050ac39"}, - "phoenix_html": {:hex, :phoenix_html, "3.3.2", "d6ce982c6d8247d2fc0defe625255c721fb8d5f1942c5ac051f6177bffa5973f", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "44adaf8e667c1c20fb9d284b6b0fa8dc7946ce29e81ce621860aa7e96de9a11d"}, + "phoenix": {:hex, :phoenix, "1.7.14", "a7d0b3f1bc95987044ddada111e77bd7f75646a08518942c72a8440278ae7825", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "c7859bc56cc5dfef19ecfc240775dae358cbaa530231118a9e014df392ace61a"}, + "phoenix_html": {:hex, :phoenix_html, "4.1.1", "4c064fd3873d12ebb1388425a8f2a19348cef56e7289e1998e2d2fa758aa982e", [:mix], [], "hexpm", "f2f2df5a72bc9a2f510b21497fd7d2b86d932ec0598f0210fed4114adc546c6f"}, + "phoenix_html_helpers": {:hex, :phoenix_html_helpers, "1.0.1", "7eed85c52eff80a179391036931791ee5d2f713d76a81d0d2c6ebafe1e11e5ec", [:mix], [{:phoenix_html, "~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "cffd2385d1fa4f78b04432df69ab8da63dc5cf63e07b713a4dcf36a3740e3090"}, "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"}, - "phoenix_template": {:hex, :phoenix_template, "1.0.3", "32de561eefcefa951aead30a1f94f1b5f0379bc9e340bb5c667f65f1edfa4326", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "16f4b6588a4152f3cc057b9d0c0ba7e82ee23afa65543da535313ad8d25d8e2c"}, + "phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"}, "phoenix_view": {:hex, :phoenix_view, "2.0.2", "6bd4d2fd595ef80d33b439ede6a19326b78f0f1d8d62b9a318e3d9c1af351098", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}], "hexpm", "a929e7230ea5c7ee0e149ffcf44ce7cf7f4b6d2bfe1752dd7c084cdff152d36f"}, - "plug": {:hex, :plug, "1.14.2", "cff7d4ec45b4ae176a227acd94a7ab536d9b37b942c8e8fa6dfc0fff98ff4d80", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "842fc50187e13cf4ac3b253d47d9474ed6c296a8732752835ce4a86acdf68d13"}, - "plug_crypto": {:hex, :plug_crypto, "1.2.5", "918772575e48e81e455818229bf719d4ab4181fcbf7f85b68a35620f78d89ced", [:mix], [], "hexpm", "26549a1d6345e2172eb1c233866756ae44a9609bd33ee6f99147ab3fd87fd842"}, + "plug": {:hex, :plug, "1.16.1", "40c74619c12f82736d2214557dedec2e9762029b2438d6d175c5074c933edc9d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a13ff6b9006b03d7e33874945b2755253841b238c34071ed85b0e86057f8cddc"}, + "plug_crypto": {:hex, :plug_crypto, "2.1.0", "f44309c2b06d249c27c8d3f65cfe08158ade08418cf540fd4f72d4d6863abb7b", [:mix], [], "hexpm", "131216a4b030b8f8ce0f26038bc4421ae60e4bb95c5cf5395e1421437824c4fa"}, "poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], [], "hexpm"}, "poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], []}, "scrivener": {:hex, :scrivener, "2.7.2", "1d913c965ec352650a7f864ad7fd8d80462f76a32f33d57d1e48bc5e9d40aba2", [:mix], [], "hexpm", "7866a0ec4d40274efbee1db8bead13a995ea4926ecd8203345af8f90d2b620d9"}, "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, + "websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"}, + "websock_adapter": {:hex, :websock_adapter, "0.5.6", "0437fe56e093fd4ac422de33bf8fc89f7bc1416a3f2d732d8b2c8fd54792fe60", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "e04378d26b0af627817ae84c92083b7e97aca3121196679b73c73b99d0d133ea"}, } diff --git a/test/scrivener/html_test.exs b/test/scrivener/html_test.exs index cb4fc1f..4c11e63 100644 --- a/test/scrivener/html_test.exs +++ b/test/scrivener/html_test.exs @@ -164,7 +164,10 @@ defmodule Scrivener.HTMLTest do test "does not include ellipsis on first page" do assert pages(1..6) == - links_with_opts([total_pages: 8, page_number: 1], first: true, ellipsis: "…") + links_with_opts([total_pages: 8, page_number: 1], + first: true, + ellipsis: "…" + ) end test "uses ellipsis only beyond of first page" do From 1b24f11d2d04f3f6591de148ec80a8580569b799 Mon Sep 17 00:00:00 2001 From: Arpan Date: Tue, 9 Jul 2024 10:44:21 +0530 Subject: [PATCH 5/5] downgrade to compatible version --- lib/scrivener/html.ex | 3 +-- lib/scrivener/html/seo.ex | 2 +- mix.exs | 3 +-- mix.lock | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/scrivener/html.ex b/lib/scrivener/html.ex index 63bfabd..58fddd8 100644 --- a/lib/scrivener/html.ex +++ b/lib/scrivener/html.ex @@ -1,6 +1,5 @@ defmodule Scrivener.HTML do - import Phoenix.HTML - use PhoenixHTMLHelpers + use Phoenix.HTML @defaults [view_style: :bootstrap, action: :index, page_param: :page, hide_single: false] @view_styles [:bootstrap, :semantic, :foundation, :bootstrap_v4, :materialize, :bulma] @raw_defaults [ diff --git a/lib/scrivener/html/seo.ex b/lib/scrivener/html/seo.ex index ff17e80..6b0c689 100644 --- a/lib/scrivener/html/seo.ex +++ b/lib/scrivener/html/seo.ex @@ -12,7 +12,7 @@ defmodule Scrivener.HTML.SEO do for help with how to do that. The recommended option is to use `render_existing/2` in your layout file and add a separate view to render that. """ alias Scrivener.Page - use PhoenixHTMLHelpers + use Phoenix.HTML @defaults Keyword.drop(Scrivener.HTML.defaults(), [:view_style]) diff --git a/mix.exs b/mix.exs index bd6c76c..93a0c3a 100644 --- a/mix.exs +++ b/mix.exs @@ -48,8 +48,7 @@ defmodule ScrivenerHtml.Mixfile do defp deps do [ {:scrivener, "~> 2.7"}, - {:phoenix_html, "~> 4.1"}, - {:phoenix_html_helpers, "~> 1.0"}, + {:phoenix_html, "~> 3.1"}, {:phoenix, "~> 1.7"}, {:plug, "~> 1.16"}, {:jason, "~> 1.4"}, diff --git a/mix.lock b/mix.lock index 6bf3614..0a3b49b 100644 --- a/mix.lock +++ b/mix.lock @@ -14,7 +14,7 @@ "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, "pavlov": {:git, "https://github.com/sproutapp/pavlov.git", "7f3c0d7c75c8c2875e21b495511a291194bfc85a", []}, "phoenix": {:hex, :phoenix, "1.7.14", "a7d0b3f1bc95987044ddada111e77bd7f75646a08518942c72a8440278ae7825", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "c7859bc56cc5dfef19ecfc240775dae358cbaa530231118a9e014df392ace61a"}, - "phoenix_html": {:hex, :phoenix_html, "4.1.1", "4c064fd3873d12ebb1388425a8f2a19348cef56e7289e1998e2d2fa758aa982e", [:mix], [], "hexpm", "f2f2df5a72bc9a2f510b21497fd7d2b86d932ec0598f0210fed4114adc546c6f"}, + "phoenix_html": {:hex, :phoenix_html, "3.3.4", "42a09fc443bbc1da37e372a5c8e6755d046f22b9b11343bf885067357da21cb3", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "0249d3abec3714aff3415e7ee3d9786cb325be3151e6c4b3021502c585bf53fb"}, "phoenix_html_helpers": {:hex, :phoenix_html_helpers, "1.0.1", "7eed85c52eff80a179391036931791ee5d2f713d76a81d0d2c6ebafe1e11e5ec", [:mix], [{:phoenix_html, "~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "cffd2385d1fa4f78b04432df69ab8da63dc5cf63e07b713a4dcf36a3740e3090"}, "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"}, "phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"},