Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Fix last commit, due to merge conflicts
Browse files Browse the repository at this point in the history
svn path=/trunk/lb/; revision=102470
  • Loading branch information
migueldeicaza committed May 4, 2008
1 parent 4044ba9 commit 995d841
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
23 changes: 16 additions & 7 deletions lb.cs
Expand Up @@ -322,9 +322,10 @@ class Blog {
string entry_template; string entry_template;
string analytics = ""; string analytics = "";
string comments = ""; string comments = "";
string archive;
Hashtable category_entries = new Hashtable (); Hashtable category_entries = new Hashtable ();


ArrayList entries = new ArrayList (); List<DayEntry> entries = new List<DayEntry> ();


public int Entries { public int Entries {
get { get {
Expand All @@ -350,8 +351,15 @@ public Blog (Config config)
if (config.CommentsStub != null && config.CommentsStub.Length > 0){ if (config.CommentsStub != null && config.CommentsStub.Length > 0){
comments = File.OpenText (config.CommentsStub).ReadToEnd (); comments = File.OpenText (config.CommentsStub).ReadToEnd ();
} }

} }


void GenerateArchiveGadget ()
{
//var x = from be in entries
//group be by be.
}

void LoadDirectory (DirectoryInfo dir) void LoadDirectory (DirectoryInfo dir)
{ {
if (dir.Name.EndsWith ("drafts")) if (dir.Name.EndsWith ("drafts"))
Expand Down Expand Up @@ -394,7 +402,7 @@ void AddCategory (Hashtable hash, DayEntry day)


static DateTime LastDate = new DateTime (2004, 5, 19, 0, 0, 0); static DateTime LastDate = new DateTime (2004, 5, 19, 0, 0, 0);


void Render (TextWriter o, IList entries, int idx, string blog_base, bool include_daily_anchor, bool include_navigation) void Render (TextWriter o, IList entries, int idx, string blog_base, bool include_daily_anchor, bool single_entry)
{ {
DayEntry d = (DayEntry) entries [idx]; DayEntry d = (DayEntry) entries [idx];


Expand All @@ -405,7 +413,8 @@ void Render (TextWriter o, IList entries, int idx, string blog_base, bool includ


string entry_specific = ""; string entry_specific = "";
string navigation = ""; string navigation = "";
if (include_navigation){
if (single_entry){
navigation = GetEntryNavigation (entries, idx, blog_base); navigation = GetEntryNavigation (entries, idx, blog_base);
if (config.EntrySpecific != null && config.EntrySpecific != String.Empty) if (config.EntrySpecific != null && config.EntrySpecific != String.Empty)
entry_specific = File.OpenText (config.EntrySpecific).ReadToEnd (); entry_specific = File.OpenText (config.EntrySpecific).ReadToEnd ();
Expand All @@ -416,7 +425,7 @@ void Render (TextWriter o, IList entries, int idx, string blog_base, bool includ
substitutions.Add ("@ENTRY_NAVIGATION@", navigation); substitutions.Add ("@ENTRY_NAVIGATION@", navigation);
substitutions.Add ("@ENTRY_SPECIFIC@", entry_specific); substitutions.Add ("@ENTRY_SPECIFIC@", entry_specific);


FillEntrySubstitutions (substitutions, d, blog_base); FillEntrySubstitutions (substitutions, d, blog_base, single_entry);


StringWriter body = new StringWriter (new StringBuilder (d.Body.Length)); StringWriter body = new StringWriter (new StringBuilder (d.Body.Length));
Translate (d.Body, body, substitutions); Translate (d.Body, body, substitutions);
Expand All @@ -425,7 +434,7 @@ void Render (TextWriter o, IList entries, int idx, string blog_base, bool includ
Translate (entry_template, o, substitutions); Translate (entry_template, o, substitutions);
} }


void FillEntrySubstitutions (Hashtable substitutions, DayEntry d, string blog_base) void FillEntrySubstitutions (Hashtable substitutions, DayEntry d, string blog_base, bool single_entry)
{ {
string category_paths = GetCategoryPaths (d, blog_base); string category_paths = GetCategoryPaths (d, blog_base);
string entry_path = LB.GetEntryPath (blog_base, d); string entry_path = LB.GetEntryPath (blog_base, d);
Expand All @@ -444,7 +453,7 @@ void FillEntrySubstitutions (Hashtable substitutions, DayEntry d, string blog_ba
substitutions.Add ("@BLOGWEBDIR@", config.BlogWebDirectory); substitutions.Add ("@BLOGWEBDIR@", config.BlogWebDirectory);
substitutions.Add ("@ENTRY_URL_PERMALINK@", Path.Combine (config.BlogWebDirectory, d.PermaLink)); substitutions.Add ("@ENTRY_URL_PERMALINK@", Path.Combine (config.BlogWebDirectory, d.PermaLink));


if (d.Comments && include_navigation){ if (d.Comments && single_entry){
StringWriter rendered_comment = new StringWriter (new StringBuilder (comments.Length)); StringWriter rendered_comment = new StringWriter (new StringBuilder (comments.Length));
Translate (comments, rendered_comment, substitutions); Translate (comments, rendered_comment, substitutions);
substitutions.Add ("@COMMENTS@", rendered_comment.ToString ()); substitutions.Add ("@COMMENTS@", rendered_comment.ToString ());
Expand Down Expand Up @@ -757,7 +766,7 @@ public void RenderRSS (RssVersion version, string output, IList entries, int sta
DayEntry d = (DayEntry) entries [idx]; DayEntry d = (DayEntry) entries [idx];


Hashtable substitutions = new Hashtable (); Hashtable substitutions = new Hashtable ();
FillEntrySubstitutions (substitutions, d, config.BlogWebDirectory); FillEntrySubstitutions (substitutions, d, config.BlogWebDirectory, false);
StringWriter description = new StringWriter (new StringBuilder (d.Body.Length)); StringWriter description = new StringWriter (new StringBuilder (d.Body.Length));
Translate (d.Body, description, substitutions); Translate (d.Body, description, substitutions);


Expand Down
4 changes: 4 additions & 0 deletions log-style.css
Expand Up @@ -8,6 +8,10 @@ h1 {
background: #666666; background: #666666;
} }


h1 a:visited {
color: #efefef
}

h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
font-family: Verdana,sans-serif; font-family: Verdana,sans-serif;
font-weight: bold; font-weight: bold;
Expand Down
2 changes: 1 addition & 1 deletion template
Expand Up @@ -16,7 +16,7 @@ function startup()


<body onload='startup ();'> <body onload='startup ();'>


<h1>@DESCRIPTION@</h1> <h1><a href="@BLOGWEBDIR@">@DESCRIPTION@</a></h1>


<div id='sidebar'> <div id='sidebar'>
<h2>RSS</h2> <h2>RSS</h2>
Expand Down

0 comments on commit 995d841

Please sign in to comment.