bunch of small fixes

This commit is contained in:
Luna D 2021-09-22 00:43:51 +02:00
parent 625c0e4556
commit e88e27ccfd
No known key found for this signature in database
GPG key ID: 81AF416F2CC36FC8
4 changed files with 19 additions and 56 deletions

View file

@ -65,9 +65,8 @@ h6 {
p {
hyphens: none;
margin-top: 4px;
margin-bottom: 6px;
margin-left: 2px;
margin: 0.75rem 2px;
margin-right: 0;
}
pre {
@ -282,23 +281,27 @@ blockquote blockquote blockquote blockquote blockquote blockquote {
}
img[alt=tiny] {
max-height: $image_tiny_size;
max-width: $image_tiny_size;
max-height: $image_tiny_size !important;
max-width: $image_tiny_size !important;
}
img[alt=small] {
max-height: $image_small_size;
max-width: $image_small_size;
max-height: $image_small_size !important;
max-width: $image_small_size !important;
}
img[alt=medium] {
max-height: $image_medium_size;
max-width: $image_medium_size;
max-height: $image_medium_size !important;
max-width: $image_medium_size !important;
}
img[alt=large] {
max-height: $image_large_size;
max-width: $image_large_size;
max-height: $image_large_size !important;
max-width: $image_large_size !important;
}
.communication__body__text > table {
@extend .table;
}
//donations

View file

@ -14,12 +14,6 @@
defmodule Philomena.Textile.ParserMarkdown do
alias Philomena.Textile.Lexer
alias Philomena.Markdown
alias Phoenix.HTML
defp markdown_quote(text) do
result = Regexp.replace(~r/\n/, text, "\\0> ")
"> #{result}"
end
def parse(parser, input) do
parser = Map.put(parser, :state, %{})
@ -95,32 +89,6 @@ defmodule Philomena.Textile.ParserMarkdown do
#
# open_token callback* close_token
#
defp simple_recursive(
:bq_open,
:bq_close,
open_tag,
close_tag,
callback,
parser,
[
{:bq_open, open} | r_tokens
],
level
) do
case repeat(callback, parser, r_tokens, true, level) do
{:ok, tree, [{:bq_close, _} | r2_tokens], level} ->
{:ok,
[
{:markup, "\n" <> String.duplicate(open_tag, level)},
tree,
{:markup, "\n" <> String.duplicate(close_tag, level - 1)}
], r2_tokens}
{:ok, tree, r2_tokens, level} ->
{:ok, [{:text, open}, tree], r2_tokens}
end
end
defp simple_recursive(
open_token,
close_token,
@ -504,14 +472,6 @@ defmodule Philomena.Textile.ParserMarkdown do
end
end
defp inline_textile_element_not_opening_markup(
_parser,
[{:bq_open, tok} | r_tokens],
level
) do
{:ok, [{:text, tok}], r_tokens}
end
defp inline_textile_element_not_opening_markup(parser, tokens, level) do
[
{:spoiler_open, :spoiler_close, "||", "||"},
@ -566,11 +526,11 @@ defmodule Philomena.Textile.ParserMarkdown do
inline_textile_element(parser, tokens, level)
end
defp block_textile_element(_parser, [{:double_newline, _} | r_tokens]) do
defp block_textile_element(_parser, [{:double_newline, _} | r_tokens], _level) do
{:ok, [{:markup, "\n\n"}], r_tokens}
end
defp block_textile_element(_parser, [{:newline, _} | r_tokens]) do
defp block_textile_element(_parser, [{:newline, _} | r_tokens], _level) do
{:ok, [{:markup, "\n"}], r_tokens}
end

View file

@ -12,7 +12,7 @@ defmodule Philomena.MixProject do
aliases: aliases(),
deps: deps(),
dialyzer: [plt_add_apps: [:mix]],
rustler_crates: [philomena_markdown: []]
rustler_crates: [philomena: []]
]
end

View file

@ -27,8 +27,8 @@ fn untrusted_host(url: Url, camo_host: String, camo_key: String) -> Option<Strin
pub fn image_url(uri: String) -> Option<String> {
let cdn_host = env::var("CDN_HOST").ok()?;
let camo_host = env::var("CAMO_HOST").ok()?;
let camo_key = env::var("CAMO_KEY").ok()?;
let camo_host = env::var("CAMO_HOST").unwrap_or_else(|_| String::from(""));
let camo_key = env::var("CAMO_KEY").unwrap_or_else(|_| String::from(""));
if camo_key.is_empty() {
return Some(uri);