org.eclipse.mylyn.wikitext.core_1.6.1.v20120425-0100

gins bodyMargins)
    {
      this.bodyMargins = bodyMargins;
    }
    
    public void setBodyBeforeRegion(XslfoDocumentBuilder.Region region)
    {
      region.setName("before");
      bodyBeforeRegion = region;
    }
    
    public XslfoDocumentBuilder.Region getBodyBeforeRegion()
    {
      return bodyBeforeRegion;
    }
    
    public void setBodyAfterRegion(XslfoDocumentBuilder.Region region)
    {
      region.setName("after");
      bodyAfterRegion = region;
    }
    
    public XslfoDocumentBuilder.Region getBodyAfterRegion()
    {
      return bodyAfterRegion;
    }
    
    public void setBodyStartRegion(XslfoDocumentBuilder.Region region)
    {
      region.setName("start");
      bodyStartRegion = region;
    }
    
    public XslfoDocumentBuilder.Region getBodyStartRegion()
    {
      return bodyStartRegion;
    }
    
    public void setBodyEndRegion(XslfoDocumentBuilder.Region region)
    {
      region.setName("end");
      bodyEndRegion = region;
    }
    
    public XslfoDocumentBuilder.Region getBodyEndRegion()
    {
      return bodyEndRegion;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.parser.builder.XslfoDocumentBuilder
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.parser.builder;

import java.io.File;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;

public class HtmlDocumentBuilder$Stylesheet
{
  private final String url;
  private final File file;
  private final Reader reader;
  private final Map<String, String> attributes = new HashMap();
  
  public HtmlDocumentBuilder$Stylesheet(File file)
  {
    if (file == null) {
      throw new IllegalArgumentException();
    }
    this.file = file;
    url = null;
    reader = null;
  }
  
  public HtmlDocumentBuilder$Stylesheet(String url)
  {
    if ((url == null) || (url.length() == 0)) {
      throw new IllegalArgumentException();
    }
    this.url = url;
    file = null;
    reader = null;
  }
  
  public HtmlDocumentBuilder$Stylesheet(Reader reader)
  {
    if (reader == null) {
      throw new IllegalArgumentException();
    }
    this.reader = reader;
    file = null;
    url = null;
  }
  
  public Map<String, String> getAttributes()
  {
    return attributes;
  }
  
  public File getFile()
  {
    return file;
  }
  
  public String getUrl()
  {
    return url;
  }
  
  public Reader getReader()
  {
    return reader;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder.Stylesheet
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.parser.builder;

import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.BlockType;

class XslfoDocumentBuilder$BlockInfo
  extends XslfoDocumentBuilder.ElementInfo
{
  final DocumentBuilder.BlockType type;
  int listItemCount;
  BlockInfo previousChild;
  
  public XslfoDocumentBuilder$BlockInfo(DocumentBuilder.BlockType type)
  {
    super(null);
    this.type = type;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.parser.builder.XslfoDocumentBuilder.BlockInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.parser.builder;

import java.io.Writer;
import java.net.URI;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder;
import org.eclipse.mylyn.wikitext.core.util.DefaultXmlStreamWriter;
import org.eclipse.mylyn.wikitext.core.util.XmlStreamWriter;

public abstract class AbstractXmlDocumentBuilder
  extends DocumentBuilder
{
  private static final Pattern ABSOLUTE_URL_PATTERN = Pattern.compile("(([a-zA-Z]{3,8}://?.*)|(mailto:.*))");
  protected XmlStreamWriter writer;
  protected URI base;
  protected boolean baseInHead = false;
  
  public AbstractXmlDocumentBuilder(Writer out)
  {
    writer = createXmlStreamWriter(out);
  }
  
  public AbstractXmlDocumentBuilder(XmlStreamWriter writer)
  {
    this.writer = writer;
  }
  
  protected XmlStreamWriter createXmlStreamWriter(Writer out)
  {
    XmlStreamWriter writer = new DefaultXmlStreamWriter(out);
    return writer;
  }
  
  public void characters(String text)
  {
    writer.writeCharacters(text);
  }
  
  protected String makeUrlAbsolute(String url)
  {
    if ((base == null) || (baseInHead) || (url == null)) {
      return url;
    }
    if (ABSOLUTE_URL_PATTERN.matcher(url).matches()) {
      return url;
    }
    if (url.startsWith("#")) {
      return url;
    }
    String absoluteUrl = base.toString();
    if ((!absoluteUrl.endsWith("/")) && (!url.startsWith("/"))) {
      absoluteUrl = absoluteUrl + '/';
    }
    absoluteUrl = absoluteUrl + url;
    return absoluteUrl;
  }
  
  protected boolean isExternalLink(String url)
  {
    if (url == null) {
      return false;
    }
    if ((ABSOLUTE_URL_PATTERN.matcher(url).matches()) && (
      (base == null) || (!url.startsWith(base.toString())))) {
      return true;
    }
    return false;
  }
  
  public void setBase(URI uri)
  {
    base = uri;
  }
  
  public URI getBase()
  {
    return base;
  }
  
  public boolean isBaseInHead()
  {
    return baseInHead;
  }
  
  public void setBaseInHead(boolean baseInHead)
  {
    this.baseInHead = baseInHead;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.parser.builder.AbstractXmlDocumentBuilder
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.parser.builder;

import java.io.Writer;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.mylyn.internal.wikitext.core.util.css.CssParser;
import org.eclipse.mylyn.internal.wikitext.core.util.css.CssRule;
import org.eclipse.mylyn.wikitext.core.parser.Attributes;
import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.BlockType;
import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.SpanType;
import org.eclipse.mylyn.wikitext.core.parser.LinkAttributes;
import org.eclipse.mylyn.wikitext.core.util.FormattingXMLStreamWriter;
import org.eclipse.mylyn.wikitext.core.util.XmlStreamWriter;

public class DocBookDocumentBuilder
  extends AbstractXmlDocumentBuilder
{
  private static final Pattern PERCENTAGE = Pattern.compile("(\\d+)%");
  private static final Pattern CSS_CLASS_INLINE = Pattern.compile("(^|\\s+)inline(\\s+|$)");
  private static Set<Integer> entityReferenceToUnicode = new HashSet();
  private String bookTitle;
  
  static
  {
    entityReferenceToUnicode.add(Integer.valueOf(215));
    entityReferenceToUnicode.add(Integer.valueOf(8211));
    entityReferenceToUnicode.add(Integer.valueOf(8212));
    entityReferenceToUnicode.add(Integer.valueOf(8220));
    entityReferenceToUnicode.add(Integer.valueOf(8221));
    entityReferenceToUnicode.add(Integer.valueOf(8216));
    entityReferenceToUnicode.add(Integer.valueOf(8217));
  }
  
  private String doctype = "<!DOCTYPE book PUBLIC \"-//OASIS//DTD DocBook XML V4.5//EN\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\">";
  private final Map<String, String> acronyms = new HashMap();
  private int headingLevel = 0;
  private final Stack<BlockDescription> blockDescriptions = new Stack();
  private boolean automaticGlossary = true;
  
  public DocBookDocumentBuilder(Writer out)
  {
    super(out);
  }
  
  public DocBookDocumentBuilder(XmlStreamWriter writer)
  {
    super(writer);
  }
  
  protected XmlStreamWriter createFormattingXmlStreamWriter(Writer out)
  {
    XmlStreamWriter writer = super.createXmlStreamWriter(out);
    new FormattingXMLStreamWriter(writer)
    {
      protected boolean preserveWhitespace(String elementName)
      {
        return (elementName.equals("code")) || (elementName.startsWith("literal"));
      }
    };
  }
  
  public String getDoctype()
  {
    return doctype;
  }
  
  public void setDoctype(String doctype)
  {
    this.doctype = doctype;
  }
  
  public String getBookTitle()
  {
    return bookTitle;
  }
  
  public void setBookTitle(String bookTitle)
  {
    this.bookTitle = bookTitle;
  }
  
  public void acronym(String text, String definition)
  {
    String previousDef = (String)acronyms.put(text, definition);
    if ((previousDef != null) && (previousDef.length() > definition.length())) {
      acronyms.put(text, previousDef);
    }
    writer.writeStartElement("glossterm");
    characters(text);
    writer.writeEndElement();
  }
  
  public void link(Attributes attributes, String href, final String text)
  {
    link(attributes, href, new ContentEmitter()
    {
      public void emit()
      {
        writer.writeCharacters(text);
      }
    });
  }
  
  private void link(Attributes attributes, String href, ContentEmitter emitter)
  {
    ensureBlockElementsOpen();
    if (href.startsWith("#"))
    {
      if (href.length() > 1)
      {
        writer.writeStartElement("link");
        writer.writeAttribute("linkend", href.substring(1));
        emitter.emit();
        writer.writeEndElement();
      }
      else
      {
        emitter.emit();
      }
    }
    else
    {
      writer.writeStartElement("ulink");
      writer.writeAttribute("url", href);
      emitter.emit();
      writer.writeEndElement();
    }
  }
  
  public void beginBlock(DocumentBuilder.BlockType type, Attributes attributes)
  {
    if (headingLevel == 0)
    {
      beginHeading(1, new Attributes());
      endHeading();
    }
    String[] elementNames = null;
    boolean allowTitle = false;
    boolean closeElementsOnBlockStart = false;
    BlockDescription previousBlock = null;
    if (!blockDescriptions.isEmpty()) {
      previousBlock = (BlockDescription)blockDescriptions.peek();
    }
    String elementName;
    String elementName;
    String elementName;
    String elementName;
    String elementName;
    String elementName;
    String elementName;
    String elementName;
    String elementName;
    String elementName;
    String elementName;
    String elementName;
    String elementName;
    switch (type)
    {
    case PARAGRAPH: 
      elementName = "itemizedlist";
      break;
    case PANEL: 
      elementName = "orderedlist";
      break;
    case TABLE_ROW: 
      elementName = "variablelist";
      
      break;
    case TIP: 
      BlockDescription blockDescription = findBlockDescription(DocumentBuilder.BlockType.DEFINITION_LIST);
      if (entrySize > 0) {
        endBlockEntry(blockDescription);
      }
      openBlockEntry(blockDescription, new String[] { "varlistentry" });
      
      elementName = "term";
      break;
    case WARNING: 
      String elementName = "listitem";
      elementNames = new String[] { "para" };
      closeElementsOnBlockStart = true;
      break;
    case BULLETED_LIST: 
    case INFORMATION: 
      elementName = "para";
      break;
    case NOTE: 
      elementName = "code";
      break;
    case NUMERIC_LIST: 
      elementName = "literallayout";
      break;
    case LIST_ITEM: 
      elementName = "blockquote";
      break;
    case PREFORMATTED: 
      String elementName = "listitem";
      elementNames = new String[] { "para" };
      closeElementsOnBlockStart = true;
      break;
    case QUOTE: 
      elementName = "informaltable";
      break;
    case TABLE_CELL_HEADER: 
      elementName = "th";
      break;
    case TABLE_CELL_NORMAL: 
      elementName = "td";
      break;
    case TABLE: 
      elementName = "tr";
      break;
    case DEFINITION_LIST: 
      String elementName = "important";
      allowTitle = true;
      break;
    case DEFINITION_TERM: 
      String elementName = "note";
      allowTitle = true;
      break;
    case DEFINITION_ITEM: 
      String elementName = "warning";
      allowTitle = true;
      break;
    case CODE: 
      String elementName = "tip";
      allowTitle = true;
      break;
    case DIV: 
      String elementName = "note";
      allowTitle = true;
      break;
    case FOOTNOTE: 
      elementName = null;
      break;
    default: 
      throw new IllegalStateException(type.name());
    }
    String elementName;
    int blockSize;
    if (elementName != null)
    {
      int blockSize = 1;
      if ((previousBlock != null) && (closeElementsOnBlockStart)) {
        endBlockEntry(previousBlock);
      }
      writer.writeStartElement(elementName);
      applyAttributes(attributes);
      if (elementNames != null)
      {
        String[] arrayOfString1;
        int j = (arrayOfString1 = elementNames).length;
        for (int i = 0; i < j; i++)
        {
          String name = arrayOfString1[i];
          writer.writeStartElement(name);
        }
      }
      if ((allowTitle) && (attributes.getTitle() != null))
      {
        writer.writeStartElement("title");
        writer.writeCharacters(attributes.getTitle());
        writer.writeEndElement();
      }
    }
    else
    {
      blockSize = 0;
    }
    blockDescriptions.push(new BlockDescription(type, blockSize, elementNames, closeElementsOnBlockStart));
  }
  
  public void endBlock()
  {
    BlockDescription blockDescription = (BlockDescription)blockDescriptions.pop();
    int size = size + entrySize;
    for (int x = 0; x < size; x++) {
      writer.writeEndElement();
    }
  }
  
  private void endBlockEntry(BlockDescription blockDescription)
  {
    for (int x = 0; x < entrySize; x++) {
      writer.writeEndElement();
    }
    entrySize = 0;
  }
  
  private void openBlockEntry(BlockDescription blockDescription, String[] entry)
  {
    String[] arrayOfString;
    int j = (arrayOfString = entry).length;
    for (int i = 0; i < j; i++)
    {
      String ent = arrayOfString[i];
      writer.writeStartElement(ent);
    }
    entrySize += entry.length;
  }
  
  public void beginHeading(int level, Attributes attributes)
  {
    closeSections(Math.max(level - 1, 0));
    while (headingLevel < level)
    {
      headingLevel += 1;
      
      writer.writeStartElement(headingLevel == 1 ? "chapter" : "section");
      if (attributes != null)
      {
        applyAttributes(attributes);
        attributes = null;
      }
    }
    writer.writeStartElement("title");
  }
  
  public void endHeading()
  {
    writer.writeEndElement();
  }
  
  public void beginDocument()
  {
    baseInHead = false;
    writer.writeStartDocument();
    writer.writeDTD(doctype);
    
    writer.writeStartElement("book");
    writer.writeStartElement("title");
    if (bookTitle != null) {
      writer.writeCharacters(bookTitle);
    }
    writer.writeEndElement();
  }
  
  public void beginSpan(DocumentBuilder.SpanType type, Attributes attributes)
  {
    ensureBlockElementsOpen();
    switch (type)
    {
    case CITATION: 
    case DELETED: 
      writer.writeStartElement("emphasis");
      writer.writeAttribute("role", "bold");
      break;
    case EMPHASIS: 
      writer.writeStartElement("citation");
      break;
    case SPAN: 
      writer.writeStartElement("code");
      break;
    case INSERTED: 
      writer.writeStartElement("emphasis");
      writer.writeAttribute("role", "del");
      break;
    case BOLD: 
      writer.writeStartElement("emphasis");
      break;
    case ITALIC: 
      writer.writeStartElement("emphasis");
      writer.writeAttribute("role", "ins");
      break;
    case SUBSCRIPT: 
      writer.writeStartElement("emphasis");
      writer.writeAttribute("role", "underline");
      break;
    case CODE: 
      writer.writeStartElement("emphasis");
      writer.writeAttribute("role", "italic");
      break;
    case SUPERSCRIPT: 
      writer.writeStartElement("quote");
      break;
    case QUOTE: 
      writer.writeStartElement("phrase");
      break;
    case MONOSPACE: 
      writer.writeStartElement("subscript");
      break;
    case LINK: 
      writer.writeStartElement("superscript");
      break;
    case STRONG: 
      writer.writeStartElement("literal");
      break;
    case UNDERLINED: 
      LinkAttributes linkAttributes = (LinkAttributes)attributes;
      String href = linkAttributes.getHref();
      if (href.startsWith("#"))
      {
        writer.writeStartElement("link");
        if (href.length() > 1) {
          writer.writeAttribute("linkend", href.substring(1));
        }
      }
      else
      {
        writer.writeStartElement("ulink");
        writer.writeAttribute("url", href);
      }
      break;
    default: 
      Logger.getLogger(DocBookDocumentBuilder.class.getName()).warning("No docbook mapping for " + type);
      writer.writeStartElement("phrase");
    }
    applyAttributes(attributes);
  }
  
  private void applyAttributes(Attributes attributes)
  {
    if (attributes.getId() != null) {
      writer.writeAttribute("id", attributes.getId());
    }
    if (attributes.getCssClass() != null) {
      writer.writeAttribute("role", attributes.getCssClass());
    }
  }
  
  public void endDocument()
  {
    closeSections(0);
    
    writeGlossaryAppendix();
    
    writer.writeEndElement();
    writer.writeEndDocument();
    
    acronyms.clear();
  }
  
  private void closeSections(int toLevel)
  {
    if (toLevel < 0) {
      toLevel = 0;
    }
    while (headingLevel > toLevel)
    {
      writer.writeEndElement();
      headingLevel -= 1;
    }
  }
  
  private void writeGlossaryAppendix()
  {
    if ((!acronyms.isEmpty()) && (automaticGlossary))
    {
      writer.writeStartElement("appendix");
      writer.writeAttribute("id", "glossary");
      writer.writeStartElement("title");
      writer.writeAttribute("id", "glossary-end");
      writer.writeCharacters(Messages.getString("DocBookDocumentBuilder.0"));
      writer.writeEndElement();
      writer.writeStartElement("glosslist");
      for (Map.Entry<String, String> glossEntry : new TreeMap(acronyms).entrySet())
      {
        writer.writeStartElement("glossentry");
        
        writer.writeStartElement("glossterm");
        writer.writeCharacters((String)glossEntry.getKey());
        writer.writeEndElement();
        
        writer.writeStartElement("glossdef");
        writer.writeStartElement("para");
        writer.writeCharacters((String)glossEntry.getValue());
        writer.writeEndElement();
        writer.writeEndElement();
        
        writer.writeEndElement();
      }
      writer.writeEndElement();
      writer.writeEndElement();
    }
  }
  
  public void endSpan()
  {
    writer.writeEndElement();
  }
  
  public void characters(String text)
  {
    ensureBlockElementsOpen();
    super.characters(text);
  }
  
  public void charactersUnescaped(String literal)
  {
    ensureBlockElementsOpen();
    
    writer.writeLiteral(literal);
  }
  
  private void ensureBlockElementsOpen()
  {
    if (!blockDescriptions.isEmpty())
    {
      BlockDescription blockDescription = (BlockDescription)blockDescriptions.peek();
      if ((entrySize == 0) && (nestedElementNames != null)) {
        openBlockEntry(blockDescription, nestedElementNames);
      }
    }
  }
  
  public void entityReference(String entity)
  {
    ensureBlockElementsOpen();
    if (entity.startsWith("#"))
    {
      String numeric = entity.substring(1);
      int base = 10;
      if (numeric.startsWith("x"))
      {
        numeric = entity.substring(1);
        base = 16;
      }
      int unicodeValue = Integer.parseInt(numeric, base);
      if (entityReferenceToUnicode.contains(Integer.valueOf(unicodeValue)))
      {
        writer.writeCharacters((char)unicodeValue);
        return;
      }
    }
    writer.writeEntityRef(entity);
  }
  
  public void image(Attributes attributes, String url)
  {
    ensureBlockElementsOpen();
    String cssClass = attributes.getCssClass();
    boolean inlined = false;
    if ((cssClass != null) && (CSS_CLASS_INLINE.matcher(cssClass).find())) {
      inlined = true;
    }
    emitImage(attributes, url, inlined);
  }
  
  private void emitImage(Attributes attributes, String url, boolean inline)
  {
    ensureBlockElementsOpen();
    writer.writeStartElement(inline ? "inlinemediaobject" : "mediaobject");
    applyAttributes(attributes);
    writer.writeStartElement("imageobject");
    writer.writeEmptyElement("imagedata");
    writer.writeAttribute("fileref", makeUrlAbsolute(url));
    String cssStyle = attributes.getCssStyle();
    if (cssStyle != null)
    {
      String width = null;
      String depth = null;
      Iterator<CssRule> ruleIterator = new CssParser().createRuleIterator(cssStyle);
      while (ruleIterator.hasNext())
      {
        CssRule rule = (CssRule)ruleIterator.next();
        if ("width".equals(name)) {
          width = value;
        } else if ("height".equals(name)) {
          depth = value;
        }
      }
      if (width != null)
      {
        Matcher matcher = PERCENTAGE.matcher(width);
        if (matcher.matches())
        {
          writer.writeAttribute("scale", matcher.group(1));
        }
        else
        {
          writer.writeAttribute("width", width);
          if (depth != null) {
            writer.writeAttribute("depth", depth);
          }
        }
      }
    }
    writer.writeEndElement();
    writer.writeEndElement();
  }
  
  public void imageLink(Attributes linkAttributes, final Attributes imageAttributes, String href, final String imageUrl)
  {
    link(linkAttributes, href, new ContentEmitter()
    {
      public void emit()
      {
        DocBookDocumentBuilder.this.emitImage(imageAttributes, imageUrl, true);
      }
    });
  }
  
  public void lineBreak()
  {
    ensureBlockElementsOpen();
    
    characters("\n");
  }
  
  private BlockDescription findBlockDescription(DocumentBuilder.BlockType type)
  {
    for (int x = blockDescriptions.size() - 1; x >= 0; x--)
    {
      BlockDescription blockDescription = (BlockDescription)blockDescriptions.get(x);
      if (type == type) {
        return blockDescription;
      }
    }
    return null;
  }
  
  private static class BlockDescription
  {
    DocumentBuilder.BlockType type;
    int size;
    int entrySize;
    final String[] nestedElementNames;
    final boolean closeElementsOnBlockStart;
    
    public BlockDescription(DocumentBuilder.BlockType type, int size, String[] nestedElementNames, boolean closeElementsOnBlockStart)
    {
      this.size = size;
      entrySize = (nestedElementNames == null ? 0 : nestedElementNames.length);
      this.type = type;
      this.nestedElementNames = nestedElementNames;
      this.closeElementsOnBlockStart = closeElementsOnBlockStart;
    }
  }
  
  public boolean isAutomaticGlossary()
  {
    return automaticGlossary;
  }
  
  public void setAutomaticGlossary(boolean automaticGlossary)
  {
    this.automaticGlossary = automaticGlossary;
  }
  
  private static abstract interface ContentEmitter
  {
    public abstract void emit();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.parser.builder.DocBookDocumentBuilder
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.parser.builder;

import org.eclipse.mylyn.wikitext.core.util.FormattingXMLStreamWriter;
import org.eclipse.mylyn.wikitext.core.util.XmlStreamWriter;

class DocBookDocumentBuilder$1
  extends FormattingXMLStreamWriter
{
  DocBookDocumentBuilder$1(DocBookDocumentBuilder paramDocBookDocumentBuilder, XmlStreamWriter $anonymous0)
  {
    super($anonymous0);
  }
  
  protected boolean preserveWhitespace(String elementName)
  {
    return (elementName.equals("code")) || (elementName.startsWith("literal"));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.parser.builder.DocBookDocumentBuilder.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.parser.builder;

import org.eclipse.mylyn.wikitext.core.util.XmlStreamWriter;

class DocBookDocumentBuilder$2
  implements DocBookDocumentBuilder.ContentEmitter
{
  DocBookDocumentBuilder$2(DocBookDocumentBuilder paramDocBookDocumentBuilder, String paramString) {}
  
  public void emit()
  {
    this$0.writer.writeCharacters(val$text);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.parser.builder.DocBookDocumentBuilder.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.parser.builder;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

class Messages
{
  private static final String BUNDLE_NAME = "org.eclipse.mylyn.wikitext.core.parser.builder.messages";
  private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("org.eclipse.mylyn.wikitext.core.parser.builder.messages");
  
  public static String getString(String key)
  {
    try
    {
      return RESOURCE_BUNDLE.getString(key);
    }
    catch (MissingResourceException localMissingResourceException) {}
    return '!' + key + '!';
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.parser.builder.Messages
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.parser.builder;

import java.io.IOException;
import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.BlockType;

public abstract class AbstractMarkupDocumentBuilder$Block
{
  private Block previousBlock;
  private final DocumentBuilder.BlockType blockType;
  
  protected AbstractMarkupDocumentBuilder$Block(AbstractMarkupDocumentBuilder paramAbstractMarkupDocumentBuilder, DocumentBuilder.BlockType blockType)
  {
    this.blockType = blockType;
  }
  
  public void write(int c)
    throws IOException
  {}
  
  public void write(String s)
    throws IOException
  {}
  
  public void open()
    throws IOException
  {
    previousBlock = this$0.currentBlock;
    this$0.currentBlock = this;
  }
  
  public void close()
    throws IOException
  {
    this$0.currentBlock = previousBlock;
  }
  
  public Block getPreviousBlock()
  {
    return previousBlock;
  }
  
  public DocumentBuilder.BlockType getBlockType()
  {
    return blockType;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.parser.builder.AbstractMarkupDocumentBuilder.Block
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.parser.builder;

import java.io.IOException;
import java.io.Writer;

class AbstractMarkupDocumentBuilder$MarkupWriter
  extends Writer
{
  private final Writer delegate;
  private char lastChar;
  
  public AbstractMarkupDocumentBuilder$MarkupWriter(Writer delegate)
  {
    this.delegate = delegate;
  }
  
  public void write(char[] cbuf, int off, int len)
    throws IOException
  {
    if (len <= 0) {
      return;
    }
    delegate.write(cbuf, off, len);
    int lastCharIndex = off + len - 1;
    lastChar = cbuf[lastCharIndex];
  }
  
  public char getLastChar()
  {
    return lastChar;
  }
  
  public void flush()
    throws IOException
  {
    delegate.flush();
  }
  
  public void close()
    throws IOException
  {
    delegate.close();
  }
  
  public Writer getDelegate()
  {
    return delegate;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.parser.builder.AbstractMarkupDocumentBuilder.MarkupWriter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core.parser.builder;

import java.io.IOException;
import java.io.Writer;
import java.util.Stack;
import org.eclipse.mylyn.wikitext.core.parser.Attributes;
import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder;
import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.BlockType;
import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.SpanType;

public abstract class AbstractMarkupDocumentBuilder
  extends DocumentBuilder
{
  protected abstract class Block
  {
    private Block previousBlock;
    private final DocumentBuilder.BlockType blockType;
    
    protected Block(DocumentBuilder.BlockType blockType)
    {
      this.blockType = blockType;
    }
    
    public void write(int c)
      throws IOException
    {}
    
    public void write(String s)
      throws IOException
    {}
    
    public void open()
      throws IOException
    {
      previousBlock = currentBlock;
      currentBlock = this;
    }
    
    public void close()
      throws IOException
    {
      currentBlock = previousBlock;
    }
    
    public Block getPreviousBlock()
    {
      return previousBlock;
    }
    
    public DocumentBuilder.BlockType getBlockType()
    {
      return blockType;
    }
  }
  
  protected class SuffixBlock
    extends AbstractMarkupDocumentBuilder.Block
  {
    private final String suffix;
    
    public SuffixBlock(DocumentBuilder.BlockType blockType, String suffix)
    {
      super(blockType);
      this.suffix = suffix;
    }
    
    public void close()
      throws IOException
    {
      emitContent(suffix);
      super.close();
    }
  }
  
  protected class ImplicitParagraphBlock
    extends AbstractMarkupDocumentBuilder.Block
  {
    private boolean hasContent = false;
    
    public ImplicitParagraphBlock()
    {
      super(DocumentBuilder.BlockType.PARAGRAPH);
    }
    
    public void write(int c)
      throws IOException
    {
      hasContent = true;
      emitContent(normalizeWhitespace(c));
    }
    
    public void write(String s)
      throws IOException
    {
      hasContent = true;
      emitContent(normalizeWhitespace(s));
    }
    
    public void close()
      throws IOException
    {
      if (hasContent) {
        emitContent("\n\n");
      }
      super.close();
    }
  }
  
  protected Block currentBlock = new ImplicitParagraphBlock();
  private Stack<MarkupWriter> writerState;
  private MarkupWriter writer;
  private boolean adjacentSeparatorRequired = false;
  
  private static class MarkupWriter
    extends Writer
  {
    private final Writer delegate;
    private char lastChar;
    
    public MarkupWriter(Writer delegate)
    {
      this.delegate = delegate;
    }
    
    public void write(char[] cbuf, int off, int len)
      throws IOException
    {
      if (len <= 0) {
        return;
      }
      delegate.write(cbuf, off, len);
      int lastCharIndex = off + len - 1;
      lastChar = cbuf[lastCharIndex];
    }
    
    public char getLastChar()
    {
      return lastChar;
    }
    
    public void flush()
      throws IOException
    {
      delegate.flush();
    }
    
    public void close()
      throws IOException
    {
      delegate.close();
    }
    
    public Writer getDelegate()
    {
      return delegate;
    }
  }
  
  protected AbstractMarkupDocumentBuilder(Writer out)
  {
    writer = new MarkupWriter(out);
  }
  
  protected void emitContent(int c)
    throws IOException
  {
    maybeInsertAdjacentWhitespace(c);
    writer.write(c);
  }
  
  private void maybeInsertAdjacentWhitespace(int c)
    throws IOException
  {
    if (adjacentSeparatorRequired)
    {
      if (!isSeparator(c))
      {
        char lastChar = getLastChar();
        if ((lastChar != 0) && (!isSeparator(lastChar))) {
          writer.write(32);
        }
      }
      adjacentSeparatorRequired = false;
    }
  }
  
  protected void emitContent(String str)
    throws IOException
  {
    if (str.length() == 0) {
      return;
    }
    maybeInsertAdjacentWhitespace(str.charAt(0));
    writer.write(str);
  }
  
  protected void requireAdjacentSeparator()
  {
    adjacentSeparatorRequired = true;
  }
  
  protected void clearRequireAdjacentSeparator()
  {
    adjacentSeparatorRequired = false;
  }
  
  protected boolean isSeparator(int i)
  {
    char c = (char)i;
    boolean separator = Character.isWhitespace(c);
    if (!separator) {
      switch (c)
      {
      case '!': 
      case '"': 
      case '(': 
      case ')': 
      case ',': 
      case '.': 
      case ':': 
      case ';': 
      case '?': 
      case '[': 
      case ']': 
      case '{': 
      case '|': 
      case '}': 
        separator = true;
      }
    }
    return separator;
  }
  
  public void beginDocument() {}
  
  public void endDocument()
  {
    while (currentBlock != null) {
      endBlock();
    }
  }
  
  protected void pushWriter(Writer writer)
  {
    if (writerState == null) {
      writerState = new Stack();
    }
    writerState.push(this.writer);
    this.writer = new MarkupWriter(writer);
  }
  
  protected Writer popWriter()
  {
    if ((writerState == null) || (writerState.isEmpty())) {
      throw new IllegalStateException();
    }
    MarkupWriter markupWriter = writer;
    writer = ((MarkupWriter)writerState.pop());
    return markupWriter.getDelegate();
  }
  
  protected char getLastChar()
  {
    char c = writer.getLastChar();
    if ((c == 0) && (writerState != null)) {
      for (int x = writerState.size() - 1; (c == 0) && (x >= 0); x--) {
        c = ((MarkupWriter)writerState.get(x)).getLastChar();
      }
    }
    return c;
  }
  
  public void beginBlock(DocumentBuilder.BlockType type, Attributes attributes)
  {
    try
    {
      if ((currentBlock instanceof ImplicitParagraphBlock))
      {
        currentBlock.close();
        currentBlock = null;
      }
      Block block = computeBlock(type, attributes);
      block.open();
    }
    catch (IOException e)
    {
      throw new RuntimeException(e);
    }
  }
  
  protected abstract Block computeBlock(DocumentBuilder.BlockType paramBlockType, Attributes paramAttributes);
  
  public void beginSpan(DocumentBuilder.SpanType type, Attributes attributes)
  {
    Block block = computeSpan(type, attributes);
    try
    {
      block.open();
    }
    catch (IOException e)
    {
      throw new RuntimeException(e);
    }
  }
  
  protected abstract Block computeSpan(DocumentBuilder.SpanType paramSpanType, Attributes paramAttributes);
  
  public void endSpan()
  {
    closeCurrentBlock();
  }
  
  protected String computePrefix(char c, int count)
  {
    String prefix = "";
    while (count-- > 0) {
      prefix = prefix + c;
    }
    return prefix;
  }
  
  protected int computeListLevel()
  {
    int level = 0;
    Block b = currentBlock;
    while (b != null)
    {
      if (b.getBlockType() != null) {
        switch (b.getBlockType())
        {
        case PANEL: 
        case PARAGRAPH: 
        case TABLE_ROW: 
          level++;
        }
      }
      b = b.getPreviousBlock();
    }
    return level;
  }
  
  protected DocumentBuilder.BlockType computeCurrentListType()
  {
    Block b = currentBlock;
    while (b != null)
    {
      if (b.getBlockType() != null) {
        switch (b.getBlockType())
        {
        case PANEL: 
        case PARAGRAPH: 
        case TABLE_ROW: 
          return b.getBlockType();
        }
      }
      b = b.getPreviousBlock();
    }
    return null;
  }
  
  public void endBlock()
  {
    closeCurrentBlock();
  }
  
  private void closeCurrentBlock()
  {
    if (currentBlock != null) {
      try
      {
        currentBlock.close();
      }
      catch (IOException e)
      {
        throw new RuntimeException(e);
      }
    }
  }
  
  public void beginHeading(int level, Attributes attributes)
  {
    Block block = computeHeading(level, attributes);
    try
    {
      block.open();
    }
    catch (IOException e)
    {
      throw new RuntimeException(e);
    }
  }
  
  public void endHeading()
  {
    endBlock();
  }
  
  protected abstract Block computeHeading(int paramInt, Attributes paramAttributes);
  
  protected void assertOpenBlock()
  {
    if (currentBlock == null) {
      currentBlock = new ImplicitParagraphBlock();
    }
  }
  
  public void charactersUnescaped(String literal)
  {
    characters(literal);
  }
  
  protected int normalizeWhitespace(int c)
  {
    if ((c == 13) || (c == 10)) {
      c = 32;
    }
    return c;
  }
  
  protected String normalizeWhitespace(String s)
  {
    s = s.replaceAll("(\r|\n)", " ");
    return s;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.parser.builder.AbstractMarkupDocumentBuilder
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.core;

import java.util.Set;
import org.eclipse.mylyn.internal.wikitext.core.WikiTextPlugin;
import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage;
import org.eclipse.mylyn.wikitext.core.validation.MarkupValidator;

public class WikiText
{
  public static final String CONTENT_TYPE = "org.eclipse.mylyn.wikitext";
  
  public static Set<String> getMarkupFileExtensions()
  {
    return WikiTextPlugin.getDefault().getMarkupFileExtensions();
  }
  
  public static MarkupLanguage getMarkupLanguage(String name)
  {
    return WikiTextPlugin.getDefault().getMarkupLanguage(name);
  }
  
  public static MarkupLanguage getMarkupLanguageForFilename(String name)
  {
    return WikiTextPlugin.getDefault().getMarkupLanguageForFilename(name);
  }
  
  public static String getMarkupLanguageNameForFilename(String name)
  {
    return WikiTextPlugin.getDefault().getMarkupLanguageNameForFilename(name);
  }
  
  public static Set<String> getMarkupLanguageNames()
  {
    return WikiTextPlugin.getDefault().getMarkupLanguageNames();
  }
  
  public static MarkupValidator getMarkupValidator(String name)
  {
    return WikiTextPlugin.getDefault().getMarkupValidator(name);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.core.WikiText
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.core.util.css;

import java.util.ArrayList;
import java.util.List;

public class Block
{
  private final Selector selector;
  private final List<CssRule> rules;
  
  Block(Selector selector)
  {
    this(selector, new ArrayList());
  }
  
  Block(Selector selector, List<CssRule> rules)
  {
    this.selector = selector;
    this.rules = rules;
  }
  
  public Selector getSelector()
  {
    return selector;
  }
  
  public List<CssRule> getRules()
  {
    return rules;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.core.util.css.Block
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.core.util.css;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class SparseCharSequence
  implements CharSequence
{
  private final CharSequence data;
  private final Segment[] segments;
  private final int length;
  
  public SparseCharSequence(CharSequence data, Pattern excludePattern)
  {
    this.data = data;
    List<Segment> segments = new ArrayList(5);
    Segment segment = new Segment(0, 0);
    Matcher matcher = excludePattern.matcher(data);
    while (matcher.find())
    {
      length = (matcher.start() - offset);
      segments.add(segment);
      int end = matcher.end();
      if (end == data.length())
      {
        segment = null;
        break;
      }
      segment = new Segment(end, zeroBase + length);
    }
    if (segment != null)
    {
      length = (data.length() - offset);
      segments.add(segment);
    }
    if (segments.size() > 1)
    {
      Iterator<Segment> it = segments.iterator();
      while ((it.hasNext()) && (segments.size() > 1))
      {
        segment = (Segment)it.next();
        if (length == 0) {
          it.remove();
        }
      }
    }
    this.segments = ((Segment[])segments.toArray(new Segment[segments.size()]));
    Segment lastSegment = this.segments[(this.segments.length - 1)];
    length = (zeroBase + length);
  }
  
  public int originalOffsetOf(int index)
  {
    if ((index < 0) || (index >= length())) {
      throw new IndexOutOfBoundsException(String.format("%s is not within [0,%s)", new Object[] { Integer.valueOf(index), Integer.val
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd