Browse Source

Start implementing importing stuff from micropub.

micropub
hoschi-it 4 months ago
committed by hoschi-it
parent
commit
bf9fe31e56
  1. 1
      src/jekyll/_includes/unknown.html
  2. 14
      src/jekyll/_posts/2022-04-12-minimum-viable-micropub-server.md
  3. 13
      src/jekyll/_posts/2022-04-12-nanopub.md
  4. 10
      src/jekyll/_posts/2022-04-18-44446.md
  5. 11
      src/jekyll/_posts/2022-04-18-44540.md
  6. 12
      src/jekyll/_posts/2022-04-18-44640.md
  7. 12
      src/jekyll/_posts/2022-04-18-45060.md
  8. 12
      src/jekyll/_posts/2022-04-18-47160.md
  9. 12
      src/jekyll/_posts/2022-04-18-49440.md
  10. 14
      src/jekyll/_posts/2022-04-18-sitewriter.md
  11. 68
      tools/github-posts-fetch

1
src/jekyll/_includes/unknown.html

@ -0,0 +1 @@
{{ content }}

14
src/jekyll/_posts/2022-04-12-minimum-viable-micropub-server.md

@ -0,0 +1,14 @@
---
layout: post
type: unknown
date: '2022-04-12T05:37:00.000Z'
title: Minimum viable micropub server
mf-read-status:
- finished
mf-read-of:
- 'https://rhiaro.co.uk/2015/04/minimum-viable-micropub'
mf-post-status:
- published
slug: minimum-viable-micropub-server
---

13
src/jekyll/_posts/2022-04-12-nanopub.md

@ -0,0 +1,13 @@
---
layout: post
type: bookmark
date: '2022-04-12T05:37:00.000Z'
title: Nanopub
mf-bookmark-of:
- 'https://indieweb.org/nanopub'
mf-post-status:
- published
slug: nanopub
category: links
---

10
src/jekyll/_posts/2022-04-18-44446.md

@ -0,0 +1,10 @@
---
layout: post
type: note
date: '2022-04-18T12:20:46.886Z'
slug: '44446'
lang: en
category: social
---
Micropub test of creating a basic h-entry

11
src/jekyll/_posts/2022-04-18-44540.md

@ -0,0 +1,11 @@
---
layout: post
type: note
date: '2022-04-18T12:22:20.140Z'
tags: test1 test2
slug: '44540'
lang: en
category: social
---
Micropub test of creating an h-entry with categories. This post should have two categories, test1 and test2

12
src/jekyll/_posts/2022-04-18-44640.md

@ -0,0 +1,12 @@
---
layout: post
type: note
date: '2022-04-18T12:24:00.000Z'
mf-post-status:
- published
slug: '44640'
lang: en
category: social
---
Ich bin wieder da :)

12
src/jekyll/_posts/2022-04-18-45060.md

@ -0,0 +1,12 @@
---
layout: post
type: note
date: '2022-04-18T12:31:00.000Z'
mf-post-status:
- published
slug: '45060'
lang: de
category: social
---
Das ist aber jetzt eindeutig deutsch.

12
src/jekyll/_posts/2022-04-18-47160.md

@ -0,0 +1,12 @@
---
layout: post
type: note
date: '2022-04-18T13:06:00.000Z'
mf-post-status:
- published
slug: '47160'
lang: en
category: social
---
Just another test.

12
src/jekyll/_posts/2022-04-18-49440.md

@ -0,0 +1,12 @@
---
layout: post
type: like
date: '2022-04-18T13:44:00.000Z'
mf-like-of:
- 'https://example.com'
mf-post-status:
- published
slug: '49440'
category: social
---

14
src/jekyll/_posts/2022-04-18-sitewriter.md

@ -0,0 +1,14 @@
---
layout: post
type: bookmark
date: '2022-04-18T13:07:00.000Z'
title: Sitewriter
mf-bookmark-of:
- 'https://github.com/gerwitz/sitewriter'
mf-post-status:
- published
slug: sitewriter
lang: de
category: links
---
Micropub für static sites

68
tools/github-posts-fetch

@ -0,0 +1,68 @@
#!/bin/bash
# - pull posts from proxie github repo
# - convert them to my liking
# - integrate them with jekyll
# github (prefix: gh)
gh_repo_url='https://github.com/hoschi-it/hoschi-it.de/'
gh_repo_wc="/tmp/hoschi-it.de--post-proxie-$RANDOM"
# jekyll (prefix: jk)
jk_post_path='./src/jekyll/_posts'
pull_repo() {
echo "Pulling to $gh_repo_wc"
mkdir -p $(echo $gh_repo_wc)
git clone -- $(echo $gh_repo_url) $(echo $gh_repo_wc)
}
notContainsVar() {
file=$1
varname=$2
return "$(grep --regex ^$varname $file | wc -l)"
}
detectPostType() {
file=$1
if [[ $(grep --regex "^mf-bookmark" $file | wc -l) -gt 0 ]]; then
ptype="bookmark"
elif [[ $(grep --regex "^mf-like-of" $file | wc -l) -gt 0 ]]; then
ptype="like"
elif [[ $(grep --regex "^mf-\S*-of" $file | wc -l) -gt 0 ]]; then
ptype="unknown"
else
ptype="note"
fi
echo "$ptype"
}
convert() {
full_path=$1
filename=$(basename $full_path)
ptype=$(detectPostType $full_path)
echo "$filename is a $ptype."
# Setting the layout and type in front matter
sed -i -E "s/^(layout:) .*$/\1 post\ntype: $ptype/" $full_path
# Removing empty title
sed -i "s/^title: ''$//" $full_path
}
cleanup() {
echo "Cleaning up $gh_repo_wc"
rm -Rf $gh_repo_wc
}
pull_repo
for f in $gh_repo_wc/_posts/*.md
do
convert $f
cp $f $jk_post_path/
done
cleanup
Loading…
Cancel
Save