I'm trying to figure out how to match two or more files using this Glob Online Tester.
What would be the expression to match styles/main.css and index.html files?
images/icons/home.svg
images/icons/phone.svg
images/promo.gif
images/logo.png
styles/main.css
index.html
It's just
styles/main.css
index.html
As seen here:
Alternatively you could read the documentation:
{} allows for a comma-separated list of "or" expressions
... and use this:
{styles/main.css,index.html}
Related
I tried to include a tpl file using smarty include file like this,
{include file='file_name.tpl'}
its not working for me. Is it needed to include path name.
Try to set path to templates before. So call setTemplateDir before rendering of your template.
More here: https://www.smarty.net/docs/en/api.set.template.dir.tpl
Also as I can see Smarty allows to specify full path to template file inside of include directive. So even this is possible:
{include file='file:/usr/local/share/templates/navigation.tpl'}
But personally I would not recommend you to use this approach and stick to setTemplateDir and consistent place for templates in your app.
Little more information on that topic: https://www.smarty.net/docs/en/resources.tpl
I'm currently compiling markdown to html using pandoc:
pandoc in.md -o out.html
and would like to include the same piece of html code in each of the output files, without having to write it into my markdown file.
I was hoping that a lua filter would do the job. However, the docs seem to indicate the filters will only respond to a sequence of characters within my markdown file, rather than appending something to each file.
I've played around with CSS (I've never used it before), but it doesn't look like I can just add arbitrary html code like this (correct me if I'm wrong).
To summarize, I'd like to find a way to add html code to my output.
A Lua filter is likely to be overkill here. Pandoc has an option --include-after-body (or --include-before-body) which will do what you need:
-A FILE, --include-after-body=FILE|URL
Include contents of FILE, verbatim, at the end of the document body (before the </body> tag in HTML, or the \end{document} command in LaTeX). This option can be used repeatedly to include multiple files. They will be included in the order specified. Implies --standalone.
I would like to generate a single (static) HTML file which would display in a browser a recursive directory listing that features collapsible subdirectories.
Currently, I am using tree in the following manner:
tree -H http://dl.dropbox.com/u/<user_id> > web/directory_listing.html
This produces a HTML recursive directory (and file) listing. For the purposes of clarity, I would like directory contents collapsed by default. When a directory is selected, the directories and files in the selected directory expand and appear in the same page.
Is there some way in which I could generate this type of HTML? Perhaps the output of tree could be modified. The reason I want a single HTML file listing is because I don't have a lot of server control (this is for hosting on Dropbox).
Thanks muchly for any assistance
If you are stuck using something like tree, perhaps add some javascript to achieve your element show/hide effects. This can easily be achieved by concatenating a javascript file on the end of your tree HTML (tree -H) output.
tree -H http://dl.dropbox.com/u/<user_id> > web/directory_listing_part.html
cat web/directory_listing_part.html web/some_file_containing_your_javascript_code > web/directory_listing.html
You could even use the javascript to provide additional styling if you like.
Take a look at this page:
http://mama.indstate.edu/users/ice/00Tree.html
This gives a good example of the sort of formats you can achieve. Note the use of class names which should easily give you something to hook into with javascript/jquery
This question already has answers here:
HTML5 include file [duplicate]
(8 answers)
Closed 9 years ago.
I have 2 HTML files, suppose a.html and b.html. In a.html I want to include b.html.
In JSF I can do it like that:
<ui:include src="b.xhtml" />
It means that inside a.xhtml file, I can include b.xhtml.
How can we do it in *.html file?
using html 5 (if it can be done at all in html 5).
Surprisingly, the same question was asked and it is possible: HTML5 include file
Rafa's answer:
Use the object tag:
<object name="foo" type="text/html" data="foo.inc"></object>
foo.inc should include valid HTML.
I tested it on Konqueror, Firefox and Chromium.
Note you must use a separate </object> tag otherwise any content after it gets discarded.
If you find it useful (I do), please upvote Rafa answer (not mine) because "it is not possible" is spreading like disease.
If your server supports SSI (server side includes) you can put the following in your html-files without needing a scripting language or whatever. Apache has SSI enabled by default (I think?)
<!--#include file="same_path_file.html" -->
<!--#include virtual="docroot_file.html" -->
"file" is relative to the current file, and probably what you would use for including related files like "relevant_article_poll.html".
"virtual" is relative to document root (ie, your website root) and you would use it for including global files, like headers and footers.
Doesn't really matter which one you choose, but it's useful to know the difference between the two.
Also, the include directive makes a new internal http request to the server for each file, so you could include php files and the likes and they would be executed as they should.
Here's a useful overview of SSI: http://en.wikipedia.org/wiki/Server_Side_Includes
To use the PHP include function in HTML5, you just have to edit your .htaccess file as follows:
<Files *.html>
ForceType application/x-httpd-php
</Files>
Now you can use any PHP code in your html file like this:
<?php include 'menu.html'; ?>
Cheers ;)
HTML5 is no different from HTML 4.01 in this sense in that this simply can't be done without scripting of some sort.
I'm looking for a greedy RegEx match to replace all text in a number of HTML files between </title> and </head> (I've combined loads of JavaScript files to minimize the number of http requests).
I've googled it but the majority of the solutions don't seem to work for me. (Which naturally leads me to assume that i'm wrong)
This is my current expression which doesn't seem to work:-
</title>([^<]*)</head>
I'm using Dreamweaver 8 search and replace.
Between the two tags there are multiple includes for various javascript files for example:-
which vary on a page by page basis.
I want to replace everything between those two tags in all pages with a consistant list of CSS / JavaScript inclues.
If DreamWeaver regex supports look-ahead assertions:
</title>((?:(?!</head>)[\s\S])*)</head>
The usual warning "don't work on HTML with regex, this will fail at some point" applies. The points where this would fail could be:
<script>var str = "something that contains </head>";<script>
or
<!-- a comment that refers to </head> -->
among other constellations.
Have you tried using something like http://www.regextester.com/ ? You could test your regex live?
There are other approaches you could take to 'test' your case.
//if i consider you are using php as you are looking for regex
//regex : '#\<\title\>(.+?)\<\/head\>#s'
//in php
$content_processed = preg_replace_callback(
'#\<\title\>(.+?)\<\/head\>#s',
create_function(
'$matches',
'return htmlentities($matches[1]);'
),
$content
);
// this will return content between the tag