Repository: nagisc007/storybuilder

Issue:
Need to fix: append head break line at scene head
シーン冒頭、前に一行開ける
===

**Description**
action出力にて、シーン冒頭のマークダウン、もう一行前も開けておく


Discussion:

Patch:
diff --git a/builder/tools.py b/builder/tools.py
index d67e47e..119a5d3 100644
--- a/builder/tools.py
+++ b/builder/tools.py
@@ -298,5 +298,5 @@ def _story_title_of(act: TagAction, level: int) -> str:
     assert isinstance(act, TagAction), "act Must be TagAction class!"
     assert isinstance(level, int), "level Must be int!"
 
-    return "{} {}\n".format("#" * level, act.note)
+    return "{}{} {}\n".format("\n" if level > 1 else "", "#" * level, act.note)
 


Test patch:
diff --git a/tests/test_tools.py b/tests/test_tools.py
index a6530a4..90ca074 100644
--- a/tests/test_tools.py
+++ b/tests/test_tools.py
@@ -87,7 +87,7 @@ class PrivateMethodsTest(unittest.TestCase):
         data = [
                 (self.ma.comment("test"), GroupType.STORY, 1, "<!--test-->"),
                 (self.ma.title("test"), GroupType.STORY, 1, "# test\n"),
-                (self.ma.title("test"), GroupType.STORY, 2, "## test\n"),
+                (self.ma.title("test"), GroupType.STORY, 2, "\n## test\n"),
                 (self.ma.title("test"), GroupType.SCENE, 1, "**test**"),
                 (self.ma.hr(), GroupType.STORY, 1, "--------" * 9),
                 ]
@@ -325,7 +325,7 @@ class PrivateMethodsTest(unittest.TestCase):
         data = [
                 ("a test", 0, " a test\n"),
                 ("a test", 1, "# a test\n"),
-                ("a test", 2, "## a test\n"),
+                ("a test", 2, "\n## a test\n"),
                 ]
 
         for title, lv, expected in data: