Make ref and relref respect plainIdAnchors

Fixes #813
This commit is contained in:
bep 2015-01-21 14:35:33 +01:00
parent e5be592ee0
commit 1cc6386937
2 changed files with 8 additions and 4 deletions

View file

@ -78,8 +78,8 @@ type PageMeta struct {
}
type Position struct {
Prev *Page
Next *Page
Prev *Page
Next *Page
PrevInSection *Page
NextInSection *Page
}
@ -204,6 +204,10 @@ func (p *Page) getRenderingConfigFlags() map[string]bool {
return flags
}
func (p *Page) isRenderingFlagEnabled(flag string) bool {
return p.getRenderingConfigFlags()[flag]
}
func newPage(filename string) *Page {
page := Page{contentType: "",
Source: Source{File: *source.NewFile(filename)},

View file

@ -186,9 +186,9 @@ func (s *SiteInfo) refLink(ref string, page *Page, relative bool) (string, error
if refUrl.Fragment != "" {
link = link + "#" + refUrl.Fragment
if refUrl.Path != "" && target != nil {
if refUrl.Path != "" && target != nil && !target.isRenderingFlagEnabled("plainIdAnchors") {
link = link + ":" + target.UniqueId()
} else if page != nil {
} else if page != nil && !page.isRenderingFlagEnabled("plainIdAnchors") {
link = link + ":" + page.UniqueId()
}
}