🎨 Format comments and code width

Use 100 instead 80
This commit is contained in:
Maxim Lebedev 2017-12-13 15:15:18 +05:00
parent 97ea0772e7
commit ffbe39bb83
No known key found for this signature in database
GPG Key ID: F8978F46FF0FFA4F
8 changed files with 28 additions and 35 deletions

View File

@ -78,7 +78,8 @@ func domToNode(domNode *html.Node) interface{} {
var nodeElement NodeElement var nodeElement NodeElement
switch strings.ToLower(domNode.Data) { switch strings.ToLower(domNode.Data) {
case "a", "aside", "b", "blockquote", "br", "code", "em", "figcaption", "figure", "h3", "h4", "hr", "i", "iframe", "img", "li", "ol", "p", "pre", "s", "strong", "u", "ul", "video": case "a", "aside", "b", "blockquote", "br", "code", "em", "figcaption", "figure", "h3", "h4",
"hr", "i", "iframe", "img", "li", "ol", "p", "pre", "s", "strong", "u", "ul", "video":
nodeElement.Tag = domNode.Data nodeElement.Tag = domNode.Data
for i := range domNode.Attr { for i := range domNode.Attr {

View File

@ -38,17 +38,16 @@ type Account struct {
func CreateAccount(account *Account) (*Account, error) { func CreateAccount(account *Account) (*Account, error) {
args := http.AcquireArgs() args := http.AcquireArgs()
// Account name, helps users with several accounts remember which they are // Account name, helps users with several accounts remember which they are currently using.
// currently using. Displayed to the user above the "Edit/Publish" button // Displayed to the user above the "Edit/Publish" button on Telegra.ph, other users don't see
// on Telegra.ph, other users don't see this name. // this name.
args.Add("short_name", account.ShortName) // required args.Add("short_name", account.ShortName) // required
// Default author name used when creating new articles. // Default author name used when creating new articles.
args.Add("author_name", account.AuthorName) args.Add("author_name", account.AuthorName)
// Default profile link, opened when users click on the author's name // Default profile link, opened when users click on the author's name below the title. Can be any
// below the title. Can be any link, not necessarily to a Telegram profile // link, not necessarily to a Telegram profile or channel.
// or channel.
args.Add("author_url", account.AuthorURL) args.Add("author_url", account.AuthorURL)
body, err := request("createAccount", "", args) body, err := request("createAccount", "", args)

View File

@ -57,9 +57,8 @@ func (account *Account) CreatePage(page *Page, returnContent bool) (*Page, error
} }
if page.AuthorURL != "" { if page.AuthorURL != "" {
// Profile link, opened when users click on the author's name below // Profile link, opened when users click on the author's name below the title. Can be any
// the title. Can be any link, not necessarily to a Telegram profile // link, not necessarily to a Telegram profile or channel.
// or channel.
args.Add("author_url", page.AuthorURL) args.Add("author_url", page.AuthorURL)
} }

View File

@ -5,9 +5,8 @@ import (
http "github.com/valyala/fasthttp" http "github.com/valyala/fasthttp"
) )
// EditAccountInfo update information about a Telegraph account. Pass only the // EditAccountInfo update information about a Telegraph account. Pass only the parameters that you
// parameters that you want to edit. On success, returns an Account object // want to edit. On success, returns an Account object with the default fields.
// with the default fields.
func (account *Account) EditAccountInfo(update *Account) (*Account, error) { func (account *Account) EditAccountInfo(update *Account) (*Account, error) {
args := http.AcquireArgs() args := http.AcquireArgs()
@ -20,9 +19,8 @@ func (account *Account) EditAccountInfo(update *Account) (*Account, error) {
// New default author name used when creating new articles. // New default author name used when creating new articles.
args.Add("author_name", update.AuthorName) args.Add("author_name", update.AuthorName)
// New default profile link, opened when users click on the author's name // New default profile link, opened when users click on the author's name below the title. Can be
// below the title. Can be any link, not necessarily to a Telegram profile // any link, not necessarily to a Telegram profile or channel.
// or channel.
args.Add("author_url", update.AuthorURL) args.Add("author_url", update.AuthorURL)
body, err := request("editAccountInfo", "", args) body, err := request("editAccountInfo", "", args)

View File

@ -7,8 +7,7 @@ import (
http "github.com/valyala/fasthttp" http "github.com/valyala/fasthttp"
) )
// EditPage edit an existing Telegraph page. On success, returns a Page // EditPage edit an existing Telegraph page. On success, returns a Page object.
// object.
func (account *Account) EditPage(update *Page, returnContent bool) (*Page, error) { func (account *Account) EditPage(update *Page, returnContent bool) (*Page, error) {
args := http.AcquireArgs() args := http.AcquireArgs()
@ -24,9 +23,8 @@ func (account *Account) EditPage(update *Page, returnContent bool) (*Page, error
} }
if update.AuthorURL != "" { if update.AuthorURL != "" {
// Profile link, opened when users click on the author's name below // Profile link, opened when users click on the author's name below the title. Can be any
// the title. Can be any link, not necessarily to a Telegram profile // link, not necessarily to a Telegram profile or channel.
// or channel.
args.Add("author_url", update.AuthorURL) args.Add("author_url", update.AuthorURL)
} }

View File

@ -34,8 +34,8 @@ func (account *Account) GetAccountInfo(fields ...string) (*Account, error) {
// Access token of the Telegraph account. // Access token of the Telegraph account.
args.Add("access_token", account.AccessToken) // required args.Add("access_token", account.AccessToken) // required
// List of account fields to return. Available fields: short_name, // List of account fields to return.
// author_name, author_url, auth_url, page_count. // Available fields: short_name, author_name, author_url, auth_url, page_count.
args.Add("fields", fmt.Sprint(`["`, strings.Join(fields, `","`), `"]`)) args.Add("fields", fmt.Sprint(`["`, strings.Join(fields, `","`), `"]`))
body, err := request("getAccountInfo", "", args) body, err := request("getAccountInfo", "", args)

View File

@ -19,26 +19,25 @@ func GetViews(path string, hour, day, month, year int) (*PageViews, error) {
args := http.AcquireArgs() args := http.AcquireArgs()
if hour > -1 { if hour > -1 {
// If passed, the number of page views for the requested hour will // If passed, the number of page views for the requested hour will be returned.
// be returned.
args.Add("hour", strconv.Itoa(hour)) args.Add("hour", strconv.Itoa(hour))
} }
if day > 0 { if day > 0 {
// Required if hour is passed. If passed, the number of page views // Required if hour is passed. If passed, the number of page views for the requested day will
// for the requested day will be returned. // be returned.
args.Add("day", strconv.Itoa(day)) args.Add("day", strconv.Itoa(day))
} }
if month > 0 { if month > 0 {
// Required if day is passed. If passed, the number of page views // Required if day is passed. If passed, the number of page views for the requested month will
// for the requested month will be returned. // be returned.
args.Add("month", strconv.Itoa(month)) args.Add("month", strconv.Itoa(month))
} }
if year > 0 { if year > 0 {
// Required if month is passed. If passed, the number of page views // Required if month is passed. If passed, the number of page views for the requested year
// for the requested year will be returned. // will be returned.
args.Add("year", strconv.Itoa(year)) args.Add("year", strconv.Itoa(year))
} }

View File

@ -5,10 +5,9 @@ import (
http "github.com/valyala/fasthttp" http "github.com/valyala/fasthttp"
) )
// RevokeAccessToken revoke access_token and generate a new one, for example, // RevokeAccessToken revoke access_token and generate a new one, for example, if the user would
// if the user would like to reset all connected sessions, or you have reasons // like to reset all connected sessions, or you have reasons to believe the token was compromised. On
// to believe the token was compromised. On success, returns an Account object // success, returns an Account object with new access_token and auth_url fields.
// with new access_token and auth_url fields.
func (account *Account) RevokeAccessToken() (*Account, error) { func (account *Account) RevokeAccessToken() (*Account, error) {
args := http.AcquireArgs() args := http.AcquireArgs()