summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--doc/ledger3.texi2
-rw-r--r--lisp/ledger-fontify.el29
-rw-r--r--lisp/ledger-regex.el13
-rw-r--r--src/py_balance.cc6
-rw-r--r--test/CMakeLists.txt23
6 files changed, 42 insertions, 33 deletions
diff --git a/README.md b/README.md
index 3618ad5a..fd2f540d 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![Build Status](https://travis-ci.org/ledger/ledger.png?branch=master)](https://travis-ci.org/ledger/ledger)
+[![Build Status](https://travis-ci.org/ledger/ledger.svg?branch=master)](https://travis-ci.org/ledger/ledger)
# Ledger: Command-Line Accounting
diff --git a/doc/ledger3.texi b/doc/ledger3.texi
index e9b0f552..05420295 100644
--- a/doc/ledger3.texi
+++ b/doc/ledger3.texi
@@ -2388,7 +2388,7 @@ fixed CAD $0.90
2012-04-11 Second day Dinner in Canada
Assets:Wallet -25.75 CAD
Expenses:Food 25.75 CAD
-endfixed
+endfixed CAD
@end smallexample
is equivalent to this:
diff --git a/lisp/ledger-fontify.el b/lisp/ledger-fontify.el
index caf7690a..7d3c3e21 100644
--- a/lisp/ledger-fontify.el
+++ b/lisp/ledger-fontify.el
@@ -79,20 +79,21 @@
Fontify the first line of an xact"
(goto-char pos)
(beginning-of-line)
- (let ((state nil))
- (re-search-forward ledger-xact-start-regex)
- (ledger-fontify-set-face (list (match-beginning 1) (match-end 1)) 'ledger-font-posting-date-face)
- (save-match-data (setq state (ledger-state-from-string (match-string 5))))
- (ledger-fontify-set-face (list (match-beginning 7) (match-end 7))
- (cond ((eq state 'pending)
- 'ledger-font-payee-pending-face)
- ((eq state 'cleared)
- 'ledger-font-payee-cleared-face)
- (t
- 'ledger-font-payee-uncleared-face)))
- (ledger-fontify-set-face (list (match-beginning 8)
- (match-end 8)) 'ledger-font-comment-face)))
-
+ (let ((state nil)
+ (cur-point (point)))
+ (re-search-forward " ")
+ (ledger-fontify-set-face (list cur-point (point)) 'ledger-font-posting-date-face)
+ (re-search-forward ledger-xact-after-date-regex)
+ (save-match-data (setq state (ledger-state-from-string (match-string 1)))
+ (ledger-fontify-set-face (list (match-beginning 3) (match-end 3))
+ (cond ((eq state 'pending)
+ 'ledger-font-payee-pending-face)
+ ((eq state 'cleared)
+ 'ledger-font-payee-cleared-face)
+ (t
+ 'ledger-font-payee-uncleared-face))))
+ (ledger-fontify-set-face (list (match-beginning 4)
+ (match-end 4)) 'ledger-font-comment-face)))
(defun ledger-fontify-posting (pos)
(let* ((state nil)
diff --git a/lisp/ledger-regex.el b/lisp/ledger-regex.el
index b13647b5..91c715a3 100644
--- a/lisp/ledger-regex.el
+++ b/lisp/ledger-regex.el
@@ -334,11 +334,14 @@
(defconst ledger-xact-start-regex
(concat "^" ledger-iso-date-regexp ;; subexp 1
- ;; "\\(=" ledger-iso-date-regexp "\\)?"
- " ?\\([ *!]\\)" ;; mark, subexp 5
- " ?\\((.*)\\)?" ;; code, subexp 6
- " ?\\([^;\n]+\\)" ;; desc, subexp 7
- "\\(\n\\|;.*\\)" ;; comment, subexp 8
+ "\\(=" ledger-iso-date-regexp "\\)?"
+ ))
+
+(defconst ledger-xact-after-date-regex
+ (concat " ?\\([ *!]\\)" ;; mark, subexp 1
+ " ?\\((.*)\\)?" ;; code, subexp 2
+ " ?\\([^;\n]+\\)" ;; desc, subexp 3
+ "\\(\n\\|;.*\\)" ;; comment, subexp 4
))
(defconst ledger-posting-regex
diff --git a/src/py_balance.cc b/src/py_balance.cc
index dec08a51..ff6e75f8 100644
--- a/src/py_balance.cc
+++ b/src/py_balance.cc
@@ -56,6 +56,11 @@ namespace {
const datetime_t& moment) {
return balance.value(moment, in_terms_of);
}
+ boost::optional<balance_t> py_value_2d(const balance_t& balance,
+ const commodity_t * in_terms_of,
+ const date_t& moment) {
+ return balance.value(datetime_t(moment), in_terms_of);
+ }
boost::optional<amount_t>
py_commodity_amount_0(const balance_t& balance) {
@@ -200,6 +205,7 @@ void export_balance()
.def("value", py_value_0)
.def("value", py_value_1, args("in_terms_of"))
.def("value", py_value_2, args("in_terms_of", "moment"))
+ .def("value", py_value_2d, args("in_terms_of", "moment"))
.def("__nonzero__", &balance_t::is_nonzero)
.def("is_nonzero", &balance_t::is_nonzero)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 21d27c7d..44db81fb 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -36,17 +36,16 @@ add_subdirectory(manual)
add_subdirectory(baseline)
add_subdirectory(regress)
-# jww (2014-04-17): This is temporary until we find a fix.
-#if (PYTHONINTERP_FOUND)
-# set(_class DocTests)
-# file(GLOB ${_class}_TESTS ${PROJECT_SOURCE_DIR}/doc/*.texi)
-# foreach(TestFile ${${_class}_TESTS})
-# get_filename_component(TestFile_Name ${TestFile} NAME_WE)
-# add_test(NAME ${_class}Test_${TestFile_Name}
-# COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/DocTests.py
-# --ledger $<TARGET_FILE:ledger> --file ${TestFile})
-# set_target_properties(check PROPERTIES DEPENDS ${_class}Test_${TestFile_Name})
-# endforeach()
-#endif()
+if (PYTHONINTERP_FOUND)
+ set(_class DocTests)
+ file(GLOB ${_class}_TESTS ${PROJECT_SOURCE_DIR}/doc/*.texi)
+ foreach(TestFile ${${_class}_TESTS})
+ get_filename_component(TestFile_Name ${TestFile} NAME_WE)
+ add_test(NAME ${_class}Test_${TestFile_Name}
+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/DocTests.py
+ --ledger $<TARGET_FILE:ledger> --file ${TestFile})
+ set_target_properties(check PROPERTIES DEPENDS ${_class}Test_${TestFile_Name})
+ endforeach()
+endif()
### CMakeLists.txt ends here