Skip to content

Commit 0fc52a3

Browse files
authored
Merge pull request #1 from okaitslinblog/main
[update] 色々と改造
2 parents b56088f + 143bd80 commit 0fc52a3

File tree

7 files changed

+85
-7
lines changed

7 files changed

+85
-7
lines changed

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
11
# BlogWriter
22
With this program you can easily post to linuxcodevblog.
3+
## 使い方
4+
0 もし写真を使う場合:URLの取得
5+
写真を使う場合、BlogWriterフォルダの中に「記事のタイトル-01.png(例:○○をする方法-01.png)」という名前で保存してください。
6+
なお、複数ある場合01を他の数字にしてください。
7+
保存したら、
8+
./getimgurl.sh 画像の名前
9+
を実行してください。
10+
画像のURL(仮)が出てきます。
11+
アップロードは./upload.shで行われます。
12+
13+
1. yyyy-mm-dd-タイトル.mdにhtmlかmdでブログの本文を書く
14+
(例:2021-08-26-○○をする方法.md)
15+
16+
2. ./blogwriter.shを実行する
17+
./blogwriter.sh 本文のファイル
18+
19+
3 ./convertc.shを実行する
20+
./convertc.sh 本文のファイル
21+
22+
4 写真の移動
23+
写真を移動させます。
24+
./mvimg.sh 画像の名前
25+
26+
4 ./upload.shを実行する
27+
./upload.sh 本文のファイル
28+
<b>もし、 「Which should be the base repository (used for e.g. querying issues) for this directory?」と聞かれたら、「okaitslinblog/okaitslinblog.github.io」と答えてください。<br>
29+
また、「Where should we push the 'gh-pages' branch?」と聞かれたら、「Create a fork of okaitslinblog/okaitslinblog.github.io」と答えてください。<br></b>

blogwriter.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
sed -i -e "1i ---" $1
3+
sed -i -e "2i layout: post" $1
4+
read -p "タイトル> " title
5+
sed -i -e "3i title: $title" $1
6+
read -p "説明・概要> " description
7+
sed -i -e "4i description: $description" $1
8+
read -p "カテゴリ> " categories
9+
sed -i -e "5i categories: $categories" $1
10+
sed -i -e "6i highlight: true" $1
11+
sed -i -e "7i disqus: true" $1
12+
read -p "筆者のDiscordユーザー名&Discordタグ(例:okaits#7534)> " author
13+
sed -i -e "8i author: $author" $1
14+
sed -i -e "9i ---" $1
15+
echo "Done."

convertc.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
sed -i -e 's/blogwriter.commands.code.start/\<pre class\=\"prettyprint\">\<code class\=\"prettyprint\"\>/g' $1
3+
sed -i -e 's/blogwriter.commands.code.end/\<\/code\>\<\/pre\>/g' $1
4+
sed -i -e 's/blogwriter.commands.toc.insert/\{\% include toc.html html\=content sanitize\=true \%\}/g' $1
5+
echo "Done."

getimgurl.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
echo "https://okaitslinblog.github.io/img/$1"
3+
exit

mvimg.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
if ls img > /dev/null 2>&1
3+
then
4+
mv $1 img/
5+
else
6+
mkdir img
7+
mv $1 img/
8+
fi
9+
echo "Done."

upload.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
if ls okaitslinblog.github.io > /dev/null 2>&1
3+
then
4+
true
5+
else
6+
gh repo clone okaitslinblog/okaitslinblog.github.io
7+
fi
8+
if ls img/* > /dev/null 2>&1
9+
then
10+
mv img/* okaitslinblog.github.io/img/
11+
fi
12+
mv $1 okaitslinblog.github.io/_posts/
13+
cd okaitslinblog.github.io
14+
ls
15+
echo "アップロード処理を開始します。"
16+
git add .
17+
git commit -m "[add] Post"
18+
gh pr create --title "[add] Post" --body "Automaticaly generated by blogwriter"
19+
echo "Done."

write.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
echo "Blog Writer Started."
33
echo 'By okaits#7534'
4-
echo "linuxcodevblog(皆の意見交流所公式ブログ)に投稿します"
4+
echo "okaitslinblogに投稿します"
55
read -p "日付(yyyy-mm-dd, 例: 2021-08-23(2021年8月23日)> " date
66
fn=$date
77
read -p "タイトル> " title
@@ -62,19 +62,19 @@ while true
6262
echo $b >> $fn
6363
done
6464
echo "アップロードします。"
65-
if ls linuxcodevblog > /dev/null 2>&1
65+
if ls okaitslinblog > /dev/null 2>&1
6666
then
67-
echo "linuxcodevblogを発見しました。cloneをキャンセルします。"
67+
echo "okaitslinblogを発見しました。cloneをキャンセルします。"
6868
else
69-
echo "linuxcodevblogがありません。cloneします。"
70-
git clone https://github.com/linuxcodevserver/linuxcodevblog
69+
echo "okaitslinblogがありません。cloneします。"
70+
git clone https://github.com/okaitslinblog/okaitslinblog.github.io
7171
echo "cloneが終わりました。"
7272
fi
73-
cd linuxcodevblog
73+
cd okaitslinblog
7474
git checkout gh-pages
7575
mv ../${fn} ./_posts/
7676
echo "アップロード処理を開始します。"
77-
echo "選択肢がでたら、絶対にlinuxcodevserver/linuxcodevblogを選んでください"
77+
echo "もし選択肢がでたら、絶対にokaitslinblog/okaitslinblog.github.ioを選んでください"
7878
gh pr create --title "[add] Post" --body "Automaticaly created by blogwriter"
7979
echo "アップロード処理が完了しました。"
8080
exit

0 commit comments

Comments
 (0)