From 096b9751766cacdbff80f760535c63bea80c2d31 Mon Sep 17 00:00:00 2001 From: Wai-Kin Chau Date: Fri, 3 Nov 2017 22:03:00 -0700 Subject: [PATCH] Alpha fixes (#4) * Fix start up text error and edit read me file. * More README.md editing. * More README.md editing. * More README.md editing. * More README.md editing. * Fix an syntax mistake --- README.md | 146 +++++++++++++++++- data/{run => jar}/help-text.txt | 0 data/user-styles.properties | 0 .../jwriter/file/ManuscriptFile.java | 8 +- src/com/creativeartie/jwriter/main/Main.java | 26 ++-- 5 files changed, 159 insertions(+), 21 deletions(-) rename data/{run => jar}/help-text.txt (100%) create mode 100644 data/user-styles.properties diff --git a/README.md b/README.md index 4f02298d..7d86230d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,147 @@ # JWriter -This is a writing software foucsed on writing for both fiction and non-fiction. It is simpiler to project like [FoucsWriter](https://gottcode.org/focuswriter/). This project is currently in alpha version, and will be optimized and will have more features. -Screen shots: + +## About +JWriter a word processor with note taking and goal setting ablities. It is +foused for authors to write fiction and non-fiction alike. Notes can be put +into to the file anywhere yet allow easy to navigate to them. The goal settings +can be adjest as the document written. + +Even though the markup language is made for this program, is very forgiving and +will highlight the syntax. In the future, there will be more support and will +have a [WYSIWYG mode](https://en.wikipedia.org/wiki/WYSIWYG). This make learning +the language as just a faster way to format and insert notes and agendas. + +This project is currently in alpha version, and will be optimized and will have +more features. + +## Markup + +### Formats +There are four different formats. Formats can be combined, but are only restrict +to one line. + +|Format |Code | +|---------|--------------| +|Italics |`\*Text\*` | +|Bold |`\*\*Text\*\*`| +|Underline|`\_Text\_` | +|Code |`\`Text\`` | + +There are also [footnote (syntax `{^footnote}`), endnote (syntax `{*endnote}`)](#note-styles), +[links (syntax `<@reference id|link text>` or ``)](#hyperlink), +[agenda (syntax `{! todo}`)](#agenda), and [citation (sytnax `{@id}`)](#notes). + +## Sections +Each section had a heading or an outline point at the top of the section. This +markup language allows you to have no heading or outline, but the section has to +be at the top of file. An outline point is nested inside a section with an +heading, or is before the first section with headings. + + +### Heading and outline + +A heading or an outline can have an [id](#id) that can be linked to a +different point of file. The syntax is `@category-id:` and it set before the +first text, other than the syntax used to indicated the heading and outline +style. Refers to the section by using [`<@id>`](#hyperlink). + +There are six level for both headings and outlines. + +A heading or an outline can also have a status with details, A status is +optional, and can be `#STUB`, `#DRAFT`, `#FINAL`, `#` (custom) and none. after +the status, there are details to go with the status. It will be at the end of +the line. + +The syntax of a heading is: + + = @category-id:Title for largest heading # status + == Title for heading 2 #DRAFT + ======Smallest headings + +The syntax of a outline is: + + !# Largest outline point + !######Smallest outline pointe + + +### Main Line Styles + +There are several types of line styles. + +|Line styles |Syntax |Notes | +|-------------|----------|-----------------------------------------------------| +|Numbered | `# text` |Add tabs before `#` to increse level (up to six) | +|Bullet | `- text` |Add tabs before `-` to increse level (up to six) | +|Quote | `> text` | | +|Section Break| `***` |It has no text after the `*` or allow spaces anywhere| +|Paragaph | `text` |There is no symbol used at the beginning of the line | + +### Note Styles +In addition there are footnote, and endnote, that can be referred to even +outside of the section that the line belongs in. Footnotes appears at end of a +page, while endnote appears at the end of either a section or a document. + +All footnote and endnotes will have an [id](#id) and text before they can appear +in the printed document. + +|Types |Line Syntax |In Text Syntax| +|-----------|------------|--------------| +|Footnote | `!^id:text`| `{^id}` | +|Endnote | `!*id:text`| `{*id}` | + +Footnote will count by numbers, while endnot count by letters. + +### Hyperlink + +Hyperlinks can be link to a section or a webpage. If the referred link points to + +A referred link needs a line somewhere with the following syntax: + + !@id:webpage path + +A referred link needs to have an [id](#id) and text before it can appears in the +printed document. + +Both referred link and section links has the following sytnax: `<@id|text>` while +direct links has the following syntax: ``. Text (include the +symbol `|` are optional, and will be replace by the web page path or the section +title if none is found. + +### Agenda +Agenda marks parts of the document to be work on later. There are two types of +agendas, in text or a single line. + +In text agenda uses the following syntax `{@text}` while a single line of agenda +uses the following syntax: + + !! to do text + +## Notes + +Note has the following syntax: + + !% @id: text + !% more text + !>source: sources + +[Id](#id) and sources are optional, but both are required if the note is from +research and is being use as a citation. + +Sources has requires two things: + +- a line of formated text to appear in the word cited section at the end of + document or section which starts with `!>source:` +- a way to cite in text with start the line with one of the following: + - `!>in-text:` appears in the text + - `!>footnote:` appears as a footnote + +## Id + +Ids have an category and title. There are unlimited number of categories and +unlimited of nested subcategories avaiable. the categories and titles are sorted +in the alphabethical order and are not case sensitive. The syntax of an id is +`category-subcategory-...-title`. + +## Screen shots ![Main Window](design/main.png) ![Stats Window](design/stats.png) diff --git a/data/run/help-text.txt b/data/jar/help-text.txt similarity index 100% rename from data/run/help-text.txt rename to data/jar/help-text.txt diff --git a/data/user-styles.properties b/data/user-styles.properties new file mode 100644 index 00000000..e69de29b diff --git a/src/com/creativeartie/jwriter/file/ManuscriptFile.java b/src/com/creativeartie/jwriter/file/ManuscriptFile.java index f8ab5e11..865be941 100644 --- a/src/com/creativeartie/jwriter/file/ManuscriptFile.java +++ b/src/com/creativeartie/jwriter/file/ManuscriptFile.java @@ -54,7 +54,7 @@ public static ManuscriptFile newFile() { new RecordTable()); } - private ManuscriptFile(File file, ManuscriptDocument doc, + public ManuscriptFile(File file, ManuscriptDocument doc, RecordTable table) { zipFile = Optional.ofNullable(file); @@ -62,12 +62,6 @@ private ManuscriptFile(File file, ManuscriptDocument doc, recordsFile = table; } - public ManuscriptFile(File doc) throws IOException{ - zipFile = Optional.empty(); - documentText = new ManuscriptDocument(doc); - recordsFile = new RecordTable(); - } - public void setSave(File file){ zipFile = Optional.of(file); } diff --git a/src/com/creativeartie/jwriter/main/Main.java b/src/com/creativeartie/jwriter/main/Main.java index 09cd1870..228c3f48 100644 --- a/src/com/creativeartie/jwriter/main/Main.java +++ b/src/com/creativeartie/jwriter/main/Main.java @@ -29,24 +29,26 @@ public void start(Stage stage) throws Exception{ stage.setTitle(TEXTS.getString("MainWindow.Title")); // testStatsWindow(stage); - // testMainWindow(stage); - jarMainWindow(stage); + openMainWindow(stage); } - private void testMainWindow(Stage stage) throws Exception{ - setupWindow(stage, new File("data/help-text.txt")); + private void openMainWindow(Stage stage) throws Exception{ + ClassLoader classLoader = getClass().getClassLoader(); + InputStream in = getClass().getResourceAsStream("/data/help-text.txt"); + StringBuilder builder = new StringBuilder(); + int read = in.read(); + while (read != -1){ + builder.append((char) read); + read = in.read(); + } + setupWindow(stage, new ManuscriptFile(null, + new ManuscriptDocument(builder.toString()), new RecordTable())); } - private void jarMainWindow(Stage stage) throws Exception{ - File classPath = new File(System.getProperty("java.class.path")); - File file = new File(classPath.getParent(), "data/help-text.txt"); - setupWindow(stage, file); - } - - private void setupWindow(Stage stage, File file) throws Exception{ + private void setupWindow(Stage stage, ManuscriptFile file) { SceneWriterControl writer = new SceneWriterControl(stage); Scene scene = new Scene(writer, 800, 600); - writer.setManuscriptFile(new ManuscriptFile(file)); + writer.setManuscriptFile(file); stage.setScene(scene); stage.setMaximized(true); stage.show();