Sponsored Content
Full Discussion: Plain Text List to HTML List
Top Forums Shell Programming and Scripting Plain Text List to HTML List Post 302286264 by QuestunAthority on Tuesday 10th of February 2009 03:50:22 PM
Old 02-10-2009
MySQL THANK YOU zaxxon to the Maxon!

I still had a bit of a struggle trying to find the correct options in the GUI OMCEdit. I was escaping with a backslash instead of "Wrap with ' for Shell." But the latter was the trick!

Thank you both so much!

I ended up using the first suggestion with awk, since I could get that one to work. The user-input options were not exactly what I needed. The last sed suggestion curiously put "n" after the opening <ol> and before the closing </ol> so I went with awk.

In case you are not familiar with the AWESOME OnMyCommand, here is a little info. It allows Mac OS X users to put command lines, shell scripts, and more in contextual menus (i.e. right click). These commands can be directed at files, folders, or selected text. Your favorite program doesn't have an option you want? Create it as a command and add it to the menu! :-)

Here is the web site: OnMyCommand

My issue is that I find myself writing in various places that demand HTML codes and was tired of typing them in. I thought, "surely I can have OnMyCommand do this for me." So now I just write normally, typing up my list, then when I am ready to add the HTML codes, I just select the list and choose Ordered List and the codes are added automatically!

UNIX.com kept coming up as I spent untold hours trying to figure this out on my own. So in case someone else is trying to do the same thing, here is the plist that can be directly imported in to OMCEdit and it's up and running!

Just save the entire plist as a text file, then use OMCEdit to import it and it'll be added to your list of commands.

Thank you both again!

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>COMMAND_LIST</key>
	<array>
		<dict>
			<key>ACTIVATION_MODE</key>
			<string>act_selected_text</string>
			<key>COMMAND</key>
			<array>
				<string>echo </string>
				<string>__OBJ_TEXT__</string>
				<string> | awk 'BEGIN{print "&lt;ol&gt;"} {print "&lt;li&gt;"$0"&lt;/li&gt;"} END{print "&lt;/ol&gt;"}' | pbcopy</string>
			</array>
			<key>ESCAPE_SPECIAL_CHARS</key>
			<string>esc_wrap_with_single_quotes_for_shell</string>
			<key>EXECUTION_MODE</key>
			<string>exe_silent_popen</string>
			<key>NAME</key>
			<array>
				<string>Ordered List</string>
			</array>
			<key>NOTES</key>
			<string>The goal of this command:
• put the correct XHTML tags around a selected list of text to make it an ordered list.

To Do:
• Error checking

Thanks to: 
• https://www.unix.com 
• zaxxon and ranjeetmenon who provided me with the command line used in this command!

My question and their help can be found here:
https://www.unix.com/shell-programming-scripting/100161-plain-text-list-html-list.html</string>
			<key>PASTE_AFTER_EXECUTION</key>
			<true/>
			<key>SUBMENU_NAME</key>
			<string>HTML</string>
			<key>TERM_BRING_TO_FRONT</key>
			<false/>
			<key>TERM_OPEN_NEW_SESSION</key>
			<false/>
			<key>VERSION</key>
			<integer>1</integer>
		</dict>
	</array>
	<key>VERSION</key>
	<integer>2</integer>
</dict>
</plist>

 

10 More Discussions You Might Find Interesting

1. Linux

Plain Text printing issues

I'm attempting to print to a networked konica printer. No linux drivers that I know of exist, but we've always used HP 5si drivers and have had good results. We just loaded a box up with CentOS 5, and now when we print any sort of file from the command line (lp -dkonica <filename>), the text is... (0 Replies)
Discussion started by: fender177
0 Replies

2. UNIX for Dummies Questions & Answers

Drag and drop items in plain html page

Hello, Am looking for a tool / open source framework that could do the following. A plain html page, with some toolbox at the border of the page where the tool box contains individual tool that represents operation like "extend fleet", "add drives", "backtrack" or something of that sort. ... (1 Reply)
Discussion started by: matrixmadhan
1 Replies

3. Shell Programming and Scripting

Splitting a list @list by space delimiter so i can access it by using $list[0 ..1..2]

EDIT : This is for perl @data2 = grep(/$data/, @list_now); This gives me @data2 as Printing data2 11 testzone1 running /zones/testzone1 ***-*****-****-*****-***** native shared But I really cant access data2 by its individual elements. $data2 is the entire list, while $data,2,3...... (1 Reply)
Discussion started by: shriyer
1 Replies

4. Shell Programming and Scripting

Convert perl qw list to text file list?

Does anyone have a good example? I am having trouble looping.. Thanks (1 Reply)
Discussion started by: mrlayance
1 Replies

5. Shell Programming and Scripting

from one word for line to plain text

Hello! I've got a very big file (from tokenization) which has one word for line. How is it possible then to rebuild the "original" text, knowing that <s> and </s> are the sentence-delimiters? My file looks like this: <s> && tanzania na Afrika kwa ujumla ambiwa na taifa kubwa... (6 Replies)
Discussion started by: mjomba
6 Replies

6. Shell Programming and Scripting

Ordering HTML Drop Down List entries Alphabetically

Hi, So I have a web page that has some drop down boxes with a whole bunch of entries. Unfortunately, they have been added over time and started from a small list and is now extremely messy. I'm looking to write script so I can just copy in the section of the HTML code and have it sorted for... (6 Replies)
Discussion started by: jedel
6 Replies

7. Shell Programming and Scripting

Display both html and plain text in email in shell script

Hi, I want to display both html and plain in email in my script. i tried the below code code: export MAILTO="ssi@a.com" export CONTENT1="$htmlfile" export CONTENT2="$plainfile" export SUBJECT="INFO " export MAILFROM="si@a.com" ( echo "Subject: $SUBJECT" echo "MIME-Version:... (4 Replies)
Discussion started by: sreelu
4 Replies

8. Web Development

How to copy a selected value of list box into a text box in html form?

hi, i have a list box , a text box and a button in a html form. list box displays some values, when a user selects a value from the list box and press the button. the selected value should be copied to the text box value. can any1 give me a html and javascript code to do this facility. ... (1 Reply)
Discussion started by: Little
1 Replies

9. Shell Programming and Scripting

Add HTML tags to file list

Hi there, I am new to shell scripting and have been struggling with this example. I have an input variable that looks like that: FILELIST="100_*_123.txt" that will produce a list of files if you use ls ${FILELIST} The output looks like 100_EN_123.txt 100_FR_123.txt I am building... (4 Replies)
Discussion started by: ornesey
4 Replies

10. UNIX for Beginners Questions & Answers

Help with moving list of data to 2nd column of HTML file

Hi Team, Can you help me with writing shell script to printing the list output to 2nd column in HTML file. (2 Replies)
Discussion started by: veereshshenoy
2 Replies
All times are GMT -4. The time now is 03:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy