2016-10-26 12:50 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)

- extras/hbdoc/_tmplate.prg
  - extras/hbdoc/hbdoc.ch
  * extras/hbdoc/_genbase.prg
  * extras/hbdoc/_genhtml.prg
  * extras/hbdoc/_gentxt.prg
  * extras/hbdoc/_genxml.prg
  * extras/hbdoc/hbdoc.hbp
  * extras/hbdoc/hbdoc.prg
    + improve readability by paragraphs spacing in DESCRIPTION sections
    + improve divs in section content for better control via CSS
    + improve readability of tables with borders and
      header hightlights
    * change default output to single-file
    + add support for the old <table>/<fixed> tags in html output until they
      are converted to something better
    + add support for <b>/<b>, <URL:url>, Markdown `inline code`,
      _emphasis_, *bold*, character escaping \*, line separators ===/---,
      and fenced code using triple backticks.
      Very limited and not with standard compliance or completeness
      in mind, just to be able to use some basic formatting.
    ; TODO: Markdown URL and lists, then replace all <b>,<URL>,<fixed>
            markup with Markdown equivalents in docs
    + better localization support
    + add support for one file per component output via -output-component
      cmdline option
    % assemble output in memory and write to disk in a single call
    % integrate external header
    % replace almost all internal arrays with hashes
    % replace self-modifying class and macro expansion with
      regular hashes
    % internal cleanups
    % switch to simpler method for sort weighting
    + merge category/subcategory values into tag list. It
      means they will be now be included in the output
    % cleanup/fix/simplify value expansions for 'compliance',
      'status' and 'platform' fields
    % cleanup the way output engines are handles internally
    + add support for 'TAGS' entry to replace/extend the rigid and
      ambiguous CATEGORY/SUBCATEGORY-based categorization. It is meant
      to be a comma-separated list of freeform tags, possibly with a set
      of standard common tags, with the freedom to use anything else deemed
      useful by component/doc authors.
    + add footer showing the build date of the doc
    + include Git revision the doc is based on, link to the relevant
      source tree version.
    * various code refactoring steps to avoid unnecessary
      classes, arrays, macro evaluation, and using undocumented
      functions
    % various HTML5 tag improvements and optimizations
    + load HBX file contents and lookup each referenced
      symbol. Emit warning in verbose mode, if docs refers
      to non-existing one.
      (this replaces slow and broken logic based on hbextern.ch)
    + use core hbdoc API to load the documentation instead
      of locally rolled logic
    * always show those content problems that are considered
      fatal and the input doc to be skipped
    + filter docs to English language by default
    + add ability to choose language using a command-line option
    ! fix faulty validation logic that resulted in
      erronously skipping certain entries
    + identify docs' 'component' property automatically
    ! fix to not eat empty lines from examples
    + convert "see also" items to links (this works correctly only
      in single file output mode)
    ! fix to not break words (f.e. URLs) when outputting HTML
    % use shorter class names
    ! fix invalid element ID generated
    ! fix RTE when trying to create output by category
    % delete dummy "HTML2" output mode
    * convert more ASCII chars to better Unicode equivalents
    + mark more text as code automatically
    * drop MS-DOS compatibility

  * src/rtl/hbdoc.prg
    ! fix filling '_LANG' property with the correct value
    * switch to use LF instead of CRLF in the field contents

  * contrib/hbct/doc/en/*.txt
  * contrib/hbgd/doc/en/hbgd.txt
  * contrib/hbgt/doc/en/hbgt.txt
  * contrib/hbmisc/doc/en/dates2.txt
  * contrib/hbnf/doc/en/*.txt
  * contrib/rddads/doc/en/adsfuncs.txt
  * doc/en/*.txt
    * cleanups and fixes
    ! casing
    ! fix to always delimit "see also" items with comma (",")
    ! fix various casing issues and old typos
    ! various fixes after detecting them using updated hbdoc
    ! eliminate/fix various rare/unnecessary/invalid field values
    ! move some embedded docs from hbdoc into their respective
      doc sources
    ! fix a typo
    * use backtick
    * replace code copyright with reference to COPYING.txt (=LICENSE.txt)
    + mark tables without a header or with double height header

  ; Above patches come from 3.4 fork commits below:

    2016-10-26 12:43 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-26 12:34 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-26 12:20 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-26 03:21 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-26 02:47 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 15:05 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 14:51 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 14:30 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 13:19 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 12:35 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 11:47 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 02:48 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 22:26 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 18:35 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 17:58 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 16:12 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 15:44 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 03:36 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 02:40 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 00:23 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-23 23:09 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-23 16:39 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-23 16:10 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-23 13:15 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
This commit is contained in:
Viktor Szakats
2016-10-26 13:07:21 +02:00
parent da5de0c27b
commit c1bde05495
86 changed files with 1791 additions and 1613 deletions

View File

@@ -47,62 +47,78 @@
#include "hbclass.ch"
#include "fileio.ch"
#define DOCUMENT_ 1
#define INDEX_ 2
CREATE CLASS TPLGenerate
METHOD NewIndex( cDir, cFilename, cTitle, cExtension )
METHOD NewDocument( cDir, cFilename, cTitle, cExtension )
METHOD NewIndex( cDir, cFilename, cTitle, cExtension, cLang )
METHOD NewDocument( cDir, cFilename, cTitle, cExtension, cLang )
METHOD AddEntry( oEntry ) INLINE HB_SYMBOL_UNUSED( oEntry ), NIL
METHOD AddReference( oEntry ) INLINE HB_SYMBOL_UNUSED( oEntry ), NIL
METHOD BeginSection( cSection, cFilename ) INLINE HB_SYMBOL_UNUSED( cSection ), HB_SYMBOL_UNUSED( cFilename ), ::Depth++
METHOD EndSection( cSection, cFilename ) INLINE HB_SYMBOL_UNUSED( cSection ), HB_SYMBOL_UNUSED( cFilename ), ::Depth--
METHOD Generate() INLINE NIL
METHOD Generate()
METHOD IsIndex() INLINE ::nType == INDEX_
PROTECTED:
VAR cFilename AS STRING
METHOD New( cDir, cFilename, cTitle, cExtension, nType ) HIDDEN
HIDDEN:
METHOD New( cDir, cFilename, cTitle, cExtension, cLang, nType )
PROTECTED:
VAR nType AS INTEGER
VAR Depth AS INTEGER INIT 0
VAR hFile
VAR cFile AS STRING INIT ""
VAR cDir AS STRING
VAR cFilename AS STRING
VAR cTitle AS STRING
VAR cExtension AS STRING
VAR cLang AS STRING
VAR cOutFileName AS STRING
ENDCLASS
METHOD NewIndex( cDir, cFilename, cTitle, cExtension ) CLASS TPLGenerate
METHOD NewIndex( cDir, cFilename, cTitle, cExtension, cLang ) CLASS TPLGenerate
::New( cDir, cFilename, cTitle, cExtension, INDEX_ )
::New( cDir, cFilename, cTitle, cExtension, cLang, INDEX_ )
RETURN self
METHOD NewDocument( cDir, cFilename, cTitle, cExtension ) CLASS TPLGenerate
METHOD NewDocument( cDir, cFilename, cTitle, cExtension, cLang ) CLASS TPLGenerate
::New( cDir, cFilename, cTitle, cExtension, DOCUMENT_ )
::New( cDir, cFilename, cTitle, cExtension, cLang, DOCUMENT_ )
RETURN self
METHOD New( cDir, cFilename, cTitle, cExtension, nType ) CLASS TPLGenerate
METHOD New( cDir, cFilename, cTitle, cExtension, cLang, nType ) CLASS TPLGenerate
::cDir := cDir
::cFilename := cFilename
::cTitle := cTitle
::cExtension := cExtension
::cLang := hb_defaultValue( cLang, "en" )
::nType := nType
IF ! hb_vfDirExists( ::cDir )
OutStd( hb_eol() + "Creating directory", "'" + ::cDir + "'" )
hb_vfDirMake( ::cDir )
ENDIF
::hFile := hb_vfOpen( ::cDir + hb_ps() + ::cFilename + ::cExtension, FO_CREAT + FO_TRUNC + FO_WRITE )
::cOutFileName := ;
::cDir + hb_ps() + ;
::cFilename + ;
iif( Lower( ::cLang ) == "en", "", "." + ::cLang ) + ;
::cExtension
RETURN self
METHOD Generate() CLASS TPLGenerate
LOCAL cDir := hb_FNameDir( ::cOutFileName )
IF ! hb_vfDirExists( cDir )
OutStd( hb_eol() + "Creating directory", "'" + cDir + "'" )
hb_vfDirMake( cDir )
ENDIF
hb_MemoWrit( ::cOutFileName, ::cFile )
RETURN self

View File

@@ -46,117 +46,162 @@
*/
#include "hbclass.ch"
#include "hbver.ch"
#ifdef __PLATFORM__DOS
#define EXTENSION ".htm"
#else
#define EXTENSION ".html"
#endif
#define EXTENSION ".html"
#define STYLEFILE "hbdoc.css"
CREATE CLASS GenerateHTML2 INHERIT GenerateHTML
METHOD NewIndex( cDir, cFilename, cTitle )
METHOD NewDocument( cDir, cFilename, cTitle )
ENDCLASS
METHOD NewDocument( cDir, cFilename, cTitle ) CLASS GenerateHTML2
::super:NewDocument( cDir, cFilename, cTitle, EXTENSION )
RETURN self
METHOD NewIndex( cDir, cFilename, cTitle ) CLASS GenerateHTML2
::super:NewIndex( cDir, cFilename, cTitle, EXTENSION )
RETURN self
#define STYLEFILE "hbdoc.css"
CREATE CLASS GenerateHTML INHERIT TPLGenerate
HIDDEN:
METHOD RecreateStyleDocument( cStyleFile )
METHOD OpenTagInline( cText, ... )
METHOD OpenTag( cText, ... )
METHOD Tagged( cText, cTag, ... )
METHOD CloseTagInline( cText )
METHOD CloseTag( cText )
METHOD Append( cText, cFormat )
METHOD Newline() INLINE hb_vfWrite( ::hFile, "<br>" + hb_eol() ), self
METHOD AppendInline( cText, cFormat, lCode )
METHOD Append( cText, cFormat, lCode )
METHOD Space() INLINE ::cFile += ", ", self
METHOD Spacer() INLINE ::cFile += hb_eol(), self
METHOD Newline() INLINE ::cFile += "<br>" + hb_eol(), self
METHOD NewFile()
CLASS VAR lCreateStyleDocument AS LOGICAL INIT .T.
VAR TargetFilename AS STRING INIT ""
EXPORTED:
METHOD NewFile() HIDDEN
METHOD NewIndex( cDir, cFilename, cTitle )
METHOD NewDocument( cDir, cFilename, cTitle )
METHOD NewIndex( cDir, cFilename, cTitle, cLang )
METHOD NewDocument( cDir, cFilename, cTitle, cLang )
METHOD AddEntry( oEntry )
METHOD AddReference( oEntry, cReference, cSubReference )
METHOD BeginSection( cSection, cFilename )
METHOD EndSection( cSection, cFilename )
METHOD Generate()
METHOD WriteEntry( cField, oEntry, lPreformatted ) HIDDEN
METHOD WriteEntry( cField, cContent, lPreformatted ) HIDDEN
VAR nStart INIT hb_MilliSeconds()
VAR nIndent INIT 0
ENDCLASS
METHOD NewFile() CLASS GenerateHTML
hb_vfWrite( ::hFile, "<!DOCTYPE html>" + hb_eol() )
::cFile += "<!DOCTYPE html>" + hb_eol()
::OpenTag( "html", "lang", "en" )
::OpenTag( "html", "lang", StrTran( ::cLang, "_", "-" ) )
::Spacer()
::OpenTag( "meta", "charset", "utf-8" )
::OpenTag( "meta", "name", "referrer", "content", "origin" )
::OpenTag( "meta", "name", "viewport", "content", "initial-scale=1" )
::Spacer()
::OpenTag( "meta", "name", "generator", "content", "hbdoc" )
::OpenTag( "meta", "name", "keywords", "content", "Harbour, Clipper, xBase, database, Free Software, GPL, compiler, cross platform, 32-bit, 64-bit" )
::OpenTag( "meta", "name", "keywords", "content", ;
"Harbour, Clipper, xBase, database, Free Software, GPL, compiler, cross-platform, 32-bit, 64-bit" )
::Spacer()
IF ::lCreateStyleDocument
::lCreateStyleDocument := .F.
::RecreateStyleDocument( STYLEFILE )
ENDIF
::Append( ::cTitle /* + iif( Empty( ::cDescription ), "", " - " + ::cDescription ) */, "title" )
::Append( ::cTitle, "title" )
::Spacer()
::OpenTag( "link", "rel", "stylesheet", "href", STYLEFILE )
::Spacer()
::OpenTag( "body" )
::Spacer()
::OpenTag( "header" )
::Append( ::cTitle, "h1" )
::CloseTag( "header" )
::Spacer()
::OpenTag( "main" )
RETURN self
METHOD NewDocument( cDir, cFilename, cTitle ) CLASS GenerateHTML
STATIC FUNCTION GitRev()
::super:NewDocument( cDir, cFilename, cTitle, EXTENSION )
LOCAL cStdOut := ""
hb_processRun( "git rev-parse --short HEAD",, @cStdOut )
RETURN hb_StrReplace( cStdOut, Chr( 13 ) + Chr( 10 ) )
METHOD Generate() CLASS GenerateHTML
LOCAL cRevision := GitRev()
::Spacer()
::CloseTag( "main" )
::Spacer()
::OpenTag( "footer" )
::Append( "Generated by hbdoc on " + hb_TToC( hb_DateTime() - ( hb_UTCOffset() / 86400 ), "yyyy-mm-dd", "hh:mm" ) + " UTC", "div" )
::OpenTagInline( "div" )
::AppendInline( "Based on commit " )
#if defined( HB_VERSION_URL_BASE )
::OpenTagInline( "a", "href", hb_Version( HB_VERSION_URL_BASE ) + "tree/" + cRevision )
#endif
::AppendInline( cRevision )
#if defined( HB_VERSION_URL_BASE )
::CloseTagInline( "a" )
#endif
::CloseTag( "div" )
::CloseTag( "footer" )
::super:Generate()
#if 0
? Round( ( hb_MilliSeconds() - ::nStart ) / 1000, 3 )
#endif
RETURN self
METHOD NewDocument( cDir, cFilename, cTitle, cLang ) CLASS GenerateHTML
::super:NewDocument( cDir, cFilename, cTitle, EXTENSION, cLang )
::NewFile()
RETURN self
METHOD NewIndex( cDir, cFilename, cTitle ) CLASS GenerateHTML
METHOD NewIndex( cDir, cFilename, cTitle, cLang ) CLASS GenerateHTML
::super:NewIndex( cDir, cFilename, cTitle, EXTENSION )
::super:NewIndex( cDir, cFilename, cTitle, EXTENSION, cLang )
::NewFile()
RETURN self
METHOD BeginSection( cSection, cFilename ) CLASS GenerateHTML
METHOD BeginSection( cSection, cFilename ) CLASS GenerateHTML
cSection := SymbolToHTMLID( cSection )
IF ::IsIndex()
IF cFilename == ::cFilename
::OpenTag( "div", "id", cSection ):Append( cSection, "h" + hb_ntos( ::Depth + 2 ) ):CloseTag( "div" )
::OpenTagInline( "div", "id", cSection ):AppendInline( cSection, "h" + hb_ntos( ::Depth + 2 ) ):CloseTag( "div" )
ELSE
::OpenTag( "a", "href", cFilename + ::cExtension + "#" + cSection ):Append( cSection, "h" + hb_ntos( ::Depth + 2 ) ):CloseTag( "a" )
ENDIF
ELSE
::OpenTag( "div", "id", cSection ):Append( cSection, "h" + hb_ntos( ::Depth + 2 ) ):CloseTag( "div" )
::OpenTagInline( "div", "id", cSection ):AppendInline( cSection, "h" + hb_ntos( ::Depth + 2 ) ):CloseTag( "div" )
ENDIF
::TargetFilename := cFilename
::Depth++
RETURN self
METHOD EndSection( cSection, cFilename ) CLASS GenerateHTML
METHOD EndSection( cSection, cFilename ) CLASS GenerateHTML
HB_SYMBOL_UNUSED( cSection )
HB_SYMBOL_UNUSED( cFilename )
@@ -167,12 +212,12 @@ METHOD EndSection( cSection, cFilename ) CLASS GenerateHTML
METHOD AddReference( oEntry, cReference, cSubReference ) CLASS GenerateHTML
IF HB_ISOBJECT( oEntry ) .AND. oEntry:ClassName() == "ENTRY"
::OpenTag( "a", "href", ::TargetFilename + ::cExtension + "#" + oEntry:Filename ):Append( oEntry:Name ):CloseTag( "a" ):Append( oEntry:OneLiner ):Newline()
::OpenTag( "a", "href", ::TargetFilename + ::cExtension + "#" + oEntry:_filename ):Append( oEntry:fld[ "NAME" ] ):CloseTag( "a" ):Append( oEntry:fld[ "ONELINER" ] ):Newline()
ELSE
IF HB_ISSTRING( cSubReference )
::OpenTag( "a", "href", cReference + ::cExtension + "#" + cSubReference ):Append( oEntry ):CloseTag( "a" ):Newline()
ELSE
::OpenTag( "a", "href", cReference + ::cExtension /* + "#" + oEntry:Filename */ ):Append( oEntry ):CloseTag( "a" ):Newline()
::OpenTag( "a", "href", cReference + ::cExtension /* + "#" + oEntry:_filename */ ):Append( oEntry ):CloseTag( "a" ):Newline()
ENDIF
ENDIF
@@ -181,67 +226,172 @@ METHOD AddReference( oEntry, cReference, cSubReference ) CLASS GenerateHTML
METHOD AddEntry( oEntry ) CLASS GenerateHTML
LOCAL item
LOCAL cEntry
FOR EACH item IN oEntry:Fields
IF item[ 1 ] == "NAME"
::OpenTag( "div", "id", SymbolToHTMLID( oEntry:filename ) ):OpenTag( "h4" ):Append( oEntry:Name ):CloseTag( "h4" ):CloseTag( "div" )
ELSEIF oEntry:IsField( item[ 1 ] ) .AND. oEntry:IsOutput( item[ 1 ] ) .AND. Len( oEntry:&( item[ 1 ] ) ) > 0
::WriteEntry( item[ 1 ], oEntry, oEntry:IsPreformatted( item[ 1 ] ) )
::Spacer()
::OpenTag( "section", "id", SymbolToHTMLID( oEntry:_filename ) )
FOR EACH item IN FieldIDList()
IF item == "NAME"
cEntry := oEntry:fld[ "NAME" ]
IF "(" $ cEntry .OR. Upper( cEntry ) == cEntry // guess if it's code
::OpenTagInline( "h4" ):OpenTagInline( "code" ):AppendInline( cEntry ):CloseTagInline( "code" ):CloseTag( "h4" )
ELSE
::OpenTagInline( "h4" ):AppendInline( cEntry ):CloseTag( "h4" )
ENDIF
ELSEIF oEntry:IsField( item ) .AND. oEntry:IsOutput( item ) .AND. Len( oEntry:fld[ item ] ) > 0
::WriteEntry( item, oEntry:fld[ item ], oEntry:IsPreformatted( item ) )
ENDIF
NEXT
::CloseTag( "section" )
RETURN self
METHOD Generate() CLASS GenerateHTML
RETURN self
METHOD PROCEDURE WriteEntry( cField, cContent, lPreformatted ) CLASS GenerateHTML
METHOD PROCEDURE WriteEntry( cField, oEntry, lPreformatted ) CLASS GenerateHTML
STATIC s_class := { ;
"NAME" => "d-na", ;
"ONELINER" => "d-ol", ;
"EXAMPLES" => "d-ex", ;
"TESTS" => "d-te" }
LOCAL cCaption := oEntry:FieldName( cField )
LOCAL cEntry := oEntry:&( cField )
LOCAL cTagClass
LOCAL cCaption
LOCAL lFirst
LOCAL tmp, tmp1
LOCAL cLine
LOCAL lCode, lTable, lTablePrev, cHeaderClass
/* TODO: change this to search the CSS document itself */
LOCAL cTagClass := iif( Lower( cField ) + "|" $ "name|oneliner|examples|tests|", Lower( cField ), "itemtext" )
IF ! Empty( cContent )
IF ! Empty( cEntry )
cTagClass := hb_HGetDef( s_class, cField, "d-it" )
#if 0
hb_default( @lPreformatted, .F. )
hb_default( @cTagClass, "itemtext" )
#endif
hb_default( @cCaption, "" )
IF ! HB_ISNULL( cCaption )
::Tagged( cCaption, "div", "class", "itemtitle" )
IF ! HB_ISNULL( cCaption := FieldCaption( cField ) )
::Tagged( cCaption, "div", "class", "d-d" )
ENDIF
IF lPreformatted
DO CASE
CASE lPreformatted /* EXAMPLES, TESTS */
::OpenTag( "pre", "class", cTagClass )
DO WHILE ! HB_ISNULL( cEntry )
IF Lower( cField ) + "|" $ "examples|tests|"
::Append( SubStr( Parse( @cEntry, hb_eol() ), 5 ), "" )
ELSE
::Append( Indent( Parse( @cEntry, hb_eol() ), 0, , .T. ), "" )
ENDIF
#if 0
IF ! HB_ISNULL( cEntry ) .AND. ! lPreformatted
hb_vfWrite( ::hFile, hb_eol() )
ENDIF
#endif
ENDDO
::Append( cContent,, .T. )
::CloseTag( "pre" )
ELSE
DO WHILE ! HB_ISNULL( cEntry )
::OpenTag( "div", "class", cTagClass )
::Append( Indent( Parse( @cEntry, hb_eol() ), 0, 70 ), "" ):Newline()
::CloseTag( "div" )
CASE cField == "SEEALSO"
::OpenTagInline( "div", "class", cTagClass )
lFirst := .T.
FOR EACH tmp IN hb_ATokens( cContent, "," )
tmp := AllTrim( tmp )
IF ! HB_ISNULL( tmp )
// TOFIX: for multi-file output
tmp1 := Parse( tmp, "(" )
IF lFirst
lFirst := .F.
ELSE
::Space()
ENDIF
::OpenTagInline( "code" ):OpenTagInline( "a", "href", "#" + SymbolToHTMLID( tmp1 ) ):AppendInline( tmp ):CloseTagInline( "a" ):CloseTagInline( "code" )
ENDIF
NEXT
::CloseTag( "div" )
CASE cField == "SYNTAX"
::OpenTagInline( "div", "class", cTagClass )
DO WHILE ! HB_ISNULL( cContent )
::OpenTagInline( "code" )
::AppendInline( Indent( Parse( @cContent, hb_eol() ), 0, -1,, .T. ),, .F. )
::CloseTagInline( "code" )
ENDDO
ENDIF
::CloseTag( "div" )
OTHERWISE
::OpenTag( "div", "class", cTagClass )
::nIndent++
lTable := .F.
DO WHILE ! HB_ISNULL( cContent )
lCode := .F.
lTablePrev := lTable
tmp1 := ""
DO WHILE ! HB_ISNULL( cContent )
cLine := Parse( @cContent, hb_eol() )
DO CASE
CASE hb_LeftEq( LTrim( cLine ), "```" )
IF lCode
EXIT
ELSE
lCode := .T.
ENDIF
CASE cLine == "<fixed>"
lCode := .T.
CASE cLine == "</fixed>"
IF lCode
EXIT
ENDIF
CASE hb_LeftEq( cLine, "<table" )
lTable := .T.
DO CASE
CASE cLine == "<table-noheader>" ; cHeaderClass := ""
CASE cLine == "<table-doubleheader>" ; cHeaderClass := "d-t1 d-t2"
OTHERWISE ; cHeaderClass := "d-t1"
ENDCASE
CASE cLine == "</table>"
lTable := .F.
OTHERWISE
tmp1 += cLine + hb_eol()
IF ! lCode
EXIT
ENDIF
ENDCASE
ENDDO
IF lTable != lTablePrev
IF lTable
::OpenTag( "div", "class", "d-t" + iif( HB_ISNULL( cHeaderClass ), "", " " + cHeaderClass ) )
ELSE
::CloseTag( "div" )
ENDIF
ENDIF
DO CASE
CASE lCode
::OpenTag( "pre" )
::Append( tmp1,, .T. )
CASE lTable
::OpenTagInline( "div" )
::AppendInline( iif( lTable, StrTran( tmp1, " ", hb_UChar( 160 ) ), tmp1 ),, .T. )
OTHERWISE
::OpenTagInline( "div" )
IF cField $ "DESCRIPTION|"
::OpenTagInline( "p" )
ENDIF
::AppendInline( iif( lTable, StrTran( tmp1, " ", hb_UChar( 160 ) ), tmp1 ),, .F. )
ENDCASE
IF lCode
::CloseTag( "pre" )
ELSE
::CloseTag( "div" )
ENDIF
ENDDO
::nIndent--
::CloseTag( "div" )
ENDCASE
ENDIF
RETURN
METHOD OpenTag( cText, ... ) CLASS GenerateHTML
METHOD OpenTagInline( cText, ... ) CLASS GenerateHTML
LOCAL aArgs := hb_AParams()
LOCAL idx
@@ -250,7 +400,18 @@ METHOD OpenTag( cText, ... ) CLASS GenerateHTML
cText += " " + aArgs[ idx ] + "=" + '"' + aArgs[ idx + 1 ] + '"'
NEXT
hb_vfWrite( ::hFile, "<" + cText + ">" + hb_eol() )
IF ! cText $ "pre"
::cFile += Replicate( " ", ::nIndent )
ENDIF
::cFile += "<" + cText + ">"
RETURN self
METHOD OpenTag( cText, ... ) CLASS GenerateHTML
::OpenTagInline( cText, ... )
::cFile += hb_eol()
RETURN self
@@ -264,32 +425,139 @@ METHOD Tagged( cText, cTag, ... ) CLASS GenerateHTML
cResult += " " + aArgs[ idx ] + "=" + '"' + aArgs[ idx + 1 ] + '"'
NEXT
hb_vfWrite( ::hFile, "<" + cTag + cResult + ">" + cText + "</" + cTag + ">" + hb_eol() )
::cFile += "<" + cTag + cResult + ">" + cText + "</" + cTag + ">" + hb_eol()
RETURN self
METHOD CloseTagInline( cText ) CLASS GenerateHTML
::cFile += "</" + cText + ">"
RETURN self
METHOD CloseTag( cText ) CLASS GenerateHTML
hb_vfWrite( ::hFile, "</" + cText + ">" + hb_eol() )
IF cText == "html"
hb_vfClose( ::hFile )
::hFile := NIL
ENDIF
::cFile += "</" + cText + ">" + hb_eol()
RETURN self
METHOD Append( cText, cFormat ) CLASS GenerateHTML
STATIC FUNCTION StrEsc( cString )
STATIC s_html := { ;
"&" => "&amp;", ;
'"' => "&quot;", ;
"<" => "&lt;", ;
">" => "&gt;" }
RETURN hb_StrReplace( cString, s_html )
METHOD AppendInline( cText, cFormat, lCode ) CLASS GenerateHTML
LOCAL idx
LOCAL cChar, cPrev, cNext, cOut, tmp, tmp1, nLen
LOCAL lEM, lIT, lPR
LOCAL nEM, nIT, nPR
LOCAL cdp
IF ! HB_ISNULL( cText )
cText := hb_StrReplace( cText, { ;
"&" => "&amp;", ;
'"' => "&quot;", ;
"<" => "&lt;", ;
">" => "&gt;" } )
hb_default( @lCode, .F. )
IF lCode
cText := StrEsc( cText )
ELSE
cdp := hb_cdpSelect( "EN" ) /* make processing loop much faster */
lEM := lIT := lPR := .F.
cOut := ""
nLen := Len( cText )
FOR tmp := 1 TO nLen
cPrev := iif( tmp > 1, SubStr( cText, tmp - 1, 1 ), "" )
cChar := SubStr( cText, tmp, 1 )
cNext := SubStr( cText, tmp + 1, 1 )
DO CASE
CASE ! lPR .AND. cChar == "\" .AND. tmp < Len( cText )
tmp++
cChar := cNext
CASE ! lPR .AND. cChar == "*" .AND. ! lIT .AND. ;
iif( lEM, ! Empty( cPrev ) .AND. Empty( cNext ), Empty( cPrev ) .AND. ! Empty( cNext ) )
lEM := ! lEM
IF lEM
nEM := Len( cOut ) + 1
ENDIF
cChar := iif( lEM, "<strong>", "</strong>" )
CASE ! lPR .AND. cChar == "_" .AND. ! lEM .AND. ;
( ( ! lIT .AND. Empty( cPrev ) .AND. ! Empty( cNext ) ) .OR. ;
( lIT .AND. ! Empty( cPrev ) .AND. Empty( cNext ) ) )
lIT := ! lIT
IF lIT
nIT := Len( cOut ) + 1
ENDIF
cChar := iif( lIT, "<i>", "</i>" )
CASE cChar == "`" .AND. ;
( ( ! lPR .AND. Empty( cPrev ) .AND. ! Empty( cNext ) ) .OR. ;
( lPR .AND. ! Empty( cPrev ) .AND. Empty( cNext ) ) )
lPR := ! lPR
IF lPR
nPR := Len( cOut ) + 1
ENDIF
cChar := iif( lPR, "<code>", "</code>" )
CASE ! lPR .AND. SubStr( cText, tmp, 3 ) == "<b>"
tmp += 2
cChar := "<strong>"
CASE ! lPR .AND. SubStr( cText, tmp, 4 ) == "</b>"
tmp += 3
cChar := "</strong>"
CASE ! lPR .AND. ;
( SubStr( cText, tmp, 3 ) == "===" .OR. SubStr( cText, tmp, 3 ) == "---" )
DO WHILE tmp < nLen .AND. SubStr( cText, tmp, 1 ) == cChar
tmp++
ENDDO
cChar := "<hr>"
CASE ! lPR .AND. ;
( SubStr( cText, tmp, 5 ) == "<URL:" .AND. ( tmp1 := hb_At( ">", cText, tmp + 6 ) ) > 0 )
tmp1 := SubStr( cText, tmp + 5, tmp1 - tmp - 5 )
tmp += Len( tmp1 ) + 5
cChar := "<a href=" + '"' + tmp1 + '"' + ">" + tmp1 + "</a>"
CASE ! lPR .AND. ;
( SubStr( cText, tmp, 3 ) == "==>" .OR. SubStr( cText, tmp, 3 ) == "-->" )
tmp += 2
cChar := "&rarr;"
CASE ! lPR .AND. ;
( SubStr( cText, tmp, 2 ) == "->" )
tmp += 1
cChar := "&rarr;"
CASE cChar == "&"
cChar := "&amp;"
CASE cChar == '"'
cChar := "&quot;"
CASE cChar == "<"
cChar := "&lt;"
CASE cChar == ">"
cChar := "&gt;"
ENDCASE
cOut += cChar
NEXT
/* Remove these tags if they weren't closed */
IF lPR
cOut := Stuff( cOut, nPR, Len( "<code>" ), "`" )
ENDIF
IF lEM
cOut := Stuff( cOut, nEM, Len( "<strong>" ), "*" )
ENDIF
IF lIT
cOut := Stuff( cOut, nIT, Len( "<i>" ), "_" )
ENDIF
cText := cOut
hb_cdpSelect( cdp )
ENDIF
FOR EACH idx IN hb_ATokens( hb_defaultValue( cFormat, "" ), "," ) DESCEND
IF ! Empty( idx )
@@ -301,12 +569,18 @@ METHOD Append( cText, cFormat ) CLASS GenerateHTML
cText := hb_StrShrink( cText, Len( hb_eol() ) )
ENDDO
hb_vfWrite( ::hFile, cText + hb_eol() )
::cFile += cText
ENDIF
RETURN self
METHOD Append( cText, cFormat, lCode ) CLASS GenerateHTML
::AppendInline( cText, cFormat, lCode )
::cFile += hb_eol()
RETURN self
METHOD RecreateStyleDocument( cStyleFile ) CLASS GenerateHTML
LOCAL cString
@@ -320,4 +594,7 @@ METHOD RecreateStyleDocument( cStyleFile ) CLASS GenerateHTML
RETURN self
STATIC FUNCTION SymbolToHTMLID( cID )
RETURN Lower( hb_StrReplace( cID, "_ ", "--" ) )
RETURN Lower( hb_StrReplace( cID, { ;
"%" => "pct", ;
"_" => "-", ;
" " => "-" } ) )

View File

@@ -49,22 +49,22 @@
CREATE CLASS GenerateAscii INHERIT GenerateText
METHOD NewIndex( cDir, cFilename, cTitle, cDescription )
METHOD NewDocument( cDir, cFilename, cTitle, cDescription )
METHOD NewIndex( cDir, cFilename, cTitle, cLang )
METHOD NewDocument( cDir, cFilename, cTitle, cLang )
ENDCLASS
METHOD NewDocument( cDir, cFilename, cTitle, cDescription ) CLASS GenerateAscii
METHOD NewDocument( cDir, cFilename, cTitle, cLang ) CLASS GenerateAscii
::lContinuous := .T.
::super:NewDocument( cDir, cFilename, cTitle, cDescription )
::super:NewDocument( cDir, cFilename, cTitle,, cLang )
RETURN self
METHOD NewIndex( cDir, cFilename, cTitle, cDescription ) CLASS GenerateAscii
METHOD NewIndex( cDir, cFilename, cTitle, cLang ) CLASS GenerateAscii
::lContinuous := .T.
::super:NewIndex( cDir, cFilename, cTitle, cDescription )
::super:NewIndex( cDir, cFilename, cTitle,, cLang )
RETURN self
@@ -72,34 +72,36 @@ CREATE CLASS GenerateText INHERIT TPLGenerate
HIDDEN:
METHOD WriteEntry( cCaption, cContent, lPreformatted )
METHOD AddIndex( oEntry )
PROTECTED:
VAR lContinuous AS LOGICAL INIT .F.
EXPORTED:
METHOD NewIndex( cDir, cFilename, cTitle )
METHOD NewDocument( cDir, cFilename, cTitle )
METHOD NewIndex( cDir, cFilename, cTitle, cLang )
METHOD NewDocument( cDir, cFilename, cTitle, cLang )
METHOD AddEntry( oEntry )
METHOD AddIndex( oEntry ) HIDDEN
METHOD BeginSection( cSection, cFilename )
#if 0
METHOD EndSection( cSection, cFilename ) /* will use inherited method */
#endif
METHOD Generate()
METHOD WriteEntry( cCaption, cEntry, lPreformatted ) HIDDEN
ENDCLASS
METHOD NewDocument( cDir, cFilename, cTitle ) CLASS GenerateText
METHOD NewDocument( cDir, cFilename, cTitle, cLang ) CLASS GenerateText
::super:NewDocument( cDir, cFilename, cTitle, ".txt" )
::super:NewDocument( cDir, cFilename, cTitle, ".txt", cLang )
::WriteEntry( "", cTitle + hb_eol(), .F. )
RETURN self
METHOD NewIndex( cDir, cFilename, cTitle ) CLASS GenerateText
METHOD NewIndex( cDir, cFilename, cTitle, cLang ) CLASS GenerateText
::super:NewIndex( cDir, cFilename, cTitle, ".txt" )
::super:NewIndex( cDir, cFilename, cTitle, ".txt", cLang )
::WriteEntry( "", cTitle + hb_eol(), .F. )
RETURN self
@@ -117,7 +119,7 @@ METHOD BeginSection( cSection, cFilename ) CLASS GenerateText
METHOD AddIndex( oEntry ) CLASS GenerateText
::WriteEntry( oEntry:FieldName( "NAME" ), oEntry:Name + " - " + oEntry:OneLiner, .F. )
::WriteEntry( FieldCaption( "NAME" ), oEntry:fld[ "NAME" ] + " - " + oEntry:fld[ "ONELINER" ], .F. )
RETURN self
@@ -128,43 +130,40 @@ METHOD AddEntry( oEntry ) CLASS GenerateText
IF ::IsIndex()
::AddIndex( oEntry )
ELSE
FOR EACH item IN oEntry:Fields
IF oEntry:IsField( item[ 1 ] ) .AND. oEntry:IsOutput( item[ 1 ] ) .AND. Len( oEntry:&( item[ 1 ] ) ) > 0
::WriteEntry( oEntry:FieldName( item[ 1 ] ), oEntry:&( item[ 1 ] ), oEntry:IsPreformatted( item[ 1 ] ) )
FOR EACH item IN FieldIDList()
IF oEntry:IsField( item ) .AND. oEntry:IsOutput( item ) .AND. Len( oEntry:fld[ item ] ) > 0
::WriteEntry( FieldCaption( item ), oEntry:fld[ item ], oEntry:IsPreformatted( item ) )
ENDIF
NEXT
IF ! ::lContinuous
hb_vfWrite( ::hFile, hb_BChar( 12 ) + hb_eol() )
::cFile += hb_BChar( 12 ) + hb_eol()
ENDIF
ENDIF
RETURN self
METHOD PROCEDURE WriteEntry( cCaption, cEntry, lPreformatted ) CLASS GenerateText
METHOD PROCEDURE WriteEntry( cCaption, cContent, lPreformatted ) CLASS GenerateText
LOCAL nIndent
IF ! Empty( cEntry )
IF ! Empty( cContent )
nIndent := iif( HB_ISNULL( cCaption ), 0, 6 )
IF ! HB_ISNULL( cCaption ) .AND. nIndent > 0
hb_vfWrite( ::hFile, Space( ::Depth * 6 ) + cCaption + ": " + hb_eol() )
::cFile += Space( ::Depth * 6 ) + cCaption + ": " + hb_eol()
ENDIF
nIndent += ::Depth * 6
DO WHILE ! HB_ISNULL( cEntry )
hb_vfWrite( ::hFile, Indent( Parse( @cEntry, hb_eol() ), nIndent, 70, lPreformatted ) )
DO WHILE ! HB_ISNULL( cContent )
::cFile += Indent( Parse( @cContent, hb_eol() ), nIndent, 70, lPreformatted )
ENDDO
ENDIF
METHOD Generate() CLASS GenerateText
IF ::IsIndex() .AND. ! ::lContinuous
hb_vfWrite( ::hFile, hb_BChar( 12 ) + hb_eol() )
::cFile += hb_BChar( 12 ) + hb_eol()
ENDIF
IF ::hFile != NIL
hb_vfClose( ::hFile )
::hFile := NIL
ENDIF
::super:Generate()
RETURN self

View File

@@ -49,45 +49,46 @@
CREATE CLASS GenerateXML INHERIT TPLGenerate
HIDDEN:
PROTECTED:
EXPORTED:
METHOD NewIndex( cDir, cFilename, cTitle )
METHOD NewDocument( cDir, cFilename, cTitle )
METHOD NewIndex( cDir, cFilename, cTitle, cLang )
METHOD NewDocument( cDir, cFilename, cTitle, cLang )
METHOD AddEntry( oEntry )
METHOD AddIndex( oEntry ) HIDDEN
METHOD BeginSection( cSection, cFilename )
METHOD EndSection( cSection, cFilename )
METHOD Generate()
METHOD WriteEntry( cCaption, cEntry, lPreformatted ) HIDDEN
HIDDEN:
METHOD WriteEntry( cCaption, cContent, lPreformatted )
ENDCLASS
METHOD NewDocument( cDir, cFilename, cTitle ) CLASS GenerateXML
METHOD NewDocument( cDir, cFilename, cTitle, cLang ) CLASS GenerateXML
::super:NewDocument( cDir, cFilename, cTitle, ".xml" )
hb_vfWrite( ::hFile, '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + hb_eol() )
hb_vfWrite( ::hFile, '<HarbourReference>' + hb_eol() )
::super:NewDocument( cDir, cFilename, cTitle, ".xml", cLang )
::cFile += ;
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + hb_eol() + ;
'<HarbourReference>' + hb_eol()
RETURN self
METHOD NewIndex( cDir, cFilename, cTitle ) CLASS GenerateXML
METHOD NewIndex( cDir, cFilename, cTitle, cLang ) CLASS GenerateXML
::super:NewIndex( cDir, cFilename, cTitle, ".xml" )
hb_vfWrite( ::hFile, '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + hb_eol() )
hb_vfWrite( ::hFile, '<HarbourReference>' + hb_eol() )
::super:NewIndex( cDir, cFilename, cTitle, ".xml", cLang )
::cFile += ;
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + hb_eol() + ;
'<HarbourReference>' + hb_eol()
RETURN self
METHOD BeginSection( cSection, cFilename ) CLASS GenerateXML
IF ::Depth == 0
hb_vfWrite( ::hFile, Replicate( Chr( 9 ), ::Depth ) + '<Section name="' + cSection + '" file="' + cFilename + ::cExtension + '">' + hb_eol() )
::cFile += Replicate( Chr( 9 ), ::Depth ) + '<Section name="' + cSection + '" file="' + cFilename + ::cExtension + '">' + hb_eol()
ELSE
hb_vfWrite( ::hFile, Replicate( Chr( 9 ), ::Depth ) + '<Section name="' + cSection + '">' + hb_eol() )
::cFile += Replicate( Chr( 9 ), ::Depth ) + '<Section name="' + cSection + '">' + hb_eol()
ENDIF
::Depth++
@@ -98,13 +99,13 @@ METHOD EndSection( cSection, cFilename ) CLASS GenerateXML
HB_SYMBOL_UNUSED( cSection )
HB_SYMBOL_UNUSED( cFilename )
::Depth--
hb_vfWrite( ::hFile, Replicate( Chr( 9 ), ::Depth ) + '</Section>' + hb_eol() )
::cFile += Replicate( Chr( 9 ), ::Depth ) + '</Section>' + hb_eol()
RETURN self
METHOD AddIndex( oEntry ) CLASS GenerateXML
::WriteEntry( "ENTRY", oEntry:Name + " - " + oEntry:OneLiner, .F. )
::WriteEntry( "ENTRY", oEntry:fld[ "NAME" ] + " - " + oEntry:fld[ "ONELINER" ], .F. )
RETURN self
@@ -115,43 +116,41 @@ METHOD AddEntry( oEntry ) CLASS GenerateXML
IF ::IsIndex()
::AddIndex( oEntry )
ELSE
hb_vfWrite( ::hFile, '<Entry>' + hb_eol() )
::cFile += '<Entry>' + hb_eol()
::Depth++
FOR EACH item IN oEntry:Fields
::WriteEntry( item[ 1 ], oEntry:&( item[ 1 ] ), oEntry:IsPreformatted( item[ 1 ] ) )
FOR EACH item IN FieldIDList()
::WriteEntry( item, oEntry:fld[ item ], oEntry:IsPreformatted( item ) )
NEXT
::Depth--
hb_vfWrite( ::hFile, '</Entry>' + hb_eol() )
::cFile += '</Entry>' + hb_eol()
ENDIF
RETURN self
METHOD Generate() CLASS GenerateXML
hb_vfWrite( ::hFile, '</HarbourReference>' + hb_eol() )
::cFile += '</HarbourReference>' + hb_eol()
IF ::hFile != NIL
hb_vfClose( ::hFile )
::hFile := NIL
ENDIF
::super:Generate()
RETURN self
METHOD PROCEDURE WriteEntry( cCaption, cEntry, lPreformatted ) CLASS GenerateXML
METHOD PROCEDURE WriteEntry( cCaption, cContent, lPreformatted ) CLASS GenerateXML
IF ! Empty( cEntry )
IF ! Empty( cContent )
IF hb_eol() $ cEntry
cEntry := hb_eol() + cEntry
IF hb_eol() $ cContent
cContent := hb_eol() + cContent
ENDIF
hb_vfWrite( ::hFile, Replicate( Chr( 9 ), ::Depth ) + "<" + cCaption + iif( lPreformatted, ' preformatted="yes"', "" ) + ">" )
hb_vfWrite( ::hFile, hb_StrReplace( cEntry, { ;
"&" => "&amp;", ;
'"' => "&quot;", ;
"<" => "&lt;", ;
">" => "&gt;" } ) )
hb_vfWrite( ::hFile, /* Replicate( Chr( 9 ), ::Depth ) + */ "</" + cCaption + ">" + hb_eol() )
::cFile += ;
Replicate( Chr( 9 ), ::Depth ) + "<" + cCaption + iif( lPreformatted, ' preformatted="yes"', "" ) + ">" + ;
hb_StrReplace( cContent, { ;
"&" => "&amp;", ;
'"' => "&quot;", ;
"<" => "&lt;", ;
">" => "&gt;" } ) + ;
"</" + cCaption + ">" + hb_eol()
ENDIF
RETURN

View File

@@ -1,232 +0,0 @@
/*
* Document generator, templates
*
* Copyright 2009 April White <bright.tigra gmail.com>
* Copyright 1999-2003 Luiz Rafael Culik <culikr@uol.com.br> (Portions of this project are based on hbdoc)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.txt. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "hbdoc.ch"
#include "hbclass.ch"
/* a class that will hold one entry */
CREATE CLASS Entry
EXPORTED:
CLASS VAR Fields AS ARRAY INIT { ;
{ "DOC", "Doc" }, ;
{ "TEMPLATE", "Template" }, ;
{ "NAME", "" }, ;
{ "CATEGORY", "Category" }, ;
{ "SUBCATEGORY", "Sub category" }, ;
{ "ONELINER", "" }, ;
{ "SYNTAX", "Syntax" }, ;
{ "ARGUMENTS", "Argument(s)" }, ;
{ "RETURNS", "Returns" }, ;
{ "DESCRIPTION", "Description" }, ;
{ "DATALINK", "Data link" }, ;
{ "DATANOLINK", "Data no link" }, ;
{ "METHODSLINK", "Methods link" }, ;
{ "METHODSNOLINK","Methods no link" }, ;
{ "EXAMPLES", "Example(s)" }, ;
{ "TESTS", "Test(s)" }, ;
{ "STATUS", "Status" }, ; /* ::hConstraint[ "status" ] is the constraint list */
{ "COMPLIANCE", "Compliance" }, ; /* ::hConstraint[ "compliance" ] is the constraint list */
{ "PLATFORMS", "Platform(s)" }, ; /* ::hConstraint[ "platforms" ] is the constraint list */
{ "FILES", "File(s)" }, ;
{ "SEEALSO", "See also" }, ;
{ "END", "End" } }
#define _S TPL_START
#define _E TPL_END
#define _T TPL_TEMPLATE
#define _R TPL_REQUIRED
#define _O TPL_OPTIONAL
#define _P TPL_PREFORMATTED
#define _U TPL_OUTPUT
/* the columns of this array correspond to the elements of Fields */
CLASS VAR Templates AS ARRAY INIT { ;
{ "Template" , { _S, _T, 0+_U, 0, _O , 0+_U, 0+_U, 0+_U, 0+_U, 0+_U, 0+_U, 0+_U, 0+_U, 0+_U, 0 +_U, 0 +_U, 0+_U, 0+_U, 0+_U, 0+_U, 0+_U, _E } }, ;
{ "Document" , { _S, _T, _R+_U, _R, _O+_U, _O+_U, 0+_U, 0+_U, 0+_U, _R+_U, 0+_U, 0+_U, 0+_U, 0+_U, 0 +_U, 0 +_U, 0+_U, 0+_U, _O+_U, _O+_U, _O+_U, _E } }, ;
{ "Function" , { _S, _T, _R+_U, _R, _R , _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, _P+_O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _E } }, ;
{ "C Function" , { _S, _T, _R+_U, _R, _R , _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, _P+_O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _E } }, ;
{ "Procedure" , { _S, _T, _R+_U, _R, _R , _O+_U, _O+_U, _O+_U, 0, _O+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, _P+_O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _E } }, ;
{ "Command" , { _S, _T, _R+_U, _R, _R , _O+_U, _R+_U, _R+_U, 0+_U, _R+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, _P+_O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _E } }, ;
{ "Class" , { _S, _T, _R+_U, _R, _R , _O+_U, _R+_U, _R+_U, _R+_U, _R+_U, _O+_U, _O+_U, _O+_U, _O+_U, _P+_O+_U, _P+_O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _E } }, ;
{ "Class method" , { _S, _T, _R+_U, _R, _R , _O+_U, _R+_U, _R+_U, _R+_U, _R+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, 0 +_U, 0+_U, 0+_U, 0+_U, 0+_U, _O+_U, _E } }, ;
{ "Class data" , { _S, _T, _R+_U, _R, _R , _O+_U, _R+_U, 0+_U, 0+_U, _R+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, 0 +_U, 0+_U, 0+_U, 0+_U, 0+_U, _O+_U, _E } }, ;
{ "Run time error", { _S, _T, _R+_U, _R, 0 , _O+_U, 0+_U, 0+_U, 0+_U, _R+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, 0 +_U, 0+_U, _O+_U, 0+_U, 0+_U, _O+_U, _E } } }
METHOD New( cType, hConstraint ) CONSTRUCTOR
METHOD IsField( c, nType )
METHOD IsTemplate( cType )
METHOD SetTemplate( cTemplate )
METHOD IsConstraint( cSectionName, cSection )
METHOD IsComplete( cIncompleteFielsList )
METHOD IsPreformatted( cField )
METHOD IsRequired( cField )
METHOD IsOptional( cField )
METHOD IsOutput( cField )
METHOD FieldName( cField )
METHOD CategoryIndex( cCategory )
METHOD SubcategoryIndex( cCategory, cSubcategory )
VAR Group AS ARRAY
VAR filename AS STRING
VAR type_ AS STRING
VAR sourcefile_ AS STRING
VAR sourcefileversion_ AS STRING
VAR uid_ AS STRING
VAR hConstraint AS HASH
CLASS VAR uid__ AS INTEGER INIT 0
ENDCLASS
METHOD New( cType, hConstraint ) CLASS Entry
::hConstraint := hConstraint
::uid_ := hb_ntos( ++::uid__ )
IF ! __objHasData( self, ::Fields[ 1 ][ 1 ] )
AEval( ::Fields, {| a | __objAddData( self, a[ 1 ] ) } )
ENDIF
IF HB_ISSTRING( cType )
::Group := ::Templates[ AScan( ::Templates, {| a | Upper( a[ 1 ] ) == Upper( cType ) } ) ][ 2 ]
ENDIF
RETURN self
METHOD IsField( c, nType ) CLASS Entry
LOCAL idx
LOCAL lResult
IF ( lResult := ( idx := AScan( ::Fields, {| a | Upper( a[ 1 ] ) == Upper( c ) } ) ) > 0 )
IF ::Group[ idx ] == 0
lResult := .F.
ELSEIF HB_ISNUMERIC( nType ) .AND. hb_bitAnd( ::Group[ idx ], nType ) != nType
lResult := .F.
ENDIF
ENDIF
RETURN lResult
METHOD IsTemplate( cType ) CLASS Entry
RETURN AScan( ::Templates, {| a | Upper( a[ 1 ] ) == Upper( cType ) } ) > 0
METHOD SetTemplate( cTemplate ) CLASS Entry
LOCAL aData := Array( Len( ::Fields ) )
LOCAL idx
::Group := ::Templates[ AScan( ::Templates, {| a | Upper( a[ 1 ] ) == Upper( cTemplate ) } ) ][ 2 ]
FOR idx := 1 TO Len( aData )
IF ::Fields[ idx ][ 1 ] == "TEMPLATE"
aData[ idx ] := { ::Fields[ idx ][ 1 ], cTemplate }
ELSE
aData[ idx ] := { ::Fields[ idx ][ 1 ], iif( ::Group[ idx ] == TPL_REQUIRED, NIL, "" ) }
ENDIF
NEXT
__objSetValueList( self, aData )
RETURN self
METHOD IsConstraint( cSectionName, cSection ) CLASS Entry
LOCAL lResult
LOCAL idx := AScan( ::Fields, {| a | a[ 1 ] == cSectionName } )
IF hb_bitAnd( ::Group[ idx ], hb_bitAnd( TPL_REQUIRED, TPL_OPTIONAL ) ) == 0
lResult := .T.
ELSEIF cSectionName $ ::hConstraint
lResult := ;
hb_AScan( ::hConstraint[ cSectionName ], cSection, , , .T. ) .OR. ;
hb_AScan( ::hConstraint[ cSectionName ], Parse( cSection, "," ), , , .T. )
ELSE
lResult := .T.
ENDIF
RETURN lResult
METHOD IsComplete( cIncompleteFielsList ) CLASS Entry
LOCAL lResult := .T.
LOCAL idx
cIncompleteFielsList := ""
FOR idx := 1 TO Len( ::Fields )
IF hb_bitAnd( ::Group[ idx ], TPL_REQUIRED ) != 0 .AND. Empty( ::&( ::Fields[ idx ][ 1 ] ) )
cIncompleteFielsList += "," + ::Fields[ idx ][ 1 ]
lResult := .F.
ENDIF
NEXT
cIncompleteFielsList := SubStr( cIncompleteFielsList, 2 )
RETURN lResult
METHOD IsPreformatted( cField ) CLASS Entry
RETURN hb_bitAnd( ::Group[ AScan( ::Fields, {| a | a[ 1 ] == cField } ) ], TPL_PREFORMATTED ) != 0
METHOD IsRequired( cField ) CLASS Entry
RETURN hb_bitAnd( ::Group[ AScan( ::Fields, {| a | a[ 1 ] == cField } ) ], TPL_REQUIRED ) != 0
METHOD IsOptional( cField ) CLASS Entry
RETURN hb_bitAnd( ::Group[ AScan( ::Fields, {| a | a[ 1 ] == cField } ) ], TPL_OPTIONAL ) != 0
METHOD IsOutput( cField ) CLASS Entry
RETURN hb_bitAnd( ::Group[ AScan( ::Fields, {| a | a[ 1 ] == cField } ) ], TPL_OUTPUT ) != 0
METHOD FieldName( cField ) CLASS Entry
RETURN ::Fields[ AScan( ::Fields, {| a | a[ 1 ] == cField } ) ][ 2 ]
METHOD CategoryIndex( cCategory ) CLASS Entry
RETURN AScan( ::hConstraint[ "categories" ], {| a | HB_ISARRAY( a ) .AND. Len( a ) >= 1 .AND. a[ 1 ] == cCategory } )
METHOD SubcategoryIndex( cCategory, cSubcategory ) CLASS Entry
RETURN ::CategoryIndex( cCategory ) >= 1 .AND. ;
hb_AScan( ::hConstraint[ "categories" ][ ::CategoryIndex( cCategory ) ][ 2 ], cSubcategory, , , .T. )

View File

@@ -1,61 +0,0 @@
/*
* Document generator include file
*
* Copyright 2009 April White <bright.tigra gmail.com>
* Copyright 1999-2003 Luiz Rafael Culik <culikr@uol.com.br> (Portions of this project are based on hbdoc)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.txt. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#ifndef HBDOC_CH_
#define HBDOC_CH_
// Template definitions
#define TPL_START 1
#define TPL_END 2
#define TPL_REQUIRED 4 // intentionally has a 'required' and 'optional' flag
#define TPL_OPTIONAL 8
#define TPL_PREFORMATTED 16
#define TPL_CONSTRAINTLIST 32
#define TPL_TEMPLATE 64
#define TPL_OUTPUT 128
#endif

View File

@@ -1,40 +1,178 @@
body {
font-family: Arial, sans-serif;
font-size: 14px;
line-height: 18px;
background-color: #f8f8f8;
font-family: 'Source Sans Pro', Arial, sans-serif;
font-size: 14pt;
line-height: 150%;
margin: 0;
padding: 0;
}
.name {
font-size: 18px;
header {
-position: fixed;
top: 0;
background-color: #0974c5;
color: #f0f0f0;
border: none;
padding: 0 20px;
margin: 0;
}
footer {
background: #333;
color: #bbb;
font-size: 75%;
line-height: 150%;
margin: auto;
padding: .6em 1em;
height: 90px;
text-align: center;
width: auto;
}
footer a {
color: #ddd;
text-decoration: none;
}
footer a:hover {
border: none;
color: #f8f8f8;
transition: color .25s;
}
footer a:active {
color: #f8f8f8;
}
main {
margin: 0 10px;
}
main section:first-child {
-margin-top: 60px;
border-top: 0;
}
a {
text-decoration: none;
}
a:hover {
border-style: none none solid;
border-width: 0 0 1px;
border-color: #000088;
border-color: rgba(0, 0, 255, .4);
}
hr {
border: 0;
border-bottom: 1px dotted rgba(0, 0, 0, .1);
width: 75%;
margin-left: 0;
}
h1 {
font-size: 130%;
font-weight: normal;
padding: 14px 0;
margin: 0;
}
section {
border-top: 1px solid rgba(0, 0, 0, .1);
margin-top: 0;
margin-bottom: 0;
padding: 1em .6em;
}
h4 {
color: #095fa8;
font-size: 125%;
margin-top: 0;
margin-bottom: 14px;
}
pre {
background-color: #f2f2f2;
font-size: 12pt;
padding: 16px;
overflow: scroll;
}
pre, code, .d-t {
font-family: Hack, Consolas, Menlo, 'Droid Sans Mono', 'Source Code Pro', 'Liberation Mono', 'Oxygen Mono', 'Andale Mono', monospace;
}
code, .d-t {
font-size: 95%;
}
p {
margin-top: 1em;
margin-bottom: 1em;
}
.d-it div:first-child p {
margin-top: .2em;
}
.d-it div:last-child p {
margin-bottom: .2em;
}
.d-t {
border-top: 1px solid rgba(0, 0, 0, .1);
border-bottom: 1px solid rgba(0, 0, 0, .1);
overflow: scroll;
margin: 16px;
width: 80%;
}
.d-t1 div:first-child {
border-top: 0;
background-color: #333;
color: #f8f8f8;
}
.d-t2 div:nth-child(2) {
background-color: #333;
color: #f8f8f8;
}
.d-na {
font-size: 100%;
margin-left: 0;
padding-top: 0;
padding-bottom: 8px;
}
.d-ol {
font-weight: bold;
font-size: 115%;
margin-left: 1em;
margin-top: 0px;
margin-bottom: 14px;
}
.d-d {
color: #095fa8;
font-weight: bold;
margin-left: 0;
padding-top: 0;
padding-bottom: 4px;
padding-bottom: 8px;
}
.oneliner {
font-style: italic;
margin-bottom: 12px;
.d-it {
margin-left: 1em;
padding-bottom: 8px;
}
.itemtitle {
font-weight: bold;
margin-left: 0;
padding-top: 0;
padding-bottom: 4px;
.d-ex {
margin-left: 1em;
margin-right: 1em;
}
.itemtext {
margin-left: 10px;
padding-bottom: 4px;
}
.examples {
margin-left: 10px;
padding-bottom: 4px;
}
.tests {
margin-left: 10px;
padding-bottom: 4px;
.d-te {
margin-left: 1em;
padding-bottom: 8px;
}

View File

@@ -11,7 +11,6 @@ _genbase.prg
_genhtml.prg
_gentxt.prg
_genxml.prg
_tmplate.prg
# NOTE: hbdoc doesn't work from other locations than
# the current one, so we don't install it yet.
@@ -19,7 +18,6 @@ _tmplate.prg
# default -run params useful to update the online docs
# on the Harbour website
-runflag=-format=html
-runflag=-output-single
-runflag=-html
{allgcc}-ldflag=-fno-lto

File diff suppressed because it is too large Load Diff