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

Automatically generate TOC menu for the specification pages #2043

Closed
wants to merge 20 commits into from

Conversation

wilzbach
Copy link
Member

@wilzbach wilzbach commented Jan 2, 2018

The Makefile target update-spec-toc is idempotent and thus can be called as called as part of the build process. In a later PR, we can do sth like dlang/dmd#7483 and ensure that the git working directory is clean or in other words that the update-spec-toc didn't need to do any changes.

@dlang-bot
Copy link
Contributor

dlang-bot commented Jan 2, 2018

Thanks for your pull request, @wilzbach!

Bugzilla references

Auto-close Bugzilla Description
18202 Show TOC overview in the dlang specification pages

@wilzbach wilzbach changed the title Automatically generate TOC menu for the specification page Automatically generate TOC menu for the specification pages Jan 2, 2018
@wilzbach wilzbach force-pushed the header-gen branch 3 times, most recently from 3bb9cfa to 448385c Compare January 3, 2018 01:11
@JinShil
Copy link
Contributor

JinShil commented Jan 4, 2018

@wilzbach
Copy link
Member Author

wilzbach commented Jan 4, 2018

There's quite a bit of redundancy between the grammar specifications and the table of contents:

That would be very trivial to fix. The update script searches for $(SPEC_HEADERNAV_TOC ...) DDoc macros. So simply removing the TOC in the spec page for these pages works.

@JinShil
Copy link
Contributor

JinShil commented Jan 4, 2018

That would be very trivial to fix.

I don't know if it needs to be "fixed", it was just and observation.

@wilzbach wilzbach added the Ddoc label Jan 4, 2018
@wilzbach
Copy link
Member Author

wilzbach commented Jan 7, 2018

I know that this looks quite shocking for reviewers with 45 files changed and 20 commits, but please note that most of it is generated and I used tiny commits for a very granular history.

Also considering that this a similar effort was merged two years ago (dlang/tools#180) and comes up in the NG from time to time (e.g. the most recent post is http://forum.dlang.org/post/bbghyhuzuofogjxkwisb@forum.dlang.org), shows that there's quite some interested in it.

(I rebased as I added a Bugzilla issue for it)

@CyberShadow
Copy link
Member

Could this be done as part of the build instead of modifying the source files?

@wilzbach
Copy link
Member Author

wilzbach commented Jan 7, 2018

Could this be done as part of the build instead of modifying the source files?

Hmm we could add a layer on top of Ddoc, but IIRC the last time I tried to add sth. like this you weren't really happy about it either.
So the simple thing that comes to my mind would be to have a ddoc.d that does these replacement on the fly and then handing the ddoc file on to dmd -D -. Is that what you were thinking about?

@CyberShadow
Copy link
Member

So the simple thing that comes to my mind would be to have a ddoc.d that does these replacement on the fly and then handing the ddoc file on to dmd -D -. Is that what you were thinking about?

That sounds like a good idea.

@wilzbach
Copy link
Member Author

wilzbach commented Jan 8, 2018

That sounds like a good idea.

-> #2060

I separated my improvements to the footer generation to #2061, but when #2060 is accepted, we can also integrate the footer generation into this script. Moreover, I just realized that this DDoc wrapper might solve a lot of our other DDoc problems.

@wilzbach wilzbach closed this Jan 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants