Skip to content

Commit

Permalink
regenerate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mistval committed Feb 27, 2019
1 parent 0390d64 commit 7975af9
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 20 deletions.
12 changes: 6 additions & 6 deletions docs/API.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h4 class="name" id="API"><span class="type-signature"></span>new API<span class

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line509">line 509</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line514">line 514</a>
</li></ul></dd>


Expand Down Expand Up @@ -226,7 +226,7 @@ <h4 class="name" id="scrapeForPhrase"><span class="type-signature">(async) </spa

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line551">line 551</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line556">line 556</a>
</li></ul></dd>


Expand Down Expand Up @@ -411,7 +411,7 @@ <h4 class="name" id="searchForExamples"><span class="type-signature">(async) </s

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line606">line 606</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line611">line 611</a>
</li></ul></dd>


Expand Down Expand Up @@ -583,7 +583,7 @@ <h4 class="name" id="searchForKanji"><span class="type-signature">(async) </span

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line579">line 579</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line584">line 584</a>
</li></ul></dd>


Expand Down Expand Up @@ -763,7 +763,7 @@ <h4 class="name" id="searchForPhrase"><span class="type-signature">(async) </spa

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line525">line 525</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line530">line 530</a>
</li></ul></dd>


Expand Down Expand Up @@ -949,7 +949,7 @@ <h5>Returns:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 26 2019 13:55:21 GMT+0700 (GMT+07:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Feb 27 2019 18:13:52 GMT+0700 (GMT+07:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
16 changes: 8 additions & 8 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ <h4 class="name" id="ExampleResultData">ExampleResultData</h4>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line484">line 484</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line489">line 489</a>
</li></ul></dd>


Expand Down Expand Up @@ -299,7 +299,7 @@ <h4 class="name" id="ExampleResults">ExampleResults</h4>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line492">line 492</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line497">line 497</a>
</li></ul></dd>


Expand Down Expand Up @@ -489,7 +489,7 @@ <h4 class="name" id="KanjiResult">KanjiResult</h4>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line452">line 452</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line457">line 457</a>
</li></ul></dd>


Expand Down Expand Up @@ -1240,7 +1240,7 @@ <h4 class="name" id="PhrasePageScrapeResult">PhrasePageScrapeResult</h4>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line434">line 434</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line439">line 439</a>
</li></ul></dd>


Expand Down Expand Up @@ -1523,7 +1523,7 @@ <h4 class="name" id="PhraseScrapeMeaning">PhraseScrapeMeaning</h4>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line422">line 422</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line427">line 427</a>
</li></ul></dd>


Expand Down Expand Up @@ -1761,7 +1761,7 @@ <h4 class="name" id="PhraseScrapeSentence">PhraseScrapeSentence</h4>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line416">line 416</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line421">line 421</a>
</li></ul></dd>


Expand Down Expand Up @@ -1905,7 +1905,7 @@ <h4 class="name" id="YomiExample">YomiExample</h4>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line445">line 445</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line450">line 450</a>
</li></ul></dd>


Expand Down Expand Up @@ -2077,7 +2077,7 @@ <h5>Type:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 26 2019 13:55:21 GMT+0700 (GMT+07:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Feb 27 2019 18:13:52 GMT+0700 (GMT+07:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
62 changes: 60 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,55 @@ <h3>Word/phrase search (provided by official Jisho API)</h3><p>This returns the

日本には美しい都市が多い。例えば京都、奈良だ
にほんにはうつくしいとしがおおい。たとえばきょうと、奈良だ
Japan is full of beautiful cities. Kyoto and Nara, for instance.</code></pre><h2>Request options</h2><p>Optionally, you can provide options, such as timeout and proxy, to use for requests. The options are passed directly to the <a href="https://www.npmjs.com/package/request">request module</a>. See its <a href="https://www.npmjs.com/package/request">documentation</a> for a full list of options.</p>
Japan is full of beautiful cities. Kyoto and Nara, for instance.</code></pre><h3>Word/phrase scraping</h3><p>This scrapes the word/phrase page on Jisho.org. This can get you some data that the official API doesn't have, such as JLPT level and part-of-speech. The official API (<code>searchForPhrase</code>) should be preferred if it has the data you need.</p>
<pre class="prettyprint source lang-js"><code>const jishoApi = require('unofficial-jisho-api');
const jisho = new jishoApi();

jisho.scrapeForPhrase('谷').then((data) => {
console.log(JSON.stringify(data, null, 2));
});</code></pre><p>This outputs the following:</p>
<pre class="prettyprint source"><code>{
&quot;found&quot;: true,
&quot;tags&quot;: [
&quot;Common word&quot;,
&quot;JLPT N3&quot;,
&quot;Wanikani level 5&quot;
],
&quot;meanings&quot;: [
{
&quot;seeAlsoTerms&quot;: [],
&quot;sentences&quot;: [],
&quot;definition&quot;: &quot;valley&quot;,
&quot;supplemental&quot;: [],
&quot;definitionAbstract&quot;: &quot;&quot;,
&quot;tags&quot;: [
&quot;noun&quot;
]
},
{
&quot;seeAlsoTerms&quot;: [],
&quot;sentences&quot;: [],
&quot;definition&quot;: &quot;Valley&quot;,
&quot;supplemental&quot;: [],
&quot;definitionAbstract&quot;: &quot;In geology, a valley or dale is a depression with predominant extent in one direction. A very deep river valley may be called a canyon or gorge. The terms U-shaped and V-shaped are descriptive terms of geography to characterize the form of valleys. Most valleys belong to one of these two main types or a mixture of them, (at least) with respect of the cross section of the slopes or hillsides.&quot;,
&quot;tags&quot;: [
&quot;wikipedia definition&quot;
]
}
],
&quot;otherForms&quot;: [
{
&quot;kanji&quot;: &quot;渓&quot;,
&quot;kana&quot;: &quot;たに&quot;
},
{
&quot;kanji&quot;: &quot;谿&quot;,
&quot;kana&quot;: &quot;たに&quot;
}
],
&quot;query&quot;: &quot;谷&quot;,
&quot;uri&quot;: &quot;https://jisho.org/word/%E8%B0%B7&quot;
}</code></pre><h2>Request options</h2><p>Optionally, you can provide options, such as timeout and proxy, to use for requests. The options are passed directly to the <a href="https://www.npmjs.com/package/request">request module</a>. See its <a href="https://www.npmjs.com/package/request">documentation</a> for a full list of options.</p>
<p>If you provide an options object to the jishoApi constructor, those options will be used for all requests. Alternatively, you can provide the options as the second argument to the searchForPhrase, searchForKanji, or searchForExamples functions, and the options will only be used for that specific request. If you provide options in both manners, the options will be merged, with the options passed to the function taking precedence if the two are in conflict.</p>
<h3>Use a proxy for all requests</h3><pre class="prettyprint source lang-js"><code>const jishoApi = require('unofficial-jisho-api');
const jisho = new jishoApi({ proxy: 'http://99.99.99.99:9999' });
Expand Down Expand Up @@ -161,6 +209,16 @@ <h3>Parse kanji page HTML</h3><pre class="prettyprint source lang-js"><code>cons
console.log(`English: ${json.results[0].english}`);
console.log(`Kanji ${json.results[0].kanji}`);
console.log(`Kana: ${json.results[0].kana}`);
});</code></pre><h3>Parse phrase page HTML</h3><pre class="prettyprint source lang-js"><code>const request = require('request');
const jishoApi = require('unofficial-jisho-api');
const jisho = new jishoApi();

const SEARCH_EXAMPLE = '保護者';
const SEARCH_URI = jisho.getUriForPhraseScrape(SEARCH_EXAMPLE);

request(SEARCH_URI, (error, response, body) => {
const json = jisho.parsePhraseScrapeHtml(body, SEARCH_EXAMPLE);
console.log(JSON.stringify(json, null, 2));
});</code></pre><h2>About</h2><p>Permission to scrape granted by Jisho's admin Kimtaro: http://jisho.org/forum/54fefc1f6e73340b1f160000-is-there-any-kind-of-search-api</p>
<p>For bugs or requested additional data, feel free to open an issue on the Github repo.</p></article>
</section>
Expand All @@ -177,7 +235,7 @@ <h3>Parse kanji page HTML</h3><pre class="prettyprint source lang-js"><code>cons
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 26 2019 13:55:21 GMT+0700 (GMT+07:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Feb 27 2019 18:13:52 GMT+0700 (GMT+07:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
15 changes: 11 additions & 4 deletions docs/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h1 class="page-title">index.js</h1>
const examples = regexResults.map((regexResult) => {
const examplesLines = regexResult.split('\n').map(s => s.trim());
return {
examples: examplesLines[0],
example: examplesLines[0],
reading: examplesLines[1].replace('【', '').replace('】', ''),
meaning: htmlEntities.decode(examplesLines[2]),
};
Expand Down Expand Up @@ -298,11 +298,16 @@ <h1 class="page-title">index.js</h1>
kanji += unlifted;
kana += furigana;

for (let j = 0; j &lt; unlifted.length; j += 1) {
const kanaEnding = [];
for (let j = unlifted.length - 1; j > 0; j -= 1) {
if (!unlifted[j].match(kanjiRegex)) {
kana += unlifted[j];
kanaEnding.push(unlifted[j]);
} else {
break;
}
}

kana += kanaEnding.reverse().join('');
} else {
kanji += unlifted;
kana += unlifted;
Expand Down Expand Up @@ -660,8 +665,10 @@ <h1 class="page-title">index.js</h1>
API.prototype.getUriForKanjiSearch = uriForKanjiSearch;
API.prototype.getUriForExampleSearch = uriForExampleSearch;
API.prototype.getUriForPhraseSearch = uriForPhraseSearch;
API.prototype.getUriForPhraseScrape = uriForPhraseScrape;
API.prototype.parseExamplePageHtml = parseExamplePageData;
API.prototype.parseKanjiPageHtml = parseKanjiPageData;
API.prototype.parsePhraseScrapeHtml = parsePhrasePageData;

module.exports = API;
</code></pre>
Expand All @@ -678,7 +685,7 @@ <h1 class="page-title">index.js</h1>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 26 2019 13:55:21 GMT+0700 (GMT+07:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Feb 27 2019 18:13:52 GMT+0700 (GMT+07:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down

0 comments on commit 7975af9

Please sign in to comment.