org.eclipse.mylyn.wikitext.tracwiki.core
Class TracWikiLanguage

java.lang.Object
  extended by org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage
      extended by org.eclipse.mylyn.wikitext.core.parser.markup.AbstractMarkupLanguage
          extended by org.eclipse.mylyn.wikitext.tracwiki.core.TracWikiLanguage
All Implemented Interfaces:
Cloneable

public class TracWikiLanguage
extends AbstractMarkupLanguage

An implementation of the TracWiki markup language.

Since:
1.0
Author:
David Green

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage
MarkupLanguage.PatternBasedSyntax
 
Field Summary
 
Fields inherited from class org.eclipse.mylyn.wikitext.core.parser.markup.AbstractMarkupLanguage
blocks, paragraphBreakingBlocks, phraseModifierSyntax, tokenSyntax
 
Fields inherited from class org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage
configuration, internalLinkPattern
 
Constructor Summary
TracWikiLanguage()
           
 
Method Summary
protected  void addStandardBlocks(List<Block> blocks, List<Block> paragraphBreakingBlocks)
           
protected  void addStandardPhraseModifiers(MarkupLanguage.PatternBasedSyntax phraseModifierSyntax)
           
protected  void addStandardTokens(MarkupLanguage.PatternBasedSyntax tokenSyntax)
           
 boolean computeInternalLinkExists(String link)
          for the purpose of converting wiki words into links, determine if the wiki word exists.
protected  Block createParagraphBlock()
           
 String getServerUrl()
          the server URL, for example http://trac.edgewall.org/ from which links may be derrived, such as http://trac.edgewall.org/wiki/WikiPage or http://trac.edgewall.org/tickets/1
 boolean isAutoLinking()
          Indicate if the markup should match WikiWords as hyperlinks.
 void setAutoLinking(boolean autoLinking)
          Indicate if the markup should match WikiWords as hyperlinks.
 void setServerUrl(String url)
          set the server URL, for example http://trac.edgewall.org/ from which links may be derrived, such as http://trac.edgewall.org/wiki/WikiPage or http://trac.edgewall.org/tickets/1
 String toChangesetHref(String changesetId, String restriction)
          convert a changeset id to a hyperlink based on the server url
 String toInternalHref(String pageName)
          Convert a page name to an href to the page.
 String toMilestoneHref(String milestoneId)
          convert a milestone id to a hyperlink based on the server url
 String toReportHref(String reportId)
          convert a report id to a hyperlink based on the server url
 String toRevisionLogHref(String revision1, String revision2, String restriction)
          convert a revisions to a revision log hyperlink based on the server url
 String toSourceBrowserHref(String source, String revision, String line)
          create an URL to the source browser
 String toTicketAttachmentHref(String ticketId, String attachment)
          create an URL to an attachment ticket based on the server url
 String toTicketHref(String ticketId, String commentNumber)
          convert a ticket id to a hyperlink based on the server url
 
Methods inherited from class org.eclipse.mylyn.wikitext.core.parser.markup.AbstractMarkupLanguage
addBlockExtensions, addPhraseModifierExtensions, addTokenExtensions, clearLanguageSyntax, getBlocks, getParagraphBreakingBlocks, getPhraseModifierSyntax, getReplacementTokenSyntax, initializeBlocks, initializePhraseModifiers, initializeSyntax, initializeTokens
 
Methods inherited from class org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage
clone, configure, createState, emitMarkupLine, emitMarkupLine, emitMarkupText, getExtendsLanguage, getIdGenerationStrategy, getInternalLinkPattern, getName, isBlocksOnly, isDetectingRawHyperlinks, isEmptyLine, isEnableMacros, isFilterGenerativeContents, processContent, setBlocksOnly, setEnableMacros, setExtendsLanguage, setFilterGenerativeContents, setInternalLinkPattern, setName, startBlock
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TracWikiLanguage

public TracWikiLanguage()
Method Detail

toInternalHref

public String toInternalHref(String pageName)
Convert a page name to an href to the page.

Parameters:
pageName - the name of the page to target
Returns:
the href to access the page
See Also:
MarkupLanguage.getInternalLinkPattern()

toTicketHref

public String toTicketHref(String ticketId,
                           String commentNumber)
convert a ticket id to a hyperlink based on the server url

Parameters:
ticketId - the id of the ticket
commentNumber - the comment number or null if the url should not reference a specific comment

toChangesetHref

public String toChangesetHref(String changesetId,
                              String restriction)
convert a changeset id to a hyperlink based on the server url

Parameters:
changesetId - the changeset id
restriction - the restriction, or null if there is no restriction. eg: "trunk"

toRevisionLogHref

public String toRevisionLogHref(String revision1,
                                String revision2,
                                String restriction)
convert a revisions to a revision log hyperlink based on the server url

Parameters:
revision1 - the first revision
revision2 - the second revision
restriction - the restriction, or null if there is no restriction. eg: "trunk"

toReportHref

public String toReportHref(String reportId)
convert a report id to a hyperlink based on the server url

Parameters:
reportId - the id of the report

toMilestoneHref

public String toMilestoneHref(String milestoneId)
convert a milestone id to a hyperlink based on the server url

Parameters:
milestoneId - the id of the milesonte

toTicketAttachmentHref

public String toTicketAttachmentHref(String ticketId,
                                     String attachment)
create an URL to an attachment ticket based on the server url

Parameters:
ticketId - the id of the ticket
attachment - the name of the attachment

toSourceBrowserHref

public String toSourceBrowserHref(String source,
                                  String revision,
                                  String line)
create an URL to the source browser

Parameters:
source - the source to be viewed
revision - the revision, or null if there is no revision
line - the line, or null if there is no line

computeInternalLinkExists

public boolean computeInternalLinkExists(String link)
for the purpose of converting wiki words into links, determine if the wiki word exists.

See Also:
WikiWordReplacementToken

isAutoLinking

public boolean isAutoLinking()
Indicate if the markup should match WikiWords as hyperlinks. The default is true.


setAutoLinking

public void setAutoLinking(boolean autoLinking)
Indicate if the markup should match WikiWords as hyperlinks. The default is true.


setServerUrl

public void setServerUrl(String url)
set the server URL, for example http://trac.edgewall.org/ from which links may be derrived, such as http://trac.edgewall.org/wiki/WikiPage or http://trac.edgewall.org/tickets/1

Parameters:
url - the url, or null if it is unknown.

getServerUrl

public String getServerUrl()
the server URL, for example http://trac.edgewall.org/ from which links may be derrived, such as http://trac.edgewall.org/wiki/WikiPage or http://trac.edgewall.org/tickets/1

See Also:
setServerUrl(String)

addStandardBlocks

protected void addStandardBlocks(List<Block> blocks,
                                 List<Block> paragraphBreakingBlocks)
Specified by:
addStandardBlocks in class AbstractMarkupLanguage

addStandardPhraseModifiers

protected void addStandardPhraseModifiers(MarkupLanguage.PatternBasedSyntax phraseModifierSyntax)
Specified by:
addStandardPhraseModifiers in class AbstractMarkupLanguage

addStandardTokens

protected void addStandardTokens(MarkupLanguage.PatternBasedSyntax tokenSyntax)
Specified by:
addStandardTokens in class AbstractMarkupLanguage

createParagraphBlock

protected Block createParagraphBlock()
Specified by:
createParagraphBlock in class AbstractMarkupLanguage


Copyright © 2011 FuseSource, Corp.. All Rights Reserved.