- From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 20 Aug 2010 18:16:59 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/spec-author-view
In directory hutz:/tmp/cvs-serv27802
Modified Files:
dfn.js patch.anolis style.css
Log Message:
make some refinements suggested by Hixie
Index: patch.anolis
===================================================================
RCS file: /sources/public/html5/spec-author-view/patch.anolis,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- patch.anolis 20 Aug 2010 05:53:11 -0000 1.8
+++ patch.anolis 20 Aug 2010 18:16:57 -0000 1.9
@@ -1,6 +1,6 @@
diff -r 16550726fd0d anolis
--- a/anolis Sun Aug 30 16:53:19 2009 -0500
-+++ b/anolis Fri Aug 20 14:52:17 2010 +0900
++++ b/anolis Sat Aug 21 03:00:25 2010 +0900
@@ -70,10 +70,10 @@
def getOptParser():
@@ -16,7 +16,7 @@
diff -r 16550726fd0d anolislib/processes/filter.py
--- a/anolislib/processes/filter.py Sun Aug 30 16:53:19 2009 -0500
-+++ b/anolislib/processes/filter.py Fri Aug 20 14:52:17 2010 +0900
++++ b/anolislib/processes/filter.py Sat Aug 21 03:00:25 2010 +0900
@@ -5,23 +5,4 @@
return
selector = cssselect.CSSSelector(kwargs["filter"])
@@ -44,8 +44,8 @@
+ element.drop_tree()
diff -r 16550726fd0d anolislib/processes/terms.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/anolislib/processes/terms.py Fri Aug 20 14:52:17 2010 +0900
-@@ -0,0 +1,337 @@
++++ b/anolislib/processes/terms.py Sat Aug 21 03:00:25 2010 +0900
+@@ -0,0 +1,325 @@
+# coding=UTF-8
+# Copyright (c) 2010 Michael(tm) Smith
+#
@@ -135,12 +135,14 @@
+ indexEntry.text = "\n"
+ # termName is container of the name of the term as it appears in the index
+ termName = etree.Element(u"dt")
-+ # textContent of the DOM textContent of this <dfn> element,
-+ # and is what we put at the beginning of the termName
-+ textContent = dfn.text_content()
++ if "id" in term.attrib:
++ del term.attrib["id"]
++ term.tag = "span"
++ term.tail = "\n"
++ termName.append(term);
+ # we need a first letter so that we can build navigational
+ # links for the alphabetic nav bars injected into the index
-+ termFirstLetter = textContent[0].upper()
++ termFirstLetter = term.text_content()[0].upper()
+ if termFirstLetter != prevTermFirstLetter and termFirstLetter.isalpha():
+ firstLetters.append(termFirstLetter)
+ indexNavHelpers[termFirstLetter] = etree.Element(u"div",{u"class": "index-nav", u"id": "index-terms_"+termFirstLetter})
@@ -153,22 +155,16 @@
+ expr = "count(//dfn\
+ [normalize-space(translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'))\
+ =normalize-space(translate($content,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'))])"
-+ if ElementTree.xpath(expr, content = textContent) > 1:
++ if ElementTree.xpath(expr, content = term.text_content()) > 1:
+ # we have more than one <dfn> in the document whose
+ # content is a case-insensitive match for the
+ # textContent of this <dfn>; so, we qualify the name of
+ # each such term in the index listing by appending the
+ # id of the <dfn> to it
-+ termName.text = textContent+" "
+ indexEntryID = etree.Element(u"span",{u"class": u"index-id", u"title": u""})
+ indexEntryID.text = "("+termID+")"
+ indexEntryID.tail = " "
+ termName.append(indexEntryID)
-+ else:
-+ # otherwise, the textContent of this <dfn> is unique
-+ # among the <dfn>s in this document, so we just use the
-+ # textContent as the name of the term
-+ termName.text = textContent
+ termName.tail= "\n"
+ indexEntry.append(termName)
+ # #########################################################
@@ -237,21 +233,13 @@
+ # to add that instance now
+ if n == 1:
+ indexEntry.append(instanceItem)
-+ # if length of instanceList isn't greater than one,
-+ # it means the <dfn> defining instance is the only one in
-+ # the list, and the document contains no hyperlinked
-+ # references to this term at all, so we add a note to
-+ # indicate that
+ if not len(instanceList) > 1:
+ # if we don't have more than one item in this list, it
+ # means the <dfn> defining instance is the only item in
+ # the list, and the document contains no hyperlinked
+ # references back to that defining instance at all, so
-+ # we add a note to indicate that
-+ noRefsNote = etree.Element(u"dd",{u"class": "index-norefs"})
-+ noRefsNote.text = "No references in this document."
++ # we need to set a flag to indicate that
+ indexEntry.set(u"class","has-norefs")
-+ indexEntry.append(noRefsNote)
+ self.terms.append(indexEntry)
+ indexEntry.tail = "\n"
+ # ######################################################################
Index: style.css
===================================================================
RCS file: /sources/public/html5/spec-author-view/style.css,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- style.css 20 Aug 2010 04:24:20 -0000 1.10
+++ style.css 20 Aug 2010 18:16:57 -0000 1.11
@@ -79,6 +79,9 @@
.dfnPanel p {
margin-bottom: 3px;
}
+.dfnPanel .norefs {
+ font-weight: bold;
+}
.dfnPanel dd {
/* style this just like an li */
display: list-item;
Index: dfn.js
===================================================================
RCS file: /sources/public/html5/spec-author-view/dfn.js,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- dfn.js 20 Aug 2010 05:51:17 -0000 1.15
+++ dfn.js 20 Aug 2010 18:16:57 -0000 1.16
@@ -1,6 +1,6 @@
// No copyright is asserted on this file.
-function initDfn(node, panelDiv) {
+function xhrDfnShow(node, panel, panelDiv) {
var request = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
var loading = document.createElement("i");
loading.textContent = "loading";
@@ -17,11 +17,8 @@
if (request.readyState == 4) {
panelDiv.innerHTML = request.responseText;
if (panelDiv.firstChild.className == "has-norefs") {
- var definingInstance = panelDiv.firstChild.firstChild;
- while (definingInstance.nodeType != definingInstance.ELEMENT_NODE) {
- definingInstance = definingInstance.nextSibling;
- }
- panelDiv.firstChild.removeChild(definingInstance);
+ panel.removeChild(panel.firstChild.nextSibling);
+ panelDiv.innerHTML = "<p class='norefs'>No references in this document.</p>"
}
}
};
@@ -74,18 +71,15 @@
if (node.id) {
introP.textContent = "Referenced in:";
if (document.documentElement.className.indexOf("split") != -1) {
- initDfn(node, panelDiv);
+ xhrDfnShow(node, panel, panelDiv);
} else {
var targetNode = document.getElementById(node.id+"_index");
if (targetNode) {
panelDiv.innerHTML = targetNode.innerHTML;
panelDiv.removeChild(panelDiv.firstChild);
if (targetNode.className == "has-norefs") {
- var definingInstance = panelDiv.firstChild;
- while (definingInstance.nodeType != definingInstance.ELEMENT_NODE) {
- definingInstance = definingInstance.nextSibling;
- }
- panelDiv.removeChild(definingInstance);
+ panel.removeChild(introP);
+ panelDiv.innerHTML = "<p class='norefs'>No references in this document.</p>";
}
} else {
console.log(node);
Received on Friday, 20 August 2010 18:17:30 UTC