Skip to content

Commit

Permalink
fixed duden func style
Browse files Browse the repository at this point in the history
  • Loading branch information
NotLe0n committed Dec 6, 2023
1 parent a7a733f commit 06fba60
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 46 deletions.
23 changes: 17 additions & 6 deletions assets/css/md-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,37 @@
vertical-align: inherit;
}

#artikel .duden-func {
#artikel .duden-func {
border-bottom: 1px solid #aaa;
padding: 0.5em;
padding-right: 0;
margin-bottom: 1rem;
}

#artikel .duden-func[open] {
border: none;
}

#artikel .duden-func-inner {
margin-left: 5px;
border-left: #aaa solid 1px;
border-bottom: 1px solid #aaa;
border-bottom-left-radius: 1rem;
}

#artikel .duden-func blockquote {
white-space: pre;
margin: 0 0 0 4px;
margin: 0 0 0 -1px;
border-left: #aaa solid 1px;
border-bottom: #aaa solid 1px;
padding: 1rem 0 1rem 1rem;
border-bottom-left-radius: 1rem;
text-wrap: wrap;
}

#artikel .duden-func-inner {
margin: -2rem 0 0 4px;
padding: 2rem 0 0 1rem;
border-left: #aaa solid 1px;
#artikel .duden-func-data {
overflow-x: auto;
margin: 0 0 1rem 1rem
}

/* Syntax Highlighting */
Expand Down
8 changes: 4 additions & 4 deletions gen/stdlib-generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ func writeMD(inputFile string, outputFile *os.File, publicDecls []ast.Declaratio
names := make([]string, 0, len(decl.ParamNames))
types := make([]string, 0, len(decl.ParamTypes))
for i := range decl.ParamNames {
names = append(names, decl.ParamNames[i].String())
types = append(types, decl.ParamTypes[i].String())
names = append(names, "<code>"+decl.ParamNames[i].String()+"</code>")
types = append(types, "<code>"+decl.ParamTypes[i].String()+"</code>")
}

params = strings.Join(names, ",")
paramTypes = strings.Join(types, ",")
params = strings.Join(names, ", ")
paramTypes = strings.Join(types, ", ")
}

aliases := ""
Expand Down
69 changes: 33 additions & 36 deletions layouts/shortcodes/duden-function.html
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@
<details class="duden-func">
<summary id="{{ .Get "name" }}"><h2>{{ .Get "name" }}</h2></summary>
{{ with .Get "desc" }}
<blockquote>{{ . | safeHTML }}</blockquote>
{{ end }}
{{ $name := .Get "name" }}
<summary id="{{ $name }}"><h2>{{ .Get "name" }}</h2></summary>
<div class="duden-func-inner">
<ul>
{{ with .Get "params" }}
<li>{{ i18n "params"}}:
{{ $params := strings.Split . "," }}
<code>{{ delimit $params "</code>, <code>" }}</code>
</li>
{{ with .Get "desc" }}
<blockquote>{{ . | safeHTML }}</blockquote>
{{ end }}
{{ with .Get "paramTypes" }}
<li>{{ i18n "paramType"}}:
{{ $params := strings.Split . "," }}
<code>{{ delimit $params "</code>, <code>" }}</code>
</li>
{{ end }}
<li>{{ i18n "returnType"}}: <code>{{ .Get "ret" }}</code></li>
</ul>

<h3>{{ i18n "aliases" }}</h3>
<ol>
{{ with .Get "aliases" }}
{{ $aliases := split . "\"" }} <!--"}}-->
{{ range $aliases}}
<li><code>{{ . }}</code></li>
<div class="duden-func-data">
<ul>
{{ with .Get "params" }}
<li>{{ i18n "params"}}: {{ . | safeHTML }}</li>
{{ end }}
{{ with .Get "paramTypes" }}
<li>{{ i18n "paramType"}}: {{ . | safeHTML }}</li>
{{ end }}
<li>{{ i18n "returnType"}}: <code>{{ .Get "ret" }}</code></li>
</ul>

<h3>{{ i18n "aliases" }}</h3>
<ol>
{{ with .Get "aliases" }}
{{ $aliases := split . "\"" }} <!--"}}-->
{{ range $aliases}}
<li><code>{{ . }}</code></li>
{{ end }}
{{ else}}
<p>Keine Aliase definiert</p>
{{ end}}
</ol>

<h3>{{ i18n "impl" }}</h3>
{{ if eq (.Get "extern") "false" }}
<pre><code>{{ replace (.Get "impl" | plainify) "&emsp;" " " }}</code></pre>
{{ else }}
<p>{{ i18n "externImpl" }} <code>{{ .Get "impl" }}</code></p>
{{ end }}
{{ else}}
<p>Keine Aliase definiert</p>
{{ end}}
</ol>

<h3>{{ i18n "impl" }}</h3>
{{ if eq (.Get "extern") "false" }}
<pre><code>{{ replace (.Get "impl" | plainify) "&emsp;" " " }}</code></pre>
{{ else }}
<p>{{ i18n "externImpl" }} <code>{{ .Get "impl" }}</code></p>
{{ end }}
</div>
</div>
</details>

0 comments on commit 06fba60

Please sign in to comment.