Commit 7f8d4721 authored by ak's avatar ak
Browse files

add types example

parent da8663d1
......@@ -5,25 +5,33 @@
- [Proper Project Managment](#proper-project-managment)
- [Context is King](#context-is-king)
- [Enable TaskWarrior
# Proper Project Managment
with taskwarrior on the command line is supported by Pykyll.
## Enable TaskWarrior Integration
Set `taskwarrior` in `.config.yml` to `true`. In Pykyll, just hit [e] and then select Change Configuration.
## Context is King
All tasks created from Pykyll are tagged `+pykyll` which enables us to view them in this context. We set it up once:
All tasks created from Pykyll are tagged with a `taskwarrior_context` which enables us to view them in this context. `taskwarrior_context` can be set in Pykylly configuration. We also set it up once in taskwarrior:
```bash
❯ task context define pykyll +pykyll
❯ task context define taskwarrior_context +taskwarrior_context
Are you sure you want to add 'context.pykyll' with a value of '+pykyll'? (yes/no) yes
Context 'pykyll' defined. Use 'task context pykyll' to activate.
```
In this example, `taskwarrior_context` is the name of the context in taskwarrior and `+taskwarrior_context` is the tagthe value of `taskwarrior_context` prepended by a `+` sign.
Thats it. Now Pykyll can drop a task for the text you are working on into taskwarrior and display all pykyll related tasks. Pykyll shorthand: [i][t] YOUR_POST
`vit` is also acessible from Pykylls [i] Integrations Menu
Use `taskwarrior context taskwarrior_context` to work on this project undistracted by your other tasks. `taskwarrior context none` resets the context.
As a convenience function, `vit` is acessible from Pykylls [i] Integrations Menu. While Pykyll is running the context is set accordingly.
---
......
......@@ -3,22 +3,73 @@
## Different page Types in Pykyll
- [Topics:](#topics)
- [Topics](#topics)
- [Pages:](#pages)
- [Topic](#topic)
- [Blog](#blog)
## Topics:
- [Pages](#pages)
- Topic
- Blog
- Pages
- Slides
- [Slides](#slides)
## Pages:
- [Pages](#pages-1)
- Pages
- Slides
- [Pages](#pages-2)
- [Slides](#slides-1)
Set the frontmatter tag `type` to one of the following vaues to set the type of your content page.
## Topics
These are the available options for a title page to a collection of texts.
### Topic
`type: topic`
- Table of Contents for a collection of texts. Sorted alphabetically.
### Blog
`type: blog`
- Table of Contents for a collection of texts. Sorted by publication date. (Not yet implemented)
### Pages
`type: page`
- default option for a content page in a collection of texts
- choose for a flat Topic without any sub pages.
### Slides#
`type: slides`
- option for displaying a slide deck from the contents of a page in a collection of texts
- chose for a flat Topic without any sub pages.
## Pages
These are the available options for a content page in a a collection of texts.
### Pages
`type: page`
- default for regular pages
### Slides
`type: slides`
- adds a View Slide Deck option to the top of the Page.
- cf the Slide Deck Management document for further information.
---
#### Topic Types
......
......@@ -2,21 +2,60 @@
author: ak
check: true
description: Types of pages available in Pykyll
edit: 2021-Mar-08 18:13
html: false
edit: 2021-Mar-10 11:32
html: true
subtitle: Different page Types in Pykyll
title: Topic Types
type: post
---
## Topics:
Set the frontmatter tag `type` to one of the following vaues to set the type of your content page.
- Topic
- Blog
- Pages
- Slides
## Topics
## Pages:
These are the available options for a title page to a collection of texts.
- Pages
- Slides
\ No newline at end of file
### Topic
`type: topic`
- Table of Contents for a collection of texts. Sorted alphabetically.
### Blog
`type: blog`
- Table of Contents for a collection of texts. Sorted by publication date. (Not yet implemented)
### Pages
`type: page`
- default option for a content page in a collection of texts
- choose for a flat Topic without any sub pages.
### Slides#
`type: slides`
- option for displaying a slide deck from the contents of a page in a collection of texts
- chose for a flat Topic without any sub pages.
## Pages
These are the available options for a content page in a a collection of texts.
### Pages
`type: page`
- default for regular pages
### Slides
`type: slides`
- adds a View Slide Deck option to the top of the Page.
- cf the Slide Deck Management document for further information.
---
\ No newline at end of file
......@@ -89,7 +89,7 @@
<ul>
<li><a href="#proper-project-managment">Proper Project Managment</a>
<ul>
<li><a href="#context-is-king">Context is King</a></li>
<li><a href="#enable-taskwarrior-integration">Enable TaskWarrior Integration</a></li>
</ul></li>
</ul>
</nav>
......@@ -101,13 +101,16 @@ Integrating to the project management stack
</p>
<h1 id="proper-project-managment">Proper Project Managment</h1>
<p>with taskwarrior on the command line is supported by Pykyll.</p>
<h2 id="context-is-king">Context is King</h2>
<p>All tasks created from Pykyll are tagged <code>+pykyll</code> which enables us to view them in this context. We set it up once:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true"></a><span class="ex">task</span> context define pykyll +pykyll</span>
<h2 id="enable-taskwarrior-integration">Enable TaskWarrior Integration</h2>
<p>Set <code>taskwarrior</code> in <code>.config.yml</code> to <code>true</code>. In Pykyll, just hit [e] and then select Change Configuration. ## Context is King</p>
<p>All tasks created from Pykyll are tagged with a <code>taskwarrior_context</code> which enables us to view them in this context. <code>taskwarrior_context</code> can be set in Pykylly configuration. We also set it up once in taskwarrior:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true"></a><span class="ex">task</span> context define taskwarrior_context +taskwarrior_context</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true"></a><span class="ex">Are</span> you sure you want to add <span class="st">&#39;context.pykyll&#39;</span> with a value of <span class="st">&#39;+pykyll&#39;</span>? (yes/no) <span class="fu">yes</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true"></a><span class="ex">Context</span> <span class="st">&#39;pykyll&#39;</span> defined. Use <span class="st">&#39;task context pykyll&#39;</span> to activate.</span></code></pre></div>
<p>In this example, <code>taskwarrior_context</code> is the name of the context in taskwarrior and <code>+taskwarrior_context</code> is the tagthe value of <code>taskwarrior_context</code> prepended by a <code>+</code> sign.</p>
<p>Thats it. Now Pykyll can drop a task for the text you are working on into taskwarrior and display all pykyll related tasks. Pykyll shorthand: [i][t] YOUR_POST</p>
<p><code>vit</code> is also acessible from Pykylls [i] Integrations Menu</p>
<p>Use <code>taskwarrior context taskwarrior_context</code> to work on this project undistracted by your other tasks. <code>taskwarrior context none</code> resets the context.</p>
<p>As a convenience function, <code>vit</code> is acessible from Pykylls [i] Integrations Menu. While Pykyll is running the context is set accordingly.</p>
<hr />
</body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<meta name="author" content="ak" />
<title>Topic Types</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<link rel="stylesheet" href="../../css/post.css" />
</head>
<body>
<header id="title-block-header">
<h1 class="title">Topic Types</h1>
<p class="subtitle">Different page Types in Pykyll</p>
<p class="author">ak</p>
<p class="date">2021-Mar-10 11:32</p>
</header>
<nav id="TOC" role="doc-toc">
<ul>
<li><a href="#topics">Topics</a>
<ul>
<li><a href="#topic">Topic</a></li>
<li><a href="#blog">Blog</a></li>
<li><a href="#pages">Pages</a></li>
<li><a href="#slides">Slides</a></li>
</ul></li>
<li><a href="#pages-1">Pages</a>
<ul>
<li><a href="#pages-2">Pages</a></li>
<li><a href="#slides-1">Slides</a></li>
</ul></li>
</ul>
</nav>
<div id="BEFORE">
<a href="../../">Pykyll</a><a href="../">Docs</a> – Topic Types
</div>
<p>
Types of pages available in Pykyll
</p>
<p>Set the frontmatter tag <code>type</code> to one of the following vaues to set the type of your content page.</p>
<h2 id="topics">Topics</h2>
<p>These are the available options for a title page to a collection of texts.</p>
<h3 id="topic">Topic</h3>
<p><code>type: topic</code></p>
<ul>
<li>Table of Contents for a collection of texts. Sorted alphabetically.</li>
</ul>
<h3 id="blog">Blog</h3>
<p><code>type: blog</code></p>
<ul>
<li>Table of Contents for a collection of texts. Sorted by publication date. (Not yet implemented)</li>
</ul>
<h3 id="pages">Pages</h3>
<p><code>type: page</code></p>
<ul>
<li>default option for a content page in a collection of texts</li>
<li>choose for a flat Topic without any sub pages.</li>
</ul>
<h3 id="slides">Slides</h3>
<p><code>type: slides</code></p>
<ul>
<li>option for displaying a slide deck from the contents of a page in a collection of texts</li>
<li>chose for a flat Topic without any sub pages.</li>
</ul>
<h2 id="pages-1">Pages</h2>
<p>These are the available options for a content page in a a collection of texts.</p>
<h3 id="pages-2">Pages</h3>
<p><code>type: page</code></p>
<ul>
<li>default for regular pages</li>
</ul>
<h3 id="slides-1">Slides</h3>
<p><code>type: slides</code></p>
<ul>
<li>adds a View Slide Deck option to the top of the Page.</li>
<li>cf the Slide Deck Management document for further information.</li>
</ul>
<hr />
</body>
</html>
......@@ -164,10 +164,7 @@ Pykyll – <a href="examples">Docs </a> – <a href="my_lipsum">Lorem </a>
<li>timewarrior</li>
<li>taskwarrior</li>
</ul>
<p>To enable taskwarrior integration into Pykylls user interface, set <code>taskwarrior</code> in <code>./config.yml</code> to <code>tue</code>. It works best with Pykyll if a context is set showing only tasks tagged with <code>pykyll</code>:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true"></a><span class="ex">task</span> context define pykyll +pykyll</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true"></a><span class="ex">Are</span> you sure you want to add <span class="st">&#39;context.pykyll&#39;</span> with a value of <span class="st">&#39;+pykyll&#39;</span>? (yes/no) <span class="fu">yes</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true"></a><span class="ex">Context</span> <span class="st">&#39;pykyll&#39;</span> defined. Use <span class="st">&#39;task context pykyll&#39;</span> to activate.</span></code></pre></div>
<p>To enable <a href="examples/taskwarrior">taskwarrior integration into Pykylls user interface</a>, set <code>taskwarrior</code> in <code>./config.yml</code> to <code>tue</code>.</p>
<h2 id="documentation">Documentation</h2>
<figure>
<img src="images/pykyll_logo.png" alt="" /><figcaption>y is missing</figcaption>
......
......@@ -43,7 +43,6 @@ if __name__ == "__main__":
pkll = Pykyll(work_dir=work_dir)
if pkll.conf["taskwarrior"]:
os.system("task context " + pkll.conf["taskwarrior_context"])
sys.stdout.write("\x1b]2;" + pkll.conf["sitename"]+ "\x07")
cons = Console()
# Main Loop
# Toolz.pause()
......@@ -53,6 +52,16 @@ if __name__ == "__main__":
.format(getuser()))
print("[bold green]{}[/bold green]".format(pkll.conf["sitename"]))
cons.rule()
if pkll.conf["content_directories"]:
pkll.toc = {}
cons.clear()
for current_dir in pkll.conf["content_directories"]:
if os.path.isdir(os.path.join(work_dir, current_dir)):
pkll.check(work_dir=os.path.join(
work_dir, current_dir),
glancetime=0,
verbose=False,
quiet=True)
print(pkll.show(verbose=False, short=True))
if pkll.conf["taskwarrior"]:
print()
......@@ -128,7 +137,7 @@ if __name__ == "__main__":
"You may want to add at least one content_directories in .config.yml or simply add from main menu\n"
)
continue
elif choice == 1:
# ADD Menu
cons.clear()
......@@ -216,6 +225,7 @@ if __name__ == "__main__":
pkll.serialize()
else:
continue
# pkll.check(verbose=False, quiet=True)
elif choice == 2:
# EDIT
......
......@@ -145,7 +145,8 @@ class Pykyll:
check_dir,
topic=".",
directory_type="post",
verbose=True):
verbose=True,
quiet=False):
"""
check and populate index.md front matter
"""
......@@ -191,8 +192,7 @@ class Pykyll:
}
})
if not post.content:
if verbose:
print("\nYour document should have some content")
print("\nYour document should have some content")
post['edit'] = time.strftime('%Y-%b-%d %H:%M')
post['check'] = True
post['html'] = False
......@@ -226,19 +226,13 @@ class Pykyll:
getuser())
post['author'] = getuser()
elif "type" in str(identifier):
# print(
# "\nYour document should have a type. \"topic\", \"post\" or \"slides\"."
# )
# print(" \"topic\"\tGenerate a ToC for the subfolders ")
# print("\"post\" \t\n")
# print(
# "\"slides\" \tExport slides. Not yet implemented.\n"
# )
post["type"] = directory_type
print("\nSet frontmatter tag \"type\"to: " +
directory_type)
else:
tag = str(identifier).strip("\'")
if quiet:
print(current_file)
if tag == "title":
print(
"\nYour document should have a [bold]" + tag +
......@@ -258,31 +252,38 @@ class Pykyll:
work_dir=os.path.join("."),
directory_type="post",
glancetime=1.5,
verbose=True):
verbose=True,
quiet=False):
"""
check content_directories recursively
"""
# print("[bold]Check[/bold]")
cons = Console()
# cons.rule()
cons.rule(title="Check", characters="?")
print(work_dir)
if not quiet:
cons.rule(title="Check", characters="?")
print(work_dir)
self.checkindex(os.path.join(work_dir),
directory_type=directory_type,
verbose=verbose)
verbose=verbose,
quiet=quiet)
sleep(glancetime)
for sub_dir in os.listdir(work_dir):
current_dir = os.path.join(work_dir, sub_dir)
if os.path.isdir(current_dir):
if verbose:
if verbose and not quiet:
cons.rule()
print(work_dir)
print("\t" + Toolz.shorten(sub_dir))
self.checkindex(current_dir, topic=work_dir, verbose=verbose)
if not quiet:
print("\t" + Toolz.shorten(sub_dir))
self.checkindex(current_dir, topic=work_dir, verbose=verbose, quiet=quiet)
sleep(glancetime)
cons.print(work_dir, justify="center")
cons.rule(title="Done", characters="!")
if verbose:
if not quiet:
cons.print(work_dir, justify="center")
cons.rule(title="Done", characters="!")
if verbose and not quiet:
print()
sleep(glancetime)
with open('.tableofcontents.json', "w") as file:
......@@ -443,7 +444,7 @@ class Pykyll:
print("⏱️ " + the_time + "\n" + work_file)
return self
def show(self, work_dir=os.getcwd(), verbose=True, short=False):
def show(self, work_dir=os.getcwd(), verbose=True, short=False, sort_by="name"):
"""
minimal tabbed table of contents
"""
......@@ -786,8 +787,8 @@ class Pykyll:
"""
choices = []
for toc_item_name in self.toc:
toc_tiem = self.toc[toc_item_name]
choices.append(toc_tiem["title"] + " – " + toc_tiem["subtitle"] + "|" + toc_item_name)
toc_item = self.toc[toc_item_name]
choices.append(toc_item["title"] + " – " + toc_item["subtitle"] + "|" + toc_item_name)
# choices.append(toc_tiem["title"] + toc_tiem["subtitle"] + toc_tiem["description"] + "|" + toc_item_name)
print()
search_string = Prompt.ask("Enter fuzzy search term")
......
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