diff options
-rw-r--r-- | doc/CMakeLists.txt | 55 | ||||
-rw-r--r-- | doc/ledger.1 | 2 | ||||
-rw-r--r-- | doc/ledger3.texi | 4 | ||||
-rw-r--r-- | doc/mainpage.txt | 4 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/global.h | 2 | ||||
-rw-r--r-- | src/ledger.hh.in | 3 | ||||
-rw-r--r-- | src/pyledger.cc | 19 |
8 files changed, 68 insertions, 22 deletions
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 61e5c077..eba8d376 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -40,6 +40,7 @@ if (USE_DOXYGEN) set(DOXYGEN_SHORT_NAMES YES) set(DOXYGEN_JAVADOC_AUTOBRIEF YES) set(DOXYGEN_TAB_SIZE 8) + set(DOXYGEN_TIMESTAMP DATETIME) set(DOXYGEN_BUILTIN_STL_SUPPORT YES) set(DOXYGEN_EXTRACT_ALL YES) set(DOXYGEN_EXTRACT_LOCAL_CLASSES NO) @@ -89,6 +90,7 @@ if (BUILD_DOCS) find_program(TEXI2PDF texi2pdf) find_program(TEX tex) find_program(MAN2HTML man2html) + find_program(MANDOC mandoc) find_program(GROFF groff) set(ledger_info_files ledger3.texi) @@ -108,18 +110,22 @@ foreach(file ${ledger_info_files}) if (MAKEINFO) add_custom_command(OUTPUT ${file_base}.info - COMMAND makeinfo --force --no-split -o ${file_base}.info ${CMAKE_CURRENT_SOURCE_DIR}/${file} + COMMAND ${MAKEINFO} --force --no-split -o ${file_base}.info ${CMAKE_CURRENT_SOURCE_DIR}/${file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} VERBATIM) list(APPEND ledger_doc_files ${file_base}.info) - endif() - - if (BUILD_WEB_DOCS AND MAKEINFO) - 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) + if (BUILD_WEB_DOCS) + 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) + add_custom_command(OUTPUT ${file_base}.txt + COMMAND ${MAKEINFO} --force --plaintext --no-split -o ${file_base}.txt ${CMAKE_CURRENT_SOURCE_DIR}/${file} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} + VERBATIM) + list(APPEND ledger_doc_files ${file_base}.txt) + endif() endif() if (TEXI2PDF AND TEX) @@ -127,7 +133,7 @@ foreach(file ${ledger_info_files}) set(papersize --texinfo=@afourpaper) endif() add_custom_command(OUTPUT ${file_base}.pdf - COMMAND texi2pdf ${papersize} -b -q -o ${file_base}.pdf ${CMAKE_CURRENT_SOURCE_DIR}/${file} + COMMAND ${TEXI2PDF} ${papersize} -b -q -o ${file_base}.pdf ${CMAKE_CURRENT_SOURCE_DIR}/${file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} VERBATIM) list(APPEND ledger_doc_files ${file_base}.pdf) @@ -143,18 +149,39 @@ if (BUILD_WEB_DOCS) endif() if (MAN2HTML) add_custom_command(OUTPUT ledger.1.html - COMMAND ${BASH} -c "man2html ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 | tail -n+3 > ledger.1.html" + COMMAND ${BASH} -c "${MAN2HTML} ${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) - elseif(GROFF) + elseif (MANDOC OR GROFF) + set(_cmd ${MANDOC}) + if (NOT _cmd) + # HTML produced by mandoc is much nicer looking, use groff only as a last resort. + message(WARNING "Using ${GROFF} to generate ledger1.html, as mandoc could not be found.") + set(_cmd ${GROFF}) + endif() add_custom_command(OUTPUT ledger.1.html - COMMAND ${BASH} -c "groff -mandoc -Thtml ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 > ledger.1.html" + COMMAND ${BASH} -c "${_cmd} -mandoc -Thtml ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 > ledger.1.html" DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 VERBATIM) list(APPEND ledger_doc_files ledger.1.html) + add_custom_command(OUTPUT ledger.1.pdf + COMMAND ${BASH} -c "${_cmd} -mandoc -Tpdf ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 > ledger.1.pdf" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 + VERBATIM) + list(APPEND ledger_doc_files ledger.1.pdf) else() - message(FATAL_ERROR "Could not find man2html or groff. HTML version of man page cannot be built.") + message(WARNING "Could not find man2html or groff. HTML version of man page will not be built.") + endif() + + if (USE_PYTHON AND Python_EXECUTABLE) + add_custom_command(OUTPUT ledger.html + COMMAND ${CMAKE_COMMAND} -E env + PYTHONPATH=${CMAKE_BINARY_DIR} + ${Python_EXECUTABLE} -m pydoc -w ledger + DEPENDS ${CMAKE_BINARY_DIR}/${_ledger_python_module_name} + VERBATIM) + list(APPEND ledger_doc_files ledger.html) endif() endif(BUILD_WEB_DOCS) diff --git a/doc/ledger.1 b/doc/ledger.1 index fab5625a..82b03b46 100644 --- a/doc/ledger.1 +++ b/doc/ledger.1 @@ -1449,7 +1449,7 @@ initializations. .Sh SEE ALSO .Xr beancount 1 , .Xr hledger 1 - +.Pp The full documentation for .Nm is maintained as a Texinfo manual. If the diff --git a/doc/ledger3.texi b/doc/ledger3.texi index 8680c5b1..e29c1082 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -4303,11 +4303,11 @@ If you want to know exactly how much you have spent in a particular account on a particular payee, the following are equivalent: @smallexample @c command:validate -$ ledger balance Auto:Fuel and Chevron +$ ledger balance Expenses:Auto:Fuel and @@Chevron @end smallexample @smallexample @c command:validate -$ ledger balance --limit 'account=~/Fuel/' and 'payee=~/Chev/' +$ ledger balance --limit 'account=~/Expenses:Auto:Fuel/ and payee=~/Chevron/' @end smallexample @noindent diff --git a/doc/mainpage.txt b/doc/mainpage.txt index 95db4d12..7958559d 100644 --- a/doc/mainpage.txt +++ b/doc/mainpage.txt @@ -1,9 +1,9 @@ /** -\mainpage API Documentation +\mainpage C++ API Documentation \section intro_sec Introduction -Documentation of the Ledger API is an ongoing process and you are invited +Documentation of the Ledger C++ API is an ongoing process and you are invited to help out and contribute. In case you find this documentation incorrect, incomplete, unclear, or lacking please [open a pull request](https://git.ledger-cli.org/ledger/pulls). diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d847d71a..f229d70c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -136,6 +136,7 @@ set(LEDGER_INCLUDES value.h views.h xact.h + ${PROJECT_BINARY_DIR}/ledger.hh ${PROJECT_BINARY_DIR}/system.hh) # Windows provides no strptime(), so supply our own. diff --git a/src/global.h b/src/global.h index 4892a471..d989d1b2 100644 --- a/src/global.h +++ b/src/global.h @@ -125,7 +125,7 @@ public: << Ledger_VERSION_PATCH; if (Ledger_VERSION_PRERELEASE != 0) out << Ledger_VERSION_PRERELEASE; - if (Ledger_VERSION_DATE != 0) + if (std::strlen(Ledger_VERSION_DATE) > 0) out << '-' << Ledger_VERSION_DATE; out << _(", the command-line accounting tool"); out << _("\nwith"); diff --git a/src/ledger.hh.in b/src/ledger.hh.in index 54e7797c..3dd5a3a8 100644 --- a/src/ledger.hh.in +++ b/src/ledger.hh.in @@ -43,7 +43,8 @@ #define Ledger_VERSION_MINOR @Ledger_VERSION_MINOR@ #define Ledger_VERSION_PATCH @Ledger_VERSION_PATCH@ #define Ledger_VERSION_PRERELEASE "@Ledger_VERSION_PRERELEASE@" -#define Ledger_VERSION_DATE @Ledger_VERSION_DATE@ +#define Ledger_VERSION_DATE "@Ledger_VERSION_DATE@" +#define Ledger_VERSION "@Ledger_VERSION_MAJOR@.@Ledger_VERSION_MINOR@.@Ledger_VERSION_PATCH@" /** * @name Default values diff --git a/src/pyledger.cc b/src/pyledger.cc index e4a5d262..a716f1a5 100644 --- a/src/pyledger.cc +++ b/src/pyledger.cc @@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <system.hh> +#include <ledger.hh> #include "pyinterp.h" @@ -43,6 +43,23 @@ BOOST_PYTHON_MODULE(ledger) { using namespace ledger; + scope().attr("__author__") = "John Wiegley <jwiegley@gmail.com>"; + scope().attr("__version__") = Ledger_VERSION; + scope().attr("__date__") = Ledger_VERSION_DATE; + scope().attr("__doc__") = + "Python API Documentation\n\n" + "Documentation of the Ledger Python API is an ongoing process and you are invited\n" + "to help out and contribute. In case you find this documentation incorrect,\n" + "incomplete, unclear, or lacking please open a pull request at\n" + "https://git.ledger-cli.org/ledger/pulls." + ; + +#if !DEBUG_MODE + docstring_options doc_options; + doc_options.disable_cpp_signatures(); +#endif + + if (! python_session.get()) python_session.reset(new python_interpreter_t); |