summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/ledger.14
-rw-r--r--doc/ledger3.texi4
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/org.cc201
-rw-r--r--src/org.h94
-rw-r--r--src/report.cc6
-rw-r--r--src/select.cc2
-rw-r--r--test/baseline/cmd-org.test28
8 files changed, 1 insertions, 340 deletions
diff --git a/doc/ledger.1 b/doc/ledger.1
index 2564d0a3..e9b47315 100644
--- a/doc/ledger.1
+++ b/doc/ledger.1
@@ -1,4 +1,4 @@
-.Dd February 24, 2019
+.Dd March 15, 2019
.Dt LEDGER 1
.Os
.Sh NAME
@@ -122,8 +122,6 @@ in a special account called
.Li Equity:Opening Balances .
The purpose of this report is to close the books for a prior year, while using
these equity postings to carry forward those balances.
-.It Ic org
-Produce a journal file suitable for use in the Emacs org mode.
.It Ic payees Oo Ar report-query Oc
List all payees for postings matching the
.Ar report-query .
diff --git a/doc/ledger3.texi b/doc/ledger3.texi
index be5a8cec..e49ebbbd 100644
--- a/doc/ledger3.texi
+++ b/doc/ledger3.texi
@@ -4843,10 +4843,6 @@ directly by Emacs Lisp. The format of the @code{sexp} is:
@subsection Emacs @command{org} Mode
@findex org
-The @command{org} command produces a journal file suitable for use in
-the Emacs Org mode. More details on using Org mode can be found at
-@url{http://www.orgmode.org}.
-
Org mode has a sub-system known as Babel which allows for literate
programming. This allows you to mix text and code within the same
document and automatically execute code which may generate results
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9b39ea94..756df376 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,7 +9,6 @@ set(LEDGER_SOURCES
convert.cc
draft.cc
emacs.cc
- org.cc
ptree.cc
print.cc
output.cc
@@ -103,7 +102,6 @@ set(LEDGER_INCLUDES
mask.h
op.h
option.h
- org.h
output.h
parser.h
pool.h
diff --git a/src/org.cc b/src/org.cc
deleted file mode 100644
index c5a1aac3..00000000
--- a/src/org.cc
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 2003-2018, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <system.hh>
-
-#include "org.h"
-#include "xact.h"
-#include "post.h"
-#include "account.h"
-#include "journal.h"
-#include "pool.h"
-#include "report.h"
-
-namespace ledger {
-
-posts_to_org_table::posts_to_org_table(report_t& _report,
- const optional<string>& _prepend_format)
- : report(_report), last_xact(NULL), last_post(NULL),
- header_printed(false), first_report_title(true)
-{
- first_line_format.parse_format
- ("|%(format_date(date))"
- "|%(code)"
- "|%(payee)"
- "|%(cleared ? \"*\" : (pending ? \"!\" : \"\"))"
- "|%(display_account)"
- "|%(scrub(top_amount(display_amount)))"
- "|%(scrub(top_amount(display_total)))"
- "|%(join(note | xact.note))\n");
-
- next_lines_format.parse_format
- ("|"
- "|"
- "|%(has_tag(\"Payee\") ? payee : \"\")"
- "|%(cleared ? \"*\" : (pending ? \"!\" : \"\"))"
- "|%(display_account)"
- "|%(scrub(top_amount(display_amount)))"
- "|%(scrub(top_amount(display_total)))"
- "|%(join(note | xact.note))\n");
-
- amount_lines_format.parse_format
- ("|"
- "|"
- "|"
- "|"
- "|"
- "|%(scrub(next_amount))"
- "|%(scrub(next_total))"
- "|\n");
-
- if (_prepend_format)
- prepend_format.parse_format(*_prepend_format);
-
- TRACE_CTOR(posts_to_org_table, "report&, optional<string>");
-}
-
-void posts_to_org_table::flush()
-{
- report.output_stream.flush();
-}
-
-void posts_to_org_table::operator()(post_t& post)
-{
- if (! post.has_xdata() ||
- ! post.xdata().has_flags(POST_EXT_DISPLAYED)) {
- std::ostream& out(report.output_stream);
-
- bind_scope_t bound_scope(report, post);
-
- if (! header_printed) {
- out << "|Date|Code|Payee|X|Account|Amount|Total|Note|\n"
- << "|-|\n"
- << "|||<20>|||<r>|<r>|<20>|\n";
- header_printed = true;
- }
-
- if (! report_title.empty()) {
- if (first_report_title)
- first_report_title = false;
- else
- out << '\n';
-
- value_scope_t val_scope(bound_scope, string_value(report_title));
- format_t group_title_format(report.HANDLER(group_title_format_).str());
-
- out << "|-|\n";
- out << '|' << group_title_format(val_scope);
- out << "|-|\n";
-
- report_title = "";
- }
-
- if (prepend_format)
- out << '|' << prepend_format(bound_scope);
-
- if (last_xact != post.xact) {
- out << first_line_format(bound_scope);
- last_xact = post.xact;
- }
- else if (last_post && last_post->date() != post.date()) {
- out << first_line_format(bound_scope);
- }
- else {
- out << next_lines_format(bound_scope);
- }
-
- value_t amt = expr_t("display_amount").calc(bound_scope).simplified();
- value_t tot = expr_t("display_total").calc(bound_scope).simplified();
-
- if (amt.type() == value_t::BALANCE || tot.type() == value_t::BALANCE) {
- balance_t amt_bal(amt.to_balance());
- balance_t tot_bal(tot.to_balance());
- balance_t::amounts_map::const_iterator i = amt_bal.amounts.begin();
- balance_t::amounts_map::const_iterator j = tot_bal.amounts.begin();
- bool first = true;
- while (i != amt_bal.amounts.end() || j != tot_bal.amounts.end()) {
- if (first) {
- first = false;
- if (i != amt_bal.amounts.end()) ++i;
- if (j != tot_bal.amounts.end()) ++j;
- } else {
- symbol_scope_t call_scope(bound_scope);
- bool assigned = false;
-
- if (i != amt_bal.amounts.end()) {
- if ((*i).second) {
- DEBUG("org.next_amount", "next_amount = " << (*i).second);
- call_scope.define(symbol_t::FUNCTION, "next_amount",
- expr_t::op_t::wrap_value((*i++).second));
- assigned = true;
- } else {
- call_scope.define(symbol_t::FUNCTION, "next_amount",
- expr_t::op_t::wrap_value(string_value("")));
- ++i;
- }
- } else {
- call_scope.define(symbol_t::FUNCTION, "next_amount",
- expr_t::op_t::wrap_value(string_value("")));
- }
-
- if (j != tot_bal.amounts.end()) {
- if ((*j).second) {
- DEBUG("org.next_total", "next_total = " << (*j).second);
- call_scope.define(symbol_t::FUNCTION, "next_total",
- expr_t::op_t::wrap_value((*j++).second));
- DEBUG("org.next_total", "2.next_total = " <<
- call_scope.lookup(symbol_t::FUNCTION,
- "next_total")->as_value());
- assigned = true;
- } else {
- call_scope.define(symbol_t::FUNCTION, "next_total",
- expr_t::op_t::wrap_value(string_value("")));
- ++j;
- }
- } else {
- call_scope.define(symbol_t::FUNCTION, "next_total",
- expr_t::op_t::wrap_value(string_value("")));
- }
-
- if (assigned) {
- amount_lines_format.mark_uncompiled();
- out << amount_lines_format(call_scope);
- }
- }
- }
- }
-
- post.xdata().add_flags(POST_EXT_DISPLAYED);
- last_post = &post;
- }
-}
-
-} // namespace ledger
diff --git a/src/org.h b/src/org.h
deleted file mode 100644
index 9702297c..00000000
--- a/src/org.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2003-2018, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup data
- */
-
-/**
- * @file org.h
- * @author John Wiegley
- *
- * @ingroup data
- */
-#ifndef _ORG_H
-#define _ORG_H
-
-#include "chain.h"
-#include "format.h"
-
-namespace ledger {
-
-class xact_t;
-class post_t;
-class report_t;
-
-class posts_to_org_table : public item_handler<post_t>
-{
-protected:
- typedef std::list<xact_t *> xacts_list;
- typedef std::map<xact_t *, bool> xacts_present_map;
-
- report_t& report;
- format_t first_line_format;
- format_t next_lines_format;
- format_t amount_lines_format;
- format_t prepend_format;
- xact_t * last_xact;
- post_t * last_post;
- bool header_printed;
- bool first_report_title;
- string report_title;
-
-public:
- posts_to_org_table(report_t& _report,
- const optional<string>& _prepend_format = none);
- virtual ~posts_to_org_table() {
- TRACE_DTOR(posts_to_org_table);
- }
-
- virtual void flush();
- virtual void operator()(post_t& post);
-
- virtual void clear() {
- last_xact = NULL;
- last_post = NULL;
- header_printed = false;
- first_report_title = true;
- report_title = "";
-
- item_handler<post_t>::clear();
- }
-};
-
-} // namespace ledger
-
-#endif // _ORG_H
diff --git a/src/report.cc b/src/report.cc
index 13e6a61f..cc165184 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -48,7 +48,6 @@
#include "convert.h"
#include "ptree.h"
#include "emacs.h"
-#include "org.h"
namespace ledger {
@@ -1672,11 +1671,6 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
if (is_eq(p, "lisp"))
return POSTS_REPORTER(new format_emacs_posts(output_stream));
break;
- case 'o':
- if (is_eq(p, "org"))
- return POSTS_REPORTER(new posts_to_org_table
- (*this, maybe_format(HANDLER(prepend_format_))));
- break;
case 'p':
if (*(p + 1) == '\0' || is_eq(p, "print")) {
diff --git a/src/select.cc b/src/select.cc
index 187387d8..a6eeee09 100644
--- a/src/select.cc
+++ b/src/select.cc
@@ -421,8 +421,6 @@ value_t select_command(call_scope_t& args)
}
else if (arg == "emacs") {
}
- else if (arg == "org") {
- }
}
++m1;
diff --git a/test/baseline/cmd-org.test b/test/baseline/cmd-org.test
deleted file mode 100644
index 12a380f5..00000000
--- a/test/baseline/cmd-org.test
+++ /dev/null
@@ -1,28 +0,0 @@
-2012-03-24 * Test 2
- ; Payee: Test 3
- C 20.00 EUR
- D
-
-2012-03-25 * (99) Test 4
- E 30.00 GBP
- F
-
-2012-03-26 * (test) Test 5
- G 1 AAA @ $10.00
- H
-
-test org
-|Date|Code|Payee|X|Account|Amount|Total|Note|
-|-|
-|||<20>|||<r>|<r>|<20>|
-|12-Mar-24||Test 3|*|C|20.00 EUR|20.00 EUR| Payee: Test 3
-|||Test 3|*|D|-20.00 EUR|0.00 EUR| Payee: Test 3
-|12-Mar-25|99|Test 4|*|E|30.00 GBP|30.00 GBP|
-||||*|F|-30.00 GBP|0.00 GBP|
-|12-Mar-26|test|Test 5|*|G|1 AAA|0.00 GBP|
-|||||||1 AAA|
-||||*|H|$-10|0.00 GBP|
-|||||||$-10|
-|||||||1 AAA|
-end test
-