Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: provide 'title' in .readme-partials.yaml to override the default #229

Merged
merged 3 commits into from
Apr 23, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion synthtool/gcp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ def _load_partials(self, metadata: Dict):
hand-crafted artisinal markdown can be provided in a .readme-partials.yml.
The following fields are currently supported:

introduction: a more thorough introduction than metadata["description"].
body: custom body to include in the usage section of the document.
introduction: a more thorough introduction than metadata["description"].
title: provide markdown to use as a custom title.
"""
cwd_path = Path(os.getcwd())
partials_file = None
Expand Down
8 changes: 6 additions & 2 deletions synthtool/gcp/templates/node_library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>

{% if 'partials' in metadata and metadata['partials']['title'] -%}
{{ metadata['partials']['title'] }}
{% else -%}
# [{{ metadata['repo']['name_pretty'] }}: {{ metadata['repo']['language']|language_pretty }} Client](https://github.com/{{ metadata['repo']['repo'] }})
{%- endif %}

{{ metadata['repo']['release_level']|release_quality_badge }}
[![npm version](https://img.shields.io/npm/v/{{ metadata['name'] }}.svg)](https://www.npmjs.org/package/{{ metadata['name'] }})
Expand All @@ -14,7 +18,7 @@
| This library is **deprecated**. {{ metadata['deprecated'] }} |
{% endif %}

{% if metadata['partials'] and metadata['partials']['introduction'] %}
{% if 'partials' in metadata and metadata['partials']['introduction'] %}
{{ metadata['partials']['introduction'] }}
{% else %}
{{ metadata['description'] }}
Expand Down Expand Up @@ -63,7 +67,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
```{{ metadata['repo']['language']|syntax_highlighter }}
{{ metadata['quickstart'] }}
```
{% endif %}{% if metadata['partials'] and metadata['partials']['body'] %}{{ metadata['partials']['body'] }}{% endif %}
{% endif %}{% if 'partials' in metadata and metadata['partials']['body'] %}{{ metadata['partials']['body'] }}{% endif %}

{% if metadata['samples']|length %}
## Samples
Expand Down
4 changes: 4 additions & 0 deletions synthtool/gcp/templates/node_library/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>

{% if 'partials' in metadata and metadata['partials']['title'] -%}
{{ metadata['partials']['title'] }} Samples
{% else -%}
# [{{ metadata['repo']['name_pretty'] }}: {{ metadata['repo']['language']|language_pretty }} Samples](https://github.com/{{ metadata['repo']['repo'] }})
{%- endif %}

[![Open in Cloud Shell][shell_img]][shell_link]

Expand Down