Skip to content

Commit

Permalink
Progress towards issues #22 and #23 - need to test further.
Browse files Browse the repository at this point in the history
With Tuli now loading plugins correctly, a minor callback has been moved into its own plugin, Finish.hx.
  • Loading branch information
skial committed May 6, 2014
1 parent b43db2f commit d51c2ad
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 10 deletions.
24 changes: 24 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@
]
,"spawn" : [

]
,"plugins" : [
{
"uhu" : [

]
}
,{
"tuli" : [
"markdown"
,"rss"
,"atom"
,"importhtml"
,"socialmetadata"
,"nofollow"
,"titlelinks"
,"boxedimages"
]
}
,{
"haxe.io" : [
"finish"
]
}
]
,"output" : "C:/Users/Skial/Dropbox/dev/haxe.io/bin/"
,"ignore" : [
Expand Down
1 change: 1 addition & 0 deletions haxe.io.hxml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
-neko bin/haxeio.js
-main Main
--macro uhx.macro.KlasImp.initalize()
-cmd "haxe plugins.hxml"
2 changes: 1 addition & 1 deletion haxe.io.hxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<option noInlineOnDebug="False" />
<option mainClass="Main" />
<option enabledebug="False" />
<option additional="--macro uhx.macro.KlasImp.initalize()&#xA;#--macro Main.GithubInformation.initialize()&#xA;#--macro Main.Markdown.initialize()&#xA;#--macro Main.ImportHTML.initialize()&#xA;#--macro Main.SocialMetadata.initialize()&#xA;#--macro Main.RoundupFooter.initialize()&#xA;#--macro Main.Finish.initialize()" />
<option additional="--macro uhx.macro.KlasImp.initalize()&#xA;#--macro Main.GithubInformation.initialize()&#xA;#--macro Main.Markdown.initialize()&#xA;#--macro Main.ImportHTML.initialize()&#xA;#--macro Main.SocialMetadata.initialize()&#xA;#--macro Main.RoundupFooter.initialize()&#xA;#--macro Main.Finish.initialize()&#xA;-cmd haxe plugins.hxml" />
</build>
<!-- haxelib libraries -->
<haxelib>
Expand Down
14 changes: 14 additions & 0 deletions plugins.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-lib tuli
-lib mo
-lib detox
-lib beanhx
-lib tjson
-lib selecthxml
-debug
#-dce no
-cp src

--each

-neko finish.n
-main Finish
55 changes: 55 additions & 0 deletions src/Finish.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package ;

import sys.io.File;
import uhx.sys.Tuli;

using Detox;
using StringTools;
using haxe.io.Path;
using sys.FileSystem;

/**
* ...
* @author Skial Bainn
*/
class Finish {

private static var files:Array<String> = [];

public static function main() return Finish;

public function new(tuli:Class<Tuli>) {
untyped Tuli = tuli;

Tuli.onExtension( 'html', handler, After );
trace('adding fin after');
Tuli.onFinish( finish, After );
}

public function handler(file:TuliFile, content:String) {
files.push( file.path );
return content;
}

public function finish() {
for (file in files) if (Tuli.fileCache.exists( file )) {
var c = Tuli.fileCache.get(file);
while (c.indexOf('&amp;') > -1) {
c = c.replace('&amp;', '&');
}
// HTML5 tidy application during html=>xml conversion
// wraps javascript wrapped in <script> tags with CDATA.
// Adding type="text/javascript" seems to force the CDATA
// to be commented out.
/*while (c.indexOf('<![CDATA[') > -1) {
c = c.replace('<![CDATA[', '');
}
while (c.indexOf(']]>') > -1) {
c = c.replace(']]>', '');
}*/

Tuli.fileCache.set( file, c );
}
}

}
12 changes: 3 additions & 9 deletions src/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ import haxe.Json;
import byte.ByteData;
import uhx.lexer.MarkdownParser;

#if macro
import sys.io.File;
import sys.io.Process;
import sys.FileSystem;
//import uhx.macro.Tuli;
import haxe.macro.Context;
import haxe.macro.Expr.ExprOf;
#end

using Lambda;
using Detox;
using Reflect;
Expand All @@ -34,6 +25,9 @@ class Main {
}

}



/*
private typedef Commit = {
var sha:String;
Expand Down
11 changes: 11 additions & 0 deletions src/_entry.atom
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<entry>
<id></id>
<title></title>
<published></published>
<updated></updated>
<author>
<name>Skial Bainn</name>
</author>
<summary></summary>
<content></content>
</entry>
7 changes: 7 additions & 0 deletions src/_entry.rss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<item>
<title></title>
<description></description>
<link></link>
<guid></guid>
<pubDate></pubDate>
</item>
11 changes: 11 additions & 0 deletions src/_feed.atom
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>http://haxe.io/</id>
<title>Haxe.io — News And Information For Haxe Developers</title>
<updated></updated>
<link rel="self" href="" />
<author>
<name>Skial Bainn</name>
<uri>http://twitter.com/skial</uri>
</author>
</feed>
13 changes: 13 additions & 0 deletions src/_feed.rss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Haxe News and Resources</title>
<description>Haxe.io — News And Information For Haxe Developers</description>
<link>http://haxe.io/</link>
<language>en-gb</language>
<pubDate></pubDate>
<lastBuildDate></lastBuildDate>
<ttl>1440</ttl>
<atom:link href="" rel="self" type="application/rss+xml" />
</channel>
</rss>

0 comments on commit d51c2ad

Please sign in to comment.