Skip to content

Commit

Permalink
Zexi template change to make unique title IDs (#5396)
Browse files Browse the repository at this point in the history
Zexi template change to make unique title IDs for examples because
otherwise Zonbook concatenates them together and it looks odd.
  • Loading branch information
Laren-AWS authored Sep 19, 2023
1 parent d4aa2a7 commit a6e276c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .doc_gen/templates/zonbook/library_by_service_chapter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<listitem><para><phrase role="topcom"><ulink url="https://github.com/awsdocs/aws-doc-sdk-examples">&AWS; SDK Examples</ulink></phrase>
&endash; GitHub repo with complete code in preferred languages. Includes instructions for setting up and running the code.</para></listitem>
</itemizedlist>
{{- template "hello" makeSlice $service.CategorizedExampleSets ""}}
{{- template "hello" makeSlice $service.CategorizedExampleSets "" $service.Model}}
<para role="contents-abbrev">Code examples</para>
{{- range $category := $service.CategoryNamesSorted}}
{{- if ne $category "Hello"}}
Expand Down
2 changes: 1 addition & 1 deletion .doc_gen/templates/zonbook/service_chapter_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{{.ServiceEntity.Caveat}}</para>
{{- template "note_example_types" makeSlice $actions.Examples $scenarios.Examples $cross_service.Examples}}
{{- template "note_complete_list"}}
{{- template "hello" makeSlice .CategorizedExampleSets ""}}
{{- template "hello" makeSlice .CategorizedExampleSets "" 0}}
<para role="contents-abbrev">Code examples</para>
{{- range $category := .CategoryNamesSorted}}
{{- if ne $category "Hello"}}
Expand Down
11 changes: 8 additions & 3 deletions .doc_gen/templates/zonbook/utility/hello.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
{{- if not $example_suffix}}
{{- $example_suffix = "tablist"}}
{{- end}}
{{- $prefix := index . 2}}
{{- $example_prefix := ""}}
{{- if $prefix}}
{{- $example_prefix = printf "%s_" $prefix}}
{{- end}}
{{- $include_docs := "file://AWSShared/code-samples/docs/"}}
{{- if isSnapshot}}
{{- $include_docs := ""}}
Expand All @@ -14,10 +19,10 @@
<block>
<collapsible expand-section="_collapse_all_">
{{- range $hello.Examples}}
<section id="example_{{.ExampleId}}_section">
<section id="{{$example_prefix}}example_{{.ExampleId}}_section">
<info>
<title id="example_{{.ExampleId}}_section.title">{{.Title}}</title>
<titleabbrev id="example_{{.ExampleId}}_section.titleabbrev">{{.TitleAbbrev}}</titleabbrev>
<title id="{{$example_prefix}}example_{{.ExampleId}}_section.title">{{.Title}}</title>
<titleabbrev id="{{$example_prefix}}example_{{.ExampleId}}_section.titleabbrev">{{.TitleAbbrev}}</titleabbrev>
<abstract>
<para>{{.Title}}</para>
</abstract>
Expand Down
2 changes: 1 addition & 1 deletion .doc_gen/templates/zonbook/utility/sdk_api_examples.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{{- template "note_example_types" makeSlice 1 1 0}}
<para>Each example includes a link to GitHub, where you can find
instructions on how to set up and run the code in context.</para>
{{- template "hello" makeSlice $svc_examples.CategorizedExampleSets $examples.Language}}
{{- template "hello" makeSlice $svc_examples.CategorizedExampleSets $examples.Language $examples.LanguageSlug}}
<para role="topiclist-abbrev"/>
{{- range $category := $svc_examples.CategoryNamesSorted}}
{{- if ne $category "Hello"}}
Expand Down
6 changes: 3 additions & 3 deletions .doc_gen/templates/zonbook/utility/service_examples.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
{{- end}}
<section id="{{$svc_prefix}}example_{{.ExampleId}}_section" role="topic">
<info>
<title id="example_{{.ExampleId}}_section.title">{{.Title}}</title>
<titleabbrev id="example_{{.ExampleId}}_section.titleabbrev">{{.TitleAbbrev}}</titleabbrev>
<title id="{{$svc_prefix}}example_{{.ExampleId}}_section.title">{{.Title}}</title>
<titleabbrev id="{{$svc_prefix}}example_{{.ExampleId}}_section.titleabbrev">{{.TitleAbbrev}}</titleabbrev>
<abstract>
<para>{{.Title}}</para>
</abstract>
Expand Down Expand Up @@ -57,7 +57,7 @@
<listitem>
<para>
<xref linkend="{{$svc_prefix}}example_{{$rel_example}}_section"
endterm="example_{{$rel_example}}_section.titleabbrev"/>
endterm="{{$svc_prefix}}example_{{$rel_example}}_section.titleabbrev"/>
</para>
</listitem>
{{- end}}
Expand Down

0 comments on commit a6e276c

Please sign in to comment.