Package com.granule.parser

Examples of com.granule.parser.TagReader


        public String scriptId = null;
    }

    private String processChunk(String chunk, IRequestProxy requestProxy, IRequestProxy runtimeRequest, CompressorSettings settings)
            throws JSCompileException {
        TagReader source = new TagReader(chunk);
        String bp = basepath == null ? settings.getBasePath() : basepath;
        List<Element> links = source.getAllElements(Tags.LINK);
        if (links.size() > 0) {
            HashSet<String> cssDuplicates = new HashSet<String>();
            List<Integer> eliminatedStyles = new ArrayList<Integer>();
            if (settings.isCleanCssDuplicates()) {
                cssDuplicates = getCssDuplicatesHash(requestProxy);
View Full Code Here


    private int processFile(String filename, String webAppRootPath, IRequestProxy request, CompressorSettings settings,
                            String pathAddition) {
      //System.out.println("pathAddition "+pathAddition);
      int errorCount = 0;
        TagReader source = null;
        try {
            source = new TagReader(new FileReader(filename));
        } catch (IOException e) {
            logger.error("Could not open file", e);
            errorCount++;
            return errorCount;
        }
       
        List<Element> els = source.getAllElements();
        for (Element el : els) {
            if (el.getName().equals(settings.getTagName())) {
                try {
                    String body = el.getContentAsString();
                    Attributes attrs = source.parseAttributes(el);
                    String id = attrs.getValue("id");
                    String method = attrs.getValue("method");
                    String options = attrs.getValue("options");
                    String basepath = attrs.getValue("basepath");
                    if (body == null) body = "";
                    if (body.contains("<%--"))
                        body = removeJspComments(body);
                    if (body.contains("<%")) {
                        logger.warn("Dynamic content found, tag skipped in file " + filename);
                    } else {
                        CompressTagHandler tagHandler = new CompressTagHandler(id, method, options, basepath);
                        tagHandler.handleTag(request, null, body);
                    }
                } catch (JSCompileException e) {
                    errorCount++;
                    logger.error("Tag process exception:", e);
                }
            } else if (el.getName().equals("%")) {
                Attributes attrs = source.parseAttributes(el);
                if (attrs != null && attrs.isValueExists("include") && attrs.isValueExists("file")) {
                    String file = attrs.getValue("file");
                    String pa = "";
                    if (!file.trim().startsWith("/") && file.indexOf("/")>=0)
                        pa = file.substring(0, file.lastIndexOf("/")+1);
View Full Code Here

TOP

Related Classes of com.granule.parser.TagReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.