Hi All,
I'm trying to create a new command to submit current file to W3C html validator. This one does not work : open http://validator.w3.org/check/%24TM_FILEPATH
Of cours I could install the validator directly in MacOS X as http://developer.apple.com/internet/opensource/validator.html but the first way seemed easier.
Any idea?
Have a nice day,
On 19/10/2004, at 2:13 PM, José Campos wrote:
Hi All, I'm trying to create a new command to submit current file to W3C
html validator. This one does not work : open http://validator.w3.org/check/%24TM_FILEPATH
Of cours I could install the validator directly in MacOS X as
http://developer.apple.com/internet/opensource/validator.html but the first way seemed easier.
Any idea?
I don't think you can do this. The W3's validator either needs a publicly available URL, or it needs a file to be uploaded. The file upload is done over POST (not GET, which is the URL), so for TM to send a file to the validator over POST, it would need to pretend to be a user uploading a file with a POST form...
I know TM can't do this, but perhaps it can interact with a library that can, but it certainly won't be easy at all.
Justin
As Justin said, you need to be able to upload the local file via an HTTP POST. You can use 'curl' to do this. The following seems to work. It calls curl, collects the results in a temporary file, and then opens that file.
curl -o /tmp/`id -u`/results.html -F uploaded_file=@$TM_FILEPATH;type=text/html http://validator.w3.org/check && open /tmp/`id -u`/results.html
Chris Brierley thebrier@gmail.com wrote:
As Justin said, you need to be able to upload the local file via an HTTP POST. You can use 'curl' to do this. The following seems to work. It calls curl, collects the results in a temporary file, and then opens that file.
curl -o /tmp/`id -u`/results.html -F
uploaded_file=@$TM_FILEPATH;type=text/html http://validator.w3.org/check && open /tmp/`id -u`/results.html
OK, not really understanding what all this mean, but I've just copy-pasted it and it *works fine*. Perhaps this could be added in the standard Commands, alongside with CSS validator and so on?
(Trying to modify the command for CSS validator does not seem to work : curl -o /tmp/`id -u`/results.html -F uploaded_file=@$TM_FILEPATH;type=text/css http://jigsaw.w3.org/css-validator/check && open /tmp/`id -u`/results.html )
Thanks a lot to both and have a nice day|night,
Chris Brierley wrote:
As Justin said, you need to be able to upload the local file via an HTTP POST. You can use 'curl' to do this. The following seems to work. It calls curl, collects the results in a temporary file, and then opens that file.
curl -o /tmp/`id -u`/results.html -F
uploaded_file=@$TM_FILEPATH;type=text/html http://validator.w3.org/check && open /tmp/`id -u`/results.html
Thanks for this, Chris. Nice job.
drew.
It's not working for me.
I get his back if I tell the command to report in a seperate window in TM:
"curl: option -F requires an extra argument! curl: try 'curl --help' for more information /bin/sh: line 3: http://validator.w3.org/check: No such file or directory"
bongoman
bongoman wrote:
It's not working for me.
I get his back if I tell the command to report in a seperate window in TM:
"curl: option -F requires an extra argument! curl: try 'curl --help' for more information /bin/sh: line 3: http://validator.w3.org/check: No such file or directory"
Make sure that the command is all on one line.
The document also needs to be saved for it to work, so I set my pre-action to save the active document. I also told it to discard the output, as the open command will spawn your default browser - there's not much useful output to TM itself.
drew.
I'm getting there....having followed those last few pointers, I'm finding that results.html is being revealed in Finder rather than opening in Safari, my default browser.
bongoman
On Tue, 19 Oct 2004 19:49:13 +1000, bongoman infolists@gmail.com wrote:
I'm finding that results.html is being revealed in Finder rather than opening in Safari, my default browser.
Hm. If the open command is getting the full path to the file I don't know why it would reveal it rather than show it. Are you sure you don't have any newlines or spaces in there where they shouldn't be? E.g. maybe it's really running 'open /tmp/`id -u`/' instead of the full path to the file? What happens if you double-click on results.html in the Finder?
You can always change the open call to 'open -a Safari /tmp/`id -u`/results.html' which forces open to use Safari ... on the other hand it doesn't really sound like that's where your problem lies.
Hi all,
I keep finding texts for which it seems impossible to define a stop marker for the folding. These are block structures where the folding should strictly speaking stop - at the line before the one in which indentation returns to it's previous level.
That's clumsily expressed, but some examples include:
- Cisco config files:
line vty 0 exec-timeout 0 0 login local length 0 width 134 line vty 1 4 exec-timeout 0 0 password 7 1234 login local length 0
- Python:
def poll(self): if self.returncode == None: if WaitForSingleObject(self._handle, 0) == WAIT_OBJECT_0: self.returncode = GetExitCodeProcess(self._handle) _active.remove(self) return self.returncode def doSomethingElse(): return bah
- Simple markup schemes such as Restructured Text, Markdown (?) etc.
Unless I've missed something (easily possible :), there doesn't seem to be any way of folding text of this sort. I can't do it using regular expressions alone - and I imagine it will require a flag of some sort, or an editor variable (PreviousIndentLevel ??) that can be defined as the "foldingStopMarker".
So, questions:
- Am I wrong? Does anyone know of a way to fold text of this sort? - If not: is it possible that such functionality could be made available by the editor. So that one can say "stop folding when the text returns to it's previous indent level".
Cheers, -- Andre
It's not working for me.
I get his back if I tell the command to report in a seperate window in TM:
"curl: option -F requires an extra argument! curl: try 'curl --help' for more information /bin/sh: line 3: http://validator.w3.org/check: No such file or directory"
This happen to me too. It was because when I pasted it in to tm it had line breaks. Paste it into a new document and remove all the line breaks then copy and paste it into a new command.