ssg: remove PostUrlFormat. this field is currently not required, and can be a potential cause for end-user confusion
This commit is contained in:
parent
27e979f19a
commit
a64ae677a0
|
@ -20,7 +20,6 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
||||||
private const string CONFIG_OUTPUT_PATH = "OutputPath";
|
private const string CONFIG_OUTPUT_PATH = "OutputPath";
|
||||||
private const string CONFIG_BUILD_COMMAND = "BuildCommand";
|
private const string CONFIG_BUILD_COMMAND = "BuildCommand";
|
||||||
private const string CONFIG_PUBLISH_COMMAND = "PublishCommand";
|
private const string CONFIG_PUBLISH_COMMAND = "PublishCommand";
|
||||||
private const string CONFIG_POST_URL_FORMAT = "PostUrlFormat";
|
|
||||||
private const string CONFIG_SITE_URL = "SiteUrl"; // Store Site Url in credentials as well, for acccess by StaticSiteClient
|
private const string CONFIG_SITE_URL = "SiteUrl"; // Store Site Url in credentials as well, for acccess by StaticSiteClient
|
||||||
private const string CONFIG_SHOW_CMD_WINDOWS = "ShowCmdWindows";
|
private const string CONFIG_SHOW_CMD_WINDOWS = "ShowCmdWindows";
|
||||||
private const string CONFIG_CMD_TIMEOUT_MS = "CmdTimeoutMs";
|
private const string CONFIG_CMD_TIMEOUT_MS = "CmdTimeoutMs";
|
||||||
|
@ -103,13 +102,6 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SiteTitle { get; set; } = "";
|
public string SiteTitle { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Post URL format, appended to end of Site URL, automatically opened on publish completion.
|
|
||||||
/// Supports %y for four-digit year, %m and %d for two-digit months and days, %f for post filename.
|
|
||||||
/// Default is Jekyll format: "%y/%m/%d/%f"
|
|
||||||
/// </summary>
|
|
||||||
public string PostUrlFormat { get; set; } = "%y/%m/%d/%f";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show CMD windows. Useful for debugging. Default is false.
|
/// Show CMD windows. Useful for debugging. Default is false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -152,8 +144,6 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
||||||
BuildCommand = creds.GetCustomValue(CONFIG_BUILD_COMMAND);
|
BuildCommand = creds.GetCustomValue(CONFIG_BUILD_COMMAND);
|
||||||
|
|
||||||
PublishCommand = creds.GetCustomValue(CONFIG_PUBLISH_COMMAND);
|
PublishCommand = creds.GetCustomValue(CONFIG_PUBLISH_COMMAND);
|
||||||
// Don't overwrite the default value if we fail to find a value;
|
|
||||||
if (creds.GetCustomValue(CONFIG_POST_URL_FORMAT) != string.Empty) PostUrlFormat = creds.GetCustomValue(CONFIG_POST_URL_FORMAT);
|
|
||||||
|
|
||||||
SiteUrl = creds.GetCustomValue(CONFIG_SITE_URL); // This will be overidden in LoadFromBlogSettings, HomepageUrl is considered a more accurate source of truth
|
SiteUrl = creds.GetCustomValue(CONFIG_SITE_URL); // This will be overidden in LoadFromBlogSettings, HomepageUrl is considered a more accurate source of truth
|
||||||
|
|
||||||
|
@ -200,7 +190,6 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
||||||
creds.SetCustomValue(CONFIG_BUILD_COMMAND, BuildCommand);
|
creds.SetCustomValue(CONFIG_BUILD_COMMAND, BuildCommand);
|
||||||
|
|
||||||
creds.SetCustomValue(CONFIG_PUBLISH_COMMAND, PublishCommand);
|
creds.SetCustomValue(CONFIG_PUBLISH_COMMAND, PublishCommand);
|
||||||
creds.SetCustomValue(CONFIG_POST_URL_FORMAT, PostUrlFormat);
|
|
||||||
creds.SetCustomValue(CONFIG_SITE_URL, SiteUrl);
|
creds.SetCustomValue(CONFIG_SITE_URL, SiteUrl);
|
||||||
|
|
||||||
creds.SetCustomValue(CONFIG_SHOW_CMD_WINDOWS, ShowCmdWindows ? "1" : "0");
|
creds.SetCustomValue(CONFIG_SHOW_CMD_WINDOWS, ShowCmdWindows ? "1" : "0");
|
||||||
|
@ -231,7 +220,6 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
||||||
PublishCommand = PublishCommand,
|
PublishCommand = PublishCommand,
|
||||||
SiteUrl = SiteUrl,
|
SiteUrl = SiteUrl,
|
||||||
SiteTitle = SiteTitle,
|
SiteTitle = SiteTitle,
|
||||||
PostUrlFormat = PostUrlFormat,
|
|
||||||
ShowCmdWindows = ShowCmdWindows,
|
ShowCmdWindows = ShowCmdWindows,
|
||||||
CmdTimeoutMs = CmdTimeoutMs,
|
CmdTimeoutMs = CmdTimeoutMs,
|
||||||
Initialised = Initialised,
|
Initialised = Initialised,
|
||||||
|
|
|
@ -27,7 +27,6 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
||||||
.ValidateDraftsPath()
|
.ValidateDraftsPath()
|
||||||
.ValidateImagesPath()
|
.ValidateImagesPath()
|
||||||
.ValidateOutputPath()
|
.ValidateOutputPath()
|
||||||
.ValidatePostUrlFormat()
|
|
||||||
.ValidateBuildCommand()
|
.ValidateBuildCommand()
|
||||||
.ValidatePublishCommand();
|
.ValidatePublishCommand();
|
||||||
|
|
||||||
|
@ -156,16 +155,6 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public StaticSiteConfigValidator ValidatePostUrlFormat()
|
|
||||||
{
|
|
||||||
if (!_config.PostUrlFormat.Contains("%f"))
|
|
||||||
throw new StaticSiteConfigValidationException(
|
|
||||||
"Invalid Post URL format",
|
|
||||||
"Post URL format does not contain filename variable (%f)");
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StaticSiteConfigValidator ValidateBuildCommand()
|
public StaticSiteConfigValidator ValidateBuildCommand()
|
||||||
{
|
{
|
||||||
if (!_config.BuildingEnabled) return this; // Don't validate if building isn't enabled
|
if (!_config.BuildingEnabled) return this; // Don't validate if building isn't enabled
|
||||||
|
|
|
@ -52,17 +52,9 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the site path for the published post
|
/// We currently do not take configuration for specifiying a post path format
|
||||||
/// eg. /2019/01/slug.html
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override string SitePath
|
public override string SitePath => throw new NotImplementedException();
|
||||||
{
|
|
||||||
get => SiteConfig.PostUrlFormat
|
|
||||||
.Replace("%y", BlogPost.DatePublished.ToString("yyyy"))
|
|
||||||
.Replace("%m", BlogPost.DatePublished.ToString("MM"))
|
|
||||||
.Replace("%d", BlogPost.DatePublished.ToString("dd"))
|
|
||||||
.Replace("%f", $"{Slug}{PUBLISH_FILE_EXTENSION}");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets filename based on slug with prepended date
|
/// Gets filename based on slug with prepended date
|
||||||
|
|
|
@ -30,14 +30,6 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard
|
||||||
private TextBox textBoxImagesPath;
|
private TextBox textBoxImagesPath;
|
||||||
private Label labelOutputPath;
|
private Label labelOutputPath;
|
||||||
private TextBox textBoxOutputPath;
|
private TextBox textBoxOutputPath;
|
||||||
private Label labelUrlFormat;
|
|
||||||
private Label labelUrlFormatSubtitle;
|
|
||||||
private TextBox textBoxUrlFormat;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Local site path, loaded from config, used for validation
|
|
||||||
/// </summary>
|
|
||||||
private string _localSitePath;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@ -52,9 +44,6 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard
|
||||||
this.labelHeader.Text = Res.Get(StringId.CWStaticSitePathsTitle);
|
this.labelHeader.Text = Res.Get(StringId.CWStaticSitePathsTitle);
|
||||||
this.labelImagesPath.Text = Res.Get(StringId.CWStaticSitePathsImagesPath);
|
this.labelImagesPath.Text = Res.Get(StringId.CWStaticSitePathsImagesPath);
|
||||||
this.labelOutputPath.Text = Res.Get(StringId.CWStaticSitePathsOutputPath);
|
this.labelOutputPath.Text = Res.Get(StringId.CWStaticSitePathsOutputPath);
|
||||||
this.labelUrlFormat.Text = Res.Get(StringId.CWStaticSitePathsUrlFormat);
|
|
||||||
this.labelUrlFormatSubtitle.Text = Res.Get(StringId.CWStaticSitePathsUrlFormatSubtitle);
|
|
||||||
this.labelUrlFormatSubtitle.ForeColor = !SystemInformation.HighContrast ? Color.FromArgb(136, 136, 136) : SystemColors.GrayText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void NaturalizeLayout()
|
public override void NaturalizeLayout()
|
||||||
|
@ -66,20 +55,13 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard
|
||||||
MaximizeWidth(textBoxImagesPath);
|
MaximizeWidth(textBoxImagesPath);
|
||||||
MaximizeWidth(labelOutputPath);
|
MaximizeWidth(labelOutputPath);
|
||||||
MaximizeWidth(textBoxOutputPath);
|
MaximizeWidth(textBoxOutputPath);
|
||||||
MaximizeWidth(labelUrlFormat);
|
|
||||||
MaximizeWidth(labelUrlFormatSubtitle);
|
|
||||||
MaximizeWidth(textBoxUrlFormat);
|
|
||||||
|
|
||||||
LayoutHelper.NaturalizeHeight(labelUrlFormatSubtitle);
|
|
||||||
|
|
||||||
LayoutHelper.NaturalizeHeightAndDistributeNoScale(3, labelImagesPath, textBoxImagesPath);
|
LayoutHelper.NaturalizeHeightAndDistributeNoScale(3, labelImagesPath, textBoxImagesPath);
|
||||||
LayoutHelper.NaturalizeHeightAndDistributeNoScale(3, labelOutputPath, textBoxOutputPath);
|
LayoutHelper.NaturalizeHeightAndDistributeNoScale(3, labelOutputPath, textBoxOutputPath);
|
||||||
LayoutHelper.NaturalizeHeightAndDistributeNoScale(3, labelUrlFormat, labelUrlFormatSubtitle, textBoxUrlFormat);
|
|
||||||
|
|
||||||
LayoutHelper.DistributeVerticallyNoScale(10, false,
|
LayoutHelper.DistributeVerticallyNoScale(10, false,
|
||||||
new ControlGroup(labelImagesPath, textBoxImagesPath),
|
new ControlGroup(labelImagesPath, textBoxImagesPath),
|
||||||
new ControlGroup(labelOutputPath, textBoxOutputPath),
|
new ControlGroup(labelOutputPath, textBoxOutputPath)
|
||||||
new ControlGroup(labelUrlFormat, labelUrlFormatSubtitle, textBoxUrlFormat)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,17 +96,10 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard
|
||||||
set => textBoxOutputPath.Text = value;
|
set => textBoxOutputPath.Text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string UrlFormat
|
|
||||||
{
|
|
||||||
get => textBoxUrlFormat.Text;
|
|
||||||
set => textBoxUrlFormat.Text = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ValidateWithConfig(StaticSiteConfig config)
|
public void ValidateWithConfig(StaticSiteConfig config)
|
||||||
=> config.Validator
|
=> config.Validator
|
||||||
.ValidateImagesPath()
|
.ValidateImagesPath()
|
||||||
.ValidateOutputPath()
|
.ValidateOutputPath();
|
||||||
.ValidatePostUrlFormat();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves panel form fields into a StaticSiteConfig
|
/// Saves panel form fields into a StaticSiteConfig
|
||||||
|
@ -134,7 +109,6 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard
|
||||||
{
|
{
|
||||||
config.ImagesPath = ImagesPath;
|
config.ImagesPath = ImagesPath;
|
||||||
config.OutputPath = OutputPath;
|
config.OutputPath = OutputPath;
|
||||||
config.PostUrlFormat = UrlFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -143,12 +117,10 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard
|
||||||
/// <param name="config">a StaticSiteConfig instance</param>
|
/// <param name="config">a StaticSiteConfig instance</param>
|
||||||
public void LoadFromConfig(StaticSiteConfig config)
|
public void LoadFromConfig(StaticSiteConfig config)
|
||||||
{
|
{
|
||||||
_localSitePath = config.LocalSitePath;
|
|
||||||
ImagesEnabled = config.ImagesEnabled;
|
ImagesEnabled = config.ImagesEnabled;
|
||||||
ImagesPath = config.ImagesPath;
|
ImagesPath = config.ImagesPath;
|
||||||
BuildingEnabled = config.BuildingEnabled;
|
BuildingEnabled = config.BuildingEnabled;
|
||||||
OutputPath = config.OutputPath;
|
OutputPath = config.OutputPath;
|
||||||
UrlFormat = config.PostUrlFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -177,9 +149,6 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard
|
||||||
this.textBoxImagesPath = new System.Windows.Forms.TextBox();
|
this.textBoxImagesPath = new System.Windows.Forms.TextBox();
|
||||||
this.labelOutputPath = new System.Windows.Forms.Label();
|
this.labelOutputPath = new System.Windows.Forms.Label();
|
||||||
this.textBoxOutputPath = new System.Windows.Forms.TextBox();
|
this.textBoxOutputPath = new System.Windows.Forms.TextBox();
|
||||||
this.labelUrlFormat = new System.Windows.Forms.Label();
|
|
||||||
this.labelUrlFormatSubtitle = new System.Windows.Forms.Label();
|
|
||||||
this.textBoxUrlFormat = new System.Windows.Forms.TextBox();
|
|
||||||
this.panelMain.SuspendLayout();
|
this.panelMain.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
@ -189,9 +158,6 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard
|
||||||
this.panelMain.Controls.Add(this.textBoxImagesPath);
|
this.panelMain.Controls.Add(this.textBoxImagesPath);
|
||||||
this.panelMain.Controls.Add(this.labelOutputPath);
|
this.panelMain.Controls.Add(this.labelOutputPath);
|
||||||
this.panelMain.Controls.Add(this.textBoxOutputPath);
|
this.panelMain.Controls.Add(this.textBoxOutputPath);
|
||||||
this.panelMain.Controls.Add(this.labelUrlFormat);
|
|
||||||
this.panelMain.Controls.Add(this.labelUrlFormatSubtitle);
|
|
||||||
this.panelMain.Controls.Add(this.textBoxUrlFormat);
|
|
||||||
this.panelMain.Size = new System.Drawing.Size(435, 242);
|
this.panelMain.Size = new System.Drawing.Size(435, 242);
|
||||||
//
|
//
|
||||||
// labelImagesPath
|
// labelImagesPath
|
||||||
|
@ -228,31 +194,6 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard
|
||||||
this.textBoxOutputPath.Size = new System.Drawing.Size(368, 20);
|
this.textBoxOutputPath.Size = new System.Drawing.Size(368, 20);
|
||||||
this.textBoxOutputPath.TabIndex = 3;
|
this.textBoxOutputPath.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// labelUrlFormat
|
|
||||||
//
|
|
||||||
this.labelUrlFormat.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
|
||||||
this.labelUrlFormat.Location = new System.Drawing.Point(20, 90);
|
|
||||||
this.labelUrlFormat.Name = "labelUrlFormat";
|
|
||||||
this.labelUrlFormat.Size = new System.Drawing.Size(83, 13);
|
|
||||||
this.labelUrlFormat.TabIndex = 4;
|
|
||||||
this.labelUrlFormat.Text = "Blog post URL format:";
|
|
||||||
//
|
|
||||||
// labelUrlFormatSubtitle
|
|
||||||
//
|
|
||||||
this.labelUrlFormatSubtitle.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
|
||||||
this.labelUrlFormatSubtitle.Location = new System.Drawing.Point(20, 107);
|
|
||||||
this.labelUrlFormatSubtitle.Name = "labelUrlFormatSubtitle";
|
|
||||||
this.labelUrlFormatSubtitle.Size = new System.Drawing.Size(83, 13);
|
|
||||||
this.labelUrlFormatSubtitle.TabIndex = 5;
|
|
||||||
this.labelUrlFormatSubtitle.Text = "Subtitle";
|
|
||||||
//
|
|
||||||
// textBoxUrlFormat
|
|
||||||
//
|
|
||||||
this.textBoxUrlFormat.Location = new System.Drawing.Point(20, 125);
|
|
||||||
this.textBoxUrlFormat.Name = "textBoxUrlFormat";
|
|
||||||
this.textBoxUrlFormat.Size = new System.Drawing.Size(368, 20);
|
|
||||||
this.textBoxUrlFormat.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// WeblogConfigurationWizardPanelStaticSitePaths2
|
// WeblogConfigurationWizardPanelStaticSitePaths2
|
||||||
//
|
//
|
||||||
this.AutoSize = true;
|
this.AutoSize = true;
|
||||||
|
|
Loading…
Reference in New Issue