Render the schema as Markdown: per group a heading, doc line, and a knob table.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(nml_schema_t), | intent(in) | :: | this | |||
| character(len=*), | intent(in) | :: | path |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | ig | ||||
| integer, | private | :: | ik | ||||
| integer, | private | :: | u | ||||
| character(len=:), | private, | allocatable | :: | ustr |
subroutine schema_render_markdown(this, path) !! Render the schema as Markdown: per group a heading, doc line, !! and a knob table. class(nml_schema_t), intent(in) :: this character(len=*), intent(in) :: path integer :: u, ig, ik character(len=:), allocatable :: ustr open (newunit=u, file=path, status="replace", action="write") do ig = 1, size(this%groups) ! Blank separator BETWEEN groups only: a trailing blank line after ! the last group gets re-trimmed by the end-of-file pre-commit hook ! on every regeneration (a recurring commit-abort nuisance). if (ig > 1) write (u, "(A)") "" write (u, "(A)") "### &"//this%groups(ig)%name//"_nml" write (u, "(A)") "" if (allocated(this%groups(ig)%doc)) then if (len_trim(this%groups(ig)%doc) > 0) then write (u, "(A)") trim(this%groups(ig)%doc) write (u, "(A)") "" end if end if write (u, "(A)") "| Knob | Default | Units | Description |" write (u, "(A)") "|------|---------|-------|-------------|" if (allocated(this%groups(ig)%keys)) then do ik = 1, size(this%groups(ig)%keys) associate (k => this%groups(ig)%keys(ik)%key) ustr = "" if (len_trim(k%units) > 0) ustr = trim(k%units) write (u, "(A)") "| `"//k%name//"` | `"//k%default_string()// & "` | "//ustr//" | "//trim(k%doc)//" |" end associate end do end if end do close (u) end subroutine schema_render_markdown