Exemple #1
0
 static htmlTag createCell(string ct, LoggerMemory wr, inlineControlTypes type, int rowIdx, int colIdx) {
   var match = cellFmt.Match(ct);
   string cls = null;
   if (match.Success) {
     var align = match.Groups["align"].Value;
     var color = match.Groups["color"].Value;
     ct = ct.Substring(match.Length);
     if (!string.IsNullOrEmpty(color)) {
       switch (color[0]) {
         case 'y': cls += rowIdx == 0 ? " oli-table-top-rounded oli-table-default" : (colIdx == 0 ? " oli-table-left-rounded oli-table-default" : " oli-table-default"); break;
         case 'b': cls += " oli-table-del"; break;
         case 'g': cls += " oli-table-default"; break;
       }
     }
     if (!string.IsNullOrEmpty(align)) {
       switch (align[0]) {
         case 'l': cls += " left"; break;
         case 'c': cls += " center"; break;
         case 'r': cls += " right"; break;
       }
       switch (align[1]) {
         case 't': cls += " top"; break;
         case 'm': cls += " middle"; break;
         case 'b': cls += " bottom"; break;
       }
     }
   }
   return htmlTag.create(htmlTag.td,
     "class", cls,
     smartTag.replaceMacroHardReturn(ct, wr, type)
   );
 }
Exemple #2
0
 public static tag prefix(macroTemplate self, inlineControlTypes type, ref string[] lines, out string tableStyleSheet) {
   tableStyleSheet = null;
   switch (type) {
     case inlineControlTypes.DragTarget:
       return new offering() { /*width = self.width*/ };
     case inlineControlTypes.GapFill_Correction:
     case inlineControlTypes.GapFill:
       if (!lines[0].StartsWith(gridPrefix)) return null;
       var parts = smartElement.splitEx(lines[0].Substring(1));
       lines = lines.Skip(gridPrefix.Length).ToArray();
       string id = string.Format("mtgid{0}",macroTableGridId++ % 50);
       tableStyleSheet = "gap-fill {offering-id:" + id + "}";
       return new offering() { id = id, words = parts.DefaultIfEmpty().Aggregate((r, i) => r + "|" + i) };
   }
   return null;
 }