mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-05 02:29:54 +00:00
Play with Hypha.Name
This commit is contained in:
parent
128f40288b
commit
1c317e39aa
@ -53,9 +53,9 @@ func IndexBacklinks() {
|
||||
}
|
||||
|
||||
// BacklinksCount returns the amount of backlinks to the hypha.
|
||||
func BacklinksCount(h *hyphae.Hypha) int {
|
||||
if _, exists := backlinkIndex[h.Name]; exists {
|
||||
return len(backlinkIndex[h.Name])
|
||||
func BacklinksCount(h hyphae.Hypher) int {
|
||||
if links, exists := backlinkIndex[h.CanonicalName()]; exists {
|
||||
return len(links)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
@ -9,27 +9,27 @@ import (
|
||||
)
|
||||
|
||||
// UpdateBacklinksAfterEdit is a creation/editing hook for backlinks index
|
||||
func UpdateBacklinksAfterEdit(h *hyphae.Hypha, oldText string) {
|
||||
oldLinks := extractHyphaLinksFromContent(h.Name, oldText)
|
||||
func UpdateBacklinksAfterEdit(h hyphae.Hypher, oldText string) {
|
||||
oldLinks := extractHyphaLinksFromContent(h.CanonicalName(), oldText)
|
||||
newLinks := extractHyphaLinks(h)
|
||||
backlinkConveyor <- backlinkIndexEdit{h.Name, oldLinks, newLinks}
|
||||
backlinkConveyor <- backlinkIndexEdit{h.CanonicalName(), oldLinks, newLinks}
|
||||
}
|
||||
|
||||
// UpdateBacklinksAfterDelete is a deletion hook for backlinks index
|
||||
func UpdateBacklinksAfterDelete(h *hyphae.Hypha, oldText string) {
|
||||
oldLinks := extractHyphaLinksFromContent(h.Name, oldText)
|
||||
backlinkConveyor <- backlinkIndexDeletion{h.Name, oldLinks}
|
||||
func UpdateBacklinksAfterDelete(h hyphae.Hypher, oldText string) {
|
||||
oldLinks := extractHyphaLinksFromContent(h.CanonicalName(), oldText)
|
||||
backlinkConveyor <- backlinkIndexDeletion{h.CanonicalName(), oldLinks}
|
||||
}
|
||||
|
||||
// UpdateBacklinksAfterRename is a renaming hook for backlinks index
|
||||
func UpdateBacklinksAfterRename(h *hyphae.Hypha, oldName string) {
|
||||
func UpdateBacklinksAfterRename(h hyphae.Hypher, oldName string) {
|
||||
actualLinks := extractHyphaLinks(h)
|
||||
backlinkConveyor <- backlinkIndexRenaming{oldName, h.Name, actualLinks}
|
||||
backlinkConveyor <- backlinkIndexRenaming{oldName, h.CanonicalName(), actualLinks}
|
||||
}
|
||||
|
||||
// extractHyphaLinks extracts hypha links from a desired hypha
|
||||
func extractHyphaLinks(h *hyphae.Hypha) []string {
|
||||
return extractHyphaLinksFromContent(h.Name, fetchText(h))
|
||||
func extractHyphaLinks(h hyphae.Hypher) []string {
|
||||
return extractHyphaLinksFromContent(h.CanonicalName(), fetchText(h))
|
||||
}
|
||||
|
||||
// extractHyphaLinksFromContent extracts local hypha links from the provided text.
|
||||
|
@ -20,7 +20,7 @@ func Index(path string) {
|
||||
|
||||
for h := range ch {
|
||||
// It's safe to ignore the mutex because there is a single worker right now.
|
||||
if oh := ByName(h.Name); oh.Exists {
|
||||
if oh := ByName(h.name); oh.Exists {
|
||||
oh.mergeIn(h)
|
||||
} else {
|
||||
h.insert()
|
||||
@ -51,7 +51,7 @@ func indexHelper(path string, nestLevel uint, ch chan *Hypha) {
|
||||
var (
|
||||
hyphaPartPath = filepath.Join(path, node.Name())
|
||||
hyphaName, isText, skip = mimetype.DataFromFilename(hyphaPartPath)
|
||||
hypha = &Hypha{Name: hyphaName, Exists: true}
|
||||
hypha = &Hypha{name: hyphaName, Exists: true}
|
||||
)
|
||||
if !skip {
|
||||
if isText {
|
||||
|
@ -31,17 +31,19 @@ func IsValidName(hyphaName string) bool {
|
||||
type Hypha struct {
|
||||
sync.RWMutex
|
||||
|
||||
Name string // Canonical name
|
||||
name string // Canonical name
|
||||
Exists bool
|
||||
TextPath string // == "" => no text part
|
||||
binaryPath string // == "" => no attachment
|
||||
}
|
||||
|
||||
func (h *Hypha) SetName(s string) { h.name = s }
|
||||
|
||||
func (h *Hypha) BinaryPath() string { return h.binaryPath }
|
||||
func (h *Hypha) SetBinaryPath(s string) { h.binaryPath = s }
|
||||
|
||||
func (h *Hypha) CanonicalName() string {
|
||||
return h.Name
|
||||
return h.name
|
||||
}
|
||||
|
||||
func (h *Hypha) Kind() HyphaKind {
|
||||
@ -65,7 +67,7 @@ func (h *Hypha) HasTextPart() bool {
|
||||
// TextPartPath returns rooted path to the file where the text part should be.
|
||||
func (h *Hypha) TextPartPath() string {
|
||||
if h.TextPath == "" {
|
||||
return filepath.Join(files.HyphaeDir(), h.Name+".myco")
|
||||
return filepath.Join(files.HyphaeDir(), h.name+".myco")
|
||||
}
|
||||
return h.TextPath
|
||||
}
|
||||
@ -81,7 +83,7 @@ var byNamesMutex = sync.Mutex{}
|
||||
// EmptyHypha returns an empty hypha struct with given name.
|
||||
func EmptyHypha(hyphaName string) *Hypha {
|
||||
return &Hypha{
|
||||
Name: hyphaName,
|
||||
name: hyphaName,
|
||||
Exists: false,
|
||||
TextPath: "",
|
||||
binaryPath: "",
|
||||
@ -99,7 +101,7 @@ func ByName(hyphaName string) (h *Hypha) {
|
||||
|
||||
func storeHypha(h *Hypha) {
|
||||
byNamesMutex.Lock()
|
||||
byNames[h.Name] = h
|
||||
byNames[h.name] = h
|
||||
byNamesMutex.Unlock()
|
||||
|
||||
h.Lock()
|
||||
@ -108,8 +110,8 @@ func storeHypha(h *Hypha) {
|
||||
}
|
||||
|
||||
// insert inserts the hypha into the storage. A previous record is used if possible. Count incrementation is done if needed.
|
||||
func (h *Hypha) insert() (justRecorded bool) {
|
||||
hp, recorded := byNames[h.Name]
|
||||
func (h *Hypha) insert() (madeNewRecord bool) {
|
||||
hp, recorded := byNames[h.name]
|
||||
if recorded {
|
||||
hp.mergeIn(h)
|
||||
} else {
|
||||
@ -121,20 +123,20 @@ func (h *Hypha) insert() (justRecorded bool) {
|
||||
}
|
||||
|
||||
// InsertIfNew checks whether hypha exists and returns `true` if it didn't and has been created.
|
||||
func (h *Hypha) InsertIfNew() (justRecorded bool) {
|
||||
if !h.Exists {
|
||||
return h.insert()
|
||||
func (h *Hypha) InsertIfNew() (madeNewRecord bool) {
|
||||
if h.DoesExist() {
|
||||
return false
|
||||
}
|
||||
return false
|
||||
return h.insert()
|
||||
}
|
||||
|
||||
// RenameTo renames a hypha and performs respective changes in the storage.
|
||||
func (h *Hypha) RenameTo(newName string) {
|
||||
byNamesMutex.Lock()
|
||||
h.Lock()
|
||||
delete(byNames, h.Name)
|
||||
h.Name = newName
|
||||
byNames[h.Name] = h
|
||||
delete(byNames, h.CanonicalName())
|
||||
h.SetName(newName)
|
||||
byNames[h.CanonicalName()] = h
|
||||
byNamesMutex.Unlock()
|
||||
h.Unlock()
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ func DeleteHypha(u *user.User, h *hyphae.Hypha, lc *l18n.Localizer) (hop *histor
|
||||
originalText, _ := FetchTextPart(h)
|
||||
hop.
|
||||
WithFilesRemoved(h.TextPath, h.BinaryPath()).
|
||||
WithMsg(fmt.Sprintf("Delete ‘%s’", h.Name)).
|
||||
WithMsg(fmt.Sprintf("Delete ‘%s’", h.CanonicalName())).
|
||||
WithUser(u).
|
||||
Apply()
|
||||
if !hop.HasErrors() {
|
||||
|
@ -20,7 +20,7 @@ func UnattachHypha(u *user.User, h *hyphae.Hypha, lc *l18n.Localizer) (hop *hist
|
||||
|
||||
hop.
|
||||
WithFilesRemoved(h.BinaryPath()).
|
||||
WithMsg(fmt.Sprintf("Unattach ‘%s’", h.Name)).
|
||||
WithMsg(fmt.Sprintf("Unattach ‘%s’", h.CanonicalName())).
|
||||
WithUser(u).
|
||||
Apply()
|
||||
|
||||
|
@ -31,9 +31,9 @@ func UploadText(h *hyphae.Hypha, data []byte, message string, u *user.User, lc *
|
||||
}
|
||||
|
||||
if message == "" {
|
||||
hop.WithMsg(fmt.Sprintf("%s ‘%s’", action, h.Name))
|
||||
hop.WithMsg(fmt.Sprintf("%s ‘%s’", action, h.CanonicalName()))
|
||||
} else {
|
||||
hop.WithMsg(fmt.Sprintf("%s ‘%s’: %s", action, h.Name, message))
|
||||
hop.WithMsg(fmt.Sprintf("%s ‘%s’: %s", action, h.CanonicalName(), message))
|
||||
}
|
||||
|
||||
if errtitle, err := CanEdit(u, h, lc); err != nil {
|
||||
@ -49,7 +49,7 @@ func UploadText(h *hyphae.Hypha, data []byte, message string, u *user.User, lc *
|
||||
// UploadBinary edits a hypha' attachment and makes a history record about that.
|
||||
func UploadBinary(h *hyphae.Hypha, mime string, file multipart.File, u *user.User, lc *l18n.Localizer) (*history.Op, string) {
|
||||
var (
|
||||
hop = history.Operation(history.TypeEditBinary).WithMsg(fmt.Sprintf("Upload attachment for ‘%s’ with type ‘%s’", h.Name, mime))
|
||||
hop = history.Operation(history.TypeEditBinary).WithMsg(fmt.Sprintf("Upload attachment for ‘%s’ with type ‘%s’", h.CanonicalName(), mime))
|
||||
data, err = io.ReadAll(file)
|
||||
)
|
||||
|
||||
@ -69,11 +69,11 @@ func UploadBinary(h *hyphae.Hypha, mime string, file multipart.File, u *user.Use
|
||||
// uploadHelp is a helper function for UploadText and UploadBinary
|
||||
func uploadHelp(h *hyphae.Hypha, hop *history.Op, ext string, data []byte, u *user.User) (*history.Op, string) {
|
||||
var (
|
||||
fullPath = filepath.Join(files.HyphaeDir(), h.Name+ext)
|
||||
fullPath = filepath.Join(files.HyphaeDir(), h.CanonicalName()+ext)
|
||||
sourceFullPath = h.TextPartPath()
|
||||
originalText = "" // for backlink update
|
||||
)
|
||||
if !isValidPath(fullPath) || !hyphae.IsValidName(h.Name) {
|
||||
if !isValidPath(fullPath) || !hyphae.IsValidName(h.CanonicalName()) {
|
||||
err := errors.New("bad path")
|
||||
return hop.WithErrAbort(err), err.Error()
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ if err != nil {
|
||||
<div class="layout">
|
||||
<main class="main-width">
|
||||
<article>
|
||||
<h1>{%s= lc.Get("ui.diff_title", &l18n.Replacements{"name": beautifulLink(h.Name), "rev": hash}) %}</h1>
|
||||
<h1>{%s= lc.Get("ui.diff_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName()), "rev": hash}) %}</h1>
|
||||
<pre class="codeblock"><code>{%s text %}</code></pre>
|
||||
</article>
|
||||
</main>
|
||||
|
@ -60,7 +60,7 @@ func StreamPrimitiveDiffHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyp
|
||||
<article>
|
||||
<h1>`)
|
||||
//line views/history.qtpl:23
|
||||
qw422016.N().S(lc.Get("ui.diff_title", &l18n.Replacements{"name": beautifulLink(h.Name), "rev": hash}))
|
||||
qw422016.N().S(lc.Get("ui.diff_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName()), "rev": hash}))
|
||||
//line views/history.qtpl:23
|
||||
qw422016.N().S(`</h1>
|
||||
<pre class="codeblock"><code>`)
|
||||
|
@ -27,13 +27,13 @@
|
||||
<h3 class="non-existent-hypha__subtitle">📝 {%s lc.Get("ui.notexist_write") %}</h3>
|
||||
<p>{%s= lc.Get("ui.notexist_write_tip1", &l18n.Replacements{"myco": mycoLink(lc)}) %}</p>
|
||||
<p>{%s lc.Get("ui.notexist_write_tip2") %}</p>
|
||||
<a class="btn btn_accent stick-to-bottom" href="/edit/{%s h.Name %}">{%s lc.Get("ui.notexist_write_button") %}</a>
|
||||
<a class="btn btn_accent stick-to-bottom" href="/edit/{%s h.CanonicalName() %}">{%s lc.Get("ui.notexist_write_button") %}</a>
|
||||
</section>
|
||||
|
||||
<section class="non-existent-hypha__way">
|
||||
<h3 class="non-existent-hypha__subtitle">🖼 {%s lc.Get("ui.notexist_media") %}</h3>
|
||||
<p>{%s lc.Get("ui.notexist_media_tip1") %}</p>
|
||||
<form action="/upload-binary/{%s h.Name %}"
|
||||
<form action="/upload-binary/{%s h.CanonicalName() %}"
|
||||
method="post" enctype="multipart/form-data"
|
||||
class="upload-binary">
|
||||
<label for="upload-binary__input"></label>
|
||||
@ -51,7 +51,7 @@
|
||||
{% code
|
||||
var (
|
||||
prevAcc = "/hypha/"
|
||||
parts = strings.Split(h.Name, "/")
|
||||
parts = strings.Split(h.CanonicalName(), "/")
|
||||
)
|
||||
%}
|
||||
<h1 class="navi-title">
|
||||
@ -82,28 +82,28 @@
|
||||
|
||||
{% case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico" %}
|
||||
<div class="binary-container binary-container_with-img">
|
||||
<a href="/binary/{%s= h.Name %}"><img src="/binary/{%s= h.Name %}"/></a>
|
||||
<a href="/binary/{%s= h.CanonicalName() %}"><img src="/binary/{%s= h.CanonicalName() %}"/></a>
|
||||
</div>
|
||||
|
||||
{% case ".ogg", ".webm", ".mp4" %}
|
||||
<div class="binary-container binary-container_with-video">
|
||||
<video controls>
|
||||
<source src="/binary/{%s= h.Name %}"/>
|
||||
<p>{%s lc.Get("ui.media_novideo") %} <a href="/binary/{%s= h.Name %}">{%s lc.Get("ui.media_novideo_link") %}</a></p>
|
||||
<source src="/binary/{%s= h.CanonicalName() %}"/>
|
||||
<p>{%s lc.Get("ui.media_novideo") %} <a href="/binary/{%s= h.CanonicalName() %}">{%s lc.Get("ui.media_novideo_link") %}</a></p>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
{% case ".mp3" %}
|
||||
<div class="binary-container binary-container_with-audio">
|
||||
<audio controls>
|
||||
<source src="/binary/{%s= h.Name %}"/>
|
||||
<p>{%s lc.Get("ui.media_noaudio") %} <a href="/binary/{%s= h.Name %}">{%s lc.Get("ui.media_noaudio_link") %}</a></p>
|
||||
<source src="/binary/{%s= h.CanonicalName() %}"/>
|
||||
<p>{%s lc.Get("ui.media_noaudio") %} <a href="/binary/{%s= h.CanonicalName() %}">{%s lc.Get("ui.media_noaudio_link") %}</a></p>
|
||||
</audio>
|
||||
</div>
|
||||
|
||||
{% default %}
|
||||
<div class="binary-container binary-container_with-nothing">
|
||||
<p><a href="/binary/{%s= h.Name %}">{%s lc.Get("ui.media_download") %}</a></p>
|
||||
<p><a href="/binary/{%s= h.CanonicalName() %}">{%s lc.Get("ui.media_download") %}</a></p>
|
||||
</div>
|
||||
{% endswitch %}
|
||||
{% endfunc %}
|
||||
|
@ -181,7 +181,7 @@ func streamnonExistentHyphaNotice(qw422016 *qt422016.Writer, h *hyphae.Hypha, u
|
||||
qw422016.N().S(`</p>
|
||||
<a class="btn btn_accent stick-to-bottom" href="/edit/`)
|
||||
//line views/hypha.qtpl:30
|
||||
qw422016.E().S(h.Name)
|
||||
qw422016.E().S(h.CanonicalName())
|
||||
//line views/hypha.qtpl:30
|
||||
qw422016.N().S(`">`)
|
||||
//line views/hypha.qtpl:30
|
||||
@ -203,7 +203,7 @@ func streamnonExistentHyphaNotice(qw422016 *qt422016.Writer, h *hyphae.Hypha, u
|
||||
qw422016.N().S(`</p>
|
||||
<form action="/upload-binary/`)
|
||||
//line views/hypha.qtpl:36
|
||||
qw422016.E().S(h.Name)
|
||||
qw422016.E().S(h.CanonicalName())
|
||||
//line views/hypha.qtpl:36
|
||||
qw422016.N().S(`"
|
||||
method="post" enctype="multipart/form-data"
|
||||
@ -263,7 +263,7 @@ func StreamNaviTitleHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha) {
|
||||
//line views/hypha.qtpl:52
|
||||
var (
|
||||
prevAcc = "/hypha/"
|
||||
parts = strings.Split(h.Name, "/")
|
||||
parts = strings.Split(h.CanonicalName(), "/")
|
||||
)
|
||||
|
||||
//line views/hypha.qtpl:56
|
||||
@ -395,11 +395,11 @@ func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha, lc *l18n.L
|
||||
<div class="binary-container binary-container_with-img">
|
||||
<a href="/binary/`)
|
||||
//line views/hypha.qtpl:85
|
||||
qw422016.N().S(h.Name)
|
||||
qw422016.N().S(h.CanonicalName())
|
||||
//line views/hypha.qtpl:85
|
||||
qw422016.N().S(`"><img src="/binary/`)
|
||||
//line views/hypha.qtpl:85
|
||||
qw422016.N().S(h.Name)
|
||||
qw422016.N().S(h.CanonicalName())
|
||||
//line views/hypha.qtpl:85
|
||||
qw422016.N().S(`"/></a>
|
||||
</div>
|
||||
@ -413,7 +413,7 @@ func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha, lc *l18n.L
|
||||
<video controls>
|
||||
<source src="/binary/`)
|
||||
//line views/hypha.qtpl:91
|
||||
qw422016.N().S(h.Name)
|
||||
qw422016.N().S(h.CanonicalName())
|
||||
//line views/hypha.qtpl:91
|
||||
qw422016.N().S(`"/>
|
||||
<p>`)
|
||||
@ -422,7 +422,7 @@ func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha, lc *l18n.L
|
||||
//line views/hypha.qtpl:92
|
||||
qw422016.N().S(` <a href="/binary/`)
|
||||
//line views/hypha.qtpl:92
|
||||
qw422016.N().S(h.Name)
|
||||
qw422016.N().S(h.CanonicalName())
|
||||
//line views/hypha.qtpl:92
|
||||
qw422016.N().S(`">`)
|
||||
//line views/hypha.qtpl:92
|
||||
@ -441,7 +441,7 @@ func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha, lc *l18n.L
|
||||
<audio controls>
|
||||
<source src="/binary/`)
|
||||
//line views/hypha.qtpl:99
|
||||
qw422016.N().S(h.Name)
|
||||
qw422016.N().S(h.CanonicalName())
|
||||
//line views/hypha.qtpl:99
|
||||
qw422016.N().S(`"/>
|
||||
<p>`)
|
||||
@ -450,7 +450,7 @@ func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha, lc *l18n.L
|
||||
//line views/hypha.qtpl:100
|
||||
qw422016.N().S(` <a href="/binary/`)
|
||||
//line views/hypha.qtpl:100
|
||||
qw422016.N().S(h.Name)
|
||||
qw422016.N().S(h.CanonicalName())
|
||||
//line views/hypha.qtpl:100
|
||||
qw422016.N().S(`">`)
|
||||
//line views/hypha.qtpl:100
|
||||
@ -468,7 +468,7 @@ func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha, lc *l18n.L
|
||||
<div class="binary-container binary-container_with-nothing">
|
||||
<p><a href="/binary/`)
|
||||
//line views/hypha.qtpl:106
|
||||
qw422016.N().S(h.Name)
|
||||
qw422016.N().S(h.CanonicalName())
|
||||
//line views/hypha.qtpl:106
|
||||
qw422016.N().S(`">`)
|
||||
//line views/hypha.qtpl:106
|
||||
|
@ -8,7 +8,7 @@
|
||||
{% func hyphaInfoEntry(h *hyphae.Hypha, u *user.User, action, displayText string) %}
|
||||
{% if u.CanProceed(action) %}
|
||||
<li class="hypha-info__entry hypha-info__entry_{%s action %}">
|
||||
<a class="hypha-info__link" href="/{%s action %}/{%s h.Name %}">{%s displayText %}</a>
|
||||
<a class="hypha-info__link" href="/{%s action %}/{%s h.CanonicalName() %}">{%s displayText %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfunc %}
|
||||
|
@ -55,7 +55,7 @@ func streamhyphaInfoEntry(qw422016 *qt422016.Writer, h *hyphae.Hypha, u *user.Us
|
||||
//line views/nav.qtpl:11
|
||||
qw422016.N().S(`/`)
|
||||
//line views/nav.qtpl:11
|
||||
qw422016.E().S(h.Name)
|
||||
qw422016.E().S(h.CanonicalName())
|
||||
//line views/nav.qtpl:11
|
||||
qw422016.N().S(`">`)
|
||||
//line views/nav.qtpl:11
|
||||
|
@ -17,7 +17,7 @@
|
||||
%}
|
||||
<div class="layout">
|
||||
<main class="main-width attachment-tab">
|
||||
<h1>{%s= lc.Get("ui.attach_title", &l18n.Replacements{"name": beautifulLink(h.Name)}) %}</h1>
|
||||
<h1>{%s= lc.Get("ui.attach_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())}) %}</h1>
|
||||
{% if h.BinaryPath() == "" %}
|
||||
<p class="explanation">{%s lc.Get("ui.attach_empty") %} <a href="/help/en/attachment" class="shy-link">{%s lc.Get("ui.attach_link") %}</a></p>
|
||||
{% else %}
|
||||
@ -42,13 +42,13 @@
|
||||
<fieldset class="amnt-menu-block">
|
||||
<legend class="modal__title modal__title_small">{%s lc.Get("ui.attach_include") %}</legend>
|
||||
<p class="modal__confirmation-msg">{%s lc.Get("ui.attach_include_tip") %}</p>
|
||||
<pre class="codeblock"><code>img { {%s h.Name %} }</code></pre>
|
||||
<pre class="codeblock"><code>img { {%s h.CanonicalName() %} }</code></pre>
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if u.CanProceed("upload-binary") %}
|
||||
<form action="/upload-binary/{%s h.Name %}"
|
||||
<form action="/upload-binary/{%s h.CanonicalName() %}"
|
||||
method="post" enctype="multipart/form-data"
|
||||
class="upload-binary modal amnt-menu-block">
|
||||
<fieldset class="modal__fieldset">
|
||||
@ -63,7 +63,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% if h.BinaryPath() != "" && u.CanProceed("unattach-confirm") %}
|
||||
<form action="/unattach-confirm/{%s h.Name %}" method="post" class="modal amnt-menu-block">
|
||||
<form action="/unattach-confirm/{%s h.CanonicalName() %}" method="post" class="modal amnt-menu-block">
|
||||
<fieldset class="modal__fieldset">
|
||||
<legend class="modal__title modal__title_small">{%s lc.Get("ui.attach_remove") %}</legend>
|
||||
<p class="modal__confirmation-msg">{%s lc.Get("ui.attach_remove_tip") %}</p>
|
||||
@ -82,7 +82,7 @@ If `contents` == "", a helpful message is shown instead.
|
||||
If you rename .prevnext, change the docs too.
|
||||
{% func HyphaHTML(rq *http.Request, lc *l18n.Localizer, h *hyphae.Hypha, contents string) %}
|
||||
{% code
|
||||
siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.Name)
|
||||
siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.CanonicalName())
|
||||
u := user.FromRequest(rq)
|
||||
%}
|
||||
<div class="layout">
|
||||
@ -90,11 +90,11 @@ If you rename .prevnext, change the docs too.
|
||||
<section id="hypha">
|
||||
{% if u.CanProceed("edit") %}
|
||||
<div class="btn btn_navititle">
|
||||
<a class="btn__link_navititle" href="/edit/{%s h.Name %}">{%s lc.Get("ui.edit_link") %}</a>
|
||||
<a class="btn__link_navititle" href="/edit/{%s h.CanonicalName() %}">{%s lc.Get("ui.edit_link") %}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if cfg.UseAuth && util.IsProfileName(h.Name) && u.Name == strings.TrimPrefix(h.Name, cfg.UserHypha + "/") %}
|
||||
{% if cfg.UseAuth && util.IsProfileName(h.CanonicalName()) && u.Name == strings.TrimPrefix(h.CanonicalName(), cfg.UserHypha + "/") %}
|
||||
<div class="btn btn_navititle">
|
||||
<a class="btn__link_navititle" href="/logout">{%s lc.Get("ui.logout_link") %}</a>
|
||||
</div>
|
||||
@ -132,12 +132,12 @@ If you rename .prevnext, change the docs too.
|
||||
|
||||
{% func RevisionHTML(rq *http.Request, lc *l18n.Localizer, h *hyphae.Hypha, contents, revHash string) %}
|
||||
{% code
|
||||
siblings, subhyphae, _, _ := tree.Tree(h.Name)
|
||||
siblings, subhyphae, _, _ := tree.Tree(h.CanonicalName())
|
||||
%}
|
||||
<div class="layout">
|
||||
<main class="main-width">
|
||||
<section>
|
||||
<p>{%s lc.Get("ui.revision_warning") %} <a href="/rev-text/{%s revHash %}/{%s h.Name %}">{%s lc.Get("ui.revision_link") %}</a></p>
|
||||
<p>{%s lc.Get("ui.revision_warning") %} <a href="/rev-text/{%s revHash %}/{%s h.CanonicalName() %}">{%s lc.Get("ui.revision_link") %}</a></p>
|
||||
{%s= NaviTitleHTML(h) %}
|
||||
{%s= contents %}
|
||||
</section>
|
||||
|
@ -64,7 +64,7 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hy
|
||||
<main class="main-width attachment-tab">
|
||||
<h1>`)
|
||||
//line views/readers.qtpl:20
|
||||
qw422016.N().S(lc.Get("ui.attach_title", &l18n.Replacements{"name": beautifulLink(h.Name)}))
|
||||
qw422016.N().S(lc.Get("ui.attach_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())}))
|
||||
//line views/readers.qtpl:20
|
||||
qw422016.N().S(`</h1>
|
||||
`)
|
||||
@ -169,7 +169,7 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hy
|
||||
qw422016.N().S(`</p>
|
||||
<pre class="codeblock"><code>img { `)
|
||||
//line views/readers.qtpl:45
|
||||
qw422016.E().S(h.Name)
|
||||
qw422016.E().S(h.CanonicalName())
|
||||
//line views/readers.qtpl:45
|
||||
qw422016.N().S(` }</code></pre>
|
||||
</fieldset>
|
||||
@ -191,7 +191,7 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hy
|
||||
qw422016.N().S(`
|
||||
<form action="/upload-binary/`)
|
||||
//line views/readers.qtpl:51
|
||||
qw422016.E().S(h.Name)
|
||||
qw422016.E().S(h.CanonicalName())
|
||||
//line views/readers.qtpl:51
|
||||
qw422016.N().S(`"
|
||||
method="post" enctype="multipart/form-data"
|
||||
@ -230,7 +230,7 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hy
|
||||
qw422016.N().S(`
|
||||
<form action="/unattach-confirm/`)
|
||||
//line views/readers.qtpl:66
|
||||
qw422016.E().S(h.Name)
|
||||
qw422016.E().S(h.CanonicalName())
|
||||
//line views/readers.qtpl:66
|
||||
qw422016.N().S(`" method="post" class="modal amnt-menu-block">
|
||||
<fieldset class="modal__fieldset">
|
||||
@ -300,7 +300,7 @@ func StreamHyphaHTML(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Local
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/readers.qtpl:85
|
||||
siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.Name)
|
||||
siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.CanonicalName())
|
||||
u := user.FromRequest(rq)
|
||||
|
||||
//line views/readers.qtpl:87
|
||||
@ -316,7 +316,7 @@ func StreamHyphaHTML(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Local
|
||||
<div class="btn btn_navititle">
|
||||
<a class="btn__link_navititle" href="/edit/`)
|
||||
//line views/readers.qtpl:93
|
||||
qw422016.E().S(h.Name)
|
||||
qw422016.E().S(h.CanonicalName())
|
||||
//line views/readers.qtpl:93
|
||||
qw422016.N().S(`">`)
|
||||
//line views/readers.qtpl:93
|
||||
@ -332,7 +332,7 @@ func StreamHyphaHTML(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Local
|
||||
|
||||
`)
|
||||
//line views/readers.qtpl:97
|
||||
if cfg.UseAuth && util.IsProfileName(h.Name) && u.Name == strings.TrimPrefix(h.Name, cfg.UserHypha+"/") {
|
||||
if cfg.UseAuth && util.IsProfileName(h.CanonicalName()) && u.Name == strings.TrimPrefix(h.CanonicalName(), cfg.UserHypha+"/") {
|
||||
//line views/readers.qtpl:97
|
||||
qw422016.N().S(`
|
||||
<div class="btn btn_navititle">
|
||||
@ -496,7 +496,7 @@ func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Lo
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/readers.qtpl:135
|
||||
siblings, subhyphae, _, _ := tree.Tree(h.Name)
|
||||
siblings, subhyphae, _, _ := tree.Tree(h.CanonicalName())
|
||||
|
||||
//line views/readers.qtpl:136
|
||||
qw422016.N().S(`
|
||||
@ -513,7 +513,7 @@ func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Lo
|
||||
//line views/readers.qtpl:140
|
||||
qw422016.N().S(`/`)
|
||||
//line views/readers.qtpl:140
|
||||
qw422016.E().S(h.Name)
|
||||
qw422016.E().S(h.CanonicalName())
|
||||
//line views/readers.qtpl:140
|
||||
qw422016.N().S(`">`)
|
||||
//line views/readers.qtpl:140
|
||||
|
@ -264,7 +264,7 @@ sort.Strings(editors)
|
||||
{% for hyphaName := range sortedHypha %}
|
||||
{% code hypha := hyphae.ByName(hyphaName) %}
|
||||
<li class="hypha-list__entry">
|
||||
<a class="hypha-list__link" href="/hypha/{%s hypha.Name %}">{%s util.BeautifulName(hypha.Name) %}</a>
|
||||
<a class="hypha-list__link" href="/hypha/{%s hypha.CanonicalName() %}">{%s util.BeautifulName(hypha.CanonicalName()) %}</a>
|
||||
{% if hypha.BinaryPath() != "" %}
|
||||
<span class="hypha-list__amnt-type">{%s filepath.Ext(hypha.BinaryPath())[1:] %}</span>
|
||||
{% endif %}
|
||||
|
@ -1027,11 +1027,11 @@ func StreamHyphaListHTML(qw422016 *qt422016.Writer, lc *l18n.Localizer) {
|
||||
<li class="hypha-list__entry">
|
||||
<a class="hypha-list__link" href="/hypha/`)
|
||||
//line views/stuff.qtpl:267
|
||||
qw422016.E().S(hypha.Name)
|
||||
qw422016.E().S(hypha.CanonicalName())
|
||||
//line views/stuff.qtpl:267
|
||||
qw422016.N().S(`">`)
|
||||
//line views/stuff.qtpl:267
|
||||
qw422016.E().S(util.BeautifulName(hypha.Name))
|
||||
qw422016.E().S(util.BeautifulName(hypha.CanonicalName()))
|
||||
//line views/stuff.qtpl:267
|
||||
qw422016.N().S(`</a>
|
||||
`)
|
||||
|
Loading…
Reference in New Issue
Block a user