Documentation ¶
Index ¶
- Constants
- func ExecutePage(w http.ResponseWriter, p Page) error
- func ExecuteTemplate(w http.ResponseWriter, name string, arg interface{}) error
- func LoadTemplates(dir string, funcMap template.FuncMap) error
- func WriteAjaxResp(w http.ResponseWriter, obj interface{}) error
- type ArticlePollResp
- type AskOver18
- type BbsArticle
- type BbsIndex
- type Captcha
- type CaptchaErr
- type Classlist
- type Context
- type Error
- type ErrorWrapper
- type ManArticle
- type ManIndex
- type NeedToWriteHeaders
- type NoContent
- type NotFound
- type NotFoundError
- type Page
- type Redirect
- type TemplateMap
Constants ¶
View Source
const ( TnameError = `error.html` TnameNotFound = `notfound.html` TnameClasslist = `classlist.html` TnameBbsIndex = `bbsindex.html` TnameBbsArticle = `bbsarticle.html` TnameAskOver18 = `askover18.html` TnameManIndex = `manindex.html` TnameManArticle = `manarticle.html` TnameCaptcha = `captcha.html` TnameLayout = `layout.html` TnameCommon = `common.html` )
Variables ¶
This section is empty.
Functions ¶
func ExecutePage ¶
func ExecutePage(w http.ResponseWriter, p Page) error
func ExecuteTemplate ¶
func ExecuteTemplate(w http.ResponseWriter, name string, arg interface{}) error
func WriteAjaxResp ¶
func WriteAjaxResp(w http.ResponseWriter, obj interface{}) error
Types ¶
type ArticlePollResp ¶
type BbsArticle ¶
type BbsArticle struct { Title string Description string Board *pttbbs.Board FileName string Content template.HTML ContentTail template.HTML ContentTruncated bool PollUrl string LongPollUrl string CurrOffset int }
func (BbsArticle) TemplateName ¶
func (BbsArticle) TemplateName() string
type BbsIndex ¶
type BbsIndex struct { Board pttbbs.Board Query string FirstPage string PrevPage string NextPage string LastPage string Articles []pttbbs.Article Bottoms []pttbbs.Article IsValid bool }
func (BbsIndex) TemplateName ¶
type Captcha ¶
type Captcha struct { // Handle is the opaque handle for getting the verification key from // database. Handle string // VerificationKey will be non-empty if the page should display the // verification key. Otherwise, it should display the captcha. VerificationKey string // InternalErrMessage signals an error, and some error texts should be // shown to user. InternalErrMessage string // CaptchaErr signals types of errors. CaptchaErr CaptchaErr // RecaptchaSiteKey is the recaptcha site key. RecaptchaSiteKey string // PostAction is the url to post response to. PostAction string }
func (Captcha) TemplateName ¶
type CaptchaErr ¶
type Classlist ¶
func (Classlist) TemplateName ¶
type Error ¶
func (Error) TemplateName ¶
type ErrorWrapper ¶
type ErrorWrapper func(Context, http.ResponseWriter) error
func (ErrorWrapper) ServeHTTP ¶
func (fn ErrorWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ManArticle ¶
type ManArticle struct { Title string Description string Board *pttbbs.Board Path string Content template.HTML ContentTail template.HTML ContentTruncated bool }
func (ManArticle) TemplateName ¶
func (ManArticle) TemplateName() string
type ManIndex ¶
func (ManIndex) TemplateName ¶
type NeedToWriteHeaders ¶
type NeedToWriteHeaders interface {
WriteHeaders(w http.ResponseWriter) error
}
type NotFound ¶
type NotFound struct{}
func (NotFound) TemplateName ¶
func (*NotFound) WriteHeaders ¶
func (p *NotFound) WriteHeaders(w http.ResponseWriter) error
type NotFoundError ¶
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type Redirect ¶
func NewRedirect ¶
func (*Redirect) WriteHeaders ¶
func (p *Redirect) WriteHeaders(w http.ResponseWriter) error
type TemplateMap ¶
Click to show internal directories.
Click to hide internal directories.