utils

package
v0.0.0-...-cd27406 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2014 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package utils implemented some useful functions.

Index

Constants

This section is empty.

Variables

View Source
var (
	DocsJsPath string
	HvJsPath   string
)
View Source
var LangTypes []*LangType // Languages are supported.

Functions

func FilterDirName

func FilterDirName(name string) bool

FilterDirName guess the file or directory is or contains Go source files.

func FormatCode

func FormatCode(w io.Writer, code *string, links []*Link)

FormatCode highlights keywords and adds HTML links to them.

func GetProjectPath

func GetProjectPath(importPath string) (projectPath string)

GetProjectPath returns project path of import path.

func IsBrowseURL

func IsBrowseURL(s string) (importPath string, ok bool)

IsBrowserURL returns importPath and true if URL looks like a URL for a VCS source browser.

func IsDocFile

func IsDocFile(n string) bool

func IsGoRepoPath

func IsGoRepoPath(importPath string) bool

IsGoRepoPath returns true if package is from standard library.

func IsGoSubrepoPath

func IsGoSubrepoPath(importPath string) bool

IsGoSubrepoPath returns true if package is from sub-repos.

func IsValidRemotePath

func IsValidRemotePath(importPath string) bool

IsValidRemotePath returns true if importPath is structurally valid for "go get".

func LoadConfig

func LoadConfig(cfgPath string)

LoadConfig loads configuration file.

func SaveConfig

func SaveConfig() error

SaveConfig saves configuration file.

func SaveDocPage

func SaveDocPage(docPath string, data []byte) int

SaveDocPage saves doc. content to JS file(s), it returns max index of JS file(s); it returns -1 when error occurs.

func SavePkgDoc

func SavePkgDoc(docPath string, readmes map[string][]byte)

SavePkgDoc saves readered readme.md file data.

func TagSuffix

func TagSuffix(prefix, t string) string

Types

type LangType

type LangType struct {
	Lang, Name string
}

LangType represents a language type.

func SetLangVer

func SetLangVer(ctx *context.Context, input url.Values, data map[interface{}]interface{}) (bool, LangType)

SetLangVer sets site language version. It returns true when language is changed by URL parameters.

type Link struct {
	Path, Name, Comment string // package path, identifier name, and comments.
}

A link describes the (HTML) link information for an identifier. The zero value of a link represents "no link".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL