Skip to content

Commit 5c3ee05

Browse files
javier-godoypaodb
authored andcommitted
docs: document multiple source feature
1 parent d5b9071 commit 5c3ee05

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class SampleDemoDefault extends Div {
3535
}
3636
```
3737

38-
The demo view can be annotated with `@DemoSource`, in order to configure the URL for retrieving the source code. An optional `value` allows providing a link to the source code, in cases where it differs from the annotated class. When this annotation is used without a value, and the tabbed demo is annotated with `@GithubLink`, the source URL is automatically set to the location of the annotated class under `src/test/java` in the specified GitHub repository. The branch information is derived from the value specified in `@GithubBranch` within the tabbed demo or its containing package. If the source URL is defaulted and no `@GithubBranch` annotation is present either in the tabbed demo or its containing package, then the branch defaults to `master`.
38+
The demo view can be annotated with `@DemoSource`, in order to configure the URL for retrieving the source code. An optional `value` allows providing a link to the source code, in cases where it differs from the annotated class. When this annotation is used without a value, and the tabbed demo is annotated with `@GithubLink`, the source URL is automatically set to the location of the annotated class under `src/test/java` in the specified GitHub repository. The branch information is derived from the value specified in `@GithubBranch` within the tabbed demo or its containing package. If the source URL is defaulted and no `@GithubBranch` annotation is present either in the tabbed demo or its containing package, then the branch defaults to `master`. The `@DemoSource` annotation is repeatable (see [multiple sources](#multiple-sources)).
3939

4040
The `@DemoHelper` annotation can be used to link demo views with associated help content provided by `DemoHelperRenderer`.
4141
The handling of how this help content is presented is managed by `DemoHelperViewer`, which is configured on the `TabbedDemo`.
@@ -183,3 +183,9 @@ The `// begin-block` and `// end-block` comments are removed after post-processi
183183
<!-- FROM https://github.com/FlowingCode/CommonsDemo/pull/62 -->
184184
![image](https://github.com/FlowingCode/CommonsDemo/assets/11554739/02063272-029f-4b4b-bd6f-821f2f8a0158)
185185

186+
### Multiple sources
187+
188+
If several `@DemoSource` annotations are present, the layout will include a tab sheet for navigating among them. When the demo is rendered, the first `@DemoSource` will be displayed. The annotation allows customizing the caption of the source tab (which defaults to the file name) and the the language used to format the sources (which is otherwise inferred from the file extension).
189+
190+
![image](https://github.com/FlowingCode/CommonsDemo/assets/11554739/3c3e2094-3ddc-457c-934c-ebd1120592f5)
191+

0 commit comments

Comments
 (0)