-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create single page html for use on ebook readers #28
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
preprocessed/ | ||
beancount.html |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
CHAPTERS= \ | ||
index.md \ | ||
command_line_accounting_in_context.md \ | ||
the_double_entry_counting_method.md \ | ||
installing_beancount.md \ | ||
running_beancount_and_generating_reports.md \ | ||
getting_started_with_beancount.md \ | ||
beancount_language_syntax.md \ | ||
beancount_options_reference.md \ | ||
precision_tolerances.md \ | ||
beancount_query_language.md \ | ||
beancount_cheat_sheet.md \ | ||
how_inventories_work.md \ | ||
exporting_your_portfolio.md \ | ||
tutorial_example.md \ | ||
beancount_history_and_credits.md \ | ||
a_comparison_of_beancount_and_ledger_hledger.md \ | ||
fetching_prices_in_beancount.md \ | ||
importing_external_data.md \ | ||
command_line_accounting_cookbook.md \ | ||
trading_with_beancount.md \ | ||
stock_vesting_in_beancount.md \ | ||
sharing_expenses_with_beancount.md \ | ||
how_we_share_expenses.md \ | ||
health_care_expenses.md \ | ||
calculating_portolio_returns.md \ | ||
beancount_scripting_plugins.md \ | ||
beancount_design_doc.md \ | ||
ledgerhub_design_doc.md \ | ||
external_contributions.md \ | ||
a_proposal_for_an_improvement_on_inventory_booking.md \ | ||
settlement_dates_in_beancount.md \ | ||
balance_assertions_in_beancount.md \ | ||
fund_accounting_with_beancount.md \ | ||
rounding_precision_in_beancount.md \ | ||
beancount_v3.md \ | ||
installing_beancount_v3.md \ | ||
beancount_v3_dependencies.md | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to read the chapter list from index.json? Maybe this makefile can be replaced with a shorter python script There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great catch! Also I agree about the short py script, I just needed to get stuff done. I will have some time a few weeks later, I'll try to get back to this, but also fell free to improve/reimplement it, if you have capacity. Thanks for the valuable feedback, and ideas! |
||
|
||
# CHAPTERS= \ | ||
# index.md \ | ||
# command_line_accounting_in_context.md \ | ||
# beancount_v3_dependencies.md | ||
|
||
DOCS_DIR=../docs | ||
PREPROCESSED_DIR=preprocessed | ||
|
||
SOURCES=$(foreach c,$(CHAPTERS),$(DOCS_DIR)/$c) | ||
PREPROCESSED=$(foreach c,$(CHAPTERS),preprocessed/$c) | ||
|
||
all: clean preprocess ebook | ||
|
||
clean: | ||
rm -rf "$(PREPROCESSED_DIR)" beancount.html | ||
|
||
$(PREPROCESSED_DIR): | ||
mkdir -p "$@" | ||
|
||
$(PREPROCESSED_DIR)/%.md: $(DOCS_DIR)/%.md $(PREPROCESSED_DIR) | ||
cp "$<" "$@" | ||
# cp -R $(basename $<) $(PREPROCESSED_DIR)/ || true | ||
sed -i -e 's@<a id="\(.*\)"></a>@<a id="$(notdir $<).\1"></a>@' $@ | ||
sed -i -e 's@](#\(.*\))@](#$(notdir $<).\1)@' $@ | ||
sed -i -e 's@](\(.*\.md\))@](#\1\.title)@' $@ | ||
|
||
preprocess: $(PREPROCESSED) | ||
@echo "Preprocess done!" | ||
|
||
ebook: beancount.html | ||
@echo "Ebook done!" | ||
|
||
beancount.html: preprocess | ||
pandoc \ | ||
--from markdown \ | ||
--to html \ | ||
--resource-path $(DOCS_DIR) \ | ||
--standalone \ | ||
--self-contained \ | ||
--metadata-file=metadata.yaml \ | ||
--output $@ \ | ||
$(PREPROCESSED) | ||
|
||
.PHONY: all preprocess clean ebook | ||
.DELETE_ON_ERROR: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: "Beancount User's Manual" | ||
# subtitle: "This is the subtitle" | ||
author: | ||
- Martin Blais | ||
# - Author Two | ||
# description: | | ||
# This is a long | ||
# description. | ||
|
||
# It consists of two paragraphs | ||
# ... | ||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First: this PR is just a PoC/hack. I needed this change because VS Code kept corrupting my makefiles, where the rule blocks are mandatorily starting with a single tab indent. I spent a few minutes trying to work this out, then simply issued this, as my goal was not fixing the VS Code editorconfig/makefile support, but generating beancount docs.
The problem root cause might be fixed upstream already.