feeds: properly use html template
This commit is contained in:
		@@ -99,7 +99,7 @@ item_link = ./a/@href
 | 
			
		||||
item_desc = ./div[class=desc]
 | 
			
		||||
item_content = ./div[class=content]
 | 
			
		||||
 | 
			
		||||
base = <!DOCTYPE html> <html> <head> <title>Feed reader by morss</title> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;" /> </head> <body> <div id="header"> <h1>@feed.title</h1> <h2>@feed.desc</h2> <p>- via morss</p> </div> <div id="content"> <div class="item"> <a class="title link" href="@item.link" target="_blank">@item.title</a> <div class="desc">@item.desc</div> <div class="content">@item.content</div> </div> </div> <script> var items = document.getElementsByClassName('item') for (var i in items) items[i].onclick = function() { this.classList.toggle('active') document.body.classList.toggle('noscroll') } </script> </body> </html>
 | 
			
		||||
base = file:reader.html.template
 | 
			
		||||
 | 
			
		||||
[twitter]
 | 
			
		||||
mode = html
 | 
			
		||||
 
 | 
			
		||||
@@ -47,7 +47,11 @@ def parse_rules(filename=None):
 | 
			
		||||
 | 
			
		||||
    for section in rules.keys():
 | 
			
		||||
        for arg in rules[section].keys():
 | 
			
		||||
            if '\n' in rules[section][arg]:
 | 
			
		||||
            if rules[section][arg].startswith('file:'):
 | 
			
		||||
                import_file = os.path.join(os.path.dirname(__file__), rules[section][arg][5:])
 | 
			
		||||
                rules[section][arg] = open(import_file).read()
 | 
			
		||||
 | 
			
		||||
            elif '\n' in rules[section][arg]:
 | 
			
		||||
                rules[section][arg] = rules[section][arg].split('\n')[1:]
 | 
			
		||||
 | 
			
		||||
    return rules
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,9 @@
 | 
			
		||||
@require(feed)
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html>
 | 
			
		||||
	<head>
 | 
			
		||||
		<title>@feed.title – via morss</title>
 | 
			
		||||
		<meta charset="UTF-8" />
 | 
			
		||||
		<meta name="description" content="@feed.desc (via morss)" />
 | 
			
		||||
		<title>Feed reader by morss</title>
 | 
			
		||||
		<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;" />
 | 
			
		||||
		<meta name="robots" content="noindex" />
 | 
			
		||||
 | 
			
		||||
		<style type="text/css">
 | 
			
		||||
			/* columns - from https://thisisdallas.github.io/Simple-Grid/simpleGrid.css */
 | 
			
		||||
@@ -32,7 +30,7 @@
 | 
			
		||||
				padding-right: 20px; /* column-space */
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			@@media handheld, only screen and (max-width: 767px) { /* @@ to escape from the template engine */
 | 
			
		||||
			@media handheld, only screen and (max-width: 767px) {
 | 
			
		||||
				#content {
 | 
			
		||||
					width: 100%;
 | 
			
		||||
					min-width: 0;
 | 
			
		||||
@@ -82,6 +80,7 @@
 | 
			
		||||
 | 
			
		||||
			#content {
 | 
			
		||||
				text-align: justify;
 | 
			
		||||
				line-height: 1.5em;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
				.item .title {
 | 
			
		||||
@@ -171,30 +170,17 @@
 | 
			
		||||
 | 
			
		||||
	<body>
 | 
			
		||||
		<div id="header">
 | 
			
		||||
			<h1>@feed.title</h1>
 | 
			
		||||
			@if feed.desc:
 | 
			
		||||
				<h2>@feed.desc</h2>
 | 
			
		||||
			@end
 | 
			
		||||
			<h1>RSS feed</h1>
 | 
			
		||||
			<h2>with full text articles</h2>
 | 
			
		||||
			<p>- via morss</p>
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		<div id="content">
 | 
			
		||||
			@for item in feed.items:
 | 
			
		||||
				<div class="item">
 | 
			
		||||
					@if item.link:
 | 
			
		||||
						<a class="title link" href="@item.link" target="_blank">@item.title</a>
 | 
			
		||||
					@else:
 | 
			
		||||
						<span class="title">@item.title</span>
 | 
			
		||||
					@end
 | 
			
		||||
					<div class="article">
 | 
			
		||||
						@if item.content:
 | 
			
		||||
							@item.content
 | 
			
		||||
						@else:
 | 
			
		||||
							@item.desc
 | 
			
		||||
						@end
 | 
			
		||||
					</div>
 | 
			
		||||
					<a class="title link" href="@item.link" target="_blank"></a>
 | 
			
		||||
					<div class="desc"></div>
 | 
			
		||||
					<div class="content"></div>
 | 
			
		||||
				</div>
 | 
			
		||||
			@end
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
	<script>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user