Writes a set of markdown lines into the StringBuilder.

@param aOut
The StringBuilder to write to.
@param aLines
The lines to write.
496870
private void _emitMarkedLines (final MarkdownHCStack aOut, final Line aLines)
  {
    final StringBuilder aIn = new StringBuilder ();
    Line aLine = aLines;
    while (aLine != null)
    {
      if (!aLine.m_bIsEmpty)
      {
        aIn.append (aLine.m_sValue.substring (aLine.m_nLeading, aLine.m_sValue.length () - aLine.m_nTrailing));
        if (aLine.m_nTrailing >= 2 && !m_bConvertNewline2Br)
          aIn.append ("<br />");
      }
      if (aLine.m_aNext != null)
      {
        aIn.append ('\n');
        if (m_bConvertNewline2Br)
          aIn.append ("<br />");
      }
      aLine = aLine.m_aNext;
    }

    _recursiveEmitLine (aOut, aIn.toString (), 0, EMarkToken.NONE);
  }
74895
private void _emitCodeLines (final MarkdownHCStack aOut,
                               final Line aLines,
                               @Nonnull final String sMeta,
                               final boolean bRemoveIndent)
  {
    Line aLine = aLines;
    if (m_aConfig.getCodeBlockEmitter () != null)
    {
      final ICommonsList <String> aList = new CommonsArrayList <> ();
      while (aLine != null)
      {
        if (aLine.m_bIsEmpty)
          aList.add ("");
        else
          aList.add (bRemoveIndent ? aLine.m_sValue.substring (4) : aLine.m_sValue);
        aLine = aLine.m_aNext;
      }
      m_aConfig.getCodeBlockEmitter ().emitBlock (aOut, aList, sMeta);
    }
    else
    {
      while (aLine != null)
      {
        if (!aLine.m_bIsEmpty)
          aOut.append (aLine.m_sValue.substring (4));
        aOut.append ('\n');
        aLine = aLine.m_aNext;
      }
    }
  }
1058312
public void encode(AsnOutputStream aos) throws EncodeException {

        try {
            aos.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG);
            int pos = aos.StartContentDefiniteLength();

            ext.encode(aos);

            aos.FinalizeContent(pos);

        } catch (AsnException e) {
            throw new EncodeException("AsnException when encoding UserInformation: " + e.getMessage(), e);
        }
    }
737953
public void writeTreesInOneLineFormat(File outFile) throws IOException {
        BufferedWriter writer = new BufferedWriter(new FileWriter(outFile));
        for (BinaryTree tree : this) {
            writer.write(tree.getAsOneLineString());
            writer.write("\n");
        }
        writer.close();        
    }
822365
void charsToLines(LinkedList<Change> diffs,
                                     List<String> lineArray) {
        StringBuilder text;
        for (Change diff : diffs) {
            text = new StringBuilder();
            for (int y = 0; y < diff.text.length(); y++) {
                text.append(lineArray.get(diff.text.charAt(y)));
            }
            diff.text = text.toString();
        }
    }
709291
public void encode(AsnOutputStream aos) throws EncodeException {

        // if (this.originatingTransactionId == null)
        // throw new ParseException("Error encoding TC-Begin: originatingTransactionId must not be null");

        try {
            aos.writeTag(Tag.CLASS_APPLICATION, false, _TAG);
            int pos = aos.StartContentDefiniteLength();

            // Utils.writeTransactionId(aos, this.originatingTransactionId, Tag.CLASS_APPLICATION, _TAG_OTX);
            aos.writeOctetString(Tag.CLASS_APPLICATION, _TAG_OTX, this.originatingTransactionId);

            if (this.dp != null)
                this.dp.encode(aos);

            if (component != null) {
                aos.writeTag(Tag.CLASS_APPLICATION, false, Component._COMPONENT_TAG);
                int pos2 = aos.StartContentDefiniteLength();
                for (Component c : this.component) {
                    c.encode(aos);
                }
                aos.FinalizeContent(pos2);
            }

            aos.FinalizeContent(pos);

        } catch (IOException e) {
            throw new EncodeException("IOException while encoding TC-Begin: " + e.getMessage(), e);
        } catch (AsnException e) {
            throw new EncodeException("AsnException while encoding TC-Begin: " + e.getMessage(), e);
        }

    }
1048391
public void log(Level level, Object... elements) {
		if(willWrite.compareTo(level)<=0) {
			StringBuilder sb = buildLine(level, new StringBuilder(),elements);
			if(context==null) {
				System.out.println(sb.toString());
			} else {
				context.log(sb.toString());
			}
		}
	}
598984
public void appendLine(Object... parts) {
    if (parts.length > 0) {
      sb.append(indent);
    }
    appendParts(parts);
    sb.append('\n');
  }
47867
protected void renderTextAreaValue(FacesContext facesContext, UIComponent uiComponent) throws IOException
    {
        ResponseWriter writer = facesContext.getResponseWriter();
        
        Object addNewLineAtStart = uiComponent.getAttributes().get(ADD_NEW_LINE_AT_START_ATTR);
        if (addNewLineAtStart != null)
        {
            boolean addNewLineAtStartBoolean = false;
            if (addNewLineAtStart instanceof String)
            {
                addNewLineAtStartBoolean = Boolean.valueOf((String)addNewLineAtStart);
            }
            else if (addNewLineAtStart instanceof Boolean)
            {
                addNewLineAtStartBoolean = (Boolean) addNewLineAtStart;
            }
            if (addNewLineAtStartBoolean)
            {
                writer.writeText("\n", null);
            }
        }
        
        String strValue = org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(facesContext, uiComponent);
        if (strValue != null)
        {
            writer.writeText(strValue, org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR);
        }
    }
143316
public function write(&$text)
    {
        $matches = array();

        if (strpos($text, '<html')) {

            //add language
            $text = str_replace('<html', '<html lang="'.$this->getService('anahita:language')->getTag().'"', $text);

            //render the styles
            $text = str_replace('</head>', $this->_renderHead().$this->_renderStyles().'</head>', $text);

            //render the scripts
            $text = str_replace('</body>', $this->_renderScripts().'</body>', $text);
        }
    }
6602
protected void writeRow(final String... columns) throws IOException {
		
		if( columns == null ) {
			throw new NullPointerException(String.format("columns to write should not be null on line %d", lineNumber));
		} else if( columns.length == 0 ) {
			throw new IllegalArgumentException(String.format("columns to write should not be empty on line %d",
				lineNumber));
		}
		
		StringBuilder builder = new StringBuilder();
		for( int i = 0; i < columns.length; i++ ) {
			
			columnNumber = i + 1; // column no used by CsvEncoder
			
			if( i > 0 ) {
				builder.append((char) preference.getDelimiterChar()); // delimiter
			}
			
			final String csvElement = columns[i];
			if( csvElement != null ) {
				final CsvContext context = new CsvContext(lineNumber, rowNumber, columnNumber);
				final String escapedCsv = encoder.encode(csvElement, context, preference);
				builder.append(escapedCsv);
				lineNumber = context.getLineNumber(); // line number can increment when encoding multi-line columns
			}
			
		}
		
		builder.append(preference.getEndOfLineSymbols()); // EOL
		writer.write(builder.toString());
	}
15707
public void writeCharacters(String text) throws XMLStreamException {
		try {
			this.checkPendingATEvents();
			encoder.encodeCharacters(new StringValue(text));
		} catch (Exception e) {
			throw new XMLStreamException(e.getLocalizedMessage(), e);
		}
	}
884989
@Override
    public void highlight(StringBuilder out, List<String> lines, String meta) {
        out.append("<pre");
        if (StringUtils.isNotBlank(meta)) {
            out.append(" class='brush:" + meta + "'");
        }
        out.append(">");
        for (String line : lines) {
            for (int i = 0; i < line.length(); i++) {
                final char c;
                switch (c = line.charAt(i)) {
                    case '&':
                        out.append("&amp;");
                        break;
                    case '<':
                        out.append("&lt;");
                        break;
                    case '>':
                        out.append("&gt;");
                        break;
                    default:
                        out.append(c);
                        break;
                }
            }
            out.append('\n');
        }
        out.append("</pre>");
    }
612648
public void encode(AsnOutputStream aos) throws EncodeException {

        if (invokeId == null)
            throw new EncodeException("No Invoke ID set.");

        try {
            aos.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG);
            int pos = aos.StartContentDefiniteLength();

            aos.writeInteger(this.invokeId);

            if (this.operationCode != null && this.parameter != null) {
                aos.writeTag(Tag.CLASS_UNIVERSAL, false, Tag.SEQUENCE);
                int pos2 = aos.StartContentDefiniteLength();
                this.operationCode.encode(aos);
                this.parameter.encode(aos);
                aos.FinalizeContent(pos2);
            }

            aos.FinalizeContent(pos);

        } catch (IOException e) {
            throw new EncodeException("IOException while encoding ReturnResult: " + e.getMessage(), e);
        } catch (AsnException e) {
            throw new EncodeException("AsnException while encoding ReturnResult: " + e.getMessage(), e);
        }
    }
745516
@Override
  public void write(TextWriterStream out, String label, int[] v) {
    StringBuilder buf = new StringBuilder();
    if(label != null) {
      buf.append(label).append('=');
    }
    if(v != null) {
      FormatUtil.formatTo(buf, v, " ");
    }
    out.inlinePrintNoQuotes(buf.toString());
  }
252118
public void encode(AsnOutputStream aos) throws EncodeException {

        if (this.errorCode == null)
            throw new EncodeException("Error encoding ReturnError: ErrorCode must not be null");
        if (this.correlationId == null)
            throw new EncodeException("Error encoding ReturnError: correlationId is mandatory but is not set");

        try {
            // tag
            aos.writeTag(Tag.CLASS_PRIVATE, false, ReturnError._TAG_RETURN_ERROR);
            int pos = aos.StartContentDefiniteLength();

            // correlationId
            byte[] buf = new byte[1];
            buf[0] = (byte) (long) this.correlationId;
            aos.writeOctetString(Tag.CLASS_PRIVATE, Component._TAG_INVOKE_ID, buf);

            // error code
            this.errorCode.encode(aos);

            // parameters
            if (this.parameter != null)
                this.parameter.encode(aos);
            else
                ParameterImpl.encodeEmptyParameter(aos);

            aos.FinalizeContent(pos);

        } catch (IOException e) {
            throw new EncodeException("IOException while encoding ReturnResult: " + e.getMessage(), e);
        } catch (AsnException e) {
            throw new EncodeException("AsnException while encoding ReturnResult: " + e.getMessage(), e);
        }
    }
193947
private static void writeParagraphs(final String text, final XmlStringBuilder xml) {
		if (!Util.empty(text)) {
			int start = 0;
			int end = text.length() - 1;

			// Set the start index to the first non-linebreak, so we don't emit leading ui:nl tags
			for (; start < end; start++) {
				char c = text.charAt(start);

				if (c != '\n' && c != '\r') {
					break;
				}
			}

			// Set the end index to the last non-linebreak, so we don't emit trailing ui:nl tags
			for (; start < end; end--) {
				char c = text.charAt(end);

				if (c != '\n' && c != '\r') {
					break;
				}
			}

			char lastChar = 0;

			for (int i = start; i <= end; i++) {
				char c = text.charAt(i);

				if (c == '\n' || c == '\r') {
					if (lastChar != 0) {
						xml.write("<ui:nl/>");
					}

					lastChar = 0;
				} else {
					xml.write(c);
					lastChar = c;
				}
			}
		}
	}