mirror of
https://github.com/CrispyPin/crispypin.cc.git
synced 2024-11-10 04:00:27 +01:00
add indentation support to generator script
This commit is contained in:
parent
aff25868d2
commit
767f249413
7 changed files with 48 additions and 46 deletions
|
@ -1,22 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<link rel="icon" type="image/x-icon" href="/icons/favicon.png">
|
||||
|
||||
<title>CrispyPin.cc - Fractals</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<header>
|
||||
<a href="/" id="logo"><img src="/logo.png" alt=""></a>
|
||||
</header>
|
||||
<nav>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/games/">Games</a></li>
|
||||
<li><a href="https://crispypin.itch.io/">Games</a></li>
|
||||
<li><a href="/fractals/">Fractals</a></li>
|
||||
<li><a href="/blender/">Blender stuff</a></li>
|
||||
<li><a href="https://crispypin.github.io/gol-wallpaper">Game of Life</a></li>
|
||||
|
@ -67,7 +66,7 @@
|
|||
</div>
|
||||
<script src="fractals.js"></script>
|
||||
</main>
|
||||
<footer>
|
||||
<footer>
|
||||
<p>Copyright © 2022 - CrispyPin</p>
|
||||
<div class="links">
|
||||
<a href="https://github.com/CrispyPin"><img src="/icons/github.png" alt="" width=32px></a>
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<link rel="icon" type="image/x-icon" href="/icons/favicon.png">
|
||||
|
||||
<title>CrispyPin.cc</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<header>
|
||||
<a href="/" id="logo"><img src="/logo.png" alt=""></a>
|
||||
</header>
|
||||
<nav>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/games/">Games</a></li>
|
||||
<li><a href="https://crispypin.itch.io/">Games</a></li>
|
||||
<li><a href="/fractals/">Fractals</a></li>
|
||||
<li><a href="/blender/">Blender stuff</a></li>
|
||||
<li><a href="https://crispypin.github.io/gol-wallpaper">Game of Life</a></li>
|
||||
|
@ -26,7 +25,7 @@
|
|||
<h1>Homepage</h1>
|
||||
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Earum exercitationem quod laudantium neque. Dolor qui magnam debitis repellendus assumenda tenetur ab aliquam ea sit in harum facere neque ad nemo vel nesciunt distinctio totam, cupiditate, deleniti nam voluptas quia aperiam.</p>
|
||||
</main>
|
||||
<footer>
|
||||
<footer>
|
||||
<p>Copyright © 2022 - CrispyPin</p>
|
||||
<div class="links">
|
||||
<a href="https://github.com/CrispyPin"><img src="/icons/github.png" alt="" width=32px></a>
|
||||
|
|
|
@ -38,14 +38,18 @@ def ensure_dir(filepath: str):
|
|||
|
||||
def apply_include(contents: str) -> str:
|
||||
included_file = get_included_name(contents)
|
||||
inserted_text = read_file(TEMPLATE_DIR + included_file)
|
||||
|
||||
new_contents = read_file(TEMPLATE_DIR + included_file)
|
||||
return insert_contents(contents, new_contents)
|
||||
|
||||
|
||||
def insert_contents(contents, new_contents):
|
||||
index_start, index_end = get_marker_indices(contents)
|
||||
return contents[:index_start] + new_contents + contents[index_end + len(INCLUDE_MARKER_END):]
|
||||
index_end += len(INCLUDE_MARKER_END)
|
||||
|
||||
prefix = contents[:index_start]
|
||||
suffix = contents[index_end:]
|
||||
|
||||
indent = prefix.split("\n")[-1]
|
||||
inserted_text = inserted_text.replace("\n", "\n" + indent)
|
||||
|
||||
return prefix + inserted_text + suffix
|
||||
|
||||
|
||||
def get_included_name(contents):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<footer>
|
||||
<p>Copyright © 2022 - CrispyPin</p>
|
||||
<div class="links">
|
||||
<a href="https://github.com/CrispyPin"><img src="/icons/github.png" alt="" width=32px></a>
|
||||
<a href="https://crispypin.itch.io/"><img src="/icons/itchio.svg" alt="" width=32px></a>
|
||||
<a href="https://twitter.com/CrispyPin42"><img src="/icons/twitter.png" alt="" width=32px></a>
|
||||
<a href="https://www.youtube.com/channel/UCFW1QTsbFgux8VrduCz_ckQ"><img src="/icons/youtube.png" alt="" width=32px></a>
|
||||
</div>
|
||||
</footer>
|
||||
<footer>
|
||||
<p>Copyright © 2022 - CrispyPin</p>
|
||||
<div class="links">
|
||||
<a href="https://github.com/CrispyPin"><img src="/icons/github.png" alt="" width=32px></a>
|
||||
<a href="https://crispypin.itch.io/"><img src="/icons/itchio.svg" alt="" width=32px></a>
|
||||
<a href="https://twitter.com/CrispyPin42"><img src="/icons/twitter.png" alt="" width=32px></a>
|
||||
<a href="https://www.youtube.com/channel/UCFW1QTsbFgux8VrduCz_ckQ"><img src="/icons/youtube.png" alt="" width=32px></a>
|
||||
</div>
|
||||
</footer>
|
|
@ -1,4 +1,4 @@
|
|||
<header>
|
||||
<a href="/" id="logo"><img src="/logo.png" alt=""></a>
|
||||
</header>
|
||||
<include navbar.html/>
|
||||
<header>
|
||||
<a href="/" id="logo"><img src="/logo.png" alt=""></a>
|
||||
</header>
|
||||
<include navbar.html/>
|
|
@ -1,5 +1,5 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<link rel="icon" type="image/x-icon" href="/icons/favicon.png">
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<link rel="icon" type="image/x-icon" href="/icons/favicon.png">
|
|
@ -1,9 +1,9 @@
|
|||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/games/">Games</a></li>
|
||||
<li><a href="/fractals/">Fractals</a></li>
|
||||
<li><a href="/blender/">Blender stuff</a></li>
|
||||
<li><a href="https://crispypin.github.io/gol-wallpaper">Game of Life</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="https://crispypin.itch.io/">Games</a></li>
|
||||
<li><a href="/fractals/">Fractals</a></li>
|
||||
<li><a href="/blender/">Blender stuff</a></li>
|
||||
<li><a href="https://crispypin.github.io/gol-wallpaper">Game of Life</a></li>
|
||||
</ul>
|
||||
</nav>
|
Loading…
Reference in a new issue