mirror of
https://github.com/sbrow/thor.git
synced 2026-08-26 11:23:32 -04:00
refactor: $content, and &body renamed to $main and &content.
This commit is contained in:
@@ -45,6 +45,7 @@
|
|||||||
- [ ] Integrity hash
|
- [ ] Integrity hash
|
||||||
- Allows users to verify their output didn't change after upgrading to a new version
|
- Allows users to verify their output didn't change after upgrading to a new version
|
||||||
- [ ] Content-hash fingerprinting for CSS and JS cache busting
|
- [ ] Content-hash fingerprinting for CSS and JS cache busting
|
||||||
|
- [ ] try to combine render_page_html and render_home_html?
|
||||||
- [ ] Avoid `json.Value` / `json.Object` where possible.
|
- [ ] Avoid `json.Value` / `json.Object` where possible.
|
||||||
- [ ] Create a json schema file for `thor.json`.
|
- [ ] Create a json schema file for `thor.json`.
|
||||||
- [ ] make `parse` an overload of `parse_text/parse_inline` and `parse_file`, or something.
|
- [ ] make `parse` an overload of `parse_text/parse_inline` and `parse_file`, or something.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{$nav}}{{/nav}}
|
{{$nav}}{{/nav}}
|
||||||
{{$content}}{{/content}}
|
{{$main}}{{/main}}
|
||||||
{{$sidebar}}{{/sidebar}}
|
{{$sidebar}}{{/sidebar}}
|
||||||
{{$footer}}{{/footer}}
|
{{$footer}}{{/footer}}
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
{{/nav}}
|
{{/nav}}
|
||||||
{{$content}}
|
{{$main}}
|
||||||
<main>
|
<main>
|
||||||
<h1>Archive</h1>
|
<h1>Archive</h1>
|
||||||
{{#posts | group_by year}}
|
{{#posts | group_by year}}
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
</section>
|
</section>
|
||||||
{{/posts}}
|
{{/posts}}
|
||||||
</main>
|
</main>
|
||||||
{{/content}}
|
{{/main}}
|
||||||
{{$sidebar}}
|
{{$sidebar}}
|
||||||
<aside>
|
<aside>
|
||||||
<h3>Recent Comments</h3>
|
<h3>Recent Comments</h3>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{> nav}}{{$content}}{{/content}}
|
{{> nav}}{{$main}}{{/main}}
|
||||||
{{> footer}}
|
{{> footer}}
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{{<base}}
|
{{<base}}
|
||||||
{{$content}}
|
{{$main}}
|
||||||
<main>
|
<main>
|
||||||
<header>
|
<header>
|
||||||
{{&body}}
|
{{&content}}
|
||||||
</header>
|
</header>
|
||||||
<ul>
|
<ul>
|
||||||
{{#pages}} <li><a href="{{permalink}}">{{&title}}</a><span>{{#date_iso}}<time
|
{{#pages}} <li><a href="{{permalink}}">{{&title}}</a><span>{{#date_iso}}<time
|
||||||
@@ -11,5 +11,5 @@
|
|||||||
{{/pages}}
|
{{/pages}}
|
||||||
</ul>
|
</ul>
|
||||||
</main>
|
</main>
|
||||||
{{/content}}
|
{{/main}}
|
||||||
{{/base}}
|
{{/base}}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
{{<base}}
|
{{<base}}
|
||||||
{{$content}}
|
{{$main}}
|
||||||
<main>
|
<main>
|
||||||
<article>
|
<article>
|
||||||
<h1>{{page_title}}</h1>
|
<h1>{{page_title}}</h1>
|
||||||
{{#date_iso}} <time class="subtitle" datetime="{{date_iso}}">{{date_display}}</time>
|
{{#date_iso}} <time class="subtitle" datetime="{{date_iso}}">{{date_display}}</time>
|
||||||
{{/date_iso}} {{&body}}
|
{{/date_iso}} {{&content}}
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
{{/content}}
|
{{/main}}
|
||||||
{{/base}}
|
{{/base}}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{{<base}}
|
{{<base}}
|
||||||
{{$content}}
|
{{$main}}
|
||||||
<main>
|
<main>
|
||||||
<h1>{{page_title}}</h1>
|
<h1>{{page_title}}</h1>
|
||||||
{{&body}}
|
{{&content}}
|
||||||
{{#posts | group_by year}}
|
{{#posts | group_by year}}
|
||||||
<section>
|
<section>
|
||||||
<h2>{{key}}</h2>
|
<h2>{{key}}</h2>
|
||||||
@@ -15,5 +15,5 @@
|
|||||||
</section>
|
</section>
|
||||||
{{/posts}}
|
{{/posts}}
|
||||||
</main>
|
</main>
|
||||||
{{/content}}
|
{{/main}}
|
||||||
{{/base}}
|
{{/base}}
|
||||||
|
|||||||
+4
-4
@@ -21,7 +21,7 @@ Page_Context :: struct {
|
|||||||
Base_Data :: struct {
|
Base_Data :: struct {
|
||||||
now: string,
|
now: string,
|
||||||
params: json.Value,
|
params: json.Value,
|
||||||
body: string,
|
content: string,
|
||||||
title: string,
|
title: string,
|
||||||
description: string,
|
description: string,
|
||||||
og: Open_Graph,
|
og: Open_Graph,
|
||||||
@@ -279,7 +279,7 @@ render_page_html :: proc(
|
|||||||
}
|
}
|
||||||
data.title = fmt.tprintf("%s | %s", page.title, site.title)
|
data.title = fmt.tprintf("%s | %s", page.title, site.title)
|
||||||
data.page_title = page.title
|
data.page_title = page.title
|
||||||
data.body = page.body_html
|
data.content = page.body_html
|
||||||
data.date = page.date
|
data.date = page.date
|
||||||
data.og = og_for_page(site.og, page)
|
data.og = og_for_page(site.og, page)
|
||||||
return render_template(content_tpl, data, partials)
|
return render_template(content_tpl, data, partials)
|
||||||
@@ -305,7 +305,7 @@ render_home_html :: proc(
|
|||||||
base = base,
|
base = base,
|
||||||
}
|
}
|
||||||
data.title = site.title
|
data.title = site.title
|
||||||
data.body = home.body_html
|
data.content = home.body_html
|
||||||
data.pages = list_pages
|
data.pages = list_pages
|
||||||
data.og = og_for_page(site.og, home)
|
data.og = og_for_page(site.og, home)
|
||||||
return render_template(content_tpl, data, partials)
|
return render_template(content_tpl, data, partials)
|
||||||
@@ -333,7 +333,7 @@ render_section :: proc(
|
|||||||
base = base,
|
base = base,
|
||||||
}
|
}
|
||||||
if has_index {
|
if has_index {
|
||||||
data.body = section_index.body_html
|
data.content = section_index.body_html
|
||||||
data.page_title = section_index.title
|
data.page_title = section_index.title
|
||||||
data.title = fmt.tprintf("%s | %s", section_index.title, site.title)
|
data.title = fmt.tprintf("%s | %s", section_index.title, site.title)
|
||||||
data.og = og_for_page(site.og, section_index)
|
data.og = og_for_page(site.og, section_index)
|
||||||
|
|||||||
Reference in New Issue
Block a user