Merge remote-tracking branch 'upstream/next' into next

This commit is contained in:
Craig Earls 2013-01-14 21:56:33 -08:00
commit 856f4b673c
7 changed files with 122 additions and 39 deletions

View file

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 2.8.5)
project(Ledger)
PROJECT(ledger)
set(Ledger_VERSION_MAJOR 3)
set(Ledger_VERSION_MINOR 0)
@ -18,7 +18,8 @@ option(DISABLE_ASSERTS "Build without any internal consistency checks" OFF)
option(BUILD_DEBUG "Build support for runtime debugging" OFF)
option(BUILD_LIBRARY "Build and install Ledger as a library" ON)
option(BUILD_DOCS "Build and install documentation" OFF)
option(BUILD_DOCS "Build and install documentation" ON)
option(BUILD_WEB_DOCS "Build version of documentation suitable for viewing online" OFF)
option(BUILD_EMACSLISP "Build and install ledger-mode for Emacs" OFF)
if(BUILD_DEBUG)
@ -275,9 +276,7 @@ elseif(CMAKE_CXX_COMPILER MATCHES "g\\+\\+")
endif()
add_subdirectory(src)
if(BUILD_DOCS)
add_subdirectory(doc)
endif()
add_subdirectory(doc)
if(BUILD_EMACSLISP)
add_subdirectory(lisp)
endif()

View file

@ -0,0 +1,89 @@
if (USE_DOXYGEN)
find_package(Doxygen)
if(NOT DOXYGEN_FOUND)
message(FATAL_ERROR "Could not find doxygen. Reference documentation cannot be built.")
endif()
configure_file(Doxyfile.in Doxyfile @ONLY)
add_custom_target(doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
SOURCES Doxyfile)
endif(USE_DOXYGEN)
########################################################################
if(NOT BUILD_DOCS)
return()
endif()
set(info_files ledger.texi ledger3.texi)
find_program(MAKEINFO makeinfo)
find_program(TEXI2PDF texi2pdf)
find_program(MAN2HTML man2html)
########################################################################
foreach(file ${info_files})
get_filename_component(file_base ${file} NAME_WE)
if(BUILD_WEB_DOCS)
if(NOT MAKEINFO)
message(FATAL_ERROR "Could not find makeinfo. HTML version of documentation cannot be built.")
endif()
add_custom_command(OUTPUT ${file_base}.html
COMMAND makeinfo --force --html --no-split -o ${file_base}.html ${CMAKE_CURRENT_SOURCE_DIR}/${file}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
VERBATIM)
list(APPEND ledger_doc_files ${file_base}.html)
endif(BUILD_WEB_DOCS)
if(NOT TEXI2PDF)
mesage(WARNING "Could not find texi2pdf. PDF version of documentation will not be built.")
else()
add_custom_command(OUTPUT ${file_base}.pdf
COMMAND texi2pdf -b -q --tidy -o ${file_base}.pdf ${CMAKE_CURRENT_SOURCE_DIR}/${file}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
VERBATIM)
list(APPEND ledger_doc_files ${file_base}.pdf)
endif()
endforeach()
########################################################################
if(BUILD_WEB_DOCS)
include(FindUnixCommands)
if(NOT BASH)
message(FATAL_ERROR "Could not find bash. Unable to build documentation.")
endif()
if(NOT MAN2HTML)
message(FATAL_ERROR "Could not find man2html. HTML version of man page cannot be built.")
endif()
add_custom_command(OUTPUT ledger.1.html
COMMAND ${BASH} -c "man2html $<1:CMAKE_CURRENT_SOURCE_DIR>/ledger.1 | tail -n+3 > ledger.1.html"
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1
VERBATIM)
list(APPEND ledger_doc_files ledger.1.html)
endif(BUILD_WEB_DOCS)
########################################################################
add_custom_target(doc ALL DEPENDS ${ledger_doc_files})
########################################################################
include(GNUInstallDirs)
if(CMAKE_INSTALL_MANDIR)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc)
endif(CMAKE_INSTALL_MANDIR)
if(CMAKE_INSTALL_DOCDIR)
foreach(file ${info_files})
get_filename_component(file_base ${file} NAME_WE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file_base}.pdf
DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT doc OPTIONAL)
endforeach()
endif(CMAKE_INSTALL_DOCDIR)

View file

@ -38,7 +38,7 @@ PROJECT_NUMBER = 3.0
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY = %builddir%/doc
OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
@ -124,7 +124,7 @@ FULL_PATH_NAMES = NO
# If left blank the directory from which doxygen is run is used as the
# path to strip.
STRIP_FROM_PATH = %srcdir%/src/
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@/src/
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells
@ -564,7 +564,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = src
INPUT = @PROJECT_SOURCE_DIR@/src
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

View file

@ -1,17 +0,0 @@
# quick doc-building makefile used by website
# requires: man2html, texinfo
docs: ledger.1.html ledger.html ledger.pdf ledger3.html ledger3.pdf
%.1.html: %.1
-man2html $< | tail -n+3 >$@
%.html: %.texi
-makeinfo --force --html --no-split -o $@ $<
%.pdf: %.texi
-texi2pdf -b -q $<
rm -f $*.aux $*.cp $*.fn $*.ky $*.log $*.pg $*.toc $*.tp $*.vr
clean:
rm -rf ledger.1.html ledger.html ledger3.html ledger.pdf ledger3.pdf

View file

@ -1312,9 +1312,9 @@ your opening balance entry could look like this:
Assets:Joint Checking $800.14
Assets:Other Checking $63.44
Assets:Savings $2805.54
Assets:Investments:401K:Deferred 100.0000 VIFSX @ $80.5227
Assets:Investments:401K:Matching 50.0000 VIFSX @ $83.7015
Assets:Investments:IRA 250.0000 VTHRX @ $20.5324
Assets:Investments:401K:Deferred 100.0000 VIFSX @@ $80.5227
Assets:Investments:401K:Matching 50.0000 VIFSX @@ $83.7015
Assets:Investments:IRA 250.0000 VTHRX @@ $20.5324
Liabilities:Mortgage $-175634.88
Liabilities:Car Loan $-3494.26
Liabilities:Visa -$1762.44
@ -2970,12 +2970,12 @@ resulting posting cost is $50.00 per share.
@node Explicit posting costs, Posting cost expressions, Posting cost, Transactions
@section Explicit posting costs
You can make any posting's cost explicit using the @ symbol after the amount
You can make any posting's cost explicit using the @@ symbol after the amount
or amount expression:
@smallexample
2012-03-10 My Broker
Assets:Brokerage 10 AAPL @ $50.00
Assets:Brokerage 10 AAPL @@ $50.00
Assets:Brokerage:Cash $-500.00
@end smallexample
@ -2984,7 +2984,7 @@ the first posting's cost, you can elide the other amount:
@smallexample
2012-03-10 My Broker
Assets:Brokerage 10 AAPL @ $50.00
Assets:Brokerage 10 AAPL @@ $50.00
Assets:Brokerage:Cash
@end smallexample
@ -3029,7 +3029,7 @@ You can even have both:
@node Total posting costs, Virtual posting costs, Posting cost expressions, Transactions
@section Total posting costs
The cost figure following the @ character specifies the @emph{per-unit} price for
The cost figure following the @@ character specifies the @emph{per-unit} price for
the commodity being transferred. If you'd like to specify the total cost
instead, use @@@@:
@ -3149,7 +3149,7 @@ Plus, it comes with dangers. This works fine:
@smallexample
2012-04-10 My Broker
Assets:Brokerage 10 AAPL @ $50.00
Assets:Brokerage 10 AAPL @@ $50.00
Assets:Brokerage:Cash $750.00
2012-04-10 My Broker
@ -3167,7 +3167,7 @@ Plus, it comes with dangers. This works fine:
@smallexample
2012-04-10 My Broker
Assets:Brokerage 10 AAPL @ $50.00
Assets:Brokerage 10 AAPL @@ $50.00
Assets:Brokerage:Cash $750.00
2012-04-10 My Broker
@ -3192,7 +3192,7 @@ following two transactions are equivalent:
@smallexample
2012-04-10 My Broker
Assets:Brokerage 10 AAPL @ $50.00
Assets:Brokerage 10 AAPL @@ $50.00
Assets:Brokerage:Cash $750.00
2012-04-10 My Broker
@ -3257,7 +3257,7 @@ that dates are parsed in value expressions):
You can also associate arbitrary notes for your own record keeping in
parentheses, and reveal them with --lot-notes. One caveat is that the note
cannot begin with an @ character, as that would indicate a virtual cost:
cannot begin with an @@ character, as that would indicate a virtual cost:
@smallexample
2012-04-10 My Broker
@ -4914,7 +4914,7 @@ model transaction:
--- Context is first posting of the following transaction ---
2004/05/27 Book Store
; This note applies to all postings. :SecondTag:
Expenses:Books 20 BOOK @ $10
Expenses:Books 20 BOOK @@ $10
; Metadata: Some Value
; Typed:: $100 + $200
; :ExampleTag:

View file

@ -983,7 +983,8 @@ void interval_posts::flush()
sort_posts_by_date());
// Determine the beginning interval by using the earliest post
if (! interval.find_period(all_posts.front()->date()))
if (all_posts.front() &&
! interval.find_period(all_posts.front()->date()))
throw_(std::logic_error, _("Failed to find period for interval report"));
// Walk the interval forward reporting all posts within each one

View file

@ -127,8 +127,19 @@ account_t * journal_t::register_account(const string& name, post_t * post,
// object.
if (account_aliases.size() > 0) {
accounts_map::const_iterator i = account_aliases.find(name);
if (i != account_aliases.end())
if (i != account_aliases.end()) {
result = (*i).second;
} else {
// only check the very first account for alias expansion, in case
// that can be expanded successfully
size_t colon = name.find(':');
if(colon != string::npos) {
accounts_map::const_iterator i = account_aliases.find(name.substr(0, colon));
if (i != account_aliases.end()) {
result = find_account((*i).second->fullname() + name.substr(colon));
}
}
}
}
// Create the account object and associate it with the journal; this