Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

We need tool to convert de google sheet to YAML #88

Open
jluis opened this issue Oct 3, 2019 · 0 comments
Open

We need tool to convert de google sheet to YAML #88

jluis opened this issue Oct 3, 2019 · 0 comments

Comments

@jluis
Copy link
Contributor

jluis commented Oct 3, 2019

To minimize the copy paste problems passing the talks data from the google doc I propose a script that parses a downloaded tsv and generates all the data from the google spreadsheet (we need to add one column for the icon and other for accepted talks:

#!/usr/bin/env perl

use strict;
use warnings;
use feature qw(say);

sub quote {
	local $_ = shift;
	s/"/\"/g;
	return '"'.$_.'"'
}

sub slug {
	local $_ = lc(shift);
	s/[^a-z ]//g;
	s/ +$//;
	s/ /-/gr;
}

while (<>) {
       my @values = split /\t/;
       next unless $values[0] =~  m|[123]?\d/[1]?\d/\d{4} [12]?\d(?:\:\d{2}){2}|;
       say " - author: ".quote $values[2];
       say "   name: ".quote $values[3];
       say "   slug: ".quote slug $values[3];
       say "   description: ".quote $values[4];
       say "   icon: ".($values[8]? quote($values[8]):"'fa-WTF'");
       say "   duration: ". $values[5];
       say "   accepted: ". (defined($values[7]) ? 'false':'true');
       say "   language: ".(defined($values[6]) ? quote($values[6]):"'unknown'");
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant