Merge branch 'master' into ledger-mode-code-cleanup
This commit is contained in:
commit
8f9c46d42b
6 changed files with 42 additions and 33 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
[](https://travis-ci.org/ledger/ledger)
|
[](https://travis-ci.org/ledger/ledger)
|
||||||
|
|
||||||
# Ledger: Command-Line Accounting
|
# Ledger: Command-Line Accounting
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2388,7 +2388,7 @@ fixed CAD $0.90
|
||||||
2012-04-11 Second day Dinner in Canada
|
2012-04-11 Second day Dinner in Canada
|
||||||
Assets:Wallet -25.75 CAD
|
Assets:Wallet -25.75 CAD
|
||||||
Expenses:Food 25.75 CAD
|
Expenses:Food 25.75 CAD
|
||||||
endfixed
|
endfixed CAD
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
is equivalent to this:
|
is equivalent to this:
|
||||||
|
|
|
||||||
|
|
@ -79,20 +79,21 @@
|
||||||
Fontify the first line of an xact"
|
Fontify the first line of an xact"
|
||||||
(goto-char pos)
|
(goto-char pos)
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(let ((state nil))
|
(let ((state nil)
|
||||||
(re-search-forward ledger-xact-start-regex)
|
(cur-point (point)))
|
||||||
(ledger-fontify-set-face (list (match-beginning 1) (match-end 1)) 'ledger-font-posting-date-face)
|
(re-search-forward " ")
|
||||||
(save-match-data (setq state (ledger-state-from-string (match-string 5))))
|
(ledger-fontify-set-face (list cur-point (point)) 'ledger-font-posting-date-face)
|
||||||
(ledger-fontify-set-face (list (match-beginning 7) (match-end 7))
|
(re-search-forward ledger-xact-after-date-regex)
|
||||||
(cond ((eq state 'pending)
|
(save-match-data (setq state (ledger-state-from-string (match-string 1)))
|
||||||
'ledger-font-payee-pending-face)
|
(ledger-fontify-set-face (list (match-beginning 3) (match-end 3))
|
||||||
((eq state 'cleared)
|
(cond ((eq state 'pending)
|
||||||
'ledger-font-payee-cleared-face)
|
'ledger-font-payee-pending-face)
|
||||||
(t
|
((eq state 'cleared)
|
||||||
'ledger-font-payee-uncleared-face)))
|
'ledger-font-payee-cleared-face)
|
||||||
(ledger-fontify-set-face (list (match-beginning 8)
|
(t
|
||||||
(match-end 8)) 'ledger-font-comment-face)))
|
'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)
|
(defun ledger-fontify-posting (pos)
|
||||||
(let* ((state nil)
|
(let* ((state nil)
|
||||||
|
|
|
||||||
|
|
@ -334,11 +334,14 @@
|
||||||
|
|
||||||
(defconst ledger-xact-start-regex
|
(defconst ledger-xact-start-regex
|
||||||
(concat "^" ledger-iso-date-regexp ;; subexp 1
|
(concat "^" ledger-iso-date-regexp ;; subexp 1
|
||||||
;; "\\(=" ledger-iso-date-regexp "\\)?"
|
"\\(=" ledger-iso-date-regexp "\\)?"
|
||||||
" ?\\([ *!]\\)" ;; mark, subexp 5
|
))
|
||||||
" ?\\((.*)\\)?" ;; code, subexp 6
|
|
||||||
" ?\\([^;\n]+\\)" ;; desc, subexp 7
|
(defconst ledger-xact-after-date-regex
|
||||||
"\\(\n\\|;.*\\)" ;; comment, subexp 8
|
(concat " ?\\([ *!]\\)" ;; mark, subexp 1
|
||||||
|
" ?\\((.*)\\)?" ;; code, subexp 2
|
||||||
|
" ?\\([^;\n]+\\)" ;; desc, subexp 3
|
||||||
|
"\\(\n\\|;.*\\)" ;; comment, subexp 4
|
||||||
))
|
))
|
||||||
|
|
||||||
(defconst ledger-posting-regex
|
(defconst ledger-posting-regex
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,11 @@ namespace {
|
||||||
const datetime_t& moment) {
|
const datetime_t& moment) {
|
||||||
return balance.value(moment, in_terms_of);
|
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>
|
boost::optional<amount_t>
|
||||||
py_commodity_amount_0(const balance_t& balance) {
|
py_commodity_amount_0(const balance_t& balance) {
|
||||||
|
|
@ -200,6 +205,7 @@ void export_balance()
|
||||||
.def("value", py_value_0)
|
.def("value", py_value_0)
|
||||||
.def("value", py_value_1, args("in_terms_of"))
|
.def("value", py_value_1, args("in_terms_of"))
|
||||||
.def("value", py_value_2, args("in_terms_of", "moment"))
|
.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("__nonzero__", &balance_t::is_nonzero)
|
||||||
.def("is_nonzero", &balance_t::is_nonzero)
|
.def("is_nonzero", &balance_t::is_nonzero)
|
||||||
|
|
|
||||||
|
|
@ -36,17 +36,16 @@ add_subdirectory(manual)
|
||||||
add_subdirectory(baseline)
|
add_subdirectory(baseline)
|
||||||
add_subdirectory(regress)
|
add_subdirectory(regress)
|
||||||
|
|
||||||
# jww (2014-04-17): This is temporary until we find a fix.
|
if (PYTHONINTERP_FOUND)
|
||||||
#if (PYTHONINTERP_FOUND)
|
set(_class DocTests)
|
||||||
# set(_class DocTests)
|
file(GLOB ${_class}_TESTS ${PROJECT_SOURCE_DIR}/doc/*.texi)
|
||||||
# file(GLOB ${_class}_TESTS ${PROJECT_SOURCE_DIR}/doc/*.texi)
|
foreach(TestFile ${${_class}_TESTS})
|
||||||
# foreach(TestFile ${${_class}_TESTS})
|
get_filename_component(TestFile_Name ${TestFile} NAME_WE)
|
||||||
# get_filename_component(TestFile_Name ${TestFile} NAME_WE)
|
add_test(NAME ${_class}Test_${TestFile_Name}
|
||||||
# add_test(NAME ${_class}Test_${TestFile_Name}
|
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/DocTests.py
|
||||||
# COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/DocTests.py
|
--ledger $<TARGET_FILE:ledger> --file ${TestFile})
|
||||||
# --ledger $<TARGET_FILE:ledger> --file ${TestFile})
|
set_target_properties(check PROPERTIES DEPENDS ${_class}Test_${TestFile_Name})
|
||||||
# set_target_properties(check PROPERTIES DEPENDS ${_class}Test_${TestFile_Name})
|
endforeach()
|
||||||
# endforeach()
|
endif()
|
||||||
#endif()
|
|
||||||
|
|
||||||
### CMakeLists.txt ends here
|
### CMakeLists.txt ends here
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue