Return info for expanding a sample into a template. Sample may not be about a specific api. Args: keywords: list of string, list of keywords for the given api. dirname: string, directory name of the sample. desc: string, long description of the sample. uri: string, uri of the s
(keywords, dirname, desc, uri)
| 129 | |
| 130 | |
| 131 | def keyword_context_from_sample(keywords, dirname, desc, uri): |
| 132 | """Return info for expanding a sample into a template. |
| 133 | |
| 134 | Sample may not be about a specific api. |
| 135 | |
| 136 | Args: |
| 137 | keywords: list of string, list of keywords for the given api. |
| 138 | dirname: string, directory name of the sample. |
| 139 | desc: string, long description of the sample. |
| 140 | uri: string, uri of the sample code if provided in the README. |
| 141 | |
| 142 | Returns: |
| 143 | A dictionary of values useful for template expansion. |
| 144 | """ |
| 145 | if uri is None: |
| 146 | uri = BASE_HG_URI + dirname.replace("/", "%2F") |
| 147 | else: |
| 148 | uri = "".join(uri) |
| 149 | context = { |
| 150 | "keywords": keywords, |
| 151 | "dir": dirname, |
| 152 | "uri": uri, |
| 153 | "desc": wiki_escape(desc), |
| 154 | } |
| 155 | return context |
| 156 | |
| 157 | |
| 158 | def scan_readme_files(dirname): |
no test coverage detected
searching dependent graphs…