Skip to content

Commit 4e7191a

Browse files
committed
add data & copts code
1 parent 836aa10 commit 4e7191a

File tree

9 files changed

+228
-29
lines changed

9 files changed

+228
-29
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.kvm linguist-language=KVM

Data/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# LGBT-CN Data
2+
3+
This is LGBT-CN's data. Refer: <https://github.com/LGBT-CN/LGBTQIA-In-China>

Data/data/default.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Description=
2+
About=
3+
Support=
4+
Lang1=
5+
Lang1Href=
6+
Lang2=
7+
Lang2Href=
8+
MainTitle=
9+
Slogan=
10+
ProjectTarget=
11+
AboutLGBTQIA=
12+
WhatsLGBTQIA=
13+
LGBTQIADefinition=
14+
WhyCreate=
15+
ReasonCreate=
16+
WhyNeedEquality=
17+
ReasonNeedEquality=
18+
HowToRespect=
19+
WaysToRespect=
20+
WaysToSupport=
21+
PRTip=

Data/data/zh.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Description=中国的 LGBTQIA 群体十分渴望自由平等
2+
About=关于
3+
Support=支持
4+
Lang1=English
5+
Lang1Href=/page/en-GB.html
6+
Lang2=繁體中文
7+
Lang2Href=/page/zh-TW.html
8+
MainTitle=人们生来是而且始终是自由平等的
9+
Slogan=People were born free and equal.
10+
ProjectTarget=本项目意图在 LGBTQIA 程序员群体中唤起对自由平等的追求,哪怕我们都深知这不会激起浪花。无论是异性恋、同性恋、双性恋、跨性别、疑性恋、双性人、无性恋,人们生来就是平等的,拥有平等的人权,这一点无法否认。</p>
11+
AboutLGBTQIA=关于 LGBTQIA
12+
WhatsLGBTQIA=什么是 LGBTQIA?
13+
LGBTQIADefinition=<strong>LGBTQIA</strong> 是一个缩略词,它代表女同性恋(Lesbian)、男同性恋(Gay)、双性恋(Bisexual)、跨性别者(Transgender)、对自身性别认同产生疑惑的人/疑性恋(Questioning)、双性人(Intersexual)、无性恋(Asexual)以及我们的支持者,这类性少数群体需要受到尊重,因为我们生来如此。
14+
WhyCreate=这个项目为什么建立?
15+
ReasonCreate=由于中国的传统文化背景,LGBTQIA 群体在中国非常不受待见,得不到他人的认可与尊重。建立这个项目是为了在开源工作者中找到 LGBTQIA 群体或是支持 LGBTQIA 平权的人们,从舆论上改善 LGBTQIA 群体在中国的状况,尽管这会造成的影响并不大,但总比没有好。
16+
WhyNeedEquality=为什么 LGBTQIA 需要平权?
17+
ReasonNeedEquality=LGBTQIA 是少数群体,尽管 LGBTQIA也是普通人,但无法否认的是我们也与占多数的异性恋有所不同,政治权利无法受到完整的保障。自由、平等,在现代社会永远都是最重要的,在中国,LGBTQIA 并没有得到真正的自由平等,为了让这类群体过上正常的生活,我们需要争取平权。
18+
HowToRespect=如何尊重 LGBTQIA 群体?
19+
WaysToRespect=就像你尊重你身边的任何一个朋友一样,把 LGBTQIA 们当做普通人。记住 LGBTQIA 不是任何形式上的一种疾病,哪怕你们有生理上的差异,LGBTQIA 也是正常人。同时,LGBTQIA 确实也需要比异性恋更多的关怀,因为 LGBTQIA 常常缺乏安全感,并且渴望被认同。
20+
WaysToSupport=如果你支持 LGBTQIA 平权,欢迎在本项目 <a href="https://github.com/LGBT-CN/LGBTQIA-in-China/">GitHub 仓库</a> 中的 <a href="https://github.com/LGBT-CN/LGBTQIA-in-China/blob/master/README.md">README.md</a> 中留下你的名字,并点一个 Star 作为支持!同时,你也可以写一篇关于中国 LGBTQIA 群体的文章,将原文地址和 Markdown 文件(作为备份)提供给我们,只要文章内容与 LGBTQIA 相关,或是 LGBTQIA 中的任意一个群体相关,呼吁平权,我们都会通过。所有支持者的名字和他们提供的文章都可以在 <a href="https://github.com/LGBT-CN/LGBTQIA-in-China/blob/master/README.md">README.md</a> 文件中看到。
21+
PRTip=尽量以 Pull Requests 的方式提交 Commit(文章请提交在 post 目录下)

Data/model/index.kvm

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
<!DOCTYPE html>
2+
<html lang="zh-tw">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
7+
<meta name="renderer" content="webkit" />
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no">
9+
<meta http-equiv="Cache-Control" content="no-siteapp, no-transform" />
10+
<meta name="theme-color" content="gray">
11+
<meta name="author" content="LGBTQIA-in-China">
12+
<meta name="description" content="{%Description%}">
13+
<meta name="keywords"
14+
content="LGBTQIA, LGBT, Homosexual, gay, lesbian, transgender, intersexual, asexual, bisexual, queer, questioning, 同性恋, 跨性别, 双性人, 酷儿, 双性恋, 疑性恋">
15+
<title>LGBTQIA in China</title>
16+
<link rel="icon" href="/static/favicon.ico" type="image/x-icon"/>
17+
<link rel="stylesheet"
18+
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC:300|Noto+Serif+SC:300|ZCOOL+KuaiLe|ZCOOL+XiaoWei&display=swap">
19+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/twbs/bootstrap/dist/css/bootstrap-grid.min.css">
20+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/alvarotrigo/fullPage.js/dist/fullpage.min.css">
21+
<link rel="stylesheet" href="https://at.alicdn.com/t/font_1640253_7ac8t2q6btg.css">
22+
<link rel="stylesheet" href="https://at.alicdn.com/t/font_1912611_olza2ei6vv.css">
23+
<link rel="stylesheet" href="/static/css/style.css">
24+
</head>
25+
26+
<body>
27+
<nav>
28+
<div class="nav" id="nav">
29+
<h1 class="nav-title"><em class="iconfont icon-flag"></em> LGBTQIA in China</h1>
30+
<div class="nav-content">
31+
<a href="#about"><em class="iconfont icon-about"></em> {%About%}</a>
32+
<a href="#support"><em class="iconfont icon-thumbs-o-up"></em> {%Support%}</a>
33+
<a>|</a>
34+
<a href="{%Lang1Href%}">{%Lang1%}</a>
35+
<a href="{%Lang2Href%}">{%Lang2%}</a>
36+
</div>
37+
</nav>
38+
<main>
39+
<div id="fullpage">
40+
<!-- equal part -->
41+
<div class="section" id="equal">
42+
<div class="equal-content">
43+
<h1 class="main-title">{%MainTitle%}</h1>
44+
<div class="devider">
45+
<div id="red"> </div>
46+
<div id="orange"> </div>
47+
<div id="yellow"> </div>
48+
<div id="green"> </div>
49+
<div id="blue"> </div>
50+
<div id="purple"> </div>
51+
</div>
52+
<blockquote>{%Slogan%}</blockquote>
53+
<p>
54+
{%ProjectTarget%}
55+
</p>
56+
<div class="button-group">
57+
<a href="https://github.com/LGBT-CN/LGBTQIA-in-China" class="button button-github button-margin-right-8px"><em
58+
class="iconfont icon-GitHub"></em> GitHub</a>
59+
<a href="https://t.me/LGBTCN" class="button button-telegram">
60+
<em class="iconfont icon-telegram"></em> Telegram</a>
61+
</div>
62+
</div>
63+
<div class="equal-flag">
64+
<img src="https://cdn.jsdelivr.net/gh/LGBT-CN/logo@0bfed07/v0/flag.svg alt="LGBTQIA Flag">
65+
</div>
66+
</div>
67+
<!-- about part -->
68+
<div class="section" id="about">
69+
<div class="container-fluid">
70+
<div class="row">
71+
<div class="about-section col-md-12" id="about-title">
72+
<h1>{%AboutLGBTQIA%}</h1>
73+
<div class="devider">
74+
<div id="red"> </div>
75+
<div id="orange"> </div>
76+
<div id="yellow"> </div>
77+
<div id="green"> </div>
78+
<div id="blue"> </div>
79+
<div id="purple"> </div>
80+
</div>
81+
</div>
82+
<div class="about-section col-md-6" id="about-1">
83+
<h2>{%WhatsLGBTQIA%}</h2>
84+
<p>
85+
{%LGBTQIADefinition%}
86+
</p>
87+
</div>
88+
<div class="about-section col-md-6" id="about-2">
89+
<h2>{%WhyCreate%}</h2>
90+
<p>
91+
{%ReasonCreate%}
92+
</p>
93+
</div>
94+
<div class="about-section col-md-6" id="about-3">
95+
<h2>{%WhyNeedEquality%}</h2>
96+
<p>
97+
{%ReasonNeedEquality%}
98+
</p>
99+
</div>
100+
<div class="about-section col-md-6" id="about-4">
101+
<h2>{%HowToRespect%}</h2>
102+
<p>
103+
{%WaysToRespect%}
104+
</p>
105+
</div>
106+
</div>
107+
<br><br>
108+
</div>
109+
</div>
110+
<!-- support -->
111+
<div class="section" id="support">
112+
<h1>
113+
{%Support%}
114+
</h1>
115+
<hr>
116+
<p>
117+
{%WaysToSupport%}
118+
</p>
119+
<p style="color: cadetblue">
120+
<em class="iconfont icon-fork"></em>
121+
{%PRTip%}
122+
</p>
123+
<p id="sayings"><span style="color:red;font-size: 25px;">❤</span><br>
124+
Love is love. We're the same.<br>
125+
在愛面前我們都一樣。
126+
</p>
127+
<br>
128+
</div>
129+
</div>
130+
</main>
131+
<footer>
132+
<div class="footer">
133+
<p>Copyright &copy; 2021 <a href="https://github.com/LGBT-CN/LGBTQIA-in-China">
134+
<em class="iconfont icon-flag"></em> LGBTQIA in China</a>, All Rights Reserved.</p>
135+
</div>
136+
<script>
137+
var new_scroll_position = 0;
138+
var last_scroll_position;
139+
var header = document.getElementById("nav");
140+
141+
window.addEventListener('scroll', function (e) {
142+
last_scroll_position = window.scrollY;
143+
144+
// 向下滾動
145+
if (new_scroll_position < last_scroll_position && last_scroll_position > 80) {
146+
header.classList.remove("slideDown");
147+
header.classList.add("slideUp");
148+
149+
// 向上滾動
150+
} else if (new_scroll_position > last_scroll_position) {
151+
header.classList.remove("slideUp");
152+
header.classList.add("slideDown");
153+
}
154+
155+
new_scroll_position = last_scroll_position;
156+
});
157+
</script>
158+
</footer>
159+
</body>
160+
161+
</html>

Kvm.Analyser/Parser.cs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public static Dictionary<string, string> ParseKey(string str)
3636
dic.Add(m[..index].Trim(), m[(index + 1)..].Trim());
3737
}
3838

39+
Shared.Log.S("Parse prop successfully!");
40+
3941
return dic;
4042
}
4143

@@ -60,20 +62,12 @@ public static string Parse(string kvm, Dictionary<string, string> prop)
6062
var m = Lexer.Parse(kvm);
6163
foreach (var i in m)
6264
{
63-
switch (i.Type)
65+
sb.Append(i.Type switch
6466
{
65-
case TokenType.Unknown:
66-
case TokenType.Block:
67-
sb.Append(i.Data);
68-
break;
69-
case TokenType.Control:
70-
lock (prop)
71-
{
72-
sb.Append(((ControlToken) i).Parse(prop));
73-
}
74-
75-
break;
76-
}
67+
TokenType.Unknown or TokenType.Block => i.Data,
68+
TokenType.Control => ((ControlToken) i).Parse(prop),
69+
_ => ""
70+
});
7771
}
7872

7973
return sb.ToString();

Kvm.ConsoleApp/Program.cs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.IO;
23
using Kvm.Analyser;
34

45
namespace Kvm.ConsoleApp
@@ -7,22 +8,11 @@ class Program
78
{
89
static void Main(string[] args)
910
{
10-
Console.WriteLine("Hello World!");
11-
string x = @"mmm
12-
KKK=auhsbcj
13-
A=CBA
14-
D=";
15-
var d = Parser.SplitByFirstLine(x);
16-
Console.WriteLine("=====1=======");
17-
Console.WriteLine(d.Item1);
18-
Console.WriteLine("=====2=======");
19-
Console.WriteLine(d.Item2);
20-
Console.WriteLine("=====3=======");
21-
var dix = Parser.ParseKey(x);
22-
foreach (var kv in dix)
23-
{
24-
Console.WriteLine($"K->{kv.Key} && V->{kv.Value}");
25-
}
11+
var model = File.ReadAllText("in\\model\\index.kvm");
12+
var prop = File.ReadAllText("in\\data\\zh.txt");
13+
var m = Parser.Parse(model, prop);
14+
File.WriteAllText("zh.html", m);
15+
2616
}
2717
}
2818
}

Kvm.Log/Default.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,12 @@ public void E(string msg)
2323
Console.Error.WriteLine($"[E {DateTime.Now.ToLocalTime().ToString()}] {msg}");
2424
Console.ResetColor();
2525
}
26+
27+
public void S(string msg)
28+
{
29+
Console.ForegroundColor = ConsoleColor.Green;
30+
Console.Error.WriteLine($"[S {DateTime.Now.ToLocalTime().ToString()}] {msg}");
31+
Console.ResetColor();
32+
}
2633
}
2734
}

Kvm.Log/IKLog.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ public interface IKLog
55
public void W(string msg);
66
public void I(string msg);
77
public void E(string msg);
8+
public void S(string msg);
89
}
910
}

0 commit comments

Comments
 (0)