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
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
(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 8)
|
||||
(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)
|
||||
(let* ((state nil)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue