Exemple #1
0
 protected CharSequence internalToHtmlParagraph(final Object it) {
   CharSequence _switchResult = null;
   boolean matched = false;
   if (!matched) {
     if (it instanceof TextOrMarkup) {
       final TextOrMarkup _textOrMarkup = (TextOrMarkup) it;
       matched = true;
       EList<EObject> _contents = _textOrMarkup.getContents();
       CharSequence _internalToHtmlParagraph = this.internalToHtmlParagraph(_contents);
       _switchResult = _internalToHtmlParagraph;
     }
   }
   if (!matched) {
     if (it instanceof List) {
       final List<EObject> _list = (List<EObject>) it;
       matched = true;
       final Function1<EObject, CharSequence> _function =
           new Function1<EObject, CharSequence>() {
             public CharSequence apply(final EObject it) {
               CharSequence _internalToHtmlParagraph =
                   HtmlExtensions.this.internalToHtmlParagraph(it);
               return _internalToHtmlParagraph;
             }
           };
       List<CharSequence> _map = ListExtensions.<EObject, CharSequence>map(_list, _function);
       String _join = IterableExtensions.join(_map);
       _switchResult = _join;
     }
   }
   if (!matched) {
     if (it instanceof TextPart) {
       final TextPart _textPart = (TextPart) it;
       matched = true;
       String _xblockexpression = null;
       {
         String _text = _textPart.getText();
         String _quote = this.quote(_text);
         String[] _split = _quote.split("^\\s*$");
         final String[] paragraphs = _split;
         final String[] _typeConverted_paragraphs = (String[]) paragraphs;
         final Function1<String, Boolean> _function =
             new Function1<String, Boolean>() {
               public Boolean apply(final String it) {
                 boolean _isEmpty = it.isEmpty();
                 boolean _operator_not = BooleanExtensions.operator_not(_isEmpty);
                 return Boolean.valueOf(_operator_not);
               }
             };
         Iterable<String> _filter =
             IterableExtensions.<String>filter(
                 ((Iterable<String>) Conversions.doWrapArray(_typeConverted_paragraphs)),
                 _function);
         StringConcatenation _builder = new StringConcatenation();
         _builder.append("</p>");
         _builder.newLine();
         _builder.append("<p>");
         _builder.newLine();
         String _join = IterableExtensions.join(_filter, _builder);
         _xblockexpression = (_join);
       }
       _switchResult = _xblockexpression;
     }
   }
   if (!matched) {
     if (it instanceof CodeBlock) {
       final CodeBlock _codeBlock = (CodeBlock) it;
       matched = true;
       CharSequence _internalToHtml = this.internalToHtml(_codeBlock, true);
       _switchResult = _internalToHtml;
     }
   }
   if (!matched) {
     CharSequence _html = this.toHtml(it);
     _switchResult = _html;
   }
   return _switchResult;
 }
Exemple #2
0
 protected CharSequence _toHtml(final TextPart it) {
   String _text = it.getText();
   String _quote = this.quote(_text);
   return _quote;
 }