Handbook as markdown module #85

Merged
merged 38 commits into from Mar 7, 2013

Projects

None yet

4 participants

@Swaagie
Member
Swaagie commented Mar 4, 2013
  • strips blacksmith as static content generator
  • all Markdown content moved to /content
  • 301 all incoming requests to nodejitsu.com/docs
  • images use versions.jitsu.com
  • provides some low level functionality, e.g provide keywords, catalog, file content getter

fixes #68

Linked to nodejitsu/home#227

@3rd-Eden
Member

I would change the lib/handbook.js to index.js in the root of the repo. Having a lib folder for one single file is bit pointless

Member

agree consider it done

@3rd-Eden

fail :) This is supposed to be served from the webhooks server as it generates the status images.

Member

Not really as it should always display success for those docs to make sense, you don't want to have it look like failure/not found

Member

Ok, makes sense. Good thinking

@3rd-Eden 3rd-Eden commented on an outdated diff Mar 5, 2013
Welcome to the Nodejitsu handbook. This document will help familiarize you with deploying your Node.js applications to the cloud while also providing detailed information about Nodejitsu's platform-specific features and about where to get help when you need it.
-This is a living document which you can submit patches to at [http://github.com/nodejitsu/handbook](http://github.com/nodejitsu/handbook). Note that this entire website is generated fromfrom the individual content files in the `/content` folder, so any edits should be made to those source files, not `/public/*.html`.
+This is a living document which you can submit patches to at
+[http://github.com/nodejitsu/handbook](repo).
+Handbook content resides in [/content](content) and is easily accessed by using
+the [/lib/handhook.js](handbook),
@3rd-Eden
3rd-Eden Mar 5, 2013 Member

This doesn't link to anything and lib/handbook is gone

@3rd-Eden 3rd-Eden commented on an outdated diff Mar 5, 2013
content/index.md
@@ -8,19 +8,19 @@ This is a living document which you can submit patches to at
Note that this entire website is generated from the individual content files in the
`/content` folder, so any edits should be made to those source files, not `/public/*.html`.
-<hr>
+---------------------------------------
@3rd-Eden
3rd-Eden Mar 5, 2013 Member

Just an FYI, you can also just use 3 dashes for a <hr>, saves typing

@3rd-Eden 3rd-Eden commented on an outdated diff Mar 5, 2013
@@ -0,0 +1,151 @@
+'use strict';
+
+var path = require('path'),
+ fs = require('fs'),
+ natural = require('natural'),
+ tokenizer = new natural.WordTokenizer(),
+ scraper = {
+ title: /\[meta:title\]:\s<>\s\((.+?)\)(?!\))/,
+ description: /\[meta:description\]:\s<>\s\((.+?)\)(?!\))/
+ };
+
+//
+// ### function scrape()
+// #### @file {String} Filename
@3rd-Eden
3rd-Eden Mar 5, 2013 Member
#### @content {String} ..desc ..
#### @key {String} .. desc..
@3rd-Eden 3rd-Eden commented on an outdated diff Mar 5, 2013
+// ### function frequency()
+// #### @content {String} Document content
+// Return list of words scored by Term Frequency-Inverse Document Frequency.
+//
+function frequency(content) {
+ var tfidf = new natural.TfIdf(),
+ processed = [],
+ words = [];
+
+ // Add the current content.
+ content = content.toLowerCase();
+ tfidf.addDocument(content);
+
+ tokenizer.tokenize(content).forEach(function wordFrequency(word) {
+ // Return early if word is processed, to short or only a number.
+ if (+word || word.length < 3 || !!~processed.indexOf(word)) return;
@3rd-Eden
3rd-Eden Mar 5, 2013 Member

FYI: You don't need to cast your indexOf to a boolean, it works without the !! as well.

Swaagie and others added some commits Mar 5, 2013
@Swaagie Swaagie [fix] shorten hr a5f9820
@Swaagie Swaagie [docs] add proper params 2c61693
@Swaagie Swaagie [fix] do not cast to boolean de7a62a
@Swaagie Swaagie [fix] delete redundant file e5eac86
@3rd-Eden 3rd-Eden [perf] Crushed the PNG's. Saved about 240kb~ in total file size 9b06581
@3rd-Eden 3rd-Eden [fix] Uniform code highlighting 18e7164
@3rd-Eden 3rd-Eden [cleanup] Clean up of the markdown code
- Removed pointless HTML and changed them to their Markdown equiv.
- Used 80 col for text, makes it easier to read in terminals
- Fixed spelling mistakes and enforced proper capitalization
- Removed some Kohai references, it's dead
- Fixed some broken urls
- Made the generated HTML match the integration
babbd02
@Swaagie Swaagie [docs] patch up docs to accomodate new handbook 1d90169
@Swaagie Swaagie [fix] add link d45de7f
@Swaagie Swaagie [fix] relative links 2a20a80
@3rd-Eden 3rd-Eden and 1 other commented on an outdated diff Mar 5, 2013
+ href: sub ? name.join('/') : '',
+ title: get(file).title,
+ path: dir
+ };
+ }
+ });
+
+ return result;
+}
+
+//
+// ### function get()
+// #### @file {String} Filename
+// Returns file content by normalized path
+//
+function get(file) {
@3rd-Eden
3rd-Eden Mar 5, 2013 Member

Any reason why this isn't done async?

@Swaagie
Swaagie Mar 5, 2013 Member

Didn't feel like the added complexity of callbacks and async would really benefit us, as home is currently caching everything after the initial request/startup. I could rename this to getSync like catalogSync though, if a project or search would require async for performance I can always change it

@3rd-Eden 3rd-Eden commented on the diff Mar 5, 2013
+ return frequency(content).sort(function sortByScore(a, b) {
+ return b.score - a.score;
+ }).slice(0, n).map(function extractWords(tag) {
+ return tag.word;
+ });
+}
+
+//
+// ### function walkSync()
+// #### @dir {String} Directory path to crawl
+// #### @result {Object} Append content to current results
+// #### @sub {Boolean} Is directory subdirectory of dir
+// Recusive walk of directory by using synchronous functions, returns
+// a collection of markdown files in each folder.
+//
+function walkSync(dir, result, sub) {
@3rd-Eden
3rd-Eden Mar 5, 2013 Member

No async ;)?

@mmalecki mmalecki commented on the diff Mar 7, 2013
content/a-quickstart/faq.md
+
+## How do I change the timezone on my drone?
+
+You can set the `TZ` environment variable with `jitsu env`. A list of time zones
+can be found [here](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
+Here is an example:
+
+```
+jitsu env set TZ America/Los_Angeles
+```
+
+---
+
+## How do subdomains work and what are the valid subdomains?
+
+Valid subdomains are strings 1-n characters long that begin and end with
@mmalecki
mmalecki Mar 7, 2013 Contributor

We should note how subdomains with periods are going to be deprecated and that people shouldn't use them anymore.

@3rd-Eden
Member
3rd-Eden commented Mar 7, 2013

FYI do not delete branch before the cdn's origin server points to the master branch instead of integration.

KTNXBAI

@3rd-Eden 3rd-Eden merged commit 92009f0 into master Mar 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment