|
60 | 60 | needed_ballot_positions, nice_consensus, prettify_std_name, update_telechat, has_same_ballot, |
61 | 61 | get_initial_notify, make_notify_changed_event, make_rev_history, default_consensus, |
62 | 62 | add_events_message_info, get_unicode_document_content, build_doc_meta_block, |
63 | | - augment_docs_and_user_with_user_info, irsg_needed_ballot_positions ) |
| 63 | + augment_docs_and_user_with_user_info, irsg_needed_ballot_positions, build_doc_supermeta_block, |
| 64 | + build_file_urls ) |
64 | 65 | from ietf.group.models import Role, Group |
65 | 66 | from ietf.group.utils import can_manage_group_type, can_manage_materials, group_features_role_filter |
66 | 67 | from ietf.ietfauth.utils import ( has_role, is_authorized_in_doc_stream, user_is_person, |
@@ -210,69 +211,21 @@ def document_main(request, name, rev=None): |
210 | 211 |
|
211 | 212 | latest_revision = None |
212 | 213 |
|
213 | | - if doc.get_state_slug() == "rfc": |
214 | | - # content |
215 | | - content = doc.text_or_error() # pyflakes:ignore |
216 | | - content = markup_txt.markup(maybe_split(content, split=split_content)) |
217 | | - |
218 | | - # file types |
219 | | - base_path = os.path.join(settings.RFC_PATH, name + ".") |
220 | | - possible_types = settings.RFC_FILE_TYPES |
221 | | - found_types = [t for t in possible_types if os.path.exists(base_path + t)] |
222 | | - |
223 | | - base = "https://www.rfc-editor.org/rfc/" |
224 | | - |
225 | | - file_urls = [] |
226 | | - for t in found_types: |
227 | | - label = "plain text" if t == "txt" else t |
228 | | - file_urls.append((label, base + name + "." + t)) |
| 214 | + file_urls, found_types = build_file_urls(doc) |
229 | 215 |
|
230 | | - if "pdf" not in found_types and "txt" in found_types: |
231 | | - file_urls.append(("pdf", base + "pdfrfc/" + name + ".txt.pdf")) |
232 | | - |
233 | | - if "txt" in found_types: |
234 | | - file_urls.append(("htmlized", settings.TOOLS_ID_HTML_URL + name)) |
235 | | - if doc.tags.filter(slug="verified-errata").exists(): |
236 | | - file_urls.append(("with errata", settings.RFC_EDITOR_INLINE_ERRATA_URL.format(rfc_number=rfc_number))) |
| 216 | + content = doc.text_or_error() # pyflakes:ignore |
| 217 | + content = markup_txt.markup(maybe_split(content, split=split_content)) |
237 | 218 |
|
| 219 | + if doc.get_state_slug() == "rfc": |
238 | 220 | if not found_types: |
239 | 221 | content = "This RFC is not currently available online." |
240 | 222 | split_content = False |
241 | 223 | elif "txt" not in found_types: |
242 | 224 | content = "This RFC is not available in plain text format." |
243 | 225 | split_content = False |
244 | 226 | else: |
245 | | - content = doc.text_or_error() # pyflakes:ignore |
246 | | - content = markup_txt.markup(maybe_split(content, split=split_content)) |
247 | | - |
248 | | - # file types |
249 | | - base_path = os.path.join(settings.INTERNET_DRAFT_PATH, doc.name + "-" + doc.rev + ".") |
250 | | - possible_types = settings.IDSUBMIT_FILE_TYPES |
251 | | - found_types = [t for t in possible_types if os.path.exists(base_path + t)] |
252 | | - |
253 | | - # if not snapshot and doc.get_state_slug() == "active": |
254 | | - # base = settings.IETF_ID_URL |
255 | | - # else: |
256 | | - # base = settings.IETF_ID_ARCHIVE_URL |
257 | | - base = settings.IETF_ID_ARCHIVE_URL |
258 | | - |
259 | | - file_urls = [] |
260 | | - for t in found_types: |
261 | | - label = "plain text" if t == "txt" else t |
262 | | - file_urls.append((label, base + doc.name + "-" + doc.rev + "." + t)) |
263 | | - |
264 | | - if "pdf" not in found_types: |
265 | | - file_urls.append(("pdf", settings.TOOLS_ID_PDF_URL + doc.name + "-" + doc.rev + ".pdf")) |
266 | | - #file_urls.append(("htmlized", settings.TOOLS_ID_HTML_URL + doc.name + "-" + doc.rev)) |
267 | | - file_urls.append(("htmlized (tools)", settings.TOOLS_ID_HTML_URL + doc.name + "-" + doc.rev)) |
268 | | - file_urls.append(("htmlized", urlreverse('ietf.doc.views_doc.document_html', kwargs=dict(name=doc.name, rev=doc.rev)))) |
269 | | - |
270 | | - # latest revision |
271 | 227 | latest_revision = doc.latest_event(NewRevisionDocEvent, type="new_revision") |
272 | 228 |
|
273 | | - # bibtex |
274 | | - file_urls.append(("bibtex", "bibtex")) |
275 | | - |
276 | 229 | # ballot |
277 | 230 | iesg_ballot_summary = None |
278 | 231 | irsg_ballot_summary = None |
@@ -717,8 +670,10 @@ def document_html(request, name, rev=None): |
717 | 670 | else: |
718 | 671 | doc = doc.fake_history_obj(rev) |
719 | 672 | if doc.type_id in ['draft',]: |
| 673 | + doc.supermeta = build_doc_supermeta_block(doc) |
720 | 674 | doc.meta = build_doc_meta_block(doc, settings.HTMLIZER_URL_PREFIX) |
721 | 675 |
|
| 676 | + # TODO: not using top - clean put building and passing it |
722 | 677 | return render(request, "doc/document_html.html", {"doc":doc, "top":top, "navbar_mode":"navbar-static-top", }) |
723 | 678 |
|
724 | 679 | def check_doc_email_aliases(): |
|
0 commit comments