Create a new Link to a table
@param text the text content
@param table the destination
@return the link
192942
public static Link create(final String text, final NamedObject table) {
        return new Link(text, null, '#'+table.getName());
    }
390872
public static Document create(@NonNull String id, @NonNull String text) {
      return DocumentFactory.getInstance().create(id, text);
   }
935839
public static R create(String text) {
        R run = factory.createR();
        setText(run, text);
        return run;
    }
825110
public ParagraphBuilder link(final String text, final Table table) {
		final ParagraphElement paragraphElement = Link.create(text, table);
		this.paragraphElements.add(paragraphElement);
		return this;
	}
274275
public ParagraphBuilder link(final String text, final File file) {
		final ParagraphElement paragraphElement = Link.create(text, file);
		this.paragraphElements.add(paragraphElement);
		return this;
	}
992382
public OptionBuilder withDescription( String text )
    {
        if (option.getDescription() != null) throw new IllegalArgumentException( "Description given twice" );
        option.setDescription( text );
        return this;
    }
1184453
function inlineLinks (text, options) {
  if (text) {
    var links = ddata.parseLink(text)
    links.forEach(function (link) {
      var linked = ddata._link(link.url, options)
      if (link.caption === link.url) link.caption = linked.name
      if (linked.url) link.url = linked.url
      text = text.replace(link.original, '[' + link.caption + '](' + link.url + ')')
    })
  }
  return text
}
243461
private static String tableToHtml( Table t ){

		if( t == null ) {
			return "null";
		}

		StringBuilder result = new StringBuilder();

		int colspan;
		try{
			colspan = t.getTableElement( t.nrOfTableElements()-1 ).getCol()+1;
		}catch( Exception e){
			colspan = 1;
		}

		result.append("<table class=\"Table\">\n<tr><th colspan="+colspan+" class=\"Table\">Table");

		if( t.getTitleElement()!=null ) {
			result.append( contentElementToHtml( t.getTitleElement() ) );
		}

		result.append("</th></tr>\n<tr>\n");

		int row = 0;
		for( int i=0; i<t.nrOfTableElements(); i++ ){
			TableElement td = t.getTableElement(i);
			if( td.getRow() > row ){
				result.append( "</tr><tr>\n");
				row = td.getRow();
			}

			result.append( "<td class=\"Table\">\n" + tableElementToHtml( td ) +"</td>\n" );
		}

		result.append("</tr>\n</table>\n");
		return result.toString();
	}
322496
def _html_link_cells(self):
        
        new_table = self.copy()
        for row in new_table:
            for c in new_table.columns:
                link = '%s <Link>' % c
                if row.get(link, None):
                    row[c] = '<a href="%s">%s</a>' % (row[link], row[c])

        new_table.columns = [c for c in self.columns if '<Link>' not in c]
        return new_table
258660
public static TextElement code(String text) {
		TextElement element = text(text);
		element.textStyles.add(TextStyle.CODE);
		return element;
	}
142053
public TextBuilder link(final String text, final File file) {
        this.curParagraphBuilder.link(text, file);
        return this;
    }
624728
public void getReferenceTableTexts(TableCandidate tc,
	    ArrayList<ArrayList<TextPiece>> linesByPage) {
	/*
	 * Gets the table caption beginning part, e.g., "Table 4"
	 */
	String thisCaption = tc.getCaption().replace(" ", "");
	char lastCharInThisKwd = tc.getKeyword().charAt(
		tc.getKeyword().length() - 1);
	int indexAfterKwd = thisCaption.indexOf(lastCharInThisKwd);
	int ii = indexAfterKwd + 1;
	int captionIndex_start = ii;
	int captionIndex_end = ii + 1;
	while ((ii < thisCaption.length() - 1)
		&& (captionIndex_end - captionIndex_start < 2)
		&& (captionIndex_end >= captionIndex_start)) { // for: Table 12
							       // 4 datasets.
							       // for such case,
							       // we may get
							       // "Tabl124" to
							       // start the
							       // reference text
							       // search,
							       // without the
							       // 2nd condition.
	    String nextChar = thisCaption.substring(ii, ii + 1);
	    if ((nextChar.compareToIgnoreCase(".") != 0)
		    && (nextChar.matches("[0-9]") == true)
		    && (nextChar.compareToIgnoreCase(":") != 0)
		    && (nextChar.compareToIgnoreCase(",") != 0))
		ii++;
	    else {
		captionIndex_end = ii;
		break;
	    }
	}
	String thisTableCaptionBeginning = thisCaption.substring(0, ii);
	/*
	 * Gets each character in the table caption beginning part
	 */
	int cationBeginningLength = thisTableCaptionBeginning.length();
	char[] charsInCaptionBeginning = new char[cationBeginningLength];
	for (int i = 0; i < cationBeginningLength; i++) {
	    charsInCaptionBeginning[i] = thisTableCaptionBeginning.charAt(i);
	}

	if (linesByPage != null && linesByPage.size() != 0
		&& thisTableCaptionBeginning.length() > 5) {
	    for (int k = 0; k < linesByPage.size(); k++) {
		ArrayList<TextPiece> linesThisPage = linesByPage.get(k);
		for (int j = 0; j < linesThisPage.size(); j++) {
		    String thisLine = linesThisPage.get(j).getText()
			    .replace(" ", "");
		    if ((k == tc.getPageId_thisTable())
			    && (j >= tc.getCaptionStartLine())
			    && (j <= tc.getCaptionEndLine())) {
		    }// filter out the table caption itself
		    else {
			if ((thisLine).contains(thisTableCaptionBeginning) == true) {
			    /*
			     * Finds the Index of the Table Caption beginning
			     * part in the matched document line. E.g., the "2"
			     * in "Table 2."
			     */
			    String thisLine_Orig = linesThisPage.get(j)
				    .getText();
			    int kk = thisLine
				    .indexOf(thisTableCaptionBeginning);

			    int beginIndex = thisLine_Orig.indexOf(
				    charsInCaptionBeginning[0], kk);
			    int endIndex = thisLine_Orig
				    .indexOf(
					    charsInCaptionBeginning[cationBeginningLength - 1],
					    beginIndex) + 1;
			    String thisPiece = "";
			    while (beginIndex < thisLine_Orig.length()
				    && endIndex < thisLine_Orig.length()
				    && (endIndex - beginIndex) > 5
				    && beginIndex >= 0 && endIndex > 0) {
				thisPiece = thisLine_Orig.substring(beginIndex,
					endIndex).replace(" ", "");
				/*
				 * for "Table 11", "thisPiece" can be "Table1"
				 */
				if (thisTableCaptionBeginning
					.startsWith(thisPiece)) {
				    while ((thisPiece.length() < thisTableCaptionBeginning
					    .length())
					    && (endIndex < thisLine_Orig
						    .length() - 1)) {
					endIndex++;
					thisPiece = thisLine_Orig.substring(
						beginIndex, endIndex).replace(
						" ", "");
				    }
				    break;
				} else {
				    beginIndex = thisLine_Orig.indexOf(
					    charsInCaptionBeginning[0],
					    endIndex);
				    endIndex = thisLine_Orig
					    .indexOf(
						    charsInCaptionBeginning[cationBeginningLength - 1],
						    beginIndex);
				}
			    }

			    if ((endIndex < thisLine_Orig.length() - 3)
				    && (endIndex > 0)
				    && (beginIndex >= 0)
				    && (thisLine_Orig.substring(endIndex,
					    endIndex + 2).matches("[ ][0-9]") == false)
				    && (thisLine_Orig.substring(endIndex,
					    endIndex + 2).matches("[0-9][.]") == false)
				    && (thisLine_Orig.substring(endIndex,
					    endIndex + 2).matches("[0-9][ ]") == false)
				    && (thisLine_Orig.substring(endIndex,
					    endIndex + 2).matches("[.][0-9]") == false)) {
				String firstHalfLine = thisLine_Orig.substring(
					0, beginIndex);
				String secondHalfLine = thisLine_Orig
					.substring(endIndex);

				/*
				 * Looks up all text of the reference
				 */
				int totalPeriodNum = 0;
				int periodNum_thisLine = 0;
				String curRef = "";
				int nextIndex = j;
				String line = secondHalfLine;
				while (nextIndex < linesThisPage.size() - 1) {
				    if ((k == tc.getPageId_thisTable())
					    && nextIndex <= tc.getBodyEndLine()
					    && nextIndex >= tc
						    .getBodyStartLine()) {
					break;
				    }
				    /*
				     * Gets the number of periods in the line.
				     * If the total period number < 2, get the
				     * whole line, otherwise, cut and break
				     */
				    for (int qq = 0; qq < line.length(); qq++) {
					if (line.substring(qq, qq + 1)
						.contentEquals(".") == true)
					    periodNum_thisLine++;
				    }
				    totalPeriodNum = totalPeriodNum
					    + periodNum_thisLine;
				    if (totalPeriodNum < 2) {
					curRef = curRef + " " + line;
					nextIndex++;
					line = linesThisPage.get(nextIndex)
						.getText();
					periodNum_thisLine = 0;
				    } else {
					if (totalPeriodNum == 2) {
					    if (periodNum_thisLine == 1) {
						String lines = line.substring(
							0,
							line.indexOf(".") + 1);
						curRef = curRef + " " + lines;
						break;
					    }
					    if (periodNum_thisLine == 2) {
						String lines = line
							.substring(
								0,
								line.lastIndexOf(".") + 1);
						curRef = curRef + " " + lines;
						break;
					    }
					}
					/*
					 * totalPeriodNum>2. In this case,
					 * periodNum_thisLine will >=2
					 */
					else {
					    int firstDot = line.indexOf(".");
					    int secondDot = line.indexOf(".",
						    firstDot);
					    String lines = line.substring(0,
						    secondDot + 1);
					    curRef = curRef + " " + lines;
					    break;
					}
				    }
				}

				/*
				 * Looks up the previous period "."
				 */
				totalPeriodNum = 0;
				periodNum_thisLine = 0;
				String preRef = "";
				int preIndex = j;
				line = firstHalfLine;
				while (preIndex > 0) {
				    if ((k == tc.getPageId_thisTable())
					    && preIndex <= tc.getBodyEndLine()
					    && preIndex >= tc
						    .getBodyStartLine()) {
					break;
				    }
				    /*
				     * Gets the period number in line, if total
				     * period number < 2, get the whole line,
				     * otherwise, cut and break
				     */
				    for (int qq = 0; qq < line.length(); qq++) {
					if (line.substring(qq, qq + 1)
						.contentEquals(".") == true)
					    periodNum_thisLine++;
				    }
				    totalPeriodNum = totalPeriodNum
					    + periodNum_thisLine;
				    if (totalPeriodNum < 2) {
					preRef = line + " " + preRef;
					preIndex--;
					line = linesThisPage.get(preIndex)
						.getText();
					periodNum_thisLine = 0;
				    } else {
					/*
					 * No matter this line has 1 or 2 ".",
					 * we get the part after the first "."
					 */
					if (totalPeriodNum == 2) {
					    String lines = line.substring(
						    line.indexOf(".") + 1,
						    line.length());
					    preRef = lines + " " + preRef;
					    break;
					}
					/*
					 * totalPeriodNum>2. In this case,
					 * periodNum_thisLine will >=2
					 */
					else {
					    int lastDot = line.lastIndexOf(".");
					    int secondLastDot = line.substring(
						    lastDot).lastIndexOf(".");
					    String lines = line.substring(
						    secondLastDot + 1,
						    line.length());
					    preRef = lines + " " + preRef;
					    break;
					}
				    }
				}

				String thisReference = preRef
					+ thisTableCaptionBeginning + curRef;
				// thisReference =
				// tc.replaceAllSpecialChracters(thisReference);

				String referenceText = tc.getRefText()
					+ "\n In PAGE " + (k + 1) + ": ..."
					+ thisReference + "...";
				tc.setRefText(referenceText);
			    }
			}
		    }
		}// end for
	    }
	} else {
	    tc.setRefText("");
	}

    }
14708
private void addContents(String text) {

        int firstColSelected = table.getSelectedColumn();
        int firstRowSelected = table.getSelectedRow();
        int temp = firstColSelected;

        if (firstColSelected == -1 || firstRowSelected == -1) {
            return;
        }
        ArrayList<ArrayList<String>> clipboard = parseString(text);
        for (int i = 0; i < clipboard.size(); i++) {
            for (int j = 0; j < clipboard.get(i).size(); j++) {
                try {
                    table.getModel().setValueAt(clipboard.get(i).get(j), firstRowSelected, temp++);
                } catch (Exception e) {
                }
            }
            temp = firstColSelected;
            firstRowSelected++;
        }
    }
607511
public ChatMessage sendMessage(String text) {
        if (text != null && !text.isEmpty()) {
            ChatMessage message = new ChatMessage(self, text);
            eventManager.fireRemoteEvent(sendEvent, message);
            return message;
        }
        
        return null;
    }
204155
public Table url(URL url) throws IOException {
	URLConnection connection = url.openConnection();
	String contentType = connection.getContentType();
	String[] pair = contentType.split(";");
	String mimeType = pair[0].trim();
	Charset charset = pair.length == 0 ? Charset.defaultCharset() : Charset.forName(pair[1].split("=")[1].trim());
	DataReader<?> reader = registry.getReaderForMimeType(mimeType);
	return reader.read(new Source(connection.getInputStream(), charset));
    }
841908
public static Pippo send(final String text) {
        Pippo pippo = new Pippo();
        pippo.GET("/", routeContext -> routeContext.send(text));
        pippo.start();

        return pippo;
    }
745832
private WPanel createPanelWithText(final String title, final String text) {
		WPanel panel = new WPanel(WPanel.Type.CHROME);
		panel.setTitleText(title);
		WText textComponent = new WText(text);
		textComponent.setEncodeText(false);
		panel.add(textComponent);

		return panel;
	}