really hacky works cited page

This commit is contained in:
Christian Genco 2015-04-06 15:21:18 -05:00
parent e52d96c5e3
commit e059e0dd41
4 changed files with 60 additions and 24 deletions

View File

@ -39,6 +39,23 @@ styles =
font: 'Times-Italic'
strong:
font: 'Times-Bold'
h1:
font: 'Times-Bold'
h2:
font: 'Times-Italic'
h3:
font: 'Times-Bold'
align: 'center'
h4:
font: 'Times-Italic'
align: 'center'
h5:
underline: true
citationHeader:
align: 'center'
citation:
indent: -72/2
marginLeft: 72/2
# syntax highlighting colors
# based on Github's theme
@ -79,25 +96,12 @@ class Node
@text = tree
return
# console.dir tree
@type = tree.shift()
# @attrs = {}
@style = _.extend({}, styles.default, styles[@type])
@attrs = {}
if typeof tree[0] is 'object' and not Array.isArray tree[0]
@attrs = tree.shift()
# parse sub nodes
@content = while tree.length
child = new Node tree.shift()
# blockquotes have an embedded paragraph; make sure the inner paragraph doesn't re-define
# its indentation
child.style?.indent = @style.indent if @style.indent?
child
console.log "content =", @content
# console.log "type =", @type
switch @type
when 'header'
@type = 'h' + @attrs.level
@ -126,6 +130,20 @@ class Node
@code = coffee.compile code if code
@height = +@attrs.title or 0
@style = _.extend({}, styles.default, styles[@type])
# parse sub nodes
@content = while tree.length
child = new Node tree.shift()
# blockquotes have an embedded paragraph; make sure the inner paragraph doesn't re-define
# its indentation
child.style?.indent = @style.indent if @style.indent?
child
console.log "content =", @content
# console.log "type =", @type
# sets the styles on the document for this node
setStyle: (doc) ->
if @style.font
@ -212,19 +230,29 @@ render = (doc, filename) ->
console.log tree
tree.shift() # ignore 'markdown' first element
onWorksCited = false
while tree.length
node = new Node tree.shift()
node = new Node(tree.shift())
console.log "node =", node
if node.type == "h1" && node.content?.first()?.text?.toLowerCase() == "works cited"
onWorksCited = true
node.style = _.extend({}, styles.default, styles.citationHeader)
if onWorksCited && node.type == "para"
node.style = _.extend({}, styles.default, styles.citation)
node.render(doc)
# add page numbers
range = doc.bufferedPageRange() # => { start: 0, count: 2 }
# todo: make more generic "draw text" function that sets the document properities based on provided styles
doc.font styles.default.font
for i in [range.start...range.start + range.count]
doc.switchToPage(i)
doc.y = 72/2
doc.x = 72
doc.text "#{metadata.lastName} #{i + 1}",
align: 'right'
doc.text "#{metadata.lastName} #{i + 1}", _.extend({}, styles.default, {align: 'right'})
doc.flushPages()
doc

BIN
guide.pdf

Binary file not shown.

View File

@ -6,13 +6,15 @@ title: Toward a Recovery of Nineteenth Century Farming Handbooks
While researching texts like *Harry Potter* and *Curious George* written about **nineteenth century farming**, I found a few "reliable" authors who published books about the literature of nineteenth century farming, particularly agricultural journals, newspapers, pamphlets, and brochures. These authors often placed the farming literature they were studying into an historical context by discussing the important events in agriculture of the year in which the literature was published (see Demaree, for example). However, while these authors discuss journals, newspapers, pamphlets, and brochures, I could not find much discussion about another important source of farming knowledge: farming handbooks. My goal in this paper is to bring this source into the agricultural literature discussion by connecting three agricultural handbooks from the nineteenth century with nineteenth century agricultural history.
# Heading
# Heading 1
## Subheading
## Heading 2
### Sub-sub heading
### Heading 3
#### Sub-sub-sub heading
#### Heading 4
##### Heading 5
To achieve this goal, I have organized my paper into four main sections, two of which have sub-sections. In the first section, I provide an account of three important events in nineteenth century agricultural history: population and technological changes, the distribution of scientific new knowledge, and farming's influence on education. In the second section, I discuss three nineteenth century farming handbooks in connection with the important events described in the first section. I end my paper with a third section that offers research questions that could be answered in future versions of this paper and conclude with a fourth section that discusses the importance of expanding this particular project. I also include an appendix after the Works Cited that contains images of the three handbooks I examined. Before I can begin the examination of the three handbooks, however, I need to provide an historical context in which the books were written, and it is to this that I now turn.
@ -21,4 +23,12 @@ By the 1860s, the need for this knowledge was strong enough to affect education.
> Perhaps it would be well, if some institution were devised, and supported at the expense of the State, which would be so organized as would tend most effectually to produce a due degree of emulation among Farmers, by rewards and honorary distinctions conferred by those who, by their successful experimental efforts and improvements, should render themselves duly entitled to them. (92)
Here's my final paragraph.
Here's my final paragraph.
---
# Works Cited
Allen, R.L. *The American Farm Book; or Compend of American Agriculture; Being a Practical Treatise on Soils, Manures, Draining, Irrigation, Grasses, Grain, Roots, Fruits, Cotton, Tobacco, Sugar Cane, Rice, and Every Staple Product of the United States with the Best Methods of Planting, Cultivating, and Preparation for Market*. New York: Saxton, 1849. Print.
Baker, Gladys L., Wayne D. Rasmussen, Vivian Wiser, and Jane M. Porter. *Century of Service: The First 100 Years of the United States Department of Agriculture*. Federal Government, 1996. Print.

View File

@ -1,7 +1,5 @@
# Todo
* headings
* works cited page
* document name; embed document author
* pretty quotes?
* citations?