Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass invalid table generation in pad docs #377

Merged
merged 2 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 0.9.0
* More fine-grained control over emitted metrics [#365](https://github.com/membraneframework/membrane_core/pull/365)
* Added log metadata when reporting init in telemetry [#376](https://github.com/membraneframework/membrane_core/pull/376)
* Fix generation of pad documentation inside an element [#377](https://github.com/membraneframework/membrane_core/pull/377)

## 0.8.2
* Fixed PadAdded spec [#359](https://github.com/membraneframework/membrane_core/pull/359)
Expand Down
16 changes: 9 additions & 7 deletions lib/membrane/core/child/pads_specs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ defmodule Membrane.Core.Child.PadsSpecs do
}
end)
|> Enum.map_join("\n", fn {k, v} ->
"#{k} | #{v}"
"<tr><td>#{k}</td> <td>#{v}</td></tr>"
end)

options_doc =
Expand All @@ -247,7 +247,9 @@ defmodule Membrane.Core.Child.PadsSpecs do
"""
### `#{inspect(unquote(name))}`

<table>
#{unquote(config_doc)}
</table>
""" <> unquote(options_doc)
end
end
Expand All @@ -258,22 +260,22 @@ defmodule Membrane.Core.Child.PadsSpecs do
|> Enum.map(fn
{module, params} ->
params_doc =
Enum.map_join(params, ",<br />", fn {k, v} ->
Bunch.Markdown.hard_indent("`#{k}: #{inspect(v)}`")
Enum.map_join(params, ",<br/>", fn {k, v} ->
Bunch.Markdown.hard_indent("<code>#{k}: #{inspect(v)}</code>")
end)

"`#{inspect(module)}`, restrictions:<br />#{params_doc}"
"<code>#{inspect(module)}</code>, restrictions:<br/>#{params_doc}"

module ->
"`#{inspect(module)}`"
"<code>#{inspect(module)}</code>"
end)
~> (
[doc] -> doc
docs -> docs |> Enum.join(",<br />")
docs -> docs |> Enum.join(",<br/>")
)
end

defp generate_pad_property_doc(_k, v) do
"`#{inspect(v)}`"
"<code>#{inspect(v)}</code>"
end
end