v.warning(null, self, "Empty README for group `{mentity}`")
return
end
- var proc = new MarkdownProcessor
- proc.emitter = new ReadmeMdEmitter(proc, self, v)
- proc.emitter.decorator = new ReadmeDecorator
+ var proc = new ReadmeMdProcessor(self, v)
+ proc.decorator = new ReadmeDecorator
var md = mdoc.content.join("\n")
proc.process(md)
end
end
# Markdown emitter used to produce the `ReadmeArticle`.
-class ReadmeMdEmitter
- super MarkdownEmitter
+class ReadmeMdProcessor
+ super MarkdownProcessor
# Readme page being decorated.
var page: ReadmePage
#
# Called from `add_headline`.
private fun open_section(lvl: Int, title: String) do
- var section = new ReadmeSection(title.escape_to_c, title, lvl, processor)
+ var section = new ReadmeSection(title.escape_to_c, title, lvl, self)
var current_section = self.current_section
if current_section == null then
page.root.add_child(section)
private fun open_article do
var section: DocComposite = page.root
if current_section != null then section = current_section.as(not null)
- var article = new ReadmeArticle("mdarticle-{section.children.length}", null, processor)
+ var article = new ReadmeArticle("mdarticle-{section.children.length}", null, self)
section.add_child(article)
context.add article
push_article article
# Parser used to process doc commands
var parser = new DocCommandParser
- redef type EMITTER: ReadmeMdEmitter
+ redef type PROCESSOR: ReadmeMdProcessor
redef fun add_headline(v, block) do
var txt = block.block.first_line.as(not null).value
end
# Renders a link to a mentity.
- private fun add_mentity_link(v: EMITTER, mentity: MEntity, name, comment: nullable Text) do
+ private fun add_mentity_link(v: PROCESSOR, mentity: MEntity, name, comment: nullable Text) do
# TODO real link
var link = mentity.full_name
if name == null then name = mentity.name
redef class DocCommand
# Render the content of the doc command.
- fun render(v: ReadmeMdEmitter, token: TokenWikiLink) is abstract
+ fun render(v: ReadmeMdProcessor, token: TokenWikiLink) is abstract
end
-redef class ArticleCommand
+redef class CommentCommand
redef fun render(v, token) do
var string = args.first
var res = v.find_mentities(string)
if mentity isa MModule then
v.add_article new MEntitiesListArticle("Classes", null, mentity.mclassdefs)
else if mentity isa MClass then
- var mprops = mentity.collect_intro_mproperties(mentity.public_view)
+ var mprops = mentity.collect_intro_mproperties(v.phase.doc)
v.add_article new MEntitiesListArticle("Methods", null, mprops.to_a)
else if mentity isa MClassDef then
v.add_article new MEntitiesListArticle("Methods", null, mentity.mpropdefs)