I want to create keywords in HelpNDoc using api script editor. But, I could not find how to define parameter of function HndKeywords.CreateKeyword. Without passing any value to function, it create New keyword. But, I want to set text, href and data-related object informations.
HndKeywords.CreateKeyword;
Output:_keywords.json
[{ "id": "B3BF561185624A4685FB01E93FE5ED87", "parent" : "#", "text": "New keyword", "a_attr": {"href": "#", "data-related": "[]"} }]
I found that, there is no way to add caption and data-related information when we are creating the keyword.
In order to edit the keyword caption, I have to use the function
SetKeywordCaption, which needs keyword id. For that, I get the keyword list using functionGetKeywordList();and it returns an array. I get the last element numeric id from that array which is a newly inserted keyword. Then, access theaKeywordListarray using last element array id and add.Idwhich will retrieve id of that keyword. Then, Using keyword id with functionSetKeywordCaption, able to edit keyword caption.In order to add data-related information, I have use function
AssociateTopicWithKeywordwhich needs thetopic idandkeyword id. I get topic list using functionGetTopicList. I get topic id of five(topic_array[(5-1)].ID) and sixth topic(topic_array[(6-1)].ID). Then, have used functionAssociateTopicWithKeywordto link keyword to topics.Call helpndoc function:
ex (
HndKeywords.CreateKeyword;)See:
HndKeywords- Properties and methods for keywords