提交 2aba686f 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

close task#7618

上级 e74c7646
qq.com
163.com
263.net
aliyun.com
126.com
gmail.com
outlook.com
hotmail.com
\ No newline at end of file
ngtesting.com
testfarm.net
\ No newline at end of file
文件已添加
......@@ -112,4 +112,54 @@ fields:
from: base.name.cnaccount.v1.yaml
use: given
prefix: "["
postfix: "]\t"
\ No newline at end of file
postfix: "]\t"
- field: test20
from: base.domain.domain.name.v1.yaml
use: number_with_esp
prefix: ""
postfix: "\t"
- field: test21
from: base.domain.domain.name.v1.yaml
use: number_with_self
prefix: ""
postfix: "\t"
- field: test22
from: base.domain.domain.name.v1.yaml
use: letter_with_esp
prefix: ""
postfix: "\t"
- field: test23
from: base.domain.domain.name.v1.yaml
use: letter_with_self
prefix: ""
postfix: "\t"
- field: test24
from: base.domain.domain.name.v1.yaml
use: western_with_esp
prefix: ""
postfix: "\t"
- field: test25
from: base.domain.domain.name.v1.yaml
use: western_with_self
prefix: ""
postfix: "\t"
- field: test26
from: base.domain.domain.name.v1.yaml
use: pinyin_with_esp
prefix: ""
postfix: "\t"
- field: test27
from: base.domain.domain.name.v1.yaml
use: pinyin_with_self
prefix: ""
postfix: "\t"
- field: test28
from: base.domain.domain.name.v1.yaml
use: western_with_custom
prefix: ""
postfix: "\t"
......@@ -221,9 +221,16 @@ func CopyField(child model.DefField, parent *model.DefField) {
func ReplaceSpecialChars(bytes []byte) []byte {
str := string(bytes)
inRanges := false // for ranges yaml only
ret := ""
for _, line := range strings.Split(str, "\n") {
if strings.Index(strings.TrimSpace(line), "range") == 0 {
if strings.Index(strings.TrimSpace(line), "ranges") == 0 {
inRanges = true
} else if len(line) > 0 && string(line[0]) != " " { // not begin with space, ranges end
inRanges = false
}
if strings.Index(strings.TrimSpace(line), "range") == 0 || inRanges {
line = strings.ReplaceAll(line,"[", string(constant.LeftBrackets))
line = strings.ReplaceAll(line,"]", string(constant.RightBrackets))
}
......
......@@ -157,6 +157,7 @@ func getRootRangeOrInstant(inst model.DefField) (parentRanges model.ResRanges, p
resFile, _, _ := fileUtils.GetResProp(inst.From)
yamlContent, err := ioutil.ReadFile(resFile)
yamlContent = ReplaceSpecialChars(yamlContent)
if err != nil {
logUtils.PrintTo(i118Utils.I118Prt.Sprintf("fail_to_read_file", resFile))
return
......
......@@ -12,8 +12,9 @@ import (
)
func TestPinYin(t *testing.T) {
path := "../../data/name/cn.family.v1.xlsx"
//path := "../../data/name/cn.family.v1.xlsx"
//path := "../../data/name/cn.given.v1.xlsx"
path := "../../data/words/v1.xlsx"
excel, err := excelize.OpenFile(path)
if err != nil {
logUtils.PrintTo(i118Utils.I118Prt.Sprintf("fail_to_read_file", path))
......@@ -32,7 +33,7 @@ func TestPinYin(t *testing.T) {
break
}
name := strings.TrimSpace(row[1])
name := strings.TrimSpace(row[2])
pinyin, err := pinyin.New(name).Split(" ").Mode(pinyin.WithoutTone).Convert()
if err == nil {
t.Log(pinyin)
......@@ -41,14 +42,14 @@ func TestPinYin(t *testing.T) {
}
pinyin = strings.Replace(pinyin," ", "", -1)
excel.SetCellValue(sheet, "C" + strconv.Itoa(index + 1), pinyin)
excel.SetCellValue(sheet, "D" + strconv.Itoa(index + 1), pinyin)
doub := "false"
lent := ChineseCount(name)
if lent > 1 {
doub = "true"
}
excel.SetCellValue(sheet, "E" + strconv.Itoa(index + 1), doub)
//doub := "false"
//lent := ChineseCount(name)
//if lent > 1 {
// doub = "true"
//}
//excel.SetCellValue(sheet, "E" + strconv.Itoa(index + 1), doub)
}
}
......
title: 域名
desc:
author: zentao
version: 1.0
field: domain
instances:
- instance: number_with_esp
note: 数字加服务商域名
fields:
- field: part1
from: base.name.numbers.v1.yaml
use: numbers
postfix: "."
- field: part2
from: base.domain.domain.v1.yaml
use: esp
- instance: number_with_self
note: 数字加自有域名
prefix:
fields:
- field: part1
from: base.name.numbers.v1.yaml
use: numbers
postfix: "."
- field: part2
from: base.domain.domain.v1.yaml
use: self
- instance: letter_with_esp
note: 字母加服务商域名
prefix:
fields:
- field: part1
from: base.name.letters.v1.yaml
select: letters
postfix: "."
- field: part2
from: base.domain.domain.v1.yaml
use: esp
- instance: letter_with_self
note: 字母加自有域名
prefix:
fields:
- field: part1
from: base.name.letters.v1.yaml
select: letters
postfix: "."
- field: part2
from: base.domain.domain.v1.yaml
use: self
- instance: western_with_esp
note: 单词加服务商域名
prefix:
fields:
- field: part1
from: words.v1
select: en
postfix: "."
- field: part2
from: base.domain.domain.v1.yaml
use: esp
- instance: western_with_self
note: 单词加自有域名
prefix:
fields:
- field: part1
from: words.v1
select: en
postfix: "."
- field: part2
from: base.domain.domain.v1.yaml
use: self
- instance: pinyin_with_esp
note: 拼音加服务商域名
prefix:
fields:
- field: part1
from: words.v1
select: pinyin
postfix: "."
- field: part2
from: base.domain.domain.v1.yaml
use: esp
- instance: pinyin_with_self
note: 拼音加自有域名
prefix:
fields:
- field: part1
from: words.v1
select: pinyin
postfix: "."
- field: part2
from: base.domain.domain.v1.yaml
use: self
- instance: pinyin_with_self
note: 拼音加自有域名
prefix:
fields:
- field: part1
from: words.v1
select: pinyin
postfix: "."
- field: part2
from: base.domain.domain.v1.yaml
use: self
- instance: western_with_custom
note: 单词加后缀生成域名
prefix:
fields:
- field: part1
from: base.name.letters.v1.yaml
select: letters
postfix: "."
- field: part2
from: words.v1
select: en
postfix: "."
- field: part3
from: base.domain.postfix.v1.yaml
use: common
\ No newline at end of file
title: 域名
desc:
author: zentao
version: 1.0
field: domain
instances:
- instance: esp
note: 服务商域名
fields:
- field: part1
range: [qq.com,163.com,263.net,aliyun.com,126.com,gmail.com,outlook.com,hotmail.com]
- instance: self
note: 自定义域名
prefix:
fields:
- field: part1
range: [zentao.com,easycorp.cn,ztf.im,zd.im]
\ No newline at end of file
title: domain_postfix
desc: 域名后缀
author: zentao
version: 1.0
field: domain_postfix
note: 域名后缀
ranges:
common: [com,net,org,cn,cc,co,im,io]
cn: [cn,org.cn,net.cn,com.cn,gov.cn]
new: [app,ai,site,xyz,ltd,ren,wang,vip,top]
country: [cn,im,tv,cc,io,la]
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册