summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-08-01 21:12:12 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-08-01 21:12:36 +0200
commitca813f41a652d00bb1df253456e013929c65d375 (patch)
treee6544c02eef2a1e110819dd7241a67b2be5a9461 /src/bin
parentbecef7aee4e6390488db5889942d2df6f7aa9bc2 (diff)
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
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian_mono/eolian/mono/documentation.hh27
-rw-r--r--src/bin/eolian_mono/eolian/mono/struct_fields.hh2
2 files changed, 28 insertions, 1 deletions
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)
567 return documentation_generator(0); 567 return documentation_generator(0);
568} 568}
569 569
570/// Escape a single string, HTML-escaping and converting the syntax
571struct documentation_string_generator
572{
573 template<typename OutputIterator, typename Context>
574 bool generate(OutputIterator sink, std::string const& text, Context const& context) const
575 {
576 std::string escaped;
577 if (!as_generator(html_escaped_string).generate(std::back_inserter(escaped), text, context))
578 return false;
579
580 auto options = context_find_tag<options_context>(context);
581 auto state = context_find_tag<eolian_state_context>(context).state;
582 if (!as_generator(string).generate(sink, documentation_generator::syntax_conversion(escaped, state, options.want_beta), context))
583 return false;
584
585 return true;
586 }
587
588} const documentation_string {};
589
570} // namespace eolian_mono 590} // namespace eolian_mono
571 591
572 592
@@ -578,6 +598,11 @@ template<>
578struct is_generator<::eolian_mono::documentation_generator> : std::true_type {}; 598struct is_generator<::eolian_mono::documentation_generator> : std::true_type {};
579 599
580template<> 600template<>
601struct is_eager_generator<::eolian_mono::documentation_string_generator> : std::true_type {};
602template<>
603struct is_generator<::eolian_mono::documentation_string_generator> : std::true_type {};
604
605template<>
581struct is_generator<::eolian_mono::documentation_terminal> : std::true_type {}; 606struct is_generator<::eolian_mono::documentation_terminal> : std::true_type {};
582 607
583namespace type_traits { 608namespace type_traits {
@@ -585,6 +610,8 @@ template<>
585struct attributes_needed<struct ::eolian_mono::documentation_generator> : std::integral_constant<int, 1> {}; 610struct attributes_needed<struct ::eolian_mono::documentation_generator> : std::integral_constant<int, 1> {};
586template<> 611template<>
587struct attributes_needed<struct ::eolian_mono::documentation_terminal> : std::integral_constant<int, 1> {}; 612struct attributes_needed<struct ::eolian_mono::documentation_terminal> : std::integral_constant<int, 1> {};
613template<>
614struct attributes_needed<struct ::eolian_mono::documentation_string_generator> : std::integral_constant<int, 1> {};
588} 615}
589} } } 616} } }
590 617
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
42 template<typename OutputIterator, typename Context> 42 template<typename OutputIterator, typename Context>
43 bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const 43 bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
44 { 44 {
45 if (!as_generator("/// <param name=\"" << string << "\">" << string << "</param>") 45 if (!as_generator("/// <param name=\"" << string << "\">" << documentation_string << "</param>")
46 .generate(sink, std::make_tuple(name_helpers::to_field_name(field.name), field.documentation.summary), context)) 46 .generate(sink, std::make_tuple(name_helpers::to_field_name(field.name), field.documentation.summary), context))
47 return false; 47 return false;
48 return true; 48 return true;