Browse code

Changed shared scheme to use github data. Fixed up RELASENOTES. Made mulle-scion simpler yet more powerful. Improved man page. Removed some warnings.

Nat! authored on 17-09-2015 11:22:30
Showing 10 changed files
... ...
@@ -5,7 +5,7 @@
5 5
 #
6 6
 Pod::Spec.new do |s|
7 7
   s.name             = "MulleScion"
8
-  s.version          = '1851.0'
8
+  s.version          = '1853.0'
9 9
   s.summary          = "MulleScion a modern Template library for ObjC."
10 10
   s.description      = <<-DESC
11 11
                        MulleScion is indeed a modern Template library for ObjC. 
... ...
@@ -19,9 +19,9 @@ Pod::Spec.new do |s|
19 19
   # s.social_media_url = 'https://twitter.com/EXAMPLE'
20 20
 
21 21
   s.platform     = :ios, '5.0'
22
-  s.platform     = :osx, '10.4'
22
+  s.platform     = :osx, '10.6'
23 23
   s.ios.deployment_target = '5.0'
24
-  s.osx.deployment_target = '10.4'
24
+  s.osx.deployment_target = '10.6'
25 25
   s.requires_arc = false
26 26
   s.compiler_flags = '-Wno-deprecated-declarations', "-DPROJECT_VERSION=#{s.version.to_s}"
27 27
   s.source_files = 'src/**/*.{c,m}', 'google-toolbox-for-mac/Foundation/GTMNSString+HTML.m'
... ...
@@ -2296,7 +2296,7 @@
2296 2296
 			isa = XCBuildConfiguration;
2297 2297
 			buildSettings = {
2298 2298
 				CLANG_WARN_INT_CONVERSION = YES;
2299
-				CURRENT_PROJECT_VERSION = 1851.0;
2299
+				CURRENT_PROJECT_VERSION = 1853.0;
2300 2300
 				DYLIB_COMPATIBILITY_VERSION = 1848.0;
2301 2301
 				DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)";
2302 2302
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
... ...
@@ -2327,7 +2327,7 @@
2327 2327
 			isa = XCBuildConfiguration;
2328 2328
 			buildSettings = {
2329 2329
 				CLANG_WARN_INT_CONVERSION = YES;
2330
-				CURRENT_PROJECT_VERSION = 1851.0;
2330
+				CURRENT_PROJECT_VERSION = 1853.0;
2331 2331
 				DYLIB_COMPATIBILITY_VERSION = 1848.0;
2332 2332
 				DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)";
2333 2333
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
... ...
@@ -2355,8 +2355,6 @@
2355 2355
 		41764B9B16DA511200560FCF /* Debug */ = {
2356 2356
 			isa = XCBuildConfiguration;
2357 2357
 			buildSettings = {
2358
-				DEPLOYMENT_LOCATION = YES;
2359
-				DSTROOT = /;
2360 2358
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
2361 2359
 				PRODUCT_NAME = "mulle-scion";
2362 2360
 			};
... ...
@@ -2365,8 +2363,6 @@
2365 2363
 		41764B9C16DA511200560FCF /* Release */ = {
2366 2364
 			isa = XCBuildConfiguration;
2367 2365
 			buildSettings = {
2368
-				DEPLOYMENT_LOCATION = YES;
2369
-				DSTROOT = /;
2370 2366
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
2371 2367
 				PRODUCT_NAME = "mulle-scion";
2372 2368
 			};
... ...
@@ -2397,7 +2393,7 @@
2397 2393
 			isa = XCBuildConfiguration;
2398 2394
 			buildSettings = {
2399 2395
 				CLANG_WARN_INT_CONVERSION = YES;
2400
-				CURRENT_PROJECT_VERSION = 1851.0;
2396
+				CURRENT_PROJECT_VERSION = 1853.0;
2401 2397
 				DYLIB_COMPATIBILITY_VERSION = 1848.0;
2402 2398
 				DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)";
2403 2399
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
... ...
@@ -2426,8 +2422,6 @@
2426 2422
 		4178D2FF16E00263001C9FB0 /* Profile */ = {
2427 2423
 			isa = XCBuildConfiguration;
2428 2424
 			buildSettings = {
2429
-				DEPLOYMENT_LOCATION = YES;
2430
-				DSTROOT = /;
2431 2425
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
2432 2426
 				PRODUCT_NAME = "mulle-scion";
2433 2427
 			};
... ...
@@ -70,11 +70,11 @@
70 70
       </BuildableProductRunnable>
71 71
       <CommandLineArguments>
72 72
          <CommandLineArgument
73
-            argument = "/tmp/MulleScionistTemp.scion"
73
+            argument = "https://raw.githubusercontent.com/mulle-nat/MulleScion/release/dox/!_Introduction.scion"
74 74
             isEnabled = "YES">
75 75
          </CommandLineArgument>
76 76
          <CommandLineArgument
77
-            argument = "none"
77
+            argument = "https://raw.githubusercontent.com/mulle-nat/MulleScion/release/dox/properties.plist"
78 78
             isEnabled = "YES">
79 79
          </CommandLineArgument>
80 80
       </CommandLineArguments>
... ...
@@ -1,15 +1,44 @@
1
+1853.0
2
+
3
+Made mulle-scion brewable. You can now brew it with:
4
+
5
+~~~
6
+brew tap mulle-kybernetik/software
7
+brew install mulle-scion
8
+~~~
9
+
10
+mulle-scion is now more powerful with regards to parameters.
11
+It is now possible to do this:
12
+
13
+echo '--- {{ VALUE }} ---' | mulle-scion - keyvalue - VALUE="1848"
14
+
15
+which produces predicatably
16
+
17
+--- 1848 ---
18
+
19
+Templates can be passed in via stdin and the replacement values can be given
20
+as key=value arguments. This makes mulle-scion even more convenient to use
21
+in shell scripts. You can also specify URLs instead of just file paths for
22
+input.
23
+
24
+There are now "hidden" environment variables WWW_ROOT, WWW_PORT, WWW_PLIST for
25
+the webserver.
26
+
27
+
1 28
 1852.0
2 29
 
3
-*** API change ***
30
+### API change 
4 31
 
5 32
 Redesigned the "convenience interface". Sorry but I just disliked the
6
-proliferation of code, that separated NSURL and NSString by type. I used the
33
+proliferation of code, that separated **NSURL** and **NSString** by type. I used the
7 34
 power of ObjC and simplified this without having to resort to degenerics ;)
8
-In other words the +descriptionWithTemplateURL: method family is gone, just use
9
-+descriptionWithTemplateFile: with either NSString or NSURL.
35
+In other words the` +descriptionWithTemplateURL:` method family is gone, just use
36
+`+descriptionWithTemplateFile:` with either NSString or NSURL.
37
+
38
+### LANGUAGE change 
10 39
 
11 40
 I apparently goofed up the documentation in 1851 and made an incompatible change
12
-so that mulle-scion choked up on its own documentation templates. Ahem. That
41
+so that **mulle-scion** choked up on its own documentation templates. Ahem. That
13 42
 has been fixed, so that MulleScion now skips all scion tags, that are
14 43
 immediately _followed_ by a backtick ` or a backquote \. This ought to be
15 44
 harmless in my opinion, but results may vary.
16 45
new file mode 100644
... ...
@@ -0,0 +1,205 @@
1
+1852.0
2
+
3
+### API change 
4
+
5
+Redesigned the "convenience interface". Sorry but I just disliked the
6
+proliferation of code, that separated **NSURL** and **NSString** by type. I used the
7
+power of ObjC and simplified this without having to resort to degenerics ;)
8
+In other words the` +descriptionWithTemplateURL:` method family is gone, just use
9
+`+descriptionWithTemplateFile:` with either NSString or NSURL.
10
+
11
+### LANGUAGE change 
12
+
13
+I apparently goofed up the documentation in 1851 and made an incompatible change
14
+so that **mulle-scion** choked up on its own documentation templates. Ahem. That
15
+has been fixed, so that MulleScion now skips all scion tags, that are
16
+immediately _followed_ by a backtick ` or a backquote \. This ought to be
17
+harmless in my opinion, but results may vary.
18
+
19
+
20
+1851.0
21
+
22
+*** BIG CHANGE!!! FILTER REDESIGNED ***
23
+
24
+I decided to convert the documentation from ASCII into markdown. For that I
25
+needed a markdown filter. As it turns out, none of the libraries I found are
26
+able to do incremental rendering (bummer). This meant, that the markdown filter
27
+had to buffer all incoming strings until the endfilter was reached.
28
+That broke a lot of stuff.
29
+
30
+On a positive note, you can now nest filters and can tweak them a little with
31
+optional parameters.
32
+
33
+
34
+*** BIG CHANGE!!! ELSEFOR INSTEAD OF ELSE IN FOR-ENDFOR ***
35
+
36
+I messed up, when I "designed" aka hacked in the {% for else endfor %} feature
37
+it doesn't work, when there is a {% if else endif %} contained in the loop.
38
+So else needs to be renamed to elsefor in this case.
39
+
40
+To keep in sync with the archive version, the version nr. has been bumped to
41
+1851.
42
+
43
+
44
+Improved the dependencyTable generation, by ignoring syntax errors.
45
+
46
+The documentation is now in markdown format. With some hacking effort
47
+the builtin webserver can now show the "Results" much nicer.
48
+
49
+Stole a CSS to make it look more nicey, nicey.
50
+
51
+Improved the LICENSE detail.
52
+
53
+Made it more possible to call a macro from a macro, which failed in some cases.
54
+
55
+There is now a hidden convert feature on includes, which allows to preprocess
56
+the data. convert > parse > print > filter
57
+
58
+
59
+1848.11
60
+
61
+*** This can break archived templates on iOS, regenerate them ***
62
+
63
+* mulle-scion has now a -z option to output compiled templates. While testing
64
+I found out, that when I use NSKeyedArchiver it's actually slower than parsing
65
+plain text and uses more space - even compressed.
66
+
67
+Compile plaintext * 100
68
+-rw-r--r--  1 nat  _lpoperator  198016 Oct  9 17:00 big.scion
69
+
70
+real	0m8.528s
71
+
72
+Compile unkeyed * 100
73
+-rw-r--r--  1 nat  wheel  75983 Oct  9 17:25 /tmp/unkeyed.scionz
74
+real	0m8.680s
75
+
76
+Compile keyed * 100
77
+-rw-r--r--  1 nat  wheel  750347 Oct  9 17:25 /tmp/keyed.scionz
78
+real	0m25.497s
79
+
80
+If you are on iOS it's most likely better to not use archives and caching!
81
+
82
+Fix erroneous trace output, which was always happening.
83
+
84
+Fix bug, where "for i in nil" would iterate once
85
+
86
+Fix bug, where MulleScionNull was passed as invocation argument
87
+
88
+
89
+1848.10
90
+
91
+*** This can break currently working templates, that contain unnoticed 
92
+    syntax errors! ***
93
+
94
+* the parser doesn't allow garbage inside mulle-scion tags anymore. It
95
+  used to parse {{ x = #<%$/&> }} because everything after "x " was
96
+  ignored, but it was just too confusing in real life use.
97
+ 
98
+* simplified expansion of function functionality a bit. 
99
+  added NSStringFromRange to builtin-functions
100
+
101
+* added some NSURL methods for opening templates, which is more convenient on
102
+iOS
103
+
104
+* made built-in function in principle expandable to support user-written
105
+functions
106
+
107
+
108
+1848.9
109
+
110
+* added a podspec
111
+
112
+
113
+1848.8
114
+
115
+* allow # comments within {% %}
116
+
117
+* added log command for debugging
118
+
119
+* mulle-scion now builds into /usr/local/bin in Release setting
120
+
121
+* the demo webserver root is now /tmp/MulleScionDox
122
+
123
+* fixed requires dox
124
+
125
+* made requires a single line command, like include or extends, just because
126
+it "felt right"
127
+
128
+* remove some extraneous debug output and runtime warnings
129
+
130
+* new scheme "Show Documentation in Browser"
131
+
132
+* updated documentation a bit regarding multi-line commands
133
+
134
+
135
+v1848.7
136
+
137
+* outsourced NSObject+MulleGraphviz because I need it in other code
138
+too and the dependency on MulleScion was annoying.
139
+
140
+* fixed some bad code in commandline tool, that reads the property list
141
+
142
+
143
+v1848.6
144
+
145
+* add __ARGV__ parsage to mulle-scion. Now you can use mulle-scion as an awk 
146
+replacement in other shell scripts, if you so desire.
147
+
148
+
149
+v1848.5
150
+
151
+* bunch of fixes. Added an example how to write a non-plist datasource, in this
152
+case using CoreData.
153
+
154
+* added a requires keyword for dynamic loading of bundles from within a scion
155
+script (experimental)
156
+
157
+
158
+v1848.4
159
+
160
+* renamed to MulleScion, because now it's more than just a template engine, it's
161
+also somewhat useful as a little standalone Obj-C interpreter. Also 
162
+MulleScionTemplates was just too long.
163
+
164
+* The MulleScionConvenience has been renamed to just MulleScion.
165
+
166
+* There is now some rudimentary tracing support available. Just going to become
167
+better over time.
168
+
169
+* {{ }} can now be placed inside {% %} which makes templates with a lot of logic
170
+and little output that much more managable.
171
+
172
+* used google-toolbox-code for htmlEscapedString, which now adds some Apache2 Licensing
173
+terms to this project. Or say #define NO_APACHE_LICENSE and get the old crufty
174
+functionality back.
175
+
176
+* the repository on github will be only pushed to for "releases" the continous
177
+development is going to happen on Mulle kybernetiK.
178
+
179
+<blockquote>mulle:  http://www.mulle-kybernetik.com/software/git/MulleScionTemplates/<br>
180
+github: https://github.com/mulle-nat/MulleScionTemplates/
181
+</blockquote>
182
+
183
+
184
+v1848.3  !!**massive changes**!!
185
+
186
+* your compiled scionz files are incompatible now. Throw them away
187
+and rebuild your caches
188
+
189
+* you used to be able to have random trash after valid scion code, which was nice
190
+for documentation. That doesn't work anymore in most cases
191
+
192
+* you can now write multiline scripts, but some keywords need still to be 
193
+enclosed as singles in {% %} like macro, block, endblock, extends and maybe
194
+some others
195
+
196
+* there are the beginnings of a test suite, check out the tests folder. there is
197
+a simple shellscript that runs the tests
198
+
199
+* lots of smaller fixes, whose content one might glean from the git comments
200
+
201
+
202
+v1848.2
203
+
204
+* your scionz files are incompatible now. Throw them away
205
+and rebuild the caches
0 206
new file mode 100755
... ...
@@ -0,0 +1,46 @@
1
+#! /bin/sh
2
+# 
3
+# Generate a formula for mulle-scion stand alone
4
+#
5
+VERSION=${1:-`mulle-agvtool vers -terse | awk -F. '{ print $1 }'`}
6
+shift
7
+PROJECT=${1:-`basename ${PWD}`}
8
+shift
9
+TARGET=${1:-"mulle-scion"}
10
+shift
11
+
12
+ARCHIVE="${VERSION}.tar.gz"
13
+ARCHIVEURL="https://github.com/mulle-nat/${PROJECT}/archive/${ARCHIVE}"
14
+HOMEPAGE="http://www.mulle-kybernetik.com/software/git/${PROJECT}"
15
+
16
+TMPARCHIVE="/tmp/${PROJECT}-${ARCHIVE}"
17
+
18
+if [ ! -f  "${TMPARCHIVE}" ]
19
+then
20
+   curl -s -L -o "${TMPARCHIVE}" "${ARCHIVEURL}"
21
+   [ $? -ne 0 ] && exit 1
22
+else
23
+   echo "using cached file ${TMPARCHIVE} instead of downloading again" >&2
24
+fi
25
+
26
+HASH=`shasum -p -a 256 "${TMPARCHIVE}" | awk '{ print $1 }'`
27
+
28
+cat <<EOF  
29
+class ${PROJECT} < Formula
30
+  homepage "${HOMEPAGE}"
31
+  url "${ARCHIVEURL}"
32
+  version "${VERSION}"
33
+  sha256 "${HASH}"
34
+
35
+  depends_on :xcode => :build
36
+#  depends_on "zlib"
37
+
38
+  def install
39
+    system "xcodebuild", "-target", "${TARGET}", "DEPLOYMENT_LOCATION=YES", "DSTROOT=/", "INSTALL_PATH=#{bin}"
40
+  end
41
+
42
+  test do
43
+    system  "test", "-x", "#{bin}/${TARGET}"
44
+  end
45
+end
46
+EOF
... ...
@@ -415,7 +415,6 @@ static macro_type   parser_grab_text_until_scion_start( parser *p)
415 415
    unsigned char   c, d;
416 416
    int             inquote;
417 417
    macro_type      type;
418
-   macro_type      escaped;
419 418
    
420 419
    assert( p->skipComments <= 0);
421 420
 
... ...
@@ -424,7 +423,6 @@ static macro_type   parser_grab_text_until_scion_start( parser *p)
424 423
    type    = garbage;
425 424
    inquote = 0;
426 425
    c       = p->curr > p->buf ? p->curr[ -1] : 0;
427
-   escaped = 0;
428 426
    
429 427
    while( p->curr < p->sentinel)
430 428
    {
... ...
@@ -442,12 +440,11 @@ static macro_type   parser_grab_text_until_scion_start( parser *p)
442 440
       default   :  type = garbage; continue;
443 441
       case '%'  :  type = command; break;
444 442
       case '#'  :  type = comment; break;
445
-      case '{'  :  type = expression; escaped = 0; break;
443
+      case '{'  :  type = expression; break;
446 444
       case '}'  :  if( type == garbage)
447 445
                      continue;
448 446
                    if( parser_scion_looks_escaped( p))
449 447
                    {
450
-                      escaped = type;
451 448
                       type    = garbage;
452 449
                       continue;
453 450
                    }
... ...
@@ -458,7 +455,6 @@ static macro_type   parser_grab_text_until_scion_start( parser *p)
458 455
       {
459 456
          if( parser_scion_looks_escaped( p))
460 457
          {
461
-            escaped = type;
462 458
             type    = garbage;
463 459
             continue;
464 460
          }
... ...
@@ -53,8 +53,9 @@
53 53
 
54 54
 - (id) initWithHTMLEscaping:(BOOL) flag
55 55
 {
56
-   [self init];
57
-   _htmlEscape = flag;
56
+   self = [self init];
57
+   if( self)
58
+      self->_htmlEscape = flag;
58 59
    return( self);
59 60
 }
60 61
 
... ...
@@ -55,7 +55,7 @@ static id            acquirePropertyListOrDataSourceFromBundle( NSString *s);
55 55
    
56 56
 - (void) appendString:(NSString *) s
57 57
 {
58
-   NSData             *data;
58
+   NSData   *data;
59 59
       
60 60
    data = [s dataUsingEncoding:NSUTF8StringEncoding];
61 61
    [self writeData:data];
... ...
@@ -85,36 +85,43 @@ static NSDictionary  *localVariablesFromInfo( NSDictionary *info)
85 85
 }
86 86
 
87 87
 
88
-static int   run( NSString *fileName,
89
-                  id <MulleScionDataSource> src,
90
-                  id < MulleScionOutput> dst,
91
-                  NSDictionary *locals)
88
+static MulleScionTemplate   *acquireTemplateFromPath( NSString *fileName)
92 89
 {
93 90
    MulleScionTemplate   *template;
91
+   NSData               *data;
92
+   NSString             *string;
93
+   NSURL                *url;
94 94
    
95
+   template = nil;
95 96
    //
96 97
    // if fileName stars with '{' assume, that it's a command line template
97 98
    //
98 99
    if( [fileName hasPrefix:@"{"]) //  on her milk white neck ... the devil's mark
99
-   {
100 100
       template = [[[MulleScionTemplate alloc] initWithString:fileName] autorelease];
101
-      if( template)
101
+   else
102
+      if( [fileName isEqualToString:@"-"])
102 103
       {
103
-         [template writeToOutput:dst
104
-                      dataSource:src
105
-                  localVariables:locals];
106
-         return( 0);
104
+         data   = [[NSFileHandle fileHandleWithStandardInput] readDataToEndOfFile];
105
+         string = [[[NSString alloc] initWithData:data
106
+                                         encoding:NSUTF8StringEncoding] autorelease];
107
+         template = [[[MulleScionTemplate alloc] initWithString:string] autorelease];
108
+         
107 109
       }
108
-   }
109
-   else
110
-      if( [MulleScionTemplate writeToOutput:dst
111
-                               templateFile:fileName
112
-                                 dataSource:src
113
-                             localVariables:locals])
114
-         return( 0);
115
-   
116
-   NSLog( @"Template \"%@\" could not be read", fileName);
117
-   return( -1);
110
+      else
111
+      {
112
+         if( [fileName rangeOfString:@"://"].length)
113
+         {
114
+            url      = [NSURL URLWithString:fileName];
115
+            template = [[[MulleScionTemplate alloc] initWithContentsOfFile:url] autorelease];
116
+         }
117
+         else
118
+            template = [[[MulleScionTemplate alloc] initWithFile:fileName] autorelease];
119
+      }
120
+
121
+   if( ! template)
122
+      NSLog( @"Template \"%@\" could not be read", fileName);
123
+
124
+   return( template);
118 125
 }
119 126
 
120 127
 
... ...
@@ -157,10 +164,56 @@ static id   acquireDataSourceFromBundle( NSString *s)
157 164
 }
158 165
 
159 166
 
167
+static id   acquirePropertyListFromArgs( NSArray *args)
168
+{
169
+   NSMutableDictionary   *plist;
170
+   NSEnumerator          *rover;
171
+   NSString              *arg;
172
+   id                    components;
173
+   NSString              *key;
174
+   NSString              *value;
175
+   
176
+   plist = [NSMutableDictionary dictionary];
177
+   
178
+   rover = [args objectEnumerator];
179
+   while( arg = [rover nextObject])
180
+   {
181
+      components = [arg componentsSeparatedByString:@"="];
182
+
183
+      key = [components objectAtIndex:0];
184
+      if( ! [key length])
185
+         continue;
186
+      
187
+      switch( [components count])
188
+      {
189
+      default :
190
+         components = [[components mutableCopy] autorelease];
191
+         [components removeObjectAtIndex:0];
192
+         value = [components componentsJoinedByString:@"="];
193
+         break;
194
+         
195
+      case 2 :
196
+         value = [components objectAtIndex:1];
197
+         break;
198
+      
199
+      case 1 :
200
+         value = @"1";
201
+         break;
202
+      }
203
+
204
+      // quote stuff will have been removed by shell
205
+      [plist setObject:value
206
+                forKey:key];
207
+   }
208
+   return( plist);
209
+}
210
+
211
+
160 212
 static id   acquirePropertyListOrDataSourceFromBundle( NSString *s)
161 213
 {
162 214
    NSData     *data;
163 215
    NSString   *error;
216
+   NSURL      *url;
164 217
    id         plist;
165 218
    
166 219
    if( [s isEqualToString:@"none"])
... ...
@@ -169,11 +222,20 @@ static id   acquirePropertyListOrDataSourceFromBundle( NSString *s)
169 222
    if( [s isEqualToString:@"-"])
170 223
       data = [[NSFileHandle fileHandleWithStandardInput] readDataToEndOfFile];
171 224
    else
225
+   {
172 226
       if( [[s pathExtension] isEqualToString:@"plist"])
173
-         data = [NSData dataWithContentsOfFile:s];
227
+      {
228
+         if( [s rangeOfString:@"://"].length)
229
+         {
230
+            url  = [NSURL URLWithString:s];
231
+            data = [NSData dataWithContentsOfURL:url];
232
+         }
233
+         else
234
+            data = [NSData dataWithContentsOfFile:s];
235
+      }
174 236
       else
175 237
          return( acquireDataSourceFromBundle( s));
176
-   
238
+   }
177 239
    error = nil;
178 240
    plist = [NSPropertyListSerialization propertyListFromData:data
179 241
                                             mutabilityOption:NSPropertyListImmutable
... ...
@@ -199,17 +261,22 @@ static NSString  *processName( void)
199 261
 
200 262
 static void   usage( void)
201 263
 {
202
-   fprintf( stderr, "%s [-w|-z] <template> [bundle|plist|-|none] [-|outputfile] [arguments]\n", [processName() cString]);
264
+   fprintf( stderr, "%s [-w|-z] <-|template> [bundle|plist|-|keyvalue|none] [-|outputfile] [argv|<key>[=value]]*\n", [processName() cString]);
203 265
    fprintf( stderr, "v%s\n", MulleScionFrameworkVersion);
204 266
    fprintf( stderr,
205 267
    "\t-w       : start webserver for /tmp/MulleScionDox\n"
206 268
    "\t-z       : write compressed archive to outputfile\n"
207 269
    "\t-Z       : write compressed keyed archive to outputfile (for IOS)\n"
208 270
    "\n"
209
-   "\ttemplate : a MulleScion template\n"
271
+   "\ttemplate : a MulleScion template\n\n"
210 272
    "\tbundle   : a NSBundle. It's NSPrincipalClass will be used as the datasource\n"
211
-   "\tplist    : any kind of property list, see: plist(5)\n\n"
212
-   "\targuments: a list of arguments to be made available to the template via __ARGV__\n"
273
+   "\tplist    : any kind of property list as datasouece, see: plist(5)\n"
274
+   "\tkeyvalue : use keyvalue arguments as datasource (see below)\n"
275
+   "\targv     : arguments made available to the template via __ARGV__ (default)\n"
276
+   "\tkey      : key values as datasource contents (only with keyvalue)\n"
277
+   "\n"
278
+   "example:\n"
279
+   "echo '***{{ VALUE }}***' | mulle-scion - args - VALUE=\"VfL Bochum 1848\"\n"
213 280
    );
214 281
 }
215 282
 
... ...
@@ -223,8 +290,9 @@ static NSDictionary  *getInfoFromEnumerator( NSEnumerator *rover)
223 290
    NSString              *templateName;
224 291
    id                    plist;
225 292
    
226
-   info         = [NSMutableDictionary dictionary];
227 293
    [rover nextObject];  // skip
294
+
295
+   info         = [NSMutableDictionary dictionary];
228 296
    templateName = [rover nextObject];
229 297
    plistName    = [rover nextObject];
230 298
    outputName   = [rover nextObject];
... ...
@@ -237,9 +305,16 @@ static NSDictionary  *getInfoFromEnumerator( NSEnumerator *rover)
237 305
    if( ! [outputName length])
238 306
       outputName = @"-";
239 307
    
240
-   plist = acquirePropertyListOrDataSourceFromBundle( plistName);
308
+   if( [plistName isEqualToString:@"keyvalue"])
309
+   {
310
+      plist = acquirePropertyListFromArgs( argv);
311
+      argv  = [NSArray array];
312
+   }
313
+   else
314
+      plist = acquirePropertyListOrDataSourceFromBundle( plistName);
241 315
    if( ! plist)
242 316
       goto usage;
317
+   
243 318
    [info setObject:plist
244 319
             forKey:@"dataSource"];
245 320
    
... ...
@@ -330,20 +405,9 @@ static int   _archive_main( int argc, const char * argv[], int keyed)
330 405
    if( [archiveName isEqualToString:@"-"])
331 406
       return( -3);
332 407
    
333
-   //
334
-   // if fileName stars with '{' assume, that it's a command line template
335
-   //
336
-   fileName    = [info objectForKey:@"MulleScionRootTemplate"];
337
-   if( [fileName hasPrefix:@"{"])
338
-      template = [[[MulleScionTemplate alloc] initWithString:fileName] autorelease];
339
-   else
340
-      template = [[[MulleScionTemplate alloc] initWithFile:fileName] autorelease];
341
-
408
+   template = acquireTemplateFromPath( fileName);
342 409
    if( ! template)
343
-   {
344
-      NSLog( @"Template \"%@\" could not be read", fileName);
345 410
       return( -1);
346
-   }
347 411
    
348 412
    if( ! [template writeArchive:archiveName
349 413
                           keyed:keyed])
... ...
@@ -360,30 +424,25 @@ static int   _main(int argc, const char * argv[])
360 424
 {
361 425
    NSDictionary   *info;
362 426
    NSFileHandle   *stream;
427
+   MulleScionTemplate   *template;
363 428
    
364 429
    info = getInfoFromArguments();
365 430
    if( ! info)
366 431
       return( -3);
367 432
    
433
+   template = acquireTemplateFromPath( [info objectForKey:@"MulleScionRootTemplate"]);
434
+   if( ! template)
435
+      return( -1);
436
+
368 437
    stream = outputStreamWithInfo( info);
369 438
    if( ! stream)
370 439
       return( -2);
371
-   
372
-   return( run( [info objectForKey:@"MulleScionRootTemplate"],
373
-               [info objectForKey:@"dataSource"],
374
-               stream,
375
-               localVariablesFromInfo( info)));
376
-}
377 440
 
378
-
379
-static char    *default_options[] =
380
-{
381
-   "document_root",   "/tmp/MulleScionDox",
382
-   "listening_ports", "127.0.0.1:18048",
383
-   "num_threads", "1",
384
-   "index_files", "index.scion,index.html,index.htm,index.cgi,index.shtml,index.php,index.lp",
385
-   NULL
386
-};
441
+   [template writeToOutput:stream
442
+                dataSource:[info objectForKey:@"dataSource"]
443
+            localVariables:localVariablesFromInfo( info)];
444
+   return( 0);
445
+}
387 446
 
388 447
 
389 448
 int main( int argc, const char * argv[])
... ...
@@ -396,16 +455,9 @@ int main( int argc, const char * argv[])
396 455
 #ifndef DONT_HAVE_WEBSERVER
397 456
       if( ! strcmp( argv[ 1], "-w"))
398 457
       {
399
-         id   plist;
400
-         loadBundles();
401
-         plist = [NSDictionary dictionaryWithContentsOfFile:@"/tmp/MulleScionDox/properties.plist"];
402
-         if( ! plist)
403
-         {
404
-            NSLog( @"/tmp/MulleScionDox/properties.plist not found");
405
-            return( -5);
406
-         }
407
-         mulle_mongoose_main( plist, default_options);
408
-         return( 0);
458
+         int   main_www( int argc, const char * argv[]);
459
+         
460
+         return( main_www( argc, argv));
409 461
       }
410 462
 #endif
411 463
 
... ...
@@ -438,3 +490,54 @@ NS_ENDHANDLER
438 490
 # endif
439 491
    return( rval);
440 492
 }
493
+
494
+
495
+/*
496
+ *
497
+ */
498
+#ifndef DONT_HAVE_WEBSERVER
499
+
500
+ static char    *default_options[] =
501
+{
502
+   "document_root",   "/tmp/MulleScionDox",
503
+   "listening_ports", "127.0.0.1:18048",
504
+   "num_threads", "1",
505
+   "index_files", "index.scion,index.html,index.htm,index.cgi,index.shtml,index.php,index.lp",
506
+   NULL
507
+};
508
+
509
+
510
+int   main_www( int argc, const char * argv[])
511
+{
512
+   id         plist;
513
+   char       *s;
514
+   NSString   *path;
515
+   NSURL      *url;
516
+   
517
+   loadBundles();
518
+   
519
+   // hack to get something else going
520
+   s = getenv( "MulleScionServerRoot");
521
+   if( s)
522
+      default_options[ 1] = s;
523
+   
524
+   s = getenv( "MulleScionServerPort");
525
+   if( s)
526
+      default_options[ 3] = s;
527
+   
528
+   path = @"/tmp/MulleScionDox/properties.plist";
529
+   s = getenv( "MulleScionServerPlist");
530
+   if( s)
531
+      path = [NSString stringWithCString:s];
532
+   
533
+   plist = acquirePropertyListOrDataSourceFromBundle( path);
534
+   if( ! plist)
535
+      plist = [NSDictionary dictionary];
536
+   
537
+   mulle_mongoose_main( plist, default_options);
538
+   return( 0);
539
+}
540
+#endif
541
+
542
+
543
+
... ...
@@ -3,45 +3,60 @@
3 3
 .Os Darwin
4 4
 .Sh NAME       
5 5
 .Nm mulle-scion
6
-.Nd creates text output from a MulleScion template and a property list file.
6
+.Nd creates text output from a template and a property list.
7 7
 .Sh SYNOPSIS      
8 8
 .Nm
9
-.Op Fl w
9
+.Op Fl w z Z
10 10
 .Ar template      
11 11
 .Ar plist         
12 12
 .Op Ar outputfile 
13 13
 .Op Ar arguments 
14 14
 .Sh DESCRIPTION   
15 15
 .Nm
16
-is a standalone renderer for MulleScion files. 
16
+is a standalone template renderer that has a built-in Objective-C interpreter.
17
+
18
+.El                      
19
+.Pp               
20
+These are optional modes
21
+.Nm  
22
+can run:
23
+.Bl -tag -width "XXXXXXXXXX" -indent 
24
+.It Fl w 
25
+If you give mulle-scion the webserver option if will start a small webserver, 
26
+suitable for demonstration purposes. The remaining arguments of the command line
27
+are treazed as bundle identifiers or paths, to be loaded immediately.
28
+The document root is hardcoded to "/tmp/MulleScionDox" and it should open a
29
+port on 18048 on the localhost interface.
30
+.It Fl z 
31
+Create a compiled '.scionz' template archive. Everything after template is ignored.
32
+.It Fl Z
33
+Create a compiled '.scionZ' template  archive suitable for iOS. Everything after template is ignored.
34
+
35
+.El
17 36
 .Pp               
18 37
 These are the arguments you can give to 
19
-.Nm
38
+.Nm  
20 39
 :
21 40
 .Bl -tag -width "XXXXXXXXXX" -indent 
22 41
 .It Ar template  
23
-path to the MulleScionTemplate. If the file has no extension a .scion will be 
42
+the template filename or URL. If the file has no extension a .scion will be
24 43
 appended. The directory of this path will become your root for included 
25
-templates. If the path starts with a '{' this argument is treated as an inline 
26
-script instead.
44
+templates. If the argument starts with a '{' this argument is treated as an
45
+inline template string instead. If you give '-' as a path, the template will
46
+be read from standard input.
27 47
 .It Ar plist  
28
-Path to a property list file. If you give '-' as a path, the property list will 
29
-be read from standard input. You can also give 'none' for no property list. If 
30
-this parameter is omitted, it defaults to standard input.
48
+A property list filename or URL. If you give '-' as a path, the property list will 
49
+be read from standard input, unless you already used '-' for the template.
50
+You can also give 'none' for no property list. Giving the keyword 'keyvalue'
51
+makes mulle-scion treat the arguments as key value pairs for a datasource plist
52
+instead.
31 53
 .It Ar outputfile
32 54
 The output file to write the output to. If this parameter is '-' or omitted, the 
33 55
 output is written to standard output.
34 56
 .It Ar arguments
35 57
 All other trailing arguments are collected and are available as an array in the
36
-MulleScion variable __ARGV__.
37
-.El                      
38
-.Bl -tag -width "XXXXXXXXXX" -indent 
39
-.It Fl w 
40
-If you give mulle-scion the webserver option if will start a small webserver, 
41
-suitable only for demonstration purposes and it will treat all remaining 
42
-arguments of the command line as bundle identifiers or paths, to be loaded 
43
-immediately. The document root is hardcoded to /tmp and it should only open a 
44
-port on 18048 on the localhost interface.
58
+MulleScion variable __ARGV__, unless 'keyvalue' has been set. In which case the
59
+arguments become the datasource.
45 60
 .El 
46 61
 .Pp                     
47 62
 .Pp
... ...
@@ -84,16 +99,27 @@ the rendering of a template.
84 99
 Fill template file my_template.scion with data from a_datasource.plist and write it to
85 100
 output.txt.
86 101
 
102
+.Pp
103
+.Dl "mulle-scion 'https://raw.githubusercontent.com/mulle-nat/MulleScion/release/dox/!_Introduction.scion' 'https://raw.githubusercontent.com/mulle-nat/MulleScion/release/dox/properties.plist'
104
+.Pp
105
+As above but using URLs and writing the output to the console
106
+
87 107
 .Pp
88 108
 .Dl "mulle-scion '{{ [__ARGV__[ 0] stringByResolvingSymlinksInPath] }}' none - /tmp/.."
89 109
 .Pp
90 110
 Use mulle-scion to resolve a symlink path /tmp/.. . The script is inlined, there is no property 
91
-list for a datasource and the output is routed to stdout.
111
+list for a datasource and the output is routed to the console.
112
+
113
+.Pp
114
+.Dl "mulle-scion '{{ [PATH stringByResolvingSymlinksInPath] }}' keyvalue - "PATH=/tmp/.."
115
+.Pp
116
+As above but using key values as a datasource instead of __ARGV__.
117
+
92 118
 .Pp
93 119
 .Dl "mulle-scion -w ~/Library/Bundles/MyWebServer.bundle"
94 120
 .Pp
95
-start a webserver for /tmp and load ~/Library/Bundles/MyWebServer.bundle. The bundle 
96
-could be adding compiled functionality to the test templates.
121
+start a webserver for "/tmp/MulleScionDo"x and load "~/Library/Bundles/MyWebServer.bundle". The bundle 
122
+can add functionality to the template code..
97 123
 
98 124
 
99 125
 .Sh SEE ALSO