ppz-bin 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/asset/style/ppz.css +141 -0
- data/asset/style/ppz.styl +126 -0
- data/bin/common.rb +38 -0
- data/bin/doc.rb +17 -0
- data/bin/folder.rb +8 -0
- data/bin/ppz +17 -0
- metadata +63 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: dc9adcc9753795a84dc0f393f422d577d56ee6c02845c0cb69181e4183322bd8
|
|
4
|
+
data.tar.gz: 81969839bb90602d99b0d3417784548509ec66c95e3e6b7de4bd8000a98caed9
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a903bddfebbd87a722a81d0c3f02bb4977a800a9e08fad0dc87db272e45c9df3e2f03b019151d73c18af9df195bba1dea3730a90e74e03683912277eb2b05aa3
|
|
7
|
+
data.tar.gz: e71b0fd6ba195ed5ae272711af392843cbc9a8dfd2851fbae2ba7b7bf399c89c7c661d062fe264dccb1d5f83672f6dd4bee6b215a2296c96aad6d1d8ee5c227e
|
data/asset/style/ppz.css
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
html {
|
|
2
|
+
line-height: 1.5;
|
|
3
|
+
}
|
|
4
|
+
body,
|
|
5
|
+
div,
|
|
6
|
+
p,
|
|
7
|
+
aside {
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
}
|
|
10
|
+
body {
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
aside {
|
|
16
|
+
overflow-y: auto;
|
|
17
|
+
padding: 2rem 1rem;
|
|
18
|
+
position: fixed;
|
|
19
|
+
top: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
width: 188px;
|
|
22
|
+
height: 100vh;
|
|
23
|
+
}
|
|
24
|
+
aside ul {
|
|
25
|
+
margin: 0 0 0 1rem;
|
|
26
|
+
padding: 0;
|
|
27
|
+
list-style: none;
|
|
28
|
+
}
|
|
29
|
+
aside a {
|
|
30
|
+
width: 100%;
|
|
31
|
+
display: block;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
text-overflow: ellipsis;
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
}
|
|
36
|
+
.ancestor-nav ul {
|
|
37
|
+
margin: 0;
|
|
38
|
+
padding: 0;
|
|
39
|
+
list-style: none;
|
|
40
|
+
font-size: 0.8rem;
|
|
41
|
+
margin: 1rem 2rem 0 0;
|
|
42
|
+
text-align: right;
|
|
43
|
+
}
|
|
44
|
+
.ancestor-nav li {
|
|
45
|
+
margin: 0;
|
|
46
|
+
padding: 0;
|
|
47
|
+
display: inline-block;
|
|
48
|
+
}
|
|
49
|
+
.ancestor-nav li a {
|
|
50
|
+
display: inline-block;
|
|
51
|
+
opacity: 0.66;
|
|
52
|
+
transition: all 0.3s;
|
|
53
|
+
}
|
|
54
|
+
.ancestor-nav li a:hover {
|
|
55
|
+
opacity: 1;
|
|
56
|
+
transform: scale(1.1, 1.1);
|
|
57
|
+
}
|
|
58
|
+
.ancestor-nav li:not(.self)::after {
|
|
59
|
+
content: '/';
|
|
60
|
+
margin: 0 0.36rem;
|
|
61
|
+
}
|
|
62
|
+
article {
|
|
63
|
+
margin-left: 188px;
|
|
64
|
+
padding: 1px 2rem 1rem 1rem;
|
|
65
|
+
}
|
|
66
|
+
h1 {
|
|
67
|
+
font-size: 2rem;
|
|
68
|
+
}
|
|
69
|
+
h2 {
|
|
70
|
+
font-size: 1.3rem;
|
|
71
|
+
}
|
|
72
|
+
h3 {
|
|
73
|
+
font-size: 1.1rem;
|
|
74
|
+
opacity: 0.9;
|
|
75
|
+
}
|
|
76
|
+
h1::before,
|
|
77
|
+
h2::before,
|
|
78
|
+
h3::before {
|
|
79
|
+
content: '# ';
|
|
80
|
+
opacity: 0.3;
|
|
81
|
+
font-size: 1rem;
|
|
82
|
+
}
|
|
83
|
+
.comment-container {
|
|
84
|
+
margin: 1rem 0;
|
|
85
|
+
padding: 1rem 1.6rem;
|
|
86
|
+
background: rgba(0,0,0,0.2);
|
|
87
|
+
font-size: 0.9rem;
|
|
88
|
+
border-radius: 4px;
|
|
89
|
+
}
|
|
90
|
+
.comment-item {
|
|
91
|
+
opacity: 0.8;
|
|
92
|
+
}
|
|
93
|
+
.special-block-container {
|
|
94
|
+
background: #141c22;
|
|
95
|
+
overflow: auto;
|
|
96
|
+
border-radius: 4px;
|
|
97
|
+
color: #eee;
|
|
98
|
+
font-family: monospace;
|
|
99
|
+
white-space: pre;
|
|
100
|
+
margin: 1rem 0;
|
|
101
|
+
padding: 1rem;
|
|
102
|
+
counter-reset: line-index;
|
|
103
|
+
}
|
|
104
|
+
.special-block-item::before {
|
|
105
|
+
counter-increment: line-index;
|
|
106
|
+
content: counter(line-index) " | ";
|
|
107
|
+
opacity: 0.3;
|
|
108
|
+
}
|
|
109
|
+
.special-block-item:hover::before {
|
|
110
|
+
opacity: 0.8;
|
|
111
|
+
}
|
|
112
|
+
.special-txt {
|
|
113
|
+
background: rgba(27,31,35,0.05);
|
|
114
|
+
border-radius: 4px;
|
|
115
|
+
font-size: 0.9em;
|
|
116
|
+
padding: 2px 4px;
|
|
117
|
+
}
|
|
118
|
+
.interpage-nav {
|
|
119
|
+
margin: 1rem 2rem 2rem 188px;
|
|
120
|
+
padding: 0 2rem;
|
|
121
|
+
list-style: none;
|
|
122
|
+
}
|
|
123
|
+
.interpage-nav .prev {
|
|
124
|
+
float: left;
|
|
125
|
+
}
|
|
126
|
+
.interpage-nav .prev::before {
|
|
127
|
+
content: '上一篇:';
|
|
128
|
+
opacity: 0.6;
|
|
129
|
+
}
|
|
130
|
+
.interpage-nav .next {
|
|
131
|
+
float: right;
|
|
132
|
+
}
|
|
133
|
+
.interpage-nav .next::before {
|
|
134
|
+
content: '下一篇:';
|
|
135
|
+
opacity: 0.6;
|
|
136
|
+
}
|
|
137
|
+
.interpage-nav::after {
|
|
138
|
+
content: '';
|
|
139
|
+
display: block;
|
|
140
|
+
clear: both;
|
|
141
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
nav-width = 188px
|
|
2
|
+
|
|
3
|
+
html
|
|
4
|
+
line-height 1.5
|
|
5
|
+
body, div, p, aside
|
|
6
|
+
box-sizing border-box
|
|
7
|
+
|
|
8
|
+
body
|
|
9
|
+
margin 0
|
|
10
|
+
padding 0
|
|
11
|
+
position relative
|
|
12
|
+
|
|
13
|
+
aside
|
|
14
|
+
overflow-y auto
|
|
15
|
+
padding: 2rem 1rem;
|
|
16
|
+
|
|
17
|
+
position fixed
|
|
18
|
+
top 0
|
|
19
|
+
left 0
|
|
20
|
+
width nav-width
|
|
21
|
+
height 100vh
|
|
22
|
+
|
|
23
|
+
ul
|
|
24
|
+
margin 0 0 0 1rem
|
|
25
|
+
padding 0
|
|
26
|
+
list-style none
|
|
27
|
+
a
|
|
28
|
+
width 100%
|
|
29
|
+
display block
|
|
30
|
+
overflow hidden
|
|
31
|
+
text-overflow ellipsis
|
|
32
|
+
white-space nowrap
|
|
33
|
+
.ancestor-nav
|
|
34
|
+
ul
|
|
35
|
+
margin 0
|
|
36
|
+
padding 0
|
|
37
|
+
list-style none
|
|
38
|
+
font-size 0.8rem
|
|
39
|
+
margin 1rem 2rem 0 0
|
|
40
|
+
text-align right
|
|
41
|
+
li
|
|
42
|
+
margin 0
|
|
43
|
+
padding 0
|
|
44
|
+
display inline-block
|
|
45
|
+
a
|
|
46
|
+
display inline-block
|
|
47
|
+
opacity 0.66
|
|
48
|
+
transition all 0.3s
|
|
49
|
+
&:hover
|
|
50
|
+
opacity 1
|
|
51
|
+
transform scale(1.1, 1.1)
|
|
52
|
+
&:not(.self)::after
|
|
53
|
+
content '/'
|
|
54
|
+
margin 0 .36rem
|
|
55
|
+
|
|
56
|
+
article
|
|
57
|
+
margin-left nav-width
|
|
58
|
+
padding: 1px 2rem 1rem 1rem
|
|
59
|
+
h1
|
|
60
|
+
font-size 2rem
|
|
61
|
+
h2
|
|
62
|
+
font-size 1.3rem
|
|
63
|
+
h3
|
|
64
|
+
font-size 1.1rem
|
|
65
|
+
opacity 0.9
|
|
66
|
+
|
|
67
|
+
h1, h2, h3
|
|
68
|
+
&::before
|
|
69
|
+
content '# '
|
|
70
|
+
opacity 0.3
|
|
71
|
+
font-size 1rem
|
|
72
|
+
|
|
73
|
+
.comment-container
|
|
74
|
+
margin 1rem 0
|
|
75
|
+
padding 1rem 1.6rem
|
|
76
|
+
background rgba(0, 0, 0, 0.2)
|
|
77
|
+
font-size 0.9rem
|
|
78
|
+
border-radius 4px
|
|
79
|
+
.comment-item
|
|
80
|
+
opacity 0.8
|
|
81
|
+
|
|
82
|
+
.special-block-container
|
|
83
|
+
background #141c22
|
|
84
|
+
overflow auto
|
|
85
|
+
border-radius 4px
|
|
86
|
+
color #eeeeee
|
|
87
|
+
|
|
88
|
+
font-family monospace
|
|
89
|
+
white-space pre
|
|
90
|
+
|
|
91
|
+
margin 1rem 0
|
|
92
|
+
padding 1rem
|
|
93
|
+
|
|
94
|
+
counter-reset line-index
|
|
95
|
+
.special-block-item
|
|
96
|
+
&::before
|
|
97
|
+
counter-increment line-index
|
|
98
|
+
content counter(line-index) " | "
|
|
99
|
+
opacity 0.3
|
|
100
|
+
&:hover::before
|
|
101
|
+
opacity 0.8
|
|
102
|
+
|
|
103
|
+
.special-txt
|
|
104
|
+
background rgba(27, 31, 35, 0.05)
|
|
105
|
+
border-radius 4px
|
|
106
|
+
font-size 0.9em
|
|
107
|
+
padding 2px 4px
|
|
108
|
+
|
|
109
|
+
.interpage-nav
|
|
110
|
+
margin 1rem 2rem 2rem nav-width
|
|
111
|
+
padding 0 2rem
|
|
112
|
+
list-style none
|
|
113
|
+
.prev
|
|
114
|
+
float left
|
|
115
|
+
&::before
|
|
116
|
+
content '上一篇:'
|
|
117
|
+
opacity 0.6
|
|
118
|
+
.next
|
|
119
|
+
float right
|
|
120
|
+
&::before
|
|
121
|
+
content '下一篇:'
|
|
122
|
+
opacity 0.6
|
|
123
|
+
&::after
|
|
124
|
+
content ''
|
|
125
|
+
display block
|
|
126
|
+
clear both
|
data/bin/common.rb
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
CURRENT_PATH = File.dirname __FILE__
|
|
2
|
+
CSS_FILE_PATH = (Pathname CURRENT_PATH) + '../asset/style/ppz.css'
|
|
3
|
+
|
|
4
|
+
class Util
|
|
5
|
+
class << self
|
|
6
|
+
def get_in_and_out
|
|
7
|
+
target_in, target_out = ARGV
|
|
8
|
+
|
|
9
|
+
# 输入文件
|
|
10
|
+
abort '要编译哪那个文件?请告诉我' unless target_in # 检查参数存在
|
|
11
|
+
target_in = PPZ::Func.format_path target_in
|
|
12
|
+
unless File.exist? target_in # 不存在的话,看看加上 .ppz 后是否存在
|
|
13
|
+
target_in += '.ppz'
|
|
14
|
+
abort target_in[0..-5] + ' 不存在' unless File.exist? target_in # 还不存在的话,就说明是写错了
|
|
15
|
+
end
|
|
16
|
+
is_folder = File.directory? target_in
|
|
17
|
+
|
|
18
|
+
# 输出文件
|
|
19
|
+
unless target_out
|
|
20
|
+
# 从输入文件获取文件名
|
|
21
|
+
target_out = ((/(.*).ppz$/.match target_in)?$1:target_in) + '.pp'
|
|
22
|
+
end
|
|
23
|
+
# + 检查上级文件夹是否存在
|
|
24
|
+
upper_dir = ((Pathname target_out) + '..').to_s
|
|
25
|
+
abort upper_dir + ' 目录不存在' unless Dir.exist? upper_dir
|
|
26
|
+
# + 检查文件夹:有则检查里面有没有文件;无则创建文件夹
|
|
27
|
+
target_out = target_out.to_s
|
|
28
|
+
if Dir.exist? target_out
|
|
29
|
+
abort target_out + ' 不是一个空文件夹' unless (Dir.children target_out).size == 0
|
|
30
|
+
else
|
|
31
|
+
Dir.mkdir target_out
|
|
32
|
+
end
|
|
33
|
+
target_out = PPZ::Func.format_path target_out
|
|
34
|
+
|
|
35
|
+
[target_in, target_out, is_folder]
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
data/bin/doc.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
target_out = Pathname TARGET_OUT
|
|
2
|
+
|
|
3
|
+
# css
|
|
4
|
+
# 输出文件路径
|
|
5
|
+
output_css_path = target_out + 'index.css'
|
|
6
|
+
# 复制
|
|
7
|
+
FileUtils.cp CSS_FILE_PATH, output_css_path
|
|
8
|
+
|
|
9
|
+
# html
|
|
10
|
+
# 输出文件路径
|
|
11
|
+
output_html_path = target_out + 'index.html'
|
|
12
|
+
# 解析文档
|
|
13
|
+
parser = PPZ::FileDocParser.new TARGET_IN
|
|
14
|
+
# 拼接上 css 文件链接
|
|
15
|
+
output_html = '<link rel="stylesheet" href="./index.css"/>' + parser.get_model.to_html
|
|
16
|
+
# 输出
|
|
17
|
+
PPZ::Func::write_to_file output_html_path.to_s, output_html
|
data/bin/folder.rb
ADDED
data/bin/ppz
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'bundler/setup'
|
|
5
|
+
|
|
6
|
+
require 'ppz'
|
|
7
|
+
require 'fileutils'
|
|
8
|
+
require 'pathname'
|
|
9
|
+
require_relative './common'
|
|
10
|
+
|
|
11
|
+
TARGET_IN, TARGET_OUT, IS_FOLDER = Util.get_in_and_out
|
|
12
|
+
|
|
13
|
+
if IS_FOLDER
|
|
14
|
+
require_relative './folder.rb'
|
|
15
|
+
else
|
|
16
|
+
require_relative './doc.rb'
|
|
17
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ppz-bin
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- wuse
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2021-02-24 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: ppz
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
description:
|
|
28
|
+
email: 372301467@qq.com
|
|
29
|
+
executables:
|
|
30
|
+
- ppz
|
|
31
|
+
extensions: []
|
|
32
|
+
extra_rdoc_files: []
|
|
33
|
+
files:
|
|
34
|
+
- asset/style/ppz.css
|
|
35
|
+
- asset/style/ppz.styl
|
|
36
|
+
- bin/common.rb
|
|
37
|
+
- bin/doc.rb
|
|
38
|
+
- bin/folder.rb
|
|
39
|
+
- bin/ppz
|
|
40
|
+
homepage: https://github.com/daGaiGuanYu/ppz
|
|
41
|
+
licenses:
|
|
42
|
+
- MIT
|
|
43
|
+
metadata: {}
|
|
44
|
+
post_install_message:
|
|
45
|
+
rdoc_options: []
|
|
46
|
+
require_paths:
|
|
47
|
+
- lib
|
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '0'
|
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - ">="
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: '0'
|
|
58
|
+
requirements: []
|
|
59
|
+
rubygems_version: 3.1.4
|
|
60
|
+
signing_key:
|
|
61
|
+
specification_version: 4
|
|
62
|
+
summary: 一种写作方式
|
|
63
|
+
test_files: []
|