<commit_before><?php include("header.php"); ?>
<script type="text/javascript" src="lib/jquery.md5.js"></script>

<h2 class="entry-title"><a href="http://www.openpolitics.com/?p=4736" title="Permalink to Adding Quote-Context using jQuery" rel="bookmark">Adding Quote-Context using jQuery</a></h2>

<p>While revising the references for an <a href="http://www.openpolitics.com/2013/02/16/the-temptation-of-jesus-mercedes-edition/" target="_blank">earlier post</a>, I got the idea of adding contextual info to blockquotes:</p>

<a href="https://www.biblegateway.com/passage/?search=matthew+4&version=NRSV">Matthew 4</a>:
<blockquote><p>Then Jesus was led up by the Spirit into the wilderness to be tempted by the devil. 2 He fasted forty days and forty nights, and afterwards he was famished. 3 The tempter came and said to him, “If you are the Son of God, command these stones to become loaves of bread.”</p><p>4 But he answered, “It is written, ‘One does not live by bread alone, but by every word that comes from the mouth of God.’”</p></blockquote>

<p>Which leads you to find the passage in <a href="https://www.biblegateway.com/passage/?search=Deuteronomy%208&version=NRSV">Deuteronomy</a> that Jesus was quoting and ask: "What was the context of this quote; and can I program something in jQuery to automatically expand this context":</p>

<a href="http://www.openpolitics.com/quote-context/cache/www.biblegateway.com/passage/%3fsearch=Deuteronomy+8.html">Deuteronomy 8</a>:
<blockquote cite="https://www.biblegateway.com/passage/?search=Deuteronomy+8&amp;version=NRSV">one does not live by bread alone, but by every word that comes from the mouth of the Lord</blockquote>

<p>Right now I have working code to pull data from a <a href="deuteronomy-8.js">json file</a> and fill divs before
and after the blockquote.  The next step is to define a process for creating and querying the json quote caches.</p>

<blockquote cite="http://en.wikipedia.org/wiki/Chinese_room?oldformat=true">The Chinese room is a thought experiment presented by <NAME></blockquote>

<div id="testing"></div>


<script type="text/javascript"> 
	// Call plugin on all blockquotes:
	jQuery( "blockquote" ).quoteContext(); 
</script><commit_msg>Create Github gist to summarize how to call function<commit_after><?php include("header.php"); ?>
<script type="text/javascript" src="lib/jquery.md5.js"></script>

<h2 class="entry-title"><a href="quote-context/">Adding Quote-Context using jQuery</a></h2>

<p>In Matthew 4, there is a quote which I cited in an earlier post, in which <a href="http://www.openpolitics.com/2013/02/16/the-temptation-of-jesus-mercedes-edition/" target="_blank">earlier post</a>, I got the idea of adding contextual info to blockquotes:</p>

<a href="https://www.biblegateway.com/passage/?search=matthew+4&version=NRSV">Matthew 4</a>:
<blockquote><p>The tempter came and said to him, “If you are the Son of God, command these stones to become loaves of bread.”</p><p>4 But he answered, “It is written, ‘One does not live by bread alone, but by every word that comes from the mouth of God.’”</p></blockquote>

<p>Often times, I would like to get more context for a given quotation, but as an author, I'd like to provide the reader with the 
	ability to expand the quote, to include the text that surrounded the excerpt:</p>

<a href="http://www.openpolitics.com/quote-context/cache/www.biblegateway.com/passage/%3fsearch=Deuteronomy+8.html">Deuteronomy 8</a>:
<blockquote cite="https://www.biblegateway.com/passage/?search=Deuteronomy+8&amp;version=NRSV">one does not live by bread alone, but by every word that comes from the mouth of the Lord</blockquote>

<h3>Code</h3>
<script src="https://gist.github.com/timlangeman/e7629d5893168ab13222.js"></script>

The relevant jQuery plugin: <a href="https://github.com/timlangeman/quote-context/blob/master/js/quote-context.js">quoteContext</a>



<script type="text/javascript"> 
	// Call plugin on all blockquotes:
	jQuery( "blockquote" ).quoteContext(); 
</script>
{'fraction_non_alphanumeric': 0.13519580942878523, 'fraction_numerical': 0.01621351958094288, 'mean_word_length': 5.3249211356466875, 'pattern_counts': {'":': 1, '<': 74, '<?xml version=': 0, '>': 74, 'https://': 7, 'lorem ipsum': 0, 'www.': 12, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1106805', 'n_tokens_mistral': 1316, 'n_tokens_neox': 1249, 'n_words': 416}