Skip to content

Commit

Permalink
Merge pull request #118 from JKRhb/example-dir
Browse files Browse the repository at this point in the history
Make examples from sdf.md available in sourcecode directory

I'm merging this now even though it will need to change once cabo/kramdown-rfc#206 is resolved.
  • Loading branch information
cabo authored Sep 26, 2023
2 parents a338e22 + 8cd0cb7 commit a451928
Show file tree
Hide file tree
Showing 8 changed files with 663 additions and 524 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
metadata.min.js
sdf.xml
.refcache
sourcecode.bak
unnamed_*
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
render: sdf-framework.cddl sdf.jso.json-unidiff sdf.md
kdrfc sdf.md

sourcecode: sdf.xml
rm -rf sourcecode.ba?
kramdown-rfc-extract-sourcecode -tfiles sdf.xml

.PHONY: all
all: render sourcecode
14 changes: 9 additions & 5 deletions sdf.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ We start with an example for the SDF definition of a simple Object called "Switc
}
}
~~~
{: sourcecode-name="example1.sdf.json"}
{: #example1 title="A simple example of an SDF definition file"}

This is a model of a switch.
Expand Down Expand Up @@ -959,6 +960,7 @@ The resulting definition of the "BasicSwitch" sdfObject would be identical to th
}
}
~~~
{: sourcecode-name="example1-without-toggle.sdf.json"}


### Resolved models
Expand Down Expand Up @@ -1448,7 +1450,7 @@ consumption there is no conflict with the intended goal.
## sdfThing

An sdfThing is a set of declarations and qualities that may be part of a more complex model. For example, the object declarations that make up the definition of a single socket of an outlet strip could be encapsulated in an sdfThing, and the socket-thing itself could be used in a declaration in the sdfThing definition for the outlet strip
(see {{exa-sdfthing-outlet-strip}} in {outlet-strip-example}} for an example SDF model).
(see {{exa-sdfthing-outlet-strip}} in {{outlet-strip-example}} for an example SDF model).

sdfThing definitions carry semantic meaning, such as a defined refrigerator compartment and a defined freezer compartment, making up a combination refrigerator-freezer product.
An `sdfThing` can also contain Interaction Affordances and sdfData itself, such
Expand Down Expand Up @@ -1875,10 +1877,10 @@ using the `sdfThing` quality.

## Outlet Strip Example {#outlet-strip-example}

~~~
~~~ json
{
"sdfThing": {
"outlet-strip" : {
"outlet-strip": {
"label": "Outlet strip",
"description": "Contains a number of Sockets",
"sdfObject": {
Expand All @@ -1892,14 +1894,15 @@ using the `sdfThing` quality.
}
}
~~~
{: sourcecode-name="example-sdfthing-outlet-strip.sdf.json"}
{: #exa-sdfthing-outlet-strip}

## Refrigerator-Freezer Example {#fridge-freezer-example}

~~~
~~~ json
{
"sdfThing": {
"refrigerator-freezer" : {
"refrigerator-freezer": {
"description": "A refrigerator combined with a freezer",
"sdfProperty": {
"status": {
Expand Down Expand Up @@ -1939,6 +1942,7 @@ using the `sdfThing` quality.
}
}
~~~
{: sourcecode-name="example-sdfthing-refrigerator-freezer.sdf.json"}
{: #exa-sdfthing-fridge-freezer}

# Acknowledgements
Expand Down
Loading

0 comments on commit a451928

Please sign in to comment.