Parent: [c6374c] (diff)

Child: [96a2f3] (diff)

Download this file

lib.html    600 lines (471 with data), 20.6 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
{% macro related_artifacts(artifact) -%}
{% set related_artifacts = artifact.related_artifacts() %}
{% if related_artifacts %}
<h4>Related</h4>
<p>
{% for related in artifact.related_artifacts() %}
<a href="{{related.url()}}">{{related.type_s}}: {{related.link_text()}}</a><br>
{% endfor %}
</p>
{% endif %}
{%- endmacro %}
{% macro gravatar(user, size, className) -%}
{% set display_name = h.really_unicode(user.display_name) %}
{% if user.icon_url() %}
<img src="{{user.icon_url()}}"
alt="{{display_name}}"
title="{{display_name}}"
class="emboss{% if size %} x{{size}}{% endif %}{% if className %} {{className}}{% endif %}">
{% else %}
<b data-icon="{{g.icons['user'].char}}" class="ico emboss {{g.icons['user'].css}}{% if size %} x{{size}}{% endif %}{% if className %} {{className}}{% endif %}"></b>
{% endif %}
{%- endmacro %}
{% macro gravatar_or_name(user, size, className) -%}
{% if user.icon_url() %}
{{gravatar(user, size, className)}}
{% else %}<span>{{ h.really_unicode(user.display_name) }}</span>{% endif %}
{%- endmacro %}
{% macro email_gravatar(email, title=None, size=None) -%}
{% set title=h.really_unicode(title) %}
{% if email %}
<img src="{{g.gravatar(email, size=size)}}"
alt="{{title or email}}"
title="{{title or email}}"
class="emboss {% if size %} x{{size}}{% endif %}">
{% else %}
<b data-icon="{{g.icons['user'].char}}" class="ico emboss {{g.icons['user'].css}}{% if size %} x{{size}}{% endif %}"></b>
{% endif %}
{%- endmacro %}
{% macro file_field(name, label) %}
{% if label %}
<label for="{{name}}">{{label}}</label>
{% endif %}
<input type="file" id="{{name}}" name="{{name}}" class="text" /><br/>
{% endmacro %}
{% macro text_area(name, label, value=None) %}
{% if label %}
<label for="{{name}}">{{label}}</label><br/>
{% endif %}
<textarea id="{{name}}" name="{{name}}">{{value}}</textarea><br/>
{% endmacro %}
{% macro text_field(name, label, value='') %}
{% if label %}
<label for="{{name}}">{{label}}</label><br/>
{% endif %}
<input type="text" id="{{name}}" name="{{name}}" class="text" value="{{value}}"/><br/>
{% endmacro %}
{% macro radio_button(name, label, option, value=None) %}
{% if label %}
<label for="{{name}}">{{label}}</label><br/>
{% endif %}
<input type="radio" name="{{name}}" class="text" value="{{option}}"
{% if option == value %}checked{% endif %}/><br/>
{% endmacro %}
{% macro submit_button(value, name=None) %}
<input type="submit" name="{{name}}" value="{{value}}"/><br/>
{% endmacro %}
{% macro abbr_date(start_time) %}
<span title="{{start_time.strftime('%a %b %d, %Y %I:%M %p UTC') if start_time else 'unknown'}}">
{{h.ago(start_time)}}
</span>
{% endmacro %}
{% macro path_links(parts) %}
{% set i=0 %}
{% for part in parts %}
<a href="{{'./' + '../' * (parts.__len__()-i-1)}}">{{part}}</a> /
{% set i=i+1 %}
{% endfor %}
{% endmacro %}
{% macro post_summary(post) %}
{% if post %}
<span>
by <a href="{{post.author().url()}}">{{post.author().display_name}}</a>
{{abbr_date(post.timestamp)}}
</span>
{% endif %}
{% endmacro %}
{% macro crumbs(trail) %}
{% for (label, url) in trail %}
<li class="{{loop.index0 == 0 and 'first' or ''}}">
{% if url %}
<a href="{{url}}">{{label}}</a>
{% else %}
<span>{{label}}</span>
{% endif %}
</li>
{% endfor %}
{% endmacro %}
{% macro markdown_syntax(id='') %}
<h1>Markdown Syntax Guide</h1>
<p>The Allura code uses markdown syntax everywhere to allow you to create rich<br>text markup, and extends markdown in several ways to allow for quick linking<br>to other artifacts in your project. </p>
<p>Markdown was created to be easy to read, easy to write, and still readable in plain text format.</p>
<ul>
<li><a href="#md_ex_links{{id}}">Links</a></li>
<li><a href="#md_ex_reflinks{{id}}">Reference Links</a></li>
<li><a href="#md_ex_artlinks{{id}}">Artifact Links</a></li>
<li><a href="#md_ex_text{{id}}">Text</a></li>
<li><a href="#md_ex_bq{{id}}">Blockquotes</a></li>
<li><a href="#md_ex_pre{{id}}">Preformatted Text</a></li>
<li><a href="#md_ex_lists{{id}}">Lists</a></li>
<li><a href="#md_ex_tables{{id}}">Tables</a></li>
<li><a href="#md_ex_headers{{id}}">Headers</a></li>
<li><a href="#md_ex_hr{{id}}">Horizontal Rules</a></li>
<li><a href="#md_ex_img{{id}}">Images</a></li>
<li><a href="#md_ex_escapes{{id}}">Escapes</a></li>
<li><a href="#md_ex_moreheaders{{id}}">More Headers</a></li>
<li><a href="#md_ex_code{{id}}">Code Highlighting</a></li>
<li><a href="#md_ex_includes{{id}}">Includes</a></li>
<li><a href="#md_ex_neighborhood_notes{{id}}">Neighborhood Notifications</a></li>
<li><a href="#md_ex_download_button{{id}}">Download Button</a></li>
<li><a href="#md_ex_project_screenshots{{id}}">Project Screenshots</a></li>
<li><a href="#md_ex_thanks{{id}}">Thanks</a></li>
</ul>
<h2 id="md_ex_links{{id}}">Links</h2>
<p>Most URLs will automatically be turned into links. To be explicit, just write it like this:</p>
<div class="codehilite"><pre>
&lt;http://someurl&gt;
&lt;somebbob@example.com&gt;
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''
<http://someurl>
<somebbob@example.com>''')}}
<p>To use text for the link, write it:</p>
<div class="codehilite"><pre>[like this](http://someurl)</pre></div>
<p>Output:</p>
{{g.markdown.convert('''[like this](http://someurl)''')}}
<p>You can add a *title* (which shows up under the cursor):</p>
<div class="codehilite"><pre>[like this](http://someurl "this title shows up when you hover")</pre></div>
<p>Output:</p>
{{g.markdown.convert('''[like this](http://someurl "this title shows up when you hover")''')}}
<h2 id="md_ex_reflinks{{id}}">Reference Links</h2>
<div class="codehilite"><pre>You can also put the [link URL][1] below the current paragraph
like [this][2].
[1]: http://url
[2]: http://another.url "A funky title"
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''You can also put the [link URL][1] below the current paragraph
like [this][2].
[1]: http://url
[2]: http://another.url "A funky title"''')}}
<p>Here the text "link URL" gets linked to "http://url", and the lines
showing "[1]: http://url" won't show anything.</p>
<p>Or you can use a [shortcut][] reference, which links the text
"shortcut" to the link named "[shortcut]" on the next paragraph.</p>
<div class="codehilite"><pre>Or you can use a [shortcut][] reference, which links the text
"shortcut" to the link named "[shortcut]" on the next paragraph.
[shortcut]: http://goes/with/the/link/name/text</pre></div>
<p>Output:</p>
{{g.markdown.convert('''Or you can use a [shortcut][] reference, which links the text
"shortcut" to the link named "[shortcut]" on the next paragraph.
[shortcut]: http://goes/with/the/link/name/text''')}}
<h2 id="md_ex_artlinks{{id}}">Artifact Links</h2>
<p>Any existing forge resource can be linked with surrounding square brackets ie [MyPage] or [#123].</p>
<p>Links to resources in other tools can be explicitly referenced by adding a tool identifier prefix to the link.
So for instance `[developerwiki:MyPage]` can refer to a wiki page in a `developerwiki` instance.
You can also link to tickets with `[tickets:#123]` assuming there's a 123 ticket in a Tracker instance mounted at `tickets`.
The same is true for forums, or any of the other tools you have installed.
You can even link to tickets in a subproject with `[subproject.tickets:#123]`.</p>
<div class="codehilite"><pre>
[MyPage]
[developerwiki:MyPage]
[#123]
[tickets:#123]
</pre></div>
<p>No example output is available for this one because it only works on real artifacts. Try it in your project!</p>
<h2 id="md_ex_text{{id}}">Text</h2>
<p>Use * or _ to emphasize things:</p>
<div class="codehilite"><pre>*this is in italic* and _so is this_
**this is in bold** and __so is this__
***this is bold and italic*** and ___so is this___
</pre></div>
<p>Output:</p>
{{g.markdown.convert("""*this is in italic* and _so is this_
**this is in bold** and __so is this__
***this is bold and italic*** and ___so is this___""")}}
<p>You can strike through text using HTML like this:</p>
<div class="codehilite"><pre>
&lt;s&gt;this is strike through text&lt;/s&gt;
</pre></div>
<p>Output:</p>
{{g.markdown.convert("""<s>this is strike through text</s>""")}}
<div class="codehilite"><pre>Just write paragraphs like in a text file and they will display how
you would expect. A blank line separates paragraphs.
So this is a new paragraph. But any text on adjacent lines
will all end up
in the same paragraph.
</pre></div>
<p>Output:</p>
{{g.markdown.convert("""Just write paragraphs like in a text file and they will display how
you would expect. A blank line separates paragraphs.
So this is a new paragraph. But any text on adjacent lines
will all end up
in the same paragraph.""")}}
<h2 id="md_ex_bq{{id}}">Blockquotes</h2>
<p>Use the &gt; character in front of a line, <i>just like in email</i></p>
<div class="codehilite"><pre>&gt; Use it if you're quoting a person, a song or whatever.
&gt; You can use *italic* or lists inside them also.
And just like with other paragraphs,
all of these lines are still
part of the blockquote, even without the &gt; character in front.
To end the blockquote, just put a blank line before the following
paragraph.
</pre></div>
<p>Output:</p>
{{g.markdown.convert("""> Use it if you're quoting a person, a song or whatever.
> You can use *italic* or lists inside them also.
And just like with other paragraphs,
all of these lines are still
part of the blockquote, even without the &gt; character in front.
To end the blockquote, just put a blank line before the following
paragraph.""")}}
<h2 id="md_ex_pre{{id}}">Preformatted Text</h2>
<p>If you want some text to show up exactly as you write it, without
Markdown doing anything to it, just indent every line by at least 4
spaces (or 1 tab).</p>
<div class="codehilite"><pre>
This line won't *have any markdown* formatting applied.
I can even write &lt;b&gt;HTML&lt;/b&gt; and it will show up as text.
This is great for showing program source code, or HTML or even
Markdown. &lt;b&gt;this won't show up as HTML&lt;/b&gt; but
exactly &lt;i&gt;as you see it in this text file&lt;/i&gt;.
As a shortcut you can use backquotes to do the same thing while
inside a normal pargraph. `This won't be *italic* or **bold**
at all.`
</pre></div>
<p>Output:</p>
{{g.markdown.convert("""
This line won't *have any markdown* formatting applied.
I can even write <b>HTML</b> and it will show up as text.
This is great for showing program source code, or HTML or even
Markdown. <b>this won't show up as HTML</b> but
exactly <i>as you see it in this text file</i>.
As a shortcut you can use backquotes to do the same thing while
inside a normal pargraph. `This won't be *italic* or **bold**
at all.`""")}}
<h2 id="md_ex_lists{{id}}">Lists</h2>
<div class="codehilite"><pre>* an asterisk starts an unordered list
* and this is another item in the list
+ or you can also use the + character
- or the - character
To start an ordered list, write this:
1. this starts a list *with* numbers
+ this will show as number "2"
* this will show as number "3."
9. any number, +, -, or * will keep the list going.
* just indent by 4 spaces (or tab) to make a sub-list
1. keep indenting for more sub lists
* here i'm back to the second level
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''* an asterisk starts an unordered list
* and this is another item in the list
+ or you can also use the + character
- or the - character
To start an ordered list, write this:
1. this starts a list *with* numbers
+ this will show as number "2"
* this will show as number "3."
9. any number, +, -, or * will keep the list going.
* just indent by 4 spaces (or tab) to make a sub-list
1. keep indenting for more sub lists
* here i\'m back to the second level''')}}
<h2 id="md_ex_tables{{id}}">Tables</h2>
<p>You can create tables using pipes and dashes like this:</p>
<div class="codehilite"><pre>
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell''')}}
<p>You can use markdown syntax within table cells for formatting:</p>
<div class="codehilite"><pre>
First Header | Second Header
------------- | -------------
*Content Cell* | Content Cell
Content Cell | Content Cell
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''
First Header | Second Header
------------- | -------------
*Content Cell* | Content Cell
Content Cell | Content Cell''')}}
<p>You can also create tables using HTML code.</p>
<h2 id="md_ex_headers{{id}}">Headers</h2>
<p>Just put 1 or more dashes or equals signs (--- or ===) below the
title.</p>
<div class="codehilite"><pre>This is a huge header
==================
this is a smaller header
------------------
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''This is a huge header
==================
this is a smaller header
------------------''')}}
<h2 id="md_ex_hr{{id}}">Horizontal Rule</h2>
<p>Just put three or more *'s or -'s on a line:</p>
<div class="codehilite"><pre>
----------------
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''----------------''')}}
<p>Or, you can use single spaces between then, like this:</p>
<div class="codehilite"><pre>
* * *
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''* * *''')}}
<p>or</p>
<div class="codehilite"><pre>
- - - - - - -
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''- - - - - - -''')}}
Make sure you have a blank line above the dashes, though, or else:
<div class="codehilite"><pre>
you will get a header
---
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''you will get a header
---''')}}
<h2 id="md_ex_img{{id}}">Images</h2>
<p>To include an image, just put a "!" in front of a text link:</p>
<div class="codehilite"><pre>
![alternate text](https://sourceforge.net/images/icon_linux.gif)
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''![alternate text](http://sourceforge.net/images/icon_linux.gif)''')}}
<p>The "alternate text" will show up if the browser can't load the
image.</p>
<p>You can also use a title if you want, like this:</p>
<div class="codehilite"><pre>
![tiny arrow](https://sourceforge.net/images/icon_linux.gif "tiny arrow")
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''![tiny arrow](http://sourceforge.net/images/icon_linux.gif "tiny arrow")''')}}
<p>To reference an attached image, just use the img macro. You can add more attributes:</p>
<div class="codehilite"><pre>
[[img src=attached-image.jpg alt=foobar]]
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''[[img src=attached-image.jpg alt=foobar]]''')}}
<h2 id="md_ex_escapes{{id}}">Escapes</h2>
<p>What if you want to just show asterisks, not italics?</p>
<div class="codehilite"><pre>* this shows up in italics: *a happy day*
* this shows the asterisks: \*a happy day\*
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''* this shows up in italics: *a happy day*
* this shows the asterisks: \*a happy day\*''')}}
<p>The backslashes will disappear and leave the asterisks.</p>
<p>You can do the same with any of the characters that have a special meaning<br>for Markdown.</p>
<p>HTML tags may need to be escaped. &lt;b&gt; will be interpreted as a bold tag. Entity codes will be used.
&lt;foobar&gt; isn't allowed and will be dropped, so you probably want to escape it:</p>
<div class="codehilite"><pre>
&lt;b&gt;this will be bold&lt;/b&gt;
you should escape &amp;lt;unknown&amp;gt; tags
&amp;lt; special entities work
&amp;amp;lt; if you want to escape it
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''<b>this will be bold</b>
you should escape &lt;unknown&gt; tags
&lt; special entities work
&amp;lt; if you want to escape it''')}}
<p>Individual ampersands (&amp;) and less-than signs (&lt;) are fine, they will be shown as expected.</p>
<h2 id="md_ex_moreheaders{{id}}">More Headers</h2>
<p>More ways of doing headers:</p>
<div class="codehilite"><pre># this is a huge header #
## this is a smaller header ##
### this is even smaller ###
#### more small ####
##### even smaller #####
###### smallest still: `&lt;h6&gt;` header
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''# this is a huge header #
## this is a smaller header ##
### this is even smaller ###
#### more small ####
##### even smaller #####
###### smallest still: `<h6>` header''')}}
<p>You can use up to 6 <code>#</code> characters at the beginning of the line.</p>
<h2 id="md_ex_code{{id}}">Code Highlighting</h2>
<p>The Code highlighting used in the newforge is based on (http://www.freewisdom.org/projects/python-markdown/CodeHilite). It follows the same syntax as regular Markdown code blocks, except that there are two ways to tell the highlighter what language to use for the code block.</p>
<p>If the first line of the codeblock contains a shebang, the language is derived from that and line numbers are used.</p>
<div class="codehilite"><pre>
#!/usr/bin/python
# Code goes here ...
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''
#!/usr/bin/python
# Code goes here ...''')}}
<p>If the first line contains a shebang, but the shebang line does not contain a path (a single / or even a space) or If the first line begins with three or more colons, the text following the colons identifies the language. In both cases, the first line is removed from the code block before processing.</p>
<div class="codehilite"><pre>
:::python
# Code goes here ...
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''
:::python
# Code goes here ...''')}}
<p>You can also designate a code block by surrounding it with lines of tildes. The type of code highlighting to apply will be inferred based on the code within, or you can specify like above.</p>
<div class="codehilite"><pre>
~~~~~~
&lt;a href="#">My code&lt;/a>
~~~~~~
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''
~~~~~~
<a href="#">My code</a>
~~~~~~''')}}
<h2 id="md_ex_includes{{id}}">Includes</h2>
<p>You can embed another wiki page directly:</p>
<div class="codehilite"><pre>
[[include ref=SamplePage]]
</pre></div>
<p>No example output is available for this one because it only works on real wiki pages. Try it in your wiki!</p>
<h2 id="md_ex_neighborhood_notes{{id}}">Neighborhood Notifications</h2>
<p>You can list updates from all projects in a neighborhood by tool type. Max_number (default is 5) and sort (default is pubdate) are optional:</p>
<div class="codehilite"><pre>
[[neighborhood_feeds tool_name=Wiki max_number=10 sort=pubdate]]
</pre></div>
<h2 id="md_ex_neighborhood_blog_posts{{id}}">Neighborhood Blog Posts</h2>
<p>You can view blog posts from all projects in a neighborhood. Max_number (default is 5) and sort (default is timestamp) are optional:</p>
<div class="codehilite"><pre>
[[neighborhood_blog_posts max_number=10 sort=timestamp]]
</pre></div>
<h2 id="md_ex_project_blog_posts{{id}}">Project Blog Posts</h2>
<p>You can view blog posts from all blogs in a project. Max_number (default is 5), mount point (leave empty to view posts from all blog tools in a project), and sort (default is timestamp) are optional:</p>
<div class="codehilite"><pre>
[[project_blog_posts max_number=10 sort=timestamp mount_point=news]]
</pre></div>
<h2 id="md_ex_download_button{{id}}">Download Button</h2>
<p>You can display a download button that links to the best download available for the active project. Please note that if you use this macro and there is no download associated with your project, the button will not appear.</p>
<div class="codehilite"><pre>
[[download_button]]
</pre></div>
<h2 id="md_ex_project_screenshots{{id}}">Project Screenshots</h2>
<p>You can show all the screenshots for the current project as thumbnails that are linked to the full-size image.</p>
<div class="codehilite"><pre>
[[project_screenshots]]
</pre></div>
<h2 id="md_ex_thanks{{id}}">Thanks</h2>
<p>Thanks to John Gruber and Aaron Swartz for creating Markdown.</p>
<p>
This page is based on some examples from Greg Schueler, <a href="mailto:greg@vario.us">greg@vario.us</a>
</p>
{% endmacro %}