Skip to content

Commit b6e50f4

Browse files
committed
RPC indexes
1 parent c218e2f commit b6e50f4

File tree

3 files changed

+88
-20
lines changed

3 files changed

+88
-20
lines changed

_doc/en/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: index
3+
btcversion: index
4+
btcgroup: index
5+
permalink: en/doc/
6+
---
7+
8+

_layouts/doc.html

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
<!doctype html>
22
{% include _browser_magic.html %}
33
<head>
4-
{% assign custom_title = page.name | append: " (" | append: page.btcversion | append: " RPC)" %}
4+
{% if page.name != "index" and page.name != "rpcindex" %}
5+
{% assign custom_title = page.name | append: " (" | append: page.btcversion | append: " RPC)" %}
6+
{% else %}
7+
{% if page.btcversion != "index" %}
8+
{% assign custom_title = "Bitcoin Core " | append: page.btcversion | append: " RPC" %}
9+
{% else %}
10+
{% assign custom_title = "Bitcoin Core RPC" %}
11+
{% endif %}
12+
{% endif %}
513
{% include _head.html %}
614
</head>
715

@@ -15,36 +23,63 @@
1523
<div class="article-author-side">
1624
<div>
1725
<p>
18-
Documentation exported from <a href="https://github.com/bitcoin/bitcoin/tree/v{{page.btcversion}}">Bitcoin Core {{page.btcversion}}</a>
26+
{% if page.btcversion != "index" %}
27+
Documentation exported from <a href="https://github.com/bitcoin/bitcoin/tree/v{{page.btcversion}}">Bitcoin Core {{page.btcversion}}</a>
28+
{% endif %}
1929
</p>
2030
</div>
2131
</div>
2232
<article class="page">
2333
<h1>{{ custom_title }}</h1>
2434
<div class="article-wrap">
25-
{% assign groups = site.doc | where:"btcversion", page.btcversion | group_by:"btcgroup" | sort: "name" %}
26-
<section class="toc">
27-
{% for group in groups %}
28-
<header>
29-
<h3 class="toc-header">
30-
<i class="fa fa-book"></i>
31-
{{ group.name }}
32-
</h3>
33-
<div class="toc-drawer js-hidden">
34-
<ul>
35-
{% for article in group.items %}
36-
<li><a href="{{article.url}}">{{article.name}}</a></li>
37-
{% endfor %}
38-
</ul>
39-
</div>
40-
</header>
41-
{% endfor %}
42-
</section>
35+
{% if page.btcversion != "index" %}
36+
{% assign groups = site.doc | where:"btcversion", page.btcversion | group_by:"btcgroup" | sort: "name" %}
37+
<section class="toc">
38+
{% for group in groups %}
39+
{% if group.name != "index" %}
40+
<header>
41+
<h3 class="toc-header">
42+
<i class="fa fa-book"></i>
43+
{{ group.name }}
44+
</h3>
45+
<div class="toc-drawer js-hidden">
46+
<ul>
47+
{% for article in group.items %}
48+
<li><a href="{{article.url}}">{{article.name}}</a></li>
49+
{% endfor %}
50+
</ul>
51+
</div>
52+
</header>
53+
{% endif %}
54+
{% endfor %}
55+
</section>
56+
{% endif %}
4357

4458
<!-- { % include _istranslated.html % } -->
59+
60+
{% if page.name != "index" and page.name != "rpcindex" %}
4561
<span class="doc">
4662
{% highlight text %}{{ content }}{% endhighlight %}
4763
</span>
64+
{% else %}
65+
{% if page.btcversion != "index" %}
66+
Select a command group in the menu.
67+
{% else %}
68+
Following docs are available:
69+
{% assign groups = site.doc | group_by:"btcversion" | sort: "name" %}
70+
<ul>
71+
{% for group in groups %}
72+
{% if group.name != "index" %}
73+
{% for article in group.items %}
74+
{% if article.name == "index" %}
75+
<li><a href="{{article.url}}">{{group.name}}</a></li>
76+
{% endif %}
77+
{% endfor %}
78+
{% endif %}
79+
{% endfor %}
80+
</ul>
81+
{% endif %}
82+
{% endif %}
4883
{% if page.share != false %}
4984
<hr />
5085
{% include _social-share.html %}

contrib/doc-gen/generate.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,31 @@ func main() {
105105
log.Fatalf("Cannot make command file %s: %s", name, err.Error())
106106
}
107107
}
108+
address := fmt.Sprintf("../../_doc/en/%s/rpc/index.html", VERSION)
109+
permalink := fmt.Sprintf("en/doc/%s/rpc/", VERSION)
110+
err = tmpl.Execute(open(address), CommandData{
111+
Version: VERSION,
112+
Name: "rpcindex",
113+
Description: "",
114+
Group: "index",
115+
Permalink: permalink,
116+
})
117+
if err != nil {
118+
log.Fatalf("Cannot make index file: %s", err.Error())
119+
}
120+
121+
address = fmt.Sprintf("../../_doc/en/%s/index.html", VERSION)
122+
permalink = fmt.Sprintf("en/doc/%s/", VERSION)
123+
err = tmpl.Execute(open(address), CommandData{
124+
Version: VERSION,
125+
Name: "index",
126+
Description: "",
127+
Group: "index",
128+
Permalink: permalink,
129+
})
130+
if err != nil {
131+
log.Fatalf("Cannot make index file: %s", err.Error())
132+
}
108133
}
109134
}
110135

0 commit comments

Comments
 (0)