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

Parse multiple cards in one file #10

Open
gaetgu opened this issue Jul 19, 2020 · 5 comments
Open

Parse multiple cards in one file #10

gaetgu opened this issue Jul 19, 2020 · 5 comments
Assignees

Comments

@gaetgu
Copy link

gaetgu commented Jul 19, 2020

Hello, thanks for creating this gem!

I was playing around with it and I noticed that if I used multiple VCards in one file, it would throw an error.
I have several (more than a hundred) VCards and I really don't want to create an individual file for each VCard, so is there any way to just parse them all in one file? Thanks a lot!

Error output:

/usr/local/lib/ruby/gems/2.7.0/gems/ruby-vobject-1.0.1/lib/vobject/vcard/v3_0/grammar.rb:156:in `parse':  (Rsec::SyntaxError)
in source:9 at 1
BEGIN:VCARD
 ^
	from /usr/local/lib/ruby/gems/2.7.0/gems/ruby-vobject-1.0.1/lib/vobject/vcard/v3_0/component.rb:10:in `parse'
	from /usr/local/lib/ruby/gems/2.7.0/gems/ruby-vobject-1.0.1/lib/vcard.rb:18:in `parse'
	from /Users/gabriel/Downloads/ruby-vobject-master/main.rb:9:in `<main>'
@ronaldtse
Copy link
Contributor

Thanks @gaetgu for the feedback!

@skalee @abunashir do you have a bit of time for this? Thanks!

@skalee skalee self-assigned this Jul 22, 2020
@skalee
Copy link
Contributor

skalee commented Jul 22, 2020

@ronaldtse Note that if have to change types of some return values (object -> array of objects), this will be a breaking change.

@ronaldtse
Copy link
Contributor

New method that allows parsing 1 (card) vs 1 (collection of cards)?

@skalee
Copy link
Contributor

skalee commented Jul 22, 2020

Hmm, yes, that will do the trick.

Also I wonder if:

  • vCards 3.0 can be mixed with vCards 4.0 in one file
  • vCards and iCalendars can be mixed in one file

I suppose the answer "yes if it is reasonably doable", but I don't know if these are real-life cases. Especially mixing VCard and iCalendar files — although I can imagine that from technical point of view, this is not defined in the standards, and these formats are expected to use different MIME types.

@ronaldtse
Copy link
Contributor

ronaldtse commented Jul 22, 2020

Technically they are acceptable (and there is no ambiguity), because the vCard/iCalendar specifications do not actually specify what it means to be a collection.

don't know if these are real-life cases

Mixed vCard versions; mixed vCard + iCalendar objects => both not practical cases.

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

No branches or pull requests

3 participants