Transform HTML to LQ mark up or -down for posting
Once, I wanted to publish the whole man-page to a tool I had scripted, on my blog, but the formatting was so cumbersome, that I preferred to just link to the HTML-version of the man-page...
Now, it is not clear to me, why transformations of all sorts attract my interest, but be it useful or not, I wrote a XSL-style-sheet to create LQ markup or -down from HTML, published a new blog-post about it and present you the style-sheet in its very first version. The XSL-file is not yet commented, as I deem it superfluous in this case (but I may be erring). The code-tag on LQ destroys part of the xsl-code, therefore I attach a functional version of the style-sheet as text to my most recent post in this thread. Cheerio. |
cool, thanks!
i wrapped it into this shell script: Code:
#!/bin/sh Quote:
could you fix that? |
Markdown? What does it have to do with BBCode that LQ uses?
I think that `<ul>` also doesn't work correctly, for example: Code:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> Code:
1st point 2nd point |
Quote:
|
Quote:
|
1) I do not know the difference between markdown and markup. As there are less tags in the LQ “formatting language” I have modified my initial post by replacing “markup” by “markdown”. Next time, I just give evidence of my not caring anyway. :p
2) The XSL-stylesheet does not honor list-tags for the simple reason that I have not yet had any use for them. I will add templates for list tags (ol, ul) and the list-items (li). 3) Right. There is no support for <br/>, yet. I am avoiding this tag in my own code and had no use for it. But I will ad a template for <br/>, too. Thanks for the feedback, I'll publish a new version of the style-sheet, soon. Also, there are apparent “bugs”, which do not render the exercise futile, but could easily be corrected to avoid ill-formatted running text or bad line-breaks. All that shall be addressed. Remember, this was the very first version and only the second style-sheet after many years of abstinence from XSLT. I am still happy with the results :cool: |
1 Attachment(s)
Hard line-breaks and lists are now honored. The new style-sheet is attached (remove the .txt extension).
|
yes!
testing - on this random post: Quote:
nice, thanks! |
All times are GMT -5. The time now is 04:56 AM. |