Package org.jsoup.nodes

Examples of org.jsoup.nodes.Element.attr()


    if (session == 0) {
      session = System.currentTimeMillis();
      body.appendElement("br");
      Element sess = new Element(Tag.valueOf("div"), "", new Attributes());
      sess.addClass("session");
      sess.attr("id", String.valueOf(session));
      sess.append("Session started on " + new java.util.Date());
      body.appendChild(sess);
      body.appendElement("br");
      if (s.equals("")) {
        saveLogFile(doc);
View Full Code Here


        }
      } else if (eventDiv.select("div.single").size() != 0) {
        // single event
        Element a = eventDiv.select("div.single a").get(0);
        String eventName = a.text();
        String eventUri = a.attr("href");
        if (eventName != null && eventUri != null) {
          eventSource = new EventSource();
          eventSource.setEventName(eventName);
          eventSource.setEventUri("www.sportowefakty.pl" + eventUri);
        }
View Full Code Here

  }

  private String extractTeamEventUri(Element eventDiv) {
    try {
      Element teamA = eventDiv.select("div.teams div.home a").get(0);
      String href = teamA.attr("href");
      if (StringUtils.isNotBlank(href)) {
        return href.trim();
      } else {
        return null;
      }
View Full Code Here

                "target/test-classes/rendersample.asciidoc"), options);

        Document doc = Jsoup.parse(content, "UTF-8");
        Element anchorElement = doc.select("a[class=anchor]").first();

        assertThat(anchorElement.attr("href"), is("#_section_a"));

    }

    @Test
    public void ignore_undefined_attributes_should_keep_lines_with_undefined_attributes() {
View Full Code Here

                .toFile(false).get());

        Document doc = Jsoup.parse(content, "UTF-8");
        Element script = doc.getElementsByTag("script").first();

        assertThat(script.attr("src"), is("https://gist.github.com/123456.js"));
    }

    @Test
    public void a_block_macro_as_string_extension_should_be_executed_when_macro_is_detected() {
View Full Code Here

                .toFile(false).get());

        Document doc = Jsoup.parse(content, "UTF-8");
        Element script = doc.getElementsByTag("script").first();

        assertThat(script.attr("src"), is("https://gist.github.com/123456.js"));
    }

    @Test
    public void a_block_macro_as_instance_extension_should_be_executed_when_macro_is_detected() {
View Full Code Here

                .toFile(false).get());

        Document doc = Jsoup.parse(content, "UTF-8");
        Element script = doc.getElementsByTag("script").first();

        assertThat(script.attr("src"), is("https://gist.github.com/123456.js"));
    }

    @Test
    public void an_inline_macro_as_string_extension_should_be_executed_when_an_inline_macro_is_detected() {
View Full Code Here

        String content = asciidoctor.renderFile(new File("target/test-classes/sample-with-man-link.ad"), options()
                .toFile(false).get());

        Document doc = Jsoup.parse(content, "UTF-8");
        Element link = doc.getElementsByTag("a").first();
        assertThat(link.attr("href"), is("gittutorial.html"));
    }

    @Test
    public void an_inline_macro_extension_should_be_executed_when_an_inline_macro_is_detected() {
View Full Code Here

        String content = asciidoctor.renderFile(new File("target/test-classes/sample-with-man-link.ad"), options()
                .toFile(false).get());

        Document doc = Jsoup.parse(content, "UTF-8");
        Element link = doc.getElementsByTag("a").first();
        assertThat(link.attr("href"), is("gittutorial.html"));

    }

    @Test
    public void an_inline_macro_as_instance_extension_should_be_executed_when_regexp_is_set_as_option_inline_macro_is_detected() {
View Full Code Here

                .toFile(false).get());

        Document doc = Jsoup.parse(content, "UTF-8");
        Element link = doc.getElementsByTag("a").first();
        assertNotNull(link);
        assertThat(link.attr("href"), is("gittutorial.html"));

    }

    @Test
    public void an_inline_macro_as_instance_extension_should_be_executed_when_an_inline_macro_is_detected() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.