Difference between revisions of "FPDoc Editor"

From Lazarus wiki
Jump to navigationJump to search
m (→‎Using the FPDoc Editor: format list as list)
 
(63 intermediate revisions by 16 users not shown)
Line 1: Line 1:
 +
{{FPDoc Editor}}
 +
 
== Introduction ==
 
== Introduction ==
LazDoc is an integrated editor/viewer for Lazarus. It currently works only for the LCL, but expanding it to any project is top priority on the todo list.
+
FPDoc is the Free Pascal documentation tool which is specifically designed to create help files for individual units of Pascal source code. For more information about FPDoc see here: [http://www.freepascal.org/docs-html/fpdoc/fpdoc.html Free Pascal documentation tool manual].
This page/ using LazDoc expects you are familiar with FPDoc. For more information see: [http://lazarus-ccr.sourceforge.net/fpcdoc/fpdoc/fpdoc.html Free Pascal documentation tool manual]
+
 
 +
[[image:FPDocEditorDescription.png]]
 +
 
 +
Lazarus provides inline FPDoc help viewer in hints and two help file editors either of which you can use to create or update source code documentation in FPDoc format.
 +
If you want to see it correctly formatted, you have to install Package TurboPowerIProDsgn.lpk!
 +
The simpler editor, integrated into the Lazarus IDE is called '''FPDoc Editor''', and is described on this page. There is also a more complete and complex editor called [[Lazarus_Documentation_Editor|LazDE]].
  
== Where to find LazDoc?? ==
+
'''LazDE''' is a bigger brother to '''FPDoc Editor''' and is the Lazarus Documentation Editor.
Because LazDoc is still in development, and it's not clear whether it will become part of Lazarus itself or it will be available as a separate package / library, LazDoc is only available when Lazarus is compiled with -dEnableLazDoc set.
+
It is a standalone application (not an integral part of the IDE). It is located at ($LazDir)/doceditor/lazde.lpi. Once you have compiled the lazde project (using Lazarus) LazDE then runs outside the IDE.
 +
You can add it into menu Tools as external tool.
  
  make OPT="-dEnableLazDoc" clean all
+
== Using the FPDoc Editor ==
 +
To use the FPDoc Editor you simply:
  
If you are used to compiling Lazarus from Lazarus, don't forget to set the option in the "Build Lazarus" dialog.
+
# Open the FPDoc Editor. You will find it under the View menu.
 +
# In the Lazarus source code editor move the cursor to some code element. You will notice that the FPDoc Editor's Caption changes to show the selected source element together with the filename of the documentation file. Within FPDoc Editor you can select an appropriate page where you can edit a specific documentation tag. Of course it is also possible to use FPDoc Editor only to view documentation files, without changing them.
 +
# Click on the Create Help button. If you have not yet set up search paths for FPDoc the IDE will ask you where the FPDoc files it generates should be stored. For each of your projects you would normally provide a 'docs' subdirectory.
 +
# Write a short description.
 +
# Click on the Save button to the left or go to the next item (the editor automatically saves a description when you move away from it).
  
== Usage ==
+
== Editing FPDoc entries for the LCL sources and Lazarus sources ==
Using LazDoc is very simple.
 
  
1. Open the LazDoc editor. You can find it under the menu Tools.
+
There are in folder ($LazDir)\docs\xml, You can add this folder to FPDoc paths at Tools / Options / Environment / FPDoc Editor
  
2. Open a file from LCL. Open or select a file for which documentation exists. Currently it's still only LCL.
+
==Editing FPDoc entries for the FPC sources, RTL and FCL==
  
3. Place and move the cursor. After placing the cursor on the source editor, you will notice that the caption of the LazDoc form changes. The caption shows the source element selected and the filename of the documentation file. By selecting the apropriate page in LazDoc you can edit a specific documentation tag. It's ofcource also possible to use LazDoc only as a viewer.
+
The FPDoc entries for the FPC sources can be downloaded from svn:
 +
<syntaxhighlight lang="bash">
 +
cd /home/username/yourchoice/
 +
svn co http://svn.freepascal.org/svn/fpcdocs/trunk fpcdocs
 +
</syntaxhighlight>
  
 +
Add the path ''/home/username/yourchoice/fpcdocs'' to Tools / Options / Environment / FPDoc Editor
 +
 +
A good item to test FPDoc on is ''TComponent.Name''.
  
 
== Future plans ==
 
== Future plans ==
The todo list contains currently the following items, in no perticular order:
+
The todo list currently contains the following items, in no particular order:
  
* Add a HTML viewer
+
*Write a help editor for topics.
 +
*Create nicer HTML output for the hint windows.
 +
*Support Operators
 +
*Jump to next/previous undocumented identifier
 +
 
 +
=== Already done ===
 +
* Extend the link editor to show packages and identifiers
 +
* Add documentation tags "example" to FPDoc Editor
 +
* Add documentation tags "topic" to FPDoc Editor
 +
* Make FPDoc Editor create new elements in documentation
 +
* Make FPDoc Editor create new documentation files
 +
* Adding a small toolbar makes it possible to use the available markup tags
 +
* Make FPDoc Editor work on keydown in source code editor
 +
* Add FPDoc Editor to IDE settings (showing and position in IDE)
 +
* Make it work for fpc sources (rtl files already exist)
 +
* Add settings to environment menu
 
* Make it work on project files also
 
* Make it work on project files also
* Make LazDoc to create new elements in documentation
+
* Propose to expand documentation tags with: "todo" and "notes" (no need for that, as there are alternatives)
* Propose to expand documentation tags with: "todo" and "notes"
 
* Add settings to environment menu
 
* Add all documentation tags to LazDoc
 
* Add more source elements to be interpreted by LazDoc (now procedure/function/constructor/destructor)
 
 
* Reduce overhead even further
 
* Reduce overhead even further
* Use IPC for communication
+
* All source elements are interpreted by FPDoc Editor using codetools
 +
* Find inherited entries. For example TControl.Align of TButton.Align
 +
* Optimization: inherited Entries are parsed on idle
 +
* Optimization: xml files are cached, and only parsed once or if they changed on disk
 +
* Add a HTML viewer. This is available by installing the turbopoweriprodsgn package
 +
* Checks for invalid xml tags and auto repairs them

Latest revision as of 00:06, 31 January 2023

Deutsch (de) English (en) français (fr) 日本語 (ja) polski (pl) português (pt) русский (ru)

Introduction

FPDoc is the Free Pascal documentation tool which is specifically designed to create help files for individual units of Pascal source code. For more information about FPDoc see here: Free Pascal documentation tool manual.

FPDocEditorDescription.png

Lazarus provides inline FPDoc help viewer in hints and two help file editors either of which you can use to create or update source code documentation in FPDoc format. If you want to see it correctly formatted, you have to install Package TurboPowerIProDsgn.lpk! The simpler editor, integrated into the Lazarus IDE is called FPDoc Editor, and is described on this page. There is also a more complete and complex editor called LazDE.

LazDE is a bigger brother to FPDoc Editor and is the Lazarus Documentation Editor. It is a standalone application (not an integral part of the IDE). It is located at ($LazDir)/doceditor/lazde.lpi. Once you have compiled the lazde project (using Lazarus) LazDE then runs outside the IDE. You can add it into menu Tools as external tool.

Using the FPDoc Editor

To use the FPDoc Editor you simply:

  1. Open the FPDoc Editor. You will find it under the View menu.
  2. In the Lazarus source code editor move the cursor to some code element. You will notice that the FPDoc Editor's Caption changes to show the selected source element together with the filename of the documentation file. Within FPDoc Editor you can select an appropriate page where you can edit a specific documentation tag. Of course it is also possible to use FPDoc Editor only to view documentation files, without changing them.
  3. Click on the Create Help button. If you have not yet set up search paths for FPDoc the IDE will ask you where the FPDoc files it generates should be stored. For each of your projects you would normally provide a 'docs' subdirectory.
  4. Write a short description.
  5. Click on the Save button to the left or go to the next item (the editor automatically saves a description when you move away from it).

Editing FPDoc entries for the LCL sources and Lazarus sources

There are in folder ($LazDir)\docs\xml, You can add this folder to FPDoc paths at Tools / Options / Environment / FPDoc Editor

Editing FPDoc entries for the FPC sources, RTL and FCL

The FPDoc entries for the FPC sources can be downloaded from svn:

cd /home/username/yourchoice/
svn co http://svn.freepascal.org/svn/fpcdocs/trunk fpcdocs

Add the path /home/username/yourchoice/fpcdocs to Tools / Options / Environment / FPDoc Editor

A good item to test FPDoc on is TComponent.Name.

Future plans

The todo list currently contains the following items, in no particular order:

  • Write a help editor for topics.
  • Create nicer HTML output for the hint windows.
  • Support Operators
  • Jump to next/previous undocumented identifier

Already done

  • Extend the link editor to show packages and identifiers
  • Add documentation tags "example" to FPDoc Editor
  • Add documentation tags "topic" to FPDoc Editor
  • Make FPDoc Editor create new elements in documentation
  • Make FPDoc Editor create new documentation files
  • Adding a small toolbar makes it possible to use the available markup tags
  • Make FPDoc Editor work on keydown in source code editor
  • Add FPDoc Editor to IDE settings (showing and position in IDE)
  • Make it work for fpc sources (rtl files already exist)
  • Add settings to environment menu
  • Make it work on project files also
  • Propose to expand documentation tags with: "todo" and "notes" (no need for that, as there are alternatives)
  • Reduce overhead even further
  • All source elements are interpreted by FPDoc Editor using codetools
  • Find inherited entries. For example TControl.Align of TButton.Align
  • Optimization: inherited Entries are parsed on idle
  • Optimization: xml files are cached, and only parsed once or if they changed on disk
  • Add a HTML viewer. This is available by installing the turbopoweriprodsgn package
  • Checks for invalid xml tags and auto repairs them