Skip to content

Commit 8e5cd75

Browse files
authored
Update build.sh
1 parent e4e0b0d commit 8e5cd75

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

build.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ EOF
158158
printf '%s%s%s' "$header_dist_min" "$middle_content" "$minified_body" > "$DIST_DIR/$id.min.user.js"
159159

160160

161-
printf ' 3. Generating doc file\n'
161+
printf ' 3. Generating doc files\n'
162162
version_slug=$(sed 's|_|__|g; s|-|--|g' <<< "$script_version")
163163
loc_count=$(npx cloc --quiet --sum-one --stdin-name="$id.user.js" - <<< "$body" | grep -m 1 'SUM:' | awk '{print $5}')
164164
[[ "$id" != 'zzzzzzzz' ]] && ((loc_count_total += loc_count))
@@ -174,15 +174,15 @@ EOF
174174
printf '%s' "${screenshots:+$'## Screenshots\n<p align="center">\n'"$(sed -E 's|(.*)| <img src="screenshots/\1" alt="screenshot" align="middle">|' <<< "$screenshots")"$'\n</p>'}"
175175
) > "$DOCS_DIR/$id.md"
176176

177-
( [[ -n "$readme_comment$screenshots" ]] && printf '%s' "# [README]($BASE_URL/blob/main/$DOCS_DIR/$id.md)"$'\n\n'
177+
script_name_fragment="$(tr 'A-Z' 'a-z' <<< "$script_name" | sed -E 's|[^a-z0-9 -]||g; s| |-|g')"
178+
script_name_markdown="$(sed 's#|#\\|#g' <<< "$script_name")"
179+
180+
( [[ -n "$readme_comment$screenshots" ]] && printf '%s\n\n' "# [README]($BASE_URL/blob/main/$DOCS_DIR/$id.md#$script_name_fragment)"
178181
printf '%s\n' "Click [HERE]($BASE_URL#readme) for general info, requirements and a full list of all my Trakt.tv userscripts."
179182
) > "$DOCS_DIR/$id-gf.md"
180183

181-
182-
printf ' 4. Adding row to README.md table\n'
183-
escaped_script_name="$(sed 's#|#\\|#g' <<< "$script_name")"
184-
install_links="[Standard]($DOWNLOAD_URL_DIST) // [Minified]($DOWNLOAD_URL_DIST_MIN)"
185-
printf '| [%s](%s) | `%s` | `%s` | %s |\n' "$escaped_script_name" "$DOCS_DIR/$id.md" "$script_version" "$loc_count" "$install_links" >> "$TABLE_CONTENT_FILE"
184+
printf '| [%s](%s) | `%s` | `%s` | [Standard](%s) // [Minified](%s) |\n' \
185+
"$script_name_markdown" "$DOCS_DIR/$id.md#$script_name_fragment" "$script_version" "$loc_count" "$DOWNLOAD_URL_DIST" "$DOWNLOAD_URL_DIST_MIN" >> "$TABLE_CONTENT_FILE"
186186
done
187187

188188

0 commit comments

Comments
 (0)