From ceed73fa063ffb3b72d21c8a8800122c115acc58 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 10 Nov 2012 11:29:31 +0530 Subject: marked-up files should have a '.scruffy' extension from now on. This commit is an un-stable commit. It has bugs. removed: io/PresentFile.java (moved to status/PresentFile.java) added: conversion/CreateHtmlFile.java (creates a corresponding '.html' file for a given '.scruffy' marked-up file) (needs some fine-tuning) status/PresentFile.java (see above) modified: conversion/ConvertFile.java (CreatHtmlFile object takes care of producing a corresponding html 'File') conversion/FileSieve.java (regex modified to reflect the '.scruffy' extension) index/IndexCreator.java (edits to reflect the '.scruffy' extension) parsers/BackButton.java (edit to reflect the '.scruffy' extension) parsers/DocumentName.java (edit to reflect the package change for PresentFile class) parsers/Header.java (edit to reflect the package change for PresentFile class) todo (updated todo) --- conversion/CreateHtmlFile.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 conversion/CreateHtmlFile.java (limited to 'conversion/CreateHtmlFile.java') diff --git a/conversion/CreateHtmlFile.java b/conversion/CreateHtmlFile.java new file mode 100644 index 0000000..ecd86c1 --- /dev/null +++ b/conversion/CreateHtmlFile.java @@ -0,0 +1,22 @@ +package scruf.conversion; + +import java.io.*; +import java.util.regex.*; +import scruf.status.*; + +public class CreateHtmlFile { + private Pattern pattern = Pattern.compile("(.+?\\.)scruffy"); + private Matcher matcher; + public File create() { + File htmlFile=null; + matcher = pattern.matcher(PresentFile.file.getName()); + if(matcher.find()) { + htmlFile = new File(PresentFile.file.getParentFile(), + matcher.group(1)+"html"); + }else { + System.err.println("ERROR: something wrong with scruf: unable to create html file"+ + " for "+PresentFile.file.getName()); + } + return htmlFile; + } +} \ No newline at end of file -- cgit v1.2.3 From 727d6d17305e6dbba4c5231fb40012b5adfaca1b Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 10 Nov 2012 11:38:40 +0530 Subject: baptized the following files with GPL license info: conversion/CreateHtmlFile.java conversion/ignore/Ignored.java --- conversion/CreateHtmlFile.java | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'conversion/CreateHtmlFile.java') diff --git a/conversion/CreateHtmlFile.java b/conversion/CreateHtmlFile.java index ecd86c1..a502f7e 100644 --- a/conversion/CreateHtmlFile.java +++ b/conversion/CreateHtmlFile.java @@ -1,3 +1,24 @@ +/*+ + * Copyright 2012 rsiddharth + * Email: + * + * This file is part of Scruf. + * + * Scruf is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + package scruf.conversion; import java.io.*; @@ -19,4 +40,4 @@ public class CreateHtmlFile { } return htmlFile; } -} \ No newline at end of file +} -- cgit v1.2.3 From 75114f9ba449a3bafd9d4ddb986e50b772c3a237 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 10 Nov 2012 17:20:42 +0530 Subject: New Parser: Source; Bug-fix for conversion/CanConvert.java & license/Liberate.java. added: parsers/Source.java (New Parser, adds a link to the 'scruffy' source file) modified: conversion/CanConvert.java (bug-fix) conversion/CreateHtmlFile.java (we have two versions of the create() method now) license/Liberate.java (regex fix) parsers/ParserList.java (new parser added, see above) --- conversion/CreateHtmlFile.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'conversion/CreateHtmlFile.java') diff --git a/conversion/CreateHtmlFile.java b/conversion/CreateHtmlFile.java index a502f7e..729b3cf 100644 --- a/conversion/CreateHtmlFile.java +++ b/conversion/CreateHtmlFile.java @@ -28,11 +28,19 @@ import scruf.status.*; public class CreateHtmlFile { private Pattern pattern = Pattern.compile("(.+?\\.)scruffy"); private Matcher matcher; + private File htmlFile=null; + /** + * This method uses PresentFile.file as the 'file' for + * which a corresponding 'htmlFile' has to be created. + */ public File create() { - File htmlFile=null; - matcher = pattern.matcher(PresentFile.file.getName()); + return create(PresentFile.file); + } + public File create(File file) { + htmlFile=null; + matcher = pattern.matcher(file.getName()); if(matcher.find()) { - htmlFile = new File(PresentFile.file.getParentFile(), + htmlFile = new File(file.getParentFile(), matcher.group(1)+"html"); }else { System.err.println("ERROR: something wrong with scruf: unable to create html file"+ -- cgit v1.2.3