Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: qoobaa/vcard
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: moneybird/vcard
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 7 commits
  • 5 files changed
  • 2 contributors

Commits on Sep 25, 2012

  1. Add gemspec

    Ivo van Hurne committed Sep 25, 2012
    Copy the full SHA
    4451fd4 View commit details

Commits on Sep 14, 2016

  1. Merge https://github.com/qoobaa/vcard

    # Conflicts:
    #	.gitignore
    #	vcard.gemspec
    Oliver Jundt committed Sep 14, 2016
    Copy the full SHA
    c94c8df View commit details
  2. fix warnings

    Oliver Jundt committed Sep 14, 2016
    Copy the full SHA
    d4425da View commit details

Commits on Sep 15, 2016

  1. More robust field name pattern

    Oliver Jundt committed Sep 15, 2016
    Copy the full SHA
    660d740 View commit details
  2. Handle whitespace padding at beginning of file

    Oliver Jundt committed Sep 15, 2016
    Copy the full SHA
    c673b34 View commit details

Commits on Jan 7, 2020

  1. Merge branch 'master' of github.com:qoobaa/vcard

    # Conflicts:
    #	lib/vcard.rb
    #	test/vcard_test.rb
    Oliver Jundt committed Jan 7, 2020

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    425b9e5 View commit details
  2. Add back removed tests

    Oliver Jundt committed Jan 7, 2020

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    5ef26db View commit details
Showing with 33 additions and 2 deletions.
  1. +1 −1 lib/vcard.rb
  2. +2 −1 lib/vcard/bnf.rb
  3. +6 −0 test/fixtures/non_standard_name.vcard
  4. +3 −0 test/fixtures/whitespace_padding.vcard
  5. +21 −0 test/vcard_test.rb
2 changes: 1 addition & 1 deletion lib/vcard.rb
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ def self.unfold(card) #:nodoc:
unfolded = []

prior_line = nil
card.each_line do |line|
card.lstrip.each_line do |line|
line.chomp!
# If it's a continuation line, add it to the last.
# If it's an empty line, drop it from the input.
3 changes: 2 additions & 1 deletion lib/vcard/bnf.rb
Original file line number Diff line number Diff line change
@@ -12,7 +12,8 @@ module Bnf #:nodoc:
# Note: "_" allowed because produced by Notes (X-LOTUS-CHILD_UID:)
# Note: "/" allowed because produced by KAddressBook (X-messaging/xmpp-All:)
# Note: " " allowed because produced by highrisehq.com (X-GOOGLE TALK:)
NAME = /[\w\/-][ \w\/-]*/
NAME_WORD = /[\w-](?:[^\s.=;:,]*[\w-])?/
NAME = /#{NAME_WORD}(?: #{NAME_WORD})*/

# <"> <Any character except CTLs, DQUOTE> <">
QSTR = /"([^"]*)"/
6 changes: 6 additions & 0 deletions test/fixtures/non_standard_name.vcard
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BEGIN:VCARD
f#oo/ba;r+test:something
X-messaging/xmpp-All:some@jabber.id
X-LOTUS-CHILD_UID:1234
X-GOOGLE TALK:2345
END:VCARD
3 changes: 3 additions & 0 deletions test/fixtures/whitespace_padding.vcard
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
begin:VCARD
N:TestUser;Stepcase;;;
end:VCARD
21 changes: 21 additions & 0 deletions test/vcard_test.rb
Original file line number Diff line number Diff line change
@@ -522,4 +522,25 @@ def test_note
card = Vcard::Vcard.decode(card.encode).first
assert_equal "line1\n;line2", card.note
end

def test_non_standard_name
card = nil
assert_nothing_thrown { card = Vcard::DirectoryInfo.decode(vcard(:non_standard_name)) }
assert_equal_nospace(vcard(:non_standard_name), card.to_s)

assert_equal("some@jabber.id", card["X-messaging/xmpp-All"])
assert_equal("2345", card["X-GOOGLE TALK"])
assert_equal("something", card["F#OO/BA"])
assert_equal("1234", card["X-LOTUS-CHILD_UID"])
assert_equal([], card.groups)
end

def test_whitespace_padding
card = nil
assert_nothing_thrown { card = Vcard::DirectoryInfo.decode(vcard(:whitespace_padding)) }
assert_equal_nospace(vcard(:whitespace_padding), card.to_s)

assert_equal("TestUser;Stepcase;;;", card["N"])
assert_equal([], card.groups)
end
end