diff --git a/go.mod b/go.mod index 4575763..21fcaef 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/bouncepaw/mycorrhiza go 1.16 require ( - github.com/bouncepaw/mycomarkup/v2 v2.0.3 + github.com/bouncepaw/mycomarkup/v2 v2.1.0 github.com/go-ini/ini v1.62.0 github.com/gorilla/feeds v1.1.1 github.com/gorilla/mux v1.8.0 @@ -19,7 +19,7 @@ require ( ) // Use this trick to test mycomarkup: -// replace github.com/bouncepaw/mycomarkup/v2 v2.0.0 => "/Users/bouncepaw/GolandProjects/mycomarkup" +// replace github.com/bouncepaw/mycomarkup/v2 v2.1.0 => "/Users/bouncepaw/GolandProjects/mycomarkup" // Use this utility every time Mycomarkup gets broken: // https://github.com/marwan-at-work/mod diff --git a/go.sum b/go.sum index 157cf01..1b512c6 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,8 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= -github.com/bouncepaw/mycomarkup/v2 v2.0.2 h1:BT7waogdo7KH7PVqksfmj60j8MFCcmu998oKaPnTfh0= -github.com/bouncepaw/mycomarkup/v2 v2.0.2/go.mod h1:sIvtvJFGG61ZeSUC+fNBrFmrQ2xBpTMZezk/QtxiQbk= -github.com/bouncepaw/mycomarkup/v2 v2.0.3 h1:qIO69XA9lZA87HbMPXhk9R4OL0aF0JJQcKOTx3ZjMIo= -github.com/bouncepaw/mycomarkup/v2 v2.0.3/go.mod h1:sIvtvJFGG61ZeSUC+fNBrFmrQ2xBpTMZezk/QtxiQbk= +github.com/bouncepaw/mycomarkup/v2 v2.1.0 h1:9ZtgiovBaL9xXLGLoXQG8Jgb1VtZ3mlyU5qPn3BGx+4= +github.com/bouncepaw/mycomarkup/v2 v2.1.0/go.mod h1:sIvtvJFGG61ZeSUC+fNBrFmrQ2xBpTMZezk/QtxiQbk= github.com/go-ini/ini v1.62.0 h1:7VJT/ZXjzqSrvtraFp4ONq80hTcRQth1c9ZnQ3uNQvU= github.com/go-ini/ini v1.62.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= diff --git a/help/en/prevnext.myco b/help/en/prevnext.myco new file mode 100644 index 0000000..c943d17 --- /dev/null +++ b/help/en/prevnext.myco @@ -0,0 +1,19 @@ +# Previous/next +Under every hypha there is a **previous/next** section with quick links to previous and next hyphae alphabetically. + +This design encourages you to name your hyphae in such a way that clicking through these links would make sense. For example, if you are storing pages of a book, you should name them //p01//, //p02//, //p03//, etc. + +It is impossible to change what hyphae are linked in this section. If you want to provide a different means of sequential navigation, just place some links by yourself. + +## Hotkeys +Press `n` to go to the **n**ext page, press `p` to go to the **p**revious page. + +## For administrators: how to remove these links +For some wikis, these links make little or no sense. In this case, it is better to hide them. + +In file `your-wiki/static/custom.css` write this: +```css +.prevnext { display: none; } +``` + +The section would still be there, but no one will see it. The hotkeys will still work. \ No newline at end of file diff --git a/help/ru/prevnext.myco b/help/ru/prevnext.myco new file mode 100644 index 0000000..4624883 --- /dev/null +++ b/help/ru/prevnext.myco @@ -0,0 +1,19 @@ +# Назад/далее +Под каждой гифой есть раздел **«назад/далее»** с быстрыми ссылками на предыдущую и следующую гифы по алфавитному порядку. + +Эта функция подталкивает вас именовать гифы так, чтобы использование этих ссылок имело смысл. Например, если вы храните страницы книги, вам стоит проименовать их //p01//, //p02//, //p03// и т.д. + +Невозможно изменить гифы, на которую ведут ссылки этого раздела. Если вы хотите предоставить другой способ последовательной навигации, проставьте собственные ссылки. + +## Горячие клавиши +Нажмите `n` (**n**ext), чтобы перейти на следующую страницу. Для перехода на предыдущую, нажмите `p` (**p**revious). + +## Для администраторов: как убрать эти ссылки +Для некоторых вики эти ссылки несут мало смысла или не несут вовсе. В таком случае лучше их скрыть. + +В файле `your-wiki/static/custom.css` пропишите следующее: +```css +.prevnext { display: none; } +``` + +Раздел останется на месте, но никто его не увидит. Горячие клавиши всё ещё будут работать. diff --git a/hyphae/iterators.go b/hyphae/iterators.go index 4c06216..9fb494e 100644 --- a/hyphae/iterators.go +++ b/hyphae/iterators.go @@ -2,8 +2,8 @@ package hyphae import ( - "strings" "sort" + "strings" ) // YieldExistingHyphae iterates over all hyphae and yields all existing ones. @@ -48,14 +48,22 @@ func PathographicSort(src chan string) <-chan string { // Classic lexicographical sort with a twist c := 0 for { - if c == len(raw[i]) { return true } - if c == len(raw[j]) { return false } + if c == len(raw[i]) { + return true + } + if c == len(raw[j]) { + return false + } if raw[i][c] == raw[j][c] { c++ } else { // The twist: subhyphae-awareness is about pushing slash upwards - if raw[i][c] == slash { return true } - if raw[j][c] == slash { return false } + if raw[i][c] == slash { + return true + } + if raw[j][c] == slash { + return false + } return raw[i][c] < raw[j][c] } } diff --git a/l18n/l18n.go b/l18n/l18n.go index dea0f32..560c8cb 100644 --- a/l18n/l18n.go +++ b/l18n/l18n.go @@ -1,6 +1,6 @@ // Code generated by go-localize; DO NOT EDIT. // This file was generated by robots at -// 2021-09-27 16:30:27.741694276 +0800 +08 m=+0.002576981 +// 2021-09-27 16:59:07.562882425 +0800 +08 m=+0.002415944 package l18n @@ -109,6 +109,7 @@ var localizations = map[string]string{ "en.help.lock": "Lock", "en.help.main": "Main", "en.help.mycomarkup": "Mycomarkup", + "en.help.prevnext": "Previous/next", "en.help.recent_changes": "Recent changes", "en.help.sibling_hyphae": "Sibling hyphae", "en.help.special_pages": "Special pages", @@ -210,6 +211,7 @@ var localizations = map[string]string{ "en.ui.rename_recurse": "Rename subhyphae too", "en.ui.rename_tip": "If you rename this hypha, all incoming links and all relative outcoming links will break. You will also lose all history for the new name. Rename carefully.", "en.ui.rename_to": "New name", + "en.ui.revision_link": "Get Mycomarkup source of this revision", "en.ui.revision_no_text": "This hypha had no text at this revision.", "en.ui.revision_title": "{{.name}} at {{.rev}}", "en.ui.revision_warning": "Please note that viewing attachments of hyphae is not supported in history for now.", @@ -322,6 +324,7 @@ var localizations = map[string]string{ "ru.help.lock": "Блокировка", "ru.help.main": "Введение", "ru.help.mycomarkup": "Микоразметка", + "ru.help.prevnext": "Назад/далее", "ru.help.recent_changes": "Недавние изменения", "ru.help.sibling_hyphae": "Гифы-сиблинги", "ru.help.special_pages": "Специальные страницы", @@ -427,6 +430,7 @@ var localizations = map[string]string{ "ru.ui.rename_recurse": "Также переименовать подгифы", "ru.ui.rename_tip": "Если вы переименуете эту гифу, сломаются все ссылки, ведущие на неё, а также исходящие относительные ссылки. Также вы потеряете всю текущую историю для нового названия. Переименовывайте аккуратно.", "ru.ui.rename_to": "Новое название", + "ru.ui.revision_link": "Посмотреть код микоразметки для этой ревизии", "ru.ui.revision_no_text": "В этой ревизии гифы не было текста.", "ru.ui.revision_title": "{{.name}} из {{.rev}}", "ru.ui.revision_warning": "Обратите внимание, просмотр вложений в истории гифы пока что недоступен.", diff --git a/l18n_src/en/help.json b/l18n_src/en/help.json index 3c6d2d8..3a5037c 100644 --- a/l18n_src/en/help.json +++ b/l18n_src/en/help.json @@ -13,6 +13,7 @@ "attachment": "Attachment", "mycomarkup": "Mycomarkup", "interface": "Interface", + "prevnext": "Previous/next", "top_bar": "Top bar", "sibling_hyphae": "Sibling hyphae", "special_pages": "Special pages", diff --git a/l18n_src/en/ui.json b/l18n_src/en/ui.json index 019f004..7126c98 100644 --- a/l18n_src/en/ui.json +++ b/l18n_src/en/ui.json @@ -67,6 +67,7 @@ "revision_title": "{{.name}} at {{.rev}}", "revision_warning": "Please note that viewing attachments of hyphae is not supported in history for now.", + "revision_link": "Get Mycomarkup source of this revision", "revision_no_text": "This hypha had no text at this revision.", "about_title": "About {{.name}}", diff --git a/l18n_src/ru/help.json b/l18n_src/ru/help.json index a48ebac..5f24784 100644 --- a/l18n_src/ru/help.json +++ b/l18n_src/ru/help.json @@ -13,6 +13,7 @@ "attachment": "Вложение", "mycomarkup": "Микоразметка", "interface": "Интерфейс", + "prevnext": "Назад/далее", "top_bar": "Верхняя панель", "sibling_hyphae": "Гифы-сиблинги", "special_pages": "Специальные страницы", diff --git a/l18n_src/ru/ui.json b/l18n_src/ru/ui.json index a2d30d0..949e2e5 100644 --- a/l18n_src/ru/ui.json +++ b/l18n_src/ru/ui.json @@ -70,6 +70,7 @@ "revision_title": "{{.name}} из {{.rev}}", "revision_warning": "Обратите внимание, просмотр вложений в истории гифы пока что недоступен.", + "revision_link": "Посмотреть код микоразметки для этой ревизии", "revision_no_text": "В этой ревизии гифы не было текста.", "about_title": "О вики «{{.name}}»", diff --git a/views/history.qtpl b/views/history.qtpl index dd6f9ce..2c5b162 100644 --- a/views/history.qtpl +++ b/views/history.qtpl @@ -1,4 +1,3 @@ -// TODO: l18n {% import "fmt" %} {% import "net/http" %} {% import "time" %} diff --git a/views/history.qtpl.go b/views/history.qtpl.go index 5d3d92c..7755d9f 100644 --- a/views/history.qtpl.go +++ b/views/history.qtpl.go @@ -1,454 +1,452 @@ // Code generated by qtc from "history.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -// TODO: l18n - -//line views/history.qtpl:2 +//line views/history.qtpl:1 package views -//line views/history.qtpl:2 +//line views/history.qtpl:1 import "fmt" -//line views/history.qtpl:3 +//line views/history.qtpl:2 import "net/http" -//line views/history.qtpl:4 +//line views/history.qtpl:3 import "time" -//line views/history.qtpl:6 +//line views/history.qtpl:5 import "github.com/bouncepaw/mycorrhiza/cfg" -//line views/history.qtpl:7 +//line views/history.qtpl:6 import "github.com/bouncepaw/mycorrhiza/l18n" -//line views/history.qtpl:8 +//line views/history.qtpl:7 import "github.com/bouncepaw/mycorrhiza/user" -//line views/history.qtpl:9 +//line views/history.qtpl:8 import "github.com/bouncepaw/mycorrhiza/hyphae" -//line views/history.qtpl:10 +//line views/history.qtpl:9 import "github.com/bouncepaw/mycorrhiza/history" -//line views/history.qtpl:13 +//line views/history.qtpl:12 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line views/history.qtpl:13 +//line views/history.qtpl:12 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line views/history.qtpl:13 +//line views/history.qtpl:12 func StreamPrimitiveDiffHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, u *user.User, hash string) { -//line views/history.qtpl:13 +//line views/history.qtpl:12 qw422016.N().S(` `) -//line views/history.qtpl:15 +//line views/history.qtpl:14 lc := l18n.FromRequest(rq) text, err := history.PrimitiveDiffAtRevision(h.TextPartPath(), hash) if err != nil { text = err.Error() } -//line views/history.qtpl:20 +//line views/history.qtpl:19 qw422016.N().S(`

`) -//line views/history.qtpl:24 +//line views/history.qtpl:23 qw422016.N().S(lc.Get("ui.diff_title", &l18n.Replacements{"name": beautifulLink(h.Name), "rev": hash})) -//line views/history.qtpl:24 +//line views/history.qtpl:23 qw422016.N().S(`

`)
-//line views/history.qtpl:25
+//line views/history.qtpl:24
 	qw422016.E().S(text)
-//line views/history.qtpl:25
+//line views/history.qtpl:24
 	qw422016.N().S(`
`) -//line views/history.qtpl:29 +//line views/history.qtpl:28 } -//line views/history.qtpl:29 +//line views/history.qtpl:28 func WritePrimitiveDiffHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, u *user.User, hash string) { -//line views/history.qtpl:29 +//line views/history.qtpl:28 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/history.qtpl:29 +//line views/history.qtpl:28 StreamPrimitiveDiffHTML(qw422016, rq, h, u, hash) -//line views/history.qtpl:29 +//line views/history.qtpl:28 qt422016.ReleaseWriter(qw422016) -//line views/history.qtpl:29 +//line views/history.qtpl:28 } -//line views/history.qtpl:29 +//line views/history.qtpl:28 func PrimitiveDiffHTML(rq *http.Request, h *hyphae.Hypha, u *user.User, hash string) string { -//line views/history.qtpl:29 +//line views/history.qtpl:28 qb422016 := qt422016.AcquireByteBuffer() -//line views/history.qtpl:29 +//line views/history.qtpl:28 WritePrimitiveDiffHTML(qb422016, rq, h, u, hash) -//line views/history.qtpl:29 +//line views/history.qtpl:28 qs422016 := string(qb422016.B) -//line views/history.qtpl:29 +//line views/history.qtpl:28 qt422016.ReleaseByteBuffer(qb422016) -//line views/history.qtpl:29 +//line views/history.qtpl:28 return qs422016 -//line views/history.qtpl:29 +//line views/history.qtpl:28 } -//line views/history.qtpl:31 +//line views/history.qtpl:30 func StreamRecentChangesHTML(qw422016 *qt422016.Writer, n int, lc *l18n.Localizer) { -//line views/history.qtpl:31 +//line views/history.qtpl:30 qw422016.N().S(`

`) -//line views/history.qtpl:34 +//line views/history.qtpl:33 qw422016.E().S(lc.Get("ui.recent_heading")) -//line views/history.qtpl:34 +//line views/history.qtpl:33 qw422016.N().S(`

`) -//line views/history.qtpl:51 +//line views/history.qtpl:50 qw422016.N().S(lc.Get("ui.recent_subscribe", &l18n.Replacements{"rss": "RSS", "atom": "Atom", "json": fmt.Sprintf("%s", lc.Get("ui.recent_subscribe_json"))})) -//line views/history.qtpl:51 +//line views/history.qtpl:50 qw422016.N().S(`

`) -//line views/history.qtpl:58 +//line views/history.qtpl:57 qw422016.N().S(` `) -//line views/history.qtpl:61 +//line views/history.qtpl:60 changes := history.RecentChanges(n) var year, day int var month time.Month -//line views/history.qtpl:64 +//line views/history.qtpl:63 qw422016.N().S(`
`) -//line views/history.qtpl:66 +//line views/history.qtpl:65 if len(changes) == 0 { -//line views/history.qtpl:66 +//line views/history.qtpl:65 qw422016.N().S(`

`) -//line views/history.qtpl:67 +//line views/history.qtpl:66 qw422016.E().S(lc.Get("ui.recent_empty")) -//line views/history.qtpl:67 +//line views/history.qtpl:66 qw422016.N().S(`

`) -//line views/history.qtpl:68 +//line views/history.qtpl:67 } else { -//line views/history.qtpl:68 +//line views/history.qtpl:67 qw422016.N().S(` `) -//line views/history.qtpl:69 +//line views/history.qtpl:68 for i, entry := range changes { -//line views/history.qtpl:69 +//line views/history.qtpl:68 qw422016.N().S(` `) -//line views/history.qtpl:71 +//line views/history.qtpl:70 y, m, d := entry.Time.UTC().Date() -//line views/history.qtpl:71 +//line views/history.qtpl:70 qw422016.N().S(` `) -//line views/history.qtpl:72 +//line views/history.qtpl:71 if d != day || m != month || y != year { -//line views/history.qtpl:72 +//line views/history.qtpl:71 qw422016.N().S(`

`) -//line views/history.qtpl:74 +//line views/history.qtpl:73 qw422016.E().S(fmt.Sprintf("%04d-%02d-%02d", y, m, d)) -//line views/history.qtpl:74 +//line views/history.qtpl:73 qw422016.N().S(`

`) -//line views/history.qtpl:76 +//line views/history.qtpl:75 year, month, day = y, m, d -//line views/history.qtpl:76 +//line views/history.qtpl:75 qw422016.N().S(` `) -//line views/history.qtpl:77 +//line views/history.qtpl:76 } -//line views/history.qtpl:77 +//line views/history.qtpl:76 qw422016.N().S(`
`) -//line views/history.qtpl:81 +//line views/history.qtpl:80 qw422016.N().S(recentChangesEntry(entry)) -//line views/history.qtpl:81 +//line views/history.qtpl:80 qw422016.N().S(`
`) -//line views/history.qtpl:84 +//line views/history.qtpl:83 } -//line views/history.qtpl:84 +//line views/history.qtpl:83 qw422016.N().S(` `) -//line views/history.qtpl:85 +//line views/history.qtpl:84 } -//line views/history.qtpl:85 +//line views/history.qtpl:84 qw422016.N().S(` `) -//line views/history.qtpl:86 +//line views/history.qtpl:85 qw422016.N().S(helpTopicBadgeHTML(lc.Locale, "recent_changes")) -//line views/history.qtpl:86 +//line views/history.qtpl:85 qw422016.N().S(`
`) -//line views/history.qtpl:90 +//line views/history.qtpl:89 } -//line views/history.qtpl:90 +//line views/history.qtpl:89 func WriteRecentChangesHTML(qq422016 qtio422016.Writer, n int, lc *l18n.Localizer) { -//line views/history.qtpl:90 +//line views/history.qtpl:89 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/history.qtpl:90 +//line views/history.qtpl:89 StreamRecentChangesHTML(qw422016, n, lc) -//line views/history.qtpl:90 +//line views/history.qtpl:89 qt422016.ReleaseWriter(qw422016) -//line views/history.qtpl:90 +//line views/history.qtpl:89 } -//line views/history.qtpl:90 +//line views/history.qtpl:89 func RecentChangesHTML(n int, lc *l18n.Localizer) string { -//line views/history.qtpl:90 +//line views/history.qtpl:89 qb422016 := qt422016.AcquireByteBuffer() -//line views/history.qtpl:90 +//line views/history.qtpl:89 WriteRecentChangesHTML(qb422016, n, lc) -//line views/history.qtpl:90 +//line views/history.qtpl:89 qs422016 := string(qb422016.B) -//line views/history.qtpl:90 +//line views/history.qtpl:89 qt422016.ReleaseByteBuffer(qb422016) -//line views/history.qtpl:90 +//line views/history.qtpl:89 return qs422016 -//line views/history.qtpl:90 +//line views/history.qtpl:89 } -//line views/history.qtpl:92 +//line views/history.qtpl:91 func streamrecentChangesEntry(qw422016 *qt422016.Writer, rev history.Revision) { -//line views/history.qtpl:92 +//line views/history.qtpl:91 qw422016.N().S(`
`) -//line views/history.qtpl:97 +//line views/history.qtpl:96 qw422016.E().S(rev.Hash) -//line views/history.qtpl:97 +//line views/history.qtpl:96 qw422016.N().S(` `) -//line views/history.qtpl:99 +//line views/history.qtpl:98 if rev.Username != "anon" { -//line views/history.qtpl:99 +//line views/history.qtpl:98 qw422016.N().S(` `) -//line views/history.qtpl:103 +//line views/history.qtpl:102 } -//line views/history.qtpl:103 +//line views/history.qtpl:102 qw422016.N().S(`
`) -//line views/history.qtpl:107 +//line views/history.qtpl:106 qw422016.N().S(rev.HyphaeLinksHTML()) -//line views/history.qtpl:107 +//line views/history.qtpl:106 qw422016.N().S(` `) -//line views/history.qtpl:110 +//line views/history.qtpl:109 qw422016.E().S(rev.Message) -//line views/history.qtpl:110 +//line views/history.qtpl:109 qw422016.N().S(`
`) -//line views/history.qtpl:113 +//line views/history.qtpl:112 } -//line views/history.qtpl:113 +//line views/history.qtpl:112 func writerecentChangesEntry(qq422016 qtio422016.Writer, rev history.Revision) { -//line views/history.qtpl:113 +//line views/history.qtpl:112 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/history.qtpl:113 +//line views/history.qtpl:112 streamrecentChangesEntry(qw422016, rev) -//line views/history.qtpl:113 +//line views/history.qtpl:112 qt422016.ReleaseWriter(qw422016) -//line views/history.qtpl:113 +//line views/history.qtpl:112 } -//line views/history.qtpl:113 +//line views/history.qtpl:112 func recentChangesEntry(rev history.Revision) string { -//line views/history.qtpl:113 +//line views/history.qtpl:112 qb422016 := qt422016.AcquireByteBuffer() -//line views/history.qtpl:113 +//line views/history.qtpl:112 writerecentChangesEntry(qb422016, rev) -//line views/history.qtpl:113 +//line views/history.qtpl:112 qs422016 := string(qb422016.B) -//line views/history.qtpl:113 +//line views/history.qtpl:112 qt422016.ReleaseByteBuffer(qb422016) -//line views/history.qtpl:113 +//line views/history.qtpl:112 return qs422016 -//line views/history.qtpl:113 +//line views/history.qtpl:112 } -//line views/history.qtpl:115 +//line views/history.qtpl:114 func StreamHistoryHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, list string, lc *l18n.Localizer) { -//line views/history.qtpl:115 +//line views/history.qtpl:114 qw422016.N().S(`

`) -//line views/history.qtpl:119 +//line views/history.qtpl:118 qw422016.N().S(fmt.Sprintf(lc.Get("ui.history_title"), beautifulLink(hyphaName))) -//line views/history.qtpl:119 +//line views/history.qtpl:118 qw422016.N().S(`

`) -//line views/history.qtpl:120 +//line views/history.qtpl:119 qw422016.N().S(list) -//line views/history.qtpl:120 +//line views/history.qtpl:119 qw422016.N().S(`
`) -//line views/history.qtpl:124 +//line views/history.qtpl:123 } -//line views/history.qtpl:124 +//line views/history.qtpl:123 func WriteHistoryHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, list string, lc *l18n.Localizer) { -//line views/history.qtpl:124 +//line views/history.qtpl:123 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/history.qtpl:124 +//line views/history.qtpl:123 StreamHistoryHTML(qw422016, rq, hyphaName, list, lc) -//line views/history.qtpl:124 +//line views/history.qtpl:123 qt422016.ReleaseWriter(qw422016) -//line views/history.qtpl:124 +//line views/history.qtpl:123 } -//line views/history.qtpl:124 +//line views/history.qtpl:123 func HistoryHTML(rq *http.Request, hyphaName, list string, lc *l18n.Localizer) string { -//line views/history.qtpl:124 +//line views/history.qtpl:123 qb422016 := qt422016.AcquireByteBuffer() -//line views/history.qtpl:124 +//line views/history.qtpl:123 WriteHistoryHTML(qb422016, rq, hyphaName, list, lc) -//line views/history.qtpl:124 +//line views/history.qtpl:123 qs422016 := string(qb422016.B) -//line views/history.qtpl:124 +//line views/history.qtpl:123 qt422016.ReleaseByteBuffer(qb422016) -//line views/history.qtpl:124 +//line views/history.qtpl:123 return qs422016 -//line views/history.qtpl:124 +//line views/history.qtpl:123 } diff --git a/views/readers.qtpl b/views/readers.qtpl index ecd9e34..4d004be 100644 --- a/views/readers.qtpl +++ b/views/readers.qtpl @@ -78,6 +78,8 @@ {% endfunc %} 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) @@ -127,7 +129,7 @@ If `contents` == "", a helpful message is shown instead.
diff --git a/views/readers.qtpl.go b/views/readers.qtpl.go index 30c9b6a..26e2ffc 100644 --- a/views/readers.qtpl.go +++ b/views/readers.qtpl.go @@ -299,17 +299,19 @@ func AttachmentMenuHTML(rq *http.Request, h *hyphae.Hypha, u *user.User) string } // If `contents` == "", a helpful message is shown instead. +// +// If you rename .prevnext, change the docs too. -//line views/readers.qtpl:81 +//line views/readers.qtpl:83 func StreamHyphaHTML(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer, h *hyphae.Hypha, contents string) { -//line views/readers.qtpl:81 +//line views/readers.qtpl:83 qw422016.N().S(` `) -//line views/readers.qtpl:83 +//line views/readers.qtpl:85 siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.Name) u := user.FromRequest(rq) -//line views/readers.qtpl:85 +//line views/readers.qtpl:87 qw422016.N().S(`
@@ -318,273 +320,285 @@ func StreamHyphaHTML(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Local
`) -//line views/readers.qtpl:92 +//line views/readers.qtpl:94 if u.CanProceed("edit") { -//line views/readers.qtpl:92 +//line views/readers.qtpl:94 qw422016.N().S(``) -//line views/readers.qtpl:94 +//line views/readers.qtpl:96 } -//line views/readers.qtpl:94 +//line views/readers.qtpl:96 qw422016.N().S(` `) -//line views/readers.qtpl:95 +//line views/readers.qtpl:97 qw422016.N().S(NaviTitleHTML(h)) -//line views/readers.qtpl:95 +//line views/readers.qtpl:97 qw422016.N().S(` `) -//line views/readers.qtpl:96 +//line views/readers.qtpl:98 if h.Exists { -//line views/readers.qtpl:96 +//line views/readers.qtpl:98 qw422016.N().S(` `) -//line views/readers.qtpl:97 +//line views/readers.qtpl:99 qw422016.N().S(contents) -//line views/readers.qtpl:97 +//line views/readers.qtpl:99 qw422016.N().S(` `) -//line views/readers.qtpl:98 +//line views/readers.qtpl:100 } else { -//line views/readers.qtpl:98 +//line views/readers.qtpl:100 qw422016.N().S(` `) -//line views/readers.qtpl:99 +//line views/readers.qtpl:101 streamnonExistentHyphaNotice(qw422016, h, u, lc) -//line views/readers.qtpl:99 +//line views/readers.qtpl:101 qw422016.N().S(` `) -//line views/readers.qtpl:100 +//line views/readers.qtpl:102 } -//line views/readers.qtpl:100 +//line views/readers.qtpl:102 qw422016.N().S(`
`) -//line views/readers.qtpl:103 +//line views/readers.qtpl:105 if prevHyphaName != "" { -//line views/readers.qtpl:103 +//line views/readers.qtpl:105 qw422016.N().S(` `) -//line views/readers.qtpl:105 +//line views/readers.qtpl:107 } -//line views/readers.qtpl:105 +//line views/readers.qtpl:107 qw422016.N().S(` `) -//line views/readers.qtpl:106 +//line views/readers.qtpl:108 if nextHyphaName != "" { -//line views/readers.qtpl:106 +//line views/readers.qtpl:108 qw422016.N().S(` `) -//line views/readers.qtpl:108 +//line views/readers.qtpl:110 } -//line views/readers.qtpl:108 +//line views/readers.qtpl:110 qw422016.N().S(`
`) -//line views/readers.qtpl:110 +//line views/readers.qtpl:112 StreamSubhyphaeHTML(qw422016, subhyphae, lc) -//line views/readers.qtpl:110 +//line views/readers.qtpl:112 qw422016.N().S(`
`) -//line views/readers.qtpl:115 +//line views/readers.qtpl:117 streamhyphaInfo(qw422016, rq, h) -//line views/readers.qtpl:115 +//line views/readers.qtpl:117 qw422016.N().S(`
`) -//line views/readers.qtpl:118 +//line views/readers.qtpl:120 streamsiblingHyphaeHTML(qw422016, siblings, lc) -//line views/readers.qtpl:118 +//line views/readers.qtpl:120 qw422016.N().S(`
`) -//line views/readers.qtpl:120 +//line views/readers.qtpl:122 streamviewScripts(qw422016) -//line views/readers.qtpl:120 +//line views/readers.qtpl:122 qw422016.N().S(` `) -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 } -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 func WriteHyphaHTML(qq422016 qtio422016.Writer, rq *http.Request, lc *l18n.Localizer, h *hyphae.Hypha, contents string) { -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 StreamHyphaHTML(qw422016, rq, lc, h, contents) -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 qt422016.ReleaseWriter(qw422016) -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 } -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 func HyphaHTML(rq *http.Request, lc *l18n.Localizer, h *hyphae.Hypha, contents string) string { -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 qb422016 := qt422016.AcquireByteBuffer() -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 WriteHyphaHTML(qb422016, rq, lc, h, contents) -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 qs422016 := string(qb422016.B) -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 qt422016.ReleaseByteBuffer(qb422016) -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 return qs422016 -//line views/readers.qtpl:121 +//line views/readers.qtpl:123 } -//line views/readers.qtpl:123 +//line views/readers.qtpl:125 func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer, h *hyphae.Hypha, contents, revHash string) { -//line views/readers.qtpl:123 +//line views/readers.qtpl:125 qw422016.N().S(` `) -//line views/readers.qtpl:125 +//line views/readers.qtpl:127 siblings, subhyphae, _, _ := tree.Tree(h.Name) -//line views/readers.qtpl:126 +//line views/readers.qtpl:128 qw422016.N().S(`

`) -//line views/readers.qtpl:130 +//line views/readers.qtpl:132 qw422016.E().S(lc.Get("ui.revision_warning")) -//line views/readers.qtpl:130 - qw422016.N().S(`

+//line views/readers.qtpl:132 + qw422016.N().S(` `) +//line views/readers.qtpl:132 + qw422016.E().S(lc.Get("ui.revision_link")) +//line views/readers.qtpl:132 + qw422016.N().S(`

`) -//line views/readers.qtpl:131 +//line views/readers.qtpl:133 qw422016.N().S(NaviTitleHTML(h)) -//line views/readers.qtpl:131 +//line views/readers.qtpl:133 qw422016.N().S(` `) -//line views/readers.qtpl:132 +//line views/readers.qtpl:134 qw422016.N().S(contents) -//line views/readers.qtpl:132 +//line views/readers.qtpl:134 qw422016.N().S(`
`) -//line views/readers.qtpl:134 +//line views/readers.qtpl:136 StreamSubhyphaeHTML(qw422016, subhyphae, lc) -//line views/readers.qtpl:134 +//line views/readers.qtpl:136 qw422016.N().S(`
`) -//line views/readers.qtpl:136 +//line views/readers.qtpl:138 streamsiblingHyphaeHTML(qw422016, siblings, lc) -//line views/readers.qtpl:136 +//line views/readers.qtpl:138 qw422016.N().S(`
`) -//line views/readers.qtpl:138 +//line views/readers.qtpl:140 streamviewScripts(qw422016) -//line views/readers.qtpl:138 +//line views/readers.qtpl:140 qw422016.N().S(` `) -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 } -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 func WriteRevisionHTML(qq422016 qtio422016.Writer, rq *http.Request, lc *l18n.Localizer, h *hyphae.Hypha, contents, revHash string) { -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 StreamRevisionHTML(qw422016, rq, lc, h, contents, revHash) -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 qt422016.ReleaseWriter(qw422016) -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 } -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 func RevisionHTML(rq *http.Request, lc *l18n.Localizer, h *hyphae.Hypha, contents, revHash string) string { -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 qb422016 := qt422016.AcquireByteBuffer() -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 WriteRevisionHTML(qb422016, rq, lc, h, contents, revHash) -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 qs422016 := string(qb422016.B) -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 qt422016.ReleaseByteBuffer(qb422016) -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 return qs422016 -//line views/readers.qtpl:139 +//line views/readers.qtpl:141 } -//line views/readers.qtpl:141 +//line views/readers.qtpl:143 func streamviewScripts(qw422016 *qt422016.Writer) { -//line views/readers.qtpl:141 +//line views/readers.qtpl:143 qw422016.N().S(` `) -//line views/readers.qtpl:142 +//line views/readers.qtpl:144 for _, scriptPath := range cfg.ViewScripts { -//line views/readers.qtpl:142 +//line views/readers.qtpl:144 qw422016.N().S(` `) -//line views/readers.qtpl:144 +//line views/readers.qtpl:146 } -//line views/readers.qtpl:144 +//line views/readers.qtpl:146 qw422016.N().S(` `) -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 } -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 func writeviewScripts(qq422016 qtio422016.Writer) { -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 streamviewScripts(qw422016) -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 qt422016.ReleaseWriter(qw422016) -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 } -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 func viewScripts() string { -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 qb422016 := qt422016.AcquireByteBuffer() -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 writeviewScripts(qb422016) -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 qs422016 := string(qb422016.B) -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 qt422016.ReleaseByteBuffer(qb422016) -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 return qs422016 -//line views/readers.qtpl:145 +//line views/readers.qtpl:147 } diff --git a/views/stuff.qtpl b/views/stuff.qtpl index 0a70705..c927b43 100644 --- a/views/stuff.qtpl +++ b/views/stuff.qtpl @@ -166,6 +166,7 @@ It outputs a poorly formatted JSON, but it works and is valid.
  • {%s lc.GetWithLocale(lang, "help.mycomarkup") %}
  • {%s lc.GetWithLocale(lang, "help.interface") %}
  • `) -//line views/stuff.qtpl:174 +//line views/stuff.qtpl:175 qw422016.E().S(lc.GetWithLocale(lang, "help.special_pages")) -//line views/stuff.qtpl:174 +//line views/stuff.qtpl:175 qw422016.N().S(`
  • `) -//line views/stuff.qtpl:179 +//line views/stuff.qtpl:180 qw422016.E().S(lc.GetWithLocale(lang, "help.configuration")) -//line views/stuff.qtpl:179 +//line views/stuff.qtpl:180 qw422016.N().S(` @@ -737,91 +746,91 @@ func streamhelpTopicsHTML(qw422016 *qt422016.Writer, lang string, lc *l18n.Local `) -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 } -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 func writehelpTopicsHTML(qq422016 qtio422016.Writer, lang string, lc *l18n.Localizer) { -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 streamhelpTopicsHTML(qw422016, lang, lc) -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 qt422016.ReleaseWriter(qw422016) -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 } -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 func helpTopicsHTML(lang string, lc *l18n.Localizer) string { -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 qb422016 := qt422016.AcquireByteBuffer() -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 writehelpTopicsHTML(qb422016, lang, lc) -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 qs422016 := string(qb422016.B) -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 qt422016.ReleaseByteBuffer(qb422016) -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 return qs422016 -//line views/stuff.qtpl:189 +//line views/stuff.qtpl:190 } -//line views/stuff.qtpl:191 +//line views/stuff.qtpl:192 func streamhelpTopicBadgeHTML(qw422016 *qt422016.Writer, lang, topic string) { -//line views/stuff.qtpl:191 +//line views/stuff.qtpl:192 qw422016.N().S(` ? `) -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 } -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 func writehelpTopicBadgeHTML(qq422016 qtio422016.Writer, lang, topic string) { -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 streamhelpTopicBadgeHTML(qw422016, lang, topic) -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 qt422016.ReleaseWriter(qw422016) -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 } -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 func helpTopicBadgeHTML(lang, topic string) string { -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 qb422016 := qt422016.AcquireByteBuffer() -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 writehelpTopicBadgeHTML(qb422016, lang, topic) -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 qs422016 := string(qb422016.B) -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 qt422016.ReleaseByteBuffer(qb422016) -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 return qs422016 -//line views/stuff.qtpl:193 +//line views/stuff.qtpl:194 } -//line views/stuff.qtpl:195 +//line views/stuff.qtpl:196 func StreamUserListHTML(qw422016 *qt422016.Writer, lc *l18n.Localizer) { -//line views/stuff.qtpl:195 +//line views/stuff.qtpl:196 qw422016.N().S(`

    `) -//line views/stuff.qtpl:198 +//line views/stuff.qtpl:199 qw422016.E().S(lc.Get("ui.users_heading")) -//line views/stuff.qtpl:198 +//line views/stuff.qtpl:199 qw422016.N().S(`

    `) -//line views/stuff.qtpl:200 +//line views/stuff.qtpl:201 var ( admins = make([]string, 0) moderators = make([]string, 0) @@ -838,385 +847,385 @@ func StreamUserListHTML(qw422016 *qt422016.Writer, lc *l18n.Localizer) { } } -//line views/stuff.qtpl:215 +//line views/stuff.qtpl:216 qw422016.N().S(`

    `) -//line views/stuff.qtpl:217 +//line views/stuff.qtpl:218 qw422016.E().S(lc.Get("ui.users_admins")) -//line views/stuff.qtpl:217 +//line views/stuff.qtpl:218 qw422016.N().S(`

      `) -//line views/stuff.qtpl:218 +//line views/stuff.qtpl:219 for _, name := range admins { -//line views/stuff.qtpl:218 +//line views/stuff.qtpl:219 qw422016.N().S(`
    1. `) -//line views/stuff.qtpl:219 +//line views/stuff.qtpl:220 qw422016.E().S(name) -//line views/stuff.qtpl:219 +//line views/stuff.qtpl:220 qw422016.N().S(`
    2. `) -//line views/stuff.qtpl:220 +//line views/stuff.qtpl:221 } -//line views/stuff.qtpl:220 +//line views/stuff.qtpl:221 qw422016.N().S(`

    `) -//line views/stuff.qtpl:223 +//line views/stuff.qtpl:224 qw422016.E().S(lc.Get("ui.users_moderators")) -//line views/stuff.qtpl:223 +//line views/stuff.qtpl:224 qw422016.N().S(`

      `) -//line views/stuff.qtpl:224 +//line views/stuff.qtpl:225 for _, name := range moderators { -//line views/stuff.qtpl:224 +//line views/stuff.qtpl:225 qw422016.N().S(`
    1. `) -//line views/stuff.qtpl:225 +//line views/stuff.qtpl:226 qw422016.E().S(name) -//line views/stuff.qtpl:225 +//line views/stuff.qtpl:226 qw422016.N().S(`
    2. `) -//line views/stuff.qtpl:226 +//line views/stuff.qtpl:227 } -//line views/stuff.qtpl:226 +//line views/stuff.qtpl:227 qw422016.N().S(`

    `) -//line views/stuff.qtpl:229 +//line views/stuff.qtpl:230 qw422016.E().S(lc.Get("ui.users_editors")) -//line views/stuff.qtpl:229 +//line views/stuff.qtpl:230 qw422016.N().S(`

      `) -//line views/stuff.qtpl:230 +//line views/stuff.qtpl:231 for _, name := range editors { -//line views/stuff.qtpl:230 +//line views/stuff.qtpl:231 qw422016.N().S(`
    1. `) -//line views/stuff.qtpl:231 +//line views/stuff.qtpl:232 qw422016.E().S(name) -//line views/stuff.qtpl:231 +//line views/stuff.qtpl:232 qw422016.N().S(`
    2. `) -//line views/stuff.qtpl:232 +//line views/stuff.qtpl:233 } -//line views/stuff.qtpl:232 +//line views/stuff.qtpl:233 qw422016.N().S(`
    `) -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 } -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 func WriteUserListHTML(qq422016 qtio422016.Writer, lc *l18n.Localizer) { -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 StreamUserListHTML(qw422016, lc) -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 qt422016.ReleaseWriter(qw422016) -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 } -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 func UserListHTML(lc *l18n.Localizer) string { -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 qb422016 := qt422016.AcquireByteBuffer() -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 WriteUserListHTML(qb422016, lc) -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 qs422016 := string(qb422016.B) -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 qt422016.ReleaseByteBuffer(qb422016) -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 return qs422016 -//line views/stuff.qtpl:236 +//line views/stuff.qtpl:237 } -//line views/stuff.qtpl:238 +//line views/stuff.qtpl:239 func StreamHyphaListHTML(qw422016 *qt422016.Writer, lc *l18n.Localizer) { -//line views/stuff.qtpl:238 +//line views/stuff.qtpl:239 qw422016.N().S(`

    `) -//line views/stuff.qtpl:241 +//line views/stuff.qtpl:242 qw422016.E().S(lc.Get("ui.list_heading")) -//line views/stuff.qtpl:241 +//line views/stuff.qtpl:242 qw422016.N().S(`

    `) -//line views/stuff.qtpl:242 +//line views/stuff.qtpl:243 qw422016.E().S(lc.GetPlural("ui.list_desc", hyphae.Count())) -//line views/stuff.qtpl:242 +//line views/stuff.qtpl:243 qw422016.N().S(`

      `) -//line views/stuff.qtpl:244 +//line views/stuff.qtpl:245 for h := range hyphae.YieldExistingHyphae() { -//line views/stuff.qtpl:244 +//line views/stuff.qtpl:245 qw422016.N().S(`
    • `) -//line views/stuff.qtpl:246 +//line views/stuff.qtpl:247 qw422016.E().S(util.BeautifulName(h.Name)) -//line views/stuff.qtpl:246 +//line views/stuff.qtpl:247 qw422016.N().S(` `) -//line views/stuff.qtpl:247 +//line views/stuff.qtpl:248 if h.BinaryPath != "" { -//line views/stuff.qtpl:247 +//line views/stuff.qtpl:248 qw422016.N().S(` `) -//line views/stuff.qtpl:248 +//line views/stuff.qtpl:249 qw422016.E().S(filepath.Ext(h.BinaryPath)[1:]) -//line views/stuff.qtpl:248 +//line views/stuff.qtpl:249 qw422016.N().S(` `) -//line views/stuff.qtpl:249 +//line views/stuff.qtpl:250 } -//line views/stuff.qtpl:249 +//line views/stuff.qtpl:250 qw422016.N().S(`
    • `) -//line views/stuff.qtpl:251 +//line views/stuff.qtpl:252 } -//line views/stuff.qtpl:251 +//line views/stuff.qtpl:252 qw422016.N().S(`
    `) -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 } -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 func WriteHyphaListHTML(qq422016 qtio422016.Writer, lc *l18n.Localizer) { -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 StreamHyphaListHTML(qw422016, lc) -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 qt422016.ReleaseWriter(qw422016) -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 } -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 func HyphaListHTML(lc *l18n.Localizer) string { -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 qb422016 := qt422016.AcquireByteBuffer() -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 WriteHyphaListHTML(qb422016, lc) -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 qs422016 := string(qb422016.B) -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 qt422016.ReleaseByteBuffer(qb422016) -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 return qs422016 -//line views/stuff.qtpl:255 +//line views/stuff.qtpl:256 } -//line views/stuff.qtpl:257 +//line views/stuff.qtpl:258 func StreamAboutHTML(qw422016 *qt422016.Writer, lc *l18n.Localizer) { -//line views/stuff.qtpl:257 +//line views/stuff.qtpl:258 qw422016.N().S(`

    `) -//line views/stuff.qtpl:261 +//line views/stuff.qtpl:262 qw422016.E().S(lc.Get("ui.about_title", &l18n.Replacements{"name": cfg.WikiName})) -//line views/stuff.qtpl:261 +//line views/stuff.qtpl:262 qw422016.N().S(`

    • `) -//line views/stuff.qtpl:263 +//line views/stuff.qtpl:264 qw422016.N().S(lc.Get("ui.about_version", &l18n.Replacements{"pre": "", "post": ""})) -//line views/stuff.qtpl:263 +//line views/stuff.qtpl:264 qw422016.N().S(` 1.5.0
    • `) -//line views/stuff.qtpl:264 +//line views/stuff.qtpl:265 if cfg.UseAuth { -//line views/stuff.qtpl:264 +//line views/stuff.qtpl:265 qw422016.N().S(`
    • `) -//line views/stuff.qtpl:265 +//line views/stuff.qtpl:266 qw422016.E().S(lc.Get("ui.about_usercount")) -//line views/stuff.qtpl:265 +//line views/stuff.qtpl:266 qw422016.N().S(` `) -//line views/stuff.qtpl:265 +//line views/stuff.qtpl:266 qw422016.N().DUL(user.Count()) -//line views/stuff.qtpl:265 +//line views/stuff.qtpl:266 qw422016.N().S(`
    • `) -//line views/stuff.qtpl:266 +//line views/stuff.qtpl:267 qw422016.E().S(lc.Get("ui.about_homepage")) -//line views/stuff.qtpl:266 +//line views/stuff.qtpl:267 qw422016.N().S(` `) -//line views/stuff.qtpl:266 +//line views/stuff.qtpl:267 qw422016.E().S(cfg.HomeHypha) -//line views/stuff.qtpl:266 +//line views/stuff.qtpl:267 qw422016.N().S(`
    • `) -//line views/stuff.qtpl:267 +//line views/stuff.qtpl:268 qw422016.E().S(lc.Get("ui.about_admins")) -//line views/stuff.qtpl:267 +//line views/stuff.qtpl:268 qw422016.N().S(``) -//line views/stuff.qtpl:267 +//line views/stuff.qtpl:268 for i, username := range user.ListUsersWithGroup("admin") { -//line views/stuff.qtpl:268 +//line views/stuff.qtpl:269 if i > 0 { -//line views/stuff.qtpl:268 +//line views/stuff.qtpl:269 qw422016.N().S(` `) -//line views/stuff.qtpl:269 +//line views/stuff.qtpl:270 } -//line views/stuff.qtpl:269 +//line views/stuff.qtpl:270 qw422016.N().S(` `) -//line views/stuff.qtpl:270 +//line views/stuff.qtpl:271 qw422016.E().S(username) -//line views/stuff.qtpl:270 +//line views/stuff.qtpl:271 qw422016.N().S(``) -//line views/stuff.qtpl:270 +//line views/stuff.qtpl:271 } -//line views/stuff.qtpl:270 +//line views/stuff.qtpl:271 qw422016.N().S(`
    • `) -//line views/stuff.qtpl:271 +//line views/stuff.qtpl:272 } else { -//line views/stuff.qtpl:271 +//line views/stuff.qtpl:272 qw422016.N().S(`
    • `) -//line views/stuff.qtpl:272 +//line views/stuff.qtpl:273 qw422016.E().S(lc.Get("ui.about_noauth")) -//line views/stuff.qtpl:272 +//line views/stuff.qtpl:273 qw422016.N().S(`
    • `) -//line views/stuff.qtpl:273 +//line views/stuff.qtpl:274 } -//line views/stuff.qtpl:273 +//line views/stuff.qtpl:274 qw422016.N().S(`

    `) -//line views/stuff.qtpl:275 +//line views/stuff.qtpl:276 qw422016.N().S(lc.Get("ui.about_hyphae", &l18n.Replacements{"link": "/list"})) -//line views/stuff.qtpl:275 +//line views/stuff.qtpl:276 qw422016.N().S(`

    `) -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 } -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 func WriteAboutHTML(qq422016 qtio422016.Writer, lc *l18n.Localizer) { -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 StreamAboutHTML(qw422016, lc) -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 qt422016.ReleaseWriter(qw422016) -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 } -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 func AboutHTML(lc *l18n.Localizer) string { -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 qb422016 := qt422016.AcquireByteBuffer() -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 WriteAboutHTML(qb422016, lc) -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 qs422016 := string(qb422016.B) -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 qt422016.ReleaseByteBuffer(qb422016) -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 return qs422016 -//line views/stuff.qtpl:279 +//line views/stuff.qtpl:280 } -//line views/stuff.qtpl:281 +//line views/stuff.qtpl:282 func StreamCommonScripts(qw422016 *qt422016.Writer) { -//line views/stuff.qtpl:281 +//line views/stuff.qtpl:282 qw422016.N().S(` `) -//line views/stuff.qtpl:282 +//line views/stuff.qtpl:283 for _, scriptPath := range cfg.CommonScripts { -//line views/stuff.qtpl:282 +//line views/stuff.qtpl:283 qw422016.N().S(` `) -//line views/stuff.qtpl:284 +//line views/stuff.qtpl:285 } -//line views/stuff.qtpl:284 +//line views/stuff.qtpl:285 qw422016.N().S(` `) -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 } -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 func WriteCommonScripts(qq422016 qtio422016.Writer) { -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 qw422016 := qt422016.AcquireWriter(qq422016) -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 StreamCommonScripts(qw422016) -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 qt422016.ReleaseWriter(qw422016) -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 } -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 func CommonScripts() string { -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 qb422016 := qt422016.AcquireByteBuffer() -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 WriteCommonScripts(qb422016) -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 qs422016 := string(qb422016.B) -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 qt422016.ReleaseByteBuffer(qb422016) -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 return qs422016 -//line views/stuff.qtpl:285 +//line views/stuff.qtpl:286 } diff --git a/web/admin.go b/web/admin.go index 4589e53..5f84dac 100644 --- a/web/admin.go +++ b/web/admin.go @@ -1,4 +1,3 @@ -// TODO: l18n package web import ( diff --git a/web/auth.go b/web/auth.go index a3c426f..3cd6251 100644 --- a/web/auth.go +++ b/web/auth.go @@ -1,4 +1,3 @@ -// TODO: l18n package web import ( diff --git a/web/readers.go b/web/readers.go index 81bceeb..047fa24 100644 --- a/web/readers.go +++ b/web/readers.go @@ -2,6 +2,7 @@ package web import ( "fmt" + "io" "log" "net/http" "os" @@ -30,6 +31,7 @@ func initReaders(r *mux.Router) { r.PathPrefix("/text/").HandlerFunc(handlerText) r.PathPrefix("/binary/").HandlerFunc(handlerBinary) r.PathPrefix("/rev/").HandlerFunc(handlerRevision) + r.PathPrefix("/rev-text/").HandlerFunc(handlerRevisionText) r.PathPrefix("/primitive-diff/").HandlerFunc(handlerPrimitiveDiff) r.PathPrefix("/attachment/").HandlerFunc(handlerAttachment) } @@ -69,7 +71,32 @@ func handlerPrimitiveDiff(w http.ResponseWriter, rq *http.Request) { u)) } -// handlerRevision displays a specific revision of text part a page +// handlerRevisionText sends Mycomarkup text of the hypha at the given revision. See also: handlerRevision, handlerText. +// +// /rev-text// +func handlerRevisionText(w http.ResponseWriter, rq *http.Request) { + util.PrepareRq(rq) + var ( + shorterUrl = strings.TrimPrefix(rq.URL.Path, "/rev-text/") + firstSlashIndex = strings.IndexRune(shorterUrl, '/') + revHash = shorterUrl[:firstSlashIndex] + hyphaName = util.CanonicalName(shorterUrl[firstSlashIndex+1:]) + h = hyphae.ByName(hyphaName) + textContents, err = history.FileAtRevision(h.TextPartPath(), revHash) + ) + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + if err != nil { + w.WriteHeader(http.StatusNotFound) + log.Printf("While serving text of ‘%s’ at revision ‘%s’: %s\n", hyphaName, revHash, err.Error()) + _, _ = io.WriteString(w, "Error: "+err.Error()) + return + } + log.Printf("Serving text of ‘%s’ from ‘%s’ at revision ‘%s’\n", hyphaName, h.TextPartPath(), revHash) + w.WriteHeader(http.StatusOK) + _, _ = io.WriteString(w, textContents) +} + +// handlerRevision displays a specific revision of the text part the hypha func handlerRevision(w http.ResponseWriter, rq *http.Request) { util.PrepareRq(rq) var (