Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

* Tweak the readme and package.json

  • Loading branch information...
commit 50390787162b7470df2663eb2cf082c2a5f65537 1 parent 6163dad
Joe Hewitt authored
2  README.md
Source Rendered
@@ -8,7 +8,7 @@ Markdom uses the Upskirt library to parse Markdom and transform it to HTML. Opti
8 8
 Installation
9 9
 ------------
10 10
 
11  
-    $ npm install markdom (not yet, it's not published)
  11
+    $ npm install markdom
12 12
 
13 13
 License 
14 14
 -------
4  package.json
... ...
@@ -1,10 +1,10 @@
1 1
 {
2 2
     "name": "markdom",
3 3
     "description": "Markdown parser based on upskirt",
4  
-    "url": "http://github.com/joehewitt/markdom",
  4
+    "homepage": "http://github.com/joehewitt/markdom",
5 5
     "repository": {
6 6
         "type": "git",
7  
-        "url" : "http://github.com/joehewitt/markdom"
  7
+        "url" : "http://github.com/joehewitt/markdom.git"
8 8
     },
9 9
     "author": "Joe Hewitt <joe@joehewitt.com>",
10 10
     "keywords": ["markdown", "upskirt"],
68  test/markdom-test.js
@@ -5,16 +5,9 @@ var path = require('path'),
5 5
 require.paths.unshift(path.join(__dirname, '..', 'lib'));
6 6
 
7 7
 var markdom = require('markdom');
8  
-var flickr = require('flickr-reflection');
9 8
 var fs = require('fs');
10 9
 var _ = require('underscore');
11 10
 
12  
-var flickrOptions = {
13  
-    key: '379e503c91f1a375a1e8d1cc4b319caf',
14  
-    secret: '6f933c11df597e28',
15  
-    apis: ['photos']
16  
-};
17  
-
18 11
 // *************************************************************************************************
19 12
 
20 13
 vows.describe('markdom basics').addBatch({
@@ -22,67 +15,6 @@ vows.describe('markdom basics').addBatch({
22 15
         topic: 'blah',
23 16
         
24 17
         testNothing: function() {
25  
-            fs.readFile('/Users/joehewitt/Code/tests/markdom.md', 'utf8', function(err, body) {
26  
-                var transformer = new FlickrTransformer();
27  
-                var html = markdom.toDOM(body, {}, transformer);
28  
-                transformer.loadImages(function() {
29  
-                    console.log(html.toHTML());
30  
-                });
31  
-                // console.log(markdom.toHTML(body));
32  
-            });
33 18
         }
34 19
     },
35 20
 }).export(module);
36  
-
37  
-// *************************************************************************************************
38  
-
39  
-function FlickrTransformer() {
40  
-    this.flickrImages = [];
41  
-}
42  
-
43  
-FlickrTransformer.prototype = _.extend(new markdom.NodeTransformer(), {
44  
-    rePhotoURL: /http:\/\/(.*?)\.flickr\.com\/photos\/(.*?)\/(.*?)\//,
45  
-    
46  
-    header: function(node) {
47  
-        if (node.level == 1) {
48  
-            return new markdom.nodeTypes.Text('');
49  
-        } else {
50  
-            return node;
51  
-        }
52  
-    },
53  
-    
54  
-    image: function(node) {
55  
-        var flickrURL = node.url;
56  
-        var m = this.rePhotoURL.exec(flickrURL);
57  
-        if (m) {
58  
-            var photoId = m[3];
59  
-
60  
-            var newImage = new markdom.nodeTypes.Image('');
61  
-            this.flickrImages[photoId] = newImage;
62  
-            var link = new markdom.nodeTypes.Link(flickrURL, null, newImage);
63  
-            return link;
64  
-        }
65  
-    },
66  
-
67  
-    loadImages: function(cb) {
68  
-        flickr.connect(flickrOptions, _.bind(function(err, api) {
69  
-            if (err) throw err;
70  
-
71  
-            for (var photoId in this.flickrImages) {
72  
-                api.photos.getSizes({photo_id: photoId}, _.bind(function(err, data) {
73  
-                    if (err) throw err;
74  
-
75  
-                    for (var i = 0; i < data.sizes.size.length; ++i) {
76  
-                        var sizeInfo = data.sizes.size[i];
77  
-                        if (sizeInfo.width > 600) {
78  
-                            this.flickrImages[photoId].url = sizeInfo.source;
79  
-                            cb();
80  
-                            break;
81  
-                        }
82  
-                    }
83  
-                }, this));
84  
-            }
85  
-        }, this));
86  
-        
87  
-    }
88  
-});

0 notes on commit 5039078

Please sign in to comment.
Something went wrong with that request. Please try again.