Skip to content

Commit

Permalink
add data & copts code
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinZonda committed Apr 25, 2021
1 parent 836aa10 commit 4e7191a
Show file tree
Hide file tree
Showing 9 changed files with 228 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.kvm linguist-language=KVM
3 changes: 3 additions & 0 deletions Data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# LGBT-CN Data

This is LGBT-CN's data. Refer: <https://github.com/LGBT-CN/LGBTQIA-In-China>
21 changes: 21 additions & 0 deletions Data/data/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Description=
About=
Support=
Lang1=
Lang1Href=
Lang2=
Lang2Href=
MainTitle=
Slogan=
ProjectTarget=
AboutLGBTQIA=
WhatsLGBTQIA=
LGBTQIADefinition=
WhyCreate=
ReasonCreate=
WhyNeedEquality=
ReasonNeedEquality=
HowToRespect=
WaysToRespect=
WaysToSupport=
PRTip=
21 changes: 21 additions & 0 deletions Data/data/zh.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Description=中国的 LGBTQIA 群体十分渴望自由平等
About=关于
Support=支持
Lang1=English
Lang1Href=/page/en-GB.html
Lang2=繁體中文
Lang2Href=/page/zh-TW.html
MainTitle=人们生来是而且始终是自由平等的
Slogan=People were born free and equal.
ProjectTarget=本项目意图在 LGBTQIA 程序员群体中唤起对自由平等的追求,哪怕我们都深知这不会激起浪花。无论是异性恋、同性恋、双性恋、跨性别、疑性恋、双性人、无性恋,人们生来就是平等的,拥有平等的人权,这一点无法否认。</p>
AboutLGBTQIA=关于 LGBTQIA
WhatsLGBTQIA=什么是 LGBTQIA?
LGBTQIADefinition=<strong>LGBTQIA</strong> 是一个缩略词,它代表女同性恋(Lesbian)、男同性恋(Gay)、双性恋(Bisexual)、跨性别者(Transgender)、对自身性别认同产生疑惑的人/疑性恋(Questioning)、双性人(Intersexual)、无性恋(Asexual)以及我们的支持者,这类性少数群体需要受到尊重,因为我们生来如此。
WhyCreate=这个项目为什么建立?
ReasonCreate=由于中国的传统文化背景,LGBTQIA 群体在中国非常不受待见,得不到他人的认可与尊重。建立这个项目是为了在开源工作者中找到 LGBTQIA 群体或是支持 LGBTQIA 平权的人们,从舆论上改善 LGBTQIA 群体在中国的状况,尽管这会造成的影响并不大,但总比没有好。
WhyNeedEquality=为什么 LGBTQIA 需要平权?
ReasonNeedEquality=LGBTQIA 是少数群体,尽管 LGBTQIA也是普通人,但无法否认的是我们也与占多数的异性恋有所不同,政治权利无法受到完整的保障。自由、平等,在现代社会永远都是最重要的,在中国,LGBTQIA 并没有得到真正的自由平等,为了让这类群体过上正常的生活,我们需要争取平权。
HowToRespect=如何尊重 LGBTQIA 群体?
WaysToRespect=就像你尊重你身边的任何一个朋友一样,把 LGBTQIA 们当做普通人。记住 LGBTQIA 不是任何形式上的一种疾病,哪怕你们有生理上的差异,LGBTQIA 也是正常人。同时,LGBTQIA 确实也需要比异性恋更多的关怀,因为 LGBTQIA 常常缺乏安全感,并且渴望被认同。
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> 文件中看到。
PRTip=尽量以 Pull Requests 的方式提交 Commit(文章请提交在 post 目录下)
161 changes: 161 additions & 0 deletions Data/model/index.kvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<!DOCTYPE html>
<html lang="zh-tw">

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no">
<meta http-equiv="Cache-Control" content="no-siteapp, no-transform" />
<meta name="theme-color" content="gray">
<meta name="author" content="LGBTQIA-in-China">
<meta name="description" content="{%Description%}">
<meta name="keywords"
content="LGBTQIA, LGBT, Homosexual, gay, lesbian, transgender, intersexual, asexual, bisexual, queer, questioning, 同性恋, 跨性别, 双性人, 酷儿, 双性恋, 疑性恋">
<title>LGBTQIA in China</title>
<link rel="icon" href="/static/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC:300|Noto+Serif+SC:300|ZCOOL+KuaiLe|ZCOOL+XiaoWei&display=swap">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/twbs/bootstrap/dist/css/bootstrap-grid.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/alvarotrigo/fullPage.js/dist/fullpage.min.css">
<link rel="stylesheet" href="https://at.alicdn.com/t/font_1640253_7ac8t2q6btg.css">
<link rel="stylesheet" href="https://at.alicdn.com/t/font_1912611_olza2ei6vv.css">
<link rel="stylesheet" href="/static/css/style.css">
</head>

<body>
<nav>
<div class="nav" id="nav">
<h1 class="nav-title"><em class="iconfont icon-flag"></em> LGBTQIA in China</h1>
<div class="nav-content">
<a href="#about"><em class="iconfont icon-about"></em> {%About%}</a>
<a href="#support"><em class="iconfont icon-thumbs-o-up"></em> {%Support%}</a>
<a>|</a>
<a href="{%Lang1Href%}">{%Lang1%}</a>
<a href="{%Lang2Href%}">{%Lang2%}</a>
</div>
</nav>
<main>
<div id="fullpage">
<!-- equal part -->
<div class="section" id="equal">
<div class="equal-content">
<h1 class="main-title">{%MainTitle%}</h1>
<div class="devider">
<div id="red"> </div>
<div id="orange"> </div>
<div id="yellow"> </div>
<div id="green"> </div>
<div id="blue"> </div>
<div id="purple"> </div>
</div>
<blockquote>{%Slogan%}</blockquote>
<p>
{%ProjectTarget%}
</p>
<div class="button-group">
<a href="https://github.com/LGBT-CN/LGBTQIA-in-China" class="button button-github button-margin-right-8px"><em
class="iconfont icon-GitHub"></em> GitHub</a>
<a href="https://t.me/LGBTCN" class="button button-telegram">
<em class="iconfont icon-telegram"></em> Telegram</a>
</div>
</div>
<div class="equal-flag">
<img src="https://cdn.jsdelivr.net/gh/LGBT-CN/logo@0bfed07/v0/flag.svg alt="LGBTQIA Flag">
</div>
</div>
<!-- about part -->
<div class="section" id="about">
<div class="container-fluid">
<div class="row">
<div class="about-section col-md-12" id="about-title">
<h1>{%AboutLGBTQIA%}</h1>
<div class="devider">
<div id="red"> </div>
<div id="orange"> </div>
<div id="yellow"> </div>
<div id="green"> </div>
<div id="blue"> </div>
<div id="purple"> </div>
</div>
</div>
<div class="about-section col-md-6" id="about-1">
<h2>{%WhatsLGBTQIA%}</h2>
<p>
{%LGBTQIADefinition%}
</p>
</div>
<div class="about-section col-md-6" id="about-2">
<h2>{%WhyCreate%}</h2>
<p>
{%ReasonCreate%}
</p>
</div>
<div class="about-section col-md-6" id="about-3">
<h2>{%WhyNeedEquality%}</h2>
<p>
{%ReasonNeedEquality%}
</p>
</div>
<div class="about-section col-md-6" id="about-4">
<h2>{%HowToRespect%}</h2>
<p>
{%WaysToRespect%}
</p>
</div>
</div>
<br><br>
</div>
</div>
<!-- support -->
<div class="section" id="support">
<h1>
{%Support%}
</h1>
<hr>
<p>
{%WaysToSupport%}
</p>
<p style="color: cadetblue">
<em class="iconfont icon-fork"></em>
{%PRTip%}
</p>
<p id="sayings"><span style="color:red;font-size: 25px;">❤</span><br>
Love is love. We're the same.<br>
在愛面前我們都一樣。
</p>
<br>
</div>
</div>
</main>
<footer>
<div class="footer">
<p>Copyright &copy; 2021 <a href="https://github.com/LGBT-CN/LGBTQIA-in-China">
<em class="iconfont icon-flag"></em> LGBTQIA in China</a>, All Rights Reserved.</p>
</div>
<script>
var new_scroll_position = 0;
var last_scroll_position;
var header = document.getElementById("nav");

window.addEventListener('scroll', function (e) {
last_scroll_position = window.scrollY;

// 向下滾動
if (new_scroll_position < last_scroll_position && last_scroll_position > 80) {
header.classList.remove("slideDown");
header.classList.add("slideUp");

// 向上滾動
} else if (new_scroll_position > last_scroll_position) {
header.classList.remove("slideUp");
header.classList.add("slideDown");
}

new_scroll_position = last_scroll_position;
});
</script>
</footer>
</body>

</html>
20 changes: 7 additions & 13 deletions Kvm.Analyser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public static Dictionary<string, string> ParseKey(string str)
dic.Add(m[..index].Trim(), m[(index + 1)..].Trim());
}

Shared.Log.S("Parse prop successfully!");

return dic;
}

Expand All @@ -60,20 +62,12 @@ public static string Parse(string kvm, Dictionary<string, string> prop)
var m = Lexer.Parse(kvm);
foreach (var i in m)
{
switch (i.Type)
sb.Append(i.Type switch
{
case TokenType.Unknown:
case TokenType.Block:
sb.Append(i.Data);
break;
case TokenType.Control:
lock (prop)
{
sb.Append(((ControlToken) i).Parse(prop));
}

break;
}
TokenType.Unknown or TokenType.Block => i.Data,
TokenType.Control => ((ControlToken) i).Parse(prop),
_ => ""
});
}

return sb.ToString();
Expand Down
22 changes: 6 additions & 16 deletions Kvm.ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.IO;
using Kvm.Analyser;

namespace Kvm.ConsoleApp
Expand All @@ -7,22 +8,11 @@ class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
string x = @"mmm
KKK=auhsbcj
A=CBA
D=";
var d = Parser.SplitByFirstLine(x);
Console.WriteLine("=====1=======");
Console.WriteLine(d.Item1);
Console.WriteLine("=====2=======");
Console.WriteLine(d.Item2);
Console.WriteLine("=====3=======");
var dix = Parser.ParseKey(x);
foreach (var kv in dix)
{
Console.WriteLine($"K->{kv.Key} && V->{kv.Value}");
}
var model = File.ReadAllText("in\\model\\index.kvm");
var prop = File.ReadAllText("in\\data\\zh.txt");
var m = Parser.Parse(model, prop);
File.WriteAllText("zh.html", m);

}
}
}
7 changes: 7 additions & 0 deletions Kvm.Log/Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,12 @@ public void E(string msg)
Console.Error.WriteLine($"[E {DateTime.Now.ToLocalTime().ToString()}] {msg}");
Console.ResetColor();
}

public void S(string msg)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Error.WriteLine($"[S {DateTime.Now.ToLocalTime().ToString()}] {msg}");
Console.ResetColor();
}
}
}
1 change: 1 addition & 0 deletions Kvm.Log/IKLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ public interface IKLog
public void W(string msg);
public void I(string msg);
public void E(string msg);
public void S(string msg);
}
}

0 comments on commit 4e7191a

Please sign in to comment.