fabulator 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +7 -0
- data/VERSION +1 -1
- data/lib/fabulator/core/structurals/constraint.rb +1 -1
- data/lib/fabulator/tag_lib.rb +1 -1
- data/xslt/form.xsl +248 -2
- metadata +4 -4
data/History.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.10
|
@@ -64,7 +64,7 @@ module Fabulator
|
|
64
64
|
|
65
65
|
case @c_type
|
66
66
|
when nil, '':
|
67
|
-
return sense.call(paths) if select.nil?
|
67
|
+
return sense.call(paths) if @select.nil?
|
68
68
|
opts = @select.run(ctx).collect { |o| o.to_s }
|
69
69
|
if !opts.include?(ctx.root.to_s)
|
70
70
|
invalidate_path(paths, ctx.root)
|
data/lib/fabulator/tag_lib.rb
CHANGED
data/xslt/form.xsl
CHANGED
@@ -50,10 +50,10 @@
|
|
50
50
|
<xsl:template match="f:form/f:form | f:option/f:form">
|
51
51
|
<xsl:param name="form_level" />
|
52
52
|
<xsl:choose>
|
53
|
-
<xsl:when test="
|
53
|
+
<xsl:when test="f:caption">
|
54
54
|
<tr><td colspan="2">
|
55
55
|
<fieldset>
|
56
|
-
<legend><xsl:apply-templates select="caption" /></legend>
|
56
|
+
<legend><xsl:apply-templates select="f:caption" /></legend>
|
57
57
|
<xsl:call-template name="form-content">
|
58
58
|
<xsl:with-param name="form_level"><xsl:value-of select="$form_level + 1"/></xsl:with-param>
|
59
59
|
</xsl:call-template>
|
@@ -140,6 +140,44 @@
|
|
140
140
|
</xsl:template>
|
141
141
|
|
142
142
|
<xsl:template match="f:selection">
|
143
|
+
<!-- for now, just handle simple selections -->
|
144
|
+
<xsl:param name="form_level"/>
|
145
|
+
<xsl:choose>
|
146
|
+
<xsl:when test="./f:option//f:form//f:selection">
|
147
|
+
<span class="form-element">
|
148
|
+
<xsl:apply-templates select="f:caption"/>
|
149
|
+
<xsl:apply-templates select="f:help"/>
|
150
|
+
<xsl:call-template name="field-selection">
|
151
|
+
<!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
|
152
|
+
<xsl:with-param name="form_level"><xsl:value-of select="$form_level"/></xsl:with-param>
|
153
|
+
</xsl:call-template>
|
154
|
+
</span>
|
155
|
+
</xsl:when>
|
156
|
+
<xsl:when test="./f:option//f:help|./f:option//f:form">
|
157
|
+
<span class="form-element">
|
158
|
+
<xsl:apply-templates select="f:caption"/>
|
159
|
+
<xsl:apply-templates select="f:help"/>
|
160
|
+
<xsl:call-template name="field-selection">
|
161
|
+
<!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
|
162
|
+
<xsl:with-param name="form_level"><xsl:value-of select="$form_level" /></xsl:with-param>
|
163
|
+
</xsl:call-template>
|
164
|
+
</span>
|
165
|
+
</xsl:when>
|
166
|
+
<xsl:otherwise>
|
167
|
+
<span class="form-element">
|
168
|
+
<!-- label class="form-element-label">
|
169
|
+
<xsl:attribute name="for">
|
170
|
+
<xsl:apply-templates select="." mode="id"/>
|
171
|
+
</xsl:attribute -->
|
172
|
+
<xsl:apply-templates select="f:caption"/>
|
173
|
+
<xsl:apply-templates select="f:help"/>
|
174
|
+
<!-- /label -->
|
175
|
+
<xsl:call-template name="field-selection">
|
176
|
+
<xsl:with-param name="form_level"><xsl:value-of select="$form_level" /></xsl:with-param>
|
177
|
+
</xsl:call-template>
|
178
|
+
</span>
|
179
|
+
</xsl:otherwise>
|
180
|
+
</xsl:choose>
|
143
181
|
</xsl:template>
|
144
182
|
|
145
183
|
<xsl:template match="f:group">
|
@@ -223,6 +261,214 @@
|
|
223
261
|
<xsl:apply-templates />
|
224
262
|
</xsl:template>
|
225
263
|
|
264
|
+
<xsl:template name="field-selection">
|
265
|
+
<!-- xsl:param name="form_id"/ -->
|
266
|
+
<xsl:param name="form_level"/>
|
267
|
+
<xsl:param name="style">
|
268
|
+
<xsl:if test="f:option//f:form">
|
269
|
+
<xsl:choose>
|
270
|
+
<xsl:when test="@count = 'multiple'">checkbox</xsl:when>
|
271
|
+
<xsl:otherwise>radio</xsl:otherwise>
|
272
|
+
</xsl:choose>
|
273
|
+
</xsl:if>
|
274
|
+
</xsl:param>
|
275
|
+
<xsl:choose>
|
276
|
+
<xsl:when test="not($style) or $style = ''">
|
277
|
+
<select>
|
278
|
+
<!-- xsl:attribute name="name"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:attribute -->
|
279
|
+
<xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
|
280
|
+
<xsl:if test="@count = 'multiple'">
|
281
|
+
<xsl:attribute name="multiple"><xsl:text>1</xsl:text></xsl:attribute>
|
282
|
+
</xsl:if>
|
283
|
+
<xsl:apply-templates select="f:option">
|
284
|
+
</xsl:apply-templates>
|
285
|
+
</select>
|
286
|
+
</xsl:when>
|
287
|
+
<xsl:otherwise>
|
288
|
+
<!-- select -->
|
289
|
+
<!-- xsl:attribute name="name"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:attribute -->
|
290
|
+
<!-- xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute -->
|
291
|
+
<!-- xsl:if test="@count = 'multiple'">
|
292
|
+
<xsl:attribute name="multiple"/>
|
293
|
+
</xsl:if -->
|
294
|
+
<span class="form-selection-options">
|
295
|
+
<xsl:apply-templates select="f:option">
|
296
|
+
<xsl:with-param name="style" select="$style"/>
|
297
|
+
<xsl:with-param name="form_level" select="$form_level"/>
|
298
|
+
<!-- xsl:with-param name="form_id">
|
299
|
+
<xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/><xsl:text>.</xsl:text></xsl:if>
|
300
|
+
<xsl:value-of select="@id"/>
|
301
|
+
</xsl:with-param -->
|
302
|
+
</xsl:apply-templates>
|
303
|
+
</span>
|
304
|
+
<!-- /select -->
|
305
|
+
</xsl:otherwise>
|
306
|
+
</xsl:choose>
|
307
|
+
</xsl:template>
|
308
|
+
|
309
|
+
<xsl:template match="f:form/f:selection/f:option|f:form//f:group/f:selection/f:option">
|
310
|
+
<xsl:param name="style"/>
|
311
|
+
<!-- xsl:param name="form_id"/ -->
|
312
|
+
<xsl:param name="form_level"/>
|
313
|
+
<xsl:choose>
|
314
|
+
<xsl:when test="$style = 'radio'">
|
315
|
+
<span class="form-selection-option">
|
316
|
+
<input>
|
317
|
+
<xsl:attribute name="type"><xsl:value-of select="$style"/></xsl:attribute>
|
318
|
+
<!-- xsl:attribute name="name"><xsl:value-of select="$form_id"/></xsl:attribute -->
|
319
|
+
<xsl:attribute name="name"><xsl:apply-templates select="parent::selection[1]" mode="id"/></xsl:attribute>
|
320
|
+
<xsl:attribute name="show">
|
321
|
+
<xsl:choose>
|
322
|
+
<xsl:when test=".//f:form">
|
323
|
+
<xsl:text>rel:</xsl:text>
|
324
|
+
<xsl:apply-templates select="." mode="id"/>
|
325
|
+
</xsl:when>
|
326
|
+
<xsl:otherwise>
|
327
|
+
<xsl:text>none</xsl:text>
|
328
|
+
</xsl:otherwise>
|
329
|
+
</xsl:choose>
|
330
|
+
</xsl:attribute>
|
331
|
+
<xsl:variable name="myid">
|
332
|
+
<xsl:choose>
|
333
|
+
<xsl:when test="@id">
|
334
|
+
<xsl:value-of select="@id"/>
|
335
|
+
</xsl:when>
|
336
|
+
<xsl:otherwise>
|
337
|
+
<xsl:value-of select="."/>
|
338
|
+
</xsl:otherwise>
|
339
|
+
</xsl:choose>
|
340
|
+
</xsl:variable>
|
341
|
+
<xsl:attribute name="value"><xsl:value-of select="$myid"/></xsl:attribute>
|
342
|
+
<xsl:for-each select="../f:default">
|
343
|
+
<xsl:if test=". = $myid">
|
344
|
+
<xsl:attribute name="checked"/>
|
345
|
+
</xsl:if>
|
346
|
+
</xsl:for-each>
|
347
|
+
</input>
|
348
|
+
<xsl:choose>
|
349
|
+
<xsl:when test="f:caption">
|
350
|
+
<xsl:choose>
|
351
|
+
<xsl:when test="f:caption"><xsl:apply-templates select="f:caption"/></xsl:when>
|
352
|
+
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
353
|
+
</xsl:choose>
|
354
|
+
<xsl:apply-templates select="f:help"/>
|
355
|
+
<xsl:if test="./f:form">
|
356
|
+
<xsl:apply-templates select="f:form" mode="body">
|
357
|
+
<!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:with-param -->
|
358
|
+
<xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
|
359
|
+
<xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
|
360
|
+
</xsl:apply-templates>
|
361
|
+
</xsl:if>
|
362
|
+
</xsl:when>
|
363
|
+
<xsl:when test="f:form">
|
364
|
+
<xsl:if test="f:form/f:caption">
|
365
|
+
<xsl:apply-templates select="f:form/f:caption"/>
|
366
|
+
<xsl:apply-templates select="f:form/f:help"/>
|
367
|
+
</xsl:if>
|
368
|
+
<xsl:apply-templates select="f:form" mode="body">
|
369
|
+
<!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:with-param -->
|
370
|
+
<xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
|
371
|
+
<xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
|
372
|
+
</xsl:apply-templates>
|
373
|
+
</xsl:when>
|
374
|
+
</xsl:choose>
|
375
|
+
</span>
|
376
|
+
</xsl:when>
|
377
|
+
<xsl:when test="$style = 'checkbox'">
|
378
|
+
<span class="form-selection-option">
|
379
|
+
<input>
|
380
|
+
<xsl:attribute name="type"><xsl:value-of select="$style"/></xsl:attribute>
|
381
|
+
<!-- xsl:attribute name="name"><xsl:value-of select="$form_id"/></xsl:attribute -->
|
382
|
+
<xsl:attribute name="name"><xsl:apply-templates select="parent::selection[1]" mode="id"/></xsl:attribute>
|
383
|
+
<xsl:attribute name="show">
|
384
|
+
<xsl:choose>
|
385
|
+
<xsl:when test=".//f:form">
|
386
|
+
<xsl:text>rel:</xsl:text>
|
387
|
+
<xsl:apply-templates select="." mode="id"/>
|
388
|
+
</xsl:when>
|
389
|
+
<xsl:otherwise>
|
390
|
+
<xsl:text>none</xsl:text>
|
391
|
+
</xsl:otherwise>
|
392
|
+
</xsl:choose>
|
393
|
+
</xsl:attribute>
|
394
|
+
<xsl:variable name="myid">
|
395
|
+
<xsl:choose>
|
396
|
+
<xsl:when test="@id">
|
397
|
+
<xsl:value-of select="@id"/>
|
398
|
+
</xsl:when>
|
399
|
+
<xsl:otherwise>
|
400
|
+
<xsl:value-of select="."/>
|
401
|
+
</xsl:otherwise>
|
402
|
+
</xsl:choose>
|
403
|
+
</xsl:variable>
|
404
|
+
<xsl:attribute name="value"><xsl:value-of select="$myid"/></xsl:attribute>
|
405
|
+
<xsl:for-each select="../f:default">
|
406
|
+
<xsl:if test=". = $myid">
|
407
|
+
<xsl:attribute name="checked"/>
|
408
|
+
</xsl:if>
|
409
|
+
</xsl:for-each>
|
410
|
+
</input>
|
411
|
+
<xsl:choose>
|
412
|
+
<xsl:when test="f:caption">
|
413
|
+
<xsl:choose>
|
414
|
+
<xsl:when test="f:caption"><xsl:apply-templates select="f:caption"/></xsl:when>
|
415
|
+
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
416
|
+
</xsl:choose>
|
417
|
+
<xsl:apply-templates select="f:help"/>
|
418
|
+
<xsl:if test="./form">
|
419
|
+
<xsl:apply-templates select="f:form" mode="body">
|
420
|
+
<!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:with-param -->
|
421
|
+
<xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
|
422
|
+
<xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
|
423
|
+
</xsl:apply-templates>
|
424
|
+
</xsl:if>
|
425
|
+
</xsl:when>
|
426
|
+
<xsl:when test="f:form">
|
427
|
+
<xsl:if test="f:form/f:caption">
|
428
|
+
<xsl:apply-templates select="f:form/f:caption"/>
|
429
|
+
<xsl:apply-templates select="f:form/f:help"/>
|
430
|
+
</xsl:if>
|
431
|
+
<xsl:apply-templates select="f:form" mode="body">
|
432
|
+
<!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:with-param -->
|
433
|
+
<xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
|
434
|
+
<xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
|
435
|
+
</xsl:apply-templates>
|
436
|
+
</xsl:when>
|
437
|
+
</xsl:choose>
|
438
|
+
</span>
|
439
|
+
</xsl:when>
|
440
|
+
<xsl:otherwise>
|
441
|
+
<option>
|
442
|
+
<xsl:variable name="myid">
|
443
|
+
<xsl:choose>
|
444
|
+
<xsl:when test="@id">
|
445
|
+
<xsl:value-of select="@id"/>
|
446
|
+
</xsl:when>
|
447
|
+
<xsl:otherwise>
|
448
|
+
<xsl:value-of select="."/>
|
449
|
+
</xsl:otherwise>
|
450
|
+
</xsl:choose>
|
451
|
+
</xsl:variable>
|
452
|
+
<xsl:attribute name="value"><xsl:value-of select="$myid"/></xsl:attribute>
|
453
|
+
<xsl:for-each select="../f:default">
|
454
|
+
<xsl:if test=". = $myid">
|
455
|
+
<xsl:attribute name="selected"/>
|
456
|
+
</xsl:if>
|
457
|
+
</xsl:for-each>
|
458
|
+
<xsl:choose>
|
459
|
+
<xsl:when test="f:caption">
|
460
|
+
<xsl:value-of select="f:caption"/>
|
461
|
+
</xsl:when>
|
462
|
+
<xsl:otherwise>
|
463
|
+
<xsl:value-of select="$myid"/>
|
464
|
+
</xsl:otherwise>
|
465
|
+
</xsl:choose>
|
466
|
+
</option>
|
467
|
+
</xsl:otherwise>
|
468
|
+
</xsl:choose>
|
469
|
+
</xsl:template>
|
470
|
+
|
471
|
+
|
226
472
|
<xsl:template match="*" mode="id">
|
227
473
|
<xsl:for-each select="ancestor::*[@id != '']">
|
228
474
|
<xsl:value-of select="@id" />
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fabulator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 10
|
10
|
+
version: 0.0.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Smith
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-08 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|