Skip to content

Commit

Permalink
chore: Manually replace 'sourcecode' with 'code'
Browse files Browse the repository at this point in the history
* README looked bad on Github due to a regression
  in rendering `sourcecode` blocks:

  github/markup#1806

* {knitr} uses `sourcecode` when rendering `README.Rrst` files
  to `README.rst` so this is just a temporary fix.
  • Loading branch information
trevorld committed May 17, 2024
1 parent bb4f377 commit 1c8f8d3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v1

Expand Down
4 changes: 2 additions & 2 deletions README.Rrst
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ knitr::opts_chunk$set(fig.path = "man/figures/README-")
:target: https://github.com/trevorld/r-ledger/actions
:alt: R-CMD-check

.. image:: https://img.shields.io/codecov/c/github/trevorld/r-ledger/master.svg
:target: https://codecov.io/github/trevorld/r-ledger?branch=master
.. image:: https://codecov.io/github/trevorld/r-ledger/branch/master/graph/badge.svg
:target: https://app.codecov.io/github/trevorld/r-ledger?branch=master
:alt: Coverage Status

.. image:: https://cranlogs.r-pkg.org/badges/ledger
Expand Down
52 changes: 26 additions & 26 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ ledger
:target: https://github.com/trevorld/r-ledger/actions
:alt: R-CMD-check

.. image:: https://img.shields.io/codecov/c/github/trevorld/r-ledger/master.svg
:target: https://codecov.io/github/trevorld/r-ledger?branch=master
.. image:: https://codecov.io/github/trevorld/r-ledger/branch/master/graph/badge.svg
:target: https://app.codecov.io/github/trevorld/r-ledger?branch=master
:alt: Coverage Status

.. image:: https://cranlogs.r-pkg.org/badges/ledger
Expand Down Expand Up @@ -82,7 +82,7 @@ register
Here are some examples of very basic files stored within the package:


.. sourcecode:: r
.. code:: r
library("ledger")
Expand All @@ -109,7 +109,7 @@ Here are some examples of very basic files stored within the package:
## # … with 32 more rows


.. sourcecode:: r
.. code:: r
hledger_file <- system.file("extdata", "example.hledger", package = "ledger")
Expand All @@ -134,7 +134,7 @@ Here are some examples of very basic files stored within the package:
## # … with 32 more rows


.. sourcecode:: r
.. code:: r
beancount_file <- system.file("extdata", "example.beancount", package = "ledger")
Expand Down Expand Up @@ -163,7 +163,7 @@ Here are some examples of very basic files stored within the package:
Here is an example reading in a beancount file generated by ``bean-example``:


.. sourcecode:: r
.. code:: r
bean_example_file <- tempfile(fileext = ".beancount")
Expand Down Expand Up @@ -191,7 +191,7 @@ Here is an example reading in a beancount file generated by ``bean-example``:
## # … with 3,320 more rows


.. sourcecode:: r
.. code:: r
suppressPackageStartupMessages(library("dplyr"))
Expand Down Expand Up @@ -228,7 +228,7 @@ Using rio::import and rio::convert
If one has loaded in the ``ledger`` package one can also use ``rio::import`` to read in the register:


.. sourcecode:: r
.. code:: r
df2 <- rio::import(bean_example_file)
Expand All @@ -254,7 +254,7 @@ net_worth
Some examples of using the ``net_worth`` function using the example files from the ``register`` examples:


.. sourcecode:: r
.. code:: r
dates <- seq(as.Date("2016-01-01"), as.Date("2018-01-01"), by="years")
Expand All @@ -271,7 +271,7 @@ Some examples of using the ``net_worth`` function using the example files from t
## 3 2018-01-01 USD 6743. 6264 -521. 1000


.. sourcecode:: r
.. code:: r
net_worth(hledger_file, dates)
Expand All @@ -287,7 +287,7 @@ Some examples of using the ``net_worth`` function using the example files from t
## 3 2018-01-01 USD 6743. 7264 -521.


.. sourcecode:: r
.. code:: r
net_worth(beancount_file, dates)
Expand All @@ -303,7 +303,7 @@ Some examples of using the ``net_worth`` function using the example files from t
## 3 2018-01-01 USD 6743. 7264 -521.


.. sourcecode:: r
.. code:: r
net_worth(bean_example_file, dates)
Expand All @@ -322,7 +322,7 @@ prune_coa
Some examples using the ``prune_coa`` function to simplify the "Chart of Account" names to a given maximum depth:


.. sourcecode:: r
.. code:: r
suppressPackageStartupMessages(library("dplyr"))
Expand Down Expand Up @@ -350,7 +350,7 @@ Some examples using the ``prune_coa`` function to simplify the "Chart of Account
## 11 Liabilities USD -2248.


.. sourcecode:: r
.. code:: r
df %>% prune_coa(2) %>%
Expand Down Expand Up @@ -393,7 +393,7 @@ beancount example generated by ``bean-example``.
First we load the (mainly tidyverse) libraries we'll be using and adjusting terminal output:


.. sourcecode:: r
.. code:: r
options(width=240) # tibble output looks better in wide terminal output
Expand All @@ -414,7 +414,7 @@ First we load the (mainly tidyverse) libraries we'll be using and adjusting term
Then we'll write some convenience functions we'll use over and over again:


.. sourcecode:: r
.. code:: r
print_tibble_rows <- function(df) {
Expand All @@ -440,7 +440,7 @@ Basic balance sheets
Here is some basic balance sheets (using the market value of our assets):


.. sourcecode:: r
.. code:: r
print_balance_sheet <- function(df) {
Expand All @@ -464,7 +464,7 @@ Here is some basic balance sheets (using the market value of our assets):
## 3 2021-11-12 VACHR 15 15 0


.. sourcecode:: r
.. code:: r
print_balance_sheet(prune_coa(df, 2))
Expand All @@ -482,7 +482,7 @@ Here is some basic balance sheets (using the market value of our assets):
## 1 Liabilities:US USD -2421.


.. sourcecode:: r
.. code:: r
print_balance_sheet(df)
Expand All @@ -509,7 +509,7 @@ Basic net worth chart
Here is a basic chart of one's net worth from the beginning of the plaintext accounting file to today by month:


.. sourcecode:: r
.. code:: r
next_month <- function(date) {
Expand All @@ -529,7 +529,7 @@ Basic income sheets
~~~~~~~~~~~~~~~~~~~


.. sourcecode:: r
.. code:: r
month_cutoff <- zoo::as.yearmon(Sys.Date()) - 2/12
Expand Down Expand Up @@ -583,7 +583,7 @@ Basic income sheets
## 3 USD net 2028. 1826. 2413.


.. sourcecode:: r
.. code:: r
print_income(prune_coa(df, 2))
Expand All @@ -597,7 +597,7 @@ Basic income sheets
## 1 Income:US USD 9437. 9279. 4640.


.. sourcecode:: r
.. code:: r
print_expenses(prune_coa(df, 2))
Expand All @@ -616,7 +616,7 @@ Basic income sheets
## 6 Expenses:Transport USD 120 120 0


.. sourcecode:: r
.. code:: r
print_income(df)
Expand All @@ -632,7 +632,7 @@ Basic income sheets
## 3 Income:US:Hoogle:Salary USD 9231. 9231. 4615.


.. sourcecode:: r
.. code:: r
print_expenses(df)
Expand Down Expand Up @@ -668,7 +668,7 @@ Basic income sheets
And here is a plot of income, expenses, and net income over time:


.. sourcecode:: r
.. code:: r
ggplot(compute_total(df), aes(x=yearmon, y=amount, group=commodity, colour=commodity)) +
Expand Down

0 comments on commit 1c8f8d3

Please sign in to comment.