Skip to content

Commit

Permalink
apa header pages
Browse files Browse the repository at this point in the history
  • Loading branch information
christiangenco committed Apr 7, 2015
1 parent 415a3ee commit 2a1f265
Show file tree
Hide file tree
Showing 3 changed files with 318 additions and 0 deletions.
Binary file not shown.
44 changes: 44 additions & 0 deletions apa_paper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
author: Christian R. Genco
institution: Southern Methodist University
title: Varying Definitions of Online Communication and\nTheir Effects on Relationship Research
runninghead: VARYING DEFINITIONS OF ONLINE COMMUNICATION
abstract: This paper explores four published articles that report on results from research conducted on online (Internet) and offline (non-Internet) relationships and their relationship to computer-mediated communication (CMC). The articles, however, vary in their definitions and uses of CMC. Butler and Kraut (2002) suggest that face-to-face (FtF) interactions are more effective than CMC, defined and used as “email,” in creating feelings of closeness or intimacy. Other articles define CMC differently and, therefore, offer different results. This paper examines Cummings, Butler, and Kraut’s (2002) research in relation to three other research articles to suggest that all forms of CMC should be studied in order to fully understand how CMC influences online and offline relationships.
keywords: computer-mediated communication, face-to-face communication

Numerous studies have been conducted on various facets of Internet relationships, focusing on the levels of intimacy, closeness, different communication modalities, and the frequency of use of computer-mediated communication (CMC). However, contradictory results are suggested within this research because only certain aspects of CMC are investigated, for example, email only. Cummings, Butler, and Kraut (2002) suggest that face-to-face (FtF) interactions are more effective than CMC (read: email) in creating feelings of closeness or intimacy, while other studies suggest the opposite. To understand how both online (Internet) and offline (non-Internet) relationships are affected by CMC, all forms of CMC should be studied. This paper examines Cummings et al.’s research against other CMC research to propose that additional research be conducted to better understand how online communication affects relationships.

# Literature Review

In Cummings et al.’s (2002) summary article reviewing three empirical studies on online social relationships, it was found that CMC, especially email, was less effective than FtF contact in creating and maintaining close social relationships. Two of the three reviewed studies focusing on communication in non-Internet and Internet relationships mediated by FtF, phone, or email modalities found that the frequency of each modality’s use was significantly linked to the strength of the particular relationship (Cummings et al., 2002). The strength of the relationship was predicted best by FtF and phone communication, as participants rated email as an inferior means of maintaining personal relationships as compared to FtF and phone contacts (Cummings et al., 2002).

Cummings et al. (2002) reviewed an additional study conducted in 1999 by the HomeNet project (see Appendix A for more information on the HomeNet project). In this project, Kraut, Mukhopadhyay, Szczypula, Kiesler, and Scherlis (1999) compared the value of using CMC and non-CMC to maintain relationships with partners. They found that participants corresponded less frequently with their Internet partner (5.2 times per month) than with their non-Internet partner (7.2 times per month) (as cited in Cummings et al., 2002). This difference does not seem significant, as it is only two times less per month. However, in additional self-report surveys, participants responded feeling more distant, or less intimate, towards their Internet partner than their nonInternet partner. This finding may be attributed to participants’ beliefs that email is an inferior mode of personal relationship communication.

# Discussion

In 2002, Cummings et al. stated that the evidence from their research conflicted with other data examining the effectiveness of online social relationships. This statement is supported by the aforementioned discussion of other research. There may be a few possible theoretical explanations for these discrepancies.

## Limitations of These Studies

The discrepancies identified may result from a number of limitations found in the materials reviewed by Cummings et al. These limitations can result from technological constraints, demographic factors, or issues of modality. Each of these limitations will be examined in further detail below.

### Technological limitations.

First, one reviewed study by Cummings et al. (2002) examined only email correspondence for their CMC modality. Therefore, the study is limited to only one mode of communication among other alternatives, e.g., IM as studied by Hu et al. (2004). Because of its many personalized features, IM provides more personal CMC. For example, it is in real time without delay, voice-chat and video features are available for many IM programs, and text boxes can be personalized with the user’s picture, favorite colors and text, and a wide variety of emoticons, e.g., :). These options allow for both an increase in self-expression and the ability to overcompensate for the barriers of CMC through customizable features, as stated in Tidwell and Walther

---

# Conclusions and Future Study

In order to gain a complete understanding of CMC’s true effect on both online and offline relationships, it is necessary to conduct a study that examines all aspects of CMC. This includes, but is not limited to, email, IM, voice-chat, video-chat, online journals and diaries, online social groups with message boards, and chat rooms. The effects on relationships of each modality may be different, and this is demonstrated by the discrepancies in intimacy between email and IM correspondence. As each mode of communication becomes more prevalent in individuals’ lives, it is important to examine the impact of all modes of CMC on online and offline relationship formation, maintenance, and even termination

---

# References

Cummings, J. N., Butler, B., & Kraut, R. (2002). The quality of online social relationships. *Communications of the ACM, 45*(7), 103-108.

Hu, Y., Wood, J. F., Smith, V., & Westbrook, N. (2004). Friendships through IM: Examining the relationship between instant messaging and intimacy. *Journal of Computer-Mediated Communication, 10*, 38-48.

Tidwell, L. C., & Walther, J. B. (2002). Computer-mediated communication effects on disclosure, impressions, and interpersonal evaluations: Getting to know one another a bit at a time. *Human Communication Research, 28*, 317-348.

Underwood, H., & Findlay, B. (2004). Internet relationships and their impact on primary relationships. *Behaviour Change, 21*(2), 127-140.
274 changes: 274 additions & 0 deletions markdowntoapa.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
_ = require 'underscore'
md = require('markdown').markdown
coffee = require 'coffee-script'
PDFDocument = require 'pdfkit'

Array::first ?= -> @[0]

Array::last ?= -> @[@length - 1]

process.chdir(__dirname)

# style definitions for markdown
styles =
default:
font: 'Times-Roman'
fontSize: 12
lineGap: 14
align: 'left'
meta:
indent: 0
title:
align: 'center'
para:
indent: 72/2
blockquote:
indent: 0
marginLeft: 72
color: 'red'
font: 'Times-Italic'
em:
font: 'Times-Italic'
strong:
font: 'Times-Bold'
h1:
align: 'center'
# 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

# This class represents a node in the markdown tree, and can render it to pdf
class Node
constructor: (tree) ->
# special case for text nodes
if typeof tree is 'string'
@type = 'text'
@text = tree
return

@type = tree.shift()
@attrs = {}

if typeof tree[0] is 'object' and not Array.isArray tree[0]
@attrs = tree.shift()

switch @type
when 'header'
@type = 'h' + @attrs.level
when 'img'
# images are used to generate inline example output
# compiles the coffeescript to JS so it can be run
# in the render method
@type = 'example'
code = codeBlocks[@attrs.alt]
@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
doc.font @style.font

if @style.fontSize
doc.fontSize @style.fontSize

if @style.color
doc.fillColor @style.color
else
doc.fillColor 'black'

# renders this node and its subnodes to the document
render: (doc, continued = false) ->
# console.log "rendering node: ", @
if @style.marginLeft
doc.x += @style.marginLeft

switch @type
when 'hr'
doc.addPage()
else
# loop through subnodes and render them
for fragment, index in @content
if fragment.type is 'text'
@setStyle doc

# remove newlines unless this is code
# unless @type is 'code'
# fragment.text = fragment.text.replace(/[\r\n]\s*/g, ' ')

# console.log "rendering text. continued =", continued, 'attrs.continued =', @attrs.continued
doc.text fragment.text, _.extend({}, @style, {continued: continued or index < @content.length - 1})
else
# console.log "rendering fragment #{fragment.type}"
fragment.render doc, index < @content.length - 1 and @type isnt 'bulletlist'

if @style.marginBottom
doc.y += @style.marginBottom
if @style.marginLeft
doc.x -= @style.marginLeft

addAPAHeader = (doc, runningHead) ->
range = doc.bufferedPageRange() # => { start: 0, count: 2 }
doc.font styles.default.font
for i in [range.start...range.start + range.count]
doc.switchToPage(i)
doc.y = 72/2
doc.x = 72
head = runningHead
head = "Running head: " + head if i == 0
doc.text head, _.extend({}, styles.default, {})

doc.y = 72/2
doc.x = 72
doc.text "#{i + 1}", _.extend({}, styles.default, {align: 'right'})

# reads and renders a markdown/literate coffeescript file to the document
render = (doc, tree) ->
doc.font 'Times-Roman'
doc.fontSize 12

codeBlocks = []

onWorksCited = false
while tree.length
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)

doc

# renders the title page of the guide
# renderTitlePage = (doc) ->
# title = 'PDFKit Guide'
# author = 'By Devon Govett'
# version = 'Version ' + require('./package.json').version

# doc.font 'fonts/AlegreyaSans-Light.ttf', 60
# doc.y = doc.page.height / 2 - doc.currentLineHeight()
# doc.text title, align: 'center'
# w = doc.widthOfString(title)

# doc.fontSize 20
# doc.y -= 10
# doc.text author,
# align: 'center'
# indent: w - doc.widthOfString(author)

# doc.font styles.para.font, 10
# doc.text version,
# align: 'center'
# indent: w - doc.widthOfString(version)

# doc.addPage()

extractMetadata = (text) ->
body = ""
metadata = {}

metadata_pattern = /// ^
([\w.-]+) # key
\:\ # colon
\s* # optional whitespace
(.+) # value
$///

for line in text.split("\n")
if meta = line.match(metadata_pattern)
key = meta[1]
value = meta[2].replace(/\\n/, "\n")
metadata[key] = value
else
body += line + "\n"

{metadata: metadata, body: body}

createAPADocument = (body, metadata, stream) ->
tree = md.parse body
tree.shift() # ignore 'markdown' first element

metadata.lastName ||= metadata.author?.split(" ").last()

doc = new PDFDocument
bufferPages: true

doc.info.Title = metadata.title.replace("\n", " ")
doc.info.Author = metadata.author
doc.info.Creator = "markdowntoapa by christian.gen.co"

# add header
doc.y = 72*3
doc.font 'Times-Roman'
doc.fontSize 12
doc.text(metadata.title, _.extend({}, styles.default, styles.title))
doc.text(metadata.author, _.extend({}, styles.default, styles.title))
doc.text(metadata.institution, _.extend({}, styles.default, styles.title))

doc.addPage()

# add abstract page
doc.text("Abstract", _.extend({}, styles.default, styles.h1))
doc.text(metadata.abstract, _.extend({}, styles.default, {}))
if metadata.keywords
# TODO: more generic text writing function
doc.font styles.em.font
doc.text("Keywords: ", _.extend({continued: true}, styles.default, styles.para))
doc.font styles.default.font
doc.text(metadata.keywords, _.extend({}, styles.default, styles.para))

doc.addPage()

doc.text(metadata.title, _.extend({}, styles.default, styles.title))

# doc.pipe(stream)
# render doc, tree
addAPAHeader(doc, metadata.runninghead)
doc.end()
doc

exports.extractMetadata = extractMetadata
exports.createAPADocument = createAPADocument

do ->
# command line
fs = require 'fs'
filename = "apa_paper.md"
content = fs.readFileSync(filename, 'utf8')
content = extractMetadata(content)
body = content.body
metadata = content.metadata
doc = createAPADocument(body, metadata)
stream = fs.createWriteStream("#{metadata.title.replace("\n", ' ')} by #{metadata.author}.pdf")
doc.pipe(stream)

0 comments on commit 2a1f265

Please sign in to comment.