Skip to content

Commit

Permalink
:fingers-crossed:
Browse files Browse the repository at this point in the history
Signed-off-by: hanbollar <[email protected]>
  • Loading branch information
hanbollar committed May 21, 2024
1 parent a8b91b5 commit dcab1ce
Show file tree
Hide file tree
Showing 137 changed files with 548 additions and 15 deletions.
60 changes: 45 additions & 15 deletions all-versions-smoo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,72 @@ versions_dir="./v-saved/all-saved"

latest_v="v0.6.4"

# copy what is in the main source to /main/
rm -rf "$versions_dir/main"
cp -r "./source" "$versions_dir/main"
echo "hi0"

# delete /main/ in v-saved setup for now.
main_version_dir="$versions_dir/main"
rm -rf $main_version_dir

echo "hi1"

# setup to run all of `smoo.sh`es for each sub-directory:
# -- for each folder in v, run smoo.sh and pass in the proper
# versioning info 'vX.Y.Z' s.t. they go to the right public
# folder

# Navigate to the version directory
cd "$versions_dir"
# cd "$versions_dir"

# Loop through each version subdirectory and execute smoo.sh
for dir in */ ; do
if [[ -d "$dir" ]]; then
# Retrieve list of directories and store in an array
directories=($(find "$versions_dir" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;))

# Echo directories to check what's captured
echo "Directories in $versions_dir:"
printf "%s\n" "${directories[@]}"

# Example of processing each directory
for dir in "${directories[@]}"; do
echo "hi2.0"
echo $dir
if [ -d "$dir" ]; then
echo "hi2"
version=${dir%/} # Strip trailing slash to get the version name

echo "Processing version $version..."

# Change to the version directory
cd "$version"
# cd "$version"

echo "pwd:" $(pwd)
echo "smoo.sh is:" "$versions_dir/$version/smoo.sh"

# Check if smoo.sh exists and is executable
# if [[ -x "../../smoo.sh" ]]; then
# # Execute smoo.sh with the version as a parameter
# ../../smoo.sh "$version"
# else
# echo "Error: smoo.sh is not executable or found"
# fi
if [[ -x "$versions_dir/$version/smoo.sh" ]]; then
# Execute smoo.sh with the version as a parameter
$versions_dir/$version/smoo.sh "$version"
else
echo "Error: smoo.sh is not executable or found"
fi

# Go back to the version directory
cd ..
# cd ..
fi
done

# Return to the original directory
cd ..
# cd ..

# run /main/ in v-saved setup now.
rm -rf $main_version_dir
mkdir $main_version_dir
echo "removed and recreated: $main_version_dir"
# copy everything except the folders .github, public, and v-saved
# to the /main/ section in v-saved/all
rsync -av --exclude='err.txt' --exclude='output.txt' --exclude='.github/' --exclude='.git' --exclude='public/' --exclude='v-saved/' ./ $main_version_dir
echo "copied current main documentation to: $main_version_dir"

# cd "$main_version_dir"
echo "pwd:" $(pwd)
./$main_version_dir/smoo.sh "main"
# cd -
4 changes: 4 additions & 0 deletions smoo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ sourceDir="$saved_version_dir/source"
templateHTML="$sourceDir/_template.html"
outputDir="public/v/$version"

if [ "$version" != "main" ]; then
outputDir="../../$outputDir"
fi

assetDir="$sourceDir/static"
pagesDir="$sourceDir/pages"
ecsDir="$sourceDir/ecs"
Expand Down
7 changes: 7 additions & 0 deletions v-saved/all-saved/main/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ignore the public folder at the root directory
/public/
# ignore for macs
.DS_Store
# for debugging locally
/output.txt/
/err.txt/
41 changes: 41 additions & 0 deletions v-saved/all-saved/main/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# from - https://github.com/DavidAnson/markdownlint
# schema - https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml

# uses default styling of the cli
defaults: True
extends: null

# MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md013.md
MD013: False
# Number of characters
# line_length: 180
# Number of characters for headings
# heading_line_length: 180
# Number of characters for code blocks
# code_block_line_length: 180
# Include code blocks
# code_blocks: true
# Include tables
# tables: true
# Include headings
# headings: true
# Strict length checking
# strict: false
# Stern length checking
# stern: false

# MD025/single-title/single-h1 : Multiple top-level headings in the same document : https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md025.md
MD025: False

# MD036/no-emphasis-as-heading : Emphasis used instead of a heading : https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md036.md
MD036: False

# MD033/no-inline-html: Raw HTML is allowed in Markdown, but this rule is included for those who want their documents to only include "pure" Markdown : https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md033.md
MD033: False

# MD022/blanks-around-headings/blanks-around-headers
MD022: False


# MD037/no-space-in-emphasis
MD037: False
36 changes: 36 additions & 0 deletions v-saved/all-saved/main/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Documentation

Public documentation page

You will need `pandoc` installed. Check the version found in the `render-build.sh` file.

To build locally, just run `smoo.sh`.

```sh
./smoo.sh
```

The website will be built in the `/public` folder.
Just serve this folder, or publish it to a CDN.

---
## To add a document

1. Add a markdown file in the `source/docs/` folder
2. Add the proper YAML data. Here's a boilerplate markdown:

```
---
title: "mr-a"
description: "The <mr-a> tag embeds a hyperlink in the interface of an <mr-panel>."
istag: true
---
# &lt;mr-a&gt;
The `<mr-a>`embeds a hyperlink in the UI of an `<mr-panel>`.
```

---
## Official Publishing

Create a pr and once it gets merged into `main`, it will auto publish to the url in the github repo description.
59 changes: 59 additions & 0 deletions v-saved/all-saved/main/action-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

## USED BY RENDER.COM AND ACTIONS IN THE MRJS REPO

# Stop on the first sign of trouble
set -e

# Set up directories
PANDOC_DIR="$HOME/local/pandoc"
mkdir -p "$PANDOC_DIR"
BIN_DIR="$HOME/local/bin"
mkdir -p "$BIN_DIR"
export PATH="$BIN_DIR:$PATH"

# Get the latest Pandoc version
PANDOC_REPO="jgm/pandoc"
PANDOC_API_URL="https://api.github.com/repos/${PANDOC_REPO}/releases/latest"

echo "Fetching latest Pandoc release from GitHub"
LATEST_RELEASE=$(curl -s $PANDOC_API_URL | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
PANDOC_VERSION=${LATEST_RELEASE}

# Exit if we failed to get the latest version
if [ -z "$PANDOC_VERSION" ]; then
echo "Failed to fetch the latest Pandoc version"
exit 1
fi

# Download Pandoc tarball
PANDOC_TARBALL="pandoc-${PANDOC_VERSION#v}-linux-amd64.tar.gz"
PANDOC_URL="https://github.com/${PANDOC_REPO}/releases/download/${PANDOC_VERSION}/${PANDOC_TARBALL}"

echo "Downloading Pandoc from $PANDOC_URL"
wget -O "${PANDOC_DIR}/${PANDOC_TARBALL}" "$PANDOC_URL"

# Verify the tarball is not empty or corrupted
if [ ! -s "${PANDOC_DIR}/${PANDOC_TARBALL}" ]; then
echo "Download failed or file is empty"
exit 1
fi

# List contents of the tarball
echo "Inspecting contents of the tarball"
tar -tzf "${PANDOC_DIR}/${PANDOC_TARBALL}"

# Extract Pandoc
echo "Extracting Pandoc to $BIN_DIR"
tar -xzf "${PANDOC_DIR}/${PANDOC_TARBALL}" -C "$BIN_DIR" --strip-components 2

# Make sure Pandoc is executable
chmod +x "${BIN_DIR}/pandoc"

# Verify Pandoc installation
pandoc --version

# Run your pre-build script
echo "Running pre-build script"
chmod +x ./smoo.sh
./smoo.sh
76 changes: 76 additions & 0 deletions v-saved/all-saved/main/all-versions-smoo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash

# Set the base directory for versions
versions_dir="./v-saved/all-saved"

latest_v="v0.6.4"

echo "hi0"

# delete /main/ in v-saved setup for now.
main_version_dir="$versions_dir/main"
rm -rf $main_version_dir

echo "hi1"

# setup to run all of `smoo.sh`es for each sub-directory:
# -- for each folder in v, run smoo.sh and pass in the proper
# versioning info 'vX.Y.Z' s.t. they go to the right public
# folder

# Navigate to the version directory
# cd "$versions_dir"

# Loop through each version subdirectory and execute smoo.sh
# Retrieve list of directories and store in an array
directories=($(find "$versions_dir" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;))

# Echo directories to check what's captured
echo "Directories in $versions_dir:"
printf "%s\n" "${directories[@]}"

# Example of processing each directory
for dir in "${directories[@]}"; do
echo "hi2.0"
echo $dir
if [ -d "$dir" ]; then
echo "hi2"
version=${dir%/} # Strip trailing slash to get the version name

echo "Processing version $version..."

# Change to the version directory
# cd "$version"

echo "pwd:" $(pwd)
echo "smoo.sh is:" "$versions_dir/$version/smoo.sh"

# Check if smoo.sh exists and is executable
if [[ -x "$versions_dir/$version/smoo.sh" ]]; then
# Execute smoo.sh with the version as a parameter
$versions_dir/$version/smoo.sh "$version"
else
echo "Error: smoo.sh is not executable or found"
fi

# Go back to the version directory
# cd ..
fi
done

# Return to the original directory
# cd ..

# run /main/ in v-saved setup now.
rm -rf $main_version_dir
mkdir $main_version_dir
echo "removed and recreated: $main_version_dir"
# copy everything except the folders .github, public, and v-saved
# to the /main/ section in v-saved/all
rsync -av --exclude='err.txt' --exclude='output.txt' --exclude='.github/' --exclude='.git' --exclude='public/' --exclude='v-saved/' ./ $main_version_dir
echo "copied current main documentation to: $main_version_dir"

# cd "$main_version_dir"
echo "pwd:" $(pwd)
./$main_version_dir/smoo.sh "main"
# cd -
14 changes: 14 additions & 0 deletions v-saved/all-saved/main/anchorlinks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- Adds anchor links to headings with IDs.
function Header (h)
if h.identifier ~= '' then
-- an empty link to this header
local anchor_link = pandoc.Link(
{}, -- content
'#' .. h.identifier, -- href
'', -- title
{class = 'anchor', ['aria-hidden'] = 'true'} -- attributes
)
h.content:insert(1, anchor_link)
return h
end
end
16 changes: 16 additions & 0 deletions v-saved/all-saved/main/colgroups.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Unset the width attribute of HTML colspecs in tables
-- See https://github.com/jgm/pandoc/issues/8139
function Table (tbl)
if PANDOC_VERSION[1] > 2 or (PANDOC_VERSION[1] == 2 and PANDOC_VERSION[2] >= 10) then
tbl.colspecs = tbl.colspecs:map(function (colspec)
local align = colspec[1]
local width = nil -- default width
return {align, width}
end)
else
for i, w in ipairs(tbl.widths) do
tbl.widths[i] = 0
end
end
return tbl
end
Loading

0 comments on commit dcab1ce

Please sign in to comment.