Skip to content

Commit

Permalink
Handle asset folder when generating dev content
Browse files Browse the repository at this point in the history
  • Loading branch information
SudoWeezy committed Oct 2, 2024
1 parent ad05b07 commit ce9c9aa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ARCs/arc-0062.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ status: Last Call
last-call-deadline: 2024-10-15
type: Standards Track
category: Interface
sub-category: Explorer
sub-category: Asa
created: 2024-06-12
requires: 2, 4, 22
---
Expand Down
16 changes: 13 additions & 3 deletions _devportal/scripts/update-arcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,27 @@ for file in arc-*.md; do
fi

# 2. Replace links like [ARC-1](./arc-0001.md) with [ARC-1](/standards/arcs/arc-0001)
sed -i $SED_INLINE -E 's|\(\./arc-([0-9]+)\.md\)|(/standards/arcs/arc-000\1)|g' "$file"
sed -i $SED_INLINE -E 's|\(\./arc-([0-9]{4})\.md\)|(/standards/arcs/arc-\1)|g' "$file"
if [[ $? -ne 0 ]]; then
echo "Failed to update links in $file"
continue
fi

# 3. Handle anchors like [ARC-1](./arc-0001.md#interface-signtxnsopts) -> [ARC-1](/standards/arcs/arc-0001#interface-signtxnsopts)
sed -i $SED_INLINE -E 's|\(\./arc-([0-9]+)\.md(\#[a-zA-Z0-9-]+)?\)|(/standards/arcs/arc-000\1\2)|g' "$file"
# 3. Replace links like [here](../assets/arc-0062) with [here](https://github.com/algorandfoundation/ARCs/tree/main/assets/arc-0062)
sed -i $SED_INLINE -E 's|\(\.\./assets/arc-([0-9]{4})\)|\(https://github.com/algorandfoundation/ARCs/tree/main/assets/arc-\1\)|g' "$file"
if [[ $? -ne 0 ]]; then
echo "Failed to update asset links in $file"
continue
fi

# 3a. Handle anchors like [ARC-1](./arc-0001.md#interface-signtxnsopts) -> [ARC-1](/standards/arcs/arc-0001#interface-signtxnsopts)
sed -i $SED_INLINE -E 's|\(\./arc-([0-9]{4})\.md(\#[a-zA-Z0-9_-]+)?\)|(/standards/arcs/arc-\1\2)|g' "$file"
if [[ $? -ne 0 ]]; then
echo "Failed to update anchored links in $file"
continue
fi


# 4. Ensure exactly one blank line between the end of the front matter and the Abstract section
sed -i $SED_INLINE -E '/^---$/,/^## Abstract$/ { /^\s*$/d; }' "$file"
if [[ $? -ne 0 ]]; then
Expand Down Expand Up @@ -116,6 +124,8 @@ sidebar:\\
echo "Failed to replace '../assets' in $file"
continue
fi


else
echo "No markdown files found matching pattern 'arc-*.md'"
fi
Expand Down

0 comments on commit ce9c9aa

Please sign in to comment.