Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm building a website that requires very basic markup capabilities. I can't use any 3rd party plugins, so I just need a simple way to convert markup to HTML. I might have a total of 3 tags that I'll allow.
What is the best way to convert ==Heading== to <h2>Heading</h2>, or --bold-- to <b>bold</b>? Can this be done simply with Regex, or does somebody have a simple function?
I'm writing this in C#, but examples from other languages would probably work.
It's not really a simple problem, because if you're going to display things back to the user, you'll need to also sanitise the input to ensure you don't create any cross site scripting vulnerabilities.
That said, you could probably do something pretty simple as you describe most easily with a regular expression replacement.
For example
replace the pattern ==([^=]*)== with <h2>\1</h2>
This really depends on the Wiki syntax you're using as there are several different ones. Obviously the wiki software has this functionality somewhere; if you can't find a software package that does this for you, you could start looking for the relevant code in your wiki software.
Maybe this is what you need.
This page is a compilation of links, descriptions, and status reports of the various alternative MediaWiki parsers — that is, programs and projects, other than MediaWiki itself, which are able or intended to translate MediaWiki's text markup syntax into something else.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to make a simple search engine in html, but I dont know how to take the users input and use it for searching purposes. What I'm trying to achieve is to take the input, and be able to search Google for what was imputed. Can someone help me?
I build search engines.
You can't do that in HTML, as it's a markup language. It isn't a programming language, because it can't use variables, nor do conditional if/else-if/else, nor switch/case logic, nor use loops/repeaters. A search engine has to be written in a programming language, like: JavaScript, PHP, C/C++, C#, Java, etc...
If you're trying to take an input form field in HTML & use it to search Google, where you want to dump the results into either an HTML IFrame or a DIV, then you'll need to use JavaScript. With JS, you can grab the form field... then simply drop it into an iframe or you can make an Ajax call to query Google & then append the results into a div.
I recommend learning JavaScript first, as it's a client-side language. Then learning a back-end language, like the ones listed above. Good luck!
Short answer, you cannot do it with only HTML because HTML is an tool. You need programming language to connect with HTML. You have several back end options like Php, Javascript (Node.js), Python (Flask or Django) etc.
You can search for tutorials for specifed backend programming language and connect it.
IDEA: To send user input to the Google search you might want to search for an Google search API
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I designed a nice resumé template in Sketch and now I want to make it available to use it for the users of a site.
The data will be stored in MySql database and the design should be modular depending on the information.
What is the best way of doing it? I though of replicating the design in CSS3 and then converting it with some of this scripts fpdf or mpdf but I don't thing that it's the easiest way of doing it.
What do you think?
Thanks!
An example of the resumé is the following:
If it's a set template/pattern I'd approach it like each segment as an object with a varying number of attributes based on data it returns from the mysql call.
IE when you pull the data from your table and start looping through a person's skills you can add that to the SKILLS object. Same for the Experience, etc etc.
Since this would essentially be like Parent Child nodes you could also do it with XML but the approach is really up to you.
You could then easily output the constructed resume as HTML (so your users on the site can see it live and may make changes, and then use a converter to convert to PDF (alots of languages have libraries to do just that). Most modern browsers can also already convert HTML pages to PDF too nowadays so you could also give them instructions on how to do that.
Just my two cents,
Hope it helps!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
So I'm working on producing my own version of a web/db project my friend was given in school. This is my first project in either area and I'm still learning. Part of the project description mentions all of the pages the client wants. I'm solving this by making an unordered list of links to the different pages with appropriate labels. Complex, I know.
Then I realized that every page will have this. My question is this: is there a way to class certain portions of code in html, so I can just have a "navigation list" in each page, instead of the full code of the list and everything associated with it, in every page?
I want the code to be clean and efficient. That's my motivation in this question.
Your question provides little detail, but it sounds like you want something like a php include. If you are running your site on your local, change the .html files to .php and do <?php include('includes/navigation.php') ?> where includes/navigation.php is a path to JUST your navigation code.
What you are talking about is templates. You cannot do it in plain html... You would need to use a server side language like php. You could also do it with a JavaScript templating language like handlebars or similar, but not in plain html.
If you don't want to use PHP or some other server side technology for a simple menu, you can try various Javascript plugins like MenuCool.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have just scratched the surface in the world of programming, and I need to know where to begin. I work for a Web-page writing articles, and I face a raise if I learn to format the article myself. I want to learn how to format, and also how to code. Is there anywhere in particular where I should begin my journey to programming things such as web-applications?
The following are just a hint. This journey is quite long and after a basic level, you have a multitude of options...
First of all: learn HTML. There's nothing to do if you cannot understand the content you're creating.
Learn CSS - this will help you to achieve the formatting in the right way and will make you understand how web pages are styled. That's where the fun begins, with knowing some CSS you will be able to make a web site look good.
Get a decent code editor for working, prototyping. If you really want to understand what's going on, then prefer non-WYSIWYG editors (you will see what I mean). The more decent you can get the better - this will help you in your daily work, better to not choose one which is irritating for you. (Personally I use PhpStorm which is a really good, professional tool. It might be too advanced for beginners.)
All web pages nowadays are created dynamically, for example via PHP. Learning to code in PHP will make you busy for quite a bit of time, so it would be the best to get a good book about it. (This will also start you up learning about databases, where the actual information is stored.) In my opinion, this is where the real part of web programming begins.
After writing some basic stuff with PHP, get familiar with different frameworks/CMSs just to know how we deal with big, real sites. (WordPress is great for starting and it's advanced enough to use it on a real site.) There's no point in reinventing the wheel, so always try to have a look whether others have done what you would like to do before. There's always a toolkit for the common tasks.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Hello I have an html page that through php pulls reports about sales and puts them in charts and graphs. It works great however I am looking for a way to convert a div box into a pdf so whoever is using the sight can print specific graphs and charts that are in selected div boxes. Is there a simple way to do this or is this unfeasible?
Thanks!
There are lots of answers here merely talking about making a PDF. That's the easy part - the hard part is finding an engine that renders the CSS well.
This question has been raised before, and the issue doesn't lie with feasibility (it's very possible and there are lots of solutions), but they vastly differ on their capabilities to translate CSS into PDF. Many just completely fail altogether.
From my research it looks like WKHTMLtoPDF is your best bet, as it uses a full WebKit engine to render the HTML first, then translate that into a PDF (I found a tutorial in addition to the docs).
The downside? It's command-line, so you'll need to engineer a solution involving either python or php to execute the program. Here's the PHP manual on executing a program.
Edit:
I have personally used FPDF before, which is a surprisingly light-weight solution with a caveat that you have to provide it with all of the HTML (edit:) line-by-line, rather than being able to use the browser-rendered result of a HTML page (a result that would include a rendered chart). I'm providing it merely as a suggestion and to help you work out where you can go from here, but it's not directly applicable to your complex CSS/chart problem.