Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV version of table #239

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

CSV version of table #239

wants to merge 1 commit into from

Conversation

jmbeach
Copy link

@jmbeach jmbeach commented Jan 30, 2021

Understand if this isn't wanted (it's another thing to keep up with), but there's a lot of design systems in the list so a csv can make it easier to search and filter.

@alexpate
Copy link
Owner

Thanks for putting this together!

I wonder if there's a way we could automatically generate this 🤔

@jmbeach
Copy link
Author

jmbeach commented Feb 20, 2021

I did write something, but it's in powershell 😅 I don't think a whole lot of people use powershell, but it could easily be adapted to other languages

$titleUrlRegex = [System.Text.RegularExpressions.Regex]::new('\[([^\]]+)\]\(([^)]+)\)');
$tableHeaderIndex = -1;
$lines = Get-Content ./README.md

# Find table start
for ($i = 0; $i -lt $lines.Length; $i++) {
    $line = $lines[$i];
    $tableHeaderIndex++;
    if ($line -like '*-----------------------------*') {
        break;
    }
}

$result = [System.Collections.Generic.List[object]]::new();

# Loop through lines until end of table
for ($i = $tableHeaderIndex + 1; $i -lt $lines.Length; $i++) {
    $line = $lines[$i];

    # Exit when at the end of table
    if ([string]::IsNullOrWhiteSpace($line)) {
        break;
    }

    # index 0 is always empty because each line is prefixed with "|"
    $parts = $line.Split('|');
    $titleUrlMatches = $titleUrlRegex.Matches($parts[1].Trim());
    $result.Add([pscustomobject]@{
            name = $titleUrlMatches.Groups[1].Value;
            url  = $titleUrlMatches.Groups[2].Value;
            hasComponents = ![string]::IsNullOrEmpty($parts[2].Trim());
            hasVoiceAndTone = ![string]::IsNullOrEmpty($parts[3].Trim());
            hasDesignersKit = ![string]::IsNullOrEmpty($parts[4].Trim());
            hasSourceCode = ![string]::IsNullOrEmpty($parts[5].Trim());
        });
}
            
$result | ConvertTo-Csv | Out-File awesome-design-systems.csv;

@LLotme
Copy link

LLotme commented Jun 1, 2024

gh pr checkout 239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants