rdmorganiser / rdmorganiser/rdmo

"Views" as standalone HTML; Django variables in HTML metadata

Open
#255 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

effort:moderate type:feature-request
Dominant language
Python
Stars
133
Forks
60
Avg merge
3d 14h
Merged PRs (30d)
21

Description

At the moment the view templates are created as HTML snippets, which then are "completed" to full HTML documents by RDMO by adding the missing tags <html>, <head>, <body> etc.

The system tolerates also ingesting standalone HTML code, but packs it all inside the <body> of the resulting HTML, overwriting therefore most of the information, at least all the <meta>data and part of the <style> declarations.

This is no simplification at all! On the contrary, it would be very useful (and in my case life saving!) as an administrator to define the metadata through Django syntax and to propagate them across the exported document (in DOCX, LaTeX and so on).

As an example:
What I define in the source code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>DMP_{{ values.project.funder.grant_nr }}_{{ values.project.research_question.acronym }}_v{{ values.project.dmp.dmp_version|default:"1" }}</title>
	<meta charset="UTF-8" />
	<meta name="category"	content="{{ values.project.funder.grant_nr }}" />
	<meta name="subject"	content="{{ values.project.research_question.acronym }}" />
	<meta name="description"	content="{{ values.project.research_question.title }}" />
	<meta name="keywords"	content="parole" />
	<meta name="contentStatus"	content="135" />
	<style type="text/css">
		body {	font-family: arial;	}
		h2 {	font-style: italics;	}
		table {	width: 100%; table-layout: fixed; border: 0; white-space: nowrap;	}
		td, th {	padding: 10px;	}
		#Titel{	color:white;background-color:black;text-align:center;line-height:21mm;font-size:2.5em;font-weight:bold;	}
	</style>
</head>

The page created by RDMO:

<!DOCTYPE html>
<html>
<head>
    <title>Erstellung DM-Pläne an der PTB</title>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta property="og:title" content="Erstellung DM-Pläne an der PTB" />
    <meta property="og:url" content="rdmo.ptb.de" />
    <meta name='baseurl' content="/" />
    <meta name='staticurl' content="/static/" />
    <link rel="shortcut icon" href="/static/core/img/favicon.png" type="image/png" />
    <script src="https://code.jquery.com//jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7//js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7//css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0//css/font-awesome.min.css" integrity="" crossorigin="anonymous" />
    <link rel="stylesheet" href="/static/CACHE/css/252cf797f6b4.css" type="text/css" />
</head>

The page ready to export:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>DMP___v1</title>
	<meta charset="UTF-8" />
	<meta name="category"	content="" />
	<meta name="subject"	content="" />
	<meta name="description"	content="" />
	<meta name="keywords"	content="parole" />
	<meta name="contentStatus"	content="135" />
	<style type="text/css">
		body {	font-family: arial;	}
		h2 {	font-style: italics;	}
		table {	width: 100%; table-layout: fixed; border: 0; white-space: nowrap;	}
		td, th {	padding: 10px;	}
		#Titel{	color:white;background-color:black;text-align:center;line-height:21mm;font-size:2.5em;font-weight:bold;	}
	</style>
</head>
<body>

(Here the Django variables seem also to have been stripped.)
In my imagination, these three should be equal.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how view templates are completed into full HTML and how the resulting document is passed to DOCX, LaTeX, and other exports. Reproduce the issue with the standalone HTML example and its Django variables. Done means the source, rendered page, and export preserve the document structure, metadata, and styles instead of nesting them inside a new body.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.