Commit ab6d3b33 authored by ak's avatar ak
Browse files

add new type: blog

parent 197d677a
Pipeline #2168 passed with stage
in 17 seconds
......@@ -83,7 +83,7 @@ Optional:
- timewarrior
- taskwarrior
To enable [taskwarrior integration into Pykylls user interface](examples/taskwarrior), set `taskwarrior` in `./config.yml` to `tue`.
To enable [taskwarrior integration into Pykylls user interface](examples/taskwarrior), set `taskwarrior` in `./config.yml` to `true`.
## Documentation
......
......@@ -3,22 +3,22 @@
#### Docs
# [Documentation Management](technical_information)
# [Documentation Management](technical_information) 2021-04-30 19:38
How to manage your software documentation with Pykyll
# [Pictures and More](picture_test)
# [Pictures and More](technical_information) 2021-04-30 19:39
How to work with pictures, audio, iframe and video embedds
# [Slide Deck Example](slides)
# [Slide Deck Example](technical_information) 2021-04-30 19:38
How to set up your post as a fancy slide show that can be remote controlled to support your on-line talk without relying on video and screen sharing, thus removing the self-referential picture-in-picture from the bigger picture.
# [Syntax](markdown_test_sheet)
# [Syntax](technical_information) 2021-04-30 19:40
Test document for markdown syntax
# [Taskwarrior Integration](taskwarrior)
# [Taskwarrior Integration](technical_information) 2021-04-30 19:38
Integrating to the project management stack
# [Topic Types](topic_types)
# [Topic Types](technical_information) 2021-04-30 19:41
Types of pages available in Pykyll
......
......@@ -2,7 +2,7 @@
author: ak
check: true
description: Documentation and Examples for Pykyll
edit: 2021-Apr-04 21:36
edit: 2021-04-30 19:46
html: true
index: /home/ak/git/pykyll/ak/index.md
subtitle: Documentation by Example
......
......@@ -10,71 +10,7 @@
- [Heading 3](#heading-3)
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
> Blockquote
>
>> Nested Blockquote
*Emphasized* **Strong** ***Emphasized Strong***
Python code block
```python
if True:
print("Hello Wold")
```
A `code statement` inline.
And so on
> #### The quarterly results look great!
>
> - Revenue was off the chart.
> - Profits were higher than ever.
>
> *Everything* is going according to **plan**.
1. First item
2. Second item
3. Third item
1. Indented item
2. Indented item
4. Fourth item
- First item
- Second item
- Third item
- Indented item
- Indented item
- Fourth item
* This is the first list item.
* Here's the second list item.
I need to add another paragraph below the second list item.
* And here's the third list item.
* This is the first list item.
* Here's the second list item.
> A blockquote would look great below the second list item.
* And here's the third list item.
Test document for markdown syntax
---
#### Syntax
......
......@@ -2,7 +2,7 @@
author: ak
check: true
description: Test document for markdown syntax
edit: 2021-Apr-15 14:35
edit: 2021-04-30 19:40
html: true
index: /home/ak/git/pykyll/ak/markdown_test_sheet/index.md
subtitle: Markdown test sheet
......
......@@ -14,94 +14,7 @@
- [Audio](#audio)
# Pictures and Embedds
---
## Pictures and Links
Regular picture is transformed into a `<figure>` HTML tag with `<figcaption>`
![Walk Way](walkway.jpg)
---
This may be a link, e.g. to the copyright holders page if not public domain
![[Link](https://wikipedia.org)](link-symbol.svg)
---
An Icon with `class="icon"`
[<img alt="Link Symbol" class="icon" src="link-symbol.svg">](https://wikipedia.org)
---
Full width picture
<img alt="Full width picture" width=100% src="black-arrow.svg">
---
Local pictures should just be dropped into the post folder. In this case: `.examples/picture_test`. The same goes for any other local content.
## Embedds
Basically all HTML Tags are simply passed through to index.html just like <em>this emphasized text</em>. To make a **bold** point, in a markdown document you can simply emphasize *like this*.
---
#### Youtube Embedded Video
This is an iframe pointing to youtube and thus breaking the no-js paradigm of this example web site.
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/-FBzpxJh5Ck" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Just look into `./examples/picture_test/index.md` to get the picture, e.g. [here](https://git.c3pb.de/ak/pykyll/-/blob/master/examples/picture_test/index.md).
---
As Pykyll comes as a no-JS website, i.e. without any client side scripting, using the HTML5 Video Tag seems the better option for a low traffic web site.
### HTML5 Video
This is a html `video` tag pointing to a file.
<video width="50%" controls src="https://cloud.harmlos.info/index.php/s/MZFPQf8Pk7g3xZp/download" type="video/ogg"></video>
---
Here, the video is stored in a NextCloud instance. How to:
- Upload video
- Share public
- Append `/download` to the public share link
- In this document:
```html
<video width="50%" controls src="https://cloud.harmlos.info/index.php/s/MZFPQf8Pk7g3xZp/download" type="video/ogg"></video>
```
**Tip** Pykyll features screen recording. Just [i] [r] from the main menu. A `.webm` and a `.gif` are created and placed in the root folder.
---
### Audio
<audio controls src="audio.mp3" type="audio/mpeg"></audio>
```html
<audio controls src="audio.mp3" type="audio/mpeg"></audio>
```
A better way to embedd audio files may be implemented in a future version. Contributions welcome.
---
#### Pictures and More
......
......@@ -2,7 +2,7 @@
author: ak
check: true
description: How to work with pictures, audio, iframe and video embedds
edit: 2021-Mar-17 00:02
edit: 2021-04-30 19:39
html: true
subtitle: How-to with Pykyll
title: Pictures and More
......
......@@ -16,64 +16,6 @@
# Pykyll Slide Decks
How to and example
Note:
Press [s] in speaker view. Allow pop-ups
---
## Set-up
- [a] Add a topic and a post in Pykyll.
- [e][p] `your_topic` `your_post` to edit:
- Change `html` frontmatter tag to `true`
- Change `type` frontmatter tag to `slides`
Note:
There there.
---
## Contents
A slide show in markdown could look like this:
```markdown
# Heading 1
- bullet 1
- bullet 2
Slide 1
---
# Heading 2
Slide 2
```
Here `---` denotes a new slide. Tip: Do not overload your slides. KISS
---
## Visual Fancy
`--` denotes a vertical slide in your presentation. Please view this on how to add [Element Attributes](https://git.c3pb.de/ak/epiphaneia/-/tree/master/slides/cyber/revealjs#element-attributes) and [Slide Addtributes](https://git.c3pb.de/ak/epiphaneia/-/tree/master/slides/cyber/revealjs#slide-attributes), e.g. to make bullet points fly in.
An extended example can be found in [the epiphaneia demo](../../epiphaneia/demo.html?changethis)
## Known Issue
The current implementation uses javascript.
---
#### Slide Deck Example
How-to with Pykyll
......
......@@ -4,7 +4,7 @@ check: true
description: How to set up your post as a fancy slide show that can be remote controlled
to support your on-line talk without relying on video and screen sharing, thus removing
the self-referential picture-in-picture from the bigger picture.
edit: 2021-Mar-08 10:14
edit: 2021-04-30 19:38
html: true
index: /home/ak/git/pykyll/examples/slides/index.md
subtitle: How-to with Pykyll
......
......@@ -8,35 +8,7 @@
- [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 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 taskwarrior_context +taskwarrior_context
```
In this example, `taskwarrior_context` is the name of the context in taskwarrior and `+taskwarrior_context` is the tag the 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
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.
---
#### Taskwarrior Integration
......
......@@ -2,7 +2,7 @@
author: ak
check: true
description: Integrating to the project management stack
edit: 2021-Mar-16 23:57
edit: 2021-04-30 19:38
html: true
subtitle: How-to for Pykyll
title: Taskwarrior Integration
......
......@@ -6,37 +6,7 @@
- [How To](#how-to)
# How To
Set up your existing repository $repo for documentation management with Pykyll:
```bash
cd $repo
❯ git submodule add https://git.c3pb.de/ak/pykyll.git
ln -s pykyll/main.py main.py
❯ ./main.py
```
in case you are using Gitlab just
```bash
cp pykyll/.gitlab-ci.yml
```
and edit it accordingly. If Gitlab Pages has been correctly set up and the runner executes successfully your project documentation will appear on-line once you have:
- Installed the pykyll submodule
- Added a topic in Pykylls [a] Add Menu: This will be your documentation folder and apart from `htmlout`, which holds your documentation web site and will in addition to the folders you are creating from within the software be the only folder ever touched by Pykyll.
- Run a [c] Concise Check from Pykylls [c] Check Menu to build up a Table of Contents
- Edit your software documentation with your favourite text editor. Tip: Can be set in Pykyll. In this way the last edited time stamp tag in the topics frontmatter will be updated
- Change the `type` frontmatter tag from `topic` to `post` for a flat hierarchy. Leave it as `topic` and add some posts to provide a manual, where the topics are the chapters
- Change the `html` frontmatter tag from `false` to `true` to include this document in the HTML export. Folder: `./htmlout`
- Don't forget to change the `sitename` in `.conf.yml` to your liking. Tip: This is available from Pykylls [e] Edit Menu
- Hit [x][h] followed by [x][s] to first align and export your contents followed by starting a local web server and opening a tab in your favourite browser
---
#### Documentation Management
......
......@@ -2,7 +2,7 @@
author: ak
check: true
description: How to manage your software documentation with Pykyll
edit: 2021-Mar-12 21:52
edit: 2021-04-30 19:38
html: true
index: /home/ak/git/pykyll/ak/tenical_information/index.md
subtitle: How-to with Pykyll
......
......@@ -20,56 +20,7 @@
- [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,7 +2,7 @@
author: ak
check: true
description: Types of pages available in Pykyll
edit: 2021-Mar-10 11:32
edit: 2021-04-30 19:41
html: true
subtitle: Different page Types in Pykyll
title: Topic Types
......
images/logo.png

129 Bytes

This diff is collapsed.
......@@ -85,7 +85,7 @@ class Pykyll:
conf = {}
VERSION = "V 0.6.8"
VERSION = "V 0.6.9"
def __init__(self, work_dir):
"""
......@@ -194,7 +194,7 @@ class Pykyll:
})
if not post.content:
print("\nYour document should have some content")
post['edit'] = time.strftime('%Y-%b-%d %H:%M')
post['edit'] = time.strftime('%Y-%m-%d %H:%M')
post['check'] = True
post['html'] = False
post.content = post['description']
......@@ -208,7 +208,7 @@ class Pykyll:
end_check = True
if not post['check']:
post['check'] = end_check
post['edit'] = time.strftime('%Y-%b-%d %H:%M')
post['edit'] = time.strftime('%Y-%m-%d %H:%M')
with open(current_file, "w") as f:
f.writelines(frontmatter.dumps(post))
if verbose:
......@@ -218,7 +218,7 @@ class Pykyll:
if "check" in str(identifier):
post['check'] = False
elif "edit" in str(identifier):
post['edit'] = time.strftime('%Y-%b-%d %H:%M')
post['edit'] = time.strftime('%Y-%m-%d %H:%M')
print("\nAdd timestamp ⏱️ " + post["edit"])
elif "html" in str(identifier):
post['html'] = False
......@@ -244,7 +244,7 @@ class Pykyll:
tag + "[/bold]\n")
value = Prompt.ask(tag, default=tag.capitalize())
post[tag] = value
post['edit'] = time.strftime('%Y-%b-%d %H:%M')
post['edit'] = time.strftime('%Y-%m-%d %H:%M')
with open(current_file, "w") as file:
file.writelines(frontmatter.dumps(post))
continue
......@@ -301,21 +301,11 @@ class Pykyll:
for check_dir in self.conf["content_directories"]:
for root, subdirs, files in os.walk(check_dir):
links = []
if subdirs:
# links = []
for subdir in subdirs:
elem_name = os.path.join(work_dir, root, subdir,
"index.md")
elem = self.toc[elem_name]
if elem["html"]:
links.append("[" + elem.get("title") + "](" + subdir +
")\n" + elem.get("subtitle"))
links = Toolz.sorted_nicely(links)
if "index.md" in files:
with open(os.path.join(root, "index.md")) as f:
post = frontmatter.load(f)
out_string = ""
if post["type"] == "topic":
if post["type"] == "topic" or post["type"] == "blog":
pass
# out_string = "{}\n\n{}\n\n{}\n\n".format(
# post["title"], post["subtitle"], post["description"])
......@@ -335,14 +325,42 @@ class Pykyll:
else:
out_string = out_string + "\n\n"
break
if links and subdirs:
out_string = out_string + \
"\n#### {}\n\n".format(post.get("title"))
for link in links:
out_string = out_string + "# " + link + "\n\n"
else:
out_string = out_string + \
re.sub("(<!--.*?-->)", "", post.content)
if subdirs:
elems = []
for subdir in subdirs:
elem_name = os.path.join(work_dir, root, subdir,
"index.md")
elem = self.toc[elem_name]
if elem["html"]:
elems.append(elem)
if post["type"] == "blog": # Sort by date
print(elems[0])
elems = sorted(elems, key=lambda x: x["edit"], reverse=True)
print(elems[0])
for elem in elems:
links.append("[" + elem.get("title") + "](" + subdir +
") " + elem.get("edit") + "\n" + elem.get("subtitle"))
if post["type"] == "topic": # Sort by -h
links = Toolz.sorted_nicely(links)
if links and subdirs:
out_string = out_string + \
"\n#### {}\n\n".format(post.get("title"))
for link in links:
out_string = out_string + "# " + link + "\n\n"
else:
out_string = out_string + \
re.sub("(<!--.*?-->)", "", post.content)
# needs rethinking
if post["type"] == "slides":
out_string = re.sub("(<!--.*?-->)", "", out_string, flags=re.MULTILINE)
......@@ -431,7 +449,7 @@ class Pykyll:
else:
with open(work_file) as f:
post = frontmatter.load(f)
the_time = time.strftime('%Y-%b-%d %H:%M')
the_time = time.strftime('%Y-%m-%d %H:%M')
try:
post['edit'] = the_time
self.toc[work_file].update({"edit": the_time})
......@@ -663,7 +681,7 @@ class Pykyll:
# print(root)
if post["type"] == "topic":
print(root)
print(root + " <- TOPIC")
index_string = "<div id=\"BEFORE\"><a href=\"../\">" + \
self.conf["sitename"] + "</a>" + " – " + \
Toolz.shorten(post["title"]) + \
......@@ -679,9 +697,26 @@ class Pykyll:
post["title"]
]))
# print(index_string)
elif post["type"] == "blog":
print(root + " <- BLOG")
index_string = "<div id=\"BEFORE\"><a href=\"../\">" + \
self.conf["sitename"] + "</a>" + " – " + \
Toolz.shorten(post["title"]) + \
"</div>\n\n" + README + "\n\n" + post.content
with open(os.path.join(work_dir, "htmlout", root, "index.html"), 'w') as f:
f.write(pypandoc.convert_text(index_string,
'html5',
format