Commit e8d857da authored by ak's avatar ak
Browse files

add external export

parent b879d204
Pykyll is a command line tool written in Python that mimiks Jekyll in its result and in the way information is stored. The result being a static web site that is build from essentially markdown text files. The name is obviously a pun of some sort.
## [Repository view](https://git.c3pb.de/ak/pykyll) 👉 [Web view](https://ak.pages.c3pb.de/pykyll) 👀
## [Repository view](https://git.c3pb.de/ak/pykyll) 👉 [Web view](https://pykyll.harmlos.info) 👀
![[Featured Views](images/Screenshot_2.png)](images/Screenshot_2.png)
......@@ -47,7 +47,7 @@ Pykyll is being developed to serve as a git sub-module within a git repository o
Basic examples are best browsed in the [web view](https://ak.pages.c3pb.de/pykyll)
### Production
### [Talks and AMA](https://talks.pages.c3pb.de/ak/)
### [Talks and AMA and Project Reports](https://talks.harmlos.info/)
Subraum Talks held or hosted by ak during wednesdays open chaos event between 2019 and now
......@@ -93,6 +93,6 @@ The software is the documentation, i.e. help is provided within the software. Th
Docs Extended can be read on the command line [r][p] Docs Extended. In repository or web view they are [here](/examples)
Pykyll README.md
README.md
---
......@@ -269,9 +269,8 @@ header h1{
font-family: 'Pacifico';
}
header p{
font-weight: bolder;
font-size: 1.6em;
line-height: 1em;
font-weight: lighter;
font-size: 1em;
}
code{
......
......@@ -269,9 +269,8 @@ header h1{
font-family: 'Pacifico';
}
header p{
font-weight: bolder;
font-size: 1.6em;
line-height: 1em;
font-weight: lighter;
font-size: 1em;
}
code{
......
......@@ -93,7 +93,7 @@
<ul>
<li><a href="#basic">Basic</a></li>
<li><a href="#production">Production</a></li>
<li><a href="#talks-and-ama"><span>Talks and AMA</span></a></li>
<li><a href="#talks-and-ama-and-project-reports"><span>Talks and AMA and Project Reports</span></a></li>
</ul></li>
<li><a href="#documentation">Documentation</a></li>
</ul></li>
......@@ -103,7 +103,7 @@
Pykyll – <a href="examples">Docs </a><a href="my_lipsum">Lorem </a>
</div>
<p>Pykyll is a command line tool written in Python that mimiks Jekyll in its result and in the way information is stored. The result being a static web site that is build from essentially markdown text files. The name is obviously a pun of some sort.</p>
<h2 id="repository-view-web-view"><a href="https://git.c3pb.de/ak/pykyll">Repository view</a> 👉 <a href="https://ak.pages.c3pb.de/pykyll">Web view</a> 👀</h2>
<h2 id="repository-view-web-view"><a href="https://git.c3pb.de/ak/pykyll">Repository view</a> 👉 <a href="https://pykyll.harmlos.info">Web view</a> 👀</h2>
<figure>
<img src="images/Screenshot_2.png" alt="" /><figcaption><a href="images/Screenshot_2.png">Featured Views</a></figcaption>
</figure>
......@@ -136,7 +136,7 @@ Pykyll – <a href="examples">Docs </a> – <a href="my_lipsum">Lorem </a>
<h3 id="basic">Basic</h3>
<p>Basic examples are best browsed in the <a href="https://ak.pages.c3pb.de/pykyll">web view</a></p>
<h3 id="production">Production</h3>
<h3 id="talks-and-ama"><a href="https://talks.pages.c3pb.de/ak/">Talks and AMA</a></h3>
<h3 id="talks-and-ama-and-project-reports"><a href="https://talks.harmlos.info/">Talks and AMA and Project Reports</a></h3>
<p>Subraum Talks held or hosted by ak during wednesdays open chaos event between 2019 and now</p>
<p>Set up a fresh git repository $repo for managing with Pykyll:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true"></a><span class="fu">mkdir</span> <span class="va">$repo</span></span>
......@@ -171,7 +171,7 @@ Pykyll – <a href="examples">Docs </a> – <a href="my_lipsum">Lorem </a>
</figure>
<p>The software is the documentation, i.e. help is provided within the software. This is just a friendly tool that aims to be useful.</p>
<p>Docs Extended can be read on the command line [r][p] Docs Extended. In repository or web view they are <a href="/examples">here</a></p>
<p>Pykyll README.md</p>
<p>README.md</p>
<hr />
</body>
</html>
......@@ -295,7 +295,8 @@ if __name__ == "__main__":
elif choice == 1:
pkll.align(work_dir)
elif choice == 2:
pkll.export_html_fs(work_dir=work_dir, output_dir=pkll.conf["export_dir"])
print("[bold]Export[/bold] " + pkll.conf["export_dir"])
pkll.export_html_fs(work_dir=os.path.join(work_dir, "htmlout"), output_dir=pkll.conf["export_dir"])
elif choice == 3:
pkll.serve()
print()
......
......@@ -494,41 +494,41 @@ class Pykyll:
cons.print("")
return self
def export_html_fs(self, work_dir=os.getcwd(), output_dir=""):
if not output_dir == "":
try:
shutil.copytree(os.path.join(work_dir, "htmlout"),
os.path.join(output_dir))
except FileExistsError:
print(output_dir + " already exists. Examining.")
for root, subdirs, files in os.walk(os.path.join(work_dir, "htmlout")):
pass
# filecmp.cmp(os.path.join(work_dir))
# files_equal = []
# for file in files:
# if filecmp.cmp(os.path(root))
# print(root)
# files_equal, files_different, files_other = filecmp.cmpfiles(files,)
# dirs_compared = filecmp.dircmp(root,
# os.path.join(self.conf["export_dir"]))
# print(dirs_compared.report())
# print(dirs_compared.subdirs)
# for subdir in dirs_compared.subdirs:
# Toolz.pause(dirs_compared.diff_files)
# if dirs_compared.diff_files:
# for file in dirs_compared.diff_files:
# print(file)
# # dirs_compared.
# shutil.copytree(os.path.join(work_dir, "htmlout"),
# os.path.join(output_dir))
def export_html_fs(self, work_dir, output_dir):
"""Recursive export
Args:
work_dir ([type], optional): [description]. Defaults to os.getcwd().
output_dir (str, optional): [description]. Defaults to "".
Returns:
[type]: [description]
"""
try:
shutil.copytree(work_dir, output_dir)
except FileExistsError:
# print(output_dir + " already exists. Examining.")
for root, subdirs, files in os.walk(os.path.join(work_dir)):
# print(root)
for subdir in subdirs:
self.export_html_fs(os.path.join(work_dir, subdir),
os.path.join(output_dir, subdir))
for file in files:
if os.path.isfile(os.path.join(work_dir, file)):
files_same = filecmp.cmp(os.path.join(work_dir, file),
os.path.join(output_dir, file))
if not files_same:
shutil.copy(os.path.join(work_dir, file),
os.path.join(output_dir, file))
print(os.path.join(work_dir, file) + " --> " +
os.path.join(output_dir, file))
except FileNotFoundError:
pass
return self
def export(self, work_dir=os.getcwd(), htmlout_dir="htmlout"):
self.align(work_dir)
print("[bold]HTML EXPERIMENTAL[/bold]")
print("[bold]HTML[/bold]")
if not os.path.isdir(os.path.join(work_dir, "htmlout")):
print("Creating htmlout")
os.mkdir(os.path.join(work_dir, "htmlout"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment