Commits

ms2ger  committed d6a8e5c

Only split the references section if explicitly asked and always remove the data-anolis-ref attribute.

  • Participants
  • Parent commits 2be3def

Comments (0)

Files changed (2)

     parser.add_option("", "--w3c-shortname", action="store", type=str,
                       dest="w3c_shortname", help="Shortname of the document")
 
+    parser.add_option("", "--split-references-section", action="store_true",
+                      help=SUPPRESS_HELP)
+
     parser.set_defaults(
         processes=["filter", "sub", "toc", "xref", "annotate"],
         parser="html5lib",
         w3c_compat_substitutions=False,
         w3c_compat_crazy_substitutions=False,
         w3c_status='ED',
-        w3c_shortname=''
+        w3c_shortname='',
+        split_references_section=False
     )
 
     return parser

File anolislib/processes/refs.py

 class refs(object):
   """Add references section."""
 
-  def __init__(self, ElementTree, w3c_compat=False, **kwargs):
+  def __init__(self, ElementTree, split_references_section=False, **kwargs):
     self.refs = {}
     self.usedrefs = []
     self.foundrefs = {}
     self.normativerefs = {}
-    self.addReferencesLinks(ElementTree, w3c_compat=w3c_compat, **kwargs)
+    self.addReferencesLinks(ElementTree, **kwargs)
     self.usedrefs.sort()
     self.buildReferences(ElementTree, **kwargs)
-    if not w3c_compat:
+    if not split_references_section:
       self.addReferencesList(ElementTree, **kwargs)
     else:
       self.addTwoReferencesLists(ElementTree, **kwargs)
     last = authors.pop()
     return "%s and %s" % (", ".join(authors), last)
 
-  def addReferencesLinks(self, ElementTree, w3c_compat=False, **kwargs):
+  def addReferencesLinks(self, ElementTree, **kwargs):
     for element in ElementTree.getroot().findall(".//span[@data-anolis-ref]"):
-      if w3c_compat:
-        del element.attrib["data-anolis-ref"]
+      del element.attrib["data-anolis-ref"]
       ref = element.text
       element.tag = "a"
       element.set("href", "#refs" + ref)