mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-05-19 16:31:52 +02:00
feat(ruby): support ruby extended syntax
This commit is contained in:
parent
66c8634a09
commit
e41d75f9ab
12 changed files with 22 additions and 10 deletions
|
@ -49,7 +49,7 @@
|
|||
</div>
|
||||
{{ end }}
|
||||
<div class="min-w-0 min-h-0 max-w-prose">
|
||||
{{ .Content }}
|
||||
{{- dict "Content" .Content "Ruby" .Site.Params.ruby | partial "functions/content.html" | safeHTML -}}
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</h1>
|
||||
</header>
|
||||
<section class="max-w-full mt-6 prose dark:prose-invert">
|
||||
{{ .Content }}
|
||||
{{- dict "Content" .Content "Ruby" .Site.Params.ruby | partial "functions/content.html" | safeHTML -}}
|
||||
</section>
|
||||
<footer class="pt-8">
|
||||
{{ partial "sharing-links.html" . }}
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
{{ partial "series/series.html" . }}
|
||||
|
||||
<div class="article-content max-w-prose mb-20">
|
||||
{{ .Content }}
|
||||
{{- dict "Content" .Content "Ruby" .Site.Params.ruby | partial "functions/content.html" | safeHTML -}}
|
||||
</div>
|
||||
|
||||
{{ if (.Params.showAuthorBottom | default ( .Site.Params.article.showAuthorBottom | default false)) }}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
{{ if .Content }}
|
||||
<section class="flex flex-col max-w-full mt-0 prose dark:prose-invert lg:flex-row">
|
||||
<div class="min-w-0 min-h-0 max-w-prose">
|
||||
{{ .Content }}
|
||||
{{- dict "Content" .Content "Ruby" .Site.Params.ruby | partial "functions/content.html" | safeHTML -}}
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<section class="flex flex-col max-w-full mt-0 mb-5 prose dark:prose-invert lg:flex-row">
|
||||
{{ if .Content }}
|
||||
<div class="min-w-0 min-h-0 max-w-prose">
|
||||
{{ .Content }}
|
||||
{{- dict "Content" .Content "Ruby" .Site.Params.ruby | partial "functions/content.html" | safeHTML -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
<script>
|
||||
|
|
7
layouts/partials/functions/content.html
Normal file
7
layouts/partials/functions/content.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{- $content := .Content -}}
|
||||
|
||||
{{- if .Ruby -}}
|
||||
{{- $content = partial "functions/ruby.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $content -}}
|
5
layouts/partials/functions/ruby.html
Normal file
5
layouts/partials/functions/ruby.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
{{- /* Ruby */ -}}
|
||||
{{- /* [EN]^(English) -> <strong><ruby>EN<rt>English</rt></ruby></strong> */ -}}
|
||||
{{- $REin := `\[(.+?)\]\^\((.+?)\)` -}}
|
||||
{{- $REout := `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
|
||||
{{- return replaceRE $REin $REout . -}}
|
|
@ -67,7 +67,7 @@
|
|||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<section class="prose dark:prose-invert">{{ .Content }}</section>
|
||||
<section class="prose dark:prose-invert">{{- dict "Content" .Content "Ruby" .Site.Params.ruby | partial "functions/content.html" | safeHTML -}}</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<h1>{{ . | emojify }}</h1>
|
||||
</header>
|
||||
{{ end }}
|
||||
<section>{{ .Content }}</section>
|
||||
<section>{{- dict "Content" .Content "Ruby" .Site.Params.ruby | partial "functions/content.html" | safeHTML -}} </section>
|
||||
</article>
|
||||
</div>
|
||||
<div class="mt-6 sm:mt-16 lg:mt-0 mx-auto max-w-xl px-4 sm:px-6 lg:mx-0 lg:max-w-none lg:py-16 lg:px-0">
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<section class="prose prose-invert">{{ .Content }}</section>
|
||||
<section class="prose prose-invert">{{- dict "Content" .Content "Ruby" .Site.Params.ruby | partial "functions/content.html" | safeHTML -}}</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<h1>{{ . | emojify }}</h1>
|
||||
</header>
|
||||
{{ end }}
|
||||
<section>{{ .Content }}</section>
|
||||
<section>{{- dict "Content" .Content "Ruby" .Site.Params.ruby | partial "functions/content.html" | safeHTML -}}</section>
|
||||
</article>
|
||||
<section>
|
||||
{{ partial "recent-articles/main.html" . }}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
{{ partialCached "author-links.html" . }}
|
||||
</div>
|
||||
</header>
|
||||
<section class="prose dark:prose-invert">{{ .Content }}</section>
|
||||
<section class="prose dark:prose-invert">{{- dict "Content" .Content "Ruby" .Site.Params.ruby | partial "functions/content.html" | safeHTML -}}</section>
|
||||
</article>
|
||||
<section>
|
||||
{{ partial "recent-articles/main.html" . }}
|
||||
|
|
Loading…
Add table
Reference in a new issue