On 10/12/11 21:06, Dag Wieers wrote:
On Sat, 10 Dec 2011, Stuart Rackham wrote:

On 10/12/11 16:07, Lex Trotman wrote:

Unfortunately I think there is some internal hardcoded processing of
blocks called "comment" in asciidoc.py. The following works fine:

Correct! The devil is always in the details. asciidoc does not consume
attribute lists that precede comments. I'm working on the complete annotation
block comment patch, but here's the diff:

Even with this, it doesn't work. I tried this as well. (Looking for 'comment'
was quite easy, there were two conditional statements I removed to make comments
in line with other blocks. To no avail :-/


Hi Dag

I've attached a patch which works with the xhtml11 backend.

I'm not happy with it though:

- I haven't included the hideannotations attribute as it requires an asciidoc code change (the template is split at '|' before attributes are processed which makes it impossible to drop the template completely).

- The DocBook 'remark' element will limit the annotation to a single paragraph because 'remark' can't contain block elements.

For such a small addition on top of the existing comments mechanism I'm getting that uneasy feeling that the cure is worse than the disease. Outside of ODF there's never been a request or a use-case for a displayable block comments, so for now I'm not adding it to the default AsciiDoc syntax. I think the best course of action is to go back to the original annotation listingblock style in odf.conf. Source containing annotations will be ODF specific but they won't break other backends -- you'll get a 'missing style' warning but the annotation will be displayed in a listing block.

Cheers, Stuart

--
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/asciidoc?hl=en.

diff -r 480a633f0fb7 asciidoc.conf
--- a/asciidoc.conf	Sun Dec 04 12:31:25 2011 +1300
+++ b/asciidoc.conf	Sun Dec 11 15:37:15 2011 +1300
@@ -288,6 +288,8 @@
 [blockdef-comment]
 delimiter=^/{4,}$
 options=skip
+posattrs=style
+annotation-style=template="annotationblock",options=(),subs=["normal"]
 
 [blockdef-sidebar]
 delimiter=^\*{4,}$
diff -r 480a633f0fb7 asciidoc.py
--- a/asciidoc.py	Sun Dec 04 12:31:25 2011 +1300
+++ b/asciidoc.py	Sun Dec 11 15:37:15 2011 +1300
@@ -3030,9 +3030,8 @@
         AbstractBlock.translate(self)
         reader.read()   # Discard delimiter.
         attrs = {}
-        if self.short_name() != 'comment':
-            BlockTitle.consume(attrs)
-            AttributeList.consume(attrs)
+        BlockTitle.consume(attrs)
+        AttributeList.consume(attrs)
         self.merge_attributes(attrs)
         self.push_blockname()
         options = self.parameters.options
diff -r 480a633f0fb7 stylesheets/asciidoc.css
--- a/stylesheets/asciidoc.css	Sun Dec 04 12:31:25 2011 +1300
+++ b/stylesheets/asciidoc.css	Sun Dec 11 15:37:15 2011 +1300
@@ -113,7 +113,7 @@
   margin-top: 1.5em;
   margin-bottom: 1.5em;
 }
-div.imageblock, div.exampleblock, div.verseblock,
+div.imageblock, div.exampleblock, div.verseblock, div.annotationblock,
 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
 div.admonitionblock {
   margin-top: 1.0em;
@@ -166,7 +166,7 @@
   padding: 0.5em;
 }
 
-div.quoteblock, div.verseblock {
+div.quoteblock, div.verseblock, div.annotationblock {
   padding-left: 1.0em;
   margin-left: 1.0em;
   margin-right: 10%;
@@ -174,6 +174,18 @@
   color: #888;
 }
 
+div.annotationblock {
+  color: black;
+  background-color: yellow;
+}
+div.annotationblock > div.attribution {
+  padding-top: 0.5em;
+  text-align: right;
+  color: green;
+  color: #527bbd;
+  font-weight: bold;
+}
+
 div.quoteblock > div.attribution {
   padding-top: 0.5em;
   text-align: right;
diff -r 480a633f0fb7 xhtml11.conf
--- a/xhtml11.conf	Sun Dec 04 12:31:25 2011 +1300
+++ b/xhtml11.conf	Sun Dec 11 15:37:15 2011 +1300
@@ -286,6 +286,17 @@
 template::[admonitionblock]
 
 # Delimited blocks.
+[annotationblock]
+<div class="annotationblock{role? {role}}{unbreakable-option? unbreakable}"{id? id="{id}"}>
+<div class="content">
+|
+</div>
+<div class="attribution">
+{2}<br />
+{3}<br />
+</div>
+</div>
+
 [listingblock]
 <div class="listingblock{role? {role}}{unbreakable-option? unbreakable}"{id? id="{id}"}>
 <div class="title">{caption=}{title}</div>

Reply via email to