Skip to content

Commit a0531c5

Browse files
authored
Help abstraction update (#68)
##### Objective Embed the year reference within the webHelpAbstraction.json export. ##### Abstractions Removed all hard coded and/or dynamically generated year paths related to documentation. Implemented a user prompt during abstraction creation, the provided value becomes the year baseline in all places from that point forward. ##### Tests performed **C#** - Verified the year would be dynamically added to existing json exports - Verified the pages wouldn't load if an unreleased year was provided **TS** - Verified the help link functionality still works and used the json year value
1 parent e89e058 commit a0531c5

File tree

9 files changed

+38
-19
lines changed

9 files changed

+38
-19
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@ vendor
44
tmp
55
autolispext*.zip
66
package.nls.*.json
7+
8+
utils/HelpAbstractionGenerator/**/*.pdb
9+
utils/HelpAbstractionGenerator/**/*.xml
10+
utils/HelpAbstractionGenerator/.vs
11+
utils/HelpAbstractionGenerator/obj
12+
utils/HelpAbstractionGenerator/packages

extension/src/help/openWebHelp.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ export class WebHelpLibrary implements IJsonLoadable {
2626
functions: Dictionary<WebHelpFunction> = {};
2727
ambiguousFunctions: Dictionary<WebHelpFunction[]> = {};
2828
enumerators: Dictionary<string> = {};
29+
year: string;
2930

3031
// consumes a JSON converted object into the WebHelpLibrary
3132
loadFromJsonObject(obj: object): void{
33+
this.year = obj['year'] ?? '2021';
3234
Object.keys(obj["dclAttributes"]).forEach(key => {
3335
let newObj = new WebHelpDclAtt(obj["dclAttributes"][key]);
3436
this.dclAttributes[key] = newObj;
@@ -65,26 +67,26 @@ export class WebHelpLibrary implements IJsonLoadable {
6567
return; // No Document
6668
} else if (editor.document.fileName.slice(-4).toUpperCase() === ".LSP") {
6769
if (symbolProfile in this.objects){
68-
return this.objects[symbolProfile].getHelpLink();
70+
return this.objects[symbolProfile].getHelpLink(this.year);
6971
} else if (symbolProfile in this.functions){
70-
return this.functions[symbolProfile].getHelpLink();
72+
return this.functions[symbolProfile].getHelpLink(this.year);
7173
} else if (symbolProfile in this.ambiguousFunctions){
72-
return this.ambiguousFunctions[symbolProfile][0].getHelpLink();
74+
return this.ambiguousFunctions[symbolProfile][0].getHelpLink(this.year);
7375
} else if (symbolProfile in this.enumerators){
7476
return this.getWebHelpUrlBySymbolName(this.enumerators[symbolProfile]);
7577
} else {
76-
return WebHelpEntity.createHelpLink("4CEE5072-8817-4920-8A2D-7060F5E16547"); // LSP General Landing Page
78+
return WebHelpEntity.createHelpLink("4CEE5072-8817-4920-8A2D-7060F5E16547", this.year); // LSP General Landing Page
7779
}
7880
} else if (editor.document.fileName.slice(-4).toUpperCase() === ".DCL") {
7981
if (symbolProfile in this.dclTiles){
80-
return this.dclTiles[symbolProfile].getHelpLink();
82+
return this.dclTiles[symbolProfile].getHelpLink(this.year);
8183
} else if (symbolProfile in this.dclAttributes){
82-
return this.dclAttributes[symbolProfile].getHelpLink();
84+
return this.dclAttributes[symbolProfile].getHelpLink(this.year);
8385
} else {
84-
return WebHelpEntity.createHelpLink("F8F5A79B-9A05-4E25-A6FC-9720216BA3E7"); // DCL General Landing Page
86+
return WebHelpEntity.createHelpLink("F8F5A79B-9A05-4E25-A6FC-9720216BA3E7", this.year); // DCL General Landing Page
8587
}
8688
}
87-
return WebHelpEntity.getDefaultHelpLink();
89+
return WebHelpEntity.getDefaultHelpLink(this.year);
8890
}
8991
}
9092

@@ -138,18 +140,17 @@ class WebHelpEntity {
138140
}
139141

140142

141-
getHelpLink(): string {
142-
return WebHelpEntity.getDefaultHelpLink() + "?guid=GUID-" + this.guid;
143+
getHelpLink(year): string {
144+
return WebHelpEntity.getDefaultHelpLink(year) + "?guid=GUID-" + this.guid;
143145
}
144146

145-
static createHelpLink(guid: string): string {
146-
return WebHelpEntity.getDefaultHelpLink() + "?guid=GUID-" + guid;
147+
static createHelpLink(guid: string, year: string): string {
148+
return WebHelpEntity.getDefaultHelpLink(year) + "?guid=GUID-" + guid;
147149
}
148150

149-
static getDefaultHelpLink(): string {
151+
static getDefaultHelpLink(year: string): string {
150152
let lang: string = WebHelpEntity.getLanguageUrlDomain();
151-
let year: number = new Date().getFullYear();
152-
return "https://help.autodesk.com/view/OARX/" + year.toString() + lang;
153+
return "https://help.autodesk.com/view/OARX/" + year + lang;
153154
}
154155

155156
static getLanguageUrlDomain(): string {

extension/src/help/webHelpAbstraction.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"year": "2021",
23
"objects": {
34
"_dacadapplicationevents": {
45
"methods": [

utils/HelpAbstractionGenerator/HelpAbstractionGenerator.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<Reference Include="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
4242
<EmbedInteropTypes>True</EmbedInteropTypes>
4343
</Reference>
44+
<Reference Include="Microsoft.VisualBasic" />
4445
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
4546
<HintPath>packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
4647
</Reference>

utils/HelpAbstractionGenerator/MainWindow.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
<TextBlock TextWrapping="Wrap" Margin="5">
3838
Once the page has loaded, expand all the left-side navigation elements you want to include in the data collection,
3939
this is required because the actual links don't exist until they've been expanded through a click event. Finally,
40-
click the 'Collect Links and Continue' button before moving onto step 2.
40+
click the 'Collect Links and Continue' button before moving onto step 2. If this page doesn't load then there is a
41+
good change the year you provided doesn't have documentation available at this time.
4142
</TextBlock>
4243
<Separator Margin="0" Padding="0"/>
4344
</StackPanel>

utils/HelpAbstractionGenerator/MainWindow.xaml.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ private void tabInterface_SelectionChanged(object sender, SelectionChangedEventA
141141
break;
142142
case 5: // possibly some kind of rule system
143143
CurrentLib = ioPathHelpAbstraction.UnPack<WebObjectLibrary>();
144+
if (CurrentLib.year == null)
145+
CurrentLib.year = urlHelpers.year;
144146
AllOverrides.Clear();
145147
Filter = "";
146148
if (System.IO.File.Exists(ioPathRuleOverrides) == true)
@@ -250,7 +252,7 @@ private void lbxScrapeContent_SelectedItemChanged(object sender, RoutedPropertyC
250252
}
251253
private void btnScrapeAllContent_Click(object sender, RoutedEventArgs e)
252254
{
253-
WebObjectLibrary ejoLib = new WebObjectLibrary();
255+
WebObjectLibrary ejoLib = new WebObjectLibrary(urlHelpers.year);
254256
foreach (var key in CatagorizedLinks.Keys)
255257
{
256258
foreach (var link in CatagorizedLinks[key])
@@ -348,7 +350,7 @@ private void btnExportFinalAbstraction_Click(object sender, RoutedEventArgs e)
348350
StringBuilder sb = new StringBuilder();
349351
sb.AppendLine("Extraction Completed: " + (Errors.Count == 0 ? "without errors" : "with override json errors!"));
350352
sb.AppendLine("");
351-
sb.AppendLine("Note that unless you've specifically overwritten the internal (pre-override) version, then this dialog will not show show the exported version");
353+
sb.AppendLine("Note that unless you've specifically overwritten the internal (pre-override) version, then this dialog will not show the exported version");
352354
sb.AppendLine("");
353355
sb.AppendLine("");
354356
foreach (string err in Errors)

utils/HelpAbstractionGenerator/StaticUtilities.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,18 @@ public static string wrapContentIntoHtmlDocument(List<HAP.HtmlNode> bodyContent)
3838

3939
public static class urlHelpers
4040
{
41+
public static string year = "";
4142
public static string getHelpURL(string guid)
4243
{
4344
return getDefaultHelpURL() + "?guid=GUID-" + guid;
4445
}
4546
public static string getDefaultHelpURL()
4647
{
47-
return "https://help.autodesk.com/view/OARX/2021/" + System.Globalization.CultureInfo.CurrentCulture.ThreeLetterWindowsLanguageName + "/";
48+
if (year == "")
49+
year = Microsoft.VisualBasic.Interaction.InputBox("This should be the most current version of the Autodesk documentation and may not be the current year shown", "Enter 4 digit year", DateTime.Now.Year.ToString()).Trim();
50+
if (year == "")
51+
year = "2021";
52+
return "https://help.autodesk.com/view/OARX/" + year + "/" + System.Globalization.CultureInfo.CurrentCulture.ThreeLetterWindowsLanguageName + "/";
4853
}
4954
}
5055

utils/HelpAbstractionGenerator/StepBehaviors/Step4.WebObjectLibrary.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace HelpAbstractionGenerator
1313
#region Exported Json Objects
1414
public class WebObjectLibrary
1515
{
16+
public string year { get; set; }
1617
public Dictionary<string, ejoObject> objects { get; set; } = new Dictionary<string, ejoObject>();
1718
public Dictionary<string, ejoFunction> functions { get; set; } = new Dictionary<string, ejoFunction>();
1819
public Dictionary<string, List<ejoFunction>> ambiguousFunctions { get; set; } = new Dictionary<string, List<ejoFunction>>();
@@ -22,6 +23,7 @@ public class WebObjectLibrary
2223
public Dictionary<string, ejoEvent> events { get; set; } = new Dictionary<string, ejoEvent>();
2324

2425
public WebObjectLibrary() { }
26+
public WebObjectLibrary(string year) { this.year = year; }
2527
}
2628

2729

Binary file not shown.

0 commit comments

Comments
 (0)