Esempio n. 1
0
def help_page(page_slug='_index'):
    """Fava's included documentation."""
    if page_slug not in app.config['HELP_PAGES']:
        abort(404)
    html = markdown2.markdown_path(os.path.join(resource_path('help'),
                                                page_slug + '.md'),
                                   extras=['fenced-code-blocks', 'tables'])
    return render_template('help.html',
                           page_slug=page_slug,
                           help_html=render_template_string(html))
Esempio n. 2
0
def help_page(page_slug='_index'):
    """Fava's included documentation."""
    if page_slug not in app.config['HELP_PAGES']:
        abort(404)
    html = markdown2.markdown_path(
        os.path.join(resource_path('help'), page_slug + '.md'),
        extras=['fenced-code-blocks', 'tables'])
    return render_template(
        'help.html',
        page_slug=page_slug,
        help_html=render_template_string(html))
Esempio n. 3
0
def help_page(page_slug="_index"):
    """Fava's included documentation."""
    if page_slug not in app.config["HELP_PAGES"]:
        abort(404)
    html = markdown2.markdown_path(
        os.path.join(resource_path("help"), page_slug + ".md"),
        extras=["fenced-code-blocks", "tables"],
    )
    return render_template(
        "_layout.html",
        active_page="help",
        page_slug=page_slug,
        help_html=render_template_string(html),
    )
Esempio n. 4
0
def help_page(page_slug):
    """Fava's included documentation."""
    if page_slug not in HELP_PAGES:
        abort(404)
    html = markdown2.markdown_path(
        (resource_path("help") / (page_slug + ".md")),
        extras=["fenced-code-blocks", "tables"],
    )
    return render_template(
        "_layout.html",
        active_page="help",
        page_slug=page_slug,
        help_html=render_template_string(html),
        HELP_PAGES=HELP_PAGES,
    )
Esempio n. 5
0
def help_page(page_slug: str) -> str:
    """Fava's included documentation."""
    if page_slug not in HELP_PAGES:
        abort(404)
    html = markdown2.markdown_path(
        (resource_path("help") / (page_slug + ".md")),
        extras=["fenced-code-blocks", "tables", "header-ids"],
    )
    return render_template(
        "_layout.html",
        active_page="help",
        page_slug=page_slug,
        help_html=Markup(
            render_template_string(
                html,
                beancount_version=beancount_version,
                fava_version=fava_version,
            )),
        HELP_PAGES=HELP_PAGES,
    )
Esempio n. 6
0
from fava import template_filters, LANGUAGES
from fava.core import FavaLedger
from fava.core.charts import FavaJSONEncoder
from fava.core.helpers import FavaAPIException
from fava.help import HELP_PAGES
from fava.json_api import json_api
from fava.serialisation import serialise
from fava.util import slugify, resource_path, setup_logging, send_file_inline
from fava.util.date import Interval
from fava.util.excel import HAVE_EXCEL

setup_logging()
app = Flask(  # pylint: disable=invalid-name
    __name__,
    template_folder=resource_path("templates"),
    static_folder=resource_path("static"),
)
app.register_blueprint(json_api, url_prefix="/<bfile>/api")

app.json_encoder = FavaJSONEncoder
app.jinja_options["extensions"].append("jinja2.ext.do")
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True

app.config["HAVE_EXCEL"] = HAVE_EXCEL
app.config["HELP_PAGES"] = HELP_PAGES
app.config["ACCOUNT_RE"] = ACCOUNT_RE

REPORTS = [
    "_context",
Esempio n. 7
0
from beancount.utils.text_utils import replace_numbers
from beancount.core.data import Document

from fava import template_filters
from fava.core import FavaLedger
from fava.core.charts import FavaJSONEncoder
from fava.core.helpers import FavaAPIException, FilterException
from fava.help import HELP_PAGES
from fava.json_api import json_api
from fava.util import slugify, resource_path, setup_logging
from fava.util.excel import HAVE_EXCEL

setup_logging()
app = Flask(  # pylint: disable=invalid-name
    __name__,
    template_folder=resource_path('templates'),
    static_folder=resource_path('static'))
app.register_blueprint(json_api, url_prefix='/<bfile>/api')

app.json_encoder = FavaJSONEncoder
app.jinja_options['extensions'].append('jinja2.ext.do')
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
# the key is currently only required to flash messages
app.secret_key = '1234'

app.config['HAVE_EXCEL'] = HAVE_EXCEL
app.config['HELP_PAGES'] = HELP_PAGES

REPORTS = [
    '_context',
Esempio n. 8
0
                   redirect, send_from_directory, g, send_file)
from flask_babel import Babel
import markdown2
import werkzeug.urls
from werkzeug import secure_filename
from beancount.core.number import Decimal

from fava import config
from fava.api import BeancountReportAPI
from fava.api.filters import FilterException
from fava.api.serialization import BeanJSONEncoder
from fava.util import slugify, resource_path
from fava.util.excel import to_csv, to_excel, HAVE_EXCEL

app = Flask(__name__,
            template_folder=resource_path('templates'),
            static_folder=resource_path('static'))

app.json_encoder = BeanJSONEncoder
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
# the key is currently only required to flash messages
app.secret_key = '1234'

app.config['DEFAULT_SETTINGS'] = resource_path('default-settings.conf')
app.config['USER_SETTINGS'] = None
app.config['HELP_DIR'] = resource_path('docs')
app.config['HAVE_EXCEL'] = HAVE_EXCEL
app.config['APIS'] = {}

Esempio n. 9
0
import werkzeug.urls
from werkzeug.utils import secure_filename
from beancount.utils.text_utils import replace_numbers

from fava import template_filters
from fava.core import FavaLedger
from fava.core.charts import FavaJSONEncoder
from fava.core.helpers import FavaAPIException, FilterException
from fava.docs import HELP_PAGES
from fava.json_api import json_api
from fava.util import slugify, resource_path
from fava.util.excel import HAVE_EXCEL

app = Flask(  # pylint: disable=invalid-name
    __name__,
    template_folder=resource_path('templates'),
    static_folder=resource_path('static'))
app.register_blueprint(json_api, url_prefix='/<bfile>/api')

app.json_encoder = FavaJSONEncoder
app.jinja_options['extensions'].append('jinja2.ext.do')
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
# the key is currently only required to flash messages
app.secret_key = '1234'

app.config['HELP_DIR'] = resource_path('docs')
app.config['HAVE_EXCEL'] = HAVE_EXCEL
app.config['HELP_PAGES'] = HELP_PAGES
app.config['LEDGERS'] = {}
Esempio n. 10
0
from fava.core import FavaLedger
from fava.core.charts import FavaJSONEncoder
from fava.core.documents import is_document_or_import_file
from fava.help import HELP_PAGES
from fava.helpers import FavaAPIException
from fava.json_api import json_api
from fava.serialisation import serialise
from fava.util import next_key
from fava.util import resource_path
from fava.util import send_file_inline
from fava.util import setup_logging
from fava.util import slugify
from fava.util.date import Interval
from fava.util.excel import HAVE_EXCEL

STATIC_FOLDER = resource_path("static")
setup_logging()
app = Flask(  # pylint: disable=invalid-name
    __name__,
    template_folder=str(resource_path("templates")),
    static_folder=str(STATIC_FOLDER),
)
app.register_blueprint(json_api, url_prefix="/<bfile>/api")

app.json_encoder = FavaJSONEncoder  # type: ignore
try:
    jinja_extensions = app.jinja_options.setdefault("extensions", [])
except TypeError:  # Flask <2
    jinja_extensions = app.jinja_options["extensions"]
jinja_extensions.append("jinja2.ext.do")
jinja_extensions.append("jinja2.ext.loopcontrols")
Esempio n. 11
0
from flask_babel import Babel
import markdown2
import werkzeug.urls
from werkzeug import secure_filename
from beancount.core.number import Decimal

from fava import config
from fava.api import BeancountReportAPI
from fava.api.filters import FilterException
from fava.api.serialization import BeanJSONEncoder
from fava.util import slugify, resource_path
from fava.util.excel import to_csv, to_excel, HAVE_EXCEL


app = Flask(__name__,
            template_folder=resource_path('templates'),
            static_folder=resource_path('static'))

app.json_encoder = BeanJSONEncoder
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
# the key is currently only required to flash messages
app.secret_key = '1234'

app.config['DEFAULT_SETTINGS'] = resource_path('default-settings.conf')
app.config['USER_SETTINGS'] = None
app.config['HELP_DIR'] = resource_path('docs')
app.config['HAVE_EXCEL'] = HAVE_EXCEL
app.config['APIS'] = {}

Esempio n. 12
0
from beancount.core.number import D
from beancount.query import query_compile, query_parser
from beancount.scripts.format import align_beancount

from fava import template_filters, util
from fava.api import (BeancountReportAPI, FavaAPIException,
                      FavaFileNotFoundException)
from fava.api.file import insert_transaction
from fava.api.filters import FilterException
from fava.api.charts import BeanJSONEncoder
from fava.docs import HELP_PAGES
from fava.util import slugify, resource_path
from fava.util.excel import to_csv, to_excel, HAVE_EXCEL

app = Flask(__name__,  # pylint: disable=invalid-name
            template_folder=resource_path('templates'),
            static_folder=resource_path('static'))

app.json_encoder = BeanJSONEncoder
app.jinja_options['extensions'].append('jinja2.ext.do')
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
# the key is currently only required to flash messages
app.secret_key = '1234'

app.config['HELP_DIR'] = resource_path('docs')
app.config['HAVE_EXCEL'] = HAVE_EXCEL
app.config['HELP_PAGES'] = HELP_PAGES
app.config['APIS'] = {}

REPORTS = [
Esempio n. 13
0
from fava import template_filters
from fava.core import FavaLedger
from fava.core.charts import FavaJSONEncoder
from fava.core.helpers import FavaAPIException
from fava.help import HELP_PAGES
from fava.json_api import json_api
from fava.serialisation import serialise
from fava.util import slugify, resource_path, setup_logging, send_file_inline
from fava.util.date import Interval
from fava.util.excel import HAVE_EXCEL


setup_logging()
app = Flask(  # pylint: disable=invalid-name
    __name__,
    template_folder=resource_path('templates'),
    static_folder=resource_path('static'))
app.register_blueprint(json_api, url_prefix='/<bfile>/api')

app.json_encoder = FavaJSONEncoder
app.jinja_options['extensions'].append('jinja2.ext.do')
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True

app.config['HAVE_EXCEL'] = HAVE_EXCEL
app.config['HELP_PAGES'] = HELP_PAGES
app.config['ACCOUNT_RE'] = ACCOUNT_RE

REPORTS = [
    '_context',
    'balance_sheet',