介绍
- 全英文段:加粗,加字体
Courier
- 保留代码块
- 保留空行
- 保留分界线
- 出现汉字整段变为
楷体
- 纯加粗段,加
size=4
- 字体标签加在标题符号
#
、-
、1.
、>
后面,保留格式
代码:
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
int main(){
freopen("data.in","r",stdin);
freopen("data.out","w",stdout);
vector<string>V;
string x;
bool code=0;
while(getline(cin,x)){
int len=x.length();
if(len==0){
V.push_back(x);
continue;
}
if(len>=3){
int h=1;
rep(i,0,len-1){
if(x[i]!='*'){
h=0;break;
}
}
if(h){
V.push_back(x);
continue;
}
}
if(len>=3&&x.substr(0,3)=="```"){
code=!code;
V.push_back(x);
continue;
}
if(code){
V.push_back(x);
continue;
}
string Add="<font face=\"\">";
int chinese=0;
for(int i=0;i<len;i++){
if(x[i]<0){chinese++;break;}
}
if(chinese){
Add.insert(12,"ї¬Ме");
}
else{
Add.insert(12,"Courier");
Add.insert(0,"<b>");
}
if(len>4){
if(x[0]==x[1]&&x[1]==x[len-1]&&x[len-1]==x[len-2]&&x[0]=='*'){
int pos=Add.find("face");
Add.insert(pos,"size=4 ");
}
}
char first;
int pos;
rep(i,0,x.length()-1){
if(x[i]!=' '){first=x[i],pos=i;break;}
}
if(first=='>'){
x.insert(pos+1,Add);
}
else if(first=='-'||first=='#'||(isdigit(first)&&pos+1<x.length()&&x[pos+1]=='.')){
pos=x.find(' ',pos);
x.insert(pos+1,Add);
}
else{
x=Add+x;
}
V.push_back(x);
}
for(auto P:V){
cout<<P<<endl;
}
}