3 Commits

Author SHA1 Message Date
Sebastian Frank
6b34509d9a target dir via t parameter in image_process filter
All checks were successful
continuous-integration/drone/push Build is passing
2019-03-14 12:10:17 +01:00
Sebastian Frank
8210e16305 website pre wrap
All checks were successful
continuous-integration/drone/push Build is passing
2019-03-12 14:59:50 +01:00
Sebastian Frank
2f114885ac fixed blog details body
All checks were successful
continuous-integration/drone/push Build is passing
2019-03-12 14:56:00 +01:00
8 changed files with 42 additions and 29 deletions

View File

@@ -1,16 +1,3 @@
NEUERUNGEN:
- pongo2-addons standardmäßig eingebunden
- fnRequest Template-Funktion für Web-Requests
- fnRender Template-Funktion um Unterseiten zu rendern
- eigene Filter via Javascript
- image_process Template-Filter um Bilder zu skalieren (resize, fit, fill)
- json Template-Filter um Variablen als JSON auszugeben
- dump Template-Filter um Variablen über spew.Dump auszugeben
- Collections via Web-Request mit optionaler Unternavigation
- Timestamp Variable
BUG FIXES:
- CR in Markdown entfernt, blackfriday-Bug
- Pfadangaben gesäubert, da sonst bei `-out ./html` der Assets-Pfad falsch ermittelt wurde
- `t=ZIEL_VERZEICHNIS` Parameter im `image_process` Filter

View File

@@ -1 +1 @@
1.1.0
1.1.1

View File

@@ -116,8 +116,9 @@ type ImagingConfig struct {
Anchor string `yaml:"Anchor"`
Quality int `yaml:"Quality"`
Filename string `yaml:"-"`
Format string `yaml:"-"`
TargetDir string `yaml:"-"`
Filename string `yaml:"-"`
Format string `yaml:"-"`
}
// PathConfig of subdir

View File

@@ -109,6 +109,8 @@ func parseImageParams(str string) (*config.ImagingConfig, error) {
p.Height, err = strconv.Atoi(e[1])
case "f":
p.Filename = e[1]
case "t":
p.TargetDir = e[1]
case "p":
p.Process = e[1]
case "a":
@@ -207,7 +209,29 @@ func ImageProcessFilter(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, *
}
}
imgTarget := ResolveOutputPath(p.Filename)
var imgTarget string
if p.TargetDir != "" {
imgTarget = ResolveOutputPath(
path.Clean(p.TargetDir) + "/" +
p.Filename,
)
pt := path.Dir(imgTarget)
if _, err := os.Stat(pt); os.IsNotExist(err) {
Log.Infof("create image target dir: %s", pt)
if err := os.MkdirAll(pt, 0755); err != nil {
return nil, &pongo2.Error{
Sender: "filter:image_resize",
OrigError: fmt.Errorf("could not create image target dir '%s': %s", pt, err),
}
}
}
p.Filename = ResolveNavPath(p.TargetDir + "/" + p.Filename)
} else {
imgTarget = ResolveOutputPath(p.Filename)
}
if f, err := os.Stat(imgTarget); err == nil && !f.IsDir() {
Log.Noticef("skipped processing image from %s to %s, file already exists", imgSource, imgTarget)

View File

@@ -1,7 +1,7 @@
GET https://mark2web.basiscms.de/api/collections/get/mark2webBlog
?sort[date]=-1
&limit=101
&token=89ff216524093123bf7a0a10f7b273
&token=985cee34099f4d3b08f18fc22f6296
###

View File

@@ -6,7 +6,7 @@ This:
EntriesAttribute: entries
GoTo: '{{ date }}-{{ title }}'
Navname: '{{ title }}'
Body: '{{ body }}'
Body: '{{ body|safe }}'
Template: base_blog_details.html
DataKey: details
Hidden: true # hide from nav, but use this feature for rendering detail sites
@@ -17,7 +17,7 @@ This:
EntriesAttribute: entries
GoTo: '{{ date }}-{{ title }}'
Navname: '{{ title }}'
Body: '{{ body }}'
Body: '{{ body|safe }}'
Template: base_blog_details.html
DataKey: details
Hidden: true

View File

@@ -272,6 +272,7 @@ pre {
padding: 5px;
border-radius: 5px;
margin-bottom: 25px;
white-space: pre-wrap;
}
code.language-mermaid {

View File

@@ -56,10 +56,10 @@
{% for sl in Data.slider %}
<div class="slide">
<img
src="{{ sl.img|image_process:"p=fill,w=1440,h=600,q=60" }}"
srcset="{{ sl.img|image_process:"p=fill,w=768,h=384,q=60" }} 768w,
{{ sl.img|image_process:"p=fill,w=1440,h=600,q=60" }} 1440w,
{{ sl.img|image_process:"p=fill,w=1920,h=800,q=60" }} 1920w"
src="{{ sl.img|image_process:"p=fill,w=1440,h=600,q=60,t=/img" }}"
srcset="{{ sl.img|image_process:"p=fill,w=768,h=384,q=60,t=/img" }} 768w,
{{ sl.img|image_process:"p=fill,w=1440,h=600,q=60,t=/img" }} 1440w,
{{ sl.img|image_process:"p=fill,w=1920,h=800,q=60,t=/img" }} 1920w"
alt="{{ sl.alt }}" style="opacity:{{ sl.opacity|default:1 }}">
</div>
{% endfor %}
@@ -103,10 +103,10 @@
<div class="maincontent">
{% if Data.background %}
<img
src="{{ Data.background|image_process:"p=fill,w=1440,h=810,q=30" }}"
srcset="{{ Data.background|image_process:"p=fill,w=768,h=768,q=30" }} 768w,
{{ Data.background|image_process:"p=fill,w=1440,h=810,q=30" }} 1440w,
{{ Data.background|image_process:"p=fill,w=1920,h=1020,q=30" }} 1920w"
src="{{ Data.background|image_process:"p=fill,w=1440,h=810,q=30,t=/img" }}"
srcset="{{ Data.background|image_process:"p=fill,w=768,h=768,q=30,t=/img" }} 768w,
{{ Data.background|image_process:"p=fill,w=1440,h=810,q=30,t=/img" }} 1440w,
{{ Data.background|image_process:"p=fill,w=1920,h=1020,q=30,t=/img" }} 1920w"
alt="{{ Meta.Title }}" class="img2bg">
{% endif %}
<div class="white_section section_padding">