8000 Added code samples using section to reference · chrisws/smallbasic.github.io@1427bf3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1427bf3

Browse files
committed
Added code samples using section to reference
1 parent ed11e55 commit 1427bf3
  • ide
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    368 files changed

    +3993
    -569
    lines changed

    _build/layouts/reference.html

    Lines changed: 11 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,3 +1,4 @@
    1+
    {% githost = "https://raw.githubusercontent.com/smallbasic/smallbasic.samples" %}
    12
    <div class="article">
    23
    <h1>{{ upper(page.name) }}</h1>
    34
    <blockquote>{{ page.title }}</blockquote>
    @@ -16,6 +17,16 @@ <h1>{{ upper(page.name) }}</h1>
    1617
    content = mid(content, eol + 1)
    1718
    %}
    1819
    {{ content }}
    20+
    {% if (len(page.samples) > 0 && len(page.samples) < 40) then %}
    21+
    <div class="lavenderBox">
    22+
    <div class="header">Code samples using {{ page.name }}</div>
    23+
    <div class="linklist">
    24+
    {% for filename in page.samples %}
    25+
    <a target="_github" href="{{ githost }}/master/{{ filename }}">{{ rightoflast(filename,"/") }} </a>&nbsp;
    26+
    {% next filename %}
    27+
    </div>
    28+
    </div>
    29+
    {% endif %}
    1930
    <div class="lavenderBox">
    2031
    <div class="header">{{ page.package }}</div>
    2132
    <div class="linklist">

    _build/mkdata.bas

    Lines changed: 37 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -2,14 +2,51 @@ rem
    22
    rem reads reference.json to produce per page json data files
    33
    rem
    44

    5+
    const samplesPath = "/home/chrisws/src/smallbasic.samples/"
    6+
    57
    tload "reference.json", s, 1
    68
    ref = array(s)
    9+
    keywords = []
    10+
    map = {}
    11+
    12+
    ' create keywords array
    13+
    for package in ref
    14+
    num_items = len(ref[package]) - 1
    15+
    for i = 0 to num_items
    16+
    item = ref[package][i]
    17+
    keywords << upper(item.keyword)
    18+
    next i
    19+
    next package
    20+
    21+
    ' create map from keyword to array of samples
    22+
    func walker(node)
    23+
    local fileName = node.path + "/" + node.name
    24+
    local found = {}
    25+
    local buffer, i, keyword
    26+
    27+
    tload fileName, buffer
    28+
    for i = 0 to len(buffer) - 1
    29+
    for keyword in keywords
    30+
    'have we already found keyword on another line
    31+
    if instr(upper(buffer(i)), keyword) != 0 && found[keyword] == 0 then
    32+
    map[keyword] << enclose(mid(fileName, len(samplesPath)), "\"")
    33+
    found[keyword] = 1
    34+
    endif
    35+
    next keyword
    36+
    next i
    37+
    return 1
    38+
    end
    39+
    40+
    dirwalk samplesPath, "*.bas", use walker(x)
    41+
    42+
    ' output the data
    743
    for package in ref
    844
    num_items = len(ref[package]) - 1
    945
    package_data = []
    1046
    for i = 0 to num_items
    1147
    item = ref[package][i]
    1248
    item.package = package
    49+
    item.samples = map[item.keyword]
    1350
    filename = "_out/data/" + item.nodeId + "-" + lower(package) + "-" + lower(item.keyword) + ".json"
    1451
    filename = translate(filename, " ", "")
    1552
    buffer = str(item)

    _build/page.bas

    Lines changed: 3 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -12,6 +12,7 @@ export sourceurl
    1212
    export changesurl
    1313
    export lastedit
    1414
    export package
    15+
    export samples
    1516

    1617
    githost = "https://github.com/smallbasic/smallbasic.github.io"
    1718

    @@ -46,6 +47,7 @@ if (not exist(jsonFile)) then
    4647
    sourcefile = "posts/" + pagename + ".markdown"
    4748
    endif
    4849
    endif
    50+
    samples = ""
    4951
    else
    5052
    rem reference page
    5153
    tload jsonFile, s, 1
    @@ -55,6 +57,7 @@ else
    5557
    url = item.nodeId
    5658
    title = item.signature
    5759
    package = item.package
    60+
    samples = item.samples
    5861
    sourcefile = item.nodeId + "-" + lower(item.package) + "-" + lower(item.keyword) + ".markdown"
    5962
    sourcefile = "reference/" + translate(sourcefile, " ", "")
    6063
    endif

    _build/pages/changelog.markdown

    Lines changed: 39 additions & 38 deletions
    Original file line numberDiff line numberDiff line change
    @@ -964,10 +964,9 @@ Compiler:
    964964
    * updated sockcl_open() to handle server listen sockets
    965965

    966966

    967+
    **VERSION 0.9.0**
    967968

    968-
    VERSION 0.9.0
    969-
    970-
    969+
    ```
    971970
    2004-05-01: ndc
    972971
    Human language depented files for messages and keywords.
    973972
    The messages and the keywords can be easily translated to another language.
    @@ -1114,23 +1113,23 @@ VERSION 0.9.0
    11141113
    MALLOC,PEEK(8,16,32),POKE(8,16,32),BCOPY,VADR
    11151114
    new: palmos, keyboard buffer dialog (press kb)
    11161115
    not good yet, but it works
    1116+
    ```
    11171117

    1118+
    **VERSION 0.8.2**
    11181119

    1119-
    VERSION 0.8.2
    1120-
    1121-
    1120+
    ```
    11221121
    2002-04-14: ndc
    11231122
    ?bug?: crash; wierd memodb records (size >32KB!!), thanks to Meino
    11241123
    bug: PalmOS, MOD's result was wrong
    11251124
    11261125
    2002-04-07: ndc
    11271126
    bug: memory overrun on scan.c:bc_get_var_id(), thanks to Meino
    11281127
    new: BGETC()/BPUTC (binary get/put bytes on a stream)
    1128+
    ```
    11291129

    1130+
    **VERSION 0.8.1**
    11301131

    1131-
    VERSION 0.8.1
    1132-
    1133-
    1132+
    ```
    11341133
    2002-03-31: ndc
    11351134
    finish: OPTION-styles, new PREDEF QUITE,COMMAND
    11361135
    modify: system string-variables are now accepted with both names
    @@ -1169,11 +1168,11 @@ VERSION 0.8.1
    11691168
    bug fix: operators && and || was on different op-category...
    11701169
    bug fix: small memory leak on string->number convertion inside
    11711170
    --eval.c module. That causes PalmOS fatal error!!!
    1171+
    ```
    11721172

    1173+
    **VERSION 0.8.0**
    11731174

    1174-
    VERSION 0.8.0
    1175-
    1176-
    1175+
    ```
    11771176
    2001-12-27: ndc
    11781177
    bug fix: memo vfs driver: deleted files, no null-char on read
    11791178
    @@ -1280,11 +1279,11 @@ VERSION 0.8.0
    12801279
    bug fix: WEEKDAY
    12811280
    bug fix: STATs I was made some stupids things here, now it is working again
    12821281
    ---(QB: DEF FNxxx - END, later will be added the inline DEF FN)
    1282+
    ```
    12831283

    1284+
    **VERSION 0.7.1**
    12841285

    1285-
    ## VERSION 0.7.1
    1286-
    1287-
    1286+
    ```
    12881287
    2001-11-24: ndc
    12891288
    changes: LINEQGJ (Gauss-Jordan) renamed to LINEQN
    12901289
    new: DIFFEQN
    @@ -1326,18 +1325,18 @@ VERSION 0.8.0
    13261325
    new: FOR var IN array - NEXT
    13271326
    command-line: quite flag (-q); No "* DONE *", no compiler messages
    13281327
    bug fix: Unix OS Name
    1328+
    ```
    13291329

    1330+
    **VERSION 0.7.0a**
    13301331

    1331-
    ## VERSION 0.7.0a
    1332-
    1333-
    1332+
    ```
    13341333
    2001-11-07: ndc
    13351334
    PalmOS: crash with MemoDB deleted/locked records
    1335+
    ```
    13361336

    1337+
    **VERSION 0.6.1-0.7.0**
    13371338

    1338-
    ## VERSION 0.6.1-0.7.0
    1339-
    1340-
    1339+
    ```
    13411340
    2001-11-06: ndc
    13421341
    SB web-site: recovery...
    13431342
    @@ -1483,11 +1482,11 @@ ex:
    14831482
    bug fix: &H prefix
    14841483
    EVAL's stack is dynamic now
    14851484
    Backup bit is enabled after copy/rename
    1485+
    ```
    14861486

    1487+
    **VERSION 0.6.0**
    14871488

    1488-
    ## VERSION 0.6.0
    1489-
    1490-
    1489+
    ```
    14911490
    2001-05-13: ndc
    14921491
    bug fix: v_set array copy
    14931492
    backup-bit is enabled when the source file is modified
    @@ -1536,10 +1535,11 @@ ex:
    15361535
    15371536
    2001-04-16: ndc
    15381537
    bug-fix: WHILE/WEND nested blocks
    1538+
    ```
    15391539

    1540+
    **VERSION 0.5.8**
    15401541

    1541-
    ## VERSION 0.5.8
    1542-
    1542+
    ```
    15431543
    2001-04-02: ndc
    15441544
    DRAWPOLY array() added
    15451545
    TRUE/FALSE system constants added
    @@ -1555,23 +1555,23 @@ ex:
    15551555
    bug fix: eq with doubles ((1=12/10) now returns false)
    15561556
    this is the FOR-NEXT problem with fps
    15571557
    bug fix: run-time error if the user had not allocate memory for arrays (DIM)
    1558+
    ```
    15581559

    1560+
    **VERSION 0.5.7**
    15591561

    1560-
    ## VERSION 0.5.7
    1561-
    1562-
    1562+
    ```
    15631563
    2001-03-10: ndc
    15641564
    Some minor bugs of multibyte charsets
    15651565
    15661566
    2001-03-09: ndc
    15671567
    Big5 charset support added - thanks to Daniel Yuan-Chih Lin (dan.lin@bigfoot.com)
    15681568
    Generic multibyte support added
    15691569
    bug fix: SOUND & BEEP volume
    1570+
    ```
    15701571

    1572+
    **VERSION 0.5.6**
    15711573

    1572-
    ## VERSION 0.5.6
    1573-
    1574-
    1574+
    ```
    15751575
    2001-03-03: ndc
    15761576
    SDL driver added
    15771577
    Win32 port
    @@ -1636,11 +1636,11 @@ ex:
    16361636
    16371637
    2001-02-12: ndc
    16381638
    Color support added
    1639+
    ```
    16391640

    1641+
    **VERSION 0.5.5**
    16401642

    1641-
    ## VERSION 0.5.5
    1642-
    1643-
    1643+
    ```
    16441644
    2001-02-11: ndc
    16451645
    decompiler (unix version, -s option)
    16461646
    Several bugs of pseudo-compiler are fixed
    @@ -1676,10 +1676,11 @@ ex:
    16761676
    Convert to SDK 3.5 using PalmCompatibility.h
    16771677
    bug fix: Hardware keys caused INKEY$ to always return nothing
    16781678
    bug fix: VAL(), OCT$(), MID$() and RTRIM$() now work correctly
    1679+
    ```
    16791680

    1681+
    **VERSION 0.5.4a**
    16801682

    1681-
    ## VERSION 0.5.4a
    1682-
    1683+
    ```
    16831684
    2001-02-04: 0.5.4a ndc
    16841685
    bug fix: last-line text without lf, thanks to Gary Clark
    16851686
    Hardware keys supported (keys: 0x101 (up) 0x102 (dn) 0x103 (#1) 0x104 (#2) 0x105 (#3) BREAK (#4))
    @@ -1697,4 +1698,4 @@ ex:
    16971698
    3 = M$ shit (QBasic)
    16981699
    4 = current x, 5 = current y
    16991700
    DIM supports more variables now
    1700-
    1701+
    ```

    index.html

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -145,7 +145,7 @@ <h2 id="smallbasic-version-0.12.10-has-been-released">SmallBASIC version 0.12.10
    145145
    |
    146146
    <a href="https://en.wikipedia.org/wiki/Markdown" target="_blank" rel="nofollow">Markdown</a>
    147147
    processed with
    148-
    <a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 2.2.1</a>
    148+
    <a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 2.5</a>
    149149
    | Template by <a href="http://html5-templates.com/" target="_blank" rel="nofollow">HTML5 Templates</a>
    150150
    </div>
    151151
    </div>

    pages/android.html

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -210,7 +210,7 @@ <h2 id="privacy-policy">Privacy Policy <a href="#privacy-policy"></a></h2>
    210210
    |
    211211
    <a href="https://en.wikipedia.org/wiki/Markdown" target="_blank" rel="nofollow">Markdown</a>
    212212
    processed with
    213-
    <a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 2.2.1</a>
    213+
    <a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 2.5</a>
    214214
    | Template by <a href="http://html5-templates.com/" target="_blank" rel="nofollow">HTML5 Templates</a>
    215215
    </div>
    216216
    </div>

    pages/android_changelog.html

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -340,7 +340,7 @@ <h1 id="android-changelog">Android Changelog</h1>
    340340
    |
    341341
    <a href="https://en.wikipedia.org/wiki/Markdown" target="_blank" rel="nofollow">Markdown</a>
    342342
    processed with
    343-
    <a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 2.2.1</a>
    343+
    <a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 2.5</a>
    344344
    | Template by <a href="http://html5-templates.com/" target="_blank" rel="nofollow">HTML5 Templates</a>
    345345
    </div>
    346346
    </div>

    pages/articles.html

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -90,7 +90,7 @@ <h2 id="programming-smallbasic-by-gerard-thomas-labèrnia">Programming SmallBASI
    9090
    |
    9191
    <a href="https://en.wikipedia.org/wiki/Markdown" target="_blank" rel="nofollow">Markdown</a>
    9292
    processed with
    93-
    <a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 2.2.1</a>
    93+
    <a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 2.5</a>
    9494
    | Template by <a href="http://html5-templates.com/" target="_blank" rel="nofollow">HTML5 Templates</a>
    9595
    </div>
    9696
    </div>

    0 commit comments

    Comments
     (0)
    0