本文整理汇总了Golang中github.com/Unknwon/hv.Package.JsNum方法的典型用法代码示例。如果您正苦于以下问题:Golang Package.JsNum方法的具体用法?Golang Package.JsNum怎么用?Golang Package.JsNum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/Unknwon/hv.Package
的用法示例。
在下文中一共展示了Package.JsNum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ConvertDataFormat
// ConvertDataFormat converts data from database acceptable format to useable format.
func ConvertDataFormat(pdoc *hv.Package, pdecl *models.PkgDecl) error {
if pdoc.PkgDecl == nil {
pdoc.PkgDecl = &hv.PkgDecl{}
}
pdoc.JsNum = pdecl.JsNum
pdoc.IsHasExport = pdecl.IsHasExport
pdoc.IsHasConst = pdecl.IsHasConst
pdoc.IsHasVar = pdecl.IsHasVar
pdoc.IsHasExample = pdecl.IsHasExample
pdoc.IsHasFile = pdecl.IsHasFile
pdoc.IsHasSubdir = pdecl.IsHasSubdir
// Imports.
pdoc.Imports = strings.Split(pdecl.Imports, "|")
if len(pdoc.Imports) == 1 && len(pdoc.Imports[0]) == 0 {
// No import.
pdoc.Imports = nil
}
return nil
}
示例2: renderDoc
//.........这里部分代码省略.........
}
buf.Reset()
utils.FormatCode(&buf, &f.Decl, links)
f.FmtDecl = buf.String() + " {"
if exs := getExamples(pdoc, "", f.Name); len(exs) > 0 {
f.Examples = exs
}
totalNum++
t.Funcs[j] = f
}
for j, m := range t.Methods {
if len(m.Doc) > 0 {
buf.Reset()
godoc.ToHTML(&buf, m.Doc, nil)
m.Doc = buf.String()
comNum++
}
buf.Reset()
utils.FormatCode(&buf, &m.Decl, links)
m.FmtDecl = buf.String() + " {"
if exs := getExamples(pdoc, t.Name, m.Name); len(exs) > 0 {
m.Examples = exs
}
totalNum++
t.Methods[j] = m
}
if len(t.Doc) > 0 {
buf.Reset()
godoc.ToHTML(&buf, t.Doc, nil)
t.Doc = buf.String()
comNum++
}
buf.Reset()
utils.FormatCode(&buf, &t.Decl, links)
t.FmtDecl = buf.String()
if exs := getExamples(pdoc, "", t.Name); len(exs) > 0 {
t.Examples = exs
}
totalNum++
pdoc.Types[i] = t
}
if !pdoc.IsCmd {
// Calculate documentation complete %.
this.Data["DocCPLabel"], this.Data["DocCP"] = calDocCP(comNum, totalNum)
} else {
this.Data["IsCmd"] = true
}
// Examples.
links = append(links, &utils.Link{
Name: path.Base(pdoc.ImportPath) + ".",
})
for _, e := range pdoc.Examples {
buf.Reset()
utils.FormatCode(&buf, &e.Code, links)
e.Code = buf.String()
}
for _, e := range pdoc.UserExamples {
buf.Reset()
utils.FormatCode(&buf, &e.Code, links)
e.Code = buf.String()
}
this.Data["ImportPath"] = pdoc.ImportPath
if len(tag) == 0 && (pdoc.IsCmd || pdoc.IsGoRepo || pdoc.IsGoSubrepo) {
this.Data["IsHasHv"] = true
}
// GitHub redirects non-HTTPS link and Safari loses "#XXX".
if strings.HasPrefix(pdoc.ImportPath, "github") {
this.Data["Secure"] = "s"
}
this.TplNames = "tpl/docs.tpl"
data, err := this.RenderBytes()
if err != nil {
beego.Error("generatePage(", pdoc.ImportPath, ") -> RenderBytes:", err)
return false
}
n := utils.SaveDocPage(docPath, com.Html2JS(data))
if n == -1 {
return false
}
pdoc.JsNum = n
pdoc.Id, err = doc.SaveProject(pdoc, pfuncs)
if err != nil {
beego.Error("generatePage(", pdoc.ImportPath, ") -> SaveProject:", err)
return false
}
models.SavePkgDoc(pdoc.ImportPath, pdoc.Readme)
this.Data["UtcTime"] = pdoc.Created
this.Data["TimeSince"] = calTimeSince(pdoc.Created)
return true
}