Novembre 2024 | Lun | Mar | Mer | Jeu | Ven | Sam | Dim |
---|
| | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | | Calendrier |
|
|
| BAS to HTML | |
| | Auteur | Message |
---|
Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: BAS to HTML Jeu 17 Déc 2015 - 2:20 | |
| Comme je suis dans ma période Html, voilà un petit outils que je me suis fais. Il nécessite un fichier *.css pour le style et un fichier *.inf avec les mots clés Panoramic ( sans parenthèses ) - Code:
-
' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ' BAS TO HTML VS 0.1 ' PAR ' YGERONIMI ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
hide 0 Variables() Labels() Gui() show 0
end
' ------------------------------------------------------------------------------
SUB Variables() dim Path$ : Path$=dir_current$ if right$(Path$,1)="\" : Path$=left$(Path$,len(Path$)-1) : end_if Path$=Path$+"\"
dim no% dim MM% : no%=no%+1 : MM%=no% dim SM1%: no%=no%+1 : SM1%=no% dim SRC%: no%=no%+1 : SRC%=no% dim ODG%: no%=no%+1 : ODG%=no% dim Kword% : no%=no%+1 : Kword%=no% dim F_FileInfo% : no%=no%+1 : F_FileInfo%=no% dim Alp_TIT% : no%=no%+1 : Alp_TIT% =no% dim Alp_AUT% : no%=no%+1 : Alp_AUT% =no% dim Alp_VER% : no%=no%+1 : Alp_VER% =no% dim Edi_TIT% : no%=no%+1 : Edi_TIT% =no% dim Edi_AUT% : no%=no%+1 : Edi_AUT% =no% dim Edi_VER% : no%=no%+1 : Edi_VER% =no% dim But1% : no%=no%+1 : But1% =no% dim F_KeyWords% : no%=no%+1 : F_KeyWords%=no% dim FOW% : no%=no%+1 : FOW% =no% dim MES% dim Change% dim KWliste$ : KWliste$ = Path$+"Panoramic.inf" dim FileSrc$ dim FileHref$ dim Title$ dim Author$ dim Version$ END_SUB
' ------------------------------------------------------------------------------
SUB Labels() LABEL Open LABEL SaveInfo LABEL Change LABEL CloseInfo END_SUB
' ------------------------------------------------------------------------------
SUB Gui() Height 0,700 width 0,1200 top 0,(screen_y-height(0))/2 left 0,(screen_x-width(0))/2
MAIN_MENU MM% SUB_MENU SM1% : parent SM1%,MM% : caption SM1%,"Open" : on_click SM1%,Open
LIST SRC% full_space SRC% font_name SRC%,"Courier New" font_size SRC%,10 dlist Kword% if file_exists(KWliste$)=1 file_load Kword%,KWliste$ else MES%=message_warning_ok("Fichier des mots clés introuvable !") end_if END_SUB
' ------------------------------------------------------------------------------
Open: OPEN_DIALOG ODG% dir_dialog ODG%,":\" filter ODG%,"*.bas|*.bas" FileSrc$ = file_name$(ODG%) if fileSrc$<>"_" file_load SRC%,FileSrc$ FormFileInfo() end_if delete ODG% return
' ------------------------------------------------------------------------------
Param: if number_click = SM3% FormKeyWords() return end_if if number_click = SM4% return end_if return
' ------------------------------------------------------------------------------
SUB FormFileInfo() if object_exists(F_FileInfo%)=1 show F_FileInfo% else FORM F_FileInfo% height F_FileInfo%,220 width F_FileInfo%,400 top F_FileInfo%,(screen_y-height(F_FileInfo%))/2 left F_FileInfo%,(screen_x-width(F_FileInfo%))/2 caption F_FileInfo%,"INFOS FICHIER SOURCE" on_close F_FileInfo%,CloseInfo font_name F_FileInfo%,"Arial" font_size F_FileInfo%,8 alpha Alp_TIT% parent Alp_TIT%,F_FileInfo% top Alp_TIT%,10 left Alp_TIT%,10 caption Alp_TIT%,"Nom du programme :" edit Edi_TIT% parent Edi_TIT%,F_FileInfo% top Edi_TIT%,25 left Edi_TIT%,10 width Edi_TIT%,width(F_FileInfo%)-36 on_change Edi_TIT%,Change
alpha Alp_AUT% parent Alp_AUT%,F_FileInfo% top Alp_AUT%,50 left Alp_AUT%,10 caption Alp_AUT%,"Auteur :" edit Edi_AUT% parent Edi_AUT%,F_FileInfo% top Edi_AUT%,65 left Edi_AUT%,10 width Edi_AUT%,width(F_FileInfo%)-36 on_change Edi_AUT%,Change alpha Alp_VER% parent Alp_VER%,F_FileInfo% top Alp_VER%,90 left Alp_VER%,10 caption Alp_VER%,"Version :" edit Edi_VER% parent Edi_VER%,F_FileInfo% top Edi_VER%,105 left Edi_VER%,10 width Edi_VER%,120 button But1% parent But1%,F_FileInfo% top But1%,height(F_FileInfo%)-68 left But1%,width(F_FileInfo%)-(width(But1%)+21) caption But1%,"Save" cursor_point But1% on_click But1%,SaveInfo end_if text Edi_TIT%,"" text Edi_AUT%,"" text Edi_VER%,"" END_SUB
' ------------------------------------------------------------------------------
SaveInfo: if len(text$(Edi_TIT%))=0 or len(text$(Edi_AUT%))=0 or len(text$(Edi_VER%))=0 MES%=message_warning_Ok("Tous les champs doivent être renseignés !...") return end_if Title$ = text$(Edi_TIT%) Author$ = text$(Edi_AUT%) Version$= text$(Edi_VER%) FileHref$ = Path$+Title$+".html" Hide F_FileInfo% TranslateBasToHtml() return
' ------------------------------------------------------------------------------
Change: if variable("cp%")=0 then dim cp% change% = number_change if change% = Edi_TIT% or change% = Edi_AUT% off_change change% cp%=caret_position(change%) text change%,upper$(text$(change%)) caret_position change%,cp% on_change change%,Change return end_if return
' ------------------------------------------------------------------------------
CloseInfo: Clear SRC% return
' ------------------------------------------------------------------------------
SUB TranslateBasToHtml() dim_local i%,l$,x%,car$,vcar%,l2$,sep%,sep2%,a$,b$,c$,d$,k$ for i%=1 to count(SRC%) l$=item_read$(SRC%,i%) l$=l$+chr$(32) item_delete SRC%,i% item_insert SRC%,i%,l$ next i% file_open_write FOW%,FileHref$ file_writeln FOW%,"<!DOCTYPE HTML>" file_writeln FOW%,"<HTML>" file_writeln FOW%,chr$(9)+"<HEAD>" file_writeln FOW%,string$(2,chr$(9))+"<TITLE>"+Title$+"</TITLE>" file_writeln FOW%,string$(2,chr$(9))+"<META http-equiv="+chr$(34)+"Content-Type"+chr$(34)+" content="+chr$(34)+"text/html; charset=UTF-8"+chr$(34)+"/>" file_writeln FOW%,string$(2,chr$(9))+"<META name="+chr$(34)+"author"+chr$(34)+" content="+chr$(34)+Author$+chr$(34)+"/>" file_writeln FOW%,string$(2,chr$(9))+"<META name="+chr$(34)+"description"+chr$(34)+" content="+chr$(34)+"Version "+Version$+chr$(34)+">" file_writeln FOW%,string$(2,chr$(9))+"<LINK href="+chr$(34)+"Panoramic.css"+chr$(34)+" rel="+chr$(34)+"stylesheet"+chr$(34)+" type="+chr$(34)+"text/css"+chr$(34)+">" file_writeln FOW%,chr$(9)+"</HEAD>" file_writeln FOW%,chr$(9)+"<BODY>" file_writeln FOW%,string$(2,chr$(9))+"<Div id="+chr$(34)+"titre"+chr$(34)+">" file_writeln FOW%,string$(2,chr$(9))+title$ file_writeln FOW%,string$(2,chr$(9))+"</Div>" file_writeln FOW%,string$(2,chr$(9))+"<Div id="+chr$(34)+"version"+chr$(34)+">" file_writeln FOW%,string$(2,chr$(9))+"Version : "+Version$ file_writeln FOW%,string$(2,chr$(9))+"</Div>" file_writeln FOW%,string$(2,chr$(9))+"<Div id="+chr$(34)+"auteur"+chr$(34)+">" file_writeln FOW%,string$(2,chr$(9))+"Auteur : "+Author$ file_writeln FOW%,string$(2,chr$(9))+"</Div>" file_writeln FOW%,string$(2,chr$(9))+"<Div id="+chr$(34)+"description"+chr$(34)+">" file_writeln FOW%,string$(2,chr$(9))+"</Div>" file_writeln FOW%,string$(2,chr$(9))+"<Div id="+chr$(34)+"source"+chr$(34)+">" file_writeln FOW%,string$(3,chr$(9))+"<Code>"
for i%=1 to count(SRC%) caption 0,str$(i%)+" / "+str$(count(SRC%)) l$=item_read$(SRC%,i%)
' traitement des caractères accentués for x%=1 to len(l$) car$ = mid$(l$,x%,1) vcar% = asc(car$) if vcar% = 233 or vcar% = 232 or vcar% = 234 or vcar% = 235 : vcar% = 101 : end_if if vcar% = 224 : vcar% = 97 : end_if if vcar% = 249 : vcar% = 117 : end_if l2$= l2$+ chr$(vcar%) next x% ' traitement des textes sep% = instr(l2$,chr$(34)) if sep% > 0 a$=left$(l2$,sep%-1) a$=a$+"<span1>"+chr$(34) b$=right$(l2$,len(l2$)-sep%) sep2% = instr(b$,chr$(34)) if sep2% > 0 c$=left$(b$,sep2%) c$=c$+"</span1>" d$=right$(b$,len(b$)-sep2%) end_if l2$=a$+c$+d$ end_if ' traitement des commentaires sep% = instr(l2$,"rem ") if sep% > 0 sep% = sep%+2 a$ = left$(l2$,sep%) b$ = right$(l2$,len(l2$)-sep%) l2$= a$+"<span2>"+b$+"</span2>" end_if sep% = instr(l2$,"REM ") if sep% > 0 sep% = sep%+2 a$ = left$(l2$,sep%) b$ = right$(l2$,len(l2$)-sep%) l2$= a$+"<span2>"+b$+"</span2>" end_if sep% = instr(l2$,"Rem ") if sep% > 0 sep% = sep%+2 a$ = left$(l2$,sep%) b$ = right$(l2$,len(l2$)-sep%) l2$= a$+"<span2>"+b$+"</span2>" end_if sep% = instr(l2$,chr$(39)+chr$(32)) if sep% > 0 a$ = left$(l2$,sep%-1) b$ = right$(l2$,len(l2$)-sep%-1) l2$= a$+"<span2>"+"' "+b$+"</span2>" end_if ' traitement des mots clés if instr(l2$,"<span2>")=0 for x% = 1 to count(Kword%) K$=item_read$(Kword%,x%) sep%=instr(l2$,k$) if sep% > 0 if mid$(l2$,sep%+len(k$),1)=chr$(32) or mid$(l2$,sep%+len(k$),1)="(" sep%=sep%-1 a$=left$(l2$,sep%) a$=a$+"<span>" sep%=sep%+len(k$) b$= right$(l2$,len(l2$)-sep%) l2$=a$+k$+"</span>"+b$ end_if else sep%=instr(l2$,lower$(k$)) if sep% > 0 if mid$(l2$,sep%+len(k$),1)=chr$(32) or mid$(l2$,sep%+len(k$),1)="(" sep%=sep%-1 a$=left$(l2$,sep%) a$=a$+"<span>" sep%=sep%+len(k$) b$= right$(l2$,len(l2$)-sep%) l2$=a$+k$+"</span>"+b$ end_if end_if end_if next x% end_if file_writeln FOW%,string$(4,chr$(9))+l2$+"<br>" l2$="" next i% file_writeln FOW%,string$(3,chr$(9))+"</Code>" file_writeln FOW%,string$(2,chr$(9))+"</Div>" file_writeln FOW%,chr$(9)+"</BODY>" file_writeln FOW%,"</HTML>" file_close FOW% END_SUB - Fichier *.css:
doit être dans le même dossier que le fichier html créé. - Code:
-
Body{ width:80%; height:auto; margin: 0 auto; }
#titre{ width:100%; height:auto; margin-top:5px; background-color: lightblue; box-shadow:2px 2px blue; border-radius:4px; font-family:Times New Roman; font-size:60px; font-weight:700; text-align:center; color:white; text-shadow:-1px -1px navy; }
#version{ width:auto; max-width:10%; height:auto; margin-top:5px; background-color: lightblue; box-shadow:2px 2px blue; border-radius:4px; font-family:Times New Roman; font-size:18px; font-weight:700; color:navy; text-shadow:-1px -1px white; padding-left:5px; }
#auteur{ width:auto; max-width:20%; height:auto; margin-top:5px; background-color: lightblue; box-shadow:2px 2px blue; border-radius:4px;
font-family:Times New Roman; font-size:18px; font-weight:700; color:navy; text-shadow:-1px -1px white; padding-left:5px; }
#description{ width:auto; max-width:20%; height:auto; margin-top:5px; background-color: lightblue; box-shadow:2px 2px blue; border-radius:4px; font-weight:700; color:navy; text-shadow:-1px -1px white; }
#source{ width:auto; max-width:100%; max-height:500px; margin-top:5px; background-color:#FFF8DC; box-shadow:2px 2px blue; border-radius:4px; overflow-x:hidden; padding-left:5px; padding-top:5px; color:black; }
#source span{ font-weight:700; color:blue; }
#source span1{ font-weight:700; color:red; }
#source span2{ font-weight:700; color:#C71585; }
- Fichier *.inf:
- Code:
-
2D_CIRCLE 2D_CLEAR 2D_FILL_COLOR 2D_FILL_CROSS 2D_FILL_DIAGONAL_CROSS 2D_FILL_DIAGONAL_DOWN 2D_FILL_DIAGONAL_UP 2D_FILL_HORIZONTAL 2D_FILL_SOLID 2D_FILL_VERTICAL 2D_FLOOD 2D_IMAGE_COPY 2D_IMAGE_PASTE 2D_LINE 2D_PEN_COLOR 2D_PEN_DASH 2D_PEN_DASH_DOT 2D_PEN_DASH_DOT_DOT 2D_PEN_DOT 2D_PEN_SOLID 2D_PEN_WIDTH 2D_POINT 2D_POLY_FROM 2D_POLY_TO 2D_RECTANGLE 2D_TARGET_IS 3D_ACTOR 3D_BOX 3D_CHAIN 3D_CHAIN_BREAK 3D_COLLISION_AS_CUBE 3D_COLLISION_AS_ELLIPSOID 3D_COLLISION_AS_FACES 3D_COLLISION_AS_POINT 3D_COLLISION_AS_SPHERE 3D_COLOR 3D_CONE 3D_CUBE 3D_CYLINDER 3D_DELETE 3D_DELETE_ALL 3D_DODECAHEDRON 3D_HIDE 3D_IMAGE_TEXTURE 3D_LINE 3D_LINE_WIDTH 3D_LOAD_OBJECT 3D_LOAD_TEXTURE 3D_LOAD_TEXTURE_BACK 3D_LOAD_TEXTURE_BOTTOM 3D_LOAD_TEXTURE_FRONT 3D_LOAD_TEXTURE_LEFT 3D_LOAD_TEXTURE_RIGHT 3D_LOAD_TEXTURE_TOP 3D_MESH 3D_MOVE 3D_PLANE 3D_POINT_OBJECT 3D_POSITION 3D_ROTATE 3D_SCALE 3D_SHOW 3D_SKYBOX 3D_SPHERE 3D_TARGET_IS 3D_TEAPOT 3D_TEXT 3D_TEXT_CHANGE 3D_TORUS 3D_TRANSPARENT 3D_U_TILE 3D_V_TILE 3D_X_POSITION 3D_X_ROTATE 3D_X_SCALE 3D_Y_POSITION 3D_Y_ROTATE 3D_Y_SCALE 3D_Z_POSITION 3D_Z_ROTATE 3D_Z_SCALE ABS ACOS ACTIVE ADR ALPHA AND APPLICATION_TITLE ASC ASIN ATN AXES_HIDE AXES_SHOW BAR_BOTH BAR_HORIZONTAL BAR_NONE BAR_VERTICAL BEEP BEEP_ERROR BEEP_EXCLAMATION BEEP_INFORMATION BEEP_QUESTION BIN_AND BIN_OR BIN_XOR BORDER_HIDE BORDER_NORMAL BORDER_SMALL BRIGHTNESS BUTTON CAM_MOVE CAM_PITCH CAM_POSITION CAM_ROLL CAM_TURN CAM_X_POSITION CAM_Y_POSITION CAM_Z_POSITION CAPTION CAPTION$ CARET_POSITION CASE CHAIN CHECK CHECKED CHR$ CLEAR CLICKED CLIPBOARD_COPY CLIPBOARD_CUT CLIPBOARD_PASTE CLIPBOARD_STRING_COPY CLIPBOARD_STRING_PASTE$ CLS COLOR COLOR_PIXEL_BLUE COLOR_PIXEL_GREEN COLOR_PIXEL_RED COMBO COMMAND_TARGET_IS CONTAINER CONTAINER_OPTION CONTRAST COS COUNT CURSOR_ARROW CURSOR_BEAM CURSOR_CROSS CURSOR_DEFAULT CURSOR_HELP CURSOR_HIDE CURSOR_HOURGLASS CURSOR_NOPARKING CURSOR_POINT DATA DATE$ DELETE DIM DIM_LOCAL DIR_CHANGE DIR_CURRENT$ DIR_DIALOG DIR_EXISTS DIR_MAKE DIR_REMOVE DISK_EXISTS DISK_KILO_FREE DISK_KILO_SIZE DISPLAY DLIST DLL_CALL0 DLL_CALL1 DLL_CALL2 DLL_CALL3 DLL_CALL4 DLL_CALL5 DLL_CALL6 DLL_OFF DLL_ON DOUBLE_CLICKED EDIT ELSE END END_IF END_SELECT END_SUB END_WHILE ERROR_ENGLISH ERROR_FRENCH ERROR_LINE ERROR_NUMBER ERROR_TYPE$ EVEN EXCEL_FILE_CLOSE EXCEL_FILE_NEW EXCEL_FILE_OPEN EXCEL_READ$ EXCEL_START EXCEL_STOP EXCEL_WRITE EXECUTE EXECUTE_WAIT EXIT_FOR EXIT_REPEAT EXIT_SUB EXIT_WHILE EXP FILE_ADD FILE_ARCHIVE FILE_ARCHIVE_OFF FILE_CLOSE FILE_COPY FILE_DELETE FILE_EOF FILE_EXISTS FILE_EXTRACT_DISK$ FILE_EXTRACT_EXTENSION$ FILE_EXTRACT_NAME$ FILE_EXTRACT_PATH$ FILE_FIND_CLOSE FILE_FIND_FIRST$ FILE_FIND_NEXT$ FILE_HIDE FILE_HIDE_OFF FILE_LOAD FILE_MOVE FILE_NAME$ FILE_OPEN_APPEND FILE_OPEN_READ FILE_OPEN_WRITE FILE_READ FILE_READ_ONLY FILE_READ_ONLY_OFF FILE_READBUF FILE_READLN FILE_READLN$ FILE_RENAME FILE_SAVE FILE_SYSTEM FILE_SYSTEM_OFF FILE_WRITE FILE_WRITEBUF FILE_WRITELN FILEBIN_BLOCK_READ FILEBIN_BLOCK_WRITE FILEBIN_CLOSE FILEBIN_HEXA_READ FILEBIN_HEXA_READ$ FILEBIN_HEXA_WRITE FILEBIN_OPEN_READ FILEBIN_OPEN_WRITE FILEBIN_POS FILEBIN_POSITION FILEBIN_READ FILEBIN_SIZE FILEBIN_WRITE FILTER FOG_COLOR FOG_DISTANCE_MAX FOG_DISTANCE_MIN FOG_OFF FOG_ON FONT_BOLD FONT_BOLD_OFF FONT_COLOR FONT_ITALIC FONT_ITALIC_OFF FONT_NAME FONT_NAMES_ADD FONT_NAMES_LOAD FONT_SIZE FONT_STRIKE FONT_STRIKE_OFF FONT_UNDERLINE FONT_UNDERLINE_OFF FOR FORM FRAC FREE FULL_SPACE GAMMA GOSUB GOTO GRID GRID_CLEAR GRID_COLUMN GRID_COLUMN_DELETE GRID_COLUMN_FIXED GRID_COLUMN_INSERT GRID_COLUMN_SIZING_OFF GRID_COLUMN_SIZING_ON GRID_COLUMN_WIDTH GRID_FIXED_COLOR GRID_LOAD GRID_ONE_COLUMN_WIDTH GRID_ONE_ROW_HEIGHT GRID_READ$ GRID_ROW GRID_ROW_DELETE GRID_ROW_FIXED GRID_ROW_HEIGHT GRID_ROW_INSERT GRID_ROW_SIZING_OFF GRID_ROW_SIZING_ON GRID_SAVE GRID_WRITE GRID_X_TO_COLUMN GRID_Y_TO_ROW HANDLE HANDLE_CANVAS HANDLE_FORM HCOS HEIGHT HEX HEX$ HIDE HINT HINT_HIDE HORIZONTAL HSIN HTAN HVIEWER IF IMAGE INACTIVE INKEY$ INPUT INPUT_MARK_OFF INPUT_MARK_ON INPUT_REDO_OFF INPUT_REDO_ON INPUT_SOURCE_IS INPUT_VISIBLE_OFF INPUT_VISIBLE_ON INSERT$ INSTR INSTR_POS INT ITEM_ADD ITEM_DELETE ITEM_INDEX ITEM_INDEX$ ITEM_INSERT ITEM_READ$ KEY_DOWN_CODE KEY_DOWN_SPECIAL KEY_UP_CODE KEY_UP_SPECIAL LABEL LEFT LEFT$ LEN LIGHT_POSITION LIGHT_X_POSITION LIGHT_Y_POSITION LIGHT_Z_POSITION LIST LOG LOG10 LOG2 LOWER$ LTRIM$ MAIL_SEND MAIN_MENU MARK_OFF MARK_ON MAX MAXIMIZE MEMO MESSAGE MESSAGE_CONFIRMATION_OK MESSAGE_CONFIRMATION_YES_NO MESSAGE_ERROR_OK MESSAGE_ERROR_YES_NO MESSAGE_INFORMATION_OK MESSAGE_INFORMATION_YES_NO MESSAGE_INPUT MESSAGE_INPUT$ MESSAGE_TEXT$ MESSAGE_WARNING_OK MESSAGE_WARNING_YES_NO MID$ MIDI_INSTRUMENT MIDI_OFF MIDI_ON MIDI_PLAY MIDI_VOLUME MIN MINIMIZE MOD MOUSE_LEFT_DOWN MOUSE_LEFT_UP MOUSE_RIGHT_DOWN MOUSE_RIGHT_UP MOUSE_X_LEFT_DOWN MOUSE_X_LEFT_UP MOUSE_X_POSITION MOUSE_X_RIGHT_DOWN MOUSE_X_RIGHT_UP MOUSE_Y_LEFT_DOWN MOUSE_Y_LEFT_UP MOUSE_Y_POSITION MOUSE_Y_RIGHT_DOWN MOUSE_Y_RIGHT_UP MOVIE NEXT NORMAL NOT NUMBER_2D_TARGET NUMBER_3D_OBJECTS NUMBER_3D_TARGET NUMBER_CHANGE NUMBER_CLICK NUMBER_COMMAND_TARGET NUMBER_CURRENT_LINE NUMBER_DOUBLE_CLICK NUMBER_EVENTS NUMBER_INPUT_SOURCE NUMBER_KEY_DOWN NUMBER_KEY_UP NUMBER_OBJECTS NUMBER_PRINT_TARGET NUMBER_SPRITE_TARGET NUMBER_SPRITES NUMBER_VARIABLES NUMERIC O3D_COLLISION O3D_OBJECT_EXISTS O3D_OBJECT_TYPE O3D_X_POSITION O3D_X_ROTATE O3D_X_SCALE O3D_Y_POSITION O3D_Y_ROTATE O3D_Y_SCALE O3D_Z_POSITION O3D_Z_ROTATE O3D_Z_SCALE OBJECT_EXISTS OBJECT_PARENT OBJECT_TYPE ODD OFF_ACTIVATE OFF_CHANGE OFF_CLICK OFF_CLOSE OFF_DOUBLE_CLICK OFF_ERROR_GOTO OFF_KEY_DOWN OFF_KEY_UP OFF_SHOW ON_ACTIVATE ON_CHANGE ON_CLICK ON_CLOSE ON_DOUBLE_CLICK ON_ERROR_GOTO ON_KEY_DOWN ON_KEY_UP ON_SHOW ON_TIMER OPEN_DIALOG OPTION OR PANEL PARALLEL_INP PARALLEL_OFF PARALLEL_ON PARALLEL_OUT PARAM_NUMBER PARAM_VALUE$ PARENT PAUSE PEEK PICTURE PLAY PLAY_WAIT POINT_OBJECT POINT_POSITION POINT_X_POSITION POINT_Y_POSITION POINT_Z_POSITION POKE POSITION POWER PRINT PRINT_LOCATE PRINT_TARGET_IS PRINT_X_LOCATE PRINT_Y_LOCATE PROGRESS_BAR READ REM REPEAT RESTORE RETURN REVERSE$ RIGHT$ RIGHT_POS$ RMDIR RND RTRIM$ SAVE_DIALOG SCANCODE SCENE2D SCENE3D SCREEN_X SCREEN_Y SCROLL_BAR SECRET_OFF SECRET_ON SELECT SELECT_READ$ SELECT_TEXT SET_FOCUS SGN SHOW SIN SORT SORT_OFF SORT_ON SOUND SPIN SPRITE SPRITE_DELETE SPRITE_DELETE_ALL SPRITE_EXISTS SPRITE_FILE_LOAD SPRITE_HIDE SPRITE_HIDE_ALL SPRITE_IMAGE_LOAD SPRITE_POSITION SPRITE_SCALE SPRITE_SHOW SPRITE_SHOW_ALL SPRITE_TARGET_IS SPRITE_X_POSITION SPRITE_X_SCALE SPRITE_Y_POSITION SPRITE_Y_SCALE SQR STEP STOP STR$ STRETCH_OFF STRETCH_ON STRING$ SUB SUB_MENU TAN TERMINATE TEXT TEXT$ TEXT_HEIGHT TEXT_WIDTH THEN TIME$ TIMER TIMER_INTERVAL TIMER_OFF TIMER_OFF_ALL TIMER_ON TO TO_BACKGROUND TO_FOREGROUND TOP TRACE_OFF TRACE_ON TRACK_BAR TRIM$ UNTIL UPPER$ VAL VARIABLE VERTICAL WAIT WHILE WIDTH OBJECT_INTERNAL SEPARATOR_IS_POINT SEPARATOR_IS_COMMA NUMBER_ACTIVATE NUMBER_SHOW TRIGGER_CLICK 2D_FILL_ON 2D_FILL_OFF ARCHIVER_ON ARCHIVER_ADD ARCHIVER_EXTRACT ARCHIVER_OFF SPRITE_CREATE_SHOW SPRITE_CREATE_HIDE WRAP_VALUE
| |
| | | papydall
Nombre de messages : 7017 Age : 74 Localisation : Moknine (Tunisie) Entre la chaise et le clavier Date d'inscription : 03/03/2012
| Sujet: Re: BAS to HTML Jeu 17 Déc 2015 - 3:20 | |
| Very good, but … Eh oui, il y a un mais ! Ligne 51 - Code:
-
dim Version$
Erreur : Name already defined. Line : 51 En effet, la version actuelle (V 0.9.27i5) définit elle-même la variable système VERSION$ qui retourne la version de PANORAMIC. J’ai modifié partout dans le code version$ par version1$ et ça a marché comme sur des roulettes. | |
| | | Jicehel
Nombre de messages : 5947 Age : 52 Localisation : 77500 Date d'inscription : 18/04/2011
| Sujet: Re: BAS to HTML Jeu 17 Déc 2015 - 7:21 | |
| En sachant que les traitements de textes gèrent le HTML, ça permetera d'avoir de beaux programmes dans les articles aussi | |
| | | Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: re Jeu 17 Déc 2015 - 18:35 | |
| @ Jicehel, Cet "Utilitaire" est en prévision pour le mag mais pas pour la rubrique "Articles"... Je pensais plutôt à une rubrique "Tutos"... @ Papydall, Je vais corriger chez moi et je remettrai en ligne avec une petite évolution dans quelques temps. | |
| | | Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: re Jeu 17 Déc 2015 - 20:59 | |
| Voilà une version ou l' on peut ajouter une description du programme avant le code source. - *.bas:
- Code:
-
' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ' BAS TO HTML VS 0.1 ' PAR ' YGERONIMI ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
hide 0 Variables() Labels() Gui() show 0
end
' ------------------------------------------------------------------------------
SUB Variables() dim Path$ : Path$=dir_current$ if right$(Path$,1)="\" : Path$=left$(Path$,len(Path$)-1) : end_if Path$=Path$+"\"
dim no% dim MM% : no%=no%+1 : MM%=no% dim SM1%: no%=no%+1 : SM1%=no% dim SRC%: no%=no%+1 : SRC%=no% dim ODG%: no%=no%+1 : ODG%=no% dim Kword% : no%=no%+1 : Kword%=no% dim F_FileInfo% : no%=no%+1 : F_FileInfo%=no% dim Alp_TIT% : no%=no%+1 : Alp_TIT% =no% dim Alp_AUT% : no%=no%+1 : Alp_AUT% =no% dim Alp_VER% : no%=no%+1 : Alp_VER% =no% dim Edi_TIT% : no%=no%+1 : Edi_TIT% =no% dim Edi_AUT% : no%=no%+1 : Edi_AUT% =no% dim Edi_VER% : no%=no%+1 : Edi_VER% =no% dim But1% : no%=no%+1 : But1% =no% dim F_description% : no%=no%+1 : F_description%=no% dim Mem_DES% : no%=no%+1 : Mem_DES% =no% dim But2% : no%=no%+1 : But2% =no% dim FOW% : no%=no%+1 : FOW% =no% dim MES% dim Change% dim KWliste$ : KWliste$ = Path$+"Panoramic.inf" dim FileSrc$ dim FileHref$ dim Title$ dim Author$ dim Vers$ END_SUB
' ------------------------------------------------------------------------------
SUB Labels() LABEL Open LABEL SaveInfo LABEL SaveDescription LABEL Change LABEL CloseInfo END_SUB
' ------------------------------------------------------------------------------
SUB Gui() Height 0,700 width 0,1200 top 0,(screen_y-height(0))/2 left 0,(screen_x-width(0))/2
MAIN_MENU MM% SUB_MENU SM1% : parent SM1%,MM% : caption SM1%,"Open" : on_click SM1%,Open
LIST SRC% full_space SRC% font_name SRC%,"Courier New" font_size SRC%,10 dlist Kword% if file_exists(KWliste$)=1 file_load Kword%,KWliste$ else MES%=message_warning_ok("Fichier des mots clés introuvable !") end_if END_SUB
' ------------------------------------------------------------------------------
Open: OPEN_DIALOG ODG% dir_dialog ODG%,":\" filter ODG%,"*.bas|*.bas" FileSrc$ = file_name$(ODG%) if fileSrc$<>"_" file_load SRC%,FileSrc$ FormFileInfo() end_if delete ODG% return
' ------------------------------------------------------------------------------
Param: if number_click = SM3% FormKeyWords() return end_if if number_click = SM4% return end_if return
' ------------------------------------------------------------------------------
SUB FormFileInfo() if object_exists(F_FileInfo%)=1 show F_FileInfo% else FORM F_FileInfo% height F_FileInfo%,220 width F_FileInfo%,400 top F_FileInfo%,(screen_y-height(F_FileInfo%))/2 left F_FileInfo%,(screen_x-width(F_FileInfo%))/2 caption F_FileInfo%,"INFOS FICHIER SOURCE" on_close F_FileInfo%,CloseInfo font_name F_FileInfo%,"Arial" font_size F_FileInfo%,8 alpha Alp_TIT% parent Alp_TIT%,F_FileInfo% top Alp_TIT%,10 left Alp_TIT%,10 caption Alp_TIT%,"Nom du programme :" edit Edi_TIT% parent Edi_TIT%,F_FileInfo% top Edi_TIT%,25 left Edi_TIT%,10 width Edi_TIT%,width(F_FileInfo%)-36 on_change Edi_TIT%,Change
alpha Alp_AUT% parent Alp_AUT%,F_FileInfo% top Alp_AUT%,50 left Alp_AUT%,10 caption Alp_AUT%,"Auteur :" edit Edi_AUT% parent Edi_AUT%,F_FileInfo% top Edi_AUT%,65 left Edi_AUT%,10 width Edi_AUT%,width(F_FileInfo%)-36 on_change Edi_AUT%,Change alpha Alp_VER% parent Alp_VER%,F_FileInfo% top Alp_VER%,90 left Alp_VER%,10 caption Alp_VER%,"Version :" edit Edi_VER% parent Edi_VER%,F_FileInfo% top Edi_VER%,105 left Edi_VER%,10 width Edi_VER%,120 button But1% parent But1%,F_FileInfo% top But1%,height(F_FileInfo%)-68 left But1%,width(F_FileInfo%)-(width(But1%)+21) caption But1%,"Next" cursor_point But1% on_click But1%,SaveInfo end_if text Edi_TIT%,"" text Edi_AUT%,"" text Edi_VER%,"" END_SUB
' ------------------------------------------------------------------------------
SaveInfo: if len(text$(Edi_TIT%))=0 or len(text$(Edi_AUT%))=0 or len(text$(Edi_VER%))=0 MES%=message_warning_Ok("Tous les champs doivent être renseignés !...") return end_if Title$ = text$(Edi_TIT%) Author$ = text$(Edi_AUT%) Vers$= text$(Edi_VER%) FileHref$ = Path$+Title$+".html" Hide F_FileInfo% FormDescription() return
' ------------------------------------------------------------------------------
Change: if variable("cp%")=0 then dim cp% change% = number_change if change% = Edi_TIT% or change% = Edi_AUT% off_change change% cp%=caret_position(change%) text change%,upper$(text$(change%)) caret_position change%,cp% on_change change%,Change return end_if return
' ------------------------------------------------------------------------------
CloseInfo: Clear SRC% return
' ------------------------------------------------------------------------------
SUB FormDescription() if object_exists(F_description%)=1 show F_description% else form F_description% height F_description%,300 width F_description%,916 top F_description%,(screen_y-height(F_description%))/2 left F_description%,(screen_x-width(F_description%))/2 Caption F_description%,"PROGRAM DESCRIPTION" Memo Mem_DES% parent Mem_DES%,F_description% width Mem_DES%,width(F_description%)-16 height Mem_DES%,210 bar_vertical Mem_DES% font_name Mem_DES%,"Times New Roman" font_size Mem_DES%,14 font_color Mem_DES%,0,0,200 Button But2% parent But2%,F_description% top But2%,height(F_description%)-68 left But2%,width(F_description%)-(width(But2%)+21) caption But2%,"Save" cursor_point But2% on_click But2%,SaveDescription end_if END_SUB
' ------------------------------------------------------------------------------
SaveDescription: hide F_description% TranslateBasToHtml() clear Mem_DES% return
' ------------------------------------------------------------------------------
SUB TranslateBasToHtml() dim_local i%,l$,x%,car$,vcar%,l2$,sep%,sep2%,a$,b$,c$,d$,k$ for i%=1 to count(SRC%) l$=item_read$(SRC%,i%) l$=l$+chr$(32) item_delete SRC%,i% item_insert SRC%,i%,l$ next i% file_open_write FOW%,FileHref$ file_writeln FOW%,"<!DOCTYPE HTML>" file_writeln FOW%,"<HTML>" file_writeln FOW%,chr$(9)+"<HEAD>" file_writeln FOW%,string$(2,chr$(9))+"<TITLE>"+Title$+"</TITLE>" file_writeln FOW%,string$(2,chr$(9))+"<META http-equiv="+chr$(34)+"Content-Type"+chr$(34)+" content="+chr$(34)+"text/html; charset=UTF-8"+chr$(34)+"/>" file_writeln FOW%,string$(2,chr$(9))+"<META name="+chr$(34)+"author"+chr$(34)+" content="+chr$(34)+Author$+chr$(34)+"/>" file_writeln FOW%,string$(2,chr$(9))+"<META name="+chr$(34)+"description"+chr$(34)+" content="+chr$(34)+"Version "+Vers$+chr$(34)+">" file_writeln FOW%,string$(2,chr$(9))+"<LINK href="+chr$(34)+"Panoramic.css"+chr$(34)+" rel="+chr$(34)+"stylesheet"+chr$(34)+" type="+chr$(34)+"text/css"+chr$(34)+">" file_writeln FOW%,chr$(9)+"</HEAD>" file_writeln FOW%,chr$(9)+"<BODY>" file_writeln FOW%,string$(2,chr$(9))+"<Div id="+chr$(34)+"titre"+chr$(34)+">" file_writeln FOW%,string$(2,chr$(9))+title$ file_writeln FOW%,string$(2,chr$(9))+"</Div>" file_writeln FOW%,string$(2,chr$(9))+"<Div id="+chr$(34)+"version"+chr$(34)+">" file_writeln FOW%,string$(2,chr$(9))+"Version : "+Vers$ file_writeln FOW%,string$(2,chr$(9))+"</Div>" file_writeln FOW%,string$(2,chr$(9))+"<Div id="+chr$(34)+"auteur"+chr$(34)+">" file_writeln FOW%,string$(2,chr$(9))+"Auteur : "+Author$ file_writeln FOW%,string$(2,chr$(9))+"</Div>" file_writeln FOW%,string$(2,chr$(9))+"<Div id="+chr$(34)+"description"+chr$(34)+">" if count(Mem_DES%)>0 for i%=1 to count(Mem_DES%) l$=item_read$(Mem_DES%,i%) ' traitement des caractères accentués for x%=1 to len(l$) car$ = mid$(l$,x%,1) vcar% = asc(car$) if vcar% = 233 or vcar% = 232 or vcar% = 234 or vcar% = 235 : vcar% = 101 : end_if if vcar% = 224 : vcar% = 97 : end_if if vcar% = 249 : vcar% = 117 : end_if l2$= l2$+ chr$(vcar%) next x% file_writeln FOW%,string$(2,chr$(9))+l2$+"<br>" l2$="" next i% end_if file_writeln FOW%,string$(2,chr$(9))+"</Div>" file_writeln FOW%,string$(2,chr$(9))+"<Div id="+chr$(34)+"source"+chr$(34)+">" file_writeln FOW%,string$(3,chr$(9))+"<Code>" for i%=1 to count(SRC%) caption 0,str$(i%)+" / "+str$(count(SRC%)) l$=item_read$(SRC%,i%)
' traitement des caractères accentués for x%=1 to len(l$) car$ = mid$(l$,x%,1) vcar% = asc(car$) if vcar% = 233 or vcar% = 232 or vcar% = 234 or vcar% = 235 : vcar% = 101 : end_if if vcar% = 224 : vcar% = 97 : end_if if vcar% = 249 : vcar% = 117 : end_if l2$= l2$+ chr$(vcar%) next x% ' traitement des textes sep% = instr(l2$,chr$(34)) if sep% > 0 a$=left$(l2$,sep%-1) a$=a$+"<span1>"+chr$(34) b$=right$(l2$,len(l2$)-sep%) sep2% = instr(b$,chr$(34)) if sep2% > 0 c$=left$(b$,sep2%) c$=c$+"</span1>" d$=right$(b$,len(b$)-sep2%) end_if l2$=a$+c$+d$ end_if ' traitement des commentaires sep% = instr(l2$,"rem ") if sep% > 0 sep% = sep%+2 a$ = left$(l2$,sep%) b$ = right$(l2$,len(l2$)-sep%) l2$= a$+"<span2>"+b$+"</span2>" end_if sep% = instr(l2$,"REM ") if sep% > 0 sep% = sep%+2 a$ = left$(l2$,sep%) b$ = right$(l2$,len(l2$)-sep%) l2$= a$+"<span2>"+b$+"</span2>" end_if sep% = instr(l2$,"Rem ") if sep% > 0 sep% = sep%+2 a$ = left$(l2$,sep%) b$ = right$(l2$,len(l2$)-sep%) l2$= a$+"<span2>"+b$+"</span2>" end_if sep% = instr(l2$,chr$(39)+chr$(32)) if sep% > 0 a$ = left$(l2$,sep%-1) b$ = right$(l2$,len(l2$)-sep%-1) l2$= a$+"<span2>"+"' "+b$+"</span2>" end_if ' traitement des mots clés if instr(l2$,"<span2>")=0 for x% = 1 to count(Kword%) K$=item_read$(Kword%,x%) sep%=instr(l2$,k$) if sep% > 0 if mid$(l2$,sep%+len(k$),1)=chr$(32) or mid$(l2$,sep%+len(k$),1)="(" sep%=sep%-1 a$=left$(l2$,sep%) a$=a$+"<span>" sep%=sep%+len(k$) b$= right$(l2$,len(l2$)-sep%) l2$=a$+k$+"</span>"+b$ end_if else sep%=instr(l2$,lower$(k$)) if sep% > 0 if mid$(l2$,sep%+len(k$),1)=chr$(32) or mid$(l2$,sep%+len(k$),1)="(" sep%=sep%-1 a$=left$(l2$,sep%) a$=a$+"<span>" sep%=sep%+len(k$) b$= right$(l2$,len(l2$)-sep%) l2$=a$+k$+"</span>"+b$ end_if end_if end_if next x% end_if file_writeln FOW%,string$(4,chr$(9))+l2$+"<br>" l2$="" next i% file_writeln FOW%,string$(3,chr$(9))+"</Code>" file_writeln FOW%,string$(2,chr$(9))+"</Div>" file_writeln FOW%,chr$(9)+"</BODY>" file_writeln FOW%,"</HTML>" file_close FOW% END_SUB
' ------------------------------------------------------------------------------
le css qui pourrait servir dans Le Mag - *.css:
- Code:
-
Body{ width:80%; max-width:900px; height:auto; margin: 0 auto; }
#titre{ width:100%; height:auto; margin-top:5px; background-color: maroon; box-shadow:2px 2px #C06868; border-radius:4px; font-family:Times New Roman; font-size:60px; font-weight:700; text-align:center; color:white; text-shadow:-2px -2px #E9967A; }
#version{ width:auto; max-width:120px; height:auto; margin-top:5px; background-color: maroon; box-shadow:2px 2px #C06868; border-radius:4px; font-family:Times New Roman; font-size:18px; font-weight:700; color:#FFF8DC; text-shadow:-1px -1px #E9967A; padding-left:5px; }
#auteur{ width:auto; max-width:300px; height:auto; margin-top:5px; background-color: maroon; box-shadow:2px 2px #C06868; border-radius:4px;
font-family:Times New Roman; font-size:18px; font-weight:700; color:white; text-shadow:-1px -1px #E9967A; padding-left:5px; }
#description{ width:100%; height:auto; max-height:100px; margin-top:5px; background-color: white; box-shadow:2px 2px #C06868; border:solid 1px maroon; border-radius:4px; overflow-x:hidden; font-family:Times New Roman; font-size:16px; font-weight:700; color:navy; padding-left:5px; }
#source{ width:100%; max-height:350px; margin-top:5px; background-color:#FFF8DC; box-shadow:2px 2px #C06868; border:solid 1px maroon; border-radius:4px; overflow-x:hidden; padding-left:5px; padding-top:5px; color:black; }
#source span{ font-weight:700; color:blue; }
#source span1{ font-weight:700; color:red; }
#source span2{ font-weight:700; color:#C71585; }
| |
| | | Contenu sponsorisé
| Sujet: Re: BAS to HTML | |
| |
| | | | BAS to HTML | |
|
Sujets similaires | |
|
| Permission de ce forum: | Vous ne pouvez pas répondre aux sujets dans ce forum
| |
| |
| |