forked from phoedos/pmd
render_markdown filter
This commit is contained in:
@ -11,13 +11,7 @@
|
||||
{% capture required_label %}{% if include.required %}<span class="label label-primary">Required</span> {% endif %}{% endcapture %}
|
||||
<tr>
|
||||
<td><code>{{ include.options | split: ',' | mappend: arg | join: "</code><br/><code>" }}</code></td>
|
||||
<td>{{ required_label }}
|
||||
{{ include.description
|
||||
| regex_replace: "`(.*?)`", "<code>\1</code>"
|
||||
| regex_replace: "\*\*(.*?)\*\*", "<b>\1</b>"
|
||||
| regex_replace: "\*(.*?)\*", "<i>\1</i>"
|
||||
| regex_replace: "\[(.*?)\]\((.*?)\)", "<a href='\2'>\1</a>" }}
|
||||
</td>
|
||||
<td>{{ required_label }}{{ include.description | render_markdown }}</td>
|
||||
<td><code>{{ include.default }}</code></td>
|
||||
<td>{{ include.languages }}</td>
|
||||
</tr>
|
||||
|
@ -68,6 +68,16 @@ module CustomFilters
|
||||
end
|
||||
end
|
||||
|
||||
def render_markdown(input)
|
||||
if input
|
||||
res = input
|
||||
res = res.gsub(/`(.*?)`/, '<code>\1</code>')
|
||||
res = res.gsub(/\*\*(.*?)\*\*/, '<b>\1</b>')
|
||||
res = res.gsub(/\*(.*?)\*/, '<i>\1</i>')
|
||||
res.gsub(/\[(.*?)\]\((.*?)\)/, '<a href="\2">\1</a>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
@ -39,7 +39,7 @@ The tool comes with a rather extensive help text, simply running with `-help`!
|
||||
{% include custom/cli_option_row.html options="-auxclasspath"
|
||||
option_arg="cp"
|
||||
description="Specifies the classpath for libraries used by the source code.
|
||||
This is used by the type resolution. Alternatively a `file://` URL
|
||||
This is used to resolve types in source files. Alternatively, a `file://` URL
|
||||
to a text file containing path elements on consecutive lines can be specified."
|
||||
languages="Java"
|
||||
%}
|
||||
|
Reference in New Issue
Block a user