From ca1fbe8793e96b3f1ad72fc4fb382660a94ed1f3 Mon Sep 17 00:00:00 2001 From: Ethan Reece Date: Thu, 26 Sep 2024 17:39:15 -0500 Subject: [PATCH] Add bibliography and citations --- README.md | 2 +- src/base/grid.typ | 4 ---- src/bibliography.yml | 14 +++++++++++++ src/content.typ | 2 +- src/page/essay.typ | 19 +++++++---------- src/page/essay/base/grid.typ | 4 ++++ src/page/essay/base/heading.typ | 10 +++++++++ src/page/essay/bibliography.typ | 16 ++++++++++++++ src/page/essay/bibliography/heading.typ | 8 +++++++ src/page/essay/content.typ | 28 +++++++++++++++++++++++++ src/page/essay/heading.typ | 4 ++-- src/page/essay/title.typ | 11 +++------- 12 files changed, 94 insertions(+), 28 deletions(-) delete mode 100644 src/base/grid.typ create mode 100644 src/bibliography.yml create mode 100644 src/page/essay/base/grid.typ create mode 100644 src/page/essay/base/heading.typ create mode 100644 src/page/essay/bibliography.typ create mode 100644 src/page/essay/bibliography/heading.typ create mode 100644 src/page/essay/content.typ diff --git a/README.md b/README.md index 33e299b..30b9492 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Notice: Uses *Liberation Serif*, a free font compatible with *Times New Roman*. -1. Modify `./src/properties.typ` for the heading and related components and `./src/content.typ` for the body. +1. Modify `./src/properties.typ` for the heading and related components, `./src/content.typ` for the body, and `./src/bibliography.yml` for the bibliography. 1. Install `just` by adding to your Guix Home configuration or running `guix install just`. diff --git a/src/base/grid.typ b/src/base/grid.typ deleted file mode 100644 index 85bf9d2..0000000 --- a/src/base/grid.typ +++ /dev/null @@ -1,4 +0,0 @@ -#let base_grid(..items) = grid( - gutter: 2em, - ..items -) diff --git a/src/bibliography.yml b/src/bibliography.yml new file mode 100644 index 0000000..32f0caf --- /dev/null +++ b/src/bibliography.yml @@ -0,0 +1,14 @@ +harry: + type: Book + title: Harry Potter and the Order of the Phoenix + author: Rowling, J. K. + volume: 5 + page-total: 768 + date: 2003-06-21 + +electronic: + type: Web + title: Ishkur's Guide to Electronic Music + serial-number: v2.5 + author: Ishkur + url: http://www.techno.org/electronic-music-guide/ diff --git a/src/content.typ b/src/content.typ index 521104d..55ca833 100644 --- a/src/content.typ +++ b/src/content.typ @@ -1,6 +1,6 @@ #{ "" } -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce congue elit ac rhoncus interdum. Morbi faucibus eros vitae suscipit pellentesque. Nam sit amet pharetra est, sed mattis magna. Aliquam sodales magna non auctor scelerisque. Donec ultricies ut magna vitae posuere. Aenean pellentesque ligula tortor, ac facilisis nibh accumsan ut. Quisque ullamcorper velit non dui varius, in tempor metus mattis. Sed in neque risus. Nullam pulvinar dolor eleifend ligula elementum mattis. Fusce nec metus id orci fermentum consectetur. Morbi placerat, urna nec posuere iaculis, nibh nisl consequat odio, nec commodo magna lacus vitae ante. Mauris ut pretium dui. Phasellus lacinia justo eu diam rutrum porttitor. +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce congue elit ac rhoncus interdum. Morbi faucibus eros vitae suscipit pellentesque. Nam sit amet pharetra est, sed mattis magna. Aliquam sodales magna non auctor scelerisque. Donec ultricies ut magna vitae posuere. Aenean pellentesque ligula tortor, ac facilisis nibh accumsan ut @electronic. Quisque ullamcorper velit non dui varius, in tempor metus mattis. Sed in neque risus. Nullam pulvinar dolor eleifend ligula elementum mattis. Fusce nec metus id orci fermentum consectetur. Morbi placerat, urna nec posuere iaculis, nibh nisl consequat odio, nec commodo magna lacus vitae ante. Mauris ut pretium dui. Phasellus lacinia justo eu diam rutrum porttitor @harry. Nullam et tellus nec lorem interdum luctus. Phasellus id purus a massa bibendum gravida vel ac lorem. Interdum et malesuada fames ac ante ipsum primis in faucibus. Vivamus metus tortor, congue eget dui non, pretium tempus arcu. Aliquam nulla diam, fermentum non finibus at, eleifend non orci. Aliquam enim lectus, laoreet nec euismod vel, bibendum non dui. Cras fermentum imperdiet dolor a eleifend. Nulla faucibus, nulla in feugiat dignissim, felis elit malesuada nisl, et interdum augue augue quis lorem. Nulla sagittis scelerisque tristique. Sed id euismod lectus. Etiam efficitur bibendum eros ut tempor. Sed lacinia elit lacus, molestie tempor risus euismod eu. Sed eu ullamcorper elit. Fusce iaculis, massa non ullamcorper hendrerit, dolor magna blandit eros, et rutrum lectus felis eget enim. diff --git a/src/page/essay.typ b/src/page/essay.typ index 524c869..a149488 100644 --- a/src/page/essay.typ +++ b/src/page/essay.typ @@ -10,23 +10,18 @@ ) = { import "../base/text.typ": base_text import "../base/page.typ": base_page - import "../base/grid.typ": base_grid import "essay/header.typ": page_essay_header - import "essay/heading.typ": page_essay_heading - import "essay/title.typ": page_essay_title - import "essay/body.typ": page_essay_body + import "essay/content.typ": page_essay_content base_text( base_page( header: page_essay_header(author_name_last: author_name.last), - base_grid( - page_essay_heading( - author_name: author_name, - instructor_name: instructor_name, - class: class, - ), - page_essay_title(title: title), - page_essay_body(content), + page_essay_content( + title: title, + author_name: author_name, + instructor_name: instructor_name, + class: class, + content ) ) ) diff --git a/src/page/essay/base/grid.typ b/src/page/essay/base/grid.typ new file mode 100644 index 0000000..91482f2 --- /dev/null +++ b/src/page/essay/base/grid.typ @@ -0,0 +1,4 @@ +#let page_essay_base_grid(..items) = grid( + gutter: 2em, + ..items +) diff --git a/src/page/essay/base/heading.typ b/src/page/essay/base/heading.typ new file mode 100644 index 0000000..f878f72 --- /dev/null +++ b/src/page/essay/base/heading.typ @@ -0,0 +1,10 @@ +#let page_essay_base_heading(title: "") = { + import "../../../base/text.typ": base_text + + align( + center, + heading( + base_text(title) + ) + ) +} diff --git a/src/page/essay/bibliography.typ b/src/page/essay/bibliography.typ new file mode 100644 index 0000000..45c1994 --- /dev/null +++ b/src/page/essay/bibliography.typ @@ -0,0 +1,16 @@ +#let page_essay_bibliography() = { + import "bibliography/heading.typ": page_essay_bibliography_heading + + set par( + leading: 2em, + hanging-indent: 0.5in, + ) + set block(spacing: 2em) + + bibliography( + style: "mla", + title: page_essay_bibliography_heading(), + full: true, + "../../bibliography.yml" + ) +} diff --git a/src/page/essay/bibliography/heading.typ b/src/page/essay/bibliography/heading.typ new file mode 100644 index 0000000..96a9317 --- /dev/null +++ b/src/page/essay/bibliography/heading.typ @@ -0,0 +1,8 @@ +#let page_essay_bibliography_heading(title: "") = { + import "../base/heading.typ": page_essay_base_heading + + block( + width: 100%, + page_essay_base_heading(title: "Works Cited") + ) +} diff --git a/src/page/essay/content.typ b/src/page/essay/content.typ new file mode 100644 index 0000000..cfe4541 --- /dev/null +++ b/src/page/essay/content.typ @@ -0,0 +1,28 @@ +#let page_essay_content( + title: "", + author_name: ( + first: "", + last: "", + ), + instructor_name: "", + class: "", + content +) = { + import "../../base/text.typ": base_text + import "base/grid.typ": page_essay_base_grid + import "title.typ": page_essay_title + import "heading.typ": page_essay_heading + import "body.typ": page_essay_body + import "bibliography.typ": page_essay_bibliography + + page_essay_base_grid( + page_essay_heading( + author_name: author_name, + instructor_name: instructor_name, + class: class, + ), + page_essay_title(title: title), + page_essay_body(content), + page_essay_bibliography(), + ) +} diff --git a/src/page/essay/heading.typ b/src/page/essay/heading.typ index d66d014..43bad90 100644 --- a/src/page/essay/heading.typ +++ b/src/page/essay/heading.typ @@ -6,13 +6,13 @@ instructor_name: "", class: "", ) = { - import "../../base/grid.typ": base_grid + import "base/grid.typ": page_essay_base_grid import "heading/author.typ": page_essay_heading_author import "heading/instructor.typ": page_essay_heading_instructor import "heading/class.typ": page_essay_heading_class import "heading/date.typ": page_essay_heading_date - base_grid( + page_essay_base_grid( page_essay_heading_author(name: author_name), page_essay_heading_instructor(name: instructor_name), page_essay_heading_class(identifier: class), diff --git a/src/page/essay/title.typ b/src/page/essay/title.typ index 8c0bc3f..0bef824 100644 --- a/src/page/essay/title.typ +++ b/src/page/essay/title.typ @@ -1,10 +1,5 @@ #let page_essay_title(title: "") = { - import "../../base/text.typ": base_text - - align( - center, - heading( - base_text(title) - ) - ) + import "base/heading.typ": page_essay_base_heading + + page_essay_base_heading(title: title) }