NAME Org::To::VCF - Export contacts in Org document to VCF (vCard addressbook) VERSION version 0.02 SYNOPSIS use Org::To::VCF qw(org_to_vcf); my $res = org_to_vcf( source_file => 'addressbook.org', # or source_str #target_file => 'addressbook.vcf', # defaults return the VCF in $res->[2] #include_tags => [...], # default exports all tags #exclude_tags => [...], # behavior mimics emacs's include/exclude rule ); die "Failed" unless $res->[0] == 200; DESCRIPTION Export contacts in Org document to VCF (vCard addressbook). My use case: I maintain my addressbook in an Org document "addressbook.org" which I regularly export to VCF and then import to Android phones. How contacts are found in an Org document: each contact is written in an Org headline (of whatever level) in a rather free-form format, e.g.: ** dad # [2014-01-25 Sat] :remind_anniv: - fullname :: frasier crane - birthday :: [1900-01-02 ] - cell :: 0811 000 0001 - some note *** TODO get dad's jakarta office number Todo items (headline with todo labels) are currently excluded. Contact fields are searched in list items. Currently Indonesian and English phrases are supported. If name field is not found, the title of the headline is used. I use timestamps a lot, so currently timestamps are stripped from headline titles. Perl-style comments (with "#" to the end of the line) are allowed. Org-contacts format is also supported, where fields are stored in a properties drawer: * Friends ** Dave Null :PROPERTIES: :EMAIL: dave@null.com :END: This is one of my friend. *** TODO Call him for the party FUNCTIONS org_to_vcf(%args) -> [status, msg, result, meta] Export contacts in Org document to VCF (vCard addressbook). Arguments ('*' denotes required arguments): * default_country => *str* Specify default country code. Free-form phone numbers on phone fields are formatted by this function, e.g. "081 123 4567" becomes 0811234567. If default country is specified (e.g. "ID"), the number will be formatted as +62811234567. Setting this option is recommended so the phone numbers are nicely formatted as international number. * exclude_tags => *array* Exclude trees that carry one of these tags. If the whole document doesn't have any of these tags, then the whole document will be exported. Otherwise, trees that do not carry one of these tags will be excluded. If a selected tree is a subtree, the heading hierarchy above it will also be selected for export, but not the text below those headings. exclude*tags is evaluated after include*tags. * export_notes => *bool* (default: 1) Whether to export note fields. * include_tags => *array* Include trees that carry one of these tags. Works like Org's 'org-export-select-tags' variable. If the whole document doesn't have any of these tags, then the whole document will be exported. Otherwise, trees that do not carry one of these tags will be excluded. If a selected tree is a subtree, the heading hierarchy above it will also be selected for export, but not the text below those headings. * source_file => *str* Source Org file to export. * source_str => *str* Alternatively you can specify Org string directly. * target_file => *str* VCF file to write to. If not specified, VCF output string will be returned instead. Return value: Returns an enveloped result (an array). First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information. TODO This is an early release. An important node, addresses (ADR), not parsed yet because my use case is currently for phone's phonebook. Other unimplemented nodes are listed in the source code. SEE ALSO For more information about Org document format, visit http://orgmode.org/ Org::Parser Text::vCard Org-contacts: http://julien.danjou.info/projects/emacs-packages#org-contacts HOMEPAGE Please visit the project's homepage at . SOURCE Source repository is at . BUGS Please report any bugs or feature requests on the bugtracker website When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. AUTHOR Steven Haryanto COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Steven Haryanto. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.