import org.sonar.server.test.ws.CoveredFilesAction;
import org.sonar.server.test.ws.TestsWs;
import org.sonar.server.text.MacroInterpreter;
-import org.sonar.server.text.RubyTextService;
import org.sonar.server.ui.PageDecorations;
import org.sonar.server.ui.PageRepository;
import org.sonar.server.ui.DeprecatedViews;
// text
MacroInterpreter.class,
- RubyTextService.class,
// Notifications
NotificationModule.class,
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.text;
-
-import org.sonar.api.server.ServerSide;
-import org.sonar.markdown.Markdown;
-
-/**
- * @since 3.6
- */
-@ServerSide
-public class RubyTextService {
-
- private final MacroInterpreter macroInterpreter;
-
- public RubyTextService(MacroInterpreter macroInterpreter) {
- this.macroInterpreter = macroInterpreter;
- }
-
- // TODO add ruby example
- public String interpretMacros(String text) {
- return macroInterpreter.interpret(text);
- }
-
- // TODO add ruby example
- public String markdownToHtml(String markdown) {
- return Markdown.convertToHtml(markdown);
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.text;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-public class RubyTextServiceTest {
-
- MacroInterpreter macroInterpreter = mock(MacroInterpreter.class);
- RubyTextService text = new RubyTextService(macroInterpreter);
-
- @Test
- public void interpretMacros() {
- text.interpretMacros("text with macros");
- verify(macroInterpreter, times(1)).interpret("text with macros");
- }
-
- @Test
- public void markdownToHtml() {
- String html = text.markdownToHtml("some *markdown*");
- assertThat(html).isEqualTo("some <strong>markdown</strong>");
- }
-
- @Test
- public void should_escape_markdown_input() {
- String html = text.markdownToHtml("a > b");
- assertThat(html).isEqualTo("a > b");
- }
-}
false
end
- def self.markdown_to_html(markdown='')
- Internal.text.markdownToHtml(markdown)
- end
-
# Splits a string into an array of lines
# For history reference:
# - http://jira.sonarsource.com/browse/SONAR-2282 first modified the behaviour to keep the trailing lines
component(Java::OrgSonarServerIssue::InternalRubyIssueService.java_class)
end
- def self.text
- component(Java::OrgSonarServerText::RubyTextService.java_class)
- end
-
def self.users_api
component(Java::OrgSonarApiUser::RubyUserService.java_class)
end
class Issue
- def self.comment_to_hash(comment)
- {
- :key => comment.key(),
- :login => comment.userLogin(),
- :htmlText => Internal.text.markdownToHtml(comment.markdownText()),
- :createdAt => Api::Utils.format_datetime(comment.createdAt())
- }
- end
-
end