0

An article is to be placed inside the html file instead of {{post.content}} but the html file does not display the results correctly

htmlcode:

{% block body %}
<!-- Page Header -->

{%set fname = 'img/' + post.img_file%}
<header class="masthead" style="background-image: url('{{ url_for('static', filename=fname) }}')">
 <div class="overlay"></div>
 <div class="container">
   <div class="row">
     <div class="col-lg-8 col-md-10 mx-auto">
       <div class="post-heading">
         <h1>{{ post.title }}</h1>
         <h2 class="subheading">{{post.tagline}}</h2>
         <span class="meta">Posted by
           <a href="#">Admin</a>
           on {{post.date}}</span>
       </div>
     </div>
   </div>
 </div>
</header>

<!-- Post Content -->
<article>
 <div class="container">
   <div class="row">
     <div class="col-lg-8 col-md-10 mx-auto">

     </div>
   </div>
 </div>
</article>

{% endblock %}
-- article in database--
FORTNITE: BATTLE ROYALE
Price: Free
Fortnite by Epic Games has been a great game over the years. Streamers, mostly on Twitch and YouTube play this game very often. It is a battle royale game in which 100 players come in one battlefield to fight against each other. The fun fact is that, this is the first ever battle royale game in which players can build walls to protect themselves from their opponent. This game also has different characters with different abilities. The thing that makes this game more interesting is that, this game has many emotes which are fun to watch.

Pros:

--article in flask app output--

FORTNITE: BATTLE ROYALE Price: Free Fortnite by Epic Games has been a great game over the years. Streamers, mostly on Twitch and YouTube play this game very often. It is a battle royale game in which 100 players come in one battlefield to fight against each other. The fun fact is that, this is the first ever battle royale game in which players can build walls to protect themselves from their opponent. This game also has different characters with different abilities. The thing that makes this game more interesting is that, this game has many emotes which are fun to watch.

why is it so?why is the price line coming inder the fortnite heading? why does it render empty spaces as only 1 space character

thefoodiee
  • 13
  • 3
  • That is not HTML but template. What is the input and expected output? – mplungjan Aug 10 '20 at 08:52
  • the input is being loaded from the phpmyadmin database and the expected output is an article which i have posted there the article in the database is shown as a proper arranged article but in the output page there is an error – thefoodiee Aug 10 '20 at 13:40
  • see the edited post for my error – thefoodiee Aug 10 '20 at 13:46
  • Newlines are ignored in HTML unless you add a `
    ` tag with wrap
    – mplungjan Aug 10 '20 at 13:57
  • actually, it is a blog and adding the ```
    ``` tag isnt required for it 
    it makes the sentence very long
    later i searched on the internet for the same problem
    i found out that there is some css formatting to be done
    after doing ```white-space: pre-wrap;``` the text was fixed but the image above the text and the navbar were completely changed
    do know a way of how to add css style to a jinja variable or a specific element of the html file and not to the whole page
    – thefoodiee Aug 10 '20 at 16:57

0 Answers0