Skip to content

Commit

Permalink
feat: Use idnits3 for post submission nits check
Browse files Browse the repository at this point in the history
  • Loading branch information
kesara committed Nov 6, 2024
1 parent 701e8a5 commit 3dd7718
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion ietf/doc/views_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,14 @@ def document_main(request, name, rev=None, document_html=False):
# Stream description and name passing test
stream = ("draft-stream-" + doc.stream.slug) if doc.stream != None else "(None)"

# Nits URL
nits_url = ''
if 'xml' in found_types:
nits_url = f"{settings.IDNITS3_BASE_URL}?url={[fu[1] for fu in file_urls if fu[0] == 'xml'][0]}"
elif 'txt' in found_types:
nits_url = f"{settings.IDNITS_BASE_URL}?url={[fu[1] for fu in file_urls if fu[0] == 'plain text'][0]}"


html = None
js = None
css = None
Expand Down Expand Up @@ -711,7 +719,8 @@ def document_main(request, name, rev=None, document_html=False):
review_requests=review_requests,
no_review_from_teams=no_review_from_teams,
due_date=due_date,
diff_revisions=diff_revisions
diff_revisions=diff_revisions,
nits_url=nits_url
))

elif doc.type_id == "charter":
Expand Down
1 change: 1 addition & 0 deletions ietf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ def skip_unreadable_post(record):
IDTRACKER_BASE_URL = "https://datatracker.ietf.org"
RFCDIFF_BASE_URL = "https://author-tools.ietf.org/iddiff"
IDNITS_BASE_URL = "https://author-tools.ietf.org/api/idnits"
IDNITS3_BASE_URL = "https://author-tools.ietf.org/api/idnits3"
IDNITS_SERVICE_URL = "https://author-tools.ietf.org/idnits"

# Content security policy configuration (django-csp)
Expand Down
4 changes: 3 additions & 1 deletion ietf/templates/doc/document_draft.html
Original file line number Diff line number Diff line change
Expand Up @@ -653,14 +653,16 @@
</i>
Referenced by
</a>
{% if nits_url %}
<a class="btn btn-primary btn-sm"
href="{{ settings.IDNITS_BASE_URL }}?url=https://www.ietf.org/archive/id/{{ doc.filename_with_rev }}"
href="{{ nits_url }}"
rel="nofollow"
target="_blank">
<i class="bi bi-exclamation">
</i>
Nits
</a>
{% endif %}
<a class="btn btn-primary btn-sm"
href="https://mailarchive.ietf.org/arch/search/?q=%22{{ doc.name }}%22"
rel="nofollow"
Expand Down

0 comments on commit 3dd7718

Please sign in to comment.