xartigas pushed a commit to branch master.

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

commit ca813f41a652d00bb1df253456e013929c65d375
Author: Lauro Moura <[email protected]>
Date:   Thu Aug 1 21:12:12 2019 +0200

    csharp: Add a documentation_string generator
    
    Summary:
    Escapes a single string, without leading `///`
    
    Depends on D9481
    
    Reviewers: segfaultxavi, felipealmeida
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D9482
---
 src/bin/eolian_mono/eolian/mono/documentation.hh | 27 ++++++++++++++++++++++++
 src/bin/eolian_mono/eolian/mono/struct_fields.hh |  2 +-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/src/bin/eolian_mono/eolian/mono/documentation.hh 
b/src/bin/eolian_mono/eolian/mono/documentation.hh
index 93bc42ef4b..588d0b68fa 100644
--- a/src/bin/eolian_mono/eolian/mono/documentation.hh
+++ b/src/bin/eolian_mono/eolian/mono/documentation.hh
@@ -567,6 +567,26 @@ documentation_generator 
as_generator(documentation_terminal)
     return documentation_generator(0);
 }
 
+/// Escape a single string, HTML-escaping and converting the syntax
+struct documentation_string_generator
+{
+  template<typename OutputIterator, typename Context>
+  bool generate(OutputIterator sink, std::string const& text, Context const& 
context) const
+  {
+      std::string escaped;
+      if 
(!as_generator(html_escaped_string).generate(std::back_inserter(escaped), text, 
context))
+        return false;
+
+      auto options = context_find_tag<options_context>(context);
+      auto state = context_find_tag<eolian_state_context>(context).state;
+      if (!as_generator(string).generate(sink, 
documentation_generator::syntax_conversion(escaped, state, options.want_beta), 
context))
+        return false;
+
+      return true;
+  }
+
+} const documentation_string {};
+
 } // namespace eolian_mono
 
 
@@ -577,6 +597,11 @@ struct 
is_eager_generator<::eolian_mono::documentation_generator> : std::true_ty
 template<>
 struct is_generator<::eolian_mono::documentation_generator> : std::true_type 
{};
 
+template<>
+struct is_eager_generator<::eolian_mono::documentation_string_generator> : 
std::true_type {};
+template<>
+struct is_generator<::eolian_mono::documentation_string_generator> : 
std::true_type {};
+
 template<>
 struct is_generator<::eolian_mono::documentation_terminal> : std::true_type {};
 
@@ -585,6 +610,8 @@ template<>
 struct attributes_needed<struct ::eolian_mono::documentation_generator> : 
std::integral_constant<int, 1> {};
 template<>
 struct attributes_needed<struct ::eolian_mono::documentation_terminal> : 
std::integral_constant<int, 1> {};
+template<>
+struct attributes_needed<struct ::eolian_mono::documentation_string_generator> 
: std::integral_constant<int, 1> {};
 }
 } } }
 
diff --git a/src/bin/eolian_mono/eolian/mono/struct_fields.hh 
b/src/bin/eolian_mono/eolian/mono/struct_fields.hh
index 5b755a7ffa..02b2cbec6e 100644
--- a/src/bin/eolian_mono/eolian/mono/struct_fields.hh
+++ b/src/bin/eolian_mono/eolian/mono/struct_fields.hh
@@ -42,7 +42,7 @@ struct field_argument_docs_generator
    template<typename OutputIterator, typename Context>
    bool generate(OutputIterator sink, attributes::struct_field_def const& 
field, Context const& context) const
    {
-       if (!as_generator("/// <param name=\"" << string << "\">" << string << 
"</param>")
+       if (!as_generator("/// <param name=\"" << string << "\">" << 
documentation_string << "</param>")
                .generate(sink, 
std::make_tuple(name_helpers::to_field_name(field.name), 
field.documentation.summary), context))
            return false;
        return true;

-- 


Reply via email to