feat: separate emoji file
This commit is contained in:
@@ -68,14 +68,16 @@ eval "find \"$src\" \( $IGNORE_ARGS \) -prune -o -type d -print" | sort | while
|
||||
if [ "$md_count" -eq 1 ]; then
|
||||
md_file=$(find "$dir" ! -name "$(basename "$dir")" -prune -name "*.md")
|
||||
is_home="false"; [ "$dir" = "$src" ] && is_home="true"
|
||||
target_url="/$rel_dir/index.html"
|
||||
[ "$rel_dir" = "." ] && target_url="/index.html"
|
||||
target_url=$(directory_index_url "$rel_dir")
|
||||
if needs_rebuild "$md_file" "$out_dir/index.html"; then
|
||||
parse_frontmatter "$md_file"
|
||||
if [ -n "$fm_content_warning" ]; then
|
||||
content_out_file="$out_dir/content.html"
|
||||
content_rel_url="/$rel_dir/content.html"
|
||||
[ "$rel_dir" = "." ] && content_rel_url="/content.html"
|
||||
if [ "$rel_dir" = "." ]; then
|
||||
content_rel_url="/content.html"
|
||||
else
|
||||
content_rel_url="/$(encode_url_path "$rel_dir")/content.html"
|
||||
fi
|
||||
write_content_warning_outputs "$md_file" "$content_out_file" "$content_rel_url" "$target_url" "$out_dir/index.html" "$is_home"
|
||||
else
|
||||
render_markdown "$md_file" "$is_home" "$target_url" > "$out_dir/index.html"
|
||||
@@ -112,7 +114,8 @@ eval "find \"$src\" \( $IGNORE_ARGS \) -prune -o -type d -print" | sort | while
|
||||
template.html|site.conf|style.css|styles.root.css|index.md) continue ;;
|
||||
esac
|
||||
if [ -d "$entry" ]; then
|
||||
echo "${name}|- [${name}/](${name}/index.html)" >> "$temp_entries"
|
||||
dir_url="$(encode_url_path "$name")/index.html"
|
||||
echo "${name}|- [${name}/](${dir_url})" >> "$temp_entries"
|
||||
elif [ "${entry%.md}" != "$entry" ]; then
|
||||
label="${name%.md}"
|
||||
set_post_metadata "$entry" ""
|
||||
@@ -147,9 +150,11 @@ eval "find \"$src\" \( $IGNORE_ARGS \) -prune -o -type d -print" | sort | while
|
||||
else
|
||||
sort_key="$name"
|
||||
fi
|
||||
echo "${sort_key}|- [$label](${name%.md}.html)|$name|${name%.md}.html" >> "$temp_entries"
|
||||
entry_url=$(encode_url_path "${name%.md}.html")
|
||||
echo "${sort_key}|- [$label](${entry_url})|$name|${entry_url}" >> "$temp_entries"
|
||||
else
|
||||
echo "${name}|- [$name]($name)|$name|$name" >> "$temp_entries"
|
||||
asset_url=$(encode_url_path "$name")
|
||||
echo "${name}|- [$name]($asset_url)|$name|$asset_url" >> "$temp_entries"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -186,8 +191,7 @@ eval "find \"$src\" \( $IGNORE_ARGS \) -prune -o -type d -print" | sort | while
|
||||
rm -f "$temp_entries"
|
||||
|
||||
is_home="false"; [ "$dir" = "$src" ] && is_home="true"
|
||||
target_url="/$rel_dir/index.html"
|
||||
[ "$rel_dir" = "." ] && target_url="/index.html"
|
||||
target_url=$(directory_index_url "$rel_dir")
|
||||
|
||||
num_items=$(wc -l < "$temp_list")
|
||||
if [ "$is_posts_dir" = "true" ] && [ -n "$posts_per_page" ] && [ "$posts_per_page" -gt 0 ] && [ "$num_items" -gt "$posts_per_page" ]; then
|
||||
@@ -289,8 +293,11 @@ eval "find \"$src\" \( $IGNORE_ARGS \) -prune -o -type d -print" | sort | while
|
||||
|
||||
if [ -n "$fm_content_warning" ]; then
|
||||
content_out_file="$out_dir/content.html"
|
||||
content_rel_url="/$rel_dir/content.html"
|
||||
[ "$rel_dir" = "." ] && content_rel_url="/content.html"
|
||||
if [ "$rel_dir" = "." ]; then
|
||||
content_rel_url="/content.html"
|
||||
else
|
||||
content_rel_url="/$(encode_url_path "$rel_dir")/content.html"
|
||||
fi
|
||||
write_content_warning_outputs "$temp_index" "$content_out_file" "$content_rel_url" "$target_url" "$out_dir/index.html" "$is_home"
|
||||
else
|
||||
render_markdown "$temp_index" "$is_home" "$target_url" > "$out_dir/index.html"
|
||||
@@ -360,8 +367,8 @@ eval "find \"$src\" \( $IGNORE_ARGS \) -prune -o -type f -print" | sort | while
|
||||
if needs_rebuild "$file" "$out_file"; then
|
||||
if [ -n "$fm_content_warning" ]; then
|
||||
content_out_file="$out/${rel_path%.md}-content.html"
|
||||
content_rel_url="/${rel_path%.md}-content.html"
|
||||
orig_rel_url="/${rel_path%.md}.html"
|
||||
content_rel_url="/$(encode_url_path "${rel_path%.md}")-content.html"
|
||||
orig_rel_url=$(markdown_file_url "$rel_path")
|
||||
write_content_warning_outputs "$file" "$content_out_file" "$content_rel_url" "$orig_rel_url" "$out_file" "$is_home"
|
||||
else
|
||||
render_markdown "$file" "$is_home" > "$out_file"
|
||||
@@ -446,7 +453,7 @@ if [ "$generate_feed" = "true" ] && [ -n "$base_url" ]; then
|
||||
|
||||
rel_path="${post_file#"$src"}"
|
||||
rel_path="${rel_path#/}"
|
||||
post_url="$base_url_feed/${rel_path%.md}.html"
|
||||
post_url="$base_url_feed$(markdown_file_url "$rel_path")"
|
||||
|
||||
if date -u -d "$post_date $post_time" '+%a, %d %b %Y %H:%M:%S +0000' >/dev/null 2>&1; then
|
||||
pub_date=$(date -u -d "$post_date $post_time" '+%a, %d %b %Y %H:%M:%S +0000')
|
||||
@@ -497,10 +504,10 @@ if [ "$generate_search" = "true" ] || [ "$generate_tags" = "true" ]; then
|
||||
if [ "$rel_path" = "index.md" ]; then
|
||||
md_url="/index.html"
|
||||
else
|
||||
md_url="/${rel_path%/index.md}/index.html"
|
||||
md_url=$(directory_index_url "${rel_path%/index.md}")
|
||||
fi
|
||||
else
|
||||
md_url="/${rel_path%.md}.html"
|
||||
md_url=$(markdown_file_url "$rel_path")
|
||||
if [ "$single_file_index" = "true" ]; then
|
||||
dir_of_file="$(dirname "$md_file")"
|
||||
rel_dir_of_file="${dir_of_file#"$src"}"
|
||||
@@ -518,7 +525,7 @@ if [ "$generate_search" = "true" ] || [ "$generate_tags" = "true" ]; then
|
||||
if [ "$rel_dir_of_file" = "." ]; then
|
||||
md_url="/index.html"
|
||||
else
|
||||
md_url="/$rel_dir_of_file/index.html"
|
||||
md_url=$(directory_index_url "$rel_dir_of_file")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -528,7 +535,7 @@ if [ "$generate_search" = "true" ] || [ "$generate_tags" = "true" ]; then
|
||||
parse_frontmatter "$md_file"
|
||||
[ "$fm_draft" = "true" ] && continue
|
||||
|
||||
markdown_title_from_file "$md_file" "$title - Page"
|
||||
markdown_title_from_loaded_file "$md_file" "$title - Page"
|
||||
md_heading="$markdown_title"
|
||||
|
||||
if [ "$generate_search" = "true" ]; then
|
||||
|
||||
@@ -49,6 +49,7 @@ DEFAULT_TMPL='<!doctype html>
|
||||
<input type="checkbox" id="nav-toggle" class="nav-toggle" aria-hidden="true" />
|
||||
<header>
|
||||
<h1>{{HEADER_BRAND}}</h1>
|
||||
{{HEADER_SEARCH}}
|
||||
<label for="nav-toggle" class="nav-toggle-label" aria-hidden="true">☰</label>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ render_markdown() {
|
||||
else
|
||||
rel_path="${file#"$src"}"
|
||||
rel_path="${rel_path#/}"
|
||||
current_url="/${rel_path%.md}.html"
|
||||
current_url=$(markdown_file_url "$rel_path")
|
||||
fi
|
||||
|
||||
content_file="$file"
|
||||
@@ -158,7 +158,7 @@ render_markdown() {
|
||||
"$src/styles.css") style_rel_to_src="styles.css" ;;
|
||||
"$src/style.css") style_rel_to_src="style.css" ;;
|
||||
esac
|
||||
style_path="/${style_rel_to_src%styles.css}"
|
||||
style_path="/$(encode_url_path "${style_rel_to_src%styles.css}")"
|
||||
style_path="${style_path%style.css}styles.css"
|
||||
else
|
||||
style_path="/styles.css"
|
||||
@@ -252,13 +252,14 @@ render_markdown() {
|
||||
|
||||
final_nav="$nav"
|
||||
final_header_brand="$header_brand"
|
||||
final_header_search=""
|
||||
if [ "$search_in_header" = "true" ]; then
|
||||
final_header_brand="$header_brand $SEARCH_FORM_HEADER"
|
||||
final_header_search="$SEARCH_FORM_HEADER"
|
||||
final_nav="$SEARCH_FORM_NAV
|
||||
$nav"
|
||||
fi
|
||||
|
||||
ENABLE_HEADER_LINKS="$enable_header_links" CUSTOM_ADMONITIONS="$custom_admonitions" MARKDOWN_SITE_ROOT="$src" MARKDOWN_FALLBACK_FILE="$script_dir/styles/$style.css" sh "$script_dir/markdown.sh" "$content_file" | AWK_LANG="$lang" AWK_CURRENT_URL="$current_url" AWK_TITLE="$page_title" AWK_NAV="$final_nav" AWK_FOOTER="$final_footer" AWK_STYLE_PATH="${style_path}" AWK_HEADER_BRAND="$final_header_brand" AWK_HEAD_EXTRA="$head_extra" AWK_VERSION="$asset_version" AWK_CONTENT_WARNING="$fm_content_warning" awk -f "$awk_dir/render_template.awk" "$local_template"
|
||||
ENABLE_HEADER_LINKS="$enable_header_links" CUSTOM_ADMONITIONS="$custom_admonitions" MARKDOWN_SITE_ROOT="$src" MARKDOWN_FALLBACK_FILE="$script_dir/styles/$style.css" sh "$script_dir/markdown.sh" "$content_file" | AWK_LANG="$lang" AWK_CURRENT_URL="$current_url" AWK_TITLE="$page_title" AWK_NAV="$final_nav" AWK_FOOTER="$final_footer" AWK_STYLE_PATH="${style_path}" AWK_HEADER_BRAND="$final_header_brand" AWK_HEADER_SEARCH="$final_header_search" AWK_HEAD_EXTRA="$head_extra" AWK_VERSION="$asset_version" AWK_CONTENT_WARNING="$fm_content_warning" awk -f "$awk_dir/render_template.awk" "$local_template"
|
||||
}
|
||||
generate_content_warning_page() {
|
||||
_fm_title="$1"
|
||||
|
||||
@@ -38,11 +38,9 @@ first_heading_from_markdown() {
|
||||
grep -m 1 '^# ' "$1" | sed 's/^# *//; s/ *$//'
|
||||
}
|
||||
|
||||
markdown_title_from_file() {
|
||||
markdown_title_from_loaded_file() {
|
||||
_title_file="$1"
|
||||
_title_default="$2"
|
||||
|
||||
parse_frontmatter "$_title_file"
|
||||
markdown_title="$fm_title"
|
||||
|
||||
if [ -z "$markdown_title" ]; then
|
||||
@@ -62,6 +60,13 @@ markdown_title_from_file() {
|
||||
fi
|
||||
}
|
||||
|
||||
markdown_title_from_file() {
|
||||
_title_file="$1"
|
||||
_title_default="$2"
|
||||
parse_frontmatter "$_title_file"
|
||||
markdown_title_from_loaded_file "$_title_file" "$_title_default"
|
||||
}
|
||||
|
||||
set_post_datetime() {
|
||||
_raw_date="$1"
|
||||
_fallback_name="$2"
|
||||
|
||||
@@ -2,6 +2,30 @@ trim_whitespace() {
|
||||
printf '%s' "$1" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//'
|
||||
}
|
||||
|
||||
encode_url_path() {
|
||||
printf '%s' "$1" | sed \
|
||||
-e 's/%/%25/g' \
|
||||
-e 's/ /%20/g' \
|
||||
-e 's/#/%23/g' \
|
||||
-e 's/?/%3F/g' \
|
||||
-e 's/"/%22/g' \
|
||||
-e "s/'/%27/g"
|
||||
}
|
||||
|
||||
markdown_file_url() {
|
||||
_rel_path="$1"
|
||||
printf '/%s.html\n' "$(encode_url_path "${_rel_path%.md}")"
|
||||
}
|
||||
|
||||
directory_index_url() {
|
||||
_rel_dir="$1"
|
||||
if [ -z "$_rel_dir" ] || [ "$_rel_dir" = "." ]; then
|
||||
printf '/index.html\n'
|
||||
else
|
||||
printf '/%s/index.html\n' "$(encode_url_path "$_rel_dir")"
|
||||
fi
|
||||
}
|
||||
|
||||
append_find_rule() {
|
||||
_expr="$1"
|
||||
_rule="$2"
|
||||
|
||||
Reference in New Issue
Block a user