src/doc: IntroArticle use new templates
authorAlexandre Terrasa <alexandre@moz-code.org>
Tue, 24 Feb 2015 00:00:26 +0000 (01:00 +0100)
committerAlexandre Terrasa <alexandre@moz-code.org>
Sat, 25 Apr 2015 01:32:42 +0000 (21:32 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/doc/doc_phases/doc_html.nit
src/doc/html_templates/html_templates.nit

index 3329fc5..d96d2f9 100644 (file)
@@ -606,24 +606,8 @@ redef class IntroArticle
                        article.source_link = v.tpl_showsource(mentity.location)
                end
                # article.subtitle = mentity.html_declaration
-               # FIXME diff hack
-               if mentity isa MProperty then
-                       # intro title
-                       var ns = mentity.intro.mclassdef.mmodule.html_namespace
-                       var section = new TplSection("intro")
-                       var title = new Template
-                       title.add "Introduction in "
-                       title.add ns
-                       section.title = title
-                       section.summary_title = "Introduction"
-                       var intro = mentity.intro.tpl_article
-                       intro.source_link = v.tpl_showsource(mentity.intro.location)
-                       section.add_child intro
-                       parent.add_child section
-               else
-                       article.content = mentity.tpl_definition
-                       parent.add_child article
-               end
+               article.content = write_to_string
+               parent.add_child article
        end
 end
 
index 540ec24..51af59c 100644 (file)
@@ -17,6 +17,7 @@ module html_templates
 
 import html_model
 import html::bootstrap
+import doc_phases::doc_structure
 
 # Renders the page as HTML.
 redef class DocPage
@@ -265,3 +266,15 @@ redef class DocArticle
        # without notice in further version.
        redef fun render_title do end
 end
+
+redef class IntroArticle
+       redef var html_id is lazy do return "article_intro_{mentity.nitdoc_id}"
+       redef var html_title is lazy do return null
+       redef var is_hidden = false
+
+       redef fun render_body do
+               var comment = mentity.html_comment
+               if comment != null then addn comment
+               super
+       end
+end