LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-03-2005, 02:58 PM   #1
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,638

Rep: Reputation: 46
Vi alternatives


If you write a letter or a few words using 'vi' editor , it will be written or rather save as a ANSI text.

When you press :wq at the end of your letter, it will save.

My question is whether it is possible to save in other formats. I would like to save as a HTML file.
 
Old 09-03-2005, 03:12 PM   #2
F0ul_Olli
Member
 
Registered: Aug 2005
Location: Flintshire, WALES, UK
Distribution: Slackware
Posts: 57

Rep: Reputation: 15
If you write your html source in VI and then save it as file.html, its then saved in that format.

e.g.
"<title>your document </title>"
"<body> This is what I want on my page etc </body>"

If on the otherhand, you are trying to write a document and then save it preformatted in html you should use something else like Openoffice or Abiword.

Have I understood your question properly?
 
Old 09-03-2005, 03:42 PM   #3
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,638

Original Poster
Rep: Reputation: 46
Thanks F0UI

I meant to write some html tags.
If I wrote the following tags and saved, it will save as ANSI document. If I can save as .htm document, for example '' testing.htm or testing.html '', I could open it on my browser.

Is it possible to save as html document?




<html>
<head>
<title>My homepage</title>
</head>
<body>
Hello everybody. Welcome to my homepage.
</body>
</html>
 
Old 09-03-2005, 03:46 PM   #4
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 53
Quote:
Originally posted by Gins
Thanks F0UI

I meant to write some html tags.
If I wrote the following tags and saved, it will save as ANSI document. If I can save as .htm document, for example '' testing.htm or testing.html '', I could open it on my browser.

Is it possible to save as html document?




<html>
<head>
<title>My homepage</title>
</head>
<body>
Hello everybody. Welcome to my homepage.
</body>
</html>
You mean ASCII (American Standard Code for Information Interchange), not ANSI (American National Standards Institute)
Of course you can save it as HTML. HTML IS in ASCII, it just has a .html (or .htm) file extension. You could call it mypage.blah and it would still open in most web browsers! In vi just do
Code:
:w myfile.html
to save it to the file called myfile.html, or better still when you start vi, start it by appending the filename, i.e.:
Code:
vi myfile.html
 
Old 09-03-2005, 03:51 PM   #5
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,638

Original Poster
Rep: Reputation: 46
Oh! great advice Komakino. I will try the way you have suggested.
 
Old 09-03-2005, 04:07 PM   #6
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,638

Original Poster
Rep: Reputation: 46
Komakino

It worked beautifully. I owe you a lot. You are living in Somerset. I would like to pay you 10 pounds. It was a really a great, great , great help.

Is this possible in Emacs too?
 
Old 09-03-2005, 04:26 PM   #7
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 53
Quote:
Originally posted by Gins
Komakino

It worked beautifully. I owe you a lot. You are living in Somerset. I would like to pay you 10 pounds. It was a really a great, great , great help.

Is this possible in Emacs too?
lol, danke, bitte schön

Yes, you can do it in any text editor. HTML is just ASCII text with html tags in it. Any editor that can save in plain text (that is, without word processor formatting) can save an HTML file.
 
Old 09-03-2005, 04:39 PM   #8
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,638

Original Poster
Rep: Reputation: 46
Thanks Komakino

I am sure you have the freeware wordprocessor for Linux and Solaris. It is called 'Open office'
I tried in vain to write those tags in that program.

Does it work there too? I doubt it very much.

In any case, now it is getting late here. I must sleep. I will try more and more tomorrow and come back to you when necessary.

Tomorrow is Sunday. I am free. Only thing I am going to do is training at the gym. Rest of the time I would spend on this.

I profoundly appreciate all the help. As I said before I don't mind paying 10 pounds for the help.
 
Old 09-03-2005, 04:43 PM   #9
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 53
Quote:
Originally posted by Gins
Thanks Komakino

I am sure you have the freeware wordprocessor for Linux and Solaris. It is called 'Open office'
I tried in vain to write those tags in that program.

Does it work there too? I doubt it very much.

In any case, now it is getting late here. I must sleep. I will try more and more tomorrow and come back to you when necessary.

Tomorrow is Sunday. I am free. Only thing I am going to do is training at the gym. Rest of the time I would spend on this.

I profoundly appreciate all the help. As I said before I don't mind paying 10 pounds for the help.
It is possible to write html in Openoffice and save it as plain text. When you save the file choose "Text (txt)" as the file type and uncheck the box that says "Automatic file name extension". Then call your file something like index.html and it should all be fine.

And of course I'm flattered that you think my advice is worth paying for but as with everything linux it's experimental but free
 
Old 09-05-2005, 10:29 AM   #10
jayemef
Member
 
Registered: Aug 2005
Location: Juniata College, PA
Distribution: Ubuntu, Slackware
Posts: 67

Rep: Reputation: 15
Don't forget also that you can specify the file extension when opening the file, even if it doesn't exist. So if you wanted to create a new HTML file in Vi, you could simply do
Code:
$ vi index.html
and anytime you save the file, it will write to index.html. This notation should work for most, if not all text editors.

On the side, I would NOT recommend writing any form of code, including HTML, in a word processor for several reasons. Firstly, your code won't be readable. This is why forums like this one provide a Code block for people to enter code. It makes the font monowidth, which is important when looking at spacing, indentation, etc. Secondly, word processors won't help you with syntax in any way. Simple editors like Vi(m), Bluefish, etc at least highlight syntax properly, and there are "smarter" ones out there that could be classified as structure editors, which are aware of the proper syntax of whatever language you are working with and will inform you when you have errors.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
libxml2 alternatives Ygrex Programming 4 11-10-2005 06:23 PM
Alternatives to x? ampex189 Linux - Software 9 03-22-2005 01:21 PM
Fsck How To? / alternatives ? m-blaster Linux - Software 2 12-19-2004 11:46 AM
email alternatives brianZA Linux - Newbie 4 11-25-2004 09:07 AM
Alternatives matahchuah Linux - Software 1 02-17-2004 05:08 PM


All times are GMT -5. The time now is 11:16 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration