Skip to content

Commit

Permalink
Add Title and display in TOC
Browse files Browse the repository at this point in the history
Reformat the list at the top of each page to be an asterisk list and to
make the labels bold. Add the RFC and Title headers and tweak the names
of the others.

Add an h2 line for the title to the template and make all other headers
h2. Remove the redundant anchor IDs.

Teach `generate-book.py` to read the title from the files and use it in
the TOC. Fall back on the file name if no title can be found.
  • Loading branch information
theory committed Jul 11, 2024
1 parent 9148d69 commit 13310e2
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 28 deletions.
39 changes: 17 additions & 22 deletions 0000-template.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
- Slug: (fill me in with a unique slug, `my_awesome_feature`)
- Start Date: (fill me in with today's date, YYYY-MM-DD)
- Status: Proposed Standard (May be "Proposed", "Draft", "Standard")
- RFC PR: [pgxn/rfcs#0000](https://github.com/pgxn/rfcs/pull/0000)
- PGXN Issue: [pgxn/repo#0000](https://github.com/pgxn/repo/issues/0000)
* **RFC:** 0000 (fill in with pull request number)
* **Title:** (fill me in with unique name, My Awesome Feature)
* **Slug:** (fill me in with a unique slug, `my_awesome_feature`)
* **Start Date:** (fill me in with today's date, YYYY-MM-DD)
* **Status:** Proposed Standard (May be "Proposed", "Draft", "Standard")
* **Pull Request:** [pgxn/rfcs#0000](https://github.com/pgxn/rfcs/pull/0000)
* **Implementation Issue:** [pgxn/repo#0000](https://github.com/pgxn/repo/issues/0000)

# Abstract
[abstract]: #abstract
# RFC--0000 --- [Fill In Title]

## Abstract

One paragraph explanation of the feature.

# Introduction
[introduction]: #introduction
## Introduction

Background and purpose. Why are we doing this? What use cases does it support?
What is the expected outcome?

# Guide-level explanation
[guide-level-explanation]: #guide-level-explanation
## Guide-level explanation

Explain the proposal as if it already existed and you were teaching it to
another extension developer. That generally means:
Expand All @@ -34,7 +35,6 @@ another extension developer. That generally means:
extension packages.

# Reference-level explanation
[reference-level-explanation]: #reference-level-explanation

This is the technical portion of the RFC. Explain the design in sufficient
detail that:
Expand All @@ -46,21 +46,18 @@ detail that:
The section should return to the examples given in the previous section, and
explain more fully how the detailed proposal makes those examples work.

# Drawbacks
[drawbacks]: #drawbacks
## Drawbacks

Why should we *not* do this?

# Rationale and alternatives
[rationale-and-alternatives]: #rationale-and-alternatives
## Rationale and alternatives

* Why is this design the best in the space of possible designs?
* What other designs have been considered and what is the rationale for not
choosing them?
* What is the impact of not doing this?

# Prior art
[prior-art]: #prior-art
## Prior art

Discuss prior art, both the good and the bad, in relation to this proposal. A
few examples of what this can include are:
Expand All @@ -81,8 +78,7 @@ picture. If there is no prior art, that is fine --- your ideas are interesting
to us whether they are brand new or if it is an adaptation from other
packaging and distribution systems.

# Unresolved questions
[unresolved-questions]: #unresolved-questions
## Unresolved questions

* What parts of the design do you expect to resolve through the RFC process
before this gets merged?
Expand All @@ -92,8 +88,7 @@ packaging and distribution systems.
be addressed in the future independently of the solution that comes out
of this RFC?

# Future possibilities
[future-possibilities]: #future-possibilities
## Future possibilities

Think about what the natural extension and evolution of your proposal would be
and how it would affect the ecosystem and project as a whole in a holistic
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
src/SUMMARY.md: README.md text/*.md
src/SUMMARY.md: generate-book.py README.md text/*.md
@./generate-book.py

run: src/SUMMARY.md
@mdbook serve --open

clean: src book
rm -rf $^
12 changes: 11 additions & 1 deletion generate-book.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ def collect(summary, path, depth):
for entry in entries:
indent = ' '*depth
name = entry.name[:-3]
title = read_title(entry)
link_path = entry.path[5:]
summary.write(f'{indent}- [{name}]({link_path})\n')
summary.write(f'{indent}* [{title}]({link_path})\n')
maybe_subdir = os.path.join(path, name)
if os.path.isdir(maybe_subdir):
collect(summary, maybe_subdir, depth+1)
Expand All @@ -62,5 +63,14 @@ def symlink(src, dst):
if not os.path.exists(dst):
os.symlink(src, dst)

def read_title(entry):
name = entry.name[:-3]
with open(entry.path, 'r') as rfc:
lines = rfc.readlines()
for line in lines:
if line.startswith('* **Title:** '):
return name[:4] + " " + line.removeprefix('* **Title:** ').strip()
name

if __name__ == '__main__':
main()
10 changes: 6 additions & 4 deletions text/0001-meta-spec-v1.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
- Slug: `meta-spec`
- Start Date: 2010-08-17
- Status: Standard
- RFC PR: [pgxn/rfcs#0001](https://github.com/pgxn/rfcs/pull/1)
* **RFC:** 1
* **Title:** PGXN Meta Spec
* **Slug:** `meta-spec`
* **Start Date:** 2010-08-17
* **Status:** Standard
* **Pull Request:** [pgxn/rfcs#1](https://github.com/pgxn/rfcs/pull/1)

Name
====
Expand Down

0 comments on commit 13310e2

Please sign in to comment.