2012-06-26 20:37 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/xhb/tfile.prg
* contrib/xhb/ttable.prg
* contrib/xhb/xhberr.prg
* contrib/xhb/xhbtedit.prg
! unicode compatibility patches. build tested only. review me
and continue.
* examples/hbdoc/genhtml.prg
* examples/hbdoc/hbdoc.prg
! fixed regression from 2012-06-11 15:31 UTC+0200
+ changed to generate HTML5 compliant HTML output
This commit is contained in:
@@ -16,6 +16,19 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-06-26 20:37 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
* contrib/xhb/tfile.prg
|
||||
* contrib/xhb/ttable.prg
|
||||
* contrib/xhb/xhberr.prg
|
||||
* contrib/xhb/xhbtedit.prg
|
||||
! unicode compatibility patches. build tested only. review me
|
||||
and continue.
|
||||
|
||||
* examples/hbdoc/genhtml.prg
|
||||
* examples/hbdoc/hbdoc.prg
|
||||
! fixed regression from 2012-06-11 15:31 UTC+0200
|
||||
+ changed to generate HTML5 compliant HTML output
|
||||
|
||||
2012-06-26 18:29 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
* TODO
|
||||
- deleted unicode support from TODO list.
|
||||
|
||||
@@ -278,7 +278,7 @@ METHOD ReadByte() CLASS TCgiFile
|
||||
LOCAL nBytes
|
||||
LOCAL cBuff := Space( 1 )
|
||||
|
||||
nBytes := Fread( ::Handle, @cBuff, 1 )
|
||||
nBytes := Fread( ::Handle, @cBuff, hb_BLen( cBuff ) )
|
||||
|
||||
RETURN IIF( nBytes > 0, Asc( cBuff ), - 1 )
|
||||
|
||||
@@ -292,7 +292,7 @@ METHOD ReadInt() CLASS TCgiFile
|
||||
LOCAL nBytes
|
||||
LOCAL cBuff := Space( 2 )
|
||||
|
||||
nBytes := Fread( ::Handle, @cBuff, 2 )
|
||||
nBytes := Fread( ::Handle, @cBuff, hb_BLen( cBuff ) )
|
||||
|
||||
RETURN IIF( nBytes > 0, Bin2i( cBuff ), - 1 )
|
||||
|
||||
@@ -306,7 +306,7 @@ METHOD ReadLong() CLASS TCgiFile
|
||||
LOCAL nBytes
|
||||
LOCAL cBuff := Space( 4 )
|
||||
|
||||
nBytes := Fread( ::Handle, @cBuff, 4 )
|
||||
nBytes := Fread( ::Handle, @cBuff, hb_BLen( cBuff ) )
|
||||
|
||||
RETURN IIF( nBytes > 0, Bin2l( cBuff ), - 1 )
|
||||
|
||||
@@ -318,7 +318,7 @@ RETURN IIF( nBytes > 0, Bin2l( cBuff ), - 1 )
|
||||
METHOD WriteByte( nByte ) CLASS TCgiFile
|
||||
|
||||
|
||||
LOCAL lSuccess := ( Fwrite( ::nHandle, Chr( nByte ), 1 ) == 1 )
|
||||
LOCAL lSuccess := ( Fwrite( ::nHandle, hb_BCode( nByte ), 1 ) == 1 )
|
||||
RETURN lSuccess
|
||||
|
||||
/*
|
||||
@@ -501,7 +501,7 @@ METHOD PrevLine( nBytes ) CLASS TCgiFile
|
||||
// Check preceeding 2 chars for CR+LF
|
||||
Fseek( fHandle, - 2, FS_RELATIVE )
|
||||
cTemp := Space( 2 )
|
||||
Fread( fHandle, @cTemp, 2 )
|
||||
Fread( fHandle, @cTemp, hb_BLen( cTemp ) )
|
||||
|
||||
IF cTemp == CRLF()
|
||||
Fseek( fHandle, - 2, FS_RELATIVE )
|
||||
|
||||
@@ -94,7 +94,7 @@ FUNCTION NetDbUse( cDataBase, cAlias, nSeconds, cDriver, ;
|
||||
nSeconds *= 1.00
|
||||
lforever := ( nSeconds == 0 )
|
||||
|
||||
KEYBOARD CHR( 255 )
|
||||
hb_keyIns( 255 )
|
||||
INKEY()
|
||||
|
||||
DO WHILE ( lforever .or. nSeconds > 0 ) .and. LASTKEY() != K_ESC
|
||||
|
||||
@@ -607,14 +607,14 @@ STATIC FUNCTION LogError( oerr )
|
||||
|
||||
nBytes := FSeek( nHandle2, 0, FS_END )
|
||||
|
||||
cBuff := space(10)
|
||||
cBuff := Space( 10 )
|
||||
FSeek( nHandle2, 0, FS_SET )
|
||||
|
||||
while nBytes > 0
|
||||
nRead := FRead( nHandle2, @cBuff, 10 )
|
||||
FWrite( nHandle, cBuff, nRead )
|
||||
nBytes -= nRead
|
||||
cBuff := space( 10 )
|
||||
nRead := FRead( nHandle2, @cBuff, hb_BLen( cBuffer ) )
|
||||
FWrite( nHandle, cBuff, nRead )
|
||||
nBytes -= nRead
|
||||
cBuff := Space( 10 )
|
||||
enddo
|
||||
|
||||
FClose( nHandle2 )
|
||||
@@ -626,7 +626,7 @@ STATIC FUNCTION LogError( oerr )
|
||||
FClose( nHandle )
|
||||
endif
|
||||
|
||||
Endif
|
||||
endif
|
||||
|
||||
Return .f.
|
||||
|
||||
@@ -641,17 +641,17 @@ STATIC FUNCTION strvalue( c, l )
|
||||
cr := c
|
||||
EXIT
|
||||
CASE "N"
|
||||
cr := Alltrim( Str( c ) )
|
||||
cr := hb_ntos( c )
|
||||
EXIT
|
||||
CASE "M"
|
||||
cr := c
|
||||
EXIT
|
||||
CASE "D"
|
||||
cr := Dtoc( c )
|
||||
cr := DToC( c )
|
||||
EXIT
|
||||
CASE "L"
|
||||
// cr := Iif( l, Iif( c, "On", "Off" ), Iif( c, "True", "False" ) )
|
||||
cr := Iif( l, Iif( c, "On", "Off" ), Iif( c, ".t.", ".f." ) )
|
||||
// cr := iif( l, iif( c, "On", "Off" ), iif( c, "True", "False" ) )
|
||||
cr := iif( l, iif( c, "On", "Off" ), iif( c, ".t.", ".f." ) )
|
||||
EXIT
|
||||
ENDSWITCH
|
||||
|
||||
|
||||
@@ -1006,7 +1006,7 @@ METHOD Edit( nPassedKey ) CLASS XHBEditor
|
||||
|
||||
OTHERWISE
|
||||
|
||||
IF nKey >= K_SPACE .AND. nKey < 256
|
||||
IF Len( hb_KeyChar( nKey ) ) > 0
|
||||
IF ::lEditAllow
|
||||
::ClrTextSelection()
|
||||
::K_Ascii( nKey )
|
||||
@@ -1435,8 +1435,6 @@ METHOD K_Mouse( nKey ) CLASS XHBEditor
|
||||
|
||||
METHOD K_Ascii( nKey ) CLASS XHBEditor
|
||||
|
||||
// nKey := ASC( HB_ANSITOOEM( CHR( nKey ) ) ) // convert from windows
|
||||
|
||||
IF !::lEditAllow .OR. ::nCol > ::nWordWrapCol + 1
|
||||
RETURN Self
|
||||
ENDIF
|
||||
@@ -1460,10 +1458,10 @@ METHOD K_Ascii( nKey ) CLASS XHBEditor
|
||||
// insert char if in insert mode or at end of current line
|
||||
//
|
||||
IF ::lInsert .OR. ( ::nCol > ::LineLen( ::nRow ) )
|
||||
::aText[ ::nRow ]:cText := Stuff( ::aText[ ::nRow ]:cText, ::nCol, 0, Chr( nKey ) )
|
||||
::aText[ ::nRow ]:cText := Stuff( ::aText[ ::nRow ]:cText, ::nCol, 0, hb_KeyChar( nKey ) )
|
||||
::lChanged := .T.
|
||||
ELSE
|
||||
::aText[ ::nRow ]:cText := Stuff( ::aText[ ::nRow ]:cText, ::nCol, 1, Chr( nKey ) )
|
||||
::aText[ ::nRow ]:cText := Stuff( ::aText[ ::nRow ]:cText, ::nCol, 1, hb_KeyChar( nKey ) )
|
||||
::lChanged := .T.
|
||||
ENDIF
|
||||
|
||||
@@ -1778,7 +1776,7 @@ METHOD K_Esc() CLASS XHBEditor
|
||||
|
||||
// 2006/JUL/21 - E.F - Exit only if "Y" is pressed.
|
||||
//
|
||||
::lExitEdit := ( Upper( Chr(nKey ) ) == "Y" )
|
||||
::lExitEdit := ( Upper( hb_KeyChar( nKey ) ) == "Y" )
|
||||
ENDIF
|
||||
|
||||
IF ::lExitEdit
|
||||
|
||||
@@ -105,12 +105,14 @@ EXPORTED:
|
||||
ENDCLASS
|
||||
|
||||
METHOD NewFile() CLASS GenerateHTML
|
||||
FWrite( ::nHandle, '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' + hb_eol() )
|
||||
|
||||
::OpenTag( "html" )
|
||||
FWrite( ::nHandle, "<!DOCTYPE html>" + hb_eol() )
|
||||
|
||||
::OpenTag( "html", "xmlns", "http://www.w3.org/1999/xhtml", "lang", "en" )
|
||||
::OpenTag( "head" )
|
||||
|
||||
::Append( ::cTitle /* + IIf( Empty( ::cDescription ), "", " - " + ::cDescription ) */, "title" )
|
||||
::OpenTag( "meta", "http-equiv", "content-type", "content", "text/html; charset=UTF-8" )
|
||||
::OpenTag( "meta", "name", "generator", "content", "Harbour examples/hbdoc" )
|
||||
::OpenTag( "meta", "name", "keywords", "content", "Harbour project, Clipper, xBase, database, Free Software, GNU, compiler, cross platform, 32-bit, FiveWin" )
|
||||
|
||||
@@ -141,20 +143,20 @@ METHOD NewIndex( cFolder, cFilename, cTitle ) CLASS GenerateHTML
|
||||
METHOD BeginSection( cSection, cFilename ) CLASS GenerateHTML
|
||||
IF ::IsIndex()
|
||||
If cFilename == ::cFilename
|
||||
::OpenTag( "a", "name", cSection ):Append( cSection, "h" + HB_NTOS( ::Depth + 2 ) ):CloseTag( "a" )//:Newline()
|
||||
::OpenTag( "div", "id", cSection ):Append( cSection, "h" + HB_NTOS( ::Depth + 2 ) ):CloseTag( "div" )//:Newline()
|
||||
ELSE
|
||||
::OpenTag( "a", "href", cFilename + ::cExtension + "#" + cSection ):Append( cSection, "h" + HB_NTOS( ::Depth + 2 ) ):CloseTag( "a" )//:Newline()
|
||||
ENDIF
|
||||
ELSE
|
||||
::OpenTag( "a", "name", cSection ):Append( cSection, "h" + HB_NTOS( ::Depth + 2 ) ):CloseTag( "a" )//:Newline()
|
||||
::OpenTag( "div", "id", cSection ):Append( cSection, "h" + HB_NTOS( ::Depth + 2 ) ):CloseTag( "div" )//:Newline()
|
||||
ENDIF
|
||||
::TargetFilename := cFilename
|
||||
::Depth++
|
||||
RETURN self
|
||||
|
||||
METHOD EndSection( cSection, cFilename ) CLASS GenerateHTML
|
||||
HB_SYMBOL_UNUSED( cSection )
|
||||
HB_SYMBOL_UNUSED( cFilename )
|
||||
HB_SYMBOL_UNUSED( cSection )
|
||||
HB_SYMBOL_UNUSED( cFilename )
|
||||
::Depth--
|
||||
RETURN self
|
||||
|
||||
@@ -175,7 +177,7 @@ METHOD AddEntry( oEntry ) CLASS GenerateHTML
|
||||
|
||||
FOR idx := 1 TO Len( oEntry:Fields )
|
||||
IF oEntry:Fields[ idx ][ 1 ] == "NAME"
|
||||
::OpenTag( "a", "name", oEntry:filename ):OpenTag( "h4" ):Append( oEntry:Name ):CloseTag( "h4" ):CloseTag( "a" )
|
||||
::OpenTag( "div", "id", oEntry:filename ):OpenTag( "h4" ):Append( oEntry:Name ):CloseTag( "h4" ):CloseTag( "div" )
|
||||
ELSEIF oEntry:IsField( oEntry:Fields[ idx ][ 1 ] ) .AND. oEntry:IsOutput( oEntry:Fields[ idx ][ 1 ] ) .AND. Len( oEntry:&( oEntry:Fields[ idx ][ 1 ] ) ) > 0
|
||||
::WriteEntry( oEntry:Fields[ idx ][ 1 ], oEntry, oEntry:IsPreformatted( oEntry:Fields[ idx ][ 1 ] ) )
|
||||
ENDIF
|
||||
@@ -294,7 +296,7 @@ METHOD Append( cText, cFormat ) CLASS GenerateHTML
|
||||
METHOD RecreateStyleDocument( cStyleFile ) CLASS GenerateHTML
|
||||
|
||||
IF ! hb_MemoWrit( ::cFolder + hb_ps() + cStyleFile,;
|
||||
"/* Harbour Documents Stylesheet (" + cStyleFile + ") */" + hb_eol() + ;
|
||||
"/* Harbour Documents Stylesheet */" + hb_eol() + ;
|
||||
"body {font-family:arial;font-size:14px;line-height:18px;}" + hb_eol() + ;
|
||||
/* ".classtitle {font-weight:bold;font-size:22px;padding-bottom:4px;}" + hb_eol() + */ ;
|
||||
".name {font-weight:bold;font-size:18px;margin-left:0px;padding-top:0px;padding-bottom:4px;}" + hb_eol() + ;
|
||||
|
||||
@@ -145,9 +145,8 @@ PROCEDURE Main( ... )
|
||||
// remove formats that have not been implemented yet
|
||||
FOR idx := Len( p_hsSwitches[ "format-list" ] ) TO 1 STEP -1
|
||||
IF p_hsSwitches[ "format-list" ][ idx ] == "all"
|
||||
|
||||
ELSEIF hb_IsFunction( "Generate" + p_hsSwitches[ "format-list" ][ idx ] )
|
||||
ASize( ADel( p_hsSwitches[ "format-list" ], idx), Len( p_hsSwitches[ "format-list" ] ) - 1 )
|
||||
ELSEIF ! hb_IsFunction( "Generate" + p_hsSwitches[ "format-list" ][ idx ] )
|
||||
hb_ADel( p_hsSwitches[ "format-list" ], idx, .T. )
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user