blob: 91b4d3e800d9b40c007a9cffdddde8245e6659b6 [file] [log] [blame]
{#-
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-#}
{% macro csrf() -%}
{{ request.cookies['_session_id'] or request.environ['_session_id'] }}
{%- endmacro %}
{% macro csrf_token() -%}
<input name="_session_id" type="hidden" value="{{csrf()}}">
{%- endmacro %}
{% macro related_artifacts(artifact, user) -%}
{% set related_artifacts = artifact.related_artifacts(user=user) %}
{% if related_artifacts %}
<h4>Related</h4>
<p>
{% for related in related_artifacts %}
{% if not related.app_config|default %}
{# e.g. a Commit is not currently an Artifact #}
{% set prefix = related.type_s %}
{% else %}
{% set tool = related.app_config.options.mount_label %}
{% if related.project != artifact.project %}
{% set prefix = '%s: %s' % (related.project.name, tool) %}
{% else %}
{% set prefix = tool %}
{% endif %}
{% endif %}
<a href="{{related.url()}}">{{prefix}}: {{related.link_text()}}</a><br>
{% endfor %}
</p>
{% endif %}
{%- endmacro %}
{% macro gravatar(user, size, className, gravatar_default_url=None) -%}
{% set display_name = h.really_unicode(user.display_name) %}
{% set icon_url, user_proj, icon_source = user.icon_url(gravatar_default_url, return_more=True) %}
{% if icon_url %}
<img {% if icon_source == 'local' %}
{{ project_icon_srcs(user_proj, icon_url=icon_url, base_size=size) }}
{% elif icon_source == 'gravatar' %}
src="{{ icon_url }}&s={{size}}"
srcset="{{icon_url}}&s={{ size*1.5 }} 1.5x,
{{icon_url}}&s={{ size*2 }} 2x"
width="{{size}}" height="{{size}}"
{% elif icon_source == 'default' %}
src="{{ icon_url }}"
{% endif %}
alt="{{display_name}}"
title="{{display_name}}"
class="emboss{% if size %} x{{size}}{% endif %}{% if className %} {{className}}{% endif %}">
{% else %}
{{ g.icons['user'].render(
tag='span',
style='text-align:center;',
extra_css='emboss {} x{}'.format(className or '', size or '')) }}
{% 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 %}
{{ g.icons['user'].render(
tag='span',
style='text-align:center;',
extra_css='emboss x{}'.format(size or '')) }}
{% endif %}
{%- endmacro %}
{% macro email_link(email, name, size=16) -%}
{% set user = h.find_user(email) -%}
{% if user and not user.is_anonymous() %}
<a href="{{user.url()}}">
{{ email_gravatar(email, name, size) }} {{ name }}
</a>
{% else %}
{{ email_gravatar(email, name, size) }} {{ name }}
{% endif %}
{%- endmacro %}
{% macro user_link(user, avatar=False, size=16, nofollow=False) -%}
{% if user %}
{% if not user.is_anonymous() %}
{% set profile_path = user.url() + 'profile/' if g.user_profile_urls_with_profile_path else user.url() %}
<a href="{{profile_path}}" class="user-mention" {% if nofollow %}rel="nofollow" {% endif %}>
{% if avatar %}
{{ gravatar_or_name(user, size) }}
{% else %}
{{ h.really_unicode(user.display_name) }}
{% endif %}
</a>
{% else %}
{{ h.really_unicode(user.display_name) }}
{% endif %}
{% 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='', type='text') %}
{% if label %}
<label for="{{name}}">{{label}}</label><br/>
{% endif %}
<input type="{{ type }}" id="{{name}}" name="{{name}}" class="text" value="{{value}}"/><br/>
{% endmacro %}
{% macro password_field(name, label, value='') %}
{{ text_field(name, label, value, type='password') }}
{% endmacro %}
{% macro hidden_field(name, value='') %}
<input type="hidden" 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, style=None) %}
<input type="submit" name="{{name}}" value="{{value}}" style="{{style}}"/><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) %}
{% if parts != [''] %}
<a href="{{'./' + '../' * parts|length }}" rel="nofollow"><b class="fa fa-folder-open-o" title="Root directory"></b></a> /
{% endif %}
{% for part in parts %}
<a href="{{'./' + '../' * loop.revindex0 }}" rel="nofollow">{{part}}</a> /
{% endfor %}
{% endmacro %}
{% macro post_summary(post) %}
{% if post %}
<span>
by {{user_link(post.author())}}
{{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 maximize_content_button() %}
{% do g.register_forge_js('js/maximize-content.js') %}
{{ g.icons['expand'].render(show_title=True, id='maximize-content') }}
{{ g.icons['restore'].render(show_title=True, id='restore-content') }}
{%- endmacro %}
{#
icon_url param is entirely optional; only pass it if you already have one for effeciency
#}
{%- macro project_icon_srcs(project, icon_url=None, base_size=48) %}
{% set icon_url = icon_url or project.icon_url() %}
{% set proj_max_size = project.icon_max_size or 0 %}
src="{{icon_url}}?{{project.icon_timestamp}}{% if base_size != 48 and proj_max_size >= base_size %}&amp;w={{base_size}}{% endif %}"
{% if proj_max_size >= base_size*1.5 -%}
srcset="{{icon_url}}?w={{ (base_size*1.5)|int }}&amp;{{project.icon_timestamp}} 1.5x
{% if proj_max_size >= base_size*2 -%},
{{icon_url}}?w={{ base_size*2 }}&amp;{{project.icon_timestamp}} 2x
{%- endif -%}
"
{%- endif -%}
{%- endmacro %}
{% macro markdown_syntax(id='') %}
<a class="markdown_syntax_toc_crumb" href="#md_ex_toc{{id}}">Back</a>
<div class="markdown_syntax_section md_ex_toc{{id}}">
<p>{{config.site_name}} uses markdown syntax everywhere to allow you to create rich text markup, and extends markdown in several ways to allow for quick linking 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 class="markdown_syntax_toc">
<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_usermentions{{id}}">User Mentions</a></li>
<li><a href="#md_ex_text{{id}}">Basic Text Formatting</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_video{{id}}">Videos</a></li>
<li><a href="#md_ex_escapes{{id}}">Escapes and HTML</a></li>
<li><a href="#md_ex_moreheaders{{id}}">More Headers</a></li>
<li><a href="#md_ex_toc1{{id}}">Table of Contents</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_project_macros{{id}}">Project Info Macros</a></li>
<li><a href="#md_ex_thanks{{id}}">Thanks</a></li>
</ul>
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_links{{id}}">
<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")''')}}
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_reflinks{{id}}">
<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''')}}
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_artlinks{{id}}">
<h2 id="md_ex_artlinks{{id}}">Artifact Links</h2>
<p>Any forge resource (artifact) can be linked with surrounding square brackets, e.g. [MyPage] or [#123].
These artifact links can take several forms.</p>
<h3>Simple Links</h3>
<p>Most commonly, the artifact identifier can simply be surrounded with square brackets. Here are some examples:</p>
<div class="codehilite"><pre>
[MyWikiPage] # Wiki - name of wiki page
[#123] # Tracker - ticket number
[r10721] # SVN - revision number
[3b9d48] # Git &amp; Mercurial - first 6 characters of revision hash
[2012/02/my-post] # Blog - post slug, including YYYY/MM/ prefix
[a6d38f98] # Discussion Thread - thread id
[a6d38f98#42f8] # Discussion Post - thread_id#post_id
</pre></div><br>
<h3>Two-part Links</h3>
<p>To link to an artifact in a specific tool, use the form: `[tool:artifact]`, where `tool` is the name of the tool
as it appears in the URL. Two-part links are useful when you have two tools of the same type installed. For example,
let's say you have a 'bugs' tracker and a 'features' tracker installed, and you want to link to the first ticket in each:</p>
<div class="codehilite"><pre>
[bugs:#1]
[features:#1]
</pre></div><br>
<h3>Three-part Links</h3>
<p>To link to an artifact in another project, use the form: `[project:tool:artifact]`, where `project` is the name of the project
as it appears in the URL. For example:
<div class="codehilite"><pre>
[allura:wiki:Home]
</pre></div><br>
<p>To link to an artifact in a subproject, use the form: `[project/subproject:tool:artifact]`, where `subproject` is the name of the subproject
as it appears in the URL. For example:</p>
<div class="codehilite"><pre>
[allura/sub:code:3b9d48]
</pre></div><br>
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_usermentions{{id}}">
<h2 id="md_ex_usermentions{{id}}">User Mentions</h2>
<p>An user can be mentioned using @ sign and the username. A rendered user mention has a link to the particular user and also an info tip on mouse hover.</p>
<div class="codehilite"><pre>
@test-user-1 # Mention test-user-1
</pre></div><br>
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_text{{id}}">
<h2 id="md_ex_text{{id}}">Basic Text Formatting</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>A carriage return
makes a line break.
Two carriage returns make a new paragraph.</pre></div>
<p>Output:</p>
{{g.markdown.convert("""A carriage return
makes a line break.
Two carriage returns make a new paragraph.""")}}
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_bq{{id}}">
<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.""")}}
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_pre{{id}}">
<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). As an alternative to indenting, you can make a code block use 3 or
more tildes (~) or backticks (`) on a line before and after the text
(<a href="https://python-markdown.github.io/extensions/fenced_code_blocks/">syntax details</a>). See examples in the
<a href="#md_ex_code">Code Highlighting section</a>.
</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;.
Within a paragraph, you can use backquotes to do the same thing.
`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>.
Within a paragraph, you can use backquotes to do the same thing.
`This won't be *italic* or **bold** at all.`""")}}
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_lists{{id}}">
<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
To start a check list, write this:
- [ ] this is not checked
- [ ] this is too
- [x] but this is checked
</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
To start a check list, write this:
- [ ] this is not checked
- [ ] this is too
- [x] but this is checked''')}}
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_tables{{id}}">
<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>
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_headers{{id}}">
<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
------------------''')}}
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_hr{{id}}">
<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
---''')}}
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_img{{id}}">
<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]({{g.forge_static('images/up.png')}})
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''![alternate text]('''+g.forge_static('images/up.png') + ''')''')}}
<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>
![small up arrow]({{g.forge_static('images/up.png')}} "small up arrow")
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''![small up arrow]('''+g.forge_static('images/up.png')+''' "small up 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>
{# no output, since this standalone example page doesn't have attachments
<p>Output:</p>
{{g.markdown.convert('''[[img src=attached-image.jpg alt=foobar]]''')}}
#}
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_video{{id}}">
<h2 id="md_ex_video{{id}}">Videos</h2>
<p>To embed a YouTube video, use the <code>embed</code> macro (only YouTube is supported at this time):</p>
<div class="codehilite"><pre>
[[embed url=https://www.youtube.com/watch?v=6YbBmqUnoQM]]
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''[[embed url=https://www.youtube.com/watch?v=6YbBmqUnoQM]]''')}}
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_escapes{{id}}">
<h2 id="md_ex_escapes{{id}}">Escapes and HTML</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. You can do the same with any of the
characters that have a special meaning<br>for Markdown.</p>
<p>Many simple HTML tags are allowed, for example &lt;b&gt; And unknown tags will be dropped.
To show a literal &lt;b&gt; or an unknown tag like &lt;foobar&gt; you need escape it with
HTML entities:
:</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;copy; special entities work
&amp;amp;copy; 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
&copy; special entities work
&amp;copy; if you want to escape it''')}}
<p>HTML tags that are block-level like &lt;div&gt; can be used, but if there is markdown formatting
within it, you must add a "markdown" attribute: &lt;div markdown&gt; Some safe attributes are also
allowed, permitting basic styling and layout: &lt;div markdown style="float:left"&gt;</p>
<p>Individual ampersands (&amp;) and less-than signs (&lt;) are fine, they will be shown as expected.</p>
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_moreheaders{{id}}">
<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>
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_toc1{{id}}">
<h2 id="md_ex_toc1{{id}}">Table of Contents</h2>
<p>You can display a list of links to jump to headers in a document. Sub-headers will be nested.</p>
<div class="codehilite"><pre>[TOC]
# Section 1
## Sub-section 1
# Section 2</pre></div>
<p>Output:</p>
{{g.markdown.convert('''[TOC]
# Section 1
## Sub-section 1
# Section 2''')}}
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_code{{id}}">
<h2 id="md_ex_code{{id}}">Code Highlighting</h2>
<p>The code highlighting syntax uses <a href="https://python-markdown.github.io/extensions/code_hilite/">CodeHilite</a> and is colored with <a href="https://pygments.org/">Pygments</a>. It follows the same syntax as regular Markdown <a href="#md_ex_pre">code blocks</a>, with ways to tell the highlighter what language to use for the code block.</p>
<p>The language will be detected automatically, if possible. Or you can specify it on the first line with 3 colons and the language name.</p>
<div class="codehilite"><pre>
:::python
import abc
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''
:::python
import abc''')}}
<p>If the first line of the codeblock contains a shebang, the language is derived from that and line numbers are used.
If shebang line contains a full path, it will be included in the output. If it does not contain a path (a single / or even a space),
then that shebang line will be omitted from output.
</p>
<div class="codehilite"><pre>
#!/usr/bin/python
import abc
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''
#!/usr/bin/python
import abc''')}}
<p>If using a code block of tildes or backticks, you can also specify the language on the first divider line</p>
<div class="codehilite"><pre>
~~~html
&lt;a href="#">My code&lt;/a>
~~~
</pre></div>
<div class="codehilite"><pre>
```html
&lt;a href="#">My code&lt;/a>
```
</pre></div>
<p>Output:</p>
{{g.markdown.convert('''
```html
<a href="#">My code</a>
```''')}}
<p>Many languages are supported. See all the "short names" listed in the <a href="https://pygments.org/docs/lexers/">Pygments docs</a>.</p>
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_includes{{id}}">
<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>
<p>Also, you can embed a file directly from a repository! Just skip the ref parameter and pass repository, path and optional revision:</p>
<div class="codehilite"><pre>
[[include repo=code path=README]]
[[include repo=myproject:code path=/ew/forms.py rev=fa61e7]]
[[include repo=p:myproject:code path=/ew/forms.py]]
</pre></div>
<p>Repo could be specified in three ways:</p>
<ul>
<li>app</li>
<li>project:app</li>
<li>neighborhood:project:app</li>
</ul>
<p>Where app is a repository's mount point, project is a project's shortname and neighborhood is a neighborhood's prefix that appears in url.</p>
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_neighborhood_notes{{id}}">
<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>
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_neighborhood_blog_posts{{id}}">
<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>
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_project_blog_posts{{id}}">
<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>
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_project_macros{{id}}" id="md_ex_project_macros{{id}}">
<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_member{{id}}">Project Member List</h2>
<p>You can display a list of project members. By default the list is limited to 20 members, and a link is provided to a page with the full list.</p>
<div class="codehilite"><pre>
[[members]]
</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>
</div>
<div class="markdown_syntax_section hidden_in_modal md_ex_thanks{{id}}">
<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>
</div>
{% endmacro %}
{% macro register_react_js_files(location='body_js') %}
{%- do g.register_forge_js('js/react.' + ('development' if h.asbool(tg.config.get('debug')) else 'production.min') + '.js', location=location) %}
{%- do g.register_forge_js('js/react-dom.' + ('development' if h.asbool(tg.config.get('debug')) else 'production.min') + '.js', location=location) %}
{# These 2 separate libraries are needed to migrate past React 15.5.0
see https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html
they were downloaded from unpkg.com since we don't do a npm/webpack build
a single line was added to the end of each so we don't have to change our code (or react-drag & react-reorderable code)
#}
{%- do g.register_forge_js('js/create-react-class.min.js', location=location) %}
{%- do g.register_forge_js('js/prop-types.min.js', location=location) %}
{%- endmacro %}
{% macro canonical_tag(page=None) %}
{# in case is inherithed from a child template and has no access to a page value #}
{% set page = request.GET['page'] if not page and 'page=' in request.query_string else page %}
{% if page == '0' %}
<link rel="canonical" href="{{ h.querystring(request, dict(page=None,limit=None)) }}"/>
{% else %}
<link rel="canonical" href="{{ h.querystring(request, dict(limit=None)) }}"/>
{% endif %}
{% endmacro %}
{% macro pagination_meta_tags(request, current_page=None, results_count=None, limit=None) %}
{%- if current_page > 0 -%}
{% if current_page == 1 %}
<link rel="prev" href="{{ h.querystring(request, dict(page=None,limit=None)) }}"/>
{% else %}
<link rel="prev" href="{{ h.querystring(request, dict(page=current_page - 1,limit=None)) }}"/>
{% endif %}
{% endif %}
{% set current_page = current_page + 1 %}
{% set total_pages = h.ceil(results_count/limit) %}
{% if results_count and current_page < total_pages -%}
<link rel="next" href="{{ h.querystring(request, dict(page=current_page,limit=None)) }}"/>
{% endif %}
{% endmacro %}