Skip to content

Commit

Permalink
book is better
Browse files Browse the repository at this point in the history
  • Loading branch information
rreece committed Oct 28, 2023
1 parent 0ce93d2 commit 95adc0a
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 178 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
with:
python-version: "3.10"

- name: Run make install_for_linux
run: make install_for_linux
- name: Run make install_for_ubuntu
run: make install_for_ubuntu

- name: Run make html
run: make html
Expand Down
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@ SHELL := /bin/bash
## helpers and settings
##-----------------------------------------------------------------------------

DATE_NOW := $(shell date +"%B %-d, %Y")
## parse meta.yaml
DOC_TITLE := $(shell grep '^title:' meta.yaml | head -n1 | sed -e 's/title:[[:space:]]*//' | tr -d "'" | tr -d '"')
TEMPLATE_HTML := $(shell grep '^template_html:' meta.yaml | head -n1 | sed -e 's/template_html:[[:space:]]*//' | tr -d "'" | tr -d '"')
TEMPLATE_TEX := $(shell grep '^template_tex:' meta.yaml | head -n1 | sed -e 's/template_tex:[[:space:]]*//' | tr -d "'" | tr -d '"')
BACKMATTER_MD := $(shell grep '^backmatter_md:' meta.yaml | head -n1 | sed -e 's/backmatter_md:[[:space:]]*//' | tr -d "'" | tr -d '"')
BACKMATTER_TEX := $(shell grep '^backmatter_tex:' meta.yaml | head -n1 | sed -e 's/backmatter_tex:[[:space:]]*//' | tr -d "'" | tr -d '"')
OUTPUT := $(shell grep '^output:' meta.yaml | head -n1 | sed -e 's/output:[[:space:]]*//' | tr -d "'" | tr -d '"')

## set fixed variables
DATE_NOW := $(shell date +"%B %-d, %Y")
MD_FILES := $(filter-out README.md LICENSE.md VERSIONS.md, $(sort $(wildcard *.md)))
HTML_FILES := $(MD_FILES:%.md=%.html)
BIB_OPTIONS := --bibliography=bibs/mybib.bib --citeproc
BIB_TXT_FILES := $(sort $(wildcard bibs/*.txt))

## helpers ran within targets
PAGE_TITLE = $(shell (grep -e '^\#' $< | head -n1 | sed -e 's/^\#[[:space:]]*//')||(grep -B1 '====' $< | head -n1))
PRINT = @echo '==> '

Expand All @@ -32,13 +35,13 @@ PRINT = @echo '==> '
## main targets
##-----------------------------------------------------------------------------

.PHONY: all default html pdf install install_for_linux install_for_mac clean realclean
.PHONY: all default html pdf install install_for_ubuntu install_for_mac clean realclean

default: html
all: html pdf
html: $(HTML_FILES)
pdf: $(OUTPUT).pdf
install: install_for_linux
install: install_for_ubuntu


##-----------------------------------------------------------------------------
Expand Down Expand Up @@ -87,7 +90,7 @@ $(OUTPUT).tex: $(MDP_FILES) bibs/mybib.bib meta.yaml
bibs/mybib.bib: $(BIB_TXT_FILES)
@if [ -z "$(BIB_TXT_FILES)" ] ; \
then \
echo "==> ERROR: No bibliography files found in bibs/. Set dorefs=false in meta.yaml." ; \
echo "==> ERROR: No bibliography files found in bibs/." ; \
exit 1 ; \
else \
python scripts/markdown2bib.py --out=bibs/mybib.bib $(BIB_TXT_FILES) ; \
Expand Down Expand Up @@ -120,8 +123,8 @@ over: realclean default
## See: https://askubuntu.com/questions/1335772/using-pandoc-crossref-on-ubuntu-20-04
##-----------------------------------------------------------------------------

install_for_linux:
@echo "Installing for linux..." ; \
install_for_ubuntu:
@echo "Installing for ubuntu..." ; \
sudo apt-get -y update ; \
if [ ! -f /usr/bin/pdflatex ]; then \
echo "Installing texlive..." ; \
Expand Down
71 changes: 29 additions & 42 deletions meta-book.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,8 @@ output: example
title: markdown-memo example document
titleshort: markdown-memo example document
subtitle: make writing easier and more productive
authorshort: R. Reece and J. Coauthor
author1: Ryan Reece
email1: [email protected]
homepage1: http://rreece.github.io
affiliation1: University of California, Santa Cruz
author2: Jane Coauthor
email2: [email protected]
homepage2: http://jane.blah.com
affiliation2: Joe University
#author3: Joe Coauthor
#email3: [email protected]
#homepage3: http://joe.blah.com
#affiliation3: Joe University
author:
- |
[Ryan Reece](http://rreece.github.io/)[^ReeceSCIPP]
[^ReeceSCIPP]: University of California, Santa Cruz / <[email protected]> / <http://rreece.github.io>
- |
Jane Coauthor[^Jane]
[^Jane]: Joe University, Joeville / <[email protected]> / <http://jane.joe.edu>
# - |
# Joe Coauthor[^Joe]
#
# [^Joe]: Joe University, Joeville / <[email protected]> / <http://joe.joe.edu>
author: Ryan Reece
authorshort: R. Reece

## optional -----------------------------------------------
abstract: |
Expand All @@ -43,19 +19,29 @@ keywords: academic writing, blogging, digital humanities, LaTeX, Markdown, open
#citation-style: templates/apa-no-doi-no-issue-with-notes.csl
citation-style: templates/chicago-author-date.csl
#date: "January 1, 2017"
#docid: EXAMPLE-DOC-000
draft: true # used with fancyhdr
#license: '&copy; 2015-2023 [Ryan Reece](http://rreece.github.io/). All rights reserved.'
#license: '<span class="copy-left">&copy;</span> 2015-2023 [Ryan Reece](http://rreece.github.io/). Licensed for sharing under [CC-BY-4.0](http://creativecommons.org/licenses/by/4.0/).'
#dorefs: true # TODO: needed?
#submitted: 'Submitted to My Favorite Journal'
#submitted: 'Journal reference: *Phys. Rev. D 92*, 072001 (2015)'
#figureTitle: "Figure"
#tableTitle: "Table"
#figPrefix: "Figure"
#eqnPrefix: "eq."
#secPrefix: "Section"
#tblPrefix: "Table"
copyright: '\copyright 2023 Ryan Reece. All rights reserved.'
copycredits: |
To request permissions, contact [email protected]
First printing edition 2023.
Cover art by Artist.
ISBN: 978-0-19-123456-1
publisher: 'My Publishing Co.'
preface: |
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Commodo nulla facilisi nullam vehicula ipsum. Quisque non tellus orci ac. Diam sollicitudin tempor id eu nisl nunc. Auctor eu augue ut lectus arcu bibendum at varius. Scelerisque eleifend donec pretium vulputate sapien nec sagittis. Volutpat maecenas volutpat blandit aliquam etiam erat velit scelerisque. Et malesuada fames ac turpis egestas integer eget. Sit amet consectetur adipiscing elit. Netus et malesuada fames ac turpis. Sit amet est placerat in egestas erat imperdiet sed. Vestibulum lorem sed risus ultricies tristique nulla aliquet.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Commodo nulla facilisi nullam vehicula ipsum. Quisque non tellus orci ac. Diam sollicitudin tempor id eu nisl nunc. Auctor eu augue ut lectus arcu bibendum at varius. Scelerisque eleifend donec pretium vulputate sapien nec sagittis. Volutpat maecenas volutpat blandit aliquam etiam erat velit scelerisque. Et malesuada fames ac turpis egestas integer eget. Sit amet consectetur adipiscing elit. Netus et malesuada fames ac turpis. Sit amet est placerat in egestas erat imperdiet sed. Vestibulum lorem sed risus ultricies tristique nulla aliquet.
Eu augue ut lectus arcu bibendum at varius vel pharetra. Viverra adipiscing at in tellus integer feugiat scelerisque varius morbi. Eu ultrices vitae auctor eu augue ut lectus. Sed id semper risus in. Odio eu feugiat pretium nibh. In nibh mauris cursus mattis molestie a iaculis. Potenti nullam ac tortor vitae purus faucibus ornare. Tortor posuere ac ut consequat semper viverra. Scelerisque purus semper eget duis. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce ut. Nisi scelerisque eu ultrices vitae auctor eu augue ut lectus.
#figureTitle: 'Figure'
#tableTitle: 'Table'
#figPrefix: 'Figure'
#eqnPrefix: 'eq.'
#secPrefix: 'Section'
#tblPrefix: 'Table'

## html options -------------------------------------------
template_html: 'templates/book_chapter.html'
Expand All @@ -81,14 +67,14 @@ classoption:
- 'letterpaper'
- 'openright'
- 'twoside'
fancyhdr: false
fancyhdr: true
fontsize: '11pt'
fontfamily: 'mathpazo'
geometry:
- 'paperwidth=8.5in'
- 'paperheight=11in'
- 'top=1in'
- 'bottom=1in'
- 'top=1.25in'
- 'bottom=1.25in'
- 'left=1.25in'
- 'right=1.25in'
- 'headheight=14pt'
Expand All @@ -97,7 +83,8 @@ hyperref: true
#linestretch: '1.1'
lof: false
lot: false
maketitle: true
makecoverpage: true
maketitlepage: true
numbersections: true
parskip: '11pt'
secnewpage: false
Expand Down
12 changes: 6 additions & 6 deletions meta-paper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ citation-style: templates/chicago-author-date.csl
#submitted: ''
#submitted: 'Submitted to My Favorite Journal'
#submitted: 'Journal reference: *Phys. Rev. D 92*, 072001 (2015)'
#figureTitle: "Figure"
#tableTitle: "Table"
#figPrefix: "Figure"
#eqnPrefix: "eq."
#secPrefix: "Section"
#tblPrefix: "Table"
#figureTitle: 'Figure'
#tableTitle: 'Table'
#figPrefix: 'Figure'
#eqnPrefix: 'eq.'
#secPrefix: 'Section'
#tblPrefix: 'Table'

## html options -------------------------------------------
template_html: 'templates/book_chapter.html'
Expand Down
71 changes: 29 additions & 42 deletions meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,8 @@ output: example
title: markdown-memo example document
titleshort: markdown-memo example document
subtitle: make writing easier and more productive
authorshort: R. Reece and J. Coauthor
author1: Ryan Reece
email1: [email protected]
homepage1: http://rreece.github.io
affiliation1: University of California, Santa Cruz
author2: Jane Coauthor
email2: [email protected]
homepage2: http://jane.blah.com
affiliation2: Joe University
#author3: Joe Coauthor
#email3: [email protected]
#homepage3: http://joe.blah.com
#affiliation3: Joe University
author:
- |
[Ryan Reece](http://rreece.github.io/)[^ReeceSCIPP]
[^ReeceSCIPP]: University of California, Santa Cruz / <[email protected]> / <http://rreece.github.io>
- |
Jane Coauthor[^Jane]
[^Jane]: Joe University, Joeville / <[email protected]> / <http://jane.joe.edu>
# - |
# Joe Coauthor[^Joe]
#
# [^Joe]: Joe University, Joeville / <[email protected]> / <http://joe.joe.edu>
author: Ryan Reece
authorshort: R. Reece

## optional -----------------------------------------------
abstract: |
Expand All @@ -43,19 +19,29 @@ keywords: academic writing, blogging, digital humanities, LaTeX, Markdown, open
#citation-style: templates/apa-no-doi-no-issue-with-notes.csl
citation-style: templates/chicago-author-date.csl
#date: "January 1, 2017"
#docid: EXAMPLE-DOC-000
draft: true # used with fancyhdr
#license: '&copy; 2015-2023 [Ryan Reece](http://rreece.github.io/). All rights reserved.'
#license: '<span class="copy-left">&copy;</span> 2015-2023 [Ryan Reece](http://rreece.github.io/). Licensed for sharing under [CC-BY-4.0](http://creativecommons.org/licenses/by/4.0/).'
#dorefs: true # TODO: needed?
#submitted: 'Submitted to My Favorite Journal'
#submitted: 'Journal reference: *Phys. Rev. D 92*, 072001 (2015)'
#figureTitle: "Figure"
#tableTitle: "Table"
#figPrefix: "Figure"
#eqnPrefix: "eq."
#secPrefix: "Section"
#tblPrefix: "Table"
copyright: '\copyright 2023 Ryan Reece. All rights reserved.'
copycredits: |
To request permissions, contact [email protected]
First printing edition 2023.
Cover art by Artist.
ISBN: 978-0-19-123456-1
publisher: 'My Publishing Co.'
preface: |
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Commodo nulla facilisi nullam vehicula ipsum. Quisque non tellus orci ac. Diam sollicitudin tempor id eu nisl nunc. Auctor eu augue ut lectus arcu bibendum at varius. Scelerisque eleifend donec pretium vulputate sapien nec sagittis. Volutpat maecenas volutpat blandit aliquam etiam erat velit scelerisque. Et malesuada fames ac turpis egestas integer eget. Sit amet consectetur adipiscing elit. Netus et malesuada fames ac turpis. Sit amet est placerat in egestas erat imperdiet sed. Vestibulum lorem sed risus ultricies tristique nulla aliquet.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Commodo nulla facilisi nullam vehicula ipsum. Quisque non tellus orci ac. Diam sollicitudin tempor id eu nisl nunc. Auctor eu augue ut lectus arcu bibendum at varius. Scelerisque eleifend donec pretium vulputate sapien nec sagittis. Volutpat maecenas volutpat blandit aliquam etiam erat velit scelerisque. Et malesuada fames ac turpis egestas integer eget. Sit amet consectetur adipiscing elit. Netus et malesuada fames ac turpis. Sit amet est placerat in egestas erat imperdiet sed. Vestibulum lorem sed risus ultricies tristique nulla aliquet.
Eu augue ut lectus arcu bibendum at varius vel pharetra. Viverra adipiscing at in tellus integer feugiat scelerisque varius morbi. Eu ultrices vitae auctor eu augue ut lectus. Sed id semper risus in. Odio eu feugiat pretium nibh. In nibh mauris cursus mattis molestie a iaculis. Potenti nullam ac tortor vitae purus faucibus ornare. Tortor posuere ac ut consequat semper viverra. Scelerisque purus semper eget duis. Et egestas quis ipsum suspendisse ultrices gravida dictum fusce ut. Nisi scelerisque eu ultrices vitae auctor eu augue ut lectus.
#figureTitle: 'Figure'
#tableTitle: 'Table'
#figPrefix: 'Figure'
#eqnPrefix: 'eq.'
#secPrefix: 'Section'
#tblPrefix: 'Table'

## html options -------------------------------------------
template_html: 'templates/book_chapter.html'
Expand All @@ -81,14 +67,14 @@ classoption:
- 'letterpaper'
- 'openright'
- 'twoside'
fancyhdr: false
fancyhdr: true
fontsize: '11pt'
fontfamily: 'mathpazo'
geometry:
- 'paperwidth=8.5in'
- 'paperheight=11in'
- 'top=1in'
- 'bottom=1in'
- 'top=1.25in'
- 'bottom=1.25in'
- 'left=1.25in'
- 'right=1.25in'
- 'headheight=14pt'
Expand All @@ -97,7 +83,8 @@ hyperref: true
#linestretch: '1.1'
lof: false
lot: false
maketitle: true
makecoverpage: true
maketitlepage: true
numbersections: true
parskip: '11pt'
secnewpage: false
Expand Down
Loading

0 comments on commit 95adc0a

Please sign in to comment.