protected virtual void VisitDocument(DocumentModel documentModel) { foreach(var child in documentModel.Children) { VisitProjectItem(child); } }
public Token(DocumentModel document, string fullName, string value, string type, int lineNumber, bool isDeclaration = false, bool isSearchable = false) { Document = document; FullName = fullName; Value = value; Type = type; LineNumber = lineNumber; IsDeclaration = isDeclaration; IsSearchable = isSearchable; }
protected override void VisitDocument(DocumentModel documentModel) { var declarations = documentModel.Tokens.Where(n => n.IsDeclaration); foreach(var declaration in declarations) { TokenLookup[declaration.FullName] = declaration; } base.VisitDocument(documentModel); }
protected override void VisitDocument(DocumentModel documentModel) { var documentId = Path.Combine(_username, _repository, documentModel.RelativePath); var declarations = documentModel.Tokens.Where(n => n.IsDeclaration && n.IsSearchable); var tokenModels = from declaration in declarations select new TokenViewModel( _username, _repository, documentId, declaration.FullName, declaration.LineNumber ); SearchIndex.AddDeclarationsToIndex(tokenModels); base.VisitDocument(documentModel); }
protected override void VisitDocument(DocumentModel documentModel) { _writer.AddAttribute(HtmlTextWriterAttribute.Class, "node collapsed"); _writer.AddAttribute(HtmlTextWriterAttribute.Title, HttpUtility.HtmlEncode(documentModel.Name)); // Tooltip _writer.RenderBeginTag(HtmlTextWriterTag.Li); //NOTE: We need to correct the backslashes to forward slashes... Thanks Windows... string linkPath = Path.Combine(_userNameAndRepoPrefix, documentModel.RelativePath); var urlStylePath = linkPath.Replace('\\','/'); _writer.AddAttribute(HtmlTextWriterAttribute.Href, urlStylePath); _writer.AddAttribute(HtmlTextWriterAttribute.Style, "margin-left: " + depth * 10 + "px;"); _writer.RenderBeginTag(HtmlTextWriterTag.A); _writer.Write(HttpUtility.HtmlEncode(documentModel.Name)); _writer.RenderEndTag(); // a base.VisitDocument(documentModel); _writer.RenderEndTag(); // li _writer.WriteLine(); }
protected override void VisitDocument(DocumentModel documentModel) { var documentSavePath = Path.Combine(_savePath, documentModel.RelativePath); Directory.CreateDirectory(Path.GetDirectoryName(documentSavePath)); using (var sw = new StreamWriter(documentSavePath)) { sw.WriteLine("<table cellpadding='0' cellspacing='0'>"); sw.WriteLine("<tbody>"); sw.WriteLine("<tr>"); sw.WriteLine("<td valign='top' style='min-diwth:65px'>"); sw.WriteLine("<pre id='line-numbers'>"); //Create the sidebar with line numbers this.createLineNumberHtml(sw, documentModel.NumberOfLines); sw.WriteLine("</pre>"); //line-numbers sw.WriteLine("</td>"); sw.WriteLine("<td valign='top'>"); sw.WriteLine("<pre class='source-code'>"); foreach (var token in documentModel.Tokens) { processToken(sw, token); } sw.WriteLine("</pre>"); sw.WriteLine("</td>"); sw.WriteLine("</tr>"); sw.WriteLine("</tbody>"); sw.WriteLine("</table>"); } base.VisitDocument(documentModel); }