home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
htmepm98.zip
/
HTMLTAGS.E
< prev
next >
Wrap
Text File
|
1995-09-02
|
34KB
|
1,041 lines
compile if not defined(SMALL) -- If SMALL not defined, then being separately compiled
define INCLUDING_FILE = 'HTMLTAGS.E'
const
compile if not defined(SITE_CONFIG)
const SITE_CONFIG = 'SITECNF.E'
compile endif
compile if SITE_CONFIG
tryinclude SITE_CONFIG
compile endif
compile endif
const
compile if not defined(WANT_DYNAMIC_PROMPTS)
WANT_DYNAMIC_PROMPTS = 1
compile endif
const
HTMLVERSION= '0.98'
HTMLTAGS_BAR__MSG = 'H~TML '
TITLE_MENU_MSG = '~Title Ctrl+T'
CENTER_MENU_MSG = '~Center Ctrl+C'
COMMENTS_MENU_MSG = 'C~omment Ctrl+O'
SEPARATORS_MENU_MSG = 'S~eparators'
PARAGRAPH_MENU__MSG = '~Paragraph Ctrl+P'
PARAGRAPHP_MENU__MSG = 'P~aragraph HTML+ Ctrl+-'
FORCEDLINE_MENU_MSG = 'Forced Line ~Break Ctrl+B'
HORIZONTALRULE_MENU_MSG = '~Horizontal rule Ctrl+H'
ANCHOR_MENU_MSG = 'Lin~k to Ctrl+K'
IMAGE_MENU_MSG = '~Image Inline Ctrl+I'
TARGET_MENU_MSG= 'Anchor Tar~get Ctrl+G'
HEADINGS_MENU__MSG = '~Headings'
HEAD1_MENU__MSG = 'Heading ~1 Ctrl+1'
HEAD2_MENU__MSG = 'Heading ~2 Ctrl+2'
HEAD3_MENU__MSG = 'Heading ~3 Ctrl+3'
HEAD4_MENU__MSG = 'Heading ~4 Ctrl+4'
HEAD5_MENU__MSG = 'Heading ~5 Ctrl+5'
HEAD6_MENU__MSG = 'Heading ~6 Ctrl+6'
STYLES_MENU_MSG = '~Styles'
LOGICAL_MENU_MSG = 'Logical St~yles'
EM_MENU__MSG = '~Emphasize'
STRONG_MENU_MSG = '~Strong emphasize'
PREFORMAT_MENU_MSG = '~Preformated Text'
ADDRESS_MENU_MSG = '~Address'
PHYSICAL_MENU__MSG = '~Physical styles'
UNDERLINE_MENU__MSG = '~Underline'
ITALIC_MENU__MSG = '~Italic'
BOLD_MENU__MSG = '~Bold'
TYPEWRITER_MENU__MSG = '~Typewriter'
LISTS_MENU_MSG = '~Lists'
LIST_ITEM_MENU__MSG = 'List ~Item Ctrl+L'
OLIST_MENU__MSG = '~Ordered list'
ULIST_MENU__MSG = '~Unordered list'
DIR_MENU__MSG = '~Directory List'
SLIST_MENU__MSG = '~Menu list'
DLIST_MENU__MSG = 'Definition ~List'
DLISTTERM_MENU_MSG = 'Definition List ~Term'
DLISTDEF_MENU_MSG = 'De~finition List Definition'
TABLA_MENU_MSG = 'Ta~ble'
SPECIAL_MENU_MSG = 'Speci~al Characters'
LEFTANGLE_MENU_MSG = '~<'
RIGHTANGLE_MENU_MSG = '~>'
A_ACUTE_MENU_MSG = 'á '
E_ACUTE_MENU_MSG = 'é '
I_ACUTE_MENU_MSG = 'í '
O_ACUTE_MENU_MSG = 'ó '
U_ACUTE_MENU_MSG = 'ú '
AMPERSAND_MENU_MSG = 'Am~persand'
QUOTES_MENU_MSG = '~Quotes'
TILDE_MENU_MSG = '~Tilde'
ACCENT_MENU_MSG = '~Acute accent'
FORMS_MENU_MSG = '~Forms'
DEFFORMS_MENU_MSG = '~Define Form'
INPUTFIELD_MENU_MSG = '~Input field'
SELECTFIELD_MENU_MSG = '~Select field'
SELECTOPTION_MENU_MSG = 'Select ~Option'
TEXTAREA_MENU_MSG = '~Text area'
DOC_MENU__MSG = 'Docu~ments'
HTMLDOC_MENU__MSG = '~Basic HTML doc'
PREVIEW_MENU__MSG = 'Pre~view'
ATTR_ON_MENU__MSG = 'Tags Hightlight On'
ATTR_OFF_MENU__MSG = 'Tags Hightlight Off'
ABOUT_MENU_MSG = 'Abo~ut...'
compile if WANT_DYNAMIC_PROMPTS
HTMLTAGS_BARP__MSG = \1'Create HTLM tags'
TITLE_MENUP_MSG = \1'Insert Title TAG '
CENTER_MENUP__MSG = \1'Center the text'
COMMENTS_MENUP_MSG = \1'Mark selected text as comment'
SEPARATORS_MENUP_MSG = \1'Paragraphs, Line Breaks & Rules'
PARAGRAPH_MENUP__MSG = \1'Insert a Paragraph tag'
PARAGRAPHP_MENUP__MSG = \1'Insert a Paragraph tag in HTML+'
FORCEDLINE_MENUP_MSG = \1'Insert a Forced Line Break'
HORIZONTALRULE_MENUP_MSG = \1'Insert an horizontal rule'
ANCHOR_MENUP_MSG = \1'Create a link'
IMAGE_MENUP_MSG = \1'Insert an image'
TARGET_MENUP_MSG = \1'Define a named anchor'
HEADINGS_MENUP__MSG = \1'Select size of a heading'
HEAD1_MENUP__MSG = \1'Select heading size 1'
HEAD2_MENUP__MSG = \1'Select heading size 2'
HEAD3_MENUP__MSG = \1'Select heading size 3'
HEAD4_MENUP__MSG = \1'Select heading size 4'
HEAD5_MENUP__MSG = \1'Select heading size 5'
HEAD6_MENUP__MSG = \1'Select heading size 6'
STYLES_MENUP_MSG = \1'Select the text style '
LOGICAL_MENUP_MSG = \1'Select between logical styles'
EM_MENUP__MSG = \1'Set emphasized style for selected text'
STRONG_MENUP_MSG = \1'Set strong emphasized style for selected text'
PREFORMAT_MENUP_MSG = \1'Let the selected text "as it is"'
ADDRESS_MENUP_MSG = \1'Render text as "address"'
PHYSICAL_MENUP__MSG = \1'Select physical style'
UNDERLINE_MENUP__MSG =\1'Set underline style for the selected text'
ITALIC_MENUP__MSG = \1'Set italic style for the selected text'
BOLD_MENUP__MSG = \1'Select bold style for the selected text'
TYPEWRITER_MENUP__MSG = \1'Select typewriter style for the selected text'
LISTS_MENUP_MSG = \1'Lists related tags'
LIST_ITEM_MENUP__MSG = \1'Create a list item'
OLIST_MENUP__MSG = \1'Create an ordered list'
ULIST_MENUP__MSG = \1'Create an unordered list'
DIR_MENUP__MSG = \1'Create a directory list'
SLIST_MENUP__MSG = \1'Create a menu list'
DLIST_MENUP__MSG = \1'Create a definition list'
DLISTTERM_MENUP_MSG = \1'Insert a definition list term tag'
DLISTDEF_MENUP_MSG = \1'Insert a definition list definition tag'
SPECIAL_MENUP_MSG = \1'Insert Special Characters'
LEFTANGLE_MENUP_MSG = \1'Insert a left angle sign'
RIGHTANGLE_MENUP_MSG = \1'Insert a right angle sign'
AMPERSAND_MENUP_MSG = \1 'Insert the Ampersand sign'
QUOTES_MENUP_MSG = \1'Insert a double Quotes sign'
TILDE_MENUP_MSG = \1'Tilde'
ACCENT_MENUP_MSG = \1'Acute accent'
FORMS_MENUP_MSG = \1'HTML Forms Interface'
DEFFORMS_MENUP_MSG = \1'Define a Form'
INPUTFIELD_MENUP_MSG = \1'Define an Input field'
SELECTFIELD_MENUP_MSG = \1'Define a Select field'
SELECTOPTION_MENUP_MSG = \1'Define a Select field Option'
TEXTAREA_MENUP_MSG = \1'Define a Text Area'
DOC_MENUP__MSG = \1'Creating HTML Documents'
HTMLDOC_MENUP__MSG = \1'Create a Basic HTML Doc'
PREVIEW_MENUP__MSG = \1'View file with WebExplorer'
ATTR_ON_MENUP__MSG = \1'Set color hightlight of HTML tags'
ATTR_OFF_MENUP__MSG = \1'Unset color hightlight of HTML tags'
compile else
HTMLTAGS_BARP__MSG = ''
TITLE_MENUP_MSG = ''
CENTER_MENUP__MSG=''
COMMENTS_MENUP_MSG= ''
SEPARATORS_MENUP_MSG = ''
PARAGRAPH_MENUP__MSG = ''
PARAGRAPHP_MENUP__MSG =''
FORCEDLINE_MENUP_MSG = ''
HORIZONTALRULE_MENUP_MSG = ''
ANCHOR_MENUP_MSG = ''
IMAGE_MENUP_MSG = ''
TARGET_MENUP_MSG= ''
HEADINGS_MENUP__MSG = ''
HEAD1_MENUP__MSG = ''
HEAD2_MENUP__MSG = ''
HEAD3_MENUP__MSG = ''
HEAD4_MENUP__MSG = ''
HEAD5_MENUP__MSG = ''
HEAD6_MENUP__MSG = ''
STYLES_MENUP_MSG = ''
LOGICAL_MENUP_MSG = ''
EM_MENUP__MSG = ''
STRONG_MENUP_MSG = ''
PREFORMAT_MENUP_MSG = ''
PHYSICAL_MENUP__MSG = ''
UNDERLINE_MENUP__MSG = ''
ITALIC_MENUP__MSG = ''
BOLD_MENUP__MSG = ''
TYPEWRITER_MENUP__MSG = ''
LISTS_MENUP_MSG = ''
LIST_ITEM_MENUP__MSG = ''
OLIST_MENUP__MSG = ''
ULIST_MENUP__MSG = ''
DIR_MENUP__MSG = ''
SLIST_MENUP__MSG = ''
DLIST_MENUP__MSG = ''
DLISTTERM_MENUP_MSG = ''
DLISTDEF_MENUP_MSG = ''
SPECIAL_MENUP_MSG = ''
LEFTANGLE_MENUP_MSG = ''
RIGHTANGLE_MENUP_MSG = ''
AMPERSAND_MENUP_MSG = ''
QUOTES_MENUP_MSG = ''
TILDE_MENUP_MSG = ''
ACCENT_MENUP_MSG = ''
FORMS_MENUP_MSG = ''
DEFFORMS_MENUP_MSG =''
INPUTFIELD_MENUP_MSG = ''
SELECTFIELD_MENUP_MSG = ''
SELECTOPTION_MENUP_MSG = ''
TEXTAREA_MENUP_MSG = ''
DOC_MENUP__MSG = ''
HTMLDOC_MENUP__MSG = ''
PREVIEW_MENUP__MSG = ''
ATTR_ON_MENUP__MSG = ''
ATTR_OFF_MENUP__MSG = ''
compile endif
definit
universal defaultmenu, activemenu
universal activeaccel
universal HTML_tags_menu_flag
universal High_ON
deletemenu defaultmenu, 6, 0, 0 -- delete the existing Help menu (we want it to stay at the right)
buildsubmenu defaultmenu, 80, HTMLTAGS_BAR__MSG, ' ', 0, 0
buildmenuitem defaultmenu, 80, 8000,TITLE_MENU_MSG,'HTML_EM TITLE'TITLE_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8001,CENTER_MENU_MSG,'HTML_EM CENTER'CENTER_MENUP__MSG,0,0
buildmenuitem defaultmenu, 80, 8002,COMMENTS_MENU_MSG,'HTML_COMMENTS'COMMENTS_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8003,\0,'',4,0
buildmenuitem defaultmenu, 80, 8004,SEPARATORS_MENU_MSG,SEPARATORS_MENUP_MSG,17,0
buildmenuitem defaultmenu, 80, 8005,PARAGRAPH_MENU__MSG,'HTML_P'PARAGRAPH_MENUP__MSG,0,0
buildmenuitem defaultmenu, 80, 8006,PARAGRAPHP_MENU__MSG,'HTML_EM P'PARAGRAPHP_MENUP__MSG,0,0
buildmenuitem defaultmenu, 80, 8007,FORCEDLINE_MENU_MSG,'HTML_INL <BR>'FORCEDLINE_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8008,HORIZONTALRULE_MENU_MSG,'HTML_INL <HR>'HORIZONTALRULE_MENUP_MSG,32769,0
buildmenuitem defaultmenu, 80, 8009,\0,'',4,0
buildmenuitem defaultmenu, 80, 8010,ANCHOR_MENU_MSG,'HTML_ANCHOR'ANCHOR_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8011,IMAGE_MENU_MSG,'HTML_IMAGE'IMAGE_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8012,TARGET_MENU_MSG,'HTML_TARGET'TARGET_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8019,\0,'',4,0
buildmenuitem defaultmenu, 80, 8020, HEADINGS_MENU__MSG, HEADINGS_MENUP__MSG, 17, 0
buildmenuitem defaultmenu, 80, 8021, HEAD1_MENU__MSG, 'HTML_EM H1'HEAD1_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8022, HEAD2_MENU__MSG, 'HTML_EM H2'HEAD2_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8023, HEAD3_MENU__MSG, 'HTML_EM H3'HEAD3_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8024, HEAD4_MENU__MSG, 'HTML_EM H4'HEAD4_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8025, HEAD5_MENU__MSG, 'HTML_EM H5'HEAD5_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8026, HEAD6_MENU__MSG, 'HTML_EM H6'HEAD6_MENUP__MSG, 32769, 0
buildmenuitem defaultmenu, 80, 8030, LOGICAL_MENU_MSG, LOGICAL_MENUP_MSG,17,0
buildmenuitem defaultmenu, 80, 8031, EM_MENU__MSG,'HTML_EM EM'EM_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8032, STRONG_MENU_MSG, 'HTML_EM STRONG'STRONG_MENUP_MSG, 0, 0
buildmenuitem defaultmenu, 80, 8033, PREFORMAT_MENU_MSG,'HTML_EM PRE'PREFORMAT_MENUP_MSG, 0,0
buildmenuitem defaultmenu, 80, 8034, ADDRESS_MENU_MSG,'HTML_EM ADDRESS'ADDRESS_MENUP_MSG,32769,0
buildmenuitem defaultmenu, 80, 8035, PHYSICAL_MENU__MSG,PHYSICAL_MENUP__MSG, 17, 0
buildmenuitem defaultmenu, 80, 8036, UNDERLINE_MENU__MSG, 'HTML_EM U'UNDERLINE_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8037, ITALIC_MENU__MSG, 'HTML_EM I'ITALIC_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8038, BOLD_MENU__MSG, 'HTML_EM B'BOLD_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8039, TYPEWRITER_MENU__MSG, 'HTML_EM TT'TYPEWRITER_MENUP__MSG, 32769, 0
buildmenuitem defaultmenu, 80, 8040, LISTS_MENU_MSG, LISTS_MENUP_MSG,17,0
buildmenuitem defaultmenu, 80, 8041, LIST_ITEM_MENU__MSG, 'HTML_I <LI>'LIST_ITEM_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8042, OLIST_MENU__MSG, 'HTML_LIST OL'OLIST_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8043, ULIST_MENU__MSG, 'HTML_LIST UL'ULIST_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8044, DIR_MENU__MSG,'HTML_LIST DIR'DIR_MENUP__MSG,0,0
buildmenuitem defaultmenu, 80, 8045, SLIST_MENU__MSG, 'HTML_LIST MENU'SLIST_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8046, DLIST_MENU__MSG, 'HTML_LIST DL'DLIST_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 80, 8047, DLISTTERM_MENU_MSG,'HTML_I <DT>'DLISTTERM_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8048, DLISTDEF_MENU_MSG,'HTML_I <DD>'DLISTDEF_MENUp_MSG,32769,0
buildmenuitem defaultmenu, 80, 8049, TABLA_MENU_MSG,'tabla',0,0
buildmenuitem defaultmenu, 80, 8050, \0,'',4, 0
buildmenuitem defaultmenu, 80, 8051,SPECIAL_MENU_MSG,SPECIAL_MENUP_MSG,17,0
buildmenuitem defaultmenu, 80, 8052,LEFTANGLE_MENU_MSG,'HTML_I <'LEFTANGLE_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8053,RIGHTANGLE_MENU_MSG,'HTML_I >'RIGHTANGLE_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8054,AMPERSAND_MENU_MSG,'HTML_I &'AMPERSAND_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8055,QUOTES_MENU_MSG,'HTML_I "'QUOTES_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8056,TILDE_MENU_MSG,'HTML_ACC tilde;'TILDE_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8057,ACCENT_MENU_MSG,'HTML_ACC acute'ACCENT_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8058,A_ACUTE_MENU_MSG,'HTML_I á',0,0
buildmenuitem defaultmenu, 80, 8059,E_ACUTE_MENU_MSG,'HTML_I é',0,0
buildmenuitem defaultmenu, 80, 8060,I_ACUTE_MENU_MSG,'HTML_I í',0,0
buildmenuitem defaultmenu, 80, 8061,O_ACUTE_MENU_MSG,'HTML_I ó',0,0
buildmenuitem defaultmenu, 80, 8062,U_ACUTE_MENU_MSG,'HTML_I ú',32769,0
buildmenuitem defaultmenu, 80, 8069,\0,'',4,0
buildmenuitem defaultmenu, 80, 8070, FORMS_MENU_MSG,FORMS_MENUP_MSG,17,0
buildmenuitem defaultmenu, 80, 8071, DEFFORMS_MENU_MSG,'HTML_FORM'DEFFORMS_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8072, INPUTFIELD_MENU_MSG,'HTML_INPUT'INPUTFIELD_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8073, SELECTFIELD_MENU_MSG,'HTML_SELECT'SELECTFIELD_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8074, SELECTOPTION_MENU_MSG, 'HTML_OPTION'SELECTOPTION_MENUP_MSG,0,0
buildmenuitem defaultmenu, 80, 8075, TEXTAREA_MENU_MSG, 'HTML_TEXTAREA'TEXTAREA_MENUP_MSG, 32769,0
buildmenuitem defaultmenu, 80, 8089, \0,'',4,0
buildmenuitem defaultmenu, 80, 8090, DOC_MENU__MSG,DOC_MENUP__MSG, 17, 0
buildmenuitem defaultmenu, 80, 8091, HTMLDOC_MENU__MSG, 'HTML_HTMLDOC'HTMLDOC_MENUP__MSG, 32769, 0
buildmenuitem defaultmenu, 80, 8092, PREVIEW_MENU__MSG,'PREVIEW'PREVIEW_MENUP__MSG,0,0
buildmenuitem defaultmenu, 80, 8093, \0,'',4,0
buildmenuitem defaultmenu, 80, 8101, ABOUT_MENU_MSG,'HTML_ABOUT',0,0
buildmenuitem defaultmenu, 80, 8109, \0,'',4,0
buildmenuitem defaultmenu, 80, 8111, ATTR_ON_MENU__MSG,'ATTRON'ATTR_ON_MENUP__MSG,0,0
buildmenuitem defaultmenu, 80, 8119, ATTR_OFF_MENU__MSG,'ATTROFF'ATTR_OFF_MENUP__MSG,0,8192
call readd_help_menu()
HTML_tags_menu_flag = 1
compile if EVERSION > '5.52'
call register_mousehandler(1,'2 CLICK 4','POPUP_MENU')
compile else
call register_mousehandler(1,'2 CLICK 0','POPUP_MENU')
compile endif
keys html_keys
call InitVars()
defexit
universal defaultmenu, activemenu
deletemenu defaultmenu,80,0,0
call maybe_show_menu()
HTML_tags_menu_flag = 0
defkeys html_keys overlay
def C_P = 'HTML_P'
def C_B = 'HTML_INL <BR>'
def C_H = 'HTML_INL <HR>'
def C_O = 'HTML_COMMENTS'
def C_C = 'HTML_EM CENTER'
def C_I = 'HTML_IMAGE'
def C_1 = 'HTML_EM H1'
def C_2 = 'HTML_EM H2'
def C_3 = 'HTML_EM H3'
def C_4 = 'HTML_EM H4'
def C_5 = 'HTML_EM H5'
def C_6 = 'HTML_EM H6'
def C_K = 'HTML_ANCHOR'
def C_T = 'HTML_EM TITLE'
def C_G = 'HTML_TARGET'
def C_MINUS = 'HTML_EM P'
def C_L = 'HTML_I <LI>'
compile if EVERSION = '5.51a'
def 'á' = 'HTML_I á'
def 'é' = 'HTML_I é'
def 'í' = 'HTML_I í'
def 'ó' = 'HTML_I ó'
def 'ú' = 'HTML_I ú'
compile endif
defload
universal High_ON
if pos(".htm",.filename) or pos(".html",.filename)then
keys html_keys
if High_ON then
call HILITE(1,.last)
endif
endif
defproc InitVars()
universal High_ON, High_Color
High_ON = 0
High_Color = .textcolor
defc HTML_P
universal High_ON
if .col = 1 then
keyin '<P>'
else
keyin '<P>'
insert
.col=1
endif
defc HTML_I
universal High_ON
l1 = .line
keyin arg(1)
l2 = .line
if High_ON then call HILITE(l1,l2) endif
defc HTML_INL
universal High_ON
l1 = .line
keyin arg(1)
insert
.col = 0
l2 = .line
if High_ON then call HILITE(l1,l2) endif
defc HTML_IML
universal High_ON
l1 = .line
parse value strip(arg(1),'L') with delim 2 rest
nextline = .line+1
do while rest <> ''
parse value rest with line (delim) rest
insertline line, nextline
nextline = nextline + 1
enddo
l2=.line
'+2'
end_line
.line = .line-1
l2 = .line
if High_ON then call HILITE(l1,l2) endif
defc HTML_LIST
tag=arg(1)
if tag=='DL' then
param ='|<'tag'>|<DT>|</'tag'>|'
else
param ='|<'tag'>|<LI>|</'tag'>|'
endif
'HTML_IML 'param
'+1'
defc HTML_COMMENTS
universal High_ON
l1 = .line
if marktype() then
call HTML_insert_tags('<!-- ',' -->')
call pend_mark()
unmark
.col=.col+4
else
keyin('<!-- -->')
.col=.col - 3
l2=.line
if High_ON then call HILITE(l1,l2) endif
endif
defc HTML_EM
universal High_ON
l1 = .line
tag = arg(1)
if marktype() then
getmark firstline,lastline,firstcol,lastcol,fileid
call HTML_insert_tags('<'tag'>','</'tag'>')
call pend_mark()
unmark
.col = .col + length(tag) + 3
else
keyin('<'tag'></'tag'>')
.col = .col - length(tag)-3
l2 = .line
if High_ON then call HILITE(l1,l2) endif
endif
defproc HTML_insert_tags(start_tag, end_tag)
universal High_ON
l1 = .line
mt = marktype()
if pos(leftstr(mt,1), 'BC') then -- Block or Character mark
getfileid fid
getmark firstline,lastline,firstcol,lastcol,fileid
if fid<>fileid then
sayerror 'Wrong file - check mark'
return
endif
else
firstline = .line; lastline = .line;
call pend_word(); lastcol = .col
call pbegin_word(); firstcol = .col
endif
.col=lastcol+1
lastline
i_s = insert_state()
if not i_s then insert_toggle; endif
keyin end_tag
firstline
.col=firstcol
keyin start_tag
if pos(leftstr(mt,1), 'BC') then -- Block or Character mark
l = length(start_tag)+1
call pset_mark(firstline, lastline, firstcol+l, lastcol+(l*(lastline=firstline)), mt, fileid)
endif
if not i_s then insert_toggle; endif
l2=.line
if High_ON then call HILITE(l1,l2) endif
defc HTML_HTMLDOC
universal High_ON
'HTML_IML |<HTML>|<HEAD>|<TITLE></TITLE>|</HEAD>| |<BODY> | |</BODY>|</HTML>'
'+2'
.col = 8
if High_ON then call HILITE(1,.last) endif
defc HTML_ANCHOR
universal High_ON
l1=.line
linktype = listbox("Select Link to ...",
"/anchor in this page/local file/anchor in local file/http/mailto/gopher/ftp/news/WAIS/Telnet","/Enter/Cancel" ,8,36,10)
if linktype == '' then
return
endif
if linktype == 'anchor in local file' then
filename = entrybox('Enter Filename')
if filename == '' then return; endif
targetname = entrybox('Enter Target name')
if targetname == '' then return; endif
linktype = filename'#'targetname
usertxt = ""
else if linktype == 'local file' then
linktype = ''
usertxt = entrybox('Enter Name of Link')
else if linktype == 'anchor in this page' then
linktype = "#"
usertxt = entrybox('Enter target name')
else if linktype == 'mailto' then
linktype = 'mailto:'
usertxt=entrybox("Address to mailto: ")
else
linktype = linktype'://'
usertxt = entrybox("Enter full URL",,linktype)
linktype =''
endif
endif endif
if usertxt == '' then
return
endif
endif
start_tag = '<A HREF="'||linktype||usertxt||'">'
end_tag = '</A>'
if marktype() then
call HTML_insert_tags(start_tag,end_tag)
call pend_mark()
unmark
.col=.col+length(end_tag)
else
keyin start_tag
keyin end_tag
l2 = .line
.col = .col - length(end_tag)
if High_ON then call HILITE(l1,l2) endif
endif
defc HTML_TARGET
universal High_ON
usertxt = entrybox('Enter Anchor name')
if usertxt == "" then
return
endif
start_tag = '<A NAME="'usertxt'">'
end_tag = '</A>'
if marktype() then
call HTML_insert_tags(start_tag,end_tag)
call pend_mark()
unmark
.col=.col+length(end_tag)
else
l1 = .line
keyin start_tag
keyin end_tag
l2 = .line
if High_ON then call HILITE(l1,l2) endif
.col = .col-4
endif
defc HTML_IMAGE
universal High_ON
usertxt = entrybox('Enter Image Name')
if usertxt == '' then
return
endif
punto=lastpos('.',usertxt)
if punto then
alttext=substr(usertxt,1,punto-1)
else
alttext=usertxt
endif
alttext = entrybox("Alternative text for non graphics display",,alttext)
imag_pos = listbox("Image Alignment","/BOTTOM/MIDDLE/TOP/",,6,50)
if imag_pos == '' then
return
endif
IsMap = listbox("Image Map ?","/No/Yes/",,6,50)
if IsMap=="Yes" then
Ismap="ISMAP"
else
IsMap=""
endif
l1=.line
keyin '<IMG SRC="'usertxt'" ALIGN="'imag_pos'" ALT="'alttext'"' IsMap'>'
l2=.line
if High_ON then call HILITE(l1,l2) endif
defc HTML_ACC
mcol = .col
letter = get_char()
if pos(letter,'AEIOUaeiou') then
keyin '&'
.col = .col + 1
keyin arg(1)';'
else if pos(letter,'Nn') then
keyin '&'
.col=.col+1
keyin arg(1)
else
sayerror("Invalid Character for accent in HTML")
return
endif endif
defproc get_char
universal linepos,colpos,target
colpos = .col
linepos = .line
getline target
return substr(target,.col,1)
defc HTML_FORM
universal High_ON
action = entrybox('URL of program that will process the form')
method = listbox("Request Method",
"/POST/GET/HEAD/PUT/DELETE/LINK/UNLINK/",,6,40,7)
if method=='' then
return
endif
start_tag = '<FORM ACTION="'||action||'" METHOD="'method'">'
end_tag = '</FORM>'
if marktype() then
l1=.line
call HTML_insert_tags(start_tag,end_tag)
l2=.line
call pend_mark()
unmark
if High_ON then call HILITE(l1,l2) endif
.col=.col+length(end_tag)
else
l1 = .line
keyin start_tag
keyin end_tag
l2 = .line
if High_ON then call HILITE(l1,l2) endif
.col = .col-length(end_tag)
endif
defc HTML_INPUT
universal High_ON
l1 = .line
type = listbox("Enter of Input Field",
"/text/password/checkbox/radio/submit/reset",,6,40, 6)
if type == "" then
return
endif
if type == 'radio' then
'HTML_radio'
else if type == 'checkbox' then
'HTML_checkbox'
else if type == 'submit' or type == 'reset' then
valor = entrybox("Text of the Button")
tag ='<INPUT TYPE="'type'" VALUE="'valor'">'
else
name = entrybox('Name of Variable ?')
if name == '' then return; endif
valor = entrybox("Default Value")
size = entrybox("Maximum number of characters")
tag='<INPUT TYPE="'type'" NAME="'name'" '
if valor<>"" then
tag=tag' VALUE="'valor'" '
endif
tag=tag' SIZE='size' MAXLENGTH='size'>'
endif
keyin tag
l2 = .line
if High_ON then call HILITE(l1,l2) endif
endif endif
defc HTML_checkbox
universal High_ON
l1 = .line
name = entrybox("Name of the input variable?")
if name == '' then return; endif
valor = entrybox("Value to return when checked")
if valor == "" then return; endif
chktxt = entrybox("Text of the button")
tag = '<INPUT TYPE="CHECKBOX" NAME="'name'" VALUE="'valor'" '
defchk = listbox("Checked by default ?","/Yes/No/",,6,20)
if defchk == "Yes" then
tag = tag' CHECKED>'
else
tag = tag'>'
endif
keyin tag || chktxt' '
l2 = .line
if High_ON then call HILITE(l1,l2) endif
.col = .col + 1
defc HTML_radio
universal option_Array, cadena
universal High_ON
l1 = .line
options = ''
rad_name = entrybox('Name of Radio Variable?')
if rad_name == '' then return; endif
rad_num = listbox('Number of Radio Buttons',"/1/2/3/4/5/More",,6,20,6)
if rad_num == 'More' then
rad_num = entrybox('Enter number of Radio Buttons')
endif
if not isnum(rad_num) then
WinMessageBox('HTMLEPM 'HTMLVERSION, 'ERROR: Must enter a number',16384)
return
endif
dispo = listbox("Button disposition","/Column/Row/",,6,20)
if dispo = "Row" then
separator = " "
else
separator = "<BR>"
endif
do_array 1, opt_id, option_array
for i =1 to rad_num
opt = entrybox('Text of Button 'i)
rad_value = entrybox('Value returned when checked')
option_str = '<INPUT TYPE=RADIO NAME="'rad_name'" VALUE="'rad_value'">'opt||separator
do_array 2, opt_id, i, option_Str
endfor
for i = 1 to rad_num
do_array 3, opt_id, i, cadena
insertline cadena
endfor
l2 =.line
if High_ON then call HILITE(l1,l2) endif
defc HTML_SELECT
universal High_ON
l1 = .line
multiselect = 0
NotMoreChecks = 0
name = entrybox('Name of select variable')
if name == "" then
return
endif
sel_num = entrybox("Options number?")
if not isnum(sel_num) then
WinMessageBox('HTMLEPM 'HTMLVERSION, 'ERROR: Must be a number',16384)
return
endif
size = entrybox('Number of visible options ?')
if size == "" then
return
endif
if not isnum(size) then
WinMessageBox('HTMLEPM 'HTMLVERSION,'ERROR: Must be a number',16384)
return
endif
multi = listbox('Multiple selection allowed?',"/No/Yes/",,6,40,2,30)
if multi == '' then
return
else
if multi == "Yes" then
multiselect = 1
else
multi = ""
endif
endif
tag_ini = '<SELECT NAME="'name'" SIZE='size || multi'>'
tag_end = '</SELECT>'
insertline tag_ini
for i = 1 to sel_num
valor = entrybox('Text of Option 'i)
if NotMoreChecks then
select = ""
else
select = listbox('Selected by default?',"/No/Yes/",,6,45)
endif
tag_1 = '<OPTION'
if select == 'Yes' then
tag_1 = tag_1 || ' SELECTED'
if not multiselect then
NotMoreChecks = 1
endif
endif
tag_1 = tag_1 '>'valor
insertline tag_1
endfor
insertline tag_end
l2 = .line
if High_ON then call HILITE(l1,l2) endif
defc HTML_OPTION
universal High_ON
l1=.line
valor = entrybox('Option text')
select = listbox('Selected by default?',"/No/Yes/",,6,20)
tag_1 = '<OPTION'
if select == 'Yes' then
tag_1 = tag_1 || ' SELECTED'
endif
tag_1 = tag_1 '>'valor
keyin tag_1
l2 = .line
if High_ON then call HILITE(l1,l2) endif
defc HTML_TEXTAREA
universal High_ON
lin_1 = .line
name = entrybox("Name of variable")
rows = entrybox("Number of rows")
cols = entrybox("Number of columns")
default = listbox("Default Text ?","/No/Yes/",,6,50)
if default == "Yes" then
defText = entrybox("Enter the Default Text")
else
defText = ""
endif
keyin '<TEXTAREA NAME='name' ROWS='rows' COLS='cols'>'defText'</TEXTAREA>'
lin_2 = .line
if (High_ON) then call HILITE(lin_1, lin_2) endif
defc POPUP_MENU
elige = listbox("Select Tag Type",
"/Link/Image/Target/Define Form/Input Field/Select/Option/Text Area/Table/",
"/OK/Cancel",6,40,11,30)
if elige = "" then return
else if elige = 'Link' then 'HTML_ANCHOR'
else if elige = 'Image' then 'HTML_IMAGE'
else if elige = 'Target' then 'HTML_TARGET'
else if elige = 'Define Form' then 'HTML_FORM'
else if elige = 'Input Field' then 'HTML_INPUT'
else if elige = 'Select' then 'HTML_SELECT'
else if elige = 'Option' then 'HTML_OPTION'
else if elige = 'Text Area' then 'HTML_TEXTAREA'
else if elige = 'Table' then 'TABLA'
endif endif endif endif endif endif endif endif endif endif
defc HTML_ABOUT
linea=.line
WinMessageBox('HTML Extensions for EPM',
' Version 'HTMLVERSION ||chr(10) ||
' (c) E.Areitio 1995', 16384)
.line=linea
defc PREVIEW
CurrFile = .filename
place = lastpos('\', CurrFile)-1
CurrDir = leftstr(CurrFile, place)
'cd 'CurrDir
'start explore ' CurrFile
defc ATTROFF
universal High_ON
TOffset = -300
Column = 1
Line = 0
Class = 0
attribute_action 1,Class,TOffset,Column,Line
while Class do
attribute_action 16,Class,TOffset,Column,Line
Class = 0
attribute_action 1,Class,TOffset,Column,Line
endwhile
refresh
High_ON = 0
'ajusta_menu'
defc ATTRON
universal High_ON, High_Color
High_ON = 1
Papel_Color = .textcolor // 16
Tinta_Color = .textcolor % 16
High_Color = Papel_Color * 16 + Tinta_Color
call HILITE(1,.last)
'ajusta_menu'
defproc HILITE(pri,ult)
universal n,c
universal High_Color
entrycol=.col
entryline=.line
sayerror "Hightlighting ..."
class = 1
aclin = pri
ultimo = ult
abre = '<'
cierra = '>'
actual = abre
while (aclin <= ultimo) do
c = 1
linea=textline(aclin)
n = length(linea)
if (n) then
x=1
while (x & c <= n) do
x = pos(actual,linea,c)
if x then
c = x+1
if actual == abre then
insert_attribute class,High_Color,1,-1,x,aclin
actual = cierra
else
insert_attribute class,High_Color,0,-1,x+1,aclin
actual = abre
endif
endif
endwhile
endif
aclin=aclin+1
endwhile
refresh
sayerror "Done."
.line=entryline
.col=entrycol
defc ajusta_menu
universal defaultmenu,High_ON
deletemenu defaultmenu,80,8111,1
deletemenu defaultmenu,80,8119,1
if (High_ON==1) then
buildmenuitem defaultmenu,80,8111,'Tag~s Hightlight On','ATTRON',0,8192
buildmenuitem defaultmenu,80,8119,'Tags Hightlight ~Off','ATTROFF',32769,0
else
buildmenuitem defaultmenu,80,8111,'Tag~s Hightlight On','ATTRON',0,0
buildmenuitem defaultmenu,80,8119,'Tags Hightlight~Off','ATTROFF',32769,8192
endif
showmenu defaultmenu
defc tabla
if marktype() =='' then
tabla_info="Table Option:"||chr(10)||
"requires marked data in the form:"||chr(10)||chr(10)||
"Table caption"||chr(10)||
" ColName1 ColName2 ColName3"||chr(10)||
"RowName1 data data data"||chr(10)||
"RowName2 data data data"||chr(10)||
" ...."
WinMessageBox('HTML Extensions for EPM 0.98',tabla_info,16384)
return
endif
call pend_mark()
my_end_line = .line
call pbegin_mark()
my_init_line = .line
nrows=my_end_line-my_init_line-1
getline caption,my_init_line
getline col_names_line,my_init_line+1
ncols = words(col_names_line)
maxsize=0
for aclin=my_init_line+1 to my_end_line
getline linea,aclin
line_size = max_word_size(linea)
if maxsize <line_size then
maxsize=line_size
endif
endfor
sep_linea = '+'
tmp_linea = insertstr('-',sep_linea,1,maxsize+2,'-')
for i = 1 to ncols+1
sep_linea=insertstr(tmp_linea,sep_linea)
endfor
oflin=1
insertline '<PRE>',my_end_line+oflin
oflin=oflin+1
captionline= '<B>'caption'</B>'
insertline captionline,my_end_line+oflin
oflin=oflin+1
insertline sep_linea,my_end_line+oflin
oflin=oflin+1
t_linea='|'
t_linea=insertstr(" ",t_linea,1,maxsize+2," ")'|'
for j = 1 to words(col_names_line)
ltpad=maxsize-length(word(col_names_line,j))
llpad=ltpad % 2
lrpad=ltpad-llpad
lpad=insertstr(" ","",1,llpad," ")
rpad=insertstr(" ","",1,lrpad," ")
t_linea=t_linea||lpad||word(col_names_line,j)||rpad'|'
endfor
insertline t_linea,my_end_line+oflin
oflin=oflin+1
insertline sep_linea,my_end_line+oflin
oflin=oflin+1
for linea = my_init_line + 2 to my_end_line
getline linea_actual,linea
t_linea='|'
for j = 1 to words(linea_actual)
if word(linea_actual,j)="*" then
t_linea=t_linea||insertstr("","",1,maxsize+1," ")'|'
else
ltpad=maxsize-length(word(linea_actual,j))
llpad=ltpad % 2
lrpad=ltpad-llpad
lpad=insertstr(" ","",1,llpad," ")
rpad=insertstr(" ","",1,lrpad," ")
t_linea=t_linea||lpad||word(linea_actual,j)||rpad'|'
endif
endfor
insertline t_linea,my_end_line+oflin
insertline sep_linea,my_end_line+oflin+1
oflin=oflin+2
endfor
insertline '</PRE>',my_end_line+oflin
call pbegin_mark()
aclin=.line-1
for i = 1 to nrows +2
getline linea,aclin+i
newlinea='<!-- 'linea' -->'
replaceline newlinea,aclin+i
endfor
insertline"",aclin+i
insert
unmark
.line=.line+nrows*3+9
.col=1
defproc max_word_size(linea)
m=0
for i=1 to words(linea)
l=wordlength(linea,1)
if l>m then
m=l
endif
endfor
return m