當前位置: 首頁>>代碼示例>>Golang>>正文


Golang helpers.RemoveSummaryDivider函數代碼示例

本文整理匯總了Golang中github.com/spf13/hugo/helpers.RemoveSummaryDivider函數的典型用法代碼示例。如果您正苦於以下問題:Golang RemoveSummaryDivider函數的具體用法?Golang RemoveSummaryDivider怎麽用?Golang RemoveSummaryDivider使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了RemoveSummaryDivider函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: PageConvert

func (h markdownHandler) PageConvert(p *Page, t tpl.Template) HandledResult {
	p.ProcessShortcodes(t)

	tmpContent, tmpTableOfContents := helpers.ExtractTOC(p.renderContent(helpers.RemoveSummaryDivider(p.rawContent)))

	if len(p.contentShortCodes) > 0 {
		replaced, err := replaceShortcodeTokensInsources(shortcodePlaceholderPrefix, p.contentShortCodes,
			tmpContent, tmpTableOfContents)
		if err != nil {
			jww.FATAL.Printf("Fail to replace shortcode tokens in %s:\n%s", p.BaseFileName(), err.Error())
			return HandledResult{err: err}
		}
		tmpContent = replaced[0]
		tmpTableOfContents = replaced[1]
	}

	s := string(tmpContent)
	if viper.GetBool("RemoveHTMLComments") {
		r, _ := regexp.Compile("<!--(.*?)-->")
		s = r.ReplaceAllString(s, "")
	}
	p.Content = template.HTML(s)

	p.TableOfContents = helpers.BytesToHTML(tmpTableOfContents)

	return HandledResult{err: nil}
}
開發者ID:yene,項目名稱:huga,代碼行數:27,代碼來源:handler_page.go

示例2: commonConvert

func commonConvert(p *Page, t tpl.Template) HandledResult {
	p.ProcessShortcodes(t)

	var err error

	if viper.GetBool("EnableEmoji") {
		p.rawContent = helpers.Emojify(p.rawContent)
	}

	renderedContent := p.renderContent(helpers.RemoveSummaryDivider(p.rawContent))

	if len(p.contentShortCodes) > 0 {
		renderedContent, err = replaceShortcodeTokens(renderedContent, shortcodePlaceholderPrefix, p.contentShortCodes)

		if err != nil {
			jww.FATAL.Printf("Failed to replace shortcode tokens in %s:\n%s", p.BaseFileName(), err.Error())
			return HandledResult{err: err}
		}
	}

	tmpContent, tmpTableOfContents := helpers.ExtractTOC(renderedContent)

	p.Content = helpers.BytesToHTML(tmpContent)
	p.TableOfContents = helpers.BytesToHTML(tmpTableOfContents)

	return HandledResult{err: nil}
}
開發者ID:nitoyon,項目名稱:hugo,代碼行數:27,代碼來源:handler_page.go

示例3: Convert

func (page *Page) Convert() error {
	markupType := page.guessMarkupType()
	switch markupType {
	case "markdown", "rst":
		tmpContent, tmpTableOfContents := helpers.ExtractTOC(page.renderContent(helpers.RemoveSummaryDivider(page.rawContent)))
		page.Content = helpers.BytesToHTML(tmpContent)
		page.TableOfContents = helpers.BytesToHTML(tmpTableOfContents)
	case "html":
		page.Content = helpers.BytesToHTML(page.rawContent)
	default:
		return fmt.Errorf("Error converting unsupported file type '%s' for page '%s'", markupType, page.Source.Path())
	}
	return nil
}
開發者ID:kuruma,項目名稱:hugo,代碼行數:14,代碼來源:page.go

示例4: PageConvert

func (h markdownHandler) PageConvert(p *Page, t tpl.Template) HandledResult {
	p.ProcessShortcodes(t)

	tmpContent, tmpTableOfContents := helpers.ExtractTOC(p.renderContent(helpers.RemoveSummaryDivider(p.rawContent)))

	if len(p.contentShortCodes) > 0 {
		tmpContentWithTokensReplaced, err := replaceShortcodeTokens(tmpContent, shortcodePlaceholderPrefix, true, p.contentShortCodes)

		if err != nil {
			jww.FATAL.Printf("Fail to replace short code tokens in %s:\n%s", p.BaseFileName(), err.Error())
			return HandledResult{err: err}
		}
		tmpContent = tmpContentWithTokensReplaced
	}

	p.Content = helpers.BytesToHTML(tmpContent)
	p.TableOfContents = helpers.BytesToHTML(tmpTableOfContents)

	return HandledResult{err: nil}
}
開發者ID:sun-friderick,項目名稱:hugo,代碼行數:20,代碼來源:handler_page.go

示例5: PageConvert

func (h asciidocHandler) PageConvert(p *Page, t tpl.Template) HandledResult {
	p.ProcessShortcodes(t)

	// TODO(spf13) Add/Refactor AsciiDoc Logic here
	tmpContent, tmpTableOfContents := helpers.ExtractTOC(p.renderContent(helpers.RemoveSummaryDivider(p.rawContent)))

	if len(p.contentShortCodes) > 0 {
		replaced, err := replaceShortcodeTokensInsources(shortcodePlaceholderPrefix, p.contentShortCodes,
			tmpContent, tmpTableOfContents)
		if err != nil {
			jww.FATAL.Printf("Fail to replace shortcode tokens in %s:\n%s", p.BaseFileName(), err.Error())
			return HandledResult{err: err}
		}
		tmpContent = replaced[0]
		tmpTableOfContents = replaced[1]
	}

	p.Content = helpers.BytesToHTML(tmpContent)
	p.TableOfContents = helpers.BytesToHTML(tmpTableOfContents)

	//err := p.Convert()
	return HandledResult{page: p, err: nil}
}
開發者ID:johndunne,項目名稱:hugo,代碼行數:23,代碼來源:handler_page.go


注:本文中的github.com/spf13/hugo/helpers.RemoveSummaryDivider函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。