Is it possible to inser text from a CMakeLists.txt into a file in a specific line (and move one line down the rest of the lines).
I have read the FILE function documentation http://www.cmake.org/cmake/help/v3.0/command/file.html but I cannot find anything.
Objective: From CMake, I want to modify a HTML file so that the directory of the index.html is wrote in this HTML file (potentially as a link). I am creating a file to log different things (output files directories). For example:
File before running cmake:
<html>
<head>
</head>
<body>
<!-- Insert text here -->
</body>
</html>
File after runing a CMakeLists.txt with something like
file((insert in line 6) ${DOC_DIR}/log.txt "<p>Inserted text.</p>")
<html>
<head>
</head>
<body>
<!-- Insert text here -->
<p>This text is normal.</p>
</body>
</html>
You can use configure_file to fill a template with CMake variables.
Simple example:
test.html.in
<html>
<head>
</head>
<body>
#html_string#
</body>
</html>
CMakeLists.txt
project(test)
set(html_string "<p>Inserted text.</p>")
configure_file(test.html.in test.html)
Running cmake results in a file test.html with the following contents to be created:
<html>
<head>
</head>
<body>
<p>Inserted text.</p>
</body>
</html>
Related
I can't seem to find the error in the code, I am not very familiar with HTML. I keep getting a syntax error on line one:
File "C:\Users\____\Desktop\Flask_test\index.html", line 1
<html>
^
SyntaxError: invalid syntax
Here is my code:
<html>
<head>
<title>Home page</title>
</head>
<body>
<h1>Home Page!</h1>
<p>Hello!</p>
</body>
</html>
I'm not familiar with Flask but I believe it's requesting the !DOCTYPE at the beginning. Try adding <!DOCTYPE html> before the starting HTML tag.
Try adding <!DOCTYPE html> and improve the code's formatting.
<!DOCTYPE html>
<html>
<head>
<title>Home page</title>
</head>
<body>
<h1>Home Page!</h1>
<p>Hello!</p>
</body>
</html>
So you are getting Internal Server Error (500)
that means the code of python you have written does work but when a request comes to the server an error occurs, or Flask just cant find your index.html file
by default Flask will search for your index.html file in a folder named "templates" or
you can set the directory of your templates(HTML files) explicitly
Anyway I wrote this script for you, try to run it on your local machine
from flask import Flask, render_template
app = Flask(__name__,
static_url_path='',
static_folder='static',
template_folder='myTemplates')
#app.route('/')
def mainRouter():
return render_template("index.html")
You need to create a directory named "myTemplates" and put your index.html file inside it, you can change the name of course inside the script (template_folder='myTemplates') to use another directory.
and if you have any static files, like images or audio files, videos, etc...
you need to create a directory called "static" and put all your static files there or you can change its name in the script (static_folder='static') to whatever you like.
Add !DOCTYPE + HTML LANG.
<!DOCTYPE html>
<html lang="en-US">
<html lang="en-US">
<head>
<meta charset="utf-8" />
<title>Home page</title>
</head>
<body>
<h1>Home Page!</h1>
<p>Hello!</p>
</body>
</html>
According to issue #4883 and PR #15320 you can create vscode:/ links in your HTML:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<h1>Test</h1>
open file.md in vscode
</body>
</html>
This should have the same effect than typing following in the console:
code -g -r /path/to/my/file.md
But what I get is different:
After click:
And after clicking on "Open Visual Studio Code", then the application is opened (or put in the foreground) but the file is not opened.
What did I miss?
I have tried <a href="vscode:///path/to/my/file.md"> but the result is the same.
I found the solution in this answer: you need a file/ prefix before the path of your file:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<h1>Test</h1>
open file.md in vscode
</body>
</html>
My folder looks like this Initial (folder\css,img,js,vbs,Main.html,Sub.html,sup.html)
I am supposed to link the .vbs script here and have it run from the file but it opens up a new window and shows the code from that file. I have tried script tags inside the link but it didn't work out very well.
My code looks like this:
<html>
<head>
</head>
<body>
Link
</body>
</html>
Use HTML like this
<!DOCTYPE html>
<html>
<head>
<script language="VBScript" type="text/vbscript" src="yourfile.vbs"></script>
</head>
<body>
</body>
</html>
Check this
I am using the elm-live dev server but I do not know how to use an external CSS file. According to documentation, I can use the following code below, but where do use that snippet of code? If i use it in the index.html it still gets overwritten on when i save my *.elm files.
Thanks
elm-live states:
$ cat <<——— > index.html
<!doctype html>
<link rel="stylesheet" href="style.css" />
<body>
<div></div>
<script src="elm.js"></script>
<script>Elm.Main.embed(document.querySelector("div"));</script>
</body>
———
$ elm-live Main.elm --output=elm.js --open
I have a problem with loading my VBscript in html. I tried to test a simple sample, but it doesn't work:
My html:
<!DOCTYPE html>
<html>
<body>
<head>
<script src="login_VBS.vbs"> </script>
</head>
</body>
</html>
login_VBS.vbs:
msgbox "this is a message"
I can not make it easier, but when I check the view source from IE, the vbs doesn't exist in my source. Any ideas?
Use valid HTML - like:
<!DOCTYPE html>
<html>
<head>
<script language="VBScript" type="text/vbscript" src="test00.vbs"></script>
</head>
<body>
</body>
</html>
and one (or both) scripting language specification; of course the .vbs must exist (in the parent folder of the .html file, if you don't use a full/absolute path).
Make sure you have gave correct filename with correct location, this should work
<script type="text/vbscript" src="VBScript_file_URL"></script>
Check this and also this, also make sure whether the file exists or not.