代码之家  ›  专栏  ›  技术社区  ›  Andrew Truckle

使用helpndoc api对主题上下文id值重新编号

  •  0
  • Andrew Truckle  · 技术社区  · 7 年前

    我找到这个了 tutorial 要将上下文帮助ID值导出到数据文件,请执行以下操作:

    const
      // Define the output file
      OUTPUT_FILE = 'c:\tmp\topics.txt';
    
    var
      // Current topic ID
      aTopicId: string;
      // List of output
      aList: TStringList;
    
    begin
      // Init list
      aList := TStringList.Create;
      aList.Add('Topic Caption | Help ID | Help Context');
      aList.Add('--------------------------------------');
      try
        // Get first topic
        aTopicId := HndTopics.GetTopicFirst();
        // Loop through all topics
        while aTopicId <> '' do
        begin
          // Add the topic to the list
          aList.Add(Format('%s | %s | %d', [
            HndTopics.GetTopicCaption(aTopicId),
            HndTopics.GetTopicHelpId(aTopicId),
            HndTopics.GetTopicHelpContext(aTopicId)
          ]));
          // Get next topic
          aTopicId := HndTopics.GetTopicNext(aTopicId);
        end;
        // Create the file
        aList.SaveToFile(OUTPUT_FILE);
      finally
        aList.Free;
      end;
    end.
    

    我对修订后的帮助文档进行了一些重新构造,因此上下文编号不是连续的:

    Contents

    使用HelpDoc我希望编写一个新的API脚本来重新命名它们,但是我看不出合适的。 API method

    这不可能吗?

    1 回复  |  直到 7 年前
        1
  •  1
  •   jonjbar    7 年前

    使用HelpDNoc API,您可以使用 HndTopics.SetTopicHelpContext 方法调用。使用简单的逻辑,可以重置所有帮助上下文编号。以下文章对此进行了描述: Using HelpNDoc scripting capabilities to automatically reset all help context numbers

    本文中显示的脚本甚至包含在最近的helpndoc安装文件夹中:

    随着帮助文档项目的发展,上下文数据可能变得混乱。此脚本将重置每个主题的上下文编号,以便从第一个主题递增设置到最后一个主题。

    以下是如何运行该脚本:

    • 保存项目的备份以备需要返回时使用
    • 加载项目
    • 从helpndoc的“工具”功能区选项卡中,单击“脚本编辑器”
    • 单击“加载脚本”旁边的箭头以显示内置脚本列表
    • 单击“resethelpcontextnumbers.hnd.pas”
    • 点击“运行脚本”
    推荐文章