Skip to content

Commit

Permalink
Add in dynamic nav for examples
Browse files Browse the repository at this point in the history
  • Loading branch information
pflooky committed Oct 18, 2024
1 parent 6b9c868 commit aec155e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs-site-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material mkdocs-open-in-new-tab "mkdocs-material[imaging]" mike
- run: pip install mkdocs-material mkdocs-open-in-new-tab "mkdocs-material[imaging]" mkdocs-awesome-pages-plugin mike
- run: bash src/script/build_docs.sh
- run: |
latest_tag=$(git describe --tags --abbrev=0)
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
.idea
site
*.iml
.cache

docs/changelog.md
docs/contributing.md
docs/home.md
docs/vendors.md
docs/examples/**/*.md
32 changes: 16 additions & 16 deletions docs/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,46 @@ This folder contains mainly excerpts of data contracts to illustrate specific se

## Full example

- [Full example](all/full-example.odcs.yaml)
- [Postgres AdventureWorks](all/postgresql-adventureworks-contract.odcs.yaml)
- [Full example](all/full-example.md)
- [Postgres AdventureWorks](all/postgresql-adventureworks-contract.md)

## Fundamentals

- [Table and column](fundamentals/table-column-description.odcs.yaml)
- [Table and column](fundamentals/table-column-description.md)

## Dataset and schema

- [All schema types](schema/all-schema-types.odcs.yaml)
- [Data types](data-types/all-data-types.odcs.yaml)
- [Table with single column](schema/table-column.odcs.yaml)
- [Table with columns and partitioning](schema/table-columns-with-partition.odcs.yaml)
- [All schema types](schema/all-schema-types.md)
- [Data types](data-types/all-data-types.md)
- [Table with single column](schema/table-column.md)
- [Table with columns and partitioning](schema/table-columns-with-partition.md)

## Data quality

- [Column accuracy](quality/column-accuracy.odcs.yaml)
- [Column completeness](quality/column-completeness.odcs.yaml)
- [Column custom](quality/column-custom.odcs.yaml)
- [Column validity](quality/column-validity.odcs.yaml)
- [Column accuracy](quality/column-accuracy.md)
- [Column completeness](quality/column-completeness.md)
- [Column custom](quality/column-custom.md)
- [Column validity](quality/column-validity.md)

## Server

- [Azure server](server/azure-server.odcs.yaml)
- [Kafka server](server/kafka-server.odcs.yaml)
- [Azure server](server/azure-server.md)
- [Kafka server](server/kafka-server.md)

## Pricing
This section covers pricing when you bill your customer for using this data product.

## Stakeholders

- [Stakeholders example](stakeholders/basic-four-dpo.odcs.yaml)
- [Stakeholders example](stakeholders/basic-four-dpo.md)

## Roles

- [Service and operational roles](roles/service-and-operational-roles.odcs.yaml)
- [Service and operational roles](roles/service-and-operational-roles.md)

## Service-level agreement

- [Database SLA](sla/database-table-sla.odcs.yaml)
- [Database SLA](sla/database-table-sla.md)

## Other properties
Coming soon.
5 changes: 4 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins:
- open-in-new-tab
- search
- social
- awesome-pages

theme:
name: material
Expand Down Expand Up @@ -34,7 +35,9 @@ theme:
nav:
- Home: 'home.md'
- Standard: 'README.md'
- Examples: 'examples/README.md'
- Examples:
- 'examples/README.md'
- '...'
- Changelog: 'changelog.md'
- Contributing: 'contributing.md'
- Vendors: 'vendors.md'
Expand Down
8 changes: 5 additions & 3 deletions src/script/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ echo "Creating markdown file for each example"
for f in docs/examples/**/*.yaml; do
yaml_content=$(cat "$f")
markdown_file_path="${f//odcs.yaml/md}"
header="${f//docs\/examples\//}"
file_name=$(basename "$f" .odcs.yaml)
header=$(echo "${file_name//\-/ }" | sed -e "s/\b\(.\)/\u\1/g")
echo "Creating file: $markdown_file_path"
content=$(cat <<-END
# ${header}
Expand All @@ -21,7 +22,8 @@ ${yaml_content}
END
)
echo "$content" > "$markdown_file_path"
escaped_header="${header//\//\\/}"
base_path="${f//docs\/examples\//}"
escaped_header="${base_path//\//\\/}"
replacement_link="${escaped_header//odcs.yaml/md}"
sed -i -e "s/$escaped_header/$replacement_link/g" docs/examples/README.md
sed -i '' -e "s/$escaped_header/$replacement_link/g" docs/examples/README.md
done

0 comments on commit aec155e

Please sign in to comment.