Skip to content

Commit 2d48e1b

Browse files
authored
Merge pull request #79 from nighca/example-optimization
Examples optimization
2 parents 0b17527 + e5b5145 commit 2d48e1b

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

105-Assignments/assign-1.gop

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# assignment
2+
23
// = is used for assigning. The values of multiple variables can be changed in one line. In this way, their values can be swapped without an intermediary variable.
34
var age int
45

105-Assignments/assign-2.gop

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# = vs :=
2+
23
// := is used for declaring and initializing. Multiple variables can be declared and intialized at one line.
34
age := 21 // age is declared and initialized to 21
45
println age

public/site.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,17 @@ body {
185185
column-count: 2;
186186
}
187187
}
188+
/* See goplus/www/goplus.org/utils/index.scss */
188189
.text-wrapper pre, .text-wrapper code {
189-
font-family: 'Menlo', 'Monaco', 'Consolas', 'Lucida Console', monospace;
190+
padding: 0.2em 0.4em;
191+
margin: 0;
192+
font-size: 85%;
193+
border-radius: 6px;
194+
font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
195+
}
196+
197+
.text-wrapper code {
198+
background-color: rgba(175, 184, 193, 0.2);
190199
}
191200

192201
/* next example link in example page */

templates/example.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,23 @@
3131
<p>No content yet, you can help us build it <a href="https://github.com/goplus/tutorial/tree/main/{{.Name}}">here</a>.</p>
3232
{{end}}
3333
{{range .Files}}
34+
{{if .HeadDoc}}
3435
<div class="docs">
3536
{{range .HeadDoc}}
3637
{{.DocsRendered}}
3738
{{end}}
3839
</div>
40+
{{end}}
41+
{{if .Code}}
3942
<goplus-code half-code language="{{.Lang}}">{{range .Code}}{{if .DocsRendered}}<goplus-code-doc>{{.DocsRendered}}</goplus-code-doc>{{end}}{{.CodeRendered}}{{end}}</goplus-code>
43+
{{end}}
44+
{{if .TailDoc}}
4045
<div class="docs">
4146
{{range .TailDoc}}
4247
{{.DocsRendered}}
4348
{{end}}
4449
</div>
50+
{{end}}
4551
{{end}}
4652
{{if .Next}}
4753
<p class="next">

0 commit comments

Comments
 (0)