nitc :: CardMetadata
nitc :: CardMetadata :: _id
nitc :: CardMetadata :: _metadata
Package metadata to displaynitc :: CardMetadata :: _title
nitc :: CardMetadata :: defaultinit
nitc :: CardMetadata :: metadata=
Package metadata to displaynitc $ CardMetadata :: SELF
Type of this instance, automatically specialized in every classnitc $ CardMetadata :: rendering
Service used to render the content of the template.nitc :: CardMetadata :: _id
nitc :: CardMEntity :: _id
template :: Template :: _is_frozen
Is the template allowing more modification (add
)
template :: Template :: _is_writing
Flag to avoid infinite recursivity if a template contains itselfnitc :: CardMetadata :: _metadata
Package metadata to displaytemplate :: Template :: _render_done
Flag to avoid multiple renderingnitc :: CardMEntity :: _title
nitc :: CardMetadata :: _title
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: CardMEntity :: defaultinit
nitc :: StaticCard :: defaultinit
nitc :: CardMetadata :: defaultinit
core :: Object :: defaultinit
core :: Writable :: defaultinit
template :: Template :: defaultinit
nitc :: CardMEntity :: full_doc=
Render the mentity full documentation?template :: Template :: is_frozen=
Is the template allowing more modification (add
)
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
template :: Template :: is_writing
Flag to avoid infinite recursivity if a template contains itselftemplate :: Template :: is_writing=
Flag to avoid infinite recursivity if a template contains itselfnitc :: CardMetadata :: metadata=
Package metadata to displaycore :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).template :: Template :: render_done=
Flag to avoid multiple renderingcore :: Writable :: write_to_bytes
Likewrite_to
but return a new Bytes (may be quite large)
core :: Writable :: write_to_file
Likewrite_to
but take care of creating the file
core :: Writable :: write_to_string
Likewrite_to
but return a new String (may be quite large).
# A card that displays the metadata about a package in the Nit catalog
class CardMetadata
super CardMEntity
autoinit(mentity, metadata, stats, deps, clients)
# Package metadata to display
var metadata: MPackageMetadata is writable
# Package stats
var stats: MPackageStats is writable
# Package dependencies
var deps: Array[MPackage] is writable
# Package clients
var clients: Array[MPackage] is writable
redef var id = "metadata_{super}" is lazy
redef var title = "Metadata"
redef fun rendering do
for maintainer in metadata.maintainers do
addn """
<p class='lead'>
{{{maintainer.to_html}}}
</p>"""
end
var license = metadata.license
if license != null then
addn """
<span class='text-muted'>
<a href='http://opensource.org/licenses/{{{license}}}'>{{{license}}}</a>
license
</span>"""
end
var homepage = metadata.homepage
var browse = metadata.browse
var issues = metadata.issues
if homepage != null or browse != null or issues != null then
addn """
<h4>Links</h4>
<ul class='list-unstyled'>"""
if homepage != null then addn "<li><a href='{homepage}'>Homepage</a></li>"
if browse != null then addn "<li><a href='{browse}'>Source Code</a></li>"
if issues != null then addn "<li><a href='{issues}'>Issues</a></li>"
addn "</ul>"
end
var git = metadata.git
var last_date = metadata.last_date
var first_date = metadata.first_date
if git != null then
addn """
<h4>Git</h4>
<ul class='list-unstyled'>
<li><a href='{{{git}}}'>{{{git}}}</a></li>
</ul>
<span class='text-muted'><b>{{{stats.commits}}}</b> commits</span>
<br>"""
if last_date != null then
addn """<b class=text-muted>Last:</b> {{{last_date}}}<br>"""
end
if first_date != null then
addn """<b class=text-muted>First:</b> {{{first_date}}}"""
end
end
addn """
<h4>Quality</h4>
<ul class='list-unstyled'>
<li>{{{stats.documentation_score}}}% documented</li>
</ul>"""
if metadata.tags.not_empty then
addn "<h4>Tags</h4>"
for tag in metadata.tags do
addn " <a href='tag_{tag.to_cmangle}.html'>{tag}</a>"
if tag != metadata.tags.last then add ", "
end
end
if deps.not_empty then
addn "<h4>Dependencies</h4>"
for dep in deps do
add dep.html_link
if dep != deps.last then add ", "
end
end
if clients.not_empty then
addn "<h4>Clients</h4>"
for client in clients do
add client.html_link
if client != clients.last then add ", "
end
end
if metadata.contributors.not_empty then
addn """
<h4>Contributors</h4>
<ul class='list-unstyled'>"""
for contrib in metadata.contributors do
addn """<li>{{{contrib.to_html}}}</li>"""
end
addn "</ul>"
end
addn """
<h4>Stats</h4>
<ul class='list-unstyled'>
<li>{{{stats.mmodules}}} modules</li>
<li>{{{stats.mclasses}}} classes</li>
<li>{{{stats.mmethods}}} methods</li>
<li>{{{stats.loc}}} loc</li>
</ul>"""
end
end
src/doc/static/static_cards.nit:558,1--675,3