Typographics initial commit

main
Inga 🏳‍🌈 15 years ago
parent 229883f67e
commit b7b90d31df
  1. 2
      Builder/IISMainHandler/build.txt
  2. 2
      Builder/IISUploadHandler/build.txt
  3. 7
      Common/UBBParser.cs

@ -35,6 +35,10 @@ namespace FLocal.Common {
private static readonly Dictionary<Regex, MatchEvaluator> SMILEYS_DATA = (from smile in SMILEYS select new KeyValuePair<Regex, MatchEvaluator>(new Regex("(^|\\s+|>)" + Regex.Escape(smile.Key) + "($|\\s+|<)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline), match => match.Groups[1] + "<img src=\"/static/smileys/" + smile.Value + ".gif\" alt=\"" + smile.Key + "\"/>" + match.Groups[2])).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); private static readonly Dictionary<Regex, MatchEvaluator> SMILEYS_DATA = (from smile in SMILEYS select new KeyValuePair<Regex, MatchEvaluator>(new Regex("(^|\\s+|>)" + Regex.Escape(smile.Key) + "($|\\s+|<)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline), match => match.Groups[1] + "<img src=\"/static/smileys/" + smile.Value + ".gif\" alt=\"" + smile.Key + "\"/>" + match.Groups[2])).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
private static readonly Dictionary<Regex, MatchEvaluator> TYPOGRAPHICS = new Dictionary<Regex, MatchEvaluator> {
{ new Regex("(\\s+)-(\\s+)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline), match => match.Groups[1] + "&ndash;" + match.Groups[2] },
};
private ITextFormatter inner; private ITextFormatter inner;
private TextFormatter() { private TextFormatter() {
@ -46,6 +50,9 @@ namespace FLocal.Common {
foreach(var smile in SMILEYS_DATA) { foreach(var smile in SMILEYS_DATA) {
result = smile.Key.Replace(result, smile.Value); result = smile.Key.Replace(result, smile.Value);
} }
foreach(var kvp in TYPOGRAPHICS) {
result = kvp.Key.Replace(result, kvp.Value);
}
return result; return result;
} }

Loading…
Cancel
Save