"Normal" SGML from Jade

Subject: "Normal" SGML from Jade
From: Brandon Ibach <bibach@xxxxxxxxxxxxxx>
Date: Fri, 15 Oct 1999 02:19:35 -0500
   As discussed a short time back, here is a patch for Jade (against
1.2.2, but will probably work with other versions) which adds an
option to have Jade *not* put in the extra line feeds inside of tags,
thus producing more "normal looking" SGML.  You should be able to run
"patch" on this right in the top Jade source directory.
   To activate this feature, use "-t sgml-raw" in place of "-t sgml"
on your Jade command line.
   This *may* show up in the will-be-release-any-day-now Jade 1.3, so
if you just want a recompiled binary with this, you shouldn't have to
wait long.  What say, guys... pop this in for 1.3?

-Brandon :)
diff -C 2 jade-d/TransformFOTBuilder.cxx jade/TransformFOTBuilder.cxx
*** jade-d/TransformFOTBuilder.cxx	Sun May  2 08:09:36 1999
--- jade/TransformFOTBuilder.cxx	Fri Oct 15 01:57:45 1999
***************
*** 178,182 ****
      DocumentTypeNIC nic_;
    };
!   TransformFOTBuilder(CmdLineApp *, bool xml);
    ~TransformFOTBuilder();
    void startElement(const ElementNIC &);
--- 178,182 ----
      DocumentTypeNIC nic_;
    };
!   TransformFOTBuilder(CmdLineApp *, bool xml, const Vector<StringC> &options);
    ~TransformFOTBuilder();
    void startElement(const ElementNIC &);
***************
*** 238,241 ****
--- 238,243 ----
    ReState state_;
    bool preserveSdata_;
+   char RE_[2];
+   char SP_[2];
    // Really Vector<bool>
    StringC preserveSdataStack_;
***************
*** 244,247 ****
--- 246,250 ----
  FOTBuilder *makeTransformFOTBuilder(CmdLineApp *app,
  				    bool xml,
+ 				    const Vector<StringC> &options,
  				    const FOTBuilder::Extension *&ext)
  {
***************
*** 312,316 ****
    };
    ext = extensions;
!   return new TransformFOTBuilder(app, xml);
  }
  
--- 315,319 ----
    };
    ext = extensions;
!   return new TransformFOTBuilder(app, xml, options);
  }
  
***************
*** 321,325 ****
  }
  
! TransformFOTBuilder::TransformFOTBuilder(CmdLineApp *app, bool xml)
  : app_(app),
    xml_(xml),
--- 324,329 ----
  }
  
! TransformFOTBuilder::TransformFOTBuilder(CmdLineApp *app, bool xml,
! 					 const Vector<StringC> &options)
  : app_(app),
    xml_(xml),
***************
*** 332,335 ****
--- 336,349 ----
    os_ = topOs_.pointer();
    preserveSdataStack_ += 0;
+   RE_[0] = RE;
+   RE_[1] = 0;
+   SP_[0] = RE;
+   SP_[1] = 0;
+   for (size_t i = 0; i < options.size(); i++) {
+     if (options[i] == app_->systemCharset().execToDesc("raw")) {
+       RE_[0] = 0;
+       SP_[0] = ' ';
+     }
+   }
  }
  
***************
*** 367,371 ****
  {
    for (size_t i = 0; i < atts.size(); i += 2) {
!     os() << RE << atts[i] << '=';
      const StringC &s = atts[i + 1];
      if (!contains(s, '"'))
--- 381,385 ----
  {
    for (size_t i = 0; i < atts.size(); i += 2) {
!     os() << SP_ << atts[i] << '=';
      const StringC &s = atts[i + 1];
      if (!contains(s, '"'))
***************
*** 397,401 ****
    os() << s;
    attributes(nic.attributes);
!   os() << RE << '>';
    openElements_.push_back(s);
    start();
--- 411,415 ----
    os() << s;
    attributes(nic.attributes);
!   os() << RE_ << '>';
    openElements_.push_back(s);
    start();
***************
*** 422,426 ****
    flushPendingReCharRef();
    os() << "</" << openElements_.back();
!   os() << RE << '>';
    openElements_.resize(openElements_.size() - 1);
    end();
--- 436,440 ----
    flushPendingReCharRef();
    os() << "</" << openElements_.back();
!   os() << RE_ << '>';
    openElements_.resize(openElements_.size() - 1);
    end();
diff -C 2 jade-d/TransformFOTBuilder.h jade/TransformFOTBuilder.h
*** jade-d/TransformFOTBuilder.h	Sun May  2 07:51:53 1999
--- jade/TransformFOTBuilder.h	Wed Oct 13 17:56:56 1999
***************
*** 14,17 ****
--- 14,18 ----
  FOTBuilder *makeTransformFOTBuilder(CmdLineApp *app,
  				    bool xml,
+ 				    const Vector<StringC> &options,
  				    const FOTBuilder::Extension *&);
  
diff -C 2 jade-d/jade.cxx jade/jade.cxx
*** jade-d/jade.cxx	Sun May  2 10:47:07 1999
--- jade/jade.cxx	Wed Oct 13 18:14:40 1999
***************
*** 177,181 ****
    case sgmlType:
    case xmlType:
!     return makeTransformFOTBuilder(this, outputType_ == xmlType, exts);
    default:
      break;
--- 177,181 ----
    case sgmlType:
    case xmlType:
!     return makeTransformFOTBuilder(this, outputType_ == xmlType, outputOptions_, exts);
    default:
      break;
Current Thread