Commit Graph

199 Commits

Author SHA1 Message Date
Andrey Makarov
fb463f545f Implement Pandoc Markdown concise link extension (#20304)
* Implement Pandoc Markdown concise link extension

This implements https://github.com/nim-lang/Nim/issues/20127.
Besides reference to headings we also support doing references
to Nim symbols inside Nim modules.

Markdown:
```
Some heading
------------

Ref. [Some heading].
```

Nim:
```
proc someFunction*() ...

... ## Ref. [someFunction]
```

This is substitution for RST syntax like `` `target`_ ``.
All 3 syntax variants of extension from Pandoc Markdown are supported:
`[target]`, `[target][]`, `[description][target]`.

This PR also fixes clashes in existing files, particularly
conflicts with RST footnote feature, which does not work with
this PR (but there is a plan to adopt a popular [Markdown footnote
extension](https://pandoc.org/MANUAL.html#footnotes) to make footnotes work).

Also the PR fixes a bug that Markdown links did not work when `[...]`
section had a line break.

The implementation is straightforward since link resolution did not
change w.r.t. RST implementation, it's almost only about new syntax
addition. The only essential difference is a possibility to add a custom
link description: form `[description][target]` which does not have an
RST equivalent.

* fix nim 1.0 gotcha
2022-09-04 21:52:21 +03:00
ee7
95b4524705 make implicit cstring conversions explicit (#19488)
The Nim manual says that an implicit conversion to cstring will
eventually not be allowed [1]:

    A Nim `string` is implicitly convertible to `cstring` for convenience.

    [...]

    Even though the conversion is implicit, it is not *safe*: The garbage collector
    does not consider a `cstring` to be a root and may collect the underlying
    memory. For this reason, the implicit conversion will be removed in future
    releases of the Nim compiler. Certain idioms like conversion of a `const` string
    to `cstring` are safe and will remain to be allowed.

And from Nim 1.6.0, such a conversion triggers a warning [2]:

    A dangerous implicit conversion to `cstring` now triggers a `[CStringConv]` warning.
    This warning will become an error in future versions! Use an explicit conversion
    like `cstring(x)` in order to silence the warning.

However, some files in this repo produced such a warning. For example,
before this commit, compiling `parsejson.nim` would produce:

    /foo/Nim/lib/pure/parsejson.nim(221, 37) Warning: implicit conversion to 'cstring' from a non-const location: my.buf; this will become a compile time error in the future [CStringConv]
    /foo/Nim/lib/pure/parsejson.nim(231, 39) Warning: implicit conversion to 'cstring' from a non-const location: my.buf; this will become a compile time error in the future [CStringConv]

This commit resolves the most visible `CStringConv` warnings, making the
cstring conversions explicit.

[1] https://github.com/nim-lang/Nim/blob/d2318d9ccfe6/doc/manual.md#cstring-type
[2] https://github.com/nim-lang/Nim/blob/d2318d9ccfe6/changelogs/changelog_1_6_0.md#type-system
2022-08-19 21:40:53 +02:00
Artem Klevtsov
ef92d6ec76 Improve db_postgres iterators (#18144)
* Fix pqSetSingleRowMode case. Add links to the docs

* Add missing PGContextVisibility enum

* Remove unused PGContextVisibility enum

* Improve db_postgres iterators

* Fix instantRows with DbColumns. Cosmetics.

* Reduce copy&paste in db_postgres

* Move pqclear inside loop
2021-06-03 19:41:57 +07:00
Thomas T. Jarløv
9f35bb3968 Escape %00 / \0 in dbQuote (#18015) [backport:1.4]
Fix https://github.com/nim-lang/Nim/issues/17925
2021-05-15 21:26:15 +02:00
Fröhlich A
2b6e1d4836 Fix insert calling wrong function (#17856)
The `insert` method is calling `tryInsertID`, which ignores the `pkName` parameter.
Calling `tryInsert` instead should be correct.
2021-04-29 14:11:05 +02:00
Danil Yarantsev
196a801c3f Change stdlib imports to use std prefix in most examples (#17202) 2021-03-01 00:17:19 +03:00
flywind
60e92168f9 use single backtick (#17100) 2021-02-19 00:47:21 -06:00
Juan Carlos
35dadac3fb db_postgres document how to use it with unix socket (#15187) 2020-08-17 03:39:58 -03:00
Bung
6f7c749ea5 add insert,tryInsert unify for postgres that need pk name (#14416)
* add insert,tryInsert unify for postgres that need pk name
* add ReadDbEffect to new procs
* add .since and changelog
* change since to 1.3
* Update src/db_postgres.nim

Co-authored-by: bung87 <crc32@qq.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: alaviss <leorize+oss@disroot.org>
2020-05-23 01:24:52 +08:00
Chris Heller
988a4ef900 Check pqntuples > 0 in getValue. Fixes #12973 (#12974) 2019-12-29 08:41:18 -08:00
Federico Ceratto
6c6a7e34e9 Fix spellings (#12277) [backport] 2019-09-27 06:02:54 +01:00
Chris Heller
60f707fdad Skip db_postgres.setRow if getRow returns 0 rows (#11859)
Fixes nim-lang/Nim#11821
2019-08-04 10:28:24 -07:00
Huy
c2daf0055e add unsafeColumnAt procs, that return unsafe cstring from InstantRow (#11647) 2019-07-10 19:56:09 +07:00
Zed
aa4184b375 Fix header inconsistencies in documentation (#11071) 2019-04-23 08:40:20 +02:00
Araq
83b5a2bc57 removes deprecated T/P types 2018-11-16 13:27:46 +01:00
Andreas Rumpf
dcfe341955 fixes merge conflict 2018-08-19 15:14:03 +02:00
Andreas Rumpf
5bc1ac4a51 make tests green again 2017-11-07 12:57:32 +01:00
Andreas Rumpf
16976718da Merge branch 'devel' into araq 2017-11-02 10:46:30 +01:00
Andreas Rumpf
196aad2c57 Merge branch 'devel' into araq 2017-09-15 21:12:59 +02:00
Andreas Rumpf
a202556ac7 Merge branch 'devel' into faster-nimsuggest 2017-02-17 10:48:01 +01:00
Araq
209b4a171e Merge branch 'devel' of https://github.com/nim-lang/Nim into devel 2016-01-18 14:54:50 +01:00
Araq
0dcdfa0ab5 Merge branch 'devel' of https://github.com/nim-lang/Nim into devel 2016-01-18 10:55:23 +01:00
Dominik Picheta
7407d00052 Merge pull request #3514 from vegansk/3513_pgsql_prepstat
Fixed issue 3513: wrong setupQuery realization
2015-11-11 16:09:18 +00:00
Dominik Picheta
043d77d2bc Improved postgres docs and added untestable tests. 2015-10-26 21:10:21 +01:00
JamesP
24c0887f54 fix doco by removing extra ` chars, change a word and line up multi-line text 2015-10-13 07:34:32 +10:00
JamesP
8fb1a0fa9e add doco outlining the two SQL parameter substitution mechanisms for the db_postgres module
adjust doco note: indent by one space

shorten doco example lines, by splitting across multiple lines

shorten doco line widths by splitting long lines into multi-lines

fix to prepare() example in doco "Note:" section
2015-09-17 14:15:33 +10:00
JamesP
a69826615a setupQuery() with SqlQuery take parameter substitution with "?"
add instantRows() with SqlPrepared parameter

fix setupQuery() for SqlQuery to produce a unique identiying query name

add rows() iterator with SqlPrepared parameter

add execAffectedRows for SqlPrepared
2015-09-17 13:08:24 +10:00
JamesP
f9f73aed79 tryExec() with SqlQuery now takes "?" substitution parameters
add tryExec() with SqlPrepared parameter

exec() with SqlQuery now expects "?" parameter substitution
2015-09-17 09:46:41 +10:00
JamesP
2179f45be2 add check to dbFormat() to verify parameter substitution has "?" identifier
add check to prepare() that parameter substitution has "$1" identifier
2015-09-17 09:42:40 +10:00
Andreas Rumpf
2157ebc536 Merge pull request #3289 from nanoant/patch/fix-whitespace
Patch/fix whitespace
2015-09-04 23:37:59 +02:00
Andreas Rumpf
8023c2c851 Merge pull request #2866 from nanoant/patch/db-deffered-rows
db: InstantRow and instantRows
2015-06-10 11:06:36 +02:00
pdw
7240056537 lib/impure - Dropped 'T' from types 2015-05-24 22:24:07 -05:00
Andreas Rumpf
88791d9a9e Merge pull request #2337 from kemege/db_charset
Add character set options when opening DB connection, default to UTF-8
2015-03-17 01:32:26 +01:00
Andreas Rumpf
01648fead0 Merge pull request #1889 from ramnes/devel
Happy new year!
2015-01-07 14:14:43 +01:00
Araq
c71afbcd53 Merge branch 'devel' into bigbreak
Conflicts:
	src/db_postgres.nim
	lib/pure/json.nim
	lib/pure/math.nim
	lib/system/atomics.nim
2014-11-03 11:42:36 +01:00
Araq
b984992511 docgen should work again 2014-10-05 03:06:19 +02:00
Araq
b612c42e1c Merge branch 'devel' of https://github.com/Araq/Nimrod into bigbreak
Conflicts:
	src/db_postgres.nim
	lib/pure/os.nim
	lib/wrappers/postgres.nim
2014-10-04 19:40:23 +02:00
Araq
1bb90ad3ae cleaned up various modules 2014-09-19 00:54:01 +02:00
Araq
0e5874a93a resolved conflict 2014-09-13 17:59:37 +02:00
Araq
00e4d53100 Nimrod renamed to Nim 2014-08-28 09:59:26 +02:00
Araq
76ae6168d8 Nimrod renamed to Nim 2014-08-28 09:50:51 +02:00
Andreas Rumpf
4eb3dda5e4 resolved conflict 2014-04-10 01:47:20 +02:00
Zahary Karadjov
f882499ca2 Merge branch 'master' of github.com:Araq/Nimrod into upstream 2013-12-09 00:26:04 +02:00
Araq
657f3bdfd0 Merge branch 'master' of github.com:Araq/Nimrod 2013-03-17 16:44:31 +01:00
Araq
3e4072c6ea Merge branch 'master' of github.com:Araq/Nimrod 2012-11-25 11:03:27 +01:00
Araq
f1a64fdb1c fixes #250 2012-11-19 00:16:25 +01:00
Araq
4ade87d840 'assert' hides EAssertionFailsure; stdlib makes use of 'tags' 2012-11-18 01:36:20 +01:00
Araq
593b731002 Merge branch 'master' of github.com:Araq/Nimrod 2012-10-20 18:48:49 +02:00
Araq
9a99aeac00 openarray/varargs split; breaks bootstrapping 2012-08-16 08:34:33 +02:00
Araq
d34c093f8d changed integer promotion rules; breaks bootstrapping and lots of code 2012-07-08 21:03:47 +02:00