Skip to content

Commit a64b6ed

Browse files
committed
Landmarks article!
1 parent 8908389 commit a64b6ed

15 files changed

+426
-14
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dev:
1515
iex -S mix phx.server
1616

1717
build:
18-
mix phx.digest
18+
cd apps/components_guide_web/ && mix template_assets && mix phx.digest
1919

2020
clean:
2121
rm -rf ./_build

apps/components_guide_web/assets/css/app.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ h3,
7676
h4,
7777
p,
7878
li,
79+
figure,
7980
table,
8081
blockquote {
8182
margin-left: var(--item-spacing-left);
@@ -110,6 +111,12 @@ p:empty {
110111
li {
111112
padding: var(--listitem-spacing);
112113
}
114+
figure {
115+
padding: var(--figure-spacing);
116+
}
117+
figcaption {
118+
padding: var(--figcaption-spacing);
119+
}
113120
table {
114121
margin: var(--table-spacing);
115122
margin-left: var(--item-spacing-left);
@@ -163,6 +170,8 @@ pre[class*="language-"] {
163170
--heading-4-spacing: var(--size-base) 0;
164171
--paragraph-spacing: 0.5rem 0;
165172
--listitem-spacing: 0.5rem 0;
173+
--figure-spacing: 1rem 0;
174+
--figcaption-spacing: 0.5rem 0 0;
166175
--table-spacing: var(--size-xl) 0;
167176
--code-spacing: 0 0.1875em;
168177
--code-radius: 0.125em;

apps/components_guide_web/lib/components_guide_web/template_engines/markdown_engine.ex

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ defmodule ComponentsGuideWeb.TemplateEngines.MarkdownEngine do
1717
regex = ~r{<live-([\w-]+)>([^<]+)</live-([^>]+)>}
1818
# regex = ~r{<live-([\w-]+)>}
1919

20-
# live? = Regex.match(regex, html)
21-
2220
html =
23-
Regex.replace(regex, html, fn whole, name, content ->
24-
case name do
21+
Regex.replace(regex, html, fn whole, tag_suffix, content ->
22+
case tag_suffix do
2523
"render" ->
2624
# |> String.to_existing_atom
2725
module = content |> String.trim()
@@ -37,6 +35,19 @@ defmodule ComponentsGuideWeb.TemplateEngines.MarkdownEngine do
3735
end
3836
end)
3937

38+
regex = ~r{<collected-([\w-]+) image="([^"]+)">([^<]+)</collected-([^>]+)>}
39+
40+
html =
41+
Regex.replace(regex, html, fn _whole, tag_suffix, image, content ->
42+
case tag_suffix do
43+
"figure" ->
44+
"<div><%= collected_figure(@conn, #{inspect(image)}, #{inspect(content)}) %></div>"
45+
46+
_ ->
47+
"!" <> image <> "!" <> content
48+
end
49+
end)
50+
4051
# html = Regex.replace(regex, html, fn whole, name, content -> "!" <> name <> "!" <> content end)
4152

4253
# html = Regex.replace(regex, html, fn whole, name, content -> "<div><%= live_render(@conn, ComponentsGuideWeb.FakeSearchLive, session: %{}) %></div>" end)
10.5 KB
Loading
26.2 KB
Loading
13.3 KB
Loading
72.2 KB
Loading
119 KB
Loading
97.4 KB
Loading
29.4 KB
Loading

0 commit comments

Comments
 (0)