本文整理汇总了C#中FlexWiki.AbsoluteTopicName类的典型用法代码示例。如果您正苦于以下问题:C# AbsoluteTopicName类的具体用法?C# AbsoluteTopicName怎么用?C# AbsoluteTopicName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbsoluteTopicName类属于FlexWiki命名空间,在下文中一共展示了AbsoluteTopicName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
private void Page_Load(object sender, System.EventArgs e)
{
_topicString = Request.QueryString["topic"];
try
{
_diff = Convert.ToInt32(Request.QueryString["diff"]);
}
catch {}
try
{
_oldid = Convert.ToInt32(Request.QueryString["oldid"]);
}
catch {}
try
{
_requestedTopic = new AbsoluteTopicName(_topicString);
}
catch {}
if (_requestedTopic == null || _diff >= _oldid)
{
Response.Redirect("default.aspx");
}
}
示例2: ControlPageTitle
public void ControlPageTitle()
{
AbsoluteTopicName top = new AbsoluteTopicName("TitledTopic", TheFederation.DefaultContentBase.Namespace);
string t = TheLinkMaker.LinkToTopic(top);
DocumentElement doc = TheBrowser.Navigate(t, true);
Assert.AreEqual("This fat hen", doc.Title);
}
示例3: ControlTopicBar
public void ControlTopicBar()
{
AbsoluteTopicName top = new AbsoluteTopicName("TitledTopic", TheFederation.DefaultContentBase.Namespace);
string t = TheLinkMaker.LinkToTopic(top);
DocumentElement doc = TheBrowser.Navigate(t, true);
HTMLElement staticTopicBar = (HTMLElement)doc.GetElementByName("StaticTopicBar");
Assert.AreEqual("This fat hen", staticTopicBar.InnerText);
}
示例4: FormattedTopic
/// <summary>
/// Answer the formatted text for a given topic, formatted using a given OutputFormat and possibly showing diffs with the previous revision
/// </summary>
/// <param name="topic">The topic</param>
/// <param name="format">What format</param>
/// <param name="showDiffs">true to show diffs</param>
/// <param name="accumulator">composite cache rule in which to accumulate cache rules</param>
/// <returns></returns>
public static string FormattedTopic(AbsoluteTopicName topic, OutputFormat format, bool showDiffs, Federation aFederation, LinkMaker lm, CompositeCacheRule accumulator)
{
// Show the current topic (including diffs if there is a previous version)
AbsoluteTopicName previousVersion = null;
ContentBase relativeToBase = aFederation.ContentBaseForNamespace(topic.Namespace);
if (showDiffs)
previousVersion = relativeToBase.VersionPreviousTo(topic.LocalName);
return FormattedTopicWithSpecificDiffs(topic, format, previousVersion, aFederation, lm, accumulator);
}
示例5: Print
static void Print(Federation federation, AbsoluteTopicName topic)
{
string formattedBody = federation.GetTopicFormattedContent(topic, null);
// Now calculate the borders
string leftBorder = federation.GetTopicFormattedBorder(topic, Border.Left);
string rightBorder =federation.GetTopicFormattedBorder(topic, Border.Right);
string topBorder = federation.GetTopicFormattedBorder(topic, Border.Top);
string bottomBorder = federation.GetTopicFormattedBorder(topic, Border.Bottom);
// Console.Out.WriteLine(formattedBody);
}
示例6: FormattedString
/// <summary>
/// Format a string of wiki content in a given OutputFormat with references all being relative to a given namespace
/// </summary>
/// <param name="topic">Topic context</param>
/// <param name="input">The input wiki text</param>
/// <param name="format">The desired output format</param>
/// <param name="relativeToContentBase">References will be relative to this namespace</param>
/// <param name="lm">Link maker (unless no relativeTo content base is provide)</param>
/// <param name="accumulator">composite cache rule in which to accumulate cache rules</param>
/// <returns></returns>
public static string FormattedString(AbsoluteTopicName topic, string input, OutputFormat format, ContentBase relativeToContentBase, LinkMaker lm, CompositeCacheRule accumulator)
{
// TODO -- some of the cases in which this call happens actually *are* nested, even though the false arg
// below says that they aren't. This causes scripts to be emitted multiple times -- should clean up.
WikiOutput output = WikiOutput.ForFormat(format, null);
Hashtable ew;
if (relativeToContentBase != null)
{
ew = relativeToContentBase.ExternalWikiHash();
}
else
{
ew = new Hashtable();
}
Format(topic, input, output, relativeToContentBase, lm, ew, 0, accumulator);
return output.ToString();
}
示例7: CalendarStore
public CalendarStore(Federation fed, string ns, int year, int month)
{
SetFederation(fed);
Namespace = ns;
Year = year;
Month = month;
foreach (DateTime each in Dates)
{
AbsoluteTopicName abs = TopicNameForDate(each);
_Topics[abs] = each;
_Topics[abs.LocalName] = each;
}
AbsoluteTopicName a = new AbsoluteTopicName("_NormalBorders", Namespace);
BackingTopic top = new BackingTopic(a, DefaultNormalBordersContent, true);
BackingTopics[a.Name] = top;
_Topics[a] = DateTime.MinValue;
}
示例8: GetTopicSpacedLines
public static ArrayList GetTopicSpacedLines( string topicName )
{
#if WIKI
AbsoluteTopicName topic = new AbsoluteTopicName(topicName);
ContentBase cb = GetFederation().ContentBaseForNamespace(topic.Namespace);
using (TextReader sr = cb.TextReaderForTopic(topic)) {
ArrayList lines = new ArrayList();
string line = null;
while( (line = sr.ReadLine()) != null ) {
if( line.StartsWith(" ") ) {
lines.Add(line.Trim());
}
}
return lines;
}
#else
return new ArrayList();
#endif
}
示例9: CreateTestPage
public void CreateTestPage()
{
AbsoluteTopicName top = new AbsoluteTopicName("DummyPage", TheFederation.DefaultContentBase.Namespace);
bool exists;
exists = TheFederation.TopicExists(top);
Assert.IsTrue(!exists);
string home = TheLinkMaker.LinkToTopic(top);
DocumentElement doc = TheBrowser.Navigate(home, true);
Assert.IsTrue(doc.Body.OuterHTML.IndexOf("Formatting Tips") > 0);
InputElement text = (InputElement) doc.GetElementByName("Text1");
text.Value = "This is SoCool!";
ButtonElement save = (ButtonElement) doc.GetElementByName("SaveButton");
save.Click(true);
// Make sure it actually got saved
exists = TheFederation.TopicExists(top);
Assert.IsTrue(exists);
}
示例10: Formatter
/// <summary>
/// Create a new formatter for a string of input content.
/// </summary>
/// <param name="source">Input wiki string</param>
/// <param name="output">Output object to which output is sent</param>
/// <param name="contentBase">The ContentBase that contains the wiki string text</param>
/// <param name="maker">A link maker </param>
/// <param name="external">External wiki map</param>
/// <param name="headingLevelBase">Relative heading level</param>
/// <param name="accumulator">composite cache rule in which to accumulate cache rules</param>
///
Formatter(AbsoluteTopicName topic, string source, WikiOutput output, ContentBase contentBase, LinkMaker maker, Hashtable external, int headingLevelBase, CompositeCacheRule accumulator)
{
_Topic = topic;
_Source = SplitStringIntoStyledLines(source, LineStyle.Unchanged);
_LinkMaker = maker;
ContentBase = contentBase;
_Output = output;
_ExternalWikiMap = external;
_HeadingLevelBase = headingLevelBase;
_CacheRuleAccumulator = accumulator;
}
示例11: WikiToPresentation
static public IWikiToPresentation WikiToPresentation(AbsoluteTopicName topic, WikiOutput output, ContentBase contentBase, LinkMaker maker, Hashtable external, int headingLevelBase, CompositeCacheRule accumulator)
{
ArrayList lines = new ArrayList();
lines.Add(new StyledLine("", LineStyle.Unchanged));
return new Formatter(topic, lines, output, contentBase, maker, external, headingLevelBase, accumulator);
}
示例12: Format
/// <summary>
/// Format a given input string to the given output
/// </summary>
/// <param name="source">Input wiki content as a list of StyledLines</param>
/// <param name="output">Output object to which output is sent</param>
/// <param name="contentBase">The ContentBase that contains the wiki string text</param>
/// <param name="maker">A link maker </param>
/// <param name="external">External wiki map</param>
/// <param name="headingLevelBase">Relative heading level</param>
/// <param name="accumulator">composite cache rule in which to accumulate cache rules</param>
///
static public void Format(AbsoluteTopicName topic, IList source, WikiOutput output, ContentBase contentBase, LinkMaker maker, Hashtable external, int headingLevelBase, CompositeCacheRule accumulator)
{
Formatter f = new Formatter(topic, source, output, contentBase, maker, external, headingLevelBase, accumulator);
f.Format();
}
示例13: LinkWikiNames
private string LinkWikiNames (string input)
{
StringBuilder answer = new StringBuilder();
string str = input;
ArrayList processed = new ArrayList();
while (str.Length > 0)
{
Match m = extractWikiLinks.Match(str);
if (!m.Success)
break;
string each = m.Groups["topic"].ToString();
string before = m.Groups["before"].ToString();
string after = m.Groups["after"].ToString();
string relabel = m.Groups["relabel"].ToString();
string anchor = m.Groups["anchor"].ToString();
RelativeTopicName relName = new RelativeTopicName(TopicName.StripEscapes(each));
// Ignore apparent links to non-existent namespaces.
if ((null == relName.Namespace) || (null != TheFederation.ContentBaseForNamespace(relName.Namespace)))
{
// Build a list of all the possible absoluteNames for this topic
ArrayList absoluteNames = new ArrayList();
// Start with the singulars in the various reachable namespaces, then add the plurals
absoluteNames.AddRange(ContentBase.AllAbsoluteTopicNamesThatExist(relName));
AddCacheRule(ContentBase.CacheRuleForAllPossibleInstancesOfTopic(relName));
foreach (TopicName alternate in relName.AlternateForms)
{
AddCacheRule(ContentBase.CacheRuleForAllPossibleInstancesOfTopic(alternate));
absoluteNames.AddRange(ContentBase.AllAbsoluteTopicNamesThatExist(alternate));
}
// Now see if we got any hits or not
string rep = beforeOrRelabel + "(" + RegexEscapeTopic(each) + ")" + afterWikiName;
AbsoluteTopicName appearedAs = new AbsoluteTopicName(each); // in case it was a plural form, be sure to show it as it appeared
string displayname = TopicName.StripEscapes((ContentBase.DisplaySpacesInWikiLinks ? appearedAs.FormattedName : appearedAs.Name));
if (relabel.Length > 0)
{
displayname = relabel;
}
if (absoluteNames.Count == 0)
{
if (!IsUnbracketedOneWordName(each))
{
// It doesn't exist, so give the option to create it
AbsoluteTopicName abs = relName.AsAbsoluteTopicName(ContentBase.Namespace);
str = ReplaceMatch(answer, str, m, before + "<a title=\"Click here to create this topic\" class=\"create\" href=\"" + LinkMaker().LinkToEditTopic(abs) + "\">" + displayname + "</a>" + after);
}
else
str = ReplaceMatch(answer, str, m, m.Value);
}
else
{
// We got hits, let's add links
if (absoluteNames.Count == 1)
{
// The simple case is that there's only one link to point to, so we output just a normal link
AbsoluteTopicName abs = (AbsoluteTopicName)absoluteNames[0];
string tip = TipForTopic(abs);
string tipid = null;
string tipHTML = null;
bool defaultTip = tip == null;
if (defaultTip)
{
tip = "Click to read this topic";
}
tipid = NewUniqueIdentifier();
tipHTML = Formatter.EscapeHTML(tip);
if (defaultTip)
{
tipHTML = "<span class=\"DefaultTopicTipText\">" + tipHTML + "</span>";
}
tipHTML += "<div class=\"TopicTipStats\">" + TheFederation.GetTopicModificationTime(abs).ToString() + " - " + TheFederation.GetTopicLastModifiedBy(abs) + "</div>";
tipHTML = "<div id=" + tipid +" style=\"display: none\">" + tipHTML + "</div>";
Output.AddToFooter(tipHTML);
string replacement = "<a ";
if (tip != null)
{
replacement += "onmouseover=\"TopicTipOn(this, '" + tipid + "', event);\" onmouseout=\"TopicTipOff();\" ";
}
replacement += "href=\"" + LinkMaker().LinkToTopic(abs);
if (anchor.Length > 0)
{
replacement += "#" + anchor;
if (0 == relabel.Length)
{
displayname += "#" + anchor;
}
}
replacement += "\">" + displayname + "</a>";
str = ReplaceMatch(answer, str, m, before + replacement + after) ;
}
else
{
// There's more than one; we need to generate a dynamic menu
string clickEvent;
clickEvent = "onclick=\"javascript:LinkMenu(new Array(";
//.........这里部分代码省略.........
示例14: TipForTopic
private string TipForTopic(AbsoluteTopicName topic)
{
string answer = TheFederation.GetTopicProperty(topic, "Summary");
if (answer == "")
answer = null;
return answer;
}
示例15: IncludedTopic
private string IncludedTopic(TopicName topic, int headingLevelBase)
{
// TODO: how do we identify specific versions? [maybe this just works now? since versionids are a formal part of a wikiname???]
// TODO: how do we show diffs?
string ns = ContentBase.UnambiguousTopicNamespace(topic);
ContentBase containingContentBase = TheFederation.ContentBaseForNamespace(ns);
AbsoluteTopicName abs = new AbsoluteTopicName(topic.Name, ns);
string content = containingContentBase.Read(abs.LocalName).TrimEnd();
WikiOutput output = WikiOutput.ForFormat(_Output.Format, Output);
Formatter.Format(abs, content, output, ContentBase, LinkMaker(), _ExternalWikiMap, headingLevelBase, CacheRuleAccumulator);
return output.ToString().Trim();
}