summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default.nix30
-rw-r--r--doc/NEWS14
-rw-r--r--doc/ledger.14
-rw-r--r--doc/ledger3.texi13
-rw-r--r--src/report.cc19
-rw-r--r--src/report.h1
6 files changed, 66 insertions, 15 deletions
diff --git a/default.nix b/default.nix
index 2878e7c2..f0bfdd2f 100644
--- a/default.nix
+++ b/default.nix
@@ -1,23 +1,35 @@
-{ stdenv, fetchgit, cmake, ninja, boost, gmp, mpfr, libedit, python
-, texinfo, doxygen, gnused, lcov }:
+{ stdenv, fetchgit, cmake, boost, gmp, mpfr, libedit, python
+, texinfo, gnused }:
let
- rev = "20160111";
+ version = "3.1.1";
+ rev = "20160906";
in
stdenv.mkDerivation {
- name = "ledger-3.1.1.${rev}";
- src = builtins.filterSource (path: type: type != "unknown") ./.;
+ name = "ledger-${version}-${rev}";
- buildInputs = [ cmake ninja doxygen lcov boost gmp mpfr libedit
- python texinfo gnused ];
+ # NOTE: fetchgit because ledger has submodules not included in the
+ # default github tarball.
+ src = ./.;
+
+ buildInputs = [ cmake boost gmp mpfr libedit python texinfo gnused ];
enableParallelBuilding = true;
+ # Skip byte-compiling of emacs-lisp files because this is currently
+ # broken in ledger...
+ postInstall = ''
+ mkdir -p $out/share/emacs/site-lisp/
+ cp -v "$src/lisp/"*.el $out/share/emacs/site-lisp/
+ '';
+
+ cmakeFlags = [ "-DCMAKE_INSTALL_LIBDIR=lib" ];
+
meta = {
homepage = "http://ledger-cli.org/";
description = "A double-entry accounting system with a command-line reporting interface";
- license = "BSD";
+ license = stdenv.lib.licenses.bsd3;
longDescription = ''
Ledger is a powerful, double-entry accounting system that is accessed
@@ -27,6 +39,6 @@ stdenv.mkDerivation {
'';
platforms = stdenv.lib.platforms.all;
- maintainers = with stdenv.lib.maintainers; [ simons the-kenny jwiegley ];
+ maintainers = with stdenv.lib.maintainers; [ the-kenny jwiegley ];
};
}
diff --git a/doc/NEWS b/doc/NEWS
index d7d91851..0cb4b2b9 100644
--- a/doc/NEWS
+++ b/doc/NEWS
@@ -9,17 +9,21 @@
- Check balance assertions against the amount after the posting (bug #1147).
+- Allow balance assertions with multiple posts to same account (bug #1187).
+
- Fixed period duration of "every X days" and similar statements (bug #370).
-- Python: Removed double quotes from Unicode values.
+- Option --force-color does not require --color anymore (bug #1109).
-- ledger.el: Made links in ledger-report "register" commands optional.
+- Added quoted_rfc4180 to allow CVS output with RFC 4180 compliant quoting.
+
+- Python: Removed double quotes from Unicode values.
-- ledger.el: Added a "binary" format specifier to ledger-report.
+- Emacs Lisp files have been moved to https://github.com/ledger/ledger-mode
-- ledger.el: Consider ISO dates in `ledger-read-date'.
+- Fixed build under MSYS (32-bit).
-- ledger.el: Fixed compatibility problem with spacemacs.
+- Fixed build under Cygwin.
- Various documentation improvements
diff --git a/doc/ledger.1 b/doc/ledger.1
index 80649496..141d245c 100644
--- a/doc/ledger.1
+++ b/doc/ledger.1
@@ -1283,6 +1283,10 @@ for values that have a per-unit cost.
Surround
.Ar expression
with double-quotes.
+.It Fn quoted_rfc4180 expression
+Surround
+.Ar expression
+with double-quotes, compatible with rfc 4180.
.It Sy real
.\" Is there a difference between real and actual?
Return true if the transaction is real, i.e not a automated or virtual
diff --git a/doc/ledger3.texi b/doc/ledger3.texi
index 08099a15..5407aa71 100644
--- a/doc/ledger3.texi
+++ b/doc/ledger3.texi
@@ -8360,7 +8360,18 @@ Return the quantity of @var{value} for values that have a per-unit cost.
@end defun
@defun quoted expression
-Surround @var{expression} with double-quotes.
+Surround @var{expression} with double-quotes. If expression contains a double-quote, it will be escaped with a backslash.
+@smallexample @c command:EAD8AA7,with_input:3406FC1
+$ ledger -f expr.dat --format "%(quoted(account)) %(quoted(amount))\n" reg
+@end smallexample
+@smallexample @c output:EAD8AA7
+"Assets:Cash" "¤ -123,45"
+"Expenses:Office Supplies" "¤ 123,45"
+@end smallexample
+@end defun
+
+@defun quoted_rfc4180 expression
+Surround @var{expression} with double-quotes, compliant with rfc 4180. If expression contains a double-quote, it will be represented with two double-quotes.
@smallexample @c command:EAD8AA7,with_input:3406FC1
$ ledger -f expr.dat --format "%(quoted(account)) %(quoted(amount))\n" reg
@end smallexample
diff --git a/src/report.cc b/src/report.cc
index b2162034..09cae692 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -759,6 +759,23 @@ value_t report_t::fn_quoted(call_scope_t& args)
return string_value(out.str());
}
+value_t report_t::fn_quoted_rfc4180(call_scope_t& args)
+{
+ std::ostringstream out;
+
+ out << '"';
+ string arg(args.get<string>(0));
+ foreach (const char ch, arg) {
+ if (ch == '"')
+ out << '"' << '"';
+ else
+ out << ch;
+ }
+ out << '"';
+
+ return string_value(out.str());
+}
+
value_t report_t::fn_join(call_scope_t& args)
{
std::ostringstream out;
@@ -1442,6 +1459,8 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
case 'q':
if (is_eq(p, "quoted"))
return MAKE_FUNCTOR(report_t::fn_quoted);
+ else if (is_eq(p, "quoted_rfc4180"))
+ return MAKE_FUNCTOR(report_t::fn_quoted_rfc4180);
else if (is_eq(p, "quantity"))
return MAKE_FUNCTOR(report_t::fn_quantity);
break;
diff --git a/src/report.h b/src/report.h
index e943de1d..6bd3ca73 100644
--- a/src/report.h
+++ b/src/report.h
@@ -181,6 +181,7 @@ public:
value_t fn_abs(call_scope_t& scope);
value_t fn_justify(call_scope_t& scope);
value_t fn_quoted(call_scope_t& scope);
+ value_t fn_quoted_rfc4180(call_scope_t& scope);
value_t fn_join(call_scope_t& scope);
value_t fn_format_date(call_scope_t& scope);
value_t fn_format_datetime(call_scope_t& scope);