-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combining plain text and tags #1939
Comments
It might not be a bad idea to add something like the syntax you suggest, but for your example you can also do: doctype html
html(lang="en")
body
div.test
| Test content
div Some other content or doctype html
html(lang="en")
body
div.test.
Test content
#[div Some other content] |
Right. While that would work in that specific example, it would quickly become problematic when either a) the plaintext part consists of a lot of lines, or b) the non-plaintext part consists of a complex structure. That's more or less the usecase I was thinking of with this suggestion. |
@joepie91 said:
I assume that you meant that the a) is problematic with the piped text syntax, and b) the tag interpolation syntax. In practice however, the pipe syntax isn't that problematic even for a lot of lines. One can simply use a regex to add a pipe to multiple lines, for example in vim ex mode
The tag interpolation syntax is designed for only small, usually inline elements. |
@TimothyGu Right. That should've been "and" in my previous comment, rather than "or". The combination of the two is a problem. Here is an awfully hacky example of the problem I'm encountering. The base HTML comes from upstream, and there is no way for me to make inline changes in it using Jade - I need to replicate some parts of the document structure in Jade, just to be able to mix Jade tags and plaintext from the original document. Pipes for every line are obviously not a reasonable option here. |
+1 for this. I'm mixing Jade with inline PHP and the pipes are becoming a pain. |
@joepie91 that example just looks like you haven't bothered to convert the html into jade. I don't see any problems that would prevent you from doing so. If you need to include large snippets of html within your jade, why not use |
@ForbesLindesay Because I'm making modifications to a large blob of HTML from upstream, that may change with some regularity. These aren't includes, they're part of the structure of the document itself, and there can be modifications at multiple levels of the hierarchy. The markup from upstream is far too large and complex to constantly have to convert things to Jade. My experiences with automated conversion tools have not been very good so far. This would be a relatively simple solution to that problem. |
I currently have some code that would conceptually look like this:
However, this is a parsing error. The following would work:
But this means I can't use Jade for my added content (the
Some other content
element). Is there a way to mix multi-line "plain text blocks" and regular Jade tags?For further context: I am working with the codebase of the pdf.js viewer, which is large, written in HTML, and changes with some regularity - this means that it's not feasible for me to continuously 'convert' the HTML into Jade. I'd much prefer some way to mix plain text and Jade tags - it's still not perfect, but at least somewhat maintainable.
The text was updated successfully, but these errors were encountered: