diff options
author | jesselau76 <jesselau76@gmail.com> | 2018-11-27 07:48:28 +0300 |
---|---|---|
committer | jesselau76 <jesselau76@gmail.com> | 2018-11-27 07:48:28 +0300 |
commit | 834565b205efcac634223b0e39a2ba7ae6c94ec4 (patch) | |
tree | ed5912e28db8a256110f7e0afc674e467d49417e | |
parent | c3c4bfffe51fff26de8e0bcf2558455bbbb68c82 (diff) |
change quote shortcodes
-rw-r--r-- | exampleSite/content/chinese/posts/shortcodes-demopage.md | 40 | ||||
-rw-r--r-- | exampleSite/content/english/posts/shortcodes-demopage.md | 39 | ||||
-rw-r--r-- | layouts/_default/list.html | 2 | ||||
-rw-r--r-- | layouts/post/single.html | 2 | ||||
-rw-r--r-- | layouts/shortcodes/quote.html | 8 |
5 files changed, 46 insertions, 45 deletions
diff --git a/exampleSite/content/chinese/posts/shortcodes-demopage.md b/exampleSite/content/chinese/posts/shortcodes-demopage.md index 6a01ec7..793da2f 100644 --- a/exampleSite/content/chinese/posts/shortcodes-demopage.md +++ b/exampleSite/content/chinese/posts/shortcodes-demopage.md @@ -209,47 +209,45 @@ print(y["age"]) <br> {{< colorcode title="Code for quote shortcodes">}} {{< quote >}}<br> -<p class=" w3-xxlarge"><br> + 天地不仁,以万物为刍狗;圣人不仁,以百姓为刍狗。<br> -</p><br> -<p class="w3-right">--- 老子</p><br> + {{< /quote >}} {{< /colorcode >}} -缺省宽度为100% +缺省宽度为100%,不显示作者 {{< quote >}} -<p class=" w3-xxlarge"> + 天地不仁,以万物为刍狗;圣人不仁,以百姓为刍狗。 -</p><p class="w3-right">--- 老子</p> + {{< /quote >}} -可以设置宽度百分比 +可以设置宽度百分比,设置作者信息 {{< colorcode title="Code for quote shortcodes with % width">}} -{{< quote width="38.2%" >}}<br> -<p class=" w3-xxlarge"><br> +{{< quote width="38.2%" author="老子" >}}<br> + 天地不仁,以万物为刍狗;圣人不仁,以百姓为刍狗。<br> -</p><br> -<p class="w3-right">--- 老子</p><br> + {{< /quote >}} {{< /colorcode >}} -{{< quote width="38.2%" >}} -<p class=" w3-xxlarge"> +{{< quote width="38.2%" author="老子" >}} + 天地不仁,以万物为刍狗;圣人不仁,以百姓为刍狗。 -</p><p class="w3-right">--- 老子</p> + {{< /quote >}} 也可以直接设置px宽度 {{< colorcode title="Code for quote shortcodes with px width">}} -{{< quote width="300px" >}}<br> -<p class=" w3-xxlarge"><br> +{{< quote width="300px" author="老子" >}}<br> + 天地不仁,以万物为刍狗;圣人不仁,以百姓为刍狗。<br> -</p><br> -<p class="w3-right">--- 老子</p><br> + {{< /quote >}} {{< /colorcode >}} -{{< quote width="300px" >}} -<p class=" w3-xxlarge"> +{{< quote width="300px" author="老子" >}} + 天地不仁,以万物为刍狗;圣人不仁,以百姓为刍狗。 -</p><p class="w3-right">--- 老子</p> + {{< /quote >}} + diff --git a/exampleSite/content/english/posts/shortcodes-demopage.md b/exampleSite/content/english/posts/shortcodes-demopage.md index a497a60..75186fc 100644 --- a/exampleSite/content/english/posts/shortcodes-demopage.md +++ b/exampleSite/content/english/posts/shortcodes-demopage.md @@ -196,49 +196,46 @@ We can display quotes with shortcodes {{< colorcode title="Code for quote shortcodes">}} {{< quote >}}<br> -<p class=" w3-xlarge"><br> + Make it as simple as possible, but not simpler.<br> -</p><br> -<p class="w3-right">--- Albert Einstein</p><br> + {{< /quote >}} {{< /colorcode >}} -It will display quote with default width 100% style: +It will display quote with default width 100% style and no author: {{< quote >}} -<p class=" w3-xlarge"> + Make it as simple as possible, but not simpler. -</p><p class="w3-right">--- Albert Einstein</p> + {{< /quote >}} -You can also set width with shortcodes: +You can also set width and author with shortcodes: {{< colorcode title="Code for quote shortcodes with % width">}} -{{< quote width="38.2%" >}}<br> -<p class=" w3-xlarge"><br> +{{< quote width="61.8%" author="Albert Einstein" >}}<br> + Make it as simple as possible, but not simpler.<br> -</p><br> -<p class="w3-right">--- Albert Einstein</p><br> + {{< /quote >}} {{< /colorcode >}} -{{< quote width="38.2%" >}} -<p class=" w3-xlarge"> +{{< quote width="61.8%" author="Albert Einstein" >}} + Make it as simple as possible, but not simpler. -</p><p class="w3-right">--- Albert Einstein</p> + {{< /quote >}} Or you can set px to width {{< colorcode title="Code for quote shortcodes with px width">}} -{{< quote width="300px" >}}<br> -<p class=" w3-xlarge"><br> +{{< quote width="300px" author="Albert Einstein" >}}<br> + Make it as simple as possible, but not simpler.<br> -</p><br> -<p class="w3-right">--- Albert Einstein</p><br> + {{< /quote >}} {{< /colorcode >}} -{{< quote width="300px" >}} -<p class=" w3-xlarge"> +{{< quote width="300px" author="Albert Einstein" >}} + Make it as simple as possible, but not simpler. -</p><p class="w3-right">--- Albert Einstein</p> + {{< /quote >}} ## Test first picture without thumbnail set diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 315b728..c128195 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -32,7 +32,7 @@ {{ else }} {{ if .Site.Params.firstpic}} - {{ $img := findRE "(?i)<img .*?src=\"[^\"]*(png|jpg|jpeg|gif|bmp|svg)\".*?>" .Content 1 }} + {{ $img := findRE "(?i)<img .*?src\\s*=\\s*\"([^\"]*(png|jpg|jpeg|gif|bmp|svg))\".*?>" .Content 1 }} {{ range $img }} <div class="w3-hover-opacity thumb "> diff --git a/layouts/post/single.html b/layouts/post/single.html index 5307ec5..c596a69 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -49,7 +49,7 @@ {{ if .Site.Params.lazyload }} - {{ $regex := "(?i)src=\"([^\"]*(png|jpg|jpeg|gif|bmp|svg))\"" }} + {{ $regex := "(?i)src\\s*=\\s*\"([^\"]*(png|jpg|jpeg|gif|bmp|svg))\"" }} {{ $img := findRE $regex .Content }} {{ if gt (len $img) 0 }} diff --git a/layouts/shortcodes/quote.html b/layouts/shortcodes/quote.html index 62892db..beb3355 100644 --- a/layouts/shortcodes/quote.html +++ b/layouts/shortcodes/quote.html @@ -1,4 +1,10 @@ <div class="w3-panel w3-card-4 w3-light-grey"{{ with .Get "width"}} style="width:{{.}}"{{ end }}> <i class="fa fa-quote-right w3-xxlarge w3-text-red"></i><br> - {{ .Inner | safeHTML }} + <p class=" w3-xxlarge"> + {{ .Inner }} + </p> + {{ with .Get "author"}} + <p class="w3-right">--- {{.}}</p> + {{ end }} + </div>
\ No newline at end of file |