Comments (16)
need to add conditional handling state to wait for conditional closing comment with <![endif]>
.
from html2jade.
Conditional comments seems to be simply stripped away. Do you think html2jade will support conditional comments in the near future? And how do you handle these for the time being; is there a workaround? Kind regards, hced
from html2jade.
Conditional comments should be supported and not stripped away.
To handle conditional comment, create another instance of jsdom
gets created to parse the textual content of conditional comment as HTML.
What seems to be happening is that either node
or jsdom
behavior changed so that parse callback gets called AFTER original document is processed, resulting in converted contents of conditional comment being dumped at the end of output.
Could you confirm if the content of your conditional comments are at the end of output Jade file?
from html2jade.
Urgh. Looks like this one is not an easy fix. I'll have to do one of the following:
- make DOM tree walking async
- do some trick with output so it can support output placeholders
- do 2-pass over elements, 1st pass to parse conditionals, 2nd to build output.
I'm going to defer this one til I have more time.
from html2jade.
@hced, couldn't sleep so went ahead and fixed it. Now conditionals should convert on client-side as well since I'm using innerHTML
to parse conditional comments.
Let me know if this fix doesn't work for you.
from html2jade.
Thanks a lot for fixing this, Don. I'll try out your fix when I find time (hopefully tomorrow).
I installed html2jade via npm and my version is/was 0.1.16. Updating the package with npm update didn't bump the version, whereas you bumped the version to 0.2.0 in your latest commit, no?
Uninstalling html2jade and then…
npm install -g https://github.com/donpark/html2jade/tarball/master
…didn't seem to update it to the newest version. As I'm a bit of a newbie (sorry), I wonder how I should update html2jade. Feel no hurry to answer this, though (no rush!).
from html2jade.
npm install -g html2jade
or
sudo npm update -g html2jade
should do it. try npm info html2jade
to check npm repository.
from html2jade.
But I fear your npm setup is in a funky state. Try npm clear cache
before installing.
If nothing works, you can try as last resort:
git clone git://github.com/donpark/html2jade.git
cd html2jade
npm install
npm link
from html2jade.
Oh, that reminds me. Make sure you have the latest version of npm
. There were numerous version that silently failed to update.
from html2jade.
Ah, right. I'll update npm itself. (Was writing a bunch of other things here but realized you were posting at the same time. Hehe.)
from html2jade.
For reference, my test case (example) for conditional comments would be:
html2jade https://raw.github.com/zurb/foundation/master/index.html > conditional_comments_test.jade
I'm afraid I'll have to go to sleep as it's way into the night here (Sweden). I'll look into this tomorrow hopefully. Thanks for your helpfulness!
from html2jade.
Well, special comment-inside-conditional trick wasn't supported in 0.2.0
but version 0.2.1
does. ;-)
See conditional2.html -> conditional2.jade
from html2jade.
Hi again. I've tried upgrading html2jade to 0.2.1 in all kinds of ways (including various unlink/link procedures in between) but somehow it just don't seem to work. When I do html2jade --version
I get 0.1.16. Which is strange, because in /usr/local/lib/node_modules/html2jade/package.json
, it says…
{
"name": "html2jade",
"description": "HTML to Jade conversion tool",
"version": "0.2.1",
"author": {
"name": "Don Park",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "git://github.com/donpark/html2jade.git"
},
"main": "index",
"bin": {
"html2jade": "./bin/html2jade"
},
"dependencies": {
"jsdom": ">= 0.x",
"commander": ">= 0.x"
},
"engines": {
"node": ">= 0.4.0"
},
"_npmUser": {
"name": "hced",
"email": "[email protected]"
},
"_id": "[email protected]",
"devDependencies": {},
"optionalDependencies": {},
"_engineSupported": true,
"_npmVersion": "1.1.10",
"_nodeVersion": "v0.8.8",
"_defaultsLoaded": true,
"dist": {
"shasum": "7cb762f67cca8945603693552c30405c005bd696"
},
"_from": "https://github.com/donpark/html2jade/tarball/0.2.1"
}
from html2jade.
try which html2jade
to find out where the old version is coming from.
you might also try npm cache clear
.
from html2jade.
which html2jade
always tells me it's in /usr/local/bin/html2jade
. That is, if I:
rm /usr/local/bin/html2jade
, then
npm cache clear
, and
npm install -g html2jade
, and
which html2jade
…it once again says /usr/local/bin/html2jade
Hmm, almost like catch-22 thing going on. :)
Edit: on random occasions, after removing the binary from /usr/local/bin and trying to reinstall html2jade, I get this output:
% npm install -g html2jade
npm http GET https://registry.npmjs.org/html2jade
npm http 200 https://registry.npmjs.org/html2jade
npm http GET https://registry.npmjs.org/html2jade/-/html2jade-0.2.1.tgz
npm http 200 https://registry.npmjs.org/html2jade/-/html2jade-0.2.1.tgz
npm ERR! error rolling back [email protected] Error: EPERM, chmod '/usr/local/lib/node_modules/html2jade'
npm ERR! Error: EPERM, chmod '/usr/local/lib/node_modules/html2jade'
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR!
npm ERR! System Darwin 12.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "html2jade"
npm ERR! cwd /Users/hced
npm ERR! node -v v0.8.8
npm ERR! npm -v 1.1.10
npm ERR! path /usr/local/lib/node_modules/html2jade
npm ERR! code EPERM
npm ERR! message EPERM, chmod '/usr/local/lib/node_modules/html2jade'
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/hced/npm-debug.log
npm not ok
% sudo npm install -g html2jade
npm http GET https://registry.npmjs.org/html2jade
npm http 304 https://registry.npmjs.org/html2jade
npm http GET https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/commander
npm http 200 https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/jsdom/-/jsdom-0.2.15.tgz
npm http 200 https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/commander/-/commander-1.0.4.tgz
npm http 200 https://registry.npmjs.org/jsdom/-/jsdom-0.2.15.tgz
npm http 200 https://registry.npmjs.org/commander/-/commander-1.0.4.tgz
npm http GET https://registry.npmjs.org/keypress
npm http GET https://registry.npmjs.org/htmlparser
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/contextify
npm http 200 https://registry.npmjs.org/keypress
npm http GET https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz
npm http 200 https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/cssom/-/cssom-0.2.5.tgz
npm http 200 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/contextify/-/contextify-0.1.3.tgz
npm http 200 https://registry.npmjs.org/htmlparser
npm http GET https://registry.npmjs.org/htmlparser/-/htmlparser-1.7.6.tgz
npm http 200 https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/request/-/request-2.11.1.tgz
npm http 200 https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz
npm http 200 https://registry.npmjs.org/cssom/-/cssom-0.2.5.tgz
npm http 200 https://registry.npmjs.org/contextify/-/contextify-0.1.3.tgz
npm http 200 https://registry.npmjs.org/htmlparser/-/htmlparser-1.7.6.tgz
npm http 200 https://registry.npmjs.org/request/-/request-2.11.1.tgz
npm WARN [email protected] package.json: bugs['web'] should probably be bugs['url']
npm http GET https://registry.npmjs.org/bindings
npm http 200 https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/bindings/-/bindings-1.0.0.tgz
npm http 200 https://registry.npmjs.org/bindings/-/bindings-1.0.0.tgz
> [email protected] install /usr/local/lib/node_modules/html2jade/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild
npm ERR! TypeError: options.uid should be a number
npm ERR! at ChildProcess.spawn (child_process.js:778:24)
npm ERR! at Object.exports.spawn (child_process.js:614:9)
npm ERR! at spawn (/usr/local/lib/node_modules/npm/lib/utils/exec.js:103:22)
npm ERR! at exec (/usr/local/lib/node_modules/npm/lib/utils/exec.js:40:12)
npm ERR! at /usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:146:5
npm ERR! at process.startup.processNextTick.process._tickCallback (node.js:244:9)
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <[email protected]>
npm ERR!
npm ERR! System Darwin 12.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "html2jade"
npm ERR! cwd /Users/hced
npm ERR! node -v v0.8.8
npm ERR! npm -v 1.1.10
npm ERR! message options.uid should be a number
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/hced/npm-debug.log
npm not ok
Does this give any clue as to how I may get this working?
from html2jade.
Looks like you're having trouble installing jsdom's native dependency because node-gyp is barfing.
Best option is to try updating npm to latest version '1.1.59'. Yours is '1.1.10'.
from html2jade.
Related Issues (20)
- --bodyless in Gulp task HOT 1
- attribute case is not preserved when converting from html HOT 13
- Strip server language tags HOT 2
- Migrate to ES6 HOT 1
- Not generating nested elements HOT 2
- Option to skip the auto trim HOT 4
- Datalist aren't converting properly HOT 3
- 有没有windows平台版本? HOT 1
- Tags options always true. HOT 1
- Rename/update to Pug 2 (html2pug) HOT 3
- what's wrong with this ? May be some bugs ? HOT 3
- Don't work with Angular 2 template syntax HOT 6
- Please support IE conditional comments HOT 2
- Breaks inline SVG's viewBox HOT 2
- backslash problem
- Non-standard self-closing tags aren't properly respected HOT 1
- Always true condition. HOT 1
- omit commas between attributes HOT 3
- Only converting first few child elements? HOT 1
- You can not convert that there is a pre
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html2jade.