diff options
author | Ralph Amissah <ralph@amissah.com> | 2015-10-20 18:52:12 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2015-10-20 22:13:25 -0400 |
commit | 4b0c115b58211dcc063bcd09f8fe122e558b92ce (patch) | |
tree | b60e38935a4f5fbd723c13a5035d952976c851bf /org/ao_markup_source_raw.org | |
parent | update minor (diff) |
literate programming introduced, tangle not yet run
Diffstat (limited to 'org/ao_markup_source_raw.org')
-rw-r--r-- | org/ao_markup_source_raw.org | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/org/ao_markup_source_raw.org b/org/ao_markup_source_raw.org new file mode 100644 index 0000000..f9bd866 --- /dev/null +++ b/org/ao_markup_source_raw.org @@ -0,0 +1,92 @@ +#+TITLE: Emacs config file written in org-mode +#+AUTHOR: Ralph Amissah +#+EMAIL: ralph.amissah@gmail.com +#+STARTUP: indent +#+LANGUAGE: en +#+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil -:t f:t *:t <:t +#+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc +#+OPTIONS: author:nil email:nil creator:nil timestamp:nil +#+OPTIONS: ^:nil _:nil#+OPTIONS: ^:nil _:nil +#+EXPORT_SELECT_TAGS: export +#+EXPORT_EXCLUDE_TAGS: noexport +#+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) + +* markup source raw +** source string +#+name: ao_markup_source_raw +#+BEGIN_SRC d :exports none +final private string markupSourceString(in char[] fn_src) { + enforce( + exists(fn_src)!=0, + "file not found" + ); + string source_txt_str; + try { + if (exists(fn_src)) { + source_txt_str = readText(fn_src); // ok + } + } + catch (ErrnoException ex) { + // Handle errors + } + catch (UTFException ex) { + // Handle validation errors + } + catch (FileException ex) { + // Handle errors + } + std.utf.validate(source_txt_str); + return source_txt_str; +} +#+end_src +** source line array +#+name: ao_markup_source_raw +#+BEGIN_SRC d :exports none +final private char[][] markupSourceLineArray(in string src_text) { + char[][] source_line_arr = + split(cast(char[]) src_text, rgx.line_delimiter); + return source_line_arr; +} +#+end_src +** insert source content raw line array +#+name: ao_markup_source_raw +#+BEGIN_SRC d :exports none +final char[][] markupInsertSourceContentRawLineArray(in char[] fn_src) { + enforce( + match(fn_src, rgx.src_fn_find_inserts), + "not a sisu markup filename" + ); + auto source_txt_str = markupSourceString(fn_src); + auto source_line_arr = markupSourceLineArray(source_txt_str); + return source_line_arr; +} +#+end_src +** source content raw line array +#+name: ao_markup_source_raw +#+BEGIN_SRC d :exports none +final char[][] markupSourceContentRawLineArray(in char[] fn_src) { + enforce( + match(fn_src, rgx.src_pth), + "not a sisu markup filename" + ); + auto source_txt_str = markupSourceString(fn_src); + auto source_line_arr = markupSourceLineArray(source_txt_str); + return source_line_arr; +} +#+end_src + +* tangles +** code structure: :ao_markup_source_raw.d: +#+name: tangle_ao_markup_source_raw +#+BEGIN_SRC d :tangle ../lib/sdp/ao_markup_source_raw.d :exports none :noweb yes +/* + markup source raw + ao_markup_source_raw.d +*/ +mixin template SiSUmarkupRaw() { + class MarkupRaw { + auto rgx = new Rgx(); + <<ao_markup_source_raw>> + } +} +#+end_src |