From 00a25a7ef03e25864019ef2e4f3fe5813ec292e9 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Fri, 9 Nov 2012 23:49:48 +0530 Subject: added: conversion/ignore/ conversion/ignore/Ignored.java (a class getting info about ignored child-directories, in the present directory) modified: conversion/ConvertDirectory.java (added code to check if the child-directory is in the ignored list) docs/scruf (started sketching out documentation on how to use scruf) styling/style.css todo --- conversion/ConvertDirectory.java | 12 +++++- conversion/ignore/Ignored.java | 33 +++++++++++++++ docs/scruf | 91 ++++++++++++++++++++++++++++++++++------ styling/style.css | 4 ++ todo | 10 ++++- 5 files changed, 134 insertions(+), 16 deletions(-) create mode 100644 conversion/ignore/Ignored.java diff --git a/conversion/ConvertDirectory.java b/conversion/ConvertDirectory.java index 2a0f6a9..a5717bb 100644 --- a/conversion/ConvertDirectory.java +++ b/conversion/ConvertDirectory.java @@ -24,6 +24,7 @@ package scruf.conversion; import java.io.*; import scruf.index.*; import scruf.status.*; +import scruf.conversion.ignore.*; public class ConvertDirectory { private ConvertFile html; @@ -39,6 +40,9 @@ public class ConvertDirectory { " No conversion done on."); return; } + // Ignored object maintains a list of 'ignored' sub-directories + // in this directory. + Ignored ignored = new Ignored(directory); // index creator for the present directory. IndexCreator index = new IndexCreator(directory); // iterate through the directory. @@ -53,8 +57,12 @@ public class ConvertDirectory { } } else if(file.isDirectory()) { - ++DirectoryInfo.level; - this.convert(file); + // Perform conversion, only if, directory + // is not a ignored directory. + if(!ignored.ignored(file)) { + ++DirectoryInfo.level; + this.convert(file); + } } } boolean convertIndex = (index.shouldConvert() || diff --git a/conversion/ignore/Ignored.java b/conversion/ignore/Ignored.java new file mode 100644 index 0000000..8129f18 --- /dev/null +++ b/conversion/ignore/Ignored.java @@ -0,0 +1,33 @@ +package scruf.conversion.ignore; + +import java.io.*; +import scruf.io.*; + +public class Ignored { + private String ignoredList[]; + public Ignored(File directory) { + File ignoredFile = new File(directory,".ignored"); + if(ignoredFile.exists()) { + ignoredList = new ReadFile(ignoredFile).split("\n"); + } + } + public boolean ignored(File subdirectory) { + boolean ignored = false; + if(ignoredList!=null) { + for(String dir:ignoredList) { + if(subdirectory.getName().matches(dir)) { + System.out.println("Ignoring Directory: "+ + subdirectory.getAbsolutePath()); + ignored = true; + break; + } + } + } + return ignored; + } +} + +/** + CVS/ + /home/rsd/projects/scruf/www/CVS/ + */ \ No newline at end of file diff --git a/docs/scruf b/docs/scruf index d9edf07..63f0b3e 100644 --- a/docs/scruf +++ b/docs/scruf @@ -1,21 +1,88 @@ -scruffy +scruf - documentation ========== -Scruffy +scruf - documentation ========== -Scruffy is a mark-up that is out right shabby and squalid, it is, in a -way inspired from the markup used in MoinMoin and MediaWiki. If it is -desired that the text version of the HTML files, that are to be, -generated, look sane enough to be interpreted as ''plain text'', it is -suggested that you look for static HTML generators that accept -Markdown. Markdown looks sane. Scruffy, as the name implies, is an -insane markup. + ''scruf'' is a simple program that converts text marked-up in +''scruffy'' mark-up to HTML5 files. It was written specifically for +generating blog posts. The way ''scruf'' works is straight forward -- +it takes in directory and converts all the ''scruffy'' marked-up +plain-text files into corresponding HTML5 files. After the conversion, +''scruf'' puts links to the generated HTML5 files in the `index.html` +file of that directory. So, that's how ''scruf'' works. -With that, I leave you, to make a choice, whether you wish to use -Scruffy, and thus Scruf, at all. +==================== +using scruf +==================== + +Before you plunge into learning about scruf and eventually using +it. Let me run you through the pre-requisites. + + '''Paraphernalia''': ''scruf'' is written in Java, therefore, you'll + need the `openjdk` package, inorder to be able to compile and run + scruf. Go ahead and install `openjdk` before proceeding + forward. Number two, ''scruf'' was written on a GNU/Linux machine, + so, it should work well on all Unix-based operating systems. + +Once, you have a copy of `openjdk` installed on your machine, you're +all set to start licking ''scruf''. Here we go. ============================== -basic structure +scruffy mark-up ============================== +Inorder to convert plain-text files into HTML5 using ''scruf'', you +got to mark it up with the ''scruff'' mark-up, so that ''scruf'' +understands the elements of the plain-text document and duly converts +them into HTML5. As the name suggests ''scruffy'' mark is pretty +shabby when compared to cleaner mark-ups like +[[http://daringfireball.net/projects/markdown/|Markdown]]. ''scruffy'' +is inspired, to an extent, from [[http://moinmo.in/|MoinMoin]] & +[[http://www.mediawiki.org/wiki/MediaWiki|MediaWiki]] syntax. + + +======================================== +basic structure +======================================== + +The ''scruffy'' plain-text document that is going to be converted by +''scruf'', follows a format and here it is: + +### + +title + +========== +foo heading +========== + +$$$ 1 January 1970 $$$ + +The bar blog post goes like this... +... +... +the bar blog post ends + +---------------------------------------------------------------------- +author's signature +---------------------------------------------------------------------- + +### + +The first line in the ''scruffy'' document __must__ always begin with +the text of the title of the document. The ''title'' is the string +that is going to be displayed on the browser tabs and for compliance +sake, it is recommended that it be same as the ''heading'' of the +''scruffy'' document. Followed by the ''title'' is the heading, then +the body of the post/essay/whatever and finally the author's +signature. This is the basic structure of a ''scruffy'' document. + + +======================================== +syntax +======================================== + +============================== +running scruf +============================== diff --git a/styling/style.css b/styling/style.css index 19d037f..02e71af 100644 --- a/styling/style.css +++ b/styling/style.css @@ -25,6 +25,10 @@ h1, h2, h3, h4, h5 { width:75%; text-align:center; } +h1 { + font-size:1.80em; +} + p, i, b{ margin-left:auto; margin-right:auto; diff --git a/todo b/todo index 6d4a79d..07afedf 100644 --- a/todo +++ b/todo @@ -1,7 +1,13 @@ -# way to ignore directories +# 'quote' special symbols inside a code-block. + +# include a link or something to view the 'source'. [working on this one] + +# introduce 'meta' info in html doc generated -- authorinfo, date of creation, etc. + +-- way to ignore directories -- [done] # extension for scruff marked-up files to make discovery easier. -# introduction to 'scruffy' mark-up. +* introduction to 'scruf' & 'scruffy' mark-up. [working on this one] # Test it by generating your _full_ homepage using scruf. -- cgit v1.2.3