mirror of
https://github.com/kataras/iris.git
synced 2026-01-09 13:05:56 +00:00
New: i18n pluralization and variables support and more...
fixes: #1649, #1648, #1641, #1650 relative to: #1597
This commit is contained in:
@@ -73,6 +73,7 @@ type ReportEntry struct {
|
||||
DependencyValue interface{} // the dependency value binded to that InputPosition of Name.
|
||||
DependencyFile string // the file
|
||||
DependencyLine int // and line number of the dependency's value.
|
||||
Static bool
|
||||
}
|
||||
|
||||
func (r *Report) fill(bindings []*binding) {
|
||||
@@ -101,6 +102,7 @@ func (r *Report) fill(bindings []*binding) {
|
||||
DependencyValue: b.Dependency.OriginalValue,
|
||||
DependencyFile: b.Dependency.Source.File,
|
||||
DependencyLine: b.Dependency.Source.Line,
|
||||
Static: b.Dependency.Static,
|
||||
}
|
||||
|
||||
r.Entries = append(r.Entries, entry)
|
||||
|
||||
@@ -482,26 +482,6 @@ var _ Result = View{}
|
||||
|
||||
const dotB = byte('.')
|
||||
|
||||
// DefaultViewExt is the default extension if `view.Name `is missing,
|
||||
// but note that it doesn't care about
|
||||
// the app.RegisterView(iris.$VIEW_ENGINE("./$dir", "$ext"))'s $ext.
|
||||
// so if you don't use the ".html" as extension for your files
|
||||
// you have to append the extension manually into the `view.Name`
|
||||
// or change this global variable.
|
||||
var DefaultViewExt = ".html"
|
||||
|
||||
func ensureExt(s string) string {
|
||||
if len(s) == 0 {
|
||||
return "index" + DefaultViewExt
|
||||
}
|
||||
|
||||
if strings.IndexByte(s, dotB) < 1 {
|
||||
s += DefaultViewExt
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// Dispatch writes the template filename, template layout and (any) data to the client.
|
||||
// Completes the `Result` interface.
|
||||
func (r View) Dispatch(ctx *context.Context) { // r as Response view.
|
||||
@@ -514,10 +494,7 @@ func (r View) Dispatch(ctx *context.Context) { // r as Response view.
|
||||
}
|
||||
|
||||
if r.Name != "" {
|
||||
r.Name = ensureExt(r.Name)
|
||||
|
||||
if r.Layout != "" {
|
||||
r.Layout = ensureExt(r.Layout)
|
||||
ctx.ViewLayout(r.Layout)
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +118,8 @@ func structFieldIgnored(f reflect.StructField) bool {
|
||||
|
||||
// all except non-zero.
|
||||
func lookupFields(elem reflect.Value, skipUnexported bool, onlyZeros bool, parentIndex []int) (fields []reflect.StructField, stateless int) {
|
||||
// Note: embedded pointers are not supported.
|
||||
// elem = reflect.Indirect(elem)
|
||||
elemTyp := elem.Type()
|
||||
for i, n := 0, elem.NumField(); i < n; i++ {
|
||||
field := elemTyp.Field(i)
|
||||
|
||||
Reference in New Issue
Block a user