qiita_org 0.1.12 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +178 -20
- data/README.org +148 -19
- data/figs/fig1.png +0 -0
- data/figs/fig2.png +0 -0
- data/figs/fig3.png +0 -0
- data/figs/fig4.png +0 -0
- data/figs/fig5.png +0 -0
- data/lib/qiita_org.rb +47 -8
- data/lib/qiita_org/config.rb +1 -1
- data/lib/qiita_org/get_file_path.rb +31 -0
- data/lib/qiita_org/get_file_url.rb +50 -0
- data/lib/qiita_org/get_template.rb +1 -1
- data/lib/qiita_org/md_converter_for_image.rb +29 -0
- data/lib/qiita_org/post.rb +15 -12
- data/lib/qiita_org/show_file_and_url.rb +116 -0
- data/lib/qiita_org/version.rb +1 -1
- data/{hoge.rb → tests/hoge.rb} +0 -0
- data/tests/test.html +280 -0
- data/tests/test.md +10 -0
- data/tests/test.org +26 -0
- data/tests/test2.md +6 -0
- data/tests/test2.org +21 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a463880ab35d7cad18535215cd98fa1dfc34e25828d4dfe4a253278f7d0d3c30
|
4
|
+
data.tar.gz: ccb99abcbdf89214c3e0fd600da6c1e3541b64f3576f481469a50928d62a995d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb48fcced4575c6925f603a26bf4ed958d4719a3aaea774ee48d10532e71003a8f13ee737f7fb15ebbe2eaf5cc14036a6fbff94515d022f71820d213d67fa4e1
|
7
|
+
data.tar.gz: 4d52108691f2c691e70fa31fa549a35df62106538d19845b48f732cbbde512069f5dc611b62b1c71a9b95ce697d935a76f07ba1d4028ff0fd009eb25baee1504
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,42 +1,199 @@
|
|
1
|
+
|
2
|
+
|
1
3
|
# QiitaOrg
|
2
4
|
|
3
|
-
|
5
|
+
\![Mac OS X-10.13.3](<https://img.shields.io/badge/MacOSX-10.13.3-brightgreen>) \![ruby-2.7.0p0](<https://img.shields.io/badge/ruby-2.7.0p0-brightgreen>) \![qiita\_org version](<https://img.shields.io/badge/qiitaorg-0.1.8-brightgreen>)
|
6
|
+
|
7
|
+
|
8
|
+
## 概要
|
9
|
+
|
10
|
+
qiita\_orgはqiitaへの投稿にあたって,テキストの作成から投稿までをterminal上で一括で行いたいというコンセプトでできたgemです.
|
11
|
+
|
12
|
+
emacs org-modeで作成したテキストをCUIでqiitaに投稿します.
|
13
|
+
|
14
|
+
注意点:command\_lineを使用しているのでrubyのバージョンは2.4.0以上にしてください.また,emacsのバージョンは26.3以上をお勧めします.
|
15
|
+
|
16
|
+
|
17
|
+
## 使用例
|
18
|
+
|
19
|
+
まず,org-modeの投稿用テンプレートを取得します.'qiita template'とコマンドを打ち,環境を書き込むかを決めtemplate.orgを作成します.![img](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/76dc9d92-3a77-5523-7a21-571f691402bb.png)
|
20
|
+
|
21
|
+
すると,このようなorgが作成されます.![img](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/4a38e62f-9cae-1bf1-ee51-080706c64f6f.png)
|
22
|
+
|
23
|
+
ここのtitle,tagをqiitaに載せる用のものに変更してあとは従来通り本文を書くだけ.
|
24
|
+
|
25
|
+
本文が作成できたら,あとは投稿用のコマンドを実行するだけ.試しに限定共有投稿へ投稿してみるとこんな感じ.![img](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/3f7179f4-e150-7a63-b8ba-e936b925d7be.png)
|
26
|
+
|
27
|
+
ズラズラーっと出ますが,設定がちゃんとできていれば投稿が完了し,Safariで投稿したページが開きます.
|
28
|
+
|
29
|
+
投稿した記事にはSouceとしてどこのディレクトリに元のorgテキストがあるか表示されるので,少し前の記事を編集したい時でも便利なはず...
|
30
|
+
|
31
|
+
|
32
|
+
## インストール
|
33
|
+
|
34
|
+
```bash
|
35
|
+
gem install qiita_org
|
36
|
+
```
|
37
|
+
|
38
|
+
get commandにpandocを使っているのでインストールしてください.macなら
|
39
|
+
|
40
|
+
```bash
|
41
|
+
brew install pandoc
|
42
|
+
```
|
43
|
+
|
44
|
+
ubuntuなら
|
45
|
+
|
46
|
+
```bash
|
47
|
+
sudo apt update
|
48
|
+
sudo apt install pandoc
|
49
|
+
```
|
50
|
+
|
51
|
+
|
52
|
+
## 設定ファイルの作成
|
53
|
+
|
54
|
+
```bash
|
55
|
+
qiita config global
|
56
|
+
```
|
57
|
+
|
58
|
+
とし,設定ファイルをホームディレクトリに作成する.
|
59
|
+
|
60
|
+
|
61
|
+
### Qiitaのアクセストークンの作成方法と設定ファイルへの書き込み
|
62
|
+
|
63
|
+
[<https://qiita.com/settings/applications>](<https://qiita.com/settings/applications>)にて
|
64
|
+
|
65
|
+
個人用アクセストークンの'新しくトークンを発行する'をクリック.![img](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/de93b61e-b42d-8364-7282-ee1bdbd572ad.png)
|
66
|
+
|
67
|
+
アクセストークンの説明を書き,スコープのところは画像のように全てにチェックを入れる.その後発行をおす.![img](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/7012077d-fba8-e823-d29c-dc93939b4d6b.png)
|
68
|
+
|
69
|
+
ページが移動すると個人用アクセストークンのところにアクセストークンが表示されているので,コピーしてください.(この文字列はページを移動すると再表示できなくなるので注意してください.)
|
70
|
+
|
71
|
+
ターミナルに戻り,以下のように実行.
|
72
|
+
|
73
|
+
```bash
|
74
|
+
qiita config global access_token 'your accesstoken'
|
75
|
+
```
|
76
|
+
|
77
|
+
'your accesstoken'のところには先ほどコピーしたアクセストークンをペーストしてください.
|
78
|
+
|
79
|
+
|
80
|
+
### 名前の登録
|
81
|
+
|
82
|
+
```bash
|
83
|
+
qiita config global name 'your name'
|
84
|
+
```
|
85
|
+
|
86
|
+
|
87
|
+
### メールアドレスの登録
|
88
|
+
|
89
|
+
```bash
|
90
|
+
qiita config global email 'your email'
|
91
|
+
```
|
92
|
+
|
93
|
+
|
94
|
+
### QiitaTeamURLの登録
|
95
|
+
|
96
|
+
'teams'というoptionを使うために必要なので,所属しているQiitaTeamがあるのならこの設定を行なってください.なければ設定しなくて大丈夫です.
|
97
|
+
|
98
|
+
```bash
|
99
|
+
qiita config global teams_url 'https://foge.qiita.com/'
|
100
|
+
```
|
101
|
+
|
102
|
+
URLは最後に'/'をつけるのを忘れないように注意してください.
|
103
|
+
|
4
104
|
|
5
|
-
|
105
|
+
### localの設定ファイルを作る方法
|
6
106
|
|
7
|
-
|
107
|
+
複数のTeamに所属している場合や,ディレクトリごとにメールアドレスを設定したい場合があればlocalの設定ファイルを指定できます.
|
8
108
|
|
9
|
-
|
109
|
+
設定ファイルを作りたいディレクトリにて,
|
10
110
|
|
11
|
-
```
|
12
|
-
|
111
|
+
```bash
|
112
|
+
qiita config local set
|
13
113
|
```
|
14
114
|
|
15
|
-
|
115
|
+
とし,上記の初期設定のglobalをlocalに変えてそのほかを同じように書き込んでいくとできます.
|
116
|
+
|
117
|
+
|
118
|
+
# コマンド一覧
|
119
|
+
|
120
|
+
- qiita all
|
121
|
+
- qiita config [global/local] [option] [input]
|
122
|
+
- qiita get [qiita/teams] [記事のID]
|
123
|
+
- qiita list [qiita/teams]
|
124
|
+
- qiita post [FILE] [private/public/teams]
|
125
|
+
- qiita template
|
126
|
+
|
127
|
+
|
128
|
+
## qiita all
|
129
|
+
|
130
|
+
カレントディレクトリ内の全てのorgファイルをqiitaに投稿するコマンドです.
|
131
|
+
|
132
|
+
orgファイル内にidの記載のあるものは記事の更新,id記載のないものに関しては全て限定共有投稿に投稿されます.
|
133
|
+
|
134
|
+
|
135
|
+
## qiita config
|
136
|
+
|
137
|
+
qiita\_orgの設定ファイルの作成と確認を行うコマンドです.
|
138
|
+
|
139
|
+
設定方法については上記の通りです.
|
16
140
|
|
17
|
-
$ bundle install
|
18
141
|
|
19
|
-
|
142
|
+
## qiita get
|
20
143
|
|
21
|
-
|
144
|
+
Qiitaの記事を取得するためのコマンドです.
|
22
145
|
|
23
|
-
## Usage
|
24
146
|
|
25
|
-
|
147
|
+
## 特定記事の取得方法
|
26
148
|
|
27
|
-
|
149
|
+
qiita get [qiita/teams] [記事のID]
|
28
150
|
|
29
|
-
|
151
|
+
実行することで指定した記事をid.orgとしてディレクトリ内に作成します.
|
30
152
|
|
31
|
-
To install this gem onto your local machine, run \`bundle exec rake install\`. To release a new version, update the version number in \`version.rb\`, and then run \`bundle exec rake release\`, which will create a git tag for the version, push git commits and tags, and push the \`.gem\` file to [rubygems.org](<https://rubygems.org>).
|
32
153
|
|
33
|
-
##
|
154
|
+
## 複数記事の取得方法
|
34
155
|
|
35
|
-
|
156
|
+
自分のQiitaもしくはQiitaTeamの記事を最新から100個まで表示し取得できます.
|
36
157
|
|
37
|
-
|
158
|
+
qiita get [qiita/teams]
|
159
|
+
|
160
|
+
実行するとタイトルが表示されるので,保存したければ'y'いらなければ'n'を入力する.終了は'e'
|
161
|
+
|
162
|
+
|
163
|
+
## qiita list
|
164
|
+
|
165
|
+
自分のQiitaもしくはQiitaTeamの記事を最新から100個までterminal上に表示するコマンドです.
|
166
|
+
|
167
|
+
qiita list [qiita/teams]
|
168
|
+
|
169
|
+
実行するとオプションがqiitaならtitle, URL, 記事の元となったorgファイルの場所が表示されます.
|
170
|
+
|
171
|
+
teamsの方ではさらに誰の記事かが表示されます.
|
172
|
+
|
173
|
+
|
174
|
+
## qiita post
|
175
|
+
|
176
|
+
Qiitaにorg-modeで書いたテキストを投稿するためのコマンドです.
|
177
|
+
|
178
|
+
qiita post [FILE] [private/public/teams]
|
179
|
+
|
180
|
+
FILEには投稿したいorgファイルを,privateは限定共有投稿,publicは公開記事,teamsはQiitaTeamに投稿されます.
|
181
|
+
|
182
|
+
例:
|
183
|
+
|
184
|
+
```
|
185
|
+
qiita post example.org private
|
186
|
+
```
|
187
|
+
|
188
|
+
と実行すると限定共有記事にexample.orgの内容が投稿されます.
|
189
|
+
|
190
|
+
|
191
|
+
## qiita template
|
192
|
+
|
193
|
+
qiita\_orgで投稿するためのヘッダーがついたorgファイルを取得するコマンドです.
|
194
|
+
|
195
|
+
カレントディレクトリにtemplate.orgを作成します.すでにtemplate.orgがある場合は作成されません.
|
38
196
|
|
39
|
-
The gem is available as open source under the terms of the [MIT License](<https://opensource.org/licenses/MIT>).
|
40
197
|
|
41
198
|
# future features
|
42
199
|
|
@@ -48,4 +205,5 @@ The gem is available as open source under the terms of the [MIT License](<https:
|
|
48
205
|
- giita config => configを表示
|
49
206
|
|
50
207
|
- cui, 変数名を適切に選ぶ,teams\_path -> teams\_url
|
51
|
-
- qiita getの実装,
|
208
|
+
- qiita getの実装,
|
209
|
+
|
data/README.org
CHANGED
@@ -11,46 +11,175 @@
|
|
11
11
|
|
12
12
|
|
13
13
|
* QiitaOrg
|
14
|
+
![Mac OS X-10.13.3](https://img.shields.io/badge/MacOSX-10.13.3-brightgreen) ![ruby-2.7.0p0](https://img.shields.io/badge/ruby-2.7.0p0-brightgreen) ![qiita_org version](https://img.shields.io/badge/qiitaorg-0.1.8-brightgreen)
|
15
|
+
** 概要
|
16
|
+
qiita_orgはqiitaへの投稿にあたって,テキストの作成から投稿までを
|
17
|
+
terminal上で一括で行いたいというコンセプトでできたgemです.
|
14
18
|
|
15
|
-
|
19
|
+
emacs org-modeで作成したテキストをCUIでqiitaに投稿します.
|
16
20
|
|
17
|
-
|
21
|
+
注意点:command_lineを使用しているのでrubyのバージョンは2.4.0以上にしてください.
|
22
|
+
また,emacsのバージョンは26.3以上をお勧めします.
|
23
|
+
** 使用例
|
18
24
|
|
19
|
-
|
25
|
+
まず,org-modeの投稿用テンプレートを取得します.
|
26
|
+
'qiita template'とコマンドを打ち,環境を書き込むかを決めtemplate.orgを作成します.
|
27
|
+
https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/76dc9d92-3a77-5523-7a21-571f691402bb.png
|
20
28
|
|
21
|
-
|
29
|
+
すると,このようなorgが作成されます.
|
30
|
+
https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/4a38e62f-9cae-1bf1-ee51-080706c64f6f.png
|
22
31
|
|
23
|
-
|
24
|
-
|
32
|
+
ここのtitle,tagをqiitaに載せる用のものに変更してあとは従来通り本文を書くだけ.
|
33
|
+
|
34
|
+
本文が作成できたら,あとは投稿用のコマンドを実行するだけ.
|
35
|
+
試しに限定共有投稿へ投稿してみるとこんな感じ.
|
36
|
+
https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/3f7179f4-e150-7a63-b8ba-e936b925d7be.png
|
37
|
+
|
38
|
+
ズラズラーっと出ますが,設定がちゃんとできていれば投稿が完了し,
|
39
|
+
Safariで投稿したページが開きます.
|
40
|
+
|
41
|
+
投稿した記事にはSouceとしてどこのディレクトリに元のorgテキストがあるか
|
42
|
+
表示されるので,少し前の記事を編集したい時でも便利なはず...
|
43
|
+
|
44
|
+
** インストール
|
45
|
+
#+begin_src bash
|
46
|
+
gem install qiita_org
|
47
|
+
#+end_src
|
48
|
+
|
49
|
+
get commandにpandocを使っているのでインストールしてください.
|
50
|
+
macなら
|
51
|
+
#+begin_src bash
|
52
|
+
brew install pandoc
|
53
|
+
#+end_src
|
54
|
+
|
55
|
+
ubuntuなら
|
56
|
+
#+begin_src bash
|
57
|
+
sudo apt update
|
58
|
+
sudo apt install pandoc
|
59
|
+
#+end_src
|
60
|
+
** 設定ファイルの作成
|
61
|
+
#+begin_src bash
|
62
|
+
qiita config global
|
25
63
|
#+end_src
|
26
64
|
|
27
|
-
|
65
|
+
とし,設定ファイルをホームディレクトリに作成する.
|
28
66
|
|
29
|
-
|
67
|
+
*** Qiitaのアクセストークンの作成方法と設定ファイルへの書き込み
|
68
|
+
[https://qiita.com/settings/applications](https://qiita.com/settings/applications)にて
|
30
69
|
|
31
|
-
|
70
|
+
個人用アクセストークンの'新しくトークンを発行する'をクリック.
|
71
|
+
https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/de93b61e-b42d-8364-7282-ee1bdbd572ad.png
|
32
72
|
|
33
|
-
|
73
|
+
アクセストークンの説明を書き,スコープのところは画像のように全てにチェックを入れる.その後発行をおす.
|
74
|
+
https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/7012077d-fba8-e823-d29c-dc93939b4d6b.png
|
34
75
|
|
35
|
-
|
76
|
+
ページが移動すると個人用アクセストークンのところにアクセストークンが表示されているので,
|
77
|
+
コピーしてください.(この文字列はページを移動すると再表示できなくなるので注意してください.)
|
36
78
|
|
37
|
-
|
79
|
+
ターミナルに戻り,以下のように実行.
|
80
|
+
#+begin_src bash
|
81
|
+
qiita config global access_token 'your accesstoken'
|
82
|
+
#+end_src
|
83
|
+
'your accesstoken'のところには先ほどコピーしたアクセストークンをペーストしてください.
|
38
84
|
|
39
|
-
|
85
|
+
*** 名前の登録
|
86
|
+
#+begin_src bash
|
87
|
+
qiita config global name 'your name'
|
88
|
+
#+end_src
|
40
89
|
|
41
|
-
|
90
|
+
*** メールアドレスの登録
|
91
|
+
#+begin_src bash
|
92
|
+
qiita config global email 'your email'
|
93
|
+
#+end_src
|
42
94
|
|
43
|
-
|
95
|
+
*** QiitaTeamURLの登録
|
96
|
+
'teams'というoptionを使うために必要なので,
|
97
|
+
所属しているQiitaTeamがあるのならこの設定を行なってください.
|
98
|
+
なければ設定しなくて大丈夫です.
|
99
|
+
|
100
|
+
#+begin_src bash
|
101
|
+
qiita config global teams_url 'https://foge.qiita.com/'
|
102
|
+
#+end_src
|
103
|
+
|
104
|
+
URLは最後に'/'をつけるのを忘れないように注意してください.
|
105
|
+
|
106
|
+
*** localの設定ファイルを作る方法
|
107
|
+
複数のTeamに所属している場合や,ディレクトリごとにメールアドレスを設定したい場合が
|
108
|
+
あればlocalの設定ファイルを指定できます.
|
109
|
+
|
110
|
+
設定ファイルを作りたいディレクトリにて,
|
111
|
+
#+begin_src bash
|
112
|
+
qiita config local set
|
113
|
+
#+end_src
|
44
114
|
|
45
|
-
|
115
|
+
とし,上記の初期設定のglobalをlocalに変えて
|
116
|
+
そのほかを同じように書き込んでいくとできます.
|
117
|
+
* コマンド一覧
|
118
|
+
- qiita all
|
119
|
+
- qiita config [global/local] [option] [input]
|
120
|
+
- qiita get [qiita/teams] [記事のID]
|
121
|
+
- qiita list [qiita/teams]
|
122
|
+
- qiita post [FILE] [private/public/teams]
|
123
|
+
- qiita template
|
46
124
|
|
47
|
-
|
125
|
+
** qiita all
|
126
|
+
カレントディレクトリ内の全てのorgファイルをqiitaに投稿するコマンドです.
|
48
127
|
|
128
|
+
orgファイル内にidの記載のあるものは記事の更新,id記載のないものに関しては
|
129
|
+
全て限定共有投稿に投稿されます.
|
130
|
+
|
131
|
+
** qiita config
|
132
|
+
qiita_orgの設定ファイルの作成と確認を行うコマンドです.
|
133
|
+
|
134
|
+
設定方法については上記の通りです.
|
135
|
+
|
136
|
+
** qiita get
|
137
|
+
Qiitaの記事を取得するためのコマンドです.
|
138
|
+
|
139
|
+
** 特定記事の取得方法
|
140
|
+
qiita get [qiita/teams] [記事のID]
|
141
|
+
|
142
|
+
実行することで指定した記事をid.orgとしてディレクトリ内に作成します.
|
143
|
+
|
144
|
+
** 複数記事の取得方法
|
145
|
+
自分のQiitaもしくはQiitaTeamの記事を最新から100個まで表示し取得できます.
|
146
|
+
|
147
|
+
qiita get [qiita/teams]
|
148
|
+
|
149
|
+
実行するとタイトルが表示されるので,保存したければ'y'いらなければ'n'を入力する.
|
150
|
+
終了は'e'
|
151
|
+
|
152
|
+
** qiita list
|
153
|
+
自分のQiitaもしくはQiitaTeamの記事を最新から100個まで
|
154
|
+
terminal上に表示するコマンドです.
|
155
|
+
|
156
|
+
qiita list [qiita/teams]
|
157
|
+
|
158
|
+
実行するとオプションがqiitaならtitle, URL, 記事の元となったorgファイルの場所
|
159
|
+
が表示されます.
|
160
|
+
|
161
|
+
teamsの方ではさらに誰の記事かが表示されます.
|
162
|
+
|
163
|
+
** qiita post
|
164
|
+
Qiitaにorg-modeで書いたテキストを投稿するためのコマンドです.
|
165
|
+
|
166
|
+
qiita post [FILE] [private/public/teams]
|
167
|
+
|
168
|
+
FILEには投稿したいorgファイルを,
|
169
|
+
privateは限定共有投稿,publicは公開記事,teamsはQiitaTeamに投稿されます.
|
170
|
+
|
171
|
+
例:
|
172
|
+
#+begin_src
|
173
|
+
qiita post example.org private
|
174
|
+
#+end_src
|
49
175
|
|
50
|
-
|
176
|
+
と実行すると限定共有記事にexample.orgの内容が投稿されます.
|
51
177
|
|
52
|
-
|
178
|
+
** qiita template
|
179
|
+
qiita_orgで投稿するためのヘッダーがついたorgファイルを取得するコマンドです.
|
53
180
|
|
181
|
+
カレントディレクトリにtemplate.orgを作成します.
|
182
|
+
すでにtemplate.orgがある場合は作成されません.
|
54
183
|
* future features
|
55
184
|
- qiita post => refactoring
|
56
185
|
|
data/figs/fig1.png
ADDED
Binary file
|
data/figs/fig2.png
ADDED
Binary file
|
data/figs/fig3.png
ADDED
Binary file
|
data/figs/fig4.png
ADDED
Binary file
|
data/figs/fig5.png
ADDED
Binary file
|
data/lib/qiita_org.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
require "thor"
|
2
3
|
require "colorize"
|
4
|
+
require "io/console"
|
3
5
|
require "qiita_org/version"
|
4
6
|
require "qiita_org/post"
|
5
7
|
require "qiita_org/config"
|
@@ -7,6 +9,8 @@ require "qiita_org/get"
|
|
7
9
|
require "qiita_org/list"
|
8
10
|
require "qiita_org/get_template"
|
9
11
|
require "qiita_org/check_pc_os"
|
12
|
+
require "qiita_org/get_file_path"
|
13
|
+
require "qiita_org/show_file_and_url"
|
10
14
|
#require "qiita_org/qiita_org_thor"
|
11
15
|
|
12
16
|
module QiitaOrg
|
@@ -17,8 +21,6 @@ module QiitaOrg
|
|
17
21
|
#
|
18
22
|
def initialize(*argv)
|
19
23
|
super(*argv)
|
20
|
-
checkos = CheckPcOs.new
|
21
|
-
@os = checkos.return_os()
|
22
24
|
end
|
23
25
|
|
24
26
|
desc "say_hello", "say_hello"
|
@@ -28,13 +30,16 @@ module QiitaOrg
|
|
28
30
|
puts "Hello #{name}."
|
29
31
|
end
|
30
32
|
|
31
|
-
desc "post", "post to qiita from org"
|
33
|
+
desc "post [FILE] [private/public/teams]", "post to qiita from org"
|
32
34
|
|
33
35
|
def post(*argv)
|
36
|
+
checkos = CheckPcOs.new
|
37
|
+
os = checkos.return_os()
|
38
|
+
|
34
39
|
p ["in qiita_org.rb", argv]
|
35
40
|
p file = argv[0] || "README.org"
|
36
41
|
p mode = argv[1] || "private"
|
37
|
-
qiita = QiitaPost.new(file, mode,
|
42
|
+
qiita = QiitaPost.new(file, mode, os)
|
38
43
|
begin
|
39
44
|
qiita.select_option(mode)
|
40
45
|
rescue RuntimeError => e
|
@@ -44,7 +49,32 @@ module QiitaOrg
|
|
44
49
|
end
|
45
50
|
end
|
46
51
|
|
47
|
-
desc "
|
52
|
+
desc "upload [FILE] [teams/public/private]", "upload about image to qiita"
|
53
|
+
|
54
|
+
def upload(*argv)
|
55
|
+
checkos = CheckPcOs.new
|
56
|
+
os = checkos.return_os()
|
57
|
+
|
58
|
+
p file = argv[0] || "README.org"
|
59
|
+
p mode = argv[1] || "private"
|
60
|
+
|
61
|
+
getpath = GetFilePath.new(file)
|
62
|
+
paths = getpath.get_file_path()
|
63
|
+
unless paths.empty?
|
64
|
+
showfile = ShowFile.new(paths, file, mode, os)
|
65
|
+
showfile.open_file_dir()
|
66
|
+
showfile.open_qiita()
|
67
|
+
|
68
|
+
puts "Input file URL's on #{file}? (y/n)".green
|
69
|
+
ans = STDIN.getch
|
70
|
+
|
71
|
+
if ans == "y"
|
72
|
+
showfile.input_url_to_org()
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
desc "config [global/local] [option] [input]", "set config"
|
48
78
|
|
49
79
|
def config(*argv)
|
50
80
|
status = argv[0] || "local"
|
@@ -54,7 +84,7 @@ module QiitaOrg
|
|
54
84
|
config.run
|
55
85
|
end
|
56
86
|
|
57
|
-
desc "get", "get qiita report"
|
87
|
+
desc "get [qiita/teams] [記事のID]", "get qiita report"
|
58
88
|
|
59
89
|
def get(*argv)
|
60
90
|
p mode = argv[0] || "qiita"
|
@@ -66,7 +96,10 @@ module QiitaOrg
|
|
66
96
|
desc "template", "make template.org"
|
67
97
|
|
68
98
|
def template(*argv)
|
69
|
-
|
99
|
+
checkos = CheckPcOs.new
|
100
|
+
os = checkos.return_os()
|
101
|
+
|
102
|
+
template = QiitaGetTemplate.new(os)
|
70
103
|
end
|
71
104
|
|
72
105
|
desc "all", "post all org file in the directory"
|
@@ -84,11 +117,17 @@ module QiitaOrg
|
|
84
117
|
end
|
85
118
|
end
|
86
119
|
|
87
|
-
desc "list", "view qiita report list"
|
120
|
+
desc "list [qiita/teams]", "view qiita report list"
|
88
121
|
|
89
122
|
def list(*argv)
|
90
123
|
p mode = argv[0] || "qiita"
|
91
124
|
QiitaList.new(mode)
|
92
125
|
end
|
126
|
+
|
127
|
+
desc "version", "show version"
|
128
|
+
|
129
|
+
def version
|
130
|
+
puts QiitaOrg::VERSION
|
131
|
+
end
|
93
132
|
end
|
94
133
|
end
|
data/lib/qiita_org/config.rb
CHANGED
@@ -9,7 +9,7 @@ class QiitaConfig
|
|
9
9
|
if status == "local"
|
10
10
|
search = SearchConfPath.new(Dir.pwd, Dir.home)
|
11
11
|
conf_dir = search.search_conf_path()
|
12
|
-
if
|
12
|
+
if @option == "set"
|
13
13
|
@setup = File.join(Dir.pwd, ".qiita.conf")
|
14
14
|
else
|
15
15
|
@setup = File.join(conf_dir, ".qiita.conf")
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class GetFilePath
|
2
|
+
def initialize(src)
|
3
|
+
@src = src
|
4
|
+
end
|
5
|
+
|
6
|
+
def get_file_path()
|
7
|
+
#lines = File.readlines(@src.gsub(".org", ".md"))
|
8
|
+
lines = File.readlines(@src)
|
9
|
+
files = []
|
10
|
+
lines.each do |line|
|
11
|
+
#if path2 = line.match(/\!\[img\]\(((.+))/)# "(.+)"\)/)
|
12
|
+
#if path2 = line.match(/\[\[file\:(.+)\](.+)\]\]/) || line.match(/\[\[file:(.+)\]\]/)
|
13
|
+
if path2 = line.match(/\[\[(.+)\]\[file:(.+)\]\]/) || line.match(/\[\[file:(.+)\]\]/)
|
14
|
+
if path2[2] == nil
|
15
|
+
files << path2[1]
|
16
|
+
else
|
17
|
+
files << path2[2]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
#paths = []
|
23
|
+
#files.each do |file|
|
24
|
+
#paths << File.join(Dir.pwd, file)
|
25
|
+
#end
|
26
|
+
#return paths
|
27
|
+
return files
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
#GetFilePath.new("thesis.org")
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "net/https"
|
2
|
+
require "json"
|
3
|
+
require "open-uri"
|
4
|
+
require "io/console"
|
5
|
+
require "colorize"
|
6
|
+
require "qiita_org/search_conf_path.rb"
|
7
|
+
|
8
|
+
class GetFileUrl
|
9
|
+
def initialize(id, file, mode)
|
10
|
+
@id = id
|
11
|
+
@file = file
|
12
|
+
@mode = (mode == "qiita" || mode == "open")? "public" : mode
|
13
|
+
search = SearchConfPath.new(Dir.pwd, Dir.home)
|
14
|
+
@conf_dir = search.search_conf_path()
|
15
|
+
set_config()
|
16
|
+
end
|
17
|
+
|
18
|
+
def set_config()
|
19
|
+
conf_path = File.join(@conf_dir, ".qiita.conf")
|
20
|
+
@conf = JSON.load(File.read(conf_path))
|
21
|
+
@access_token = @conf["access_token"]
|
22
|
+
@teams_url = @conf["teams_url"]
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_file_url()
|
26
|
+
qiita = (@mode == "teams")? @teams_url : "https://qiita.com/"
|
27
|
+
path = "api/v2/items/#{@id}"
|
28
|
+
|
29
|
+
items = access_qiita(@access_token, qiita, path)
|
30
|
+
|
31
|
+
file_url = items["body"].match(/\!\[#{@file}\]\(((.+))\)/)[2]
|
32
|
+
return file_url
|
33
|
+
|
34
|
+
#File.write("url_text.md", items["body"])
|
35
|
+
end
|
36
|
+
|
37
|
+
def access_qiita(access_token, qiita, path)
|
38
|
+
uri = URI.parse(qiita + path)
|
39
|
+
|
40
|
+
headers = { "Authorization" => "Bearer #{access_token}",
|
41
|
+
"Content-Type" => "application/json" }
|
42
|
+
|
43
|
+
response = URI.open(
|
44
|
+
"#{uri}",
|
45
|
+
"Authorization" => "#{headers["Authorization"]}",
|
46
|
+
)
|
47
|
+
items = JSON.parse(response.read)
|
48
|
+
return items
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class MdConverter
|
2
|
+
def initialize(lines)
|
3
|
+
@lines = lines
|
4
|
+
end
|
5
|
+
|
6
|
+
def convert_for_image()
|
7
|
+
@lines.each_with_index do |line, i|
|
8
|
+
m = []
|
9
|
+
if m = line.match(/\[\!\[img\]\((.+) "(.+)"\)\]\((.+)\)/)
|
10
|
+
path = File.basename(m[1])
|
11
|
+
url = m[3]
|
12
|
+
@lines[i] = "![#{path}](#{url})\n"
|
13
|
+
elsif m = line.match(/\[\!\[img\]\((.+)\)\]\((.+)\)/)
|
14
|
+
path = File.basename(m[1])
|
15
|
+
url = m[2]
|
16
|
+
@lines[i] = "![#{path}](#{url})\n"
|
17
|
+
else
|
18
|
+
next
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
return @lines
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
if __FILE__ == $0
|
27
|
+
p lines = File.readlines("test.md")
|
28
|
+
p lines2 = MdConverter.new(lines).convert_for_image()
|
29
|
+
end
|
data/lib/qiita_org/post.rb
CHANGED
@@ -5,6 +5,7 @@ require "json"
|
|
5
5
|
require "command_line/global"
|
6
6
|
require "colorize"
|
7
7
|
require "qiita_org/search_conf_path.rb"
|
8
|
+
require "qiita_org/md_converter_for_image"
|
8
9
|
|
9
10
|
class QiitaPost
|
10
11
|
def initialize(file, option, os)
|
@@ -19,19 +20,19 @@ class QiitaPost
|
|
19
20
|
public
|
20
21
|
def get_title_tags()
|
21
22
|
@conts = File.read(@src)
|
22
|
-
|
23
|
-
|
23
|
+
m = @conts.match(/\#\+(TITLE|title|Title): (.+)/)
|
24
|
+
@title = m ? m[2] : "テスト"
|
24
25
|
@tags = if m = @conts.match(/\#\+(TAG|tag|Tag|tags|TAGS|Tags): (.+)/)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
if m[2].count(",") >= 5
|
27
|
+
puts "The maximum number of tag is five. Please delete some tags.".red
|
28
|
+
exit
|
29
|
+
end
|
30
|
+
m[2].split(",").inject([]) do |l, c|
|
31
|
+
l << { name: c.strip } #, versions: []}
|
32
|
+
end
|
33
|
+
else
|
34
|
+
[{ name: "hoge" }] #, versions: [] }]
|
35
|
+
end
|
35
36
|
p @tags
|
36
37
|
end
|
37
38
|
|
@@ -146,6 +147,7 @@ class QiitaPost
|
|
146
147
|
system "explorer.exe #{@res_body["url"]}"
|
147
148
|
else
|
148
149
|
system "open #{@res_body["url"]}"
|
150
|
+
system "xdg-open #{@res_body["url"]}"
|
149
151
|
end
|
150
152
|
end
|
151
153
|
|
@@ -154,6 +156,7 @@ class QiitaPost
|
|
154
156
|
set_config()
|
155
157
|
convert_org_to_md()
|
156
158
|
add_source_path_in_md()
|
159
|
+
@lines = MdConverter.new(@lines).convert_for_image()
|
157
160
|
select_patch_or_post()
|
158
161
|
@qiita, @private = select_option(@option)
|
159
162
|
qiita_post()
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require "colorize"
|
2
|
+
require "qiita_org/get_file_url.rb"
|
3
|
+
|
4
|
+
class ShowFile
|
5
|
+
def initialize(paths, src, mode, os)
|
6
|
+
@paths = paths
|
7
|
+
@src = src
|
8
|
+
@mode = (mode == "qiita" || mode == "open")? "public" : mode
|
9
|
+
@os = os
|
10
|
+
search = SearchConfPath.new(Dir.pwd, Dir.home)
|
11
|
+
@conf_dir = search.search_conf_path()
|
12
|
+
end
|
13
|
+
|
14
|
+
def set_config()
|
15
|
+
conf_path = File.join(@conf_dir, ".qiita.conf")
|
16
|
+
@conf = JSON.load(File.read(conf_path))
|
17
|
+
@access_token = @conf["access_token"]
|
18
|
+
@teams_url = @conf["teams_url"]
|
19
|
+
end
|
20
|
+
|
21
|
+
def open_file_dir()
|
22
|
+
previous_paths = []
|
23
|
+
previous_paths << File.join(@paths[0].split("/")[0..-2])
|
24
|
+
if @os == "mac"
|
25
|
+
system "open #{File.join(@paths[0].split("/")[0..-2])}"
|
26
|
+
elsif @os == "windows"
|
27
|
+
system "explorer.exe #{File.join(@paths[0].split("/")[0..-2])}"
|
28
|
+
else
|
29
|
+
system "open #{File.join(@paths[0].split("/")[0..-2])}"
|
30
|
+
system "xdg-open #{File.join(@paths[0].split("/")[0..-2])}"
|
31
|
+
end
|
32
|
+
@paths.each do |path|
|
33
|
+
dir_path = File.join(path.split("/")[0..-2])
|
34
|
+
unless previous_paths.include?(dir_path)
|
35
|
+
previous_paths << dir_path
|
36
|
+
#system "open #{dir_path}"
|
37
|
+
if @os == "mac"
|
38
|
+
system "open #{dir_path}"
|
39
|
+
elsif @os == "windows"
|
40
|
+
system "explorer.exe #{dir_path}"
|
41
|
+
else
|
42
|
+
system "open #{dir_path}"
|
43
|
+
system "xdg-open #{dir_path}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def open_qiita()
|
50
|
+
conts = File.read(@src)
|
51
|
+
id = conts.match(/\#\+qiita_#{@mode}: (.+)/)[1]
|
52
|
+
|
53
|
+
set_config()
|
54
|
+
|
55
|
+
qiita = (@mode == "teams")? @teams_url : "https://qiita.com/"
|
56
|
+
path = "api/v2/items/#{id}"
|
57
|
+
|
58
|
+
items = access_qiita(@access_token, qiita, path)
|
59
|
+
|
60
|
+
if @os == "mac"
|
61
|
+
system "open #{items["url"]}"
|
62
|
+
elsif @os == "windows"
|
63
|
+
system "explorer.exe #{items["url"]}"
|
64
|
+
else
|
65
|
+
system "open #{items["url"]}"
|
66
|
+
system "xdg-open #{items["url"]}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def show_file_url()
|
71
|
+
conts = File.read(@src)
|
72
|
+
id = conts.match(/\#\+qiita_#{@mode}: (.+)/)[1]
|
73
|
+
|
74
|
+
@paths.each do |path|
|
75
|
+
file_name = File.basename(path).strip
|
76
|
+
geturl = GetFileUrl.new(id, file_name, @mode)
|
77
|
+
url = geturl.get_file_url()
|
78
|
+
puts "#{file_name}'s URL".green
|
79
|
+
puts url
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def input_url_to_org()
|
84
|
+
lines = File.readlines(@src)
|
85
|
+
conts = File.read(@src)
|
86
|
+
id = conts.match(/\#\+qiita_#{@mode}: (.+)/)[1]
|
87
|
+
|
88
|
+
@paths.each do |path|
|
89
|
+
file_name = File.basename(path).strip
|
90
|
+
geturl = GetFileUrl.new(id, file_name, @mode)
|
91
|
+
url = geturl.get_file_url()
|
92
|
+
lines.each_with_index do |line, i|
|
93
|
+
if line.match(/\[\[file:#{path}\]\]/)
|
94
|
+
#lines[i] = "[[file:# {path}][# {url}]]\n"
|
95
|
+
lines[i] = "[[#{url}][file:#{path}]]\n"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
#p lines
|
100
|
+
File.write(@src, lines.join)
|
101
|
+
end
|
102
|
+
|
103
|
+
def access_qiita(access_token, qiita, path)
|
104
|
+
uri = URI.parse(qiita + path)
|
105
|
+
|
106
|
+
headers = { "Authorization" => "Bearer #{access_token}",
|
107
|
+
"Content-Type" => "application/json" }
|
108
|
+
|
109
|
+
response = URI.open(
|
110
|
+
"#{uri}",
|
111
|
+
"Authorization" => "#{headers["Authorization"]}",
|
112
|
+
)
|
113
|
+
items = JSON.parse(response.read)
|
114
|
+
return items
|
115
|
+
end
|
116
|
+
end
|
data/lib/qiita_org/version.rb
CHANGED
data/{hoge.rb → tests/hoge.rb}
RENAMED
File without changes
|
data/tests/test.html
ADDED
@@ -0,0 +1,280 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="jp" xml:lang="jp">
|
5
|
+
<head>
|
6
|
+
<!-- 2020-10-20 火 14:30 -->
|
7
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
9
|
+
<title>test</title>
|
10
|
+
<meta name="generator" content="Org mode" />
|
11
|
+
<meta name="author" content="Kenta Yamamoto" />
|
12
|
+
<style type="text/css">
|
13
|
+
<!--/*--><![CDATA[/*><!--*/
|
14
|
+
.title { text-align: center;
|
15
|
+
margin-bottom: .2em; }
|
16
|
+
.subtitle { text-align: center;
|
17
|
+
font-size: medium;
|
18
|
+
font-weight: bold;
|
19
|
+
margin-top:0; }
|
20
|
+
.todo { font-family: monospace; color: red; }
|
21
|
+
.done { font-family: monospace; color: green; }
|
22
|
+
.priority { font-family: monospace; color: orange; }
|
23
|
+
.tag { background-color: #eee; font-family: monospace;
|
24
|
+
padding: 2px; font-size: 80%; font-weight: normal; }
|
25
|
+
.timestamp { color: #bebebe; }
|
26
|
+
.timestamp-kwd { color: #5f9ea0; }
|
27
|
+
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
|
28
|
+
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
|
29
|
+
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
|
30
|
+
.underline { text-decoration: underline; }
|
31
|
+
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
|
32
|
+
p.verse { margin-left: 3%; }
|
33
|
+
pre {
|
34
|
+
border: 1px solid #ccc;
|
35
|
+
box-shadow: 3px 3px 3px #eee;
|
36
|
+
padding: 8pt;
|
37
|
+
font-family: monospace;
|
38
|
+
overflow: auto;
|
39
|
+
margin: 1.2em;
|
40
|
+
}
|
41
|
+
pre.src {
|
42
|
+
position: relative;
|
43
|
+
overflow: visible;
|
44
|
+
padding-top: 1.2em;
|
45
|
+
}
|
46
|
+
pre.src:before {
|
47
|
+
display: none;
|
48
|
+
position: absolute;
|
49
|
+
background-color: white;
|
50
|
+
top: -10px;
|
51
|
+
right: 10px;
|
52
|
+
padding: 3px;
|
53
|
+
border: 1px solid black;
|
54
|
+
}
|
55
|
+
pre.src:hover:before { display: inline;}
|
56
|
+
/* Languages per Org manual */
|
57
|
+
pre.src-asymptote:before { content: 'Asymptote'; }
|
58
|
+
pre.src-awk:before { content: 'Awk'; }
|
59
|
+
pre.src-C:before { content: 'C'; }
|
60
|
+
/* pre.src-C++ doesn't work in CSS */
|
61
|
+
pre.src-clojure:before { content: 'Clojure'; }
|
62
|
+
pre.src-css:before { content: 'CSS'; }
|
63
|
+
pre.src-D:before { content: 'D'; }
|
64
|
+
pre.src-ditaa:before { content: 'ditaa'; }
|
65
|
+
pre.src-dot:before { content: 'Graphviz'; }
|
66
|
+
pre.src-calc:before { content: 'Emacs Calc'; }
|
67
|
+
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
|
68
|
+
pre.src-fortran:before { content: 'Fortran'; }
|
69
|
+
pre.src-gnuplot:before { content: 'gnuplot'; }
|
70
|
+
pre.src-haskell:before { content: 'Haskell'; }
|
71
|
+
pre.src-hledger:before { content: 'hledger'; }
|
72
|
+
pre.src-java:before { content: 'Java'; }
|
73
|
+
pre.src-js:before { content: 'Javascript'; }
|
74
|
+
pre.src-latex:before { content: 'LaTeX'; }
|
75
|
+
pre.src-ledger:before { content: 'Ledger'; }
|
76
|
+
pre.src-lisp:before { content: 'Lisp'; }
|
77
|
+
pre.src-lilypond:before { content: 'Lilypond'; }
|
78
|
+
pre.src-lua:before { content: 'Lua'; }
|
79
|
+
pre.src-matlab:before { content: 'MATLAB'; }
|
80
|
+
pre.src-mscgen:before { content: 'Mscgen'; }
|
81
|
+
pre.src-ocaml:before { content: 'Objective Caml'; }
|
82
|
+
pre.src-octave:before { content: 'Octave'; }
|
83
|
+
pre.src-org:before { content: 'Org mode'; }
|
84
|
+
pre.src-oz:before { content: 'OZ'; }
|
85
|
+
pre.src-plantuml:before { content: 'Plantuml'; }
|
86
|
+
pre.src-processing:before { content: 'Processing.js'; }
|
87
|
+
pre.src-python:before { content: 'Python'; }
|
88
|
+
pre.src-R:before { content: 'R'; }
|
89
|
+
pre.src-ruby:before { content: 'Ruby'; }
|
90
|
+
pre.src-sass:before { content: 'Sass'; }
|
91
|
+
pre.src-scheme:before { content: 'Scheme'; }
|
92
|
+
pre.src-screen:before { content: 'Gnu Screen'; }
|
93
|
+
pre.src-sed:before { content: 'Sed'; }
|
94
|
+
pre.src-sh:before { content: 'shell'; }
|
95
|
+
pre.src-sql:before { content: 'SQL'; }
|
96
|
+
pre.src-sqlite:before { content: 'SQLite'; }
|
97
|
+
/* additional languages in org.el's org-babel-load-languages alist */
|
98
|
+
pre.src-forth:before { content: 'Forth'; }
|
99
|
+
pre.src-io:before { content: 'IO'; }
|
100
|
+
pre.src-J:before { content: 'J'; }
|
101
|
+
pre.src-makefile:before { content: 'Makefile'; }
|
102
|
+
pre.src-maxima:before { content: 'Maxima'; }
|
103
|
+
pre.src-perl:before { content: 'Perl'; }
|
104
|
+
pre.src-picolisp:before { content: 'Pico Lisp'; }
|
105
|
+
pre.src-scala:before { content: 'Scala'; }
|
106
|
+
pre.src-shell:before { content: 'Shell Script'; }
|
107
|
+
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
|
108
|
+
/* additional language identifiers per "defun org-babel-execute"
|
109
|
+
in ob-*.el */
|
110
|
+
pre.src-cpp:before { content: 'C++'; }
|
111
|
+
pre.src-abc:before { content: 'ABC'; }
|
112
|
+
pre.src-coq:before { content: 'Coq'; }
|
113
|
+
pre.src-groovy:before { content: 'Groovy'; }
|
114
|
+
/* additional language identifiers from org-babel-shell-names in
|
115
|
+
ob-shell.el: ob-shell is the only babel language using a lambda to put
|
116
|
+
the execution function name together. */
|
117
|
+
pre.src-bash:before { content: 'bash'; }
|
118
|
+
pre.src-csh:before { content: 'csh'; }
|
119
|
+
pre.src-ash:before { content: 'ash'; }
|
120
|
+
pre.src-dash:before { content: 'dash'; }
|
121
|
+
pre.src-ksh:before { content: 'ksh'; }
|
122
|
+
pre.src-mksh:before { content: 'mksh'; }
|
123
|
+
pre.src-posh:before { content: 'posh'; }
|
124
|
+
/* Additional Emacs modes also supported by the LaTeX listings package */
|
125
|
+
pre.src-ada:before { content: 'Ada'; }
|
126
|
+
pre.src-asm:before { content: 'Assembler'; }
|
127
|
+
pre.src-caml:before { content: 'Caml'; }
|
128
|
+
pre.src-delphi:before { content: 'Delphi'; }
|
129
|
+
pre.src-html:before { content: 'HTML'; }
|
130
|
+
pre.src-idl:before { content: 'IDL'; }
|
131
|
+
pre.src-mercury:before { content: 'Mercury'; }
|
132
|
+
pre.src-metapost:before { content: 'MetaPost'; }
|
133
|
+
pre.src-modula-2:before { content: 'Modula-2'; }
|
134
|
+
pre.src-pascal:before { content: 'Pascal'; }
|
135
|
+
pre.src-ps:before { content: 'PostScript'; }
|
136
|
+
pre.src-prolog:before { content: 'Prolog'; }
|
137
|
+
pre.src-simula:before { content: 'Simula'; }
|
138
|
+
pre.src-tcl:before { content: 'tcl'; }
|
139
|
+
pre.src-tex:before { content: 'TeX'; }
|
140
|
+
pre.src-plain-tex:before { content: 'Plain TeX'; }
|
141
|
+
pre.src-verilog:before { content: 'Verilog'; }
|
142
|
+
pre.src-vhdl:before { content: 'VHDL'; }
|
143
|
+
pre.src-xml:before { content: 'XML'; }
|
144
|
+
pre.src-nxml:before { content: 'XML'; }
|
145
|
+
/* add a generic configuration mode; LaTeX export needs an additional
|
146
|
+
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
|
147
|
+
pre.src-conf:before { content: 'Configuration File'; }
|
148
|
+
|
149
|
+
table { border-collapse:collapse; }
|
150
|
+
caption.t-above { caption-side: top; }
|
151
|
+
caption.t-bottom { caption-side: bottom; }
|
152
|
+
td, th { vertical-align:top; }
|
153
|
+
th.org-right { text-align: center; }
|
154
|
+
th.org-left { text-align: center; }
|
155
|
+
th.org-center { text-align: center; }
|
156
|
+
td.org-right { text-align: right; }
|
157
|
+
td.org-left { text-align: left; }
|
158
|
+
td.org-center { text-align: center; }
|
159
|
+
dt { font-weight: bold; }
|
160
|
+
.footpara { display: inline; }
|
161
|
+
.footdef { margin-bottom: 1em; }
|
162
|
+
.figure { padding: 1em; }
|
163
|
+
.figure p { text-align: center; }
|
164
|
+
.equation-container {
|
165
|
+
display: table;
|
166
|
+
text-align: center;
|
167
|
+
width: 100%;
|
168
|
+
}
|
169
|
+
.equation {
|
170
|
+
vertical-align: middle;
|
171
|
+
}
|
172
|
+
.equation-label {
|
173
|
+
display: table-cell;
|
174
|
+
text-align: right;
|
175
|
+
vertical-align: middle;
|
176
|
+
}
|
177
|
+
.inlinetask {
|
178
|
+
padding: 10px;
|
179
|
+
border: 2px solid gray;
|
180
|
+
margin: 10px;
|
181
|
+
background: #ffffcc;
|
182
|
+
}
|
183
|
+
#org-div-home-and-up
|
184
|
+
{ text-align: right; font-size: 70%; white-space: nowrap; }
|
185
|
+
textarea { overflow-x: auto; }
|
186
|
+
.linenr { font-size: smaller }
|
187
|
+
.code-highlighted { background-color: #ffff00; }
|
188
|
+
.org-info-js_info-navigation { border-style: none; }
|
189
|
+
#org-info-js_console-label
|
190
|
+
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
|
191
|
+
.org-info-js_search-highlight
|
192
|
+
{ background-color: #ffff00; color: #000000; font-weight: bold; }
|
193
|
+
.org-svg { width: 90%; }
|
194
|
+
/*]]>*/-->
|
195
|
+
</style>
|
196
|
+
<script type="text/javascript">
|
197
|
+
/*
|
198
|
+
@licstart The following is the entire license notice for the
|
199
|
+
JavaScript code in this tag.
|
200
|
+
|
201
|
+
Copyright (C) 2012-2020 Free Software Foundation, Inc.
|
202
|
+
|
203
|
+
The JavaScript code in this tag is free software: you can
|
204
|
+
redistribute it and/or modify it under the terms of the GNU
|
205
|
+
General Public License (GNU GPL) as published by the Free Software
|
206
|
+
Foundation, either version 3 of the License, or (at your option)
|
207
|
+
any later version. The code is distributed WITHOUT ANY WARRANTY;
|
208
|
+
without even the implied warranty of MERCHANTABILITY or FITNESS
|
209
|
+
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
210
|
+
|
211
|
+
As additional permission under GNU GPL version 3 section 7, you
|
212
|
+
may distribute non-source (e.g., minimized or compacted) forms of
|
213
|
+
that code without the copy of the GNU GPL normally required by
|
214
|
+
section 4, provided you include this license notice and a URL
|
215
|
+
through which recipients can access the Corresponding Source.
|
216
|
+
|
217
|
+
|
218
|
+
@licend The above is the entire license notice
|
219
|
+
for the JavaScript code in this tag.
|
220
|
+
*/
|
221
|
+
<!--/*--><![CDATA[/*><!--*/
|
222
|
+
function CodeHighlightOn(elem, id)
|
223
|
+
{
|
224
|
+
var target = document.getElementById(id);
|
225
|
+
if(null != target) {
|
226
|
+
elem.cacheClassElem = elem.className;
|
227
|
+
elem.cacheClassTarget = target.className;
|
228
|
+
target.className = "code-highlighted";
|
229
|
+
elem.className = "code-highlighted";
|
230
|
+
}
|
231
|
+
}
|
232
|
+
function CodeHighlightOff(elem, id)
|
233
|
+
{
|
234
|
+
var target = document.getElementById(id);
|
235
|
+
if(elem.cacheClassElem)
|
236
|
+
elem.className = elem.cacheClassElem;
|
237
|
+
if(elem.cacheClassTarget)
|
238
|
+
target.className = elem.cacheClassTarget;
|
239
|
+
}
|
240
|
+
/*]]>*///-->
|
241
|
+
</script>
|
242
|
+
</head>
|
243
|
+
<body>
|
244
|
+
<div id="content">
|
245
|
+
<h1 class="title">test</h1>
|
246
|
+
<p>
|
247
|
+
![Mac OS X-10.13.3](<a href="https://img.shields.io/badge/MacOSX-10.13.3-brightgreen">https://img.shields.io/badge/MacOSX-10.13.3-brightgreen</a>) ![ruby-2.7.0p0](<a href="https://img.shields.io/badge/ruby-2.7.0p0-brightgreen">https://img.shields.io/badge/ruby-2.7.0p0-brightgreen</a>)
|
248
|
+
</p>
|
249
|
+
|
250
|
+
<p>
|
251
|
+
fogefoge
|
252
|
+
</p>
|
253
|
+
|
254
|
+
|
255
|
+
<div class="figure">
|
256
|
+
<p><a href="figs/fig1.png"><img src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/a3b2ab02-f903-f5d6-d8b9-5407e8db5a2a.png" alt="a3b2ab02-f903-f5d6-d8b9-5407e8db5a2a.png" /></a>
|
257
|
+
</p>
|
258
|
+
</div>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
<div id="org244c236" class="figure">
|
263
|
+
<p><img src="figs/fig2.png" alt="fig2.png" />
|
264
|
+
</p>
|
265
|
+
<p><span class="figure-number">Figure 2: </span>example qiita template command</p>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
|
269
|
+
<div class="figure">
|
270
|
+
<p><img src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/a3b2ab02-f903-f5d6-d8b9-5407e8db5a2a.png" alt="a3b2ab02-f903-f5d6-d8b9-5407e8db5a2a.png" />
|
271
|
+
</p>
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
<div id="postamble" class="status">
|
275
|
+
<p class="author">Author: Kenta Yamamoto</p>
|
276
|
+
<p class="date">Created: 2020-10-20 火 14:30</p>
|
277
|
+
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
278
|
+
</div>
|
279
|
+
</body>
|
280
|
+
</html>
|
data/tests/test.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
\![Mac OS X-10.13.3](<https://img.shields.io/badge/MacOSX-10.13.3-brightgreen>) \![ruby-2.7.0p0](<https://img.shields.io/badge/ruby-2.7.0p0-brightgreen>)
|
2
|
+
|
3
|
+
fogefoge
|
4
|
+
|
5
|
+
[![img](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/a3b2ab02-f903-f5d6-d8b9-5407e8db5a2a.png)](file:///Users/kentayamamoto/Github/qiita_org/figs/fig1.png)
|
6
|
+
|
7
|
+
![img](../figs/fig2.png "example qiita template command")
|
8
|
+
|
9
|
+
![img](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/a3b2ab02-f903-f5d6-d8b9-5407e8db5a2a.png)
|
10
|
+
|
data/tests/test.org
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#+qiita_private: 5f8c73e8007e52ef3f40
|
2
|
+
#+OPTIONS: ^:{}
|
3
|
+
#+STARTUP: indent nolineimages
|
4
|
+
#+TITLE: test
|
5
|
+
#+AUTHOR: Kenta Yamamoto
|
6
|
+
#+EMAIL: (concat "doi35077@kwansei.ac.jp")
|
7
|
+
#+LANGUAGE: jp
|
8
|
+
# +OPTIONS: H:4 toc:t num:2
|
9
|
+
#+OPTIONS: toc:nil
|
10
|
+
#+TAG: test
|
11
|
+
# +SETUPFILE: ~/.emacs.d/org-mode/theme-readtheorg.setup
|
12
|
+
|
13
|
+
![Mac OS X-10.13.3](https://img.shields.io/badge/MacOSX-10.13.3-brightgreen) ![ruby-2.7.0p0](https://img.shields.io/badge/ruby-2.7.0p0-brightgreen)
|
14
|
+
|
15
|
+
fogefoge
|
16
|
+
# +caption: example qiita template command
|
17
|
+
# +name: fig:fig1
|
18
|
+
#+ATTR_LATEX: :width 8cm
|
19
|
+
[[file:~/Github/qiita_org/figs/fig1.png][https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/a3b2ab02-f903-f5d6-d8b9-5407e8db5a2a.png]]
|
20
|
+
|
21
|
+
|
22
|
+
#+caption: example qiita template command
|
23
|
+
#+name: fig:fig1
|
24
|
+
[[file:../figs/fig2.png]]
|
25
|
+
|
26
|
+
https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/a3b2ab02-f903-f5d6-d8b9-5407e8db5a2a.png
|
data/tests/test2.md
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
\![Mac OS X-10.13.3](<https://img.shields.io/badge/MacOSX-10.13.3-brightgreen>) \![ruby-2.7.0p0](<https://img.shields.io/badge/ruby-2.7.0p0-brightgreen>)
|
2
|
+
|
3
|
+
fogefoge
|
4
|
+
|
5
|
+
[![img](../figs/fig1.png)](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/ebf505d2-6960-6bb9-20f0-e16dab142f4a.png)
|
6
|
+
|
data/tests/test2.org
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#+qiita_private: ca3a6b6e1f5e8c0ba743
|
2
|
+
#+OPTIONS: ^:{}
|
3
|
+
#+STARTUP: indent nolineimages
|
4
|
+
#+TITLE: test
|
5
|
+
#+AUTHOR: Kenta Yamamoto
|
6
|
+
#+EMAIL: (concat "doi35077@kwansei.ac.jp")
|
7
|
+
#+LANGUAGE: jp
|
8
|
+
# +OPTIONS: H:4 toc:t num:2
|
9
|
+
#+OPTIONS: toc:nil
|
10
|
+
#+TAG: test
|
11
|
+
# +SETUPFILE: ~/.emacs.d/org-mode/theme-readtheorg.setup
|
12
|
+
|
13
|
+
![Mac OS X-10.13.3](https://img.shields.io/badge/MacOSX-10.13.3-brightgreen) ![ruby-2.7.0p0](https://img.shields.io/badge/ruby-2.7.0p0-brightgreen)
|
14
|
+
|
15
|
+
fogefoge
|
16
|
+
# +caption: example qiita template command
|
17
|
+
# +name: fig:fig1
|
18
|
+
#+ATTR_LATEX: :width 8cm
|
19
|
+
[[https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/ebf505d2-6960-6bb9-20f0-e16dab142f4a.png][file:../figs/fig1.png]]
|
20
|
+
|
21
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qiita_org
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenta Yamamoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -510,6 +510,11 @@ files:
|
|
510
510
|
- bin/setup
|
511
511
|
- exe/qiita
|
512
512
|
- exe/qiita_org
|
513
|
+
- figs/fig1.png
|
514
|
+
- figs/fig2.png
|
515
|
+
- figs/fig3.png
|
516
|
+
- figs/fig4.png
|
517
|
+
- figs/fig5.png
|
513
518
|
- gems/ruby/2.7.0/bin/htmldiff
|
514
519
|
- gems/ruby/2.7.0/bin/ldiff
|
515
520
|
- gems/ruby/2.7.0/bin/qiita
|
@@ -950,22 +955,31 @@ files:
|
|
950
955
|
- gems/ruby/2.7.0/specifications/rspec-mocks-3.9.1.gemspec
|
951
956
|
- gems/ruby/2.7.0/specifications/rspec-support-3.9.3.gemspec
|
952
957
|
- gems/ruby/2.7.0/specifications/thor-1.0.1.gemspec
|
953
|
-
- hoge.rb
|
954
958
|
- lib/qiita_org.rb
|
955
959
|
- lib/qiita_org/.qiita.conf
|
956
960
|
- lib/qiita_org/check_pc_os.rb
|
957
961
|
- lib/qiita_org/config.json
|
958
962
|
- lib/qiita_org/config.rb
|
959
963
|
- lib/qiita_org/get.rb
|
964
|
+
- lib/qiita_org/get_file_path.rb
|
965
|
+
- lib/qiita_org/get_file_url.rb
|
960
966
|
- lib/qiita_org/get_template.rb
|
961
967
|
- lib/qiita_org/hoge.txt
|
962
968
|
- lib/qiita_org/list.rb
|
969
|
+
- lib/qiita_org/md_converter_for_image.rb
|
963
970
|
- lib/qiita_org/ox-qmd/ox-qmd.el
|
964
971
|
- lib/qiita_org/post.rb
|
965
972
|
- lib/qiita_org/search_conf_path.rb
|
973
|
+
- lib/qiita_org/show_file_and_url.rb
|
966
974
|
- lib/qiita_org/template.org
|
967
975
|
- lib/qiita_org/version.rb
|
968
976
|
- qiita_org.gemspec
|
977
|
+
- tests/hoge.rb
|
978
|
+
- tests/test.html
|
979
|
+
- tests/test.md
|
980
|
+
- tests/test.org
|
981
|
+
- tests/test2.md
|
982
|
+
- tests/test2.org
|
969
983
|
homepage: https://github.com/yamatoken/qiita_org
|
970
984
|
licenses:
|
971
985
|
- MIT
|