Is there a way to change the delimiter in Kirby text files?

I’m wondering if I can change the delimiter in Kirby content(.txt) files from the [“hard return”, “----”, “hard return”] to a simple ["," “space”]…so, instead of the 4 dashes instead use a simple comma?

I’m trying to decide on a CMS and I’d really appreciate one that could update from csv files. I’ve got a spreadsheet that is basically running the show for 2 other websites and I’d like to be able to “kill 3 birds with 1 stone” per se.

Essentially take the existing spreadsheets, create hooks in a CMS for the columns and let the spreadsheet do a lot of the heavy lifting from a content perspective.

Is this possible? And…if so, can someone point me in the right direction?

Thanks,
Matt

I don´t think so, because the separator is hardcoded in kirby. The only solution (without doing some search and replace in your files) is to hack the core in this file:
https://github.com/getkirby/kirby/blob/master/core/content.php at line 37.

But I don´t really understand what you want to do.

Basically I have pre-developed spreadsheets with tables and tables of product info. Instead of hand keying them in the kirby GUI, it’d be much easier if I could somehow “hook” those spreadsheets in via a csv file in order to populate kirby webpages so…instead of a traditional kirby .txt page file looking like this…

Title: Project A

----

Year: 2014

----

Tags: outdoor

----

 Text: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor.
Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.
Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a,
venenatis vitae, justo.

i’d like them to delimit like this so I can use a csv file for uploads…

Title: Project A, Year: 2014, Tags: outdoor, Text: Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, 
nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat 
massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, 
imperdiet a, venenatis vitae, justo.

Is this something that is possible? Sorry for not being more concise the first time around.

The problem I see here is that a simple comma is not a unique delimiter if that character is also present in field content. So you would need to use some regex to find a comma before a field key. Plus, as @jbeyerstedt has already pointed out, there is no native way of changing the delimiter.

Basically I have gobs of product data in csv files and a cms with the ability to upload directly from them would be a huge time saver for me so instead of a Kirby .txt file looking like this…

Title: Project A

----

Year: 2014

----

Tags: outdoor

----

Text: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.         
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies 
nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet 
nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.

I’d like them to look like this…

Title: Project A, Year: 2014, Tags: outdoor, Text: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean 
commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, 
nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat 
massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, 
imperdiet a, venenatis vitae, justo.

Sorry for not explaining myself more concisely earlier. I really just need to change the delimiter to make it easier to upload data.

Ahh…I didn’t think of that. Well I can actually export csv’s with some other delimiter like a “|, pipe” for example.

That was one of the things I didn´t understand. How could just comma space be unique in the context of normal language text.

So, to make this work I’d really just need to modify the core file line 37 to look like this:

$fields = preg_split('!\n%20|%20 \s*\n*!', $this->raw);

and, modify the .txt file to be seperated with a pipe like this…

Title: Project A | Year: 2014 | Tags: outdoor | Text: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, 
nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat 
massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, 
imperdiet a, venenatis vitae, justo.

Would that work?

I’d say you better write a script to convert your csv to kirby format.
because, I don’t know how is your cvs, but you may not have the column (field) name and it may also have all pages on the same file.

A typical cvs looks like

title, year, tags, text
projectA, 2014, outdoor, loremipsum....
projectB, 2015, outdoor, loremipsum ...

So even changing the delimiter won’t give you a page for each product. Again, I don’t know how your cvs looks like, but it seems odd to me.

You can also just put the CSV files next to the Kirby content files in the same content directories and parse your CSV in a robust way from your template/controller to get the information you need.