Even nested WITHs (although the heavy lifting is done by JSQLParser,
where I am only a strong contributor for).

A good test for the Highlighter is this one, Pygments gets it totally
wrong:
SELECT Overlaps( overlaps ) AS overlaps
FROM overlaps.overlaps overlaps
WHERE overlaps = 'overlaps'
    AND (CURRENT_TIME, INTERVAL '1' HOUR) OVERLAPS (CURRENT_TIME, INTERVAL -'1' 
HOUR)

Cheers

Andreas

On Tue, 2022-09-20 at 08:10 +0200, Dave The Dane wrote:
> Can it handle the WITH Clause?
> ...probably the most unknown tool for structuring SQL Queries!
> 
> DaveLaw,
> Subquery-Factoring Evangelist 😎
> 
> On 20/09/2022 07:45, Andreas Reichel wrote:
>  
> > 
> > Thanks Dave.  
> > 
> > I have written a good SQL
> > Formatter https://manticore-projects.com/JSQLFormatter/index.html
> > 
> > I only will need to add xsl-fo output which is easy. 
> > 
> > All the best
> > Andreas
> > 
> > On 20 Sept 2022 06:01, Dave The Dane <xmlgraphics.d...@apconsult.de> wrote:
> >  
> > > Would ANTLR & their Grammars for Java, SQL, etc. make sense for
> > > this?
> > > https://www.antlr.org/
> > > https://github.com/antlr/grammars-v4
> > > 
> > > All the best,
> > > DaveLaw
> > > 
> > > On 19/09/2022 10:07, Andreas Reichel wrote:
> > > 
> > > > Klaus and Team,
> > > > 
> > > > thank you for your feedback.
> > > > I have actually figured out something working nicely:
> > > > 
> > > > 1) based on Pygments
> > > > 2) use the XSLFO Pygments formatter (can be installed from PIP,
> > > > the code is fairly simple and straight forward)
> > > > 3) from your XML document containing the Code Block:
> > > > a) iterate through all code blocks
> > > >         b) call Pygments with the XSLFO Formatter and format
> > > > the block into a temporary XML file (your FO styled codeblock)
> > > >         c) when this succeeded, add to the Code Block node a
> > > > childnode with the absolute path to this temporary XML file
> > > > 4) amend your XSL file and for each code-block use the
> > > > XSL:COPY-OF directive to insert the FO formatted content of the
> > > > temporary XML file into the final PDF directly. (Apply a
> > > > XSL:CHOOSE, when child exists then XSL:COPY-OF otherwise
> > > > XSL:VALUE.)
> > > > 5) clean up all the temporary files from step 3)
> > > > 
> > > > Caveats: 
> > > > a) you need to call Python Pygmentize from Java using
> > > > ProcessBuilder/Process (and react to failures)
> > > > b) Pygments understanding of the code is limited and the
> > > > highlighting can be questionable especially for SQL. However, I
> > > > will use my own SQL Formatter to properly format complex SQL in
> > > > FO
> > > > 
> > > > Cheers!
> > > > 
> > > > 
> > > 
> >  
> > -------------------------------------------------------------------
> > -- To unsubscribe, e-mail:
> > fop-users-unsubscr...@xmlgraphics.apache.org For additional
> > commands, e-mail: fop-users-h...@xmlgraphics.apache.org
>  

Reply via email to