X-Git-Url: http://nitlanguage.org
diff --git a/src/nitcatalog.nit b/src/nitcatalog.nit
index e3e77f3..9dd3351 100644
--- a/src/nitcatalog.nit
+++ b/src/nitcatalog.nit
@@ -18,63 +18,13 @@
#
# The tool scans packages and generates the HTML files of a catalog.
#
-# ## Features
-#
-# * [X] scan packages and their `.ini`
-# * [X] generate lists of packages
-# * [X] generate a page per package with the readme and most metadata
-# * [ ] link/include/be included in the documentation
-# * [ ] propose `related packages`
-# * [X] show directory content (a la nitls)
-# * [X] gather git information from the working directory
-# * [ ] gather git information from the repository
-# * [ ] gather package information from github
-# * [ ] gather people information from github
-# * [ ] reify people
-# * [ ] separate information gathering from rendering
-# * [ ] move up information gathering in (existing or new) service modules
-# * [X] add command line options
-# * [ ] harden HTML (escaping, path injection, etc)
-# * [ ] nitcorn server with RESTful API
-#
-# ## Issues and limitations
-#
-# The tool works likee the other tools and expects to find valid Nit source code in the directories
-#
-# * cruft and temporary files will be collected
-# * missing source file (e.g. not yet generated by nitcc) will make information
-# incomplete (e.g. invalid module thus partial dependency and metrics)
-#
-# How to use the tool as the basis of a Nit code archive on the web usable with a package manager is not clear.
+# See `catalog` for details
module nitcatalog
import loader # Scan&load packages, groups and modules
-import doc::doc_down # Display mdoc
-import md5 # To get gravatar images
-import counter # For statistics
-import modelize # To process and count classes and methods
-
-redef class MPackage
- # Return the associated metadata from the `ini`, if any
- fun metadata(key: String): nullable String
- do
- var ini = self.ini
- if ini == null then return null
- return ini[key]
- end
+import catalog
- # The list of maintainers
- var maintainers = new Array[String]
-
- # The list of contributors
- var contributors = new Array[String]
-
- # The date of the most recent commit
- var last_date: nullable String = null
-
- # The date of the oldest commit
- var first_date: nullable String = null
-end
+import doc::templates::html_model
# A HTML page in a catalog
#
@@ -83,6 +33,9 @@ end
class CatalogPage
super Template
+ # The associated catalog, used to groups options and other global data
+ var catalog: Catalog
+
# Placeholder to include additional things before the ``.
var more_head = new Template
@@ -131,6 +84,37 @@ class CatalogPage
"""
end
+ # Inject piwik HTML code if required
+ private fun add_piwik
+ do
+ var tracker_url = catalog.piwik_tracker
+ if tracker_url == null then return
+
+ var site_id = catalog.piwik_site_id
+
+ tracker_url = tracker_url.trim
+ if tracker_url.chars.last != '/' then tracker_url += "/"
+ add """
+
+
+
+
+"""
+
+ end
+
redef fun rendering
do
add """
@@ -138,114 +122,86 @@ class CatalogPage
+"""
+ add_piwik
+ add """
+