Return-Path:
Delivered-To: apmail-incubator-sling-commits-archive@locus.apache.org
Received: (qmail 29443 invoked from network); 4 Mar 2008 13:40:54 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2)
by minotaur.apache.org with SMTP; 4 Mar 2008 13:40:54 -0000
Received: (qmail 32359 invoked by uid 500); 4 Mar 2008 13:40:50 -0000
Delivered-To: apmail-incubator-sling-commits-archive@incubator.apache.org
Received: (qmail 32317 invoked by uid 500); 4 Mar 2008 13:40:50 -0000
Mailing-List: contact sling-commits-help@incubator.apache.org; run by ezmlm
Precedence: bulk
List-Help:
List-Unsubscribe:
List-Post:
List-Id:
Reply-To: sling-dev@incubator.apache.org
Delivered-To: mailing list sling-commits@incubator.apache.org
Received: (qmail 32308 invoked by uid 99); 4 Mar 2008 13:40:50 -0000
Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136)
by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Mar 2008 05:40:50 -0800
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3)
by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Mar 2008 13:40:22 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
id 20B801A983A; Tue, 4 Mar 2008 05:40:33 -0800 (PST)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r633474 - in /incubator/sling/trunk/extensions: ./ apt/
apt/apt-parser/ apt/apt-parser/src/ apt/apt-parser/src/main/
apt/apt-parser/src/main/java/ apt/apt-parser/src/main/java/org/
apt/apt-parser/src/main/java/org/apache/ apt/apt-parser/src...
Date: Tue, 04 Mar 2008 13:40:26 -0000
To: sling-commits@incubator.apache.org
From: bdelacretaz@apache.org
X-Mailer: svnmailer-1.0.8
Message-Id: <20080304134033.20B801A983A@eris.apache.org>
X-Virus-Checked: Checked by ClamAV on apache.org
Author: bdelacretaz
Date: Tue Mar 4 05:40:21 2008
New Revision: 633474
URL: http://svn.apache.org/viewvc?rev=633474&view=rev
Log:
SLING-305, APT parser bundle
Added:
incubator/sling/trunk/extensions/
incubator/sling/trunk/extensions/apt/
incubator/sling/trunk/extensions/apt/apt-parser/ (with props)
incubator/sling/trunk/extensions/apt/apt-parser/pom.xml (with props)
incubator/sling/trunk/extensions/apt/apt-parser/src/
incubator/sling/trunk/extensions/apt/apt-parser/src/main/
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParseException.java (with props)
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParser.java (with props)
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptParser.java (with props)
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptSink.java (with props)
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/MacroResolver.java (with props)
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParseExceptionImpl.java (with props)
incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParserImpl.java (with props)
incubator/sling/trunk/extensions/apt/apt-parser/src/test/
incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/
incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/
incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/apache/
incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/apache/sling/
incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/apache/sling/apt/
incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/apache/sling/apt/parser/
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Mar 4 05:40:21 2008
@@ -0,0 +1,10 @@
+target
+bin
+*.iml
+*.ipr
+*.iws
+.settings
+.project
+.classpath
+.externalToolBuilders
+
Added: incubator/sling/trunk/extensions/apt/apt-parser/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/apt/apt-parser/pom.xml?rev=633474&view=auto
==============================================================================
--- incubator/sling/trunk/extensions/apt/apt-parser/pom.xml (added)
+++ incubator/sling/trunk/extensions/apt/apt-parser/pom.xml Tue Mar 4 05:40:21 2008
@@ -0,0 +1,91 @@
+
+
+
+ 4.0.0
+
+ org.apache.sling
+ sling
+ 1-incubator-SNAPSHOT
+ ../../../parent/pom.xml
+
+
+ org.apache.sling.extensions.apt.parser
+ bundle
+ 2.0.0-incubator-SNAPSHOT
+
+ Sling - APT parser
+
+ Parser for the Sling variant of the APT (Almost Plain Text)
+ structured text format.
+
+
+
+
+ scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/commons/apt-parser
+
+
+ scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/apt-parser
+
+
+ http://svn.apache.org/viewvc/incubator/sling/trunk/commons/apt-parser
+
+
+
+
+
+
+ org.apache.felix
+ maven-scr-plugin
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+
+ !org.apache.sling.apt.parser.internal,
+ org.apache.sling.apt.parser.*
+
+
+ org.apache.sling.apt.parser.internal,
+ org.apache.maven.doxia.*
+
+
+
+
+
+
+
+
+
+ org.apache.maven.doxia
+ doxia-module-apt
+ 1.0-alpha-10
+
+
+ junit
+ junit
+ test
+
+
+
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParseException.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParseException.java?rev=633474&view=auto
==============================================================================
--- incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParseException.java (added)
+++ incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParseException.java Tue Mar 4 05:40:21 2008
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.apt.parser;
+
+/** Generic SlingAptParseException */
+public abstract class SlingAptParseException extends Exception {
+
+ protected SlingAptParseException(String reason, Throwable cause) {
+ super(reason, cause);
+ }
+
+ /**
+ * Returns the file that caused the exception
+ */
+ public abstract String getFileName();
+
+ /**
+ * Returns the line number where the exception ocurred.
+ */
+ public abstract int getLineNumber();
+}
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParseException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParseException.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Added: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParser.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParser.java?rev=633474&view=auto
==============================================================================
--- incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParser.java (added)
+++ incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParser.java Tue Mar 4 05:40:21 2008
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.apt.parser;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+/** APT parser interface for Sling */
+public interface SlingAptParser {
+ /** Parse the given input, which must be in APT format, and
+ * write the HTML result to output.
+ */
+ void parse(Reader input, Writer output) throws IOException, SlingAptParseException;
+}
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/SlingAptParser.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Added: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptParser.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptParser.java?rev=633474&view=auto
==============================================================================
--- incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptParser.java (added)
+++ incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptParser.java Tue Mar 4 05:40:21 2008
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.apt.parser.internal;
+
+import org.apache.maven.doxia.macro.Macro;
+import org.apache.maven.doxia.macro.MacroExecutionException;
+import org.apache.maven.doxia.macro.MacroRequest;
+import org.apache.maven.doxia.macro.manager.MacroNotFoundException;
+import org.apache.maven.doxia.module.apt.AptParser;
+import org.apache.maven.doxia.sink.Sink;
+
+/** Customize the doxia APT parser to use our MacroResolver */
+class CustomAptParser extends AptParser{
+
+ private final MacroResolver macroProvider;
+
+ /** Instead of throwing an Exception we execute this Macro
+ * if we didn't find the requested one
+ */
+ static class DefaultMacro implements Macro {
+ private final String id;
+
+ DefaultMacro(String id) {
+ this.id = id;
+ }
+
+ public void execute(Sink sink, MacroRequest request) throws MacroExecutionException {
+ sink.text("APT macro not found: '" + id + "'");
+ }
+ }
+
+ CustomAptParser(MacroResolver mp) {
+ macroProvider = mp;
+ }
+
+ @Override
+ public void executeMacro( String macroId, MacroRequest request, Sink sink )
+ throws MacroExecutionException, MacroNotFoundException
+ {
+ Macro m = macroProvider.resolveMacro(macroId);
+ if(m == null) {
+ m = new DefaultMacro(macroId);
+ }
+ m.execute( sink, request );
+ }
+}
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptParser.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Added: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptSink.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptSink.java?rev=633474&view=auto
==============================================================================
--- incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptSink.java (added)
+++ incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptSink.java Tue Mar 4 05:40:21 2008
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.apt.parser.internal;
+
+import java.io.Writer;
+
+import org.apache.maven.doxia.module.apt.AptSink;
+
+/** AptSink which outputs (X)HTML */
+class CustomAptSink extends AptSink {
+
+ CustomAptSink(Writer w) {
+ super(w);
+ }
+
+ @Override
+ public void sectionTitle1() {
+ write("");
+ }
+
+ @Override
+ public void sectionTitle1_() {
+ write("
");
+ }
+
+ @Override
+ public void sectionTitle2_() {
+ write("");
+ }
+
+ @Override
+ public void sectionTitle2() {
+ write("");
+ }
+
+ @Override
+ public void sectionTitle3_() {
+ write("");
+ }
+
+ @Override
+ public void sectionTitle3() {
+ write("");
+ }
+
+ @Override
+ public void sectionTitle4_() {
+ write("");
+ }
+
+ @Override
+ public void sectionTitle4() {
+ write("");
+ }
+
+ @Override
+ public void list_() {
+ write("");
+ }
+
+ @Override
+ public void list() {
+ write("");
+ }
+
+ @Override
+ public void listItem_() {
+ write("");
+ }
+
+ @Override
+ public void listItem() {
+ write("- ");
+ }
+
+
+ @Override
+ public void head_() {
+ }
+
+ @Override
+ public void head() {
+ }
+
+ @Override
+ public void paragraph_() {
+ write("
");
+ }
+
+ @Override
+ public void paragraph() {
+ write("");
+ }
+
+ @Override
+ public void link(String name) {
+ write("");
+ }
+
+ @Override
+ public void link_() {
+ write("");
+ }
+
+ @Override
+ public void horizontalRule() {
+ write("
\n");
+ }
+
+}
\ No newline at end of file
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptSink.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/CustomAptSink.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Added: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/MacroResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/MacroResolver.java?rev=633474&view=auto
==============================================================================
--- incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/MacroResolver.java (added)
+++ incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/MacroResolver.java Tue Mar 4 05:40:21 2008
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.apt.parser.internal;
+
+import org.apache.maven.doxia.macro.Macro;
+
+/** Simple provider of APT Macro objects */
+interface MacroResolver {
+ Macro resolveMacro(String macroId);
+}
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/MacroResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/MacroResolver.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Added: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParseExceptionImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParseExceptionImpl.java?rev=633474&view=auto
==============================================================================
--- incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParseExceptionImpl.java (added)
+++ incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParseExceptionImpl.java Tue Mar 4 05:40:21 2008
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.apt.parser.internal;
+
+import org.apache.maven.doxia.module.apt.AptParseException;
+import org.apache.sling.apt.parser.SlingAptParseException;
+
+/** SlingAptParseException that wraps a doxia AptParseException */
+class SlingAptParseExceptionImpl extends SlingAptParseException {
+ private final AptParseException ape;
+
+ SlingAptParseExceptionImpl(AptParseException ape) {
+ super(ape.getMessage(), ape.getCause());
+ this.ape = ape;
+ }
+
+ @Override
+ public String getFileName() {
+ return ape.getFileName();
+ }
+
+ @Override
+ public int getLineNumber() {
+ return ape.getLineNumber();
+ }
+
+}
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParseExceptionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParseExceptionImpl.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Added: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParserImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParserImpl.java?rev=633474&view=auto
==============================================================================
--- incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParserImpl.java (added)
+++ incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParserImpl.java Tue Mar 4 05:40:21 2008
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.apt.parser.internal;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+import org.apache.maven.doxia.module.apt.AptParseException;
+import org.apache.maven.doxia.module.apt.AptParser;
+import org.apache.maven.doxia.sink.Sink;
+import org.apache.sling.apt.parser.SlingAptParseException;
+import org.apache.sling.apt.parser.SlingAptParser;
+
+/** SlingAptParser implementation, provided as an SCR service
+ *
+* @scr.component label="Sling APT parser"
+* description="Converts APT documents to HTML format"
+* @scr.property name="service.vendor" value="The Apache Software Foundation"
+* @scr.property name="service.description"
+* value="Sling APT structured text parser"
+*
+* @scr.service
+*/
+
+public class SlingAptParserImpl implements SlingAptParser {
+
+ private final MacroResolver macroProvider;
+
+ public SlingAptParserImpl() {
+ macroProvider = null;
+ }
+
+ SlingAptParserImpl(MacroResolver mp) {
+ macroProvider = mp;
+ }
+
+ public void parse(Reader input, Writer output) throws IOException, SlingAptParseException {
+ final Sink sink = new CustomAptSink(output);
+ final AptParser parser = new CustomAptParser(macroProvider);
+ try {
+ parser.parse(input, sink);
+ } catch(AptParseException ape) {
+ throw new SlingAptParseExceptionImpl(ape);
+ }
+ }
+
+}
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParserImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/main/java/org/apache/sling/apt/parser/internal/SlingAptParserImpl.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL