Commit 410a11e5e048c29face844aa995cfae29e9e0139

Thomas de Grivel 2022-11-02T18:46:59

remove empty lines

diff --git a/lib/header/c.ex b/lib/header/c.ex
index 118d44b..a9160c6 100644
--- a/lib/header/c.ex
+++ b/lib/header/c.ex
@@ -22,6 +22,9 @@ defmodule Header.C do
   def split("/*" <> rest, acc) do
     {"", acc <> "/*" <> rest}
   end
+  def split("*/\n\n" <> rest, acc) do
+    split("*/\n" <> rest, acc)
+  end
   def split("*/\n" <> rest, acc) do
     header = acc <> "*/"
     {header, rest}
diff --git a/lib/header/make.ex b/lib/header/make.ex
index 059cc75..673c058 100644
--- a/lib/header/make.ex
+++ b/lib/header/make.ex
@@ -11,8 +11,6 @@
 ## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
 ## THIS SOFTWARE.
 
-
-
 defmodule Header.Make do
   def split(src) do
     split(src, [])
@@ -21,8 +19,14 @@ defmodule Header.Make do
   def split([line = ("#" <> _) | rest], acc) do
     split(rest, [line | acc])
   end
-  def split(rest, acc) do
-    {Enum.reverse(acc) |> Enum.join("\n"), rest |> Enum.join("\n")}
+  def split([line | rest], acc) do
+    case Regex.run(~r/^\s*$/, line) do
+      [_] -> split(rest, acc)
+      _ ->
+        acc = Enum.reverse(acc) |> Enum.join("\n")
+        rest = [line | rest] |> Enum.join("\n")
+        {acc, rest}
+    end
   end
 
   def main([src_path | dest_paths]) do
diff --git a/lib/kmxgit.ex b/lib/kmxgit.ex
index d63a6f2..2d8ccc0 100644
--- a/lib/kmxgit.ex
+++ b/lib/kmxgit.ex
@@ -11,7 +11,6 @@
 ## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
 ## THIS SOFTWARE.
 
-
 defmodule Kmxgit do
   @moduledoc """
   Kmxgit keeps the contexts that define your domain