-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
With such a great markdown/multimarkdown bundle combination, and now with CSS Preview, I am doing more and more writing/publishing with prince from Textmate. However, I have to use a shell command to run prince. I have tried to hack the screenplay bundles command without much success. What I am trying to write is: 1. convert a multimarkdown (need multi's footnotes) file with declared css file to html (or xml) 2. tell prince to run the file with the css file "prince -s / file/css /tmp/$DST.HTML /tmp/" getting the css file name from the header in the html file so I don't have to tell prince where it is. 3. open the generated /tmp/$DST.PDF il in preview.
I can get prince to run, but not glob the css file name. My end product is a PDF of the html source file. Cutie, but not what I want.
Thanks in advance for any help, or if others would like to make this. Robert
On 12/5/2006, at 20:54, Robert M. Ullrey wrote:
[...] I can get prince to run, but not glob the css file name. My end product is a PDF of the html source file. Cutie, but not what I want.
CSS_FILES=$(ruby <"$TM_FILEPATH" -ne 'puts $1 if /<link(?=[^>]*? type="text/css")[^>]*?href="(.*?)"/')
This will give all href arguments to link tags of type text/css.
I am still having troubles getting my multimarkdown to Prince command to find the css file. Prince wants to look for it in the /tmp file because that is were the generated html file is. So, if my file is in: ~/scratch/book.multimarkdown, and my css is also in ~/scratch/ book.css, the multimarkdown covention is to then write in the beginning of the document:
format: complete css: book.css
If I convert the document to html and save it in ~/scratch/ then run Prince I have no troubles. However, running my script to generate an / tmp/$DST.html and then running Prince on it gets me a pdf without the stylesheet. I can specify the style sheet in Prince "prince -s ~/ scratch/book.css book.css", but that would be impractical for a script. What I would love to write is prince -s "$CSS_FILES" "$DST.html" /tmp/
Allan gave me a quick ruby script "CSS_FILES=$(ruby <"$TM_FILEPATH" - ne 'puts $1 if /<link(?=[^>]*?type="text/css")[^>]*? href="(.*?)"/')", but it does not seem to find ~/scratch/book.css (or any other css file) and use it as $CSS_FILES.
Any help appreciated.
Thanks
Robert
On May 14, 2006, at 8:40 AM, Allan Odgaard wrote:
On 12/5/2006, at 20:54, Robert M. Ullrey wrote:
[...] I can get prince to run, but not glob the css file name. My end product is a PDF of the html source file. Cutie, but not what I want.
CSS_FILES=$(ruby <"$TM_FILEPATH" -ne 'puts $1 if /<link(?=[^>]*? type="text/css")[^>]*?href="(.*?)"/')
This will give all href arguments to link tags of type text/css.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 25/5/2006, at 0:54, Robert M. Ullrey wrote:
[...] it does not seem to find ~/scratch/book.css (or any other css file) and use it as $CSS_FILES.
Isn’t the problem here, that the generated HTML does not contain an aboslute reference to the CSS? So after having generated the file, there is actually no way to know wher ethe CSS is placed.
You need to convert the CSS reference to an absolute path when converting Markdown to HTML (because after that point, you lose the original location of the file, thus the CSS).