lauromoura pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=993b337e6798c5641b1272087a56e6c1c62a4eb5

commit 993b337e6798c5641b1272087a56e6c1c62a4eb5
Author: Jaehyun Cho <[email protected]>
Date:   Wed Sep 11 11:46:51 2019 -0300

    eolian_mono: fix documentation warning by using "<" and ">"
    
    Summary:
    If type A: list<B>; is written in eo, then documentation warning
    occurs because list<B> is written in the documentation without string
    conversion.
    
    To fix the warning, "<" and ">" are converted into "&lt;" and "&gt;".
    
    Reviewers: lauromoura
    
    Reviewed By: lauromoura
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D9891
---
 src/bin/eolian_mono/eolian/mono/alias_definition.hh |  8 ++++++--
 src/bin/eolian_mono/eolian/mono/utils.hh            | 14 ++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/bin/eolian_mono/eolian/mono/alias_definition.hh 
b/src/bin/eolian_mono/eolian/mono/alias_definition.hh
index a6cfadbca5..12d9ce78f9 100644
--- a/src/bin/eolian_mono/eolian/mono/alias_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/alias_definition.hh
@@ -37,6 +37,10 @@ struct alias_definition_generator
      if 
(!as_generator(eolian_mono::type).generate(std::back_inserter(alias_type), 
alias.base_type, context))
        return false;
 
+     std::string alias_type_doc;
+     alias_type_doc = utils::replace_all(alias_type, "<", "&lt;");
+     alias_type_doc = utils::replace_all(alias_type_doc, ">", "&gt;");
+
      std::string const alias_name = utils::remove_all(alias.eolian_name, '_');
      if (!as_generator(
                  documentation
@@ -44,7 +48,7 @@ struct alias_definition_generator
                  << "{\n"
                  << scope_tab << "private " << alias_type << " payload;\n\n"
 
-                 << scope_tab << "/// <summary>Converts an instance of " << 
alias_type << " to this struct.</summary>\n"
+                 << scope_tab << "/// <summary>Converts an instance of " << 
alias_type_doc << " to this struct.</summary>\n"
                  << scope_tab << "/// <param name=\"value\">The value to be 
converted.</param>\n"
                  << scope_tab << "/// <returns>A struct with the given 
value.</returns>\n"
                  << scope_tab << "public static implicit operator " << 
alias_name << "(" << alias_type << " value)\n"
@@ -52,7 +56,7 @@ struct alias_definition_generator
                  << scope_tab << scope_tab << "return new " << alias_name << 
"{payload=value};\n"
                  << scope_tab << "}\n\n"
 
-                 << scope_tab << "/// <summary>Converts an instance of this 
struct to " << alias_type << ".</summary>\n"
+                 << scope_tab << "/// <summary>Converts an instance of this 
struct to " << alias_type_doc << ".</summary>\n"
                  << scope_tab << "/// <param name=\"value\">The value to be 
converted packed in this struct.</param>\n"
                  << scope_tab << "/// <returns>The actual value the alias is 
wrapping.</returns>\n"
                  << scope_tab << "public static implicit operator " << 
alias_type << "(" << alias_name << " value)\n"
diff --git a/src/bin/eolian_mono/eolian/mono/utils.hh 
b/src/bin/eolian_mono/eolian/mono/utils.hh
index 392cb00f11..9e583df4f9 100644
--- a/src/bin/eolian_mono/eolian/mono/utils.hh
+++ b/src/bin/eolian_mono/eolian/mono/utils.hh
@@ -88,6 +88,20 @@ namespace eolian_mono { namespace utils {
        else
            return false;
    }
+
+   inline std::string replace_all(std::string s, std::string target, 
std::string replace)
+   {
+       size_t pos = s.find(target);
+
+       while (pos != std::string::npos)
+       {
+           s.replace(pos, target.length(), replace);
+           pos += replace.length();
+           pos = s.find(target, pos);
+       }
+
+       return s;
+   }
 } }
 
 #endif

-- 


Reply via email to