17 Star 34 Fork 0

vz/ego
关闭

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
compile.go 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
vz 提交于 2017-06-14 17:35 +08:00 . Rename renders and add minify
// Copyright 2016 The go-ego Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// https://github.com/go-ego/ego/blob/master/LICENSE
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Package rego renders vgo
package rego
import (
"strings"
)
func RendersVgo(name string) {
var (
rname string
racss string
rajs string
)
layout, err := Readfile("public/layout.html")
if err != nil {
panic(err)
}
if len(name) > 0 {
rname = "public/" + name + ".vgo"
} else {
rname = "public/banner.vgo"
}
abanner, err := Readfile(rname)
if err != nil {
panic(err)
}
notes := TrimNotes(abanner)
_, retext, _, class, recss, rejs := ImpStr(notes)
aRecss, aRejs := styScr(notes)
for i := 0; i < len(aRecss); i++ {
racss += aRecss[i]
}
for i := 0; i < len(aRejs); i++ {
rajs += aRejs[i]
}
for h := 0; h < len(recss); h++ {
for i := 0; i < len(recss[h]); i++ {
if strings.Contains(racss, recss[h][i]) {
recss[h][i] = ""
}
racss += recss[h][i]
}
}
for h := 0; h < len(rejs); h++ {
for i := 0; i < len(rejs[h]); i++ {
if strings.Contains(rajs, rejs[h][i]) {
rejs[h][i] = ""
}
rajs += rejs[h][i]
}
}
trimtext := TrimIs(retext)
var wname string
if strings.Contains(name, "/") {
sname := strings.Split(name, "/")
wname = sname[0] + "_" + sname[1]
} else {
wname = name
}
WHtml(class, layout, racss, trimtext, rajs, wname)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/veni0/ego.git
git@gitee.com:veni0/ego.git
veni0
ego
ego
263eb77d34e2

搜索帮助