mono-docs: Allow embedding external examples
authorXavi Artigas <xavierartigas@yahoo.es>
Thu, 11 Apr 2019 08:38:40 +0000 (10:38 +0200)
committerShinwoo Kim <cinoo.kim@samsung.com>
Wed, 17 Apr 2019 01:09:29 +0000 (10:09 +0900)
commitd041e9b2ee9ace25f05d8e3264d894f68ef98d06
tree6c6c42c3d2633ad4aad2aa9f9feb494a5c2a0521
parent129efa2de27221bf1d058fc0da67ccf3ee8fc88a
mono-docs: Allow embedding external examples

Summary:
New option added to eolian_gen: -e <dir>
This specifies a directory to search for examples. If a file is found with the
same name as an EFL C# class (e.g. Efl.Ui.Button.cs) or as an EFL C# method or
property (e.g. Efl.IText.Text.cs, Efl.IText.SetText.cs) its full
contents will be embedded in the documentation for that class or method within
<example> and <code> tags. This is, in turn, is parsed by DocFX and shown
in Example boxes in the generated pages.
If an example file is not found, no examples are embedded for that object.
If -e is not used, no examples are embedded for any object.

New option added to meson: mono-examples-dir to point to the examples directory.
This directory is then passed to eolian_mono through -e.
Do not use it (or define it to nothing) to disable example embedding.

No performance drop has been observed because of these extra tests.

Right now examples can only be given for base classes, not for derived ones
(i.e. Efl.IText.Text but not Efl.Ui.Button.Text). This will be addressed in a
later commit.

Feature
Depends on D8587

Test Plan:
Create an examples folder and put some files in it:
```
mkdir /tmp/examples
echo 'var button = new Efl.Ui.Button();' > /tmp/examples/Efl.Ui.Button.cs
echo 'button.AutoRepeatEnabled = true;' > /tmp/examples/Efl.Ui.IAutorepeat.AutorepeatEnabled.cs
echo 'button.SetAutoRepeatEnabled(true);' > /tmp/examples/Efl.Ui.IAutorepeat.SetAutorepeatEnabled.cs
```
Configure meson to embed examples and build:
```
meson configure -Dmono-examples-dir=/tmp/examples
ninja
```
Examine the generated efl_ui_button.eo.cs file to see embedded <example> tags,
or run DocFX and bask in the glory of documentation pages with examples:
```
cd doc/docfx
./gendoc.sh
```

Reviewers: lauromoura, felipealmeida, vitor.sousa, zmike, bu5hm4n

Reviewed By: vitor.sousa

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8592
meson_options.txt
src/bin/eolian_mono/eolian/mono/documentation.hh
src/bin/eolian_mono/eolian/mono/generation_contexts.hh
src/bin/eolian_mono/eolian_mono.cc
src/bindings/mono/meson.build