forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bazel DevSite: Add "create issue" & "view source" buttons to the gene…
…rated reference documentation. - This change is a follow-up to unknown commit which added the buttons to all narrative docs. - It only affects the documentation generated from Java sources. Consequently, the docs at https://bazel.build/rules/lib/repo are currently out-of-scope (since they are generated by StarDoc). Implementation details: - `_buttons.html` received some logic that controls whether the "view source" button should be displayed, and which URL it points to. This decision depends on the newly added `source_file` variable. - All relevant `.vm` template files now include `_buttons.html` and set the `source_file` variable. As a result, there are now three scenarios: 1. Narrative documentation remains unchanged since it does NOT set the `source_file` variable. As a result, the "view source" button is displayed, with an URL pointing to the current Markdown page. 2. Reference documentation that is generated from multiple source files has `source_file="NONE"`, which means that no "view source" button will be displayed. 3. Reference documentation that is generated from a single file stores the path of said file in the variable. In this case the button will be displayed, too. A notable example of scenario 3 are Starlark modules, since they all use `starlark-library.vm`. Consequently, I modified `StarlarkDocumentationCollector` and `StarlarkBuiltinDoc` to inject the correct value into the `source_file` variable. PiperOrigin-RevId: 486896353 Change-Id: I600fa17f07914a4f489c65de0b04cfce8f20b9ec
- Loading branch information
1 parent
3b9ed6e
commit 0331b0d
Showing
11 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
<a class="button button-with-icon" href="https://github.com/bazelbuild/bazel/issues/new?title=%5Bbazel.build%5D+Problem+with+{% dynamic print request.path %}&labels=type%3A%20documentation%20%28cleanup%29" target="_blank"> | ||
Report an issue<span class="material-icons icon-after" aria-hidden="true">open_in_new</span> | ||
</a> | ||
{% dynamic if not setvar.source_file %} | ||
<a class="button button-with-icon" href="https://github.com/bazelbuild/bazel/tree/master/site/en{% dynamic print request.path %}.md" target="_blank"> | ||
View source<span class="material-icons icon-after" aria-hidden="true">open_in_new</span> | ||
</a> | ||
{% dynamic elif setvar.source_file != "NONE" %} | ||
<a class="button button-with-icon" href="https://github.com/bazelbuild/bazel/tree/master/{% dynamic print setvar.source_file %}" target="_blank"> | ||
View source<span class="material-icons icon-after" aria-hidden="true">open_in_new</span> | ||
</a> | ||
{% dynamic endif %} | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters