Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples optimization #79

Merged
merged 3 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 105-Assignments/assign-1.gop
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# assignment

Copy link
Contributor Author

@nighca nighca Feb 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

标题与后续注释之间预期留空行。

这里的后续注释(// = is used for assigning. The values...)与相邻的代码(var age int...)是关联的,而标题(# assignment)不应与该代码关联。“关联”意味着在排版上会展示为左右对齐展示。

下方图一为这里修改之前的渲染结果(认为“# assignment”也是对右侧代码说明的一部分),图二为修改后的渲染结果(认为“# assignment”不是对右侧代码的说明,而是单独的文档内容):

image

image

// = 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.
var age int

Expand Down
1 change: 1 addition & 0 deletions 105-Assignments/assign-2.gop
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# = vs :=

// := is used for declaring and initializing. Multiple variables can be declared and intialized at one line.
age := 21 // age is declared and initialized to 21
println age
Expand Down
11 changes: 10 additions & 1 deletion public/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,17 @@ body {
column-count: 2;
}
}
/* See goplus/www/goplus.org/utils/index.scss */
.text-wrapper pre, .text-wrapper code {
font-family: 'Menlo', 'Monaco', 'Consolas', 'Lucida Console', monospace;
padding: 0.2em 0.4em;
margin: 0;
font-size: 85%;
border-radius: 6px;
font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
}

.text-wrapper code {
background-color: rgba(175, 184, 193, 0.2);
}

/* next example link in example page */
Expand Down
6 changes: 6 additions & 0 deletions templates/example.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,23 @@
<p>No content yet, you can help us build it <a href="https://github.com/goplus/tutorial/tree/main/{{.Name}}">here</a>.</p>
{{end}}
{{range .Files}}
{{if .HeadDoc}}
<div class="docs">
{{range .HeadDoc}}
{{.DocsRendered}}
{{end}}
</div>
{{end}}
{{if .Code}}
<goplus-code half-code language="{{.Lang}}">{{range .Code}}{{if .DocsRendered}}<goplus-code-doc>{{.DocsRendered}}</goplus-code-doc>{{end}}{{.CodeRendered}}{{end}}</goplus-code>
{{end}}
{{if .TailDoc}}
<div class="docs">
{{range .TailDoc}}
{{.DocsRendered}}
{{end}}
</div>
{{end}}
{{end}}
{{if .Next}}
<p class="next">
Expand Down
Loading