├── ci └── vale │ └── styles │ └── Vocab │ └── Base │ ├── reject.txt │ └── accept.txt ├── images ├── HelpMenu.gif ├── MathJax.png ├── Narrowing.gif ├── logo-icon.png ├── menu-main.png ├── Narrowing01.png ├── ReadmeBuffer.png ├── VariableMenu.png ├── InsertThingsMenu.png ├── logo-color-multi.png ├── CategoryCompletion.png ├── SourceBlockNormal3.png ├── logo-color-single.png ├── WarningInvalidPostId.png ├── WireSharpTLSV1Dot2Dump.png ├── WireSharpTLSV1Dot3Dump.png └── SourceBlockSyntaxHighlighterExposed3.png ├── .gitignore ├── docs ├── o2b-entry-new-flow.png ├── o2b-entry-trash-flow.png ├── o2b-entry-view-flow.png ├── o2b-external-libraries.png ├── o2b-entry-create-save-flow.png ├── o2b-entry-source-dest-flow.png ├── Org2Bloggers.org ├── DebuggingStories.org ├── ReleaseProcess.org ├── CONTRIBUTING.org ├── TestPlan.org └── DEVELOPMENT.org ├── .vale.ini ├── .dir-locals.el ├── .mailmap ├── org2blog-pkg.el ├── .github ├── CODE_OF_CONDUCT.md ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── Makefile ├── .travis.yml ├── FUTURE.org ├── HISTORY.org ├── org2blog-test-system.el ├── ox-wp.el ├── metaweblog.el ├── tests └── org2blog-tests.org └── LICENSE.txt /ci/vale/styles/Vocab/Base/reject.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ci/vale/styles/Vocab/Base/accept.txt: -------------------------------------------------------------------------------- 1 | Grammarly 2 | UNIXen 3 | -------------------------------------------------------------------------------- /images/HelpMenu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/HelpMenu.gif -------------------------------------------------------------------------------- /images/MathJax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/MathJax.png -------------------------------------------------------------------------------- /images/Narrowing.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/Narrowing.gif -------------------------------------------------------------------------------- /images/logo-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/logo-icon.png -------------------------------------------------------------------------------- /images/menu-main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/menu-main.png -------------------------------------------------------------------------------- /images/Narrowing01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/Narrowing01.png -------------------------------------------------------------------------------- /images/ReadmeBuffer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/ReadmeBuffer.png -------------------------------------------------------------------------------- /images/VariableMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/VariableMenu.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /org2blog-autoloads.el 2 | /README.html 3 | *.elc 4 | vale/styles/* 5 | !vale/styles/Vocab/Base 6 | -------------------------------------------------------------------------------- /docs/o2b-entry-new-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/docs/o2b-entry-new-flow.png -------------------------------------------------------------------------------- /images/InsertThingsMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/InsertThingsMenu.png -------------------------------------------------------------------------------- /images/logo-color-multi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/logo-color-multi.png -------------------------------------------------------------------------------- /docs/o2b-entry-trash-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/docs/o2b-entry-trash-flow.png -------------------------------------------------------------------------------- /docs/o2b-entry-view-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/docs/o2b-entry-view-flow.png -------------------------------------------------------------------------------- /images/CategoryCompletion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/CategoryCompletion.png -------------------------------------------------------------------------------- /images/SourceBlockNormal3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/SourceBlockNormal3.png -------------------------------------------------------------------------------- /images/logo-color-single.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/logo-color-single.png -------------------------------------------------------------------------------- /docs/o2b-external-libraries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/docs/o2b-external-libraries.png -------------------------------------------------------------------------------- /images/WarningInvalidPostId.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/WarningInvalidPostId.png -------------------------------------------------------------------------------- /docs/o2b-entry-create-save-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/docs/o2b-entry-create-save-flow.png -------------------------------------------------------------------------------- /docs/o2b-entry-source-dest-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/docs/o2b-entry-source-dest-flow.png -------------------------------------------------------------------------------- /images/WireSharpTLSV1Dot2Dump.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/WireSharpTLSV1Dot2Dump.png -------------------------------------------------------------------------------- /images/WireSharpTLSV1Dot3Dump.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/WireSharpTLSV1Dot3Dump.png -------------------------------------------------------------------------------- /.vale.ini: -------------------------------------------------------------------------------- 1 | StylesPath = ci/vale/styles 2 | 3 | MinAlertLevel = suggestion 4 | Vocab = Base 5 | 6 | [*.org] 7 | BasedOnStyles = Vale 8 | -------------------------------------------------------------------------------- /images/SourceBlockSyntaxHighlighterExposed3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/misohena/org2blog/image-fix/images/SourceBlockSyntaxHighlighterExposed3.png -------------------------------------------------------------------------------- /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ;;; Directory Local Variables 2 | ;;; For more information see (info "(emacs) Directory Variables") 3 | 4 | ((nil 5 | (fill-column . 78)) 6 | (emacs-lisp-mode 7 | (indent-tabs-mode))) 8 | 9 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Charl Botha Charl P. Botha 2 | Grant Rettke Grant Rettke 3 | Puneeth Chaganti Puneeth Chaganti 4 | Puneeth Chaganti guest1 5 | Sacha Chua Sacha Chua 6 | -------------------------------------------------------------------------------- /org2blog-pkg.el: -------------------------------------------------------------------------------- 1 | (define-package "org2blog" "1.1.16" "Blog from Org mode to WordPress" 2 | '((htmlize "1.56" "https://github.com/hniksic/emacs-htmlize.git") 3 | (hydra "0.15.0" "https://github.com/abo-abo/hydra.git") 4 | (xml-rpc "1.6.15" "https://github.com/hexmode/xml-rpc-el.git") 5 | (writegood-mode "2.2.0" "https://github.com/bnbeckwith/writegood-mode") 6 | (metaweblog "1.1.16" "https://github.com/org2blog/org2blog.git")) 7 | :authors 8 | '(("Puneeth Chaganti" . "punchagan+org2blog@gmail.com")) 9 | :maintainer 10 | '("Grant Rettke" . "grant@wisdomandwonder.com") 11 | :keywords 12 | '("comm" "convenience" "outlines" "wp") 13 | :homepage "https://github.com/org2blog/org2blog") 14 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | Contributor Code of Conduct 2 | =========================== 3 | 4 | As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. 5 | 6 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion. 7 | 8 | Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. 9 | 10 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. 11 | 12 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. 13 | 14 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available [here](http://contributor-covenant.org/version/1/0/0/). 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | EMACS=emacs 2 | 3 | EMACS_CLEAN=-Q 4 | EMACS_BATCH=$(EMACS_CLEAN) --batch 5 | TESTS= 6 | 7 | CURL=curl --silent -L 8 | WORK_DIR=$(shell pwd) 9 | PACKAGE_NAME=$(shell basename $(WORK_DIR)) 10 | TRAVIS_FILE=.travis.yml 11 | TEST_DIR=tests 12 | 13 | ORG_URL=http://orgmode.org/org-latest.tar.gz 14 | ORG_TAR=org-latest.tar.gz 15 | XML_RPC_URL=https://launchpad.net/xml-rpc-el/trunk/1.6.8/+download/xml-rpc.el 16 | XML_RPC=xml-rpc 17 | METAWEBLOG_URL=https://raw.githubusercontent.com/punchagan/metaweblog/master/metaweblog.el 18 | METAWEBLOG=metaweblog 19 | 20 | test: clean 21 | @cd $(TEST_DIR) && \ 22 | (for test_lib in *-tests.org; do \ 23 | $(EMACS) $(EMACS_BATCH) -L . -L .. -L ../org-mode/lisp \ 24 | -l $(XML_RPC) -l cl -l $(METAWEBLOG) --eval \ 25 | "(progn \ 26 | (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t) (python . t))) \ 27 | (fset 'ert--print-backtrace 'ignore) \ 28 | (setq org-confirm-babel-evaluate nil) \ 29 | (org-babel-load-file \"$$test_lib\") \ 30 | (ert-run-tests-batch-and-exit '(and \"$(TESTS)\" (not (tag :interactive)))))" || exit 1; \ 31 | done) 32 | 33 | download-org : 34 | $(CURL) '$(ORG_URL)' > '$(WORK_DIR)/$(ORG_TAR)' 35 | tar xzf $(WORK_DIR)/$(ORG_TAR) 36 | rm $(WORK_DIR)/$(ORG_TAR) 37 | 38 | download-xml-rpc : 39 | $(CURL) '$(XML_RPC_URL)' > '$(WORK_DIR)/$(XML_RPC).el' 40 | 41 | download-metaweblog : 42 | $(CURL) '$(METAWEBLOG_URL)' > '$(WORK_DIR)/$(METAWEBLOG).el' 43 | 44 | download-deps : download-xml-rpc download-metaweblog download-org 45 | 46 | clean : 47 | rm -rf $(TEST_DIR)/*.el 48 | -------------------------------------------------------------------------------- /docs/Org2Bloggers.org: -------------------------------------------------------------------------------- 1 | Here are some blogs using Org2Blog. 2 | 3 | Please let us know about more blogs to add to the list! 4 | 5 | - [[http://alea.fr.eu.org/][Alea]] 6 | - [[http://ringloo.wordpress.com/][Blog]] 7 | - [[http://blog.binchen.org/][Chen Bin's Blog]] 8 | - [[http://langec.wordpress.com][Christoph Lange Weblog]] (featuring [[http://langec.wordpress.com/2012/01/20/blogging-from-emacs/][a post about org2blog]]) 9 | - [[http://crazythinking.wordpress.com/][Crazythinking]] 10 | - [[http://croniqueslinux.wordpress.com/][Cròniques d'un Nyu i un Pingüí (in catalan)]] 11 | - [[http://blog.nethazard.net/][Gabriel Saldana's blog]] 12 | - [[https://www.wisdomandwonder.com/][Grant Rettke: Wisdom and Wonder]] 13 | - [[http://graphtheoryinlatex.wordpress.com/][Graph Theory in LaTeX 2]] 14 | - [[http://www.hackinghistory.ca/][Hacking History]] 15 | - [[http://blog.nozav.org/][Humus numericus]] 16 | - [[http://irreal.org/blog/][Irreal]] 17 | - [[http://www.mikeyboldt.com/][Mikey Boldt]] 18 | - [[http://mrblog.nl/][MrBlog]] 19 | - [[http://blog.pengworld.com/][Pengworld blog]] 20 | - [[http://www.sccg.sk/~chalmo/][Pri krbe]] 21 | - [[http://rvfblog.wordpress.com/][Rafael's Blog]] 22 | - [[http://blog.ugnus.uk.eu.org/][Ramblings on Physics, Music & GNU/Linux]] 23 | - [[http://recolliments.wordpress.com/][Recolliments (Poetry in catalan)]] 24 | - [[http://stallmer.wordpress.com/][STALLMER]] 25 | - [[http://bytebaker.com/][The ByteBaker | Computer Science isn't a science and it's not about computers]] 26 | - [[https://www.lonecpluspluscoder.com][The Lone C++ Coder's Blog]] 27 | - [[http://www.alandmoore.com/blog][Thought Bucket]] 28 | - [[http://avdi.org/devblog/][Virtuous Code]] 29 | - [[http://www.olivierberger.com/weblog/][WebLog Olivier Berger]] 30 | - [[http://lolole13.wordpress.com][Yet Another Noob's Blog]] 31 | - [[http://sachachua.com/blog][sacha chua]] 32 | - [[http://synchronouslife.wordpress.com/][synchronouslife]] 33 | - [[http://vxlabs.com/2014/05/25/emacs-24-with-prelude-org2blog-and-wordpress/][vxlabs]] 34 | - [[http://wdicc.com][wd and cc]] 35 | - [[http://wenshanren.org/][肉山博客(Wenshan's Blog)]] 36 | - [[https://diggingthedigital.com/bloggen-met-org2blog/][Digging the digital (Dutch)]] 37 | -------------------------------------------------------------------------------- /docs/DebuggingStories.org: -------------------------------------------------------------------------------- 1 | * Debugging Stories 2 | 3 | Over the years various issues have surfaced. Most of them weren't worth mentioning because they were to small. But some of them were big that they deserved getting written down here! 4 | 5 | After studying how debugging works you might enjoy seeing the outcome of an example or two. 6 | 7 | ** Can't Post Unicode 8 | 9 | Suddenly Org2Blog couldn't post any content that contained Unicode characters. The problem was that when Emacs 26 came out its HTTP request library began enforcing correct byte usage for Unicode. The library itself worked fine. However clients of the library had to change. The solution was nearly a [[https://github.com/hexmode/xml-rpc-el/commit/8ee416cb7644eef4ca8edda5ea79b1c670555ad0][one line fix]]. 10 | 11 | ** Inexplicably Can't Login Or Do Anything 12 | 13 | For years everything was fine using Org2Blog, it just worked on my box. Then once in a while it didn't. And then it only worked one time out of ten. This was a major issue. 14 | 15 | After testing every combination of every library nothing obvious jumps out. Finally I pull out WireShark and curl to see what is happening. 16 | 17 | Take a look— 18 | 19 | Here is what it looks like when it /doesn't/ work using Org2Blog: 20 | 21 | [[file:../images/WireSharpTLSV1Dot3Dump.png]] 22 | 23 | Here is what it looks like when it /does/ work using curl: 24 | 25 | [[file:../images/WireSharpTLSV1Dot2Dump.png]] 26 | 27 | Debugging at the communications layer was an absolute last resort—and it payed off. Unbeknownst to me the TLS version used is negotiated between the client and the server. For some reason my GnuTLS was negotiating v1.3 with the server and puked resulting it sending everything unencrypted over HTTP instead of encrypted over HTTPS! 28 | 29 | The solution was pretty simple: forbid GnuTLS from using TLSv1.3: 30 | 31 | #+name: org_gcr_2019-01-31T23-58-28-06-00_cosmicality_B75B85C4-2197-4893-9F13-70D0212F5E8D 32 | #+begin_src emacs-lisp 33 | (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") 34 | #+end_src 35 | 36 | At least that was the /first/ solution. 37 | 38 | As it would turn out this issue was caused by a bug in GnuTLS and by changing this setting it uninentionally avoided the error. 39 | 40 | The issue was resolved in Emacs 26.3. 41 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Note: Please delete explanatory content before submitting this. 2 | 3 | ## Pull request checklist 4 | 5 | Please check if your PR fulfills the following [Contribution Expectations](https://github.com/org2blog/org2blog/blob/master/docs/CONTRIBUTING.org#contribution-expectations) 6 | 7 | Does this PR fulfill them? 8 | - [ ] No 9 | - [ ] Yes 10 | 11 | ## Pull request type 12 | 13 | Please try to limit your pull request to one type, submit multiple pull requests if needed. 14 | 15 | Please check the type of change your PR introduces: 16 | - [ ] Bugfix 17 | - [ ] Feature 18 | - [ ] Code style update (formatting, renaming) 19 | - [ ] Refactoring (no functional changes, no api changes) 20 | - [ ] Build related changes 21 | - [ ] Documentation content changes 22 | - [ ] Other (please describe): 23 | 24 | ## What is the current behavior? 25 | 26 | [Please describe the current behavior that you are modifying or link to a relevant issue. If an issue doesn't exist yet, then create one before submitting this pull request.] 27 | 28 | Issue Number: [Replace this in with the issue number] 29 | 30 | ## What is the new behavior? 31 | 32 | [Please describe the behavior or changes that are being added by this PR.] 33 | 34 | ## Have you updated the project documentation with the new behavior? 35 | 36 | - [ ] Yes 37 | - [ ] No 38 | 39 | [Please explain your answer.] 40 | 41 | This is most common for contributions with new features. Reflect on the fact that although the code may be simple, the feature might introduce, refine, or entirely redefine a concept: each of which significantly changes how you think about using Org2Blog. 80% of the time, new feature contributions require thoughtful, detailed, and example-driven updates to the system documentation. If you are unsure whether this is the case, then please review the [README](https://github.com/org2blog/org2blog/blob/master/docs/README.org), and reach out in the Issue Request itself. 42 | 43 | ## Does this introduce a breaking change? 44 | 45 | - [ ] Yes 46 | - [ ] No 47 | 48 | [If this introduces a breaking change, please describe the impact and migration path for existing applications below.] 49 | 50 | ## Other information 51 | 52 | [Please include any other information that is important to this PR.] 53 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | env: 3 | matrix: 4 | - EMACS=emacs24 5 | global: 6 | - secure: nZGl7avSoD3XmpbydmUVcV3eoWhHG70Swcoq4RUixb7XCUTl27evxqjwEh8l5C6+jRW6ZGVXTQA3Cdb+GuHpTU5oYJA0oj9S82VxG30Z4l0rD1JdaMTi5iiR7/LDUdHz7gnqfVuq8BHuv43IWsLlJirPDRIkDn5a79rd8C32reM= 7 | install: 8 | - if [ "$EMACS" = 'emacs22' ]; then curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22_22.2-0ubuntu9_i386.deb 9 | && curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-bin-common_22.2-0ubuntu9_i386.deb 10 | && curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-common_22.2-0ubuntu9_all.deb 11 | && curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-el_22.2-0ubuntu9_all.deb 12 | && curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-gtk_22.2-0ubuntu9_i386.deb 13 | && sudo apt-get -qq update && sudo apt-get -qq remove emacs emacs23-bin-common emacs23-common 14 | emacs23-nox && sudo apt-get -qq --fix-missing install install-info emacsen-common 15 | libjpeg62:i386 xaw3dg:i386 liblockfile1:i386 libasound2:i386 libgif4:i386 libncurses5:i386 16 | libpng12-0:i386 libtiff4:i386 libxpm4:i386 libxft2:i386 libglib2.0-0:i386 libgtk2.0-0:i386 17 | && sudo apt-get -qq -f install && sudo dpkg -i emacs22-common_22.2-0ubuntu9_all.deb 18 | emacs22-el_22.2-0ubuntu9_all.deb && sudo dpkg -i --force-depends emacs22-bin-common_22.2-0ubuntu9_i386.deb 19 | && sudo dpkg -i emacs22_22.2-0ubuntu9_i386.deb emacs22-gtk_22.2-0ubuntu9_i386.deb 20 | && sudo update-alternatives --set emacs22 /usr/bin/emacs22-gtk; fi 21 | - if [ "$EMACS" = 'emacs23' ]; then sudo apt-get -qq update && sudo apt-get -qq -f 22 | install && sudo apt-get -qq install emacs23-gtk emacs23-el; fi 23 | - if [ "$EMACS" = 'emacs24' ]; then sudo add-apt-repository -y ppa:cassou/emacs && 24 | sudo apt-get -qq update && sudo apt-get -qq -f install && sudo apt-get -qq install 25 | emacs24 emacs24-el; fi 26 | - if [ "$EMACS" = 'emacs-snapshot' ]; then sudo add-apt-repository -y ppa:ubuntu-elisp/ppa 27 | && sudo apt-get -qq update && sudo apt-get -qq -f install && sudo apt-get -qq install 28 | emacs-snapshot && sudo apt-get -qq install emacs-snapshot-el; fi 29 | before_script: make download-deps && $EMACS --version 30 | script: make test EMACS="$EMACS" 31 | notifications: 32 | email: false 33 | -------------------------------------------------------------------------------- /FUTURE.org: -------------------------------------------------------------------------------- 1 | * Issue Created 2 | 3 | - Support for custom fields/taxonomies #278 4 | - Overhaul testing #274 5 | - Get Travis autobuild and autotesting running again #273 6 | - Migrate to continuous integration with nix-emacs-ci 7 | - Migrate XML-RPC WordPress API to https://codex.wordpress.org/XML-RPC_WordPress_API/Taxonomies #271 8 | - Prevent documents from being posted #200 9 | - Make sure that post tracking works without org-directory set #242 10 | - This test https://github.com/org2blog/org2blog/blob/master/tests/org2blog-tests.org#tracking-posts should verify that post tracking owrks without org-directory set. 11 | - This post #216 (comment) may indicate that it does not. 12 | - Determine whether or not this is an issue and deal with it. 13 | - Make the location of .org2blog configurable #268 14 | - Add a customizable variable for the default, which is nothing 15 | - If a customization exists then use that, otherwise use org-directory 16 | - Generate Texinfo from README.org #272 17 | - Switch everything to POST_ID from POSTID #304 18 | 19 | * No Issue Created 20 | 21 | - Application Passwords 22 | - See [[https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/][Application Passwords: Integration Guide]] 23 | - On <2022-08-10> tried on WordPress 6.0.1. Couldn't make feature work using either ~curl~ or ~org2blog~. 24 | - Refactor org2blog-tests.org running again 25 | - Document how Org2Blog works 26 | - Update documentation for Gutenberg 27 | - Note that since Org2Blog uses the Org-WordPress model there is no integration. 28 | - Add examples of warning messages 29 | - Document spell checking tools 30 | - Document [[https://github.com/alphapapa/org-web-tools][org-web-tools]] workflow 31 | - Shortcode documentation needs to be added 32 | - Right now ~org2blog/wp-use-sourcecode-shortcode~ is only mentioned in context of one specific plugin. It's a general feature that applies to every plugin. Document this. 33 | - Application overview for new contributors 34 | - Keeping issues in a closed state with the "on-hold" label and this file at 35 | the same time is starting to get confusing. 36 | - GPL releases for previous committers. 37 | - Use ~reporter-submit-bug-report~ instead of custom-created 38 | - ~metaweblog~ data structures 39 | - There are 20 calls to ~cons~ to prepare ~metaweblog~ arguments 40 | - This ought to be in a data structure for anyone using the client 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: If something can be better, then we'll make it happen together! 4 | title: '' 5 | labels: 'Feature Request' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Thank you for filling out this feature request (FR). Please perform every step and answer every question to the best of your ability. That will make it easier for you and more accessible for us to address the feature request with the highest level of quality in the shortest amount of time. 11 | 12 | Note: Please delete explanatory content before submitting this. 13 | 14 | ### Description 15 | 16 | [Please replace this with: _A single sentence description of the feature._] 17 | 18 | ### Prerequisites 19 | 20 | * [ ] Did you study the [README](https://github.com/org2blog/org2blog/blob/master/README.org) and learn how the existing Org2Blog features work? 21 | * [ ] Did you review the issue tracker to see if this FR already 22 | exists or is resolved? 23 | * [ ] Have you reviewed the [FUTURE](https://github.com/org2blog/org2blog/blob/master/FUTURE.org) file to see if the FR already exists? 24 | 25 | ### Good Documentation 26 | 27 | Good documentation requires the author to take the user's perspective, address that user, and most importantly, have zero working knowledge of how the software works internally. Developers can rarely do this well for one simple reason: they are too close to their product, so someone else usually has to do it. Typically a Technical Writer is staffed to fill that role, but like most software projects (open source or not), Org2Blog can't quite fit that in the budget this year, so it is up to the developers yet again. However, the good news for all Org2Blog users now is that you are here! 28 | 29 | You are already writing this feature request from the viewpoint required for good documentation. You already know how you'll be doing what you want to do with this product: you just need them implemented. Here, my friend is where the magic can happen. 30 | 31 | Given your unique take on Org2Blog, how it can improve, the new functionality inspiring you, and your ideal position as a thoughtful user and feature request submitter—everyone is dying to know: 32 | 33 | Are you willing to write new or refine the existing documentation as this feature request moves through its lifecycle? 34 | 35 | Please choose one of the following: 36 | 37 | - [ ] Yes. 38 | - [ ] No. Please provide an explanation why. 39 | 40 | ### Type of FR 41 | 42 | Please try to limit your FR to one type, submit multiple FRs if needed. 43 | 44 | Please check the type of feature you are requesting: 45 | 46 | - [ ] Brand New Feature 47 | - [ ] Change Existing Feature 48 | - [ ] Code style update (formatting, renaming) 49 | - [ ] Refactoring (no functional changes, no api changes) 50 | - [ ] Build related changes 51 | - [ ] Documentation content changes 52 | - [ ] Other (please describe): 53 | 54 | ### Describe the solution you'd like 55 | 56 | [Please replace this with: _A clear and concise description of what you want to happen._] 57 | 58 | Include "Why" for some context. For example that "It is painful when..." or "Org2Blog would make me so much happier if..."] 59 | 60 | ### Describe alternatives you've considered 61 | 62 | [Please replace this with: _A clear and concise description of any alternative solutions or features you've considered, including none._] 63 | 64 | ### Screenshots & User Interface Mockups 65 | 66 | If applicable, add screenshots to help explain your FR. 67 | 68 | ### Additional context 69 | 70 | If applicable, add any other context about the FR here. 71 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: If something is wrong, then we will make it right! 4 | title: '' 5 | labels: 'Bug Report' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Thank you for filling out this bug report (BR). Please perform every step and answer every question to the best of your ability. That will make it easier for you and more accessible for us to address the issue with the highest level of quality in the shortest amount of time. 11 | 12 | Note: Please delete explanatory content before submitting this. 13 | 14 | ### Description 15 | 16 | [Single sentence description of the bug.] 17 | 18 | ### Prerequisites 19 | 20 | * [ ] Did you study the [README](https://github.com/org2blog/org2blog/blob/master/README.org) to learn how the feature you are reporting a bug is expected to work? 21 | * [ ] Did you go through the [When Things Go Wrong](https://github.com/org2blog/org2blog#when-things-go-wrong-or-could-go-even-better) process? It covers the steps to review many possibilies 22 | * [ ] Did you review the issue tracker to see if this bug is already 23 | reported or resolved? 24 | * [ ] Did you consider that what you are describing may be a feature request? If you answered yes, review both the issue tracker and the [FUTURE](https://github.com/org2blog/org2blog/blob/master/FUTURE.org) file to see if the feature request already exists. 25 | 26 | ### Environment 27 | 28 | - Regarding the feature that you are reporting: #1 Has it ever worked correctly for you? and #2 If so when, and, what do you think might have changed between then and now? For example you are on a different network or you made changes to your Emacs configuration. 29 | - What operating system are you running Emacs on? [e.g., macOS 10.13 or Windows 10] 30 | - How did you install Emacs? [e.g., compiled it, download and manual install, package manager like Apt on Linux or brew on macOS] 31 | - Do you run Emacs in the GUI or a Terminal? [e.g., GUI or Terminal] 32 | - What is the value of `org2blog/wp-blog-alist`? Here is how to add the value to this BR: Create an empty source block by inserting three backticks on a blank line, hit return to create a new empty line, then insert three backticks. Now the goal is to place the value on that empty line. One way is for you to copy your configuration into this block manually. It is the easiest. Another way is to ask Emacs to find the value so you can paste it onto this line. Here is how: hit `M-S-:`, type `(kill-new (with-output-to-string (princ org2blog/wp-blog-alist)))` and strike `[enter]`, the information is now in the `kill-ring`, go back to that empty line, and paste the value. You will have to format it now, but you will have the correct values for your system. Either way, remove any private information like passwords or internal URLs. It will look something like this markup and code:' 33 | 34 | ``` 35 | (("yourblog" 36 | :url "https://www.yourblog.com/xmlrpc.php" 37 | :username "you" 38 | :password "onlyyouknow")) 39 | ``` 40 | 41 | Now obtain critical library information by: 42 | 1. Hitting `M-x` 43 | 2. Typing in `org2blog-version-info` 44 | 3. Striking `[enter]` 45 | 4. The information appears in the minibuffer then gets added to the `kill-ring`, aka your clipboard. 46 | 5. Paste that message below: 47 | 48 | ``` 49 | Paste the message here. 50 | ``` 51 | 52 | Did you go through the `org2blog-user-report` process? If you did then please paste in the log files here [yes/No]: 53 | 54 | ``` 55 | Paste the logs here. 56 | ``` 57 | 58 | ### Server 59 | 60 | - What is the URL of your blog? 61 | - Do you have a web browser to use for testing? 62 | - Can you reach that URL using that browser? 63 | - Can you log into your blog using that browser? 64 | - Can you create or edit a post using that browser? 65 | 66 | ### Hardware Issues 67 | 68 | It is easy to diagnose odd computer and router behavior and that might have been reported to address issues working with WordPress's XML-RPC. However for most of us rebooting the server is neither trivial nor easy and in fact can be a very bad idea. Only consider that route if you know what you are doing. 69 | 70 | - Have you tried rebooting your computer? 71 | - Have you tried rebooting your router? 72 | - Have you tried rebooting your server? 73 | 74 | ### Minimal Reproducible Example 75 | 76 | Read about creating a [Minimal Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) to learn about the best way to write a BR. Although the post is tailored for their discussion board, the techniques and strategies apply perfectly to report a bug. After reading about their approach a couple of times, please move forward with the BR. 77 | 78 | ### Steps to Reproduce 79 | 80 | 1. [First Step] 81 | 2. [Second step] 82 | 3. [and so on...] 83 | 84 | ### Expected behavior 85 | 86 | [What you expected to happen] 87 | 88 | ### Actual behavior 89 | 90 | [What actually happened] 91 | 92 | ### Screenshots 93 | 94 | If applicable, add screenshots to help explain your problem. 95 | 96 | ### Additional context 97 | 98 | Add any other context about the problem here. 99 | -------------------------------------------------------------------------------- /docs/ReleaseProcess.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Org2Blog Release 1.1.16 2 | #+DATE: 2022-11-17T23:06:17-06:00 3 | 4 | - [X] What release tag is this? \rarr v1.1.16 5 | - [ ] Create and checkout this branch 6 | - [ ] Update copyright dates 7 | - [X] Open and update [[../HISTORY.org][History]] as you go 8 | - [ ] Update software versions in ~org2blog-defi~: 9 | - Start emacs with no init file and check: ~emacs --no-init-file&~ 10 | - [ ] Emacs version 11 | - [ ] Org version 12 | - [ ] For each used library note [internal or external] and [tag] and maybe 13 | update it in ~org2blog-defi~ and regenerate things 14 | - [ ] HTMLize, external, 1.56 15 | - [ ] Hydra, external, 0.15.0 16 | - [ ] XML-RPC, external, 1.6.15 17 | - [ ] WriteGood, external, v2.2.0 18 | - [ ] Regenerated? [Yes or No] Yes 19 | - Open ~org2blog.el~ 20 | - [X] The release version number appears in multiple files. Update them with 21 | this helper function by following these steps: 22 | - Open ~org2blog.el~ 23 | - Update ~org2blog/wp-version~ with the new version 24 | - Evaluate the buffer 25 | - Call ~org2blog-def-update-artifacts~ 26 | - This step /may/ be fragile. It automates the manual steps of updating 27 | version numbers by searching for string matches, and sometimes those 28 | values change. If the function fails, try visiting each of the relevant 29 | files in the function body, moving the cursor to the first line, and 30 | trying again. If that fails, then please file an Issue Report so we can 31 | look at it together. 32 | - Stage it and review the results. 33 | - [ ] Bring codebase up to expectations in [[CONTRIBUTING.org][Contributing]]. 34 | - [ ] Byte compile changed files 35 | - Expected and non critical warnings 36 | - [ ] Checkdoc and paste the results here 37 | #+begin_quote 38 | Buffer comments and tags: Ok 39 | Documentation style: 19 Errors 40 | Message/Query text style: Ok 41 | Unwanted Spaces: Ok 42 | #+end_quote 43 | - [ ] Package-Lint: ~package-lint-current-buffer~- Notes follow 44 | - 17:23: warning: This makes the package uninstallable in all released Emacs versions. 45 | - Invalid symbol names with slash in them. 46 | - [ ] Testing: Do one or both―note it 47 | - [ ] Yes: Manually test all functions 48 | | Container | Type | Save | View | Publish | Trash | 49 | |-----------+------+------+------+---------+-------| 50 | | Buffer | Post | OK | OK | OK | OK | 51 | | Buffer | Page | OK | OK | OK | OK | 52 | | Subtree | Post | OK | OK | OK | OK | 53 | | Subtree | Page | OK | OK | OK | OK | 54 | - [ ] No: Complete [[../org2blog-test-system.el][System Test Program and Test Plan]] 55 | - Start Emacs in an empty environment before loading Org2Blog and perform the testing by starting Emacs like this: ~emacs --no-init-file~ 56 | - The test is identical to running manually. Primarily used in case you don't have a blog and you are pointing at the test server. 57 | - Did you run this and why? 58 | - [ ] Build package with [[https://github.com/melpa/melpa#build-scripts][MELPA]]: First with metaweblog and second org2blog 59 | - [ ] Update MELPA from Github 60 | - [ ] Configure to point at this branch for example. The key thing is that you are pointing it at the branch. When it builds the package verify it. The build script is sensitive to recipe formatting btw. You must enable file variables when you open it. 61 | #+begin_src elisp 62 | (org2blog :fetcher github 63 | :repo "org2blog/org2blog" 64 | :branch "noautoloads" 65 | :files (:defaults "README.org" (:exclude "metaweblog.el"))) 66 | #+end_src 67 | - [ ] Build it from the top level dir 68 | - make clean 69 | - make recipes/org2blog 70 | - open packages 71 | - open ~/.emacs.d/elpa 72 | - Delete the metaweblog and org2blog folder 73 | - [ ] Install it with ~package-install-file~. Open install folder and look 74 | at the headers: are they OK? 75 | - [ ] Test using the package versus using the source code. 76 | - [ ] Create a Feature Reqest with this in it: 77 | #+begin_src gfm 78 | This is a placeholder for when vX.Y.Z gets released. 79 | 80 | It serves as a notification for users running into any issues. 81 | 82 | When the [branch](https://github.com/org2blog/org2blog/tree/X.Y.Z) is merged I'll add a comment here. 83 | 84 | After day or two when it seems OK I'll tag it. 85 | #+end_src 86 | - [ ] Run grammar checker 87 | - [ ] At minimum on the =About= section 88 | - [ ] More: What did you also do? 89 | - Processed a lot of contractions 90 | - [ ] Merge branch into ~master~ push it. 91 | - [X] Wait a day or two to make sure it's OK 92 | - [X] If you didn't do a merge, then commit the changes here 93 | - "Make v1.1.16 release in master" 94 | - [X] Prepare to later publish announcement on Reddit 95 | - Customize Message 96 | #+begin_src markdown 97 | Just released Org2Blog v1.1.16 98 | 99 | Just released Org2Blog v1.1.16: 100 | 101 | - Underlining was broken 102 | - Now it works 103 | 104 | Code: https://github.com/org2blog/org2blog 105 | 106 | Cross posting to: 107 | 108 | - Org mode: Because it uses Org markup 109 | - Emacs: Because its an application that runs on top of Emacs 110 | 111 | Thank you for helping make Org2Blog better. 112 | 113 | Happy Blogging! 114 | #+end_src 115 | - [X] Tag and push it 116 | #+begin_src sh 117 | git tag v1.1.16 118 | git log --tags --simplify-by-decoration --pretty="format:%ai %d" 119 | git push --tags 120 | #+end_src 121 | - [X] In the post-tag commit: 122 | - Create a feature request, paste this in a code block, and close it 123 | - Title: Release 1.1.16 124 | -------------------------------------------------------------------------------- /docs/CONTRIBUTING.org: -------------------------------------------------------------------------------- 1 | * Introduction 2 | 3 | Nice to meet you 😄. 4 | 5 | Wherever we end up going from here: 6 | 7 | Thank you for spending your precious time and valued brainpower—it's truly appreciated! 8 | 9 | This contribution guide exists so that you and other contributors will get the most out of your effort for the least amount of time and expenditure required. It's simple—we are looking for all and everything you view as a contribution. 10 | 11 | * Areas To Contribute 12 | 13 | - Improving documentation. 14 | - Bug triage. 15 | - Writing tutorials. 16 | - Feature ideas. 17 | - "Simple things" like spelling and grammar fixes, typo correction, white space, and formatting changes 18 | - Refactoring. 19 | - Support questions: yes, really! If you are facing it, then you can't be the only one. It's an opportunity to better the documentation, the package itself, or more. Create a [[https://github.com/org2blog/org2blog/issues/new]["Blank" issue type]] to ask your question since it's neither a bug report nor a feature request. 20 | - Whatever things that /aren't/ listed here that /should be/. 21 | 22 | * Contribution Expectations 23 | 24 | ** Documentation 25 | 26 | 80% of the time, your changes require either an update to the project documentation, the source code [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Documentation.html][documentation]], or *BOTH*. The literal changes your contribution made is crystal clear: the commits explains everything. However, the context for your change, the thought process you followed, and examples of its use are not. There might be little to no documentation required for bug fixes and minor changes: it should be self-evident. For new features, though, assume that you will have to put some real thought into the new documentation. Assume that your fellow bloggers are unfamiliar with the feature area. You are introducing the feature area, the problem you faced using it, and the solution you created for them for the first time. 80% of the time, your fellow users are either using this feature for the first time, or have used it and won't precisely understand it solves. The saddest software is the one that never runs. Unless you update the documentation, other users will likely never learn about your contribution, and the code will essentially die. Consider it your duty, responsibility, and gift to future users to make your donation accessible in both the code and the documentation. Please take this as an opportunity to have some fun changing how other Org2Bloggers think: you are making the Org2Blog universe a better place and all of the greatly appreciate it. 27 | 28 | ** Coding style and conventions 29 | 30 | The Emacs Lisp code should follow the [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Tips.html][Emacs Lisp conventions]] and the [[https://github.com/bbatsov/emacs-lisp-style-guide][Emacs Lisp Style Guide]]. Write easy-to-understand code. That doesn't mean going overboard, though! It just means write code that humans can follow simply by reading and that you can easily debug with [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Edebug.html][Edebug]]. For example, instead of writing multiple expressions embedded many levels deep, use a ~let*~ to write sequential code: it's easier to understand. Make variable names with full words in all but the most straightforward cases. For example, regular expressions are defined in a two-item list: the first item is the logical name of the regex, for example, "birthday," and the second item is the actual regex pattern to match. Instead of binding the logical name and regex to ~n~ and ~r~ instead bind them to ~rxname~ and ~rxpattern~—another example handling function results. Bind the result of the function to a variable before returning it: ~(let ((result (hard-work-here))) result)~. That way, you can quickly identify where the function logically ends and additionally can set a breakpoint there and play around with ~eval~'ing code during the function's execution (use ~edebug-defun~). Sometimes you run into situations where there is no logical way to proceed through a function, and the best solution is to exit the function. You may never have heard of this before, but you /can/quickly write this style of code using ~catch~ and ~throw~. Although there is a stigma attached to this sequential code in Lisp, it's essential for writing real-world functions as you do in Org2Blog. An additionally, you can combine that with ~condition-case-unless-debug~ for precise error handling. A good example is how to handle errors in functions where you don't have to leave the function but need to quickly abort what you are doing, notify the users, then decide what to do next. When you write non-trivial functions, as are most, it will help you make sense when you are writing it and make it easier for future maintainers. Overall write code to make it easy for future maintainers to maintain: it will result in more accessible and higher quality code for you to write right now and for all maintainers in the future. 31 | 32 | ** Grammar and Language 33 | 34 | This project is configured for [[https://vale.sh/][Vale]]. 35 | 36 | At a minimum =errors= must be resolved. 37 | 38 | Strive for =warning=s reduced. 39 | 40 | =suggestions= are fine just don't leave it in =.vale.ini=. 41 | 42 | For project documentation, don't break long lines for example, using Auto Fill Mode. Linters usually don't like broken sentence. It becomes tedious to read long lines, though: the solution is to use [[https://github.com/joostkremers/visual-fill-column][Visual Fill Column]] to mimic the effects of breaking your lines. 43 | 44 | ** Use quality-checking tools 45 | 46 | Use [[https://melpa.org/#/flycheck][flycheck]], [[https://github.com/purcell/package-lint][package-lint]] and [[https://github.com/purcell/flycheck-package][flycheck-package]] to help you identify common errors in package metadata and code. Use [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Tips.html][checkdoc]] to make sure that your package follows the conventions for documentation strings. 47 | 48 | ** Review existing issues 49 | 50 | [[https://github.com/org2blog/org2blog/issues][The issue tracker]] may already have them solved; otherwise, they're a great place to start 51 | 52 | ** The Future 53 | 54 | [[https://github.com/org2blog/org2blog/blob/master/FUTURE.org][The future file]] may already have new features listed, and if it doesn't, then maybe it should. Either way, it might be a great place to start. 55 | 56 | ** Accept the license 57 | 58 | Org2Blog is licensed [[https://www.gnu.org/licenses/gpl-3.0.en.html][GPLv3]]: you understand and submit your code under those terms. 59 | 60 | * Conclusion 61 | 62 | That is it. That would be everything. If you made it this far: kudos to you for sticking around. Thank you for spending your time here. I hope you keep blogging and having fun with Org2Blog. 63 | 64 | Thanks and have a great day. 65 | -------------------------------------------------------------------------------- /docs/TestPlan.org: -------------------------------------------------------------------------------- 1 | * Introduction 2 | 3 | This is an informal test plan for Org2Blog. It only includes commands. Reviewing each of them will give you a sense of how the system works. Perhaps reviewing the smallest units of functionality is a better way to learn the system compared to studying it all once. In service of those goals, just enough detail is provided here to make sense of testing without becoming mind numbingly painful. 4 | 5 | The tests are split up logically and informally. The prerequisites are obvious. For example you need a blog before you can post, and you need a user before you can log in. Each test has /some/ notes about what should happen, maybe along with a reference. All of the commands are also accessible by the UI if that is easier for you. Ideally you test the command directly and also via the UI. 6 | 7 | The easiest way to use this is to copy this file to your computer and check off items as you go. Please submit improvements and corrections. Have a pleasant test run! 8 | 9 | * Information 10 | 11 | These are user facing system information commands. 12 | 13 | - [ ] Commands 14 | - [ ] ~org2blog-about~ 15 | - Verify all URLs 16 | - [ ] ~org2blog-user-interface~ 17 | - [ ] Main Menu 18 | - It should load 19 | - [ ] Insert Menu 20 | - After creating a post try inserting everything 21 | - [ ] Variables Menu 22 | - Load every value 23 | - [ ] ~org2blog-readme~ 24 | - It displays. Is savable. 25 | - [ ] ~org2blog-version-info~ 26 | - Version numbers display 27 | 28 | * Key Bindings 29 | 30 | - [ ] Commands 31 | - [ ] ~org2blog-reload-entry-mode-map~: change prefix 32 | - [ ] Compare bindings with UI 33 | 34 | * General Entries 35 | 36 | These are commands that insert markup into your post. 37 | 38 | - [ ] Commands 39 | - [ ] ~org2blog-insert-latex~ 40 | - Inserts a [[https://orgmode.org/manual/LaTeX-fragments.html][LaTeX fragment]] for the name LaTeX 41 | - [ ] ~org2blog-insert-mathjax~ 42 | - Inserts a [[https://codex.wordpress.org/Shortcode_API][WordPress Shortcode]] for [[https://wordpress.org/plugins/mathjax-latex/][MathJax-LaTeX]] 43 | - [ ] ~org2blog-insert-more~ 44 | - Inserts a [[https://en.support.wordpress.com/more-tag/][WordPress More tag]] test empty and populated 45 | - [ ] ~org2blog-insert-link~ 46 | - Insert a link to your blog 47 | - [ ] Post 48 | - [ ] Page 49 | - [ ] ~org2blog-org2blog-keyword-check~ 50 | - Inserts the #+ORG2BLOG keyword in the first open line it finds to test a 51 | few out. It works the same in buffer and subtree pages 52 | - [ ] ~org2blog-complete~ 53 | - Completes categories, tags, and [[https://en.support.wordpress.com/pages/page-options/#parent-page][parent]]. 54 | - Position cursor all over the line 55 | - Use empty and populated lines: one place it won't complete is at the keword closing colon, so read the error message there 56 | - [ ] Buffer 57 | - [ ] Post 58 | - [ ] Category 59 | - [ ] Tag 60 | - [ ] Parent 61 | - [ ] Page 62 | - [ ] Category 63 | - [ ] Tag 64 | - [ ] Parent 65 | - [ ] Subtree 66 | - [ ] Post 67 | - [ ] Category 68 | - [ ] Tag 69 | - [ ] Parent 70 | - [ ] Page 71 | - [ ] Category 72 | - [ ] Tag 73 | - [ ] Parent 74 | - [ ] ~org2blog-entry-trash-prompt~ 75 | - [ ] Page 76 | - [ ] Post 77 | - [ ] Image Attachments 78 | - [ ] Single file 79 | - [ ] Two files 80 | 81 | * Tracking 82 | 83 | - [ ] Handle when no tracking is configured 84 | - [ ] When using the Org dir 85 | - [ ] Buffer 86 | - [ ] Post 87 | - [ ] Page 88 | - [ ] Subtree 89 | - [ ] Post 90 | - [ ] Page 91 | - [ ] When using the configuration file specified dir 92 | - [ ] Buffer 93 | - [ ] Post 94 | - [ ] Page 95 | - [ ] Subtree 96 | - [ ] Post 97 | - [ ] Page 98 | 99 | * Buffers 100 | 101 | - [ ] Commands 102 | - [ ] ~org2blog-buffer-new~ 103 | - [ ] ~org2blog-buffer-post-save~ 104 | - [ ] ~org2blog-buffer-post-view~ 105 | - [ ] ~org2blog-buffer-post-publish~ 106 | - [ ] ~org2blog-buffer-post-trash~ 107 | - [ ] ~org2blog-buffer-page-save~ 108 | - [ ] ~org2blog-buffer-page-view~ 109 | - [ ] ~org2blog-buffer-page-publish~ 110 | - [ ] ~org2blog-buffer-page-trash~ 111 | 112 | * Subtrees 113 | 114 | - [ ] Commands 115 | - [ ] ~org2blog-subtree-new~ 116 | - [ ] ~org2blog-subtree-post-save~ 117 | - [ ] ~org2blog-subtree-post-view~ 118 | - [ ] ~org2blog-subtree-post-publish~ 119 | - [ ] ~org2blog-subtree-post-trash~ 120 | - [ ] ~org2blog-subtree-page-save~ 121 | - [ ] ~org2blog-subtree-page-view~ 122 | - [ ] ~org2blog-subtree-page-publish~ 123 | - [ ] ~org2blog-subtree-page-trash~ 124 | 125 | * Source Blocks 126 | 127 | - [ ] Without SyntaxHighlighter Evolved 128 | - [ ] Caption 129 | - [ ] Name 130 | - [ ] With SyntaxHighlighter Evolved 131 | - [ ] Caption 132 | - [ ] Name 133 | 134 | * LaTeX 135 | 136 | - [ ] Built-In 137 | - [ ] Inline 138 | - [ ] Environment 139 | - [ ] MathJax 140 | - [ ] Inline 141 | - [ ] Environment 142 | 143 | * User 144 | 145 | - [ ] Commands 146 | - [ ] ~org2blog-user-login~ 147 | - Area above UI shows login status 148 | - Messages shows statistics 149 | - [ ] ~org2blog-user-logout~ 150 | - Area above UI shows logout status 151 | - [ ] ~org2blog-user-report~ 152 | - When enabled there are a lot of SSL messages happening 153 | - Disable it and they're not 154 | - [ ] Hooks 155 | - [ ] ~org2blog-mode-hook~ 156 | - A good place to create keybindings, check that they're set 157 | - [ ] ~org2blog-buffer-entry-save-hook~ 158 | - Add the sample hook from the docsring and veriy that it works. 159 | - [ ] ~org2blog-maybe-start~ 160 | - Open an ORG2BLOG file verify mode starts 161 | - [ ] ~org2blog/wp-after-new-post-or-page-functions~ 162 | - Use the ~pp~ example from [[../README.org][README]] 163 | 164 | * Code 165 | 166 | - [ ] Review Every Artifact For TODO Entries 167 | 168 | * Installation 169 | 170 | - [ ] Download source and use that 171 | - [ ] Create a package and install it 172 | - [ ] Update build.sh 173 | - [ ] Verify it has expected files 174 | - [ ] Source 175 | - [ ] Documents 176 | - [ ] Images 177 | - [ ] Study Installation 178 | - [ ] Test package 179 | - Start a separate Emacs instance with an awareness of how Emacs is loading Org2Blog from where 180 | - [ ] MELPA Package 181 | - [ ] Update recipe 182 | - [ ] Verify it has expected files 183 | - [ ] Source 184 | - [ ] Documents 185 | - [ ] Images 186 | - [ ] Study Installation 187 | - [ ] Test package 188 | - Start a separate Emacs instance with an awareness of how Emacs is loading Org2Blog from where 189 | 190 | * Documentation 191 | 192 | - [ ] README.org 193 | - [ ] Contains information for defcustoms 194 | - [ ] Table of Contents has been rebuilt 195 | - [ ] Spell check 196 | 197 | ** README 198 | 199 | - [ ] Standard 200 | - [ ] Badges 201 | - [ ] Github Shields 202 | - [ ] Versions 203 | 204 | ** Other 205 | 206 | - [ ] Contributing 207 | - [ ] Standard 208 | - [ ] ISSUE_TEMPLATE 209 | - [ ] Standard 210 | -------------------------------------------------------------------------------- /HISTORY.org: -------------------------------------------------------------------------------- 1 | * About 2 | 3 | Documents notable release changes. 4 | 5 | * Table of Contents 6 | :PROPERTIES: 7 | :TOC: :include all :ignore (this) 8 | :END: 9 | :CONTENTS: 10 | - [[#about][About]] 11 | - [[#v11-inky-hand][v1.1 "Inky Hand"]] 12 | - [[#v1100][v1.1.00]] 13 | - [[#users][Users]] 14 | - [[#developers][Developers]] 15 | - [[#maintainers][Maintainers]] 16 | - [[#fixes][Fixes]] 17 | - [[#v1101-v1112][v1.1.01-v1.1.12]] 18 | - [[#v1113][v1.1.13]] 19 | - [[#v1113][v1.1.13]] 20 | - [[#v1114][v1.1.14]] 21 | - [[#v1115][v1.1.15]] 22 | - [[#v10][v1.0]] 23 | - [[#v1000][v1.0.00]] 24 | - [[#v1001][v1.0.01]] 25 | - [[#v1002][v1.0.02]] 26 | - [[#v1003][v1.0.03]] 27 | - [[#v09][v0.9]] 28 | - [[#v0901][v0.9.01]] 29 | - [[#v0902][v0.9.02]] 30 | - [[#v0903][v0.9.03]] 31 | :END: 32 | 33 | * v1.1 "Inky Hand" 34 | ** v1.1.00 35 | *** Users 36 | 37 | - Adds a simple and powerful user interface exposing every aspect of Org2Blog—many of which you may never have known even existed before. 38 | - Use the one-keypress help menu to look up the documentation behind every menu entry along with the function name behind it if you want to bind it to a key. 39 | - Includes the manual built-in to the application. It's the README.org so you don't have to go to the web page to read it. 40 | - Expands on and revises every aspect of documentation including explanations and screenshots. 41 | - Blogging styles and strategies covered range from first-time blogging to advanced use with multiple blogs and diverse workflows. 42 | - Adds an API for automating bulk import of Org files when you want to move from another Org based blogging platform to Org2Blog. 43 | - Added a new logo: 44 | - A WordPress operator's inky hand, colored by Org mode, cradles a special press plate for Org2Blog: Org2Blog's first logo. Thank you Cari at [[http://sepiarainbow.com/][Sepia Rainbow Designs]] for this brilliant logo. 45 | - Adds a built-in README with links to learn more about this project, how to start having fun blogging, and even how Free Software is critical to you as a user and society as a whole. 46 | 47 | *** Developers 48 | 49 | - Now requires at least Emacs 26.3 and Org mode 9.1.9. 50 | - Expanded and revised every aspect of documentation including running from the source code instead of a package and debugging various network issues. 51 | - Adds steps for rebuilding the readme 52 | - Revises contribution expectations 53 | - Adds scripted system integration testing covering 50% of Org2Blog's functionality 54 | - Imports ~metaweblog~ 55 | - Adds ~org2blog-def-update-artifacts~ to update version numbers across all package files. See ~org2blog-def--package~ for details. 56 | - Names refactored to standardize language. 57 | - All code brought up to GNU and MELPA coding and packaging standards. 58 | 59 | *** Maintainers 60 | 61 | - Adds steps for all aspects of package maintenance 62 | - Adds function deprecations for future future retirement 63 | - Blog ID will only ever be 1: Org2Blog doesn't support multi-site installs. See ~org2blog--default-blogid~. 64 | 65 | *** Fixes 66 | 67 | - ~ox-wp~ exporter includes source block IDs. 68 | - Completed and corrected implementation of various functionality. 69 | 70 | ** v1.1.01-v1.1.12 71 | 72 | - v1.1.01 73 | - Standardized version numbers across Org2Blog, OX-WP, and MetaWeblog to 1.1.1 74 | - v1.1.02 75 | - Load =subr-x=. 76 | - v1.1.03 77 | - Correct listing format spacing in ~ox-wp-src-block-shortcode~ and ~ox-wp-src-block-html~. 78 | - v1.1.04 79 | - Remove "Listing" prefix ~ox-wp-src-block-shortcode~ and ~ox-wp-src-block-html~. 80 | - v1.1.05 81 | - Make Subtree Entries using a template like Buffer Entries already do. 82 | - v1.1.06 83 | - Give Tags configurable default values like Categories already do. 84 | - v1.1.07 85 | - Refactor Image Uploading Functionality 86 | - No longer uploads =A HREF= links. 87 | - Now an Option disabled by default. 88 | - Expanded documentation. 89 | - v1.1.08 90 | - Completely disabled publishing so re-enabled it. 91 | - v1.1.09 92 | - Implement `Excerpt' property 93 | - v1.1.10 94 | - Restore narrowing functionality when posting buffer entries. 95 | - Corrected title creation bug exposed by restoring narrowing. 96 | - v1.1.11 97 | - Raw HTML support with ~wp~ snippets and blocks for more straightforward custom HTML. 98 | - Narrowing approach to store multiple posts in a single file makes exporting to other formats easier. 99 | - Improved Contribution Expectations for Documentation and Coding style makes contributing easier. 100 | - Added Issue template, Bug report template, and Pull request template for easier creation and resolution. 101 | - Unfilled documentation making grammar enabling the use of checking tools for more straightforward grammar checking. 102 | - Structure templates for inserting RAW HTML using snippets or blocks. 103 | - Minor refactorings to ease maintenance. 104 | - Added testimonials for the fun of it. 105 | - After this release, only bug fixes: new development in v1.2.0 branch starting with migration to the latest Emacs and Org mode. 106 | - v1.1.12 107 | - Correctly use and document autoloads 108 | - Don't populate kill ring with version message 109 | - Documentation cleanup 110 | 111 | ** v1.1.13 112 | 113 | - Updates WordPress 5.x 🠆 6.x 114 | - Updates Emacs v27.1 🠆 v28.1 115 | - Updates Org v9.1.9 🠆 9.5.2 116 | - Updates HTMLize v1.54 🠆 v1.56 117 | - Updates XML-RPC v1.6.12 🠆 1.6.15 118 | - Converts system definition from hashtables to structs 119 | - Loads categories, tags, and pages without failing on error 120 | - Adds tag checkout to org2blog-def-checkout-statement 121 | - Documents WordPress version 122 | - Further document Source Entries to Destinations in WordPress 123 | - Move to new org-make-toc format 124 | - Refactor to support different Post and Page view format w/Docs 125 | Consequently ~org2blog-buffer-post-or-page-view~ and 126 | ~org2blog-subtree-post-or-page-view~ are unusable. 127 | - During byte compilation do not warn that docstrings that are too wide. 128 | Hydra creates an exceeding number of non-human viewed docstrings 129 | so no point warning. 130 | - Document Parent Page support 131 | 132 | ** v1.1.14 133 | 134 | - Recognizes Org2Blog as an application 135 | - Adds Writer Tools menu and features: writegood, spellcheck, and 136 | word count 137 | - Adds Value for project itself 138 | - Adds more documentation and images on application design 139 | - Explains =amsmath= status 140 | 141 | ** v1.1.15 142 | 143 | - When you add ~(emacs "XX.YY")~ to the Package-Requires header line it must 144 | be at least one major version /less/ than the current version 145 | - This release updates the dependency to 27.1 146 | 147 | ** v1.1.16 148 | 149 | - Override Org-generated CSS Underline with plain HTML underline 150 | 151 | * v1.0 152 | ** v1.0.00 153 | 154 | Communicate completeness of the library with a first major release. 155 | 156 | ** v1.0.01 157 | 158 | Use latest metaweblog 159 | 160 | ** v1.0.02 161 | 162 | Increment for new metaweblog version. 163 | 164 | ** v1.0.03 165 | 166 | Adds Hydra support for user-interface. 167 | 168 | * v0.9 169 | ** v0.9.01 170 | 171 | Bump up version to 0.9.1. 172 | 173 | ** v0.9.02 174 | 175 | Bump up version. 176 | 177 | ** v0.9.03 178 | 179 | - v0.9.2 ad389ae was released on 14-12-14 180 | - Development continued until 16-05-02 fc7b2d9 181 | - Today is 17-05-19 182 | - It has been in use for one year and seventeen days 183 | - And today 184 | - Merged post subtree and publish and it's fine 185 | - Added dependency on Org-Mode 8.3 186 | - So therefore a new release 187 | - v0.9.3 188 | 189 | -------------------------------------------------------------------------------- /org2blog-test-system.el: -------------------------------------------------------------------------------- 1 | ;;; org2blog-test-system.el --- Org2Blog WordPress System Testing -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2019-2022 Grant Rettke 4 | 5 | ;; Author: Grant Rettke 6 | 7 | ;; This program is free software; you can redistribute it and/or modify 8 | ;; it under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation, either version 3 of the License, or 10 | ;; (at your option) any later version. 11 | 12 | ;; This program is distributed in the hope that it will be useful, 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ;; GNU General Public License for more details. 16 | 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with this program. If not, see . 19 | 20 | ;;; Commentary: 21 | 22 | ;; Provides interactive system integration testing. Get your blog ready for 23 | ;; use and choose the test you want to run. At each step of the test you are 24 | ;; prompted whether to continue or not. Visually very the results of each step 25 | ;; in Messages and on your blog. 26 | 27 | ;;; Code: 28 | 29 | ;;;; 30 | ;;;; Setup 31 | ;;;; 32 | 33 | (when nil ;; Default to running using package instead of source 34 | (add-to-list 'load-path "~/src/htmlize") 35 | (require 'htmlize) 36 | (add-to-list 'load-path "~/src/hydra") 37 | (require 'hydra) 38 | (add-to-list 'load-path "~/src/xml-rpc") 39 | (require 'xml-rpc) 40 | (add-to-list 'load-path "~/src/org2blog") 41 | (require 'org2blog)) 42 | 43 | (setq org2blog/wp-blog-alist 44 | `(("test" 45 | :url ,(getenv "O2BXMLRPC") 46 | :username ,(getenv "O2BUSER") 47 | :password ,(getenv "O2BPASSWORD") 48 | :default-title "Hello World" 49 | :default-categories ("org2blog")) 50 | )) 51 | 52 | ;;;; 53 | ;;;; Utility 54 | ;;;; 55 | 56 | (defvar org2blog--buffer-content nil 57 | "Stores test buffer contents as a string. 58 | 59 | Every test runs within the context of a buffer. There are two 60 | scenarios. The first is creating a new buffer and populating it 61 | with an entry. The second is performing server operations on an 62 | existing entry already in a buffer possibly resulting in changes 63 | to the buffer. This variable stores that content both before and 64 | after the test.") 65 | 66 | (defun org2blog--test-confirm-step (&optional msg) 67 | "Confirm progression of the test. Prompt with MSG if non-nil." 68 | (setq msg (or msg "Continue?")) 69 | (message "%s" msg) 70 | (unless (y-or-n-p msg) 71 | (throw 'return nil))) 72 | 73 | ;;;; 74 | ;;;; Create -> View -> Modify -> View -> Publish -> View -> Trash -> View 75 | ;;;; 76 | ;;;; Keep this one simple don't need macros here. 77 | ;;;; 78 | 79 | ;;; Buffer Post 80 | 81 | (defun org2blog--test-buffer-post () 82 | (interactive) 83 | (catch 'return 84 | (setq org2blog--buffer-content 85 | " 86 | #+ORG2BLOG: 87 | #+BLOG: test 88 | #+DATE: [2019-10-09 Wed 19:12] 89 | #+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 90 | #+CATEGORY: Test 91 | #+TAGS: Test 92 | #+TITLE: TEST: Buffer Post 93 | 94 | TEST: Buffer Post 95 | ") 96 | ;; Log In 97 | (org2blog--test-confirm-step "Log in?") 98 | (org2blog-user-login "test") 99 | ;; Create 100 | (org2blog--test-confirm-step "Create buffer post?") 101 | (let* ((body 102 | (with-temp-buffer 103 | (org-mode) 104 | (insert org2blog--buffer-content) 105 | (org2blog-buffer-post-save) 106 | (buffer-string)))) 107 | (setq org2blog--buffer-content body)) 108 | ;; View 109 | (org2blog--test-confirm-step "View it?") 110 | (with-temp-buffer 111 | (org-mode) 112 | (insert org2blog--buffer-content) 113 | (org2blog-buffer-post-view)) 114 | ;; Modify 115 | (setq org2blog--buffer-content 116 | (concat org2blog--buffer-content 117 | "\nModified here.")) 118 | (org2blog--test-confirm-step "Update it?") 119 | (with-temp-buffer 120 | (org-mode) 121 | (insert org2blog--buffer-content) 122 | (org2blog-buffer-post-save)) 123 | ;; View 124 | (org2blog--test-confirm-step "View it?") 125 | (with-temp-buffer 126 | (org-mode) 127 | (insert org2blog--buffer-content) 128 | (org2blog-buffer-post-view)) 129 | ;; Publish 130 | (org2blog--test-confirm-step "Publish it?") 131 | (with-temp-buffer 132 | (org-mode) 133 | (insert org2blog--buffer-content) 134 | (org2blog-buffer-post-publish)) 135 | ;; View 136 | (org2blog--test-confirm-step "View it?") 137 | (with-temp-buffer 138 | (org-mode) 139 | (insert org2blog--buffer-content) 140 | (org2blog-buffer-post-view)) 141 | ;; Trash 142 | (org2blog--test-confirm-step "Trash it?") 143 | (with-temp-buffer 144 | (org-mode) 145 | (insert org2blog--buffer-content) 146 | (org2blog-buffer-post-trash)) 147 | ;; View 148 | (org2blog--test-confirm-step "View it?") 149 | (with-temp-buffer 150 | (org-mode) 151 | (insert org2blog--buffer-content) 152 | (org2blog-buffer-post-view)))) 153 | 154 | ;;; Buffer Page 155 | 156 | (defun org2blog--test-buffer-page () 157 | (interactive) 158 | (catch 'return 159 | (setq org2blog--buffer-content 160 | " 161 | #+ORG2BLOG: 162 | #+BLOG: test 163 | #+DATE: [2019-10-09 Wed 19:12] 164 | #+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 165 | #+CATEGORY: Test 166 | #+TAGS: Test 167 | #+TITLE: TEST: Buffer Page 168 | 169 | TEST: Buffer Page 170 | ") 171 | ;; Log In 172 | (org2blog--test-confirm-step "Log in?") 173 | (org2blog-user-login "test") 174 | ;; Create 175 | (org2blog--test-confirm-step "Create buffer page?") 176 | (let* ((body 177 | (with-temp-buffer 178 | (org-mode) 179 | (insert org2blog--buffer-content) 180 | (org2blog-buffer-page-save) 181 | (buffer-string)))) 182 | (setq org2blog--buffer-content body)) 183 | ;; View 184 | (org2blog--test-confirm-step "View it?") 185 | (with-temp-buffer 186 | (org-mode) 187 | (insert org2blog--buffer-content) 188 | (org2blog-buffer-page-view)) 189 | ;; Modify 190 | (setq org2blog--buffer-content 191 | (concat org2blog--buffer-content 192 | "\nModified here.")) 193 | (org2blog--test-confirm-step "Update it?") 194 | (with-temp-buffer 195 | (org-mode) 196 | (insert org2blog--buffer-content) 197 | (org2blog-buffer-page-save)) 198 | ;; View 199 | (org2blog--test-confirm-step "View it?") 200 | (with-temp-buffer 201 | (org-mode) 202 | (insert org2blog--buffer-content) 203 | (org2blog-buffer-page-view)) 204 | ;; Publish 205 | (org2blog--test-confirm-step "Publish it?") 206 | (with-temp-buffer 207 | (org-mode) 208 | (insert org2blog--buffer-content) 209 | (org2blog-buffer-page-publish)) 210 | ;; View 211 | (org2blog--test-confirm-step "View it?") 212 | (with-temp-buffer 213 | (org-mode) 214 | (insert org2blog--buffer-content) 215 | (org2blog-buffer-page-view)) 216 | ;; Trash 217 | (org2blog--test-confirm-step "Trash it?") 218 | (with-temp-buffer 219 | (org-mode) 220 | (insert org2blog--buffer-content) 221 | (org2blog-buffer-page-trash)) 222 | ;; View 223 | (org2blog--test-confirm-step "View it?") 224 | (with-temp-buffer 225 | (org-mode) 226 | (insert org2blog--buffer-content) 227 | (org2blog-buffer-page-view)))) 228 | 229 | ;;; Subtree Post 230 | 231 | (defun org2blog--test-subtree-post () 232 | (interactive) 233 | (catch 'return 234 | (setq org2blog--buffer-content 235 | " 236 | #+ORG2BLOG 237 | 238 | * Subtree Post Test 239 | :PROPERTIES: 240 | :BLOG: test 241 | :DATE: [2019-10-09 Wed 19:27] 242 | :OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 243 | :CATEGORY: Test 244 | :POST_TAGS: Test 245 | :END: 246 | 247 | TEST: Subtree Post 248 | ") 249 | ;; Log In 250 | (org2blog--test-confirm-step "Log in?") 251 | (org2blog-user-login "test") 252 | ;; Create 253 | (org2blog--test-confirm-step "Create subtree post?") 254 | (let* ((body 255 | (with-temp-buffer 256 | (org-mode) 257 | (insert org2blog--buffer-content) 258 | (org2blog-subtree-post-save) 259 | (buffer-string)))) 260 | (setq org2blog--buffer-content body)) 261 | ;; View 262 | (org2blog--test-confirm-step "View it?") 263 | (with-temp-buffer 264 | (org-mode) 265 | (insert org2blog--buffer-content) 266 | (org2blog-subtree-post-view)) 267 | ;; Modify 268 | (setq org2blog--buffer-content 269 | (concat org2blog--buffer-content 270 | "\nModified here.")) 271 | (org2blog--test-confirm-step "Update it?") 272 | (with-temp-buffer 273 | (org-mode) 274 | (insert org2blog--buffer-content) 275 | (org2blog-subtree-post-save)) 276 | ;; View 277 | (org2blog--test-confirm-step "View it?") 278 | (with-temp-buffer 279 | (org-mode) 280 | (insert org2blog--buffer-content) 281 | (org2blog-subtree-post-view)) 282 | ;; Publish 283 | (org2blog--test-confirm-step "Publish it?") 284 | (with-temp-buffer 285 | (org-mode) 286 | (insert org2blog--buffer-content) 287 | (org2blog-subtree-post-publish)) 288 | ;; View 289 | (org2blog--test-confirm-step "View it?") 290 | (with-temp-buffer 291 | (org-mode) 292 | (insert org2blog--buffer-content) 293 | (org2blog-subtree-post-view)) 294 | ;; Trash 295 | (org2blog--test-confirm-step "Trash it?") 296 | (with-temp-buffer 297 | (org-mode) 298 | (insert org2blog--buffer-content) 299 | (org2blog-subtree-post-trash)) 300 | ;; View 301 | (org2blog--test-confirm-step "View it?") 302 | (with-temp-buffer 303 | (org-mode) 304 | (insert org2blog--buffer-content) 305 | (org2blog-subtree-post-view)))) 306 | 307 | ;;; Subtree Page 308 | 309 | (defun org2blog--test-subtree-page () 310 | (interactive) 311 | (catch 'return 312 | (setq org2blog--buffer-content 313 | " 314 | #+ORG2BLOG 315 | 316 | * Subtree Page Test 317 | :PROPERTIES: 318 | :BLOG: test 319 | :DATE: [2019-10-09 Wed 19:27] 320 | :OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 321 | :CATEGORY: Test 322 | :PAGE_TAGS: Test 323 | :END: 324 | 325 | TEST: Subtree Page 326 | ") 327 | ;; Log In 328 | (org2blog--test-confirm-step "Log in?") 329 | (org2blog-user-login "test") 330 | ;; Create 331 | (org2blog--test-confirm-step "Create subtree page?") 332 | (let* ((body 333 | (with-temp-buffer 334 | (org-mode) 335 | (insert org2blog--buffer-content) 336 | (org2blog-subtree-page-save) 337 | (buffer-string)))) 338 | (setq org2blog--buffer-content body)) 339 | ;; View 340 | (org2blog--test-confirm-step "View it?") 341 | (with-temp-buffer 342 | (org-mode) 343 | (insert org2blog--buffer-content) 344 | (org2blog-subtree-page-view)) 345 | ;; Modify 346 | (setq org2blog--buffer-content 347 | (concat org2blog--buffer-content 348 | "\nModified here.")) 349 | (org2blog--test-confirm-step "Update it?") 350 | (with-temp-buffer 351 | (org-mode) 352 | (insert org2blog--buffer-content) 353 | (org2blog-subtree-page-save)) 354 | ;; View 355 | (org2blog--test-confirm-step "View it?") 356 | (with-temp-buffer 357 | (org-mode) 358 | (insert org2blog--buffer-content) 359 | (org2blog-subtree-page-view)) 360 | ;; Publish 361 | (org2blog--test-confirm-step "Publish it?") 362 | (with-temp-buffer 363 | (org-mode) 364 | (insert org2blog--buffer-content) 365 | (org2blog-subtree-page-publish)) 366 | ;; View 367 | (org2blog--test-confirm-step "View it?") 368 | (with-temp-buffer 369 | (org-mode) 370 | (insert org2blog--buffer-content) 371 | (org2blog-subtree-page-view)) 372 | ;; Trash 373 | (org2blog--test-confirm-step "Trash it?") 374 | (with-temp-buffer 375 | (org-mode) 376 | (insert org2blog--buffer-content) 377 | (org2blog-subtree-page-trash)) 378 | ;; View 379 | (org2blog--test-confirm-step "View it?") 380 | (with-temp-buffer 381 | (org-mode) 382 | (insert org2blog--buffer-content) 383 | (org2blog-subtree-page-view)))) 384 | -------------------------------------------------------------------------------- /ox-wp.el: -------------------------------------------------------------------------------- 1 | ;;; ox-wp.el --- Org mode exporter for WordPress -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2014 Puneeth Chaganti 4 | ;; Copyright (C) 2019-2022 Grant Rettke 5 | 6 | ;; Author: Puneeth Chaganti 7 | ;; Maintainer: Grant Rettke 8 | ;; Version: 1.1.16 9 | ;; Package-Requires: ((emacs "27.1")) 10 | ;; Keywords: comm, convenience, outlines, wp 11 | ;; Homepage: https://github.com/org2blog/org2blog 12 | 13 | ;; This program is free software; you can redistribute it and/or modify 14 | ;; it under the terms of the GNU General Public License as published by 15 | ;; the Free Software Foundation, either version 3 of the License, or 16 | ;; (at your option) any later version. 17 | 18 | ;; This program is distributed in the hope that it will be useful, 19 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | ;; GNU General Public License for more details. 22 | 23 | ;; You should have received a copy of the GNU General Public License 24 | ;; along with this program. If not, see . 25 | 26 | ;;; Commentary: 27 | 28 | ;; Read about how this exporter works here URL ‘https://orgmode.org/manual/Adding-export-back_002dends.html/’ 29 | 30 | ;;;; Code: 31 | 32 | ;;; Require 33 | 34 | (require 'ox-html) 35 | 36 | ;;; Constants 37 | 38 | (defconst ox-wp-version "1.1.16" 39 | "Current version of ox-wp.el.") 40 | 41 | ;;; Functions 42 | 43 | ;;;###autoload 44 | (defun ox-wp-export-as-wordpress (&optional async subtreep ext-plist) 45 | "Export current buffer to a text buffer by delegation. 46 | 47 | Delegating: ASYNC, SUTREEP, and EXT-PLIST. 48 | 49 | If narrowing is active in the current buffer, only export its 50 | narrowed part. 51 | 52 | If a region is active, export that region. 53 | 54 | A non-nil optional argument ASYNC means the process should happen 55 | asynchronously. The resulting buffer should be accessible 56 | through the `org-export-stack' interface. 57 | 58 | When optional argument SUBTREEP is non-nil, export the sub-tree 59 | at point, extracting information from the headline properties 60 | first. 61 | 62 | When `org-export-show-temporary-export-buffer' is non-nil 63 | display a buffer with the export value." 64 | (interactive) 65 | (org-export-to-buffer 'wp "*Org WordPress Export*" 66 | async subtreep nil t ext-plist (lambda () (html-mode)))) 67 | 68 | (defun ox-wp-export-as-string (&optional async subtreep ext-plist) 69 | "Get exported buffer text as a string by delegation. 70 | 71 | delegating: ASYNC, SUBTREEP, and EXT-PLIST. 72 | 73 | Delegates work to `ox-wp-export-as-wordpress'." 74 | (interactive) 75 | (with-current-buffer (ox-wp-export-as-wordpress async subtreep ext-plist) 76 | (let ((text (buffer-string))) 77 | (kill-buffer) 78 | text))) 79 | 80 | ;; Back-End 81 | 82 | (org-export-define-derived-backend 'wp 'html 83 | :translate-alist '(;;(src-block . ox-wp-src-block) 84 | ;;(example-block . ox-wp-src-block) 85 | (latex-environment . ox-wp-latex-environment) 86 | (latex-fragment . ox-wp-latex-fragment) 87 | (export-block . ox-wp-export-block) 88 | (export-snippet . ox-wp-export-snippet)) 89 | :filters-alist '((:filter-paragraph . ox-wp-filter-paragraph))) 90 | 91 | 92 | ;; Filters 93 | 94 | (defun ox-wp-filter-paragraph (paragraph _backend info) 95 | "When INFO, filter newlines from PARAGRAPH." 96 | (let* ((keep-new-lines (plist-get info :wp-keep-new-lines)) 97 | (result (if keep-new-lines paragraph 98 | (format "%s\n\n" 99 | (org-trim (replace-regexp-in-string "\s*\n" " " 100 | paragraph)))))) 101 | result)) 102 | 103 | (defun ox-wp-src-block (src-block contents info) 104 | "Delegate transcoding of SRC-BLOCK, CONTENTS, and INFO." 105 | (let* ((sc (plist-get info :wp-shortcode)) 106 | (result (if sc 107 | (ox-wp-src-block-shortcode src-block contents info) 108 | (ox-wp-src-block-html src-block contents info)))) 109 | result)) 110 | 111 | (defun ox-wp-src-block-shortcode (src-block _contents info) 112 | "Create the SyntaxHighlighter Evolved sourceblock with SRC-BLOCK, CONTENTS, and INFO." 113 | (let* ((langval (org-element-property :language src-block)) 114 | (langs (plist-get info :wp-shortcode-langs-map)) 115 | (lang (or (cdr (assoc langval langs)) 116 | (when langval (downcase langval)) 117 | "text")) 118 | (name (org-element-property :name src-block)) 119 | (cap (and (org-export-get-caption src-block) 120 | (org-trim (org-export-data 121 | (org-export-get-caption src-block) 122 | info)))) 123 | (title (concat (when name (format "Name: %s." name)) 124 | (when cap (format "%s." (concat (when name " ") cap))))) 125 | (syntaxhl (or (org-export-read-attribute :attr_wp src-block :syntaxhl) 126 | "")) 127 | (srccode (org-export-format-code-default src-block info)) 128 | (result 129 | (format 130 | "[sourcecode language=\"%s\" title=\"%s\" %s]\n%s[/sourcecode]" 131 | lang 132 | title 133 | syntaxhl 134 | srccode))) 135 | result)) 136 | 137 | (defun ox-wp-src-block-html (src-block _contents info) 138 | "Create the HTML sourceblock with SRC-BLOCK, CONTENTS, and INFO." 139 | (catch 'return 140 | (when (org-export-read-attribute :attr_html src-block :textarea) 141 | (let ((result (org-html--textarea-block src-block))) 142 | (throw 'return result))) 143 | (let* ((name (org-element-property :name src-block)) 144 | (caption (or (org-export-data 145 | (org-export-get-caption src-block) 146 | info))) 147 | (lang (org-element-property :language src-block)) 148 | (code (org-html-format-code src-block info)) 149 | (name-and-caption 150 | (concat (when name (format " Name: %s." name)) 151 | (unless (string-blank-p caption) (format " %s." caption))))) 152 | (unless lang 153 | (let ((result 154 | (format "%s\n
\n%s
" 155 | name-and-caption name code))) 156 | (throw 'return result))) 157 | (let* ((classlabel 158 | (format "" 159 | name-and-caption)) 160 | (body (format "
%s
" 161 | lang name code)) 162 | (div (format "
\n%s\n%s\n
" 163 | classlabel 164 | body)) 165 | (result div)) 166 | result)))) 167 | 168 | (defun ox-wp-latex-environment (latex-environment contents info) 169 | "Transcode a LATEX-ENVIRONMENT element from Org to WP HTML. 170 | 171 | CONTENTS holds the contents of the item. INFO is a plist holding 172 | contextual information." 173 | (if (not (plist-get info :wp-latex)) 174 | (org-html-latex-environment latex-environment contents info) 175 | (let ((latex-env (org-element-property :value latex-environment))) 176 | (ox-wp-latex-to-wp latex-env)))) 177 | 178 | (defun ox-wp-latex-fragment (latex-fragment contents info) 179 | "Transcode a LATEX-FRAGMENT element from Org to WP HTML. 180 | 181 | CONTENTS holds the contents of the item. INFO is a plist holding 182 | contextual information." 183 | (if (not (plist-get info :wp-latex)) 184 | (org-html-latex-fragment latex-fragment contents info) 185 | (let ((latex-frag (org-element-property :value latex-fragment))) 186 | (ox-wp-latex-to-wp latex-frag)))) 187 | 188 | (defun ox-wp-latex-to-wp (text) 189 | "Convert latex fragments or environments in TEXT to WP LaTeX blocks." 190 | (let ((matchers (plist-get org-format-latex-options :matchers)) 191 | (regular-expressions org-latex-regexps)) 192 | (with-temp-buffer 193 | (insert text) 194 | (goto-char (point-min)) 195 | (while (nth 0 regular-expressions) 196 | (let* ((regular-expression (pop regular-expressions)) 197 | (re-matcher (nth 0 regular-expression)) 198 | (re-pattern (nth 1 regular-expression))) 199 | (when (member re-matcher matchers) 200 | (save-match-data 201 | (when (re-search-forward re-pattern nil t) 202 | (cond 203 | ((equal re-matcher "$") 204 | (replace-match (concat (match-string 1) "$latex " 205 | (match-string 4) "$" 206 | (match-string 6)) 207 | nil t)) 208 | ((equal re-matcher "$1") 209 | (replace-match (concat (match-string 1) "$latex " 210 | (substring (match-string 2) 1 -1) 211 | "$" (match-string 3)) 212 | nil t)) 213 | ((equal re-matcher "\\(") 214 | (replace-match (concat "$latex " 215 | (substring (match-string 0) 2 -2) 216 | "$") nil t)) 217 | ((equal re-matcher "\\[") 218 | (replace-match (concat "

$latex " 219 | (substring (match-string 0) 2 -2) 220 | "$

") nil t)) 221 | ((equal re-matcher "$$") 222 | (replace-match (concat "

$latex " 223 | (substring (match-string 0) 2 -2) 224 | "$

") nil t)) 225 | ((equal re-matcher "begin") 226 | (cond ((equal (match-string 2) "equation") 227 | (replace-match (concat "

$latex " 228 | (substring (match-string 1) 16 -14) 229 | "$

") nil t)))))))))) 230 | (let ((result 231 | (replace-regexp-in-string "\s*\n" " " (buffer-string)))) 232 | result)))) 233 | 234 | (defun ox-wp-export-snippet (export-snippet _contents _info) 235 | "Transcode a EXPORT-SNIPPET object from Org to WordPress. 236 | CONTENTS is nil. INFO is a plist holding contextual 237 | information. 238 | 239 | `ox-wp' initially relied upon `ox-html' to satisfy this 240 | function's responsibility. Consequently, it used the 241 | `html' tag. When `ox-wp' implemented its export function, 242 | it switched over to using the `wp' tag instead. However, 243 | it needs to continue supporting both tags." 244 | (when (member (org-export-snippet-backend export-snippet) '(wp html)) 245 | (org-element-property :value export-snippet))) 246 | 247 | (defun ox-wp-export-block (export-block _contents _info) 248 | "Transcode a EXPORT-BLOCK element from Org to WordPress. 249 | CONTENTS is nil. INFO is a plist holding contextual information. 250 | 251 | `ox-wp' initially relied upon `ox-html' to satisfy this 252 | function's responsibility. Consequently, it used the 253 | `html' tag. When `ox-wp' implemented its export function, 254 | it switched over to using the `wp' tag instead. However, 255 | it needs to continue supporting both tags." 256 | (when (or (string= (org-element-property :type export-block) "WP") 257 | (string= (org-element-property :type export-block) "HTML")) 258 | (org-remove-indentation (org-element-property :value export-block)))) 259 | 260 | ;;;; Underline 261 | 262 | ;; (defun org-html-underline (_underline contents _info) 263 | ;; "Transcode UNDERLINE from Org to HTML. 264 | ;; CONTENTS is the text with underline markup. INFO is a plist 265 | ;; holding contextual information. 266 | 267 | ;; Underline implementation: 268 | 269 | ;; - WordPress friendly plain HTML 270 | ;; - W3C HTML and WHATWG HTML standard compliant HTML 271 | ;; - No CSS 272 | ;; - Zero Org configuration changes. For example ignore 273 | ;; `org-html-htmlize-output-type' and 274 | ;; `org-html-text-markup-alist'." 275 | ;; (format "%s" contents)) 276 | 277 | (provide 'ox-wp) 278 | ;;; ox-wp.el ends here 279 | 280 | -------------------------------------------------------------------------------- /docs/DEVELOPMENT.org: -------------------------------------------------------------------------------- 1 | #+title: Development 2 | 3 | * About 4 | 5 | Org2Blog Developer Documentation. 6 | 7 | * Table Of Contents 8 | :PROPERTIES: 9 | :TOC: :include all :ignore (this) 10 | :END: 11 | :CONTENTS: 12 | - [[#about][About]] 13 | - [[#loading-up-the-source-code-by-hand][Loading Up The Source Code By Hand]] 14 | - [[#software-packages-used][Software Packages Used]] 15 | - [[#getting-started-with-development][Getting Started With Development]] 16 | - [[#package-questions-and-answers][Package Questions And Answers]] 17 | - [[#why-does-org2blog-talk-about-save-view-publish-and-trash-so-much][Why Does Org2blog Talk About Save, View, Publish, And Trash So Much?]] 18 | - [[#why-does-org2blog-talk-about-buffers-subtrees-posts-and-pages-so-much][Why Does Org2blog Talk About Buffers, Subtrees, Posts, And Pages So Much?]] 19 | - [[#why-isnt-the-package-name-org2wordpress][Why Isn't The Package Name Org2wordpress?]] 20 | - [[#how-does-org2blog-manage-autoloads][How Does Org2blog Manage Autoloads?]] 21 | - [[#metaweblog][MetaWeblog]] 22 | - [[#what-is-metaweblog][What Is MetaWeblog?]] 23 | - [[#what-blogs-use-metaweblog][What Blogs Use MetaWeblog?]] 24 | - [[#what-is-the-official-metaweblog-api][What Is The Official MetaWeblog API?]] 25 | - [[#metaweblogs-api-support][MetaWeblog's API Support]] 26 | - [[#wordpresss-api-support][WordPress's API Support]] 27 | - [[#why-is-metaweblog-in-this-project][Why is MetaWeblog In This Project?]] 28 | - [[#data-model--functional-design][Data Model & Functional Design]] 29 | - [[#create][Create]] 30 | - [[#read-aka-view][Read Aka View]] 31 | - [[#update-aka-create-or-save][Update Aka Create Or Save]] 32 | - [[#delete][Delete]] 33 | :END: 34 | 35 | * Loading Up The Source Code By Hand 36 | :PROPERTIES: 37 | :ID: org_gcr_2019-03-06T17-15-24-06-00_cosmicality:3386D277-56FD-4D2F-BE0C-56553541CD25 38 | :END: 39 | 40 | Here is where to start: 41 | 42 | The constant ~org2blog-def--package~ helps manage Org2Blog's dependencies. Here are helper functions to quickly get you started: 43 | 44 | - ~org2blog-def-checkout-statement~ creates Git commands to get the code from GitHub into the directory you want it stored. Call it and input the directory name. Finally copy and paste the commands from =*Messages*= into your Terminal to run them. 45 | - ~org2blog-def-load-statement~ creates Elisp code to load the libraries. Call it and input the directory name. Copy and paste the commands from =*Messages*= into your init file. Finally run them. Now they will get loaded each time you start Emacs. 46 | 47 | For example, you should see something like this: 48 | 49 | #+begin_src shell 50 | cd ~/tmp 51 | git clone https://github.com/hniksic/emacs-htmlize.git ~/tmp/htmlize 52 | cd htmlize 53 | git checkout release/1.56 54 | cd .. 55 | #+end_src 56 | 57 | And this 58 | 59 | #+begin_src emacs-lisp 60 | (add-to-list 'load-path "/Users/gcr/mysrc/htmlize") 61 | #+end_src 62 | 63 | Note: the correct tag of the project is loaded automatically. 64 | 65 | Now you've got everything you need to run Org2Blog against its source code. 66 | 67 | With this set up you can start playing around with things and even making changes. When you scratch an itch: create your branch and submit a pull request. It's fun, easy, and makes Org2Blog better for all its users. 68 | 69 | * Software Packages Used 70 | 71 | Org2Blog uses these libraries: 72 | 73 | [[file:/docs/o2b-external-libraries.png]] 74 | 75 | (Source code for this image follows) 76 | 77 | #+begin_src plantuml :file o2b-external-libraries.png 78 | @startmindmap 79 | !theme plain 80 | caption Read Left To Right 81 | title Referenced Libraries 82 | header 83 | Org2Blog Docs 84 | endheader 85 | center footer Org2Blog DEVELOPMENT 86 | 87 | ,* org2blog 88 | left side 89 | ,** Internal 90 | ,*** org 91 | ,*** ox-wp 92 | ,*** subr-x 93 | ,** External 94 | ,*** htmlize 95 | ,*** hydra 96 | ,*** xml-rpc 97 | ,*** metaweblog 98 | @endmindmap 99 | #+end_src 100 | 101 | #+RESULTS: 102 | #+begin_RESULTS 103 | [[file:o2b-external-libraries.png]] 104 | #+end_RESULTS 105 | 106 | * Getting Started With Development 107 | 108 | - You may have already set up your codebase to /run/ Org2Blog, but if you haven't, then find out how up in the Installation section. 109 | - Readme 110 | - If you made any changes in the README then rebuild the Table of Contents just to be sure it's correct. Follow the directions [[https://github.com/alphapapa/org-make-toc][here]]. 111 | - Contributing 112 | - Read the [[./docs/CONTRIBUTING.org][contributing]] guidelines. 113 | - Before your commit make sure that ~byte-compile-file~, ~checkdoc~, and ~package-lint-current-buffer~ don't report any errors. The first two are included with Emacs. ~package-lint~ you can either install using MELPA or you can also install it by hand like you did the other packages, like this: 114 | #+begin_src sh 115 | cd ~/src 116 | git clone https://github.com/purcell/package-lint.git 117 | #+end_src 118 | Use this code to load it: 119 | #+begin_src emacs-lisp 120 | (add-to-list 'load-path "~/src/package-lint") 121 | (require 'package-lint) 122 | #+end_src 123 | - *Note*: Org2Blog uses non-standard separators in its naming. The naming will address it in a future release. 124 | #+BEGIN_SRC text 125 | error: `org2blog/wp-version' contains a non-standard separator `/', use hyphens instead (see Elisp Coding Conventions). 126 | #+END_SRC 127 | - Testing 128 | - Programmatic Interactive System Testing 129 | - Working with posts and pages is the most critical 80% of this package. This core functionality should always work well and be easy to test. And it's easy to test. It only takes 3 steps to get the system tests running. 130 | - Define three system variables for the blog you will test against like this: 131 | #+begin_src shell 132 | O2BXMLRPC="https://yourblog.com/xmlrpc.php" 133 | O2BUSER="user" 134 | O2BPASSWORD="password" 135 | #+end_src 136 | - Load and evaluate [[./org2blog-test-system.el][System Test Program]]. 137 | - Start Emacs in an empty environment before loading Org2Blog and performing the testing by starting Emacs like this: ~emacs --no-init-file~ 138 | - Load (or open and evalute it) it because it's not a package. 139 | - Now you've got everything you need to start automatically going through the entire blogging process. The test functions will log you in, create and display posts, modify them, publish them, and finally trash them. At each step, there is a pause so you can observe what is happening on the blog. Testing is a great way to see how the workflow works, too, if you've never blogged before. These four functions cover everything. 140 | - ~defun org2blog--test-buffer-post~ 141 | - ~defun org2blog--test-buffer-page~ 142 | - ~defun org2blog--test-subtree-post~ 143 | - ~defun org2blog--test-subtree-page~ 144 | - If you need a test WordPress system to use you can set up a free WordPress blog [[https://wordpress.com][here]]. 145 | - Manual System Testing 146 | - Here is a detailed [[./docs/TestPlan.org][Test Plan]] for manually testing every feature of this system. It's a great way to see everything that can be done with Org2Blog. 147 | - [[./docs/ReleaseProcess.org][Release Process]]. 148 | - Rules 149 | - [[https://alphapapa.github.io/dont-tread-on-emacs/][Don't Tread On Emacs]]. 150 | - [[./.github/CODE_OF_CONDUCT.org][Code of Conduct]]. 151 | 152 | * Package Questions And Answers 153 | :PROPERTIES: 154 | :ID: org_gcr_2019-03-06T17-15-24-06-00_cosmicality:D0ECB4B0-5922-4BE5-BCE8-904EAB930CDD 155 | :END: 156 | 157 | In some ways Org2Blog can be surprising. Since it bridges that gap between Org mode documents and WordPress blog posts sometimes there can be a little friction. That is where most of the questions come from in the form of something like "Why does Org2Blog ...fill in the blank...? Because it's really weird!". Be at ease though, this section should clear up some the weirdness ASAP. 158 | 159 | ** Why Does Org2blog Talk About Save, View, Publish, And Trash So Much? 160 | :PROPERTIES: 161 | :ID: org_gcr_2019-03-06T17-15-24-06-00_cosmicality:630E39ED-9A45-4707-9147-FB6C681D23EE 162 | :END: 163 | 164 | Most software out there has some version of [[https://en.wikipedia.org/wiki/Create,_read,_update_and_delete][Create, read, update and delete]] (CRUD). In our case it has to do with WordPress Entries and Pages. In techie language you would talk about CRUD'ing them. In WordPress language you talk about Saving, Viewing, Publishing, and Trashing. Org2Blog chose to use the WordPress language: it's less surprising and makes it easier to keep the idea that Org2Blog fits into your WordPress workflow in your mind. 165 | 166 | Take time to learn that workflow /outside/ of Org2Blog. It will save you from uncomfortable situations where your Entry enters a /weird/ state. At least it can feel weird. For example when you make changes to an Entry and save it, it will enter the Status of =Draft=. From here you only have two options to move it back to a Published state: Save the changes you made, or Save it without any changes. If you've never encountered this before it can be upsetting when the URL for your Entry always says ~preview=true~. Whenever you get into a confusing situation be sure to access your blog inside of the WordPress UI to find out more about what is happening. Usually it's something really simple. Then step back and see what Org2Blog is doing within the WordPress workflow. 167 | 168 | Those words are also used because they reflect the natural workflow of working with WordPress that looks like this: 169 | 170 | #+begin_example 171 | ⮎Save → View → Publish⮌ Trash⁉ 172 | #+end_example 173 | 174 | Blogging with WordPress is an iterative workflow, going through the cycle as many times as desired. Org2Blog supports and facilitates this workflow very well. This workflow is so important in fact that the entire right side of the main menu is dedicated to realizing it. 175 | 176 | ** Why Does Org2blog Talk About Buffers, Subtrees, Posts, And Pages So Much? 177 | :PROPERTIES: 178 | :ID: org_gcr_2019-03-06T17-15-24-06-00_cosmicality:790CCCC4-7178-43E0-889B-15AD3163D383 179 | :END: 180 | 181 | WordPress doesn't see much difference between a =Post= and a =Page=, so Org2Blog doesn't either. Here are some terms to help clarify things: 182 | 183 | - Blog is shorthand for =Web Log= 184 | - Every post you make on your blog is called an =Entry= 185 | - Org2Blog stores =Entries= in either a =Buffer= or a =Subtree= 186 | - Every =Entry= can be either a =Post= or a =Page= 187 | 188 | Here is how to visualize it remembering this is supposed to make it /easier/ to make sense of how Org2Blog works behind the scenes: 189 | 190 | [[file:/docs/o2b-entry-source-dest-flow.png]] 191 | 192 | (Source code for this image follows) 193 | 194 | #+begin_src plantuml :file o2b-entry-source-dest-flow.png 195 | @startmindmap 196 | !theme plain 197 | caption Read Left To Right 198 | title Data Flow From Org2Blog Entries To WordPress 199 | header 200 | Org2Blog Docs 201 | endheader 202 | center footer Org2Blog README 203 | 204 | ,* Org2Blog 205 | ,** 🠊 WordPress Post 206 | ,** 🠊 WordPress Page 207 | left side 208 | ,** Buffer Entry 🠊 209 | ,** Subtree Entry 🠊 210 | @endmindmap 211 | #+end_src 212 | 213 | #+RESULTS: 214 | #+begin_RESULTS 215 | [[file:o2b-entry-source-dest-flow.png]] 216 | #+end_RESULTS 217 | 218 | This simplicity can actually lead to some less comfortable situations where you accidentally publish one thing as another (it's pretty easy to fix anyway though). 219 | 220 | Although Org2Blog is implemented how WordPress works, it can surprising to see these words used. However you'll get used to it pretty quickly. 221 | 222 | ** Why Isn't The Package Name Org2wordpress? 223 | 224 | When Org2Blog was created its technical name, its /package name/, was ~org2blog~. Unbeknownst to us there was another package out there named Org2BlogAtom with the same package name! 225 | 226 | These unforeseen naming conflicts do happen more than you might thing and it had to be resolved. Since they both had the same package name they needed some way to differentiate themselves from each other and the slash/suffix approach was chosen resulting in ~org2blog/atom~ and ~org2blog/wp~. So why doesn't /this/ package say 'Org2Blog/WP' all over the place today? 227 | 228 | That is another historical accident. This package became known simply as Org2Blog without the /WP, and the name stuck. Part of the reason might be that Org2BlogAtom seems [[https://repo.or.cz/r/org2blog.git/][unavailable]] and no longer maintained. Its [[https://www.emacswiki.org/emacs/Org2BlogAtom][wiki]] page hasn't had any updates on the topic either. Having made this decision it made sense to change the artifact naming scheme to ~org2blog~ instead of ~org2blog/wp~. It's easier to understand and adheres to artifact naming best practices. Over time existing ~/wp~ names are slowly being migrated. That still doesn't answer the original question yet! 229 | 230 | Org2Blog is blogging software. You write everything in Org mode and publish it to a blog. It's pretty simple. Currently it publishes to WordPress. Could it publish to any other blog? With some work definitely. Its impossible to rule out using Org2Blog to blog to other blogs in addition to WordPress. 231 | 232 | In that historical context and considering goals today the name remains Org2Blog instead of Org2WordPress. 233 | 234 | ** How Does Org2blog Manage Autoloads? 235 | 236 | Preemptive TL;DR: It doesn't—Packages are not supposed to manage autoloads. 237 | 238 | [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Autoload.html][The autoload facility]] delays loading Elisp files until their contents are actually used improving Emacs startup times. To state it even more simply: it's how to lazy-load packages. Anytime you see code prefixed with [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Autoload.html#index-autoload-cookie][the default magic autoload comment]] ~;;;###autoload~ you can use it (for example call a function) before the its package is loaded. Org2Blog has lots of ~autoload~'ed functions. Emacs learns about them by reading the autoloads file. There are three entities that /can/ manage the autoloads file along with their decision of whether or not they will: 239 | 240 | - Org2Blog: Won't do it 241 | - You: Should not do it 242 | - A Package Manager: Will do it by design—And Easily 243 | 244 | Org2Blog does not manage an autoloads file because packages are not supposed to manage it. Usage and management of an autoloads file is a personal decision made by the user or their choice package manager. By design packages *never* assume the responsibility. For reference at the moment there are 5,258 packages in MELPA and only one of them includes an autoloads file. Like anything there are exceptions to the rule but Org2Blog isn't one of them. Another entity who can manage the autoloads file is you. 245 | 246 | With an inordinate amount of effort you can create the autoloads file and load it yourself. However it's likely not worth the effort. Disk drives today are fast. Disk drives of 20 years ago are almost as fast (this applies to whatever the current year is). Drive speed improvements take care of the load time issue. That leaves the time required to manage the autoloads file. If you want to manage the autoloads file yourself you need to create, load it, and update it whenever autoloaded values are changed. It's even more work better left to a program. If you insist then have at it. Otherwise make your life easy and let the package manager do it for you. 247 | 248 | Package Managers by design are responsible for creating the autoloads file for you. It requires no effort and likely zero customization on your part. It's that simpler. Even better though would be something simpler. 249 | 250 | The simplest way to handle autoloads is simply never to use them at all. There is essentially [[https://www.gnu.org/software/emacs/manual/html_node/elisp/When-to-Autoload.html][never a good justification]] for using autoloads. There is almost always another way to achieve your goal. The worst part is that once people start relying on that features autoload behavior you can never remove it later on without creating pain for the user. 251 | 252 | The best code is the code that doesn't exist: that includes autoloads. Bit by bit Org2Blog will keep moving towards a future without them. 253 | 254 | * MetaWeblog 255 | ** What Is MetaWeblog? 256 | 257 | Via [[https://en.wikipedia.org/wiki/MetaWeblog][Wikipedia]]: 258 | 259 | #+begin_quote 260 | The =MetaWeblog= =API= is an application programming interface created by 261 | software developer Dave Winer^{in 2002} that enables weblog entries to be written, 262 | edited, and deleted using web services. 263 | 264 | The =API= is implemented as an [[https://en.wikipedia.org/wiki/XML-RPC][XML-RPC]] [[https://en.wikipedia.org/wiki/Web_service][web service]] with three methods 265 | whose names describe their function: ~metaweblog.newPost()~, 266 | ~metaweblog.getPost()~ and ~metaweblog.editPost()~. These methods take 267 | arguments that specify the blog author's username and password along with 268 | information related to an individual weblog entry. 269 | #+end_quote 270 | 271 | ** What Blogs Use MetaWeblog? 272 | 273 | - [[https://blogengine.io/news/blogengine-1.5-released/][BlogEngine]] 274 | - [[https://www.cloudscribe.com/][cloudscribe.SimpleContent]] 275 | - [[https://docs.expressionengine.com/latest/add-ons/metaweblog-api.html][ExpressionEngine]] 276 | - [[https://github.com/juforg/hexo-deployer-metaweblog][Hexo]] 277 | - To provide context for number of users it serves *many* Chinese COM sites (via 278 | [[https://github.com/apanly/metaweblog][apanly]]: 163, 51cto, chinaunix, cnblogs, csdn, oschina, sina) 279 | - [[https://github.com/elliotekj/orbit][Hugo]] 280 | - [[https://github.com/tominsam/jekyll-metaweblog][Jekyll]] 281 | - [[https://code.google.com/archive/p/google-highly-open-participation-joomla/issues/170][Joomla]] 282 | - [[https://devnet.kentico.com/docs/7_0/devguide/index.html?metaweblog_api_overview.htm][Kentico CMS]] 283 | - [[https://github.com/kastner/sin][Sinatra]] 284 | - [[https://codex.wordpress.org/XML-RPC_MetaWeblog_API][WordPress]] 285 | 286 | ** What Is The Official MetaWeblog API? 287 | 288 | The official definition only contains three methods: 289 | 290 | - ~metaweblog.editPost()~ 291 | - ~metaweblog.getPost()~ 292 | - ~metaweblog.newPost()~ 293 | 294 | That doesn't seem like enough. A cursory glance at various [[https://github.com/search?q=metaweblog][implementations]] 295 | reveals there are likely more. The problem is that neither the specification 296 | [[http://xmlrpc.com/metaWeblogApi.html][homepage]]―nor [[https://web.archive.org/web/20200523134114/http://xmlrpc.com/metaWeblogApi.html][Web.Archive.Org]]'s snapshot of it―is available to confirm that. 297 | This leaves us in the situation of having to deduce the /current/ =MetaWeblog= 298 | =API= specification by studying what is implemented by the servers and the 299 | client software. Since WordPress definitely supports =MetaWeblog=, Org2Blog 300 | starts here. 301 | 302 | ** MetaWeblog's API Support 303 | 304 | This library provides the following for what is believed to be the current 305 | MetaWeblog API standard: 306 | 307 | | Method URL | Supported | 308 | |---------------------------+-----------| 309 | | [[https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.deletePost][metaWeblog.deletePost]] | Yes | 310 | | [[https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.editPost][metaWeblog.editPost]] | Yes | 311 | | [[https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getCategories][metaWeblog.getCategories]] | Yes | 312 | | [[https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getPost][metaWeblog.getPost]] | Yes | 313 | | [[https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getRecentPosts][metaWeblog.getRecentPosts]] | Yes | 314 | | [[https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getTemplate][metaWeblog.getTemplate]] | No | 315 | | [[https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getUsersBlogs][metaWeblog.getUsersBlogs]] | Yes | 316 | | [[https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.newMediaObject][metaWeblog.newMediaObject]] | Yes | 317 | | [[https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.newPost][metaWeblog.newPost]] | Yes | 318 | | [[https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.setTemplate][metaWeblog.setTemplate]] | No | 319 | 320 | - Note 321 | - This reflects the subset supported by WordPress. 322 | - This definition reflects what other implementations support. 323 | - Looking at other implementations the support for ~getTemplate~ and 324 | ~setTemplate~ is about fifty-percent. The reason why is unknown. It will 325 | be helpful to understand why. 326 | 327 | ** WordPress's API Support 328 | 329 | In addition to MetaWeblog this library provides the following [[https://codex.wordpress.org/XML-RPC_WordPress_API][XML-RPC 330 | WordPress API]] methods: 331 | 332 | - ~wp.deletePage~ 333 | - ~wp.editPage~ 334 | - ~wp.getPageList~ 335 | - ~wp.getPages~ 336 | - ~wp.getTags~ 337 | - ~wp.newCategory~ 338 | - ~wp.newPage~ 339 | 340 | ** Why is MetaWeblog In This Project? 341 | 342 | 1. Org2Blog maintains MetaWeblog as an independent library for common usage 343 | 2. MetaWeblog provides critical functionality for Org2Blog 344 | 345 | * Data Model & Functional Design 346 | 347 | Org2Blog's data model addresses only two ideas: 348 | 349 | - You write an ~Entry~ (=SOURCE=) that gets published to either a WordPress ~Post~ or ~Page~ (=DEST=) 350 | - An ~Entry~ is defined in either a ~Buffer~ or a ~Subtree~ 351 | 352 | All of the functions revolve around these two ideas. 353 | 354 | =Object-Orientation= is not used with either the data or implementation. With only two data types the effort isn't justified. With that in mind functions must manually manually address this implementation scenario: 355 | 356 | [[file:o2b-entry-source-dest-flow.png]] 357 | 358 | Consequently key functions all either include (or deduce) the variables: 359 | 360 | - =SOURCE= :: Either ~'buffer~ or ~'subtree~ 361 | - =DEST= :: Either ~'post~ ~'page~ 362 | 363 | From the user's perspective the source data is virtually identical: you write an ~Entry~ that gets published out to WordPress. It's really that simple. 364 | 365 | From WordPress's perspective a ~Post~ and ~Page~ are almost identical too. Therefore many of the functions can be reused with slight differences. 366 | 367 | Since WordPress follows the CRUD model Org2Blog will only need four implementations for each operation type documented here addressing =SOURCE 🠆 DEST=: 368 | 369 | - ~Buffer~ 🠆 ~Post~ 370 | - ~Buffer~ 🠆 ~Page~ 371 | - ~Subtree~ 🠆 ~Post~ 372 | - ~Subtree~ 🠆 ~Page~ 373 | 374 | Resulting in 4x4 combination. Here is how the each work. 375 | 376 | In the interest of brevity the ~org2blog-~ prefix is removed from the function names. 377 | 378 | The node document format below is: 379 | 380 | - Function name: newline 381 | - Argument names: newline 382 | - Values passed to next function in round parens: (🠆 args...) 383 | 384 | ** Create 385 | 386 | ~org2blog--new~ creates the content but doesn't publish it yet. See Save. 387 | 388 | It works like this: 389 | 390 | - Confirm the destination type is valid or error out 391 | - Maybe login 392 | - Prepare a buffer to population with ~Entry~ content 393 | - Insert ~Entry~ specific content 394 | - Maybe track it's creation 395 | 396 | [[file:/docs/o2b-entry-new-flow.png]]]] 397 | 398 | (Source code for this image follows) 399 | 400 | #+begin_src plantuml :file o2b-entry-new-flow.png 401 | @startmindmap 402 | !theme plain 403 | caption Read Left To Right 404 | title Creation Function Flow 405 | header 406 | Org2Blog Docs 407 | endheader 408 | center footer Org2Blog DEVELOPMENT 409 | 410 | ,* -new\nsource 411 | left side 412 | ,** buffer-new\n('buffer 🠆) 413 | ,** subtree-new\n('subtree 🠆) 414 | @endmindmap 415 | #+end_src 416 | 417 | #+RESULTS: 418 | #+begin_RESULTS 419 | [[file:o2b-entry-new-flow.png]] 420 | #+end_RESULTS 421 | 422 | ** Read Aka View 423 | 424 | ~org2blog-entry-view~ works like this: 425 | 426 | - ~Subtree~ processing is almost identical to a ~Buffer~. Therefore 427 | make a note right away this for a subtree 428 | - Get the =Post ID=. If there isn't one then error out. 429 | - Prepare the preview URL 430 | - Open in web browser 431 | 432 | [[file:/docs/o2b-entry-view-flow.png]]]] 433 | 434 | (Source code for this image follows) 435 | 436 | #+begin_src plantuml :file o2b-entry-view-flow.png 437 | @startmindmap 438 | !theme plain 439 | caption Read Left To Right 440 | title View Function Flow 441 | header 442 | Org2Blog Docs 443 | endheader 444 | center footer Org2Blog DEVELOPMENT 445 | 446 | ,* entry-view\nsource dest 447 | left side 448 | ,** buffer-post-view\n('buffer 'post 🠆) 449 | ,** buffer-page-view\n('buffer 'page 🠆) 450 | ,** subtree-view\ndest\n('subtree dest 🠆) 451 | ,*** subtree-post-view\n('post 🠆) 452 | ,*** subtree-page-view\n('page 🠆) 453 | @endmindmap 454 | #+end_src 455 | 456 | #+RESULTS: 457 | #+begin_RESULTS 458 | [[file:o2b-entry-view-flow.png]] 459 | #+end_RESULTS 460 | 461 | ** Update Aka Create Or Save 462 | 463 | From a WordPress perspective both Create and Save are the same thing. The only difference is whether or not they're a Draft, and private, or published and pubic. 464 | 465 | ~org2blog-entry-save~ works like this: 466 | 467 | - Maybe login 468 | - ~Subtree~ processing is almost identical to a ~Buffer~. Therefore 469 | make a note right away this for a subtree 470 | - Maybe auto-save and auto-post it 471 | - Either create or save the post 472 | - Update the ~Entry~ with the new ID 473 | 474 | [[file:/docs/o2b-entry-create-save-flow.png]]]] 475 | 476 | (Source code for this image follows) 477 | 478 | #+begin_src plantuml :file o2b-entry-create-save-flow.png 479 | @startmindmap 480 | !theme plain 481 | caption Read Left To Right 482 | title Create & Save Function Flow 483 | header 484 | Org2Blog Docs 485 | endheader 486 | center footer Org2Blog DEVELOPMENT 487 | 488 | ,* entry-save\nsource type &publish 489 | left side 490 | ,** buffer-post-save\n&publish\n('buffer 'post publish) 491 | ,*** buffer-post-publish\n(t) 492 | ,** subtree-post-save\n&publish\n('subtree 'post publish) 493 | ,*** subtree-post-publish\n(t) 494 | ,** buffer-page-save\n&publish\n('buffer 'page publish) 495 | ,*** buffer-page-publish\n(t) 496 | ,** subtree-page-save\n&publish\n('subtree 'page publish) 497 | ,*** subtree-page-publish\n(t) 498 | @endmindmap 499 | #+end_src 500 | 501 | #+RESULTS: 502 | #+begin_RESULTS 503 | [[file:o2b-entry-create-save-flow.png]] 504 | #+end_RESULTS 505 | 506 | ** Delete 507 | 508 | ~org2blog-entry-trash~ works like this: 509 | 510 | - Get the =Post ID= 511 | - Maybe confirm the trashing 512 | - Trash it 513 | 514 | [[file:/docs/o2b-entry-trash-flow.png]] 515 | 516 | #+begin_src plantuml :file o2b-entry-trash-flow.png 517 | @startmindmap 518 | !theme plain 519 | caption Read Left To Right 520 | title Delete Flow 521 | header 522 | Org2Blog Docs 523 | endheader 524 | center footer Org2Blog DEVELOPMENT 525 | 526 | ,* entry-trash\n&post-id 527 | left side 528 | ,** buffer-post-trash\n&post-id\n('post post-id) 529 | ,** subtree-post-trash\n&post-id\n('post post-id) 530 | ,** buffer-page-trash\n&page-id\n('page page-id) 531 | ,** subtree-page-trash\n&page-id\n('page post-id) 532 | @endmindmap 533 | #+end_src 534 | 535 | #+RESULTS: 536 | #+begin_RESULTS 537 | [[file:o2b-entry-trash-flow.png]] 538 | #+end_RESULTS 539 | -------------------------------------------------------------------------------- /metaweblog.el: -------------------------------------------------------------------------------- 1 | ;;; metaweblog.el --- An XML-RPC MetaWeblog and WordPress API client -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2008 Ashish Shukla 4 | ;; Copyright (C) 2010 Puneeth Chaganti 5 | ;; Copyright (C) 2019-2022 Grant Rettke 6 | 7 | ;; Author: Puneeth Chaganti 8 | ;; Maintainer: Grant Rettke 9 | ;; Version: 1.1.16 10 | ;; Package-Requires: ((emacs "27.1")) 11 | ;; Keywords: comm 12 | ;; Homepage: https://github.com/org2blog/org2blog 13 | 14 | ;; This program is free software; you can redistribute it and/or modify 15 | ;; it under the terms of the GNU General Public License as published by 16 | ;; the Free Software Foundation, either version 3 of the License, or 17 | ;; (at your option) any later version. 18 | 19 | ;; This program is distributed in the hope that it will be useful, 20 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | ;; GNU General Public License for more details. 23 | 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see . 26 | 27 | ;;; Commentary: 28 | 29 | ;; This API operates against WordPress using both the 30 | ;; XML-RPC MetaWeblog API specification 31 | ;; https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getRecentPosts 32 | ;; and the XML-RPC WordPress API 33 | ;; https://codex.wordpress.org/XML-RPC_WordPress_API 34 | 35 | ;; This API operates against a blog using its RPC endpoint URL ‘BLOG-XMLRPC', 36 | ;; a user name `USER-NAME', a password `PASSWORD', and a blog ID ‘BLOG-ID'. 37 | ;; These parameters are used for every API call. When their intention is 38 | ;; obvious and as expected they are excluded from documentation by 39 | ;; including them in line at the end of the docstring only to satisfy 40 | ;; the byte-compiler. 41 | 42 | ;; A portion of the code in this file is based on blog.el posted to 43 | ;; http://www.mail-archive.com/gnu-emacs-sources@gnu.org/msg01576.html 44 | ;; copyrighted by Ashish Shukla. 45 | 46 | ;;; Code: 47 | 48 | ;;; Require 49 | 50 | (require 'xml-rpc) 51 | 52 | ;;; Constants 53 | 54 | (defconst metaweblog-version "1.1.16" 55 | "Current version of metaweblog.el.") 56 | 57 | ;;; Deprecations 58 | 59 | (defconst metaweblog-deprecation "2.0.0" 60 | "Release in which obselete objects will be removed.") 61 | 62 | (mapc (lambda (ls) 63 | (define-obsolete-function-alias (car ls) (cadr ls) metaweblog-deprecation)) 64 | '((wp-new-category metaweblog-wp-new-category) 65 | (wp-get-tags metaweblog-wp-get-tags) 66 | (wp-get-pages metaweblog-wp-get-pages) 67 | (wp-get-pagelist metaweblog-wp-get-pagelist) 68 | (wp-new-page metaweblog-wp-new-page) 69 | (wp-edit-page metaweblog-wp-edit-page) 70 | (wp-delete-page metaweblog-wp-delete-page) 71 | (get-file-properties metaweblog-get-file-properties))) 72 | 73 | ;;; Function - Public 74 | 75 | (defun metaweblog-get-categories (blog-xmlrpc user-name password blog-id) 76 | "Retrieve list of Categories. 77 | 78 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 79 | (xml-rpc-method-call blog-xmlrpc 80 | "metaWeblog.getCategories" 81 | blog-id 82 | user-name 83 | password)) 84 | 85 | (defun metaweblog-wp-new-category (blog-xmlrpc user-name password blog-id category) 86 | "Create Category CATEGORY. 87 | 88 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 89 | (xml-rpc-method-call blog-xmlrpc 90 | "wp.newCategory" 91 | blog-id 92 | user-name 93 | password 94 | `(("name" . ,category)))) 95 | 96 | (defun metaweblog-wp-get-tags (blog-xmlrpc user-name password blog-id) 97 | "Retrieve list of Tags. 98 | 99 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 100 | (xml-rpc-method-call blog-xmlrpc 101 | "wp.getTags" 102 | blog-id 103 | user-name 104 | password)) 105 | 106 | (defun metaweblog-wp-get-pages (blog-xmlrpc user-name password blog-id) 107 | "Retrieve list of Pages with entire page content. 108 | 109 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 110 | (xml-rpc-method-call blog-xmlrpc 111 | "wp.getPages" 112 | blog-id 113 | user-name 114 | password)) 115 | 116 | (defun metaweblog-wp-get-pagelist (blog-xmlrpc user-name password blog-id) 117 | "Retrieve list of Pages with minimal page content. 118 | 119 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 120 | (xml-rpc-method-call blog-xmlrpc 121 | "wp.getPageList" 122 | blog-id 123 | user-name 124 | password)) 125 | 126 | (defun metaweblog-new-post 127 | (blog-xmlrpc user-name password blog-id content publish) 128 | "Create a new Post. 129 | 130 | If PUBLISH is non-nil, the post is published, otherwise it is 131 | saved as draft. CONTENT will be an alist title, description, 132 | categories, and date as keys (string-ified) mapped to the title 133 | of the post, post contents, list of categories, and date 134 | respectively. 135 | 136 | Since `xml-rpc-method-call' entity-fies the HTML text in the post 137 | we've to use raw. 138 | 139 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 140 | (let ((post-title (cdr (assoc "title" content))) 141 | (post-description (cdr (assoc "description" content))) 142 | (post-categories (cdr (assoc "categories" content))) 143 | (post-tags (cdr (assoc "tags" content))) 144 | (post-excerpt (cdr (assoc "excerpt" content))) 145 | (post-permalink (cdr (assoc "permalink" content))) 146 | (post-date (cdr (assoc "date" content)))) 147 | (xml-rpc-xml-to-response 148 | (xml-rpc-request 149 | blog-xmlrpc 150 | `((methodCall 151 | nil 152 | (methodName nil "metaWeblog.newPost") 153 | (params nil 154 | (param nil (value nil (string nil ,blog-id))) 155 | (param nil (value nil (string nil ,user-name))) 156 | (param nil (value nil (string nil ,password))) 157 | (param nil (value nil 158 | (struct 159 | nil 160 | (member nil 161 | (name nil "title") 162 | (value nil ,post-title)) 163 | (member nil 164 | (name nil "description") 165 | (value nil ,post-description)) 166 | (member nil 167 | (name nil "mt_excerpt") 168 | (value nil ,post-excerpt)) 169 | (member nil 170 | (name nil "wp_slug") 171 | (value nil ,post-permalink)) 172 | (member nil 173 | (name nil "dateCreated") 174 | (dateTime.iso8601 nil ,post-date)) 175 | ,(when post-tags 176 | `(member nil 177 | (name nil "mt_keywords") 178 | (value nil 179 | (array 180 | nil 181 | ,(append 182 | '(data nil) 183 | (mapcar 184 | (lambda(f) 185 | `(value nil (string nil ,f))) 186 | post-tags)))))) 187 | ,(when post-categories 188 | `(member nil 189 | (name nil "categories") 190 | (value nil 191 | (array 192 | nil 193 | ,(append 194 | '(data nil) 195 | (mapcar 196 | (lambda(f) 197 | `(value nil (string nil ,f))) 198 | post-categories))))))))) 199 | (param nil (value nil (boolean nil ,(if publish "1" "0"))))))))))) 200 | 201 | (defun metaweblog-wp-new-page 202 | (blog-xmlrpc user-name password blog-id content publish) 203 | "Sends a new page to the blog. 204 | 205 | If PUBLISH is non-nil, the post is published, otherwise it is 206 | saved as draft. CONTENT will be an alist title, description, 207 | categories, and date as keys (string-ified) mapped to the title 208 | of the post, post contents, list of categories, and date 209 | respectively. 210 | 211 | Since `xml-rpc-method-call' entity-fies the HTML text in the post 212 | we've to use raw. 213 | 214 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 215 | (let ((post-title (cdr (assoc "title" content))) 216 | (post-description (cdr (assoc "description" content))) 217 | (post-categories (cdr (assoc "categories" content))) 218 | (post-tags (cdr (assoc "tags" content))) 219 | (post-excerpt (cdr (assoc "excerpt" content))) 220 | (post-permalink (cdr (assoc "permalink" content))) 221 | (post-parent (cdr (assoc "parent" content))) 222 | (post-date (cdr (assoc "date" content)))) 223 | (xml-rpc-xml-to-response 224 | (xml-rpc-request 225 | blog-xmlrpc 226 | `((methodCall 227 | nil 228 | (methodName nil "wp.newPage") 229 | (params nil 230 | (param nil (value nil (string nil ,blog-id))) 231 | (param nil (value nil (string nil ,user-name))) 232 | (param nil (value nil (string nil ,password))) 233 | (param nil (value nil 234 | (struct 235 | nil 236 | (member nil 237 | (name nil "title") 238 | (value nil ,post-title)) 239 | (member nil 240 | (name nil "description") 241 | (value nil ,post-description)) 242 | (member nil 243 | (name nil "mt_excerpt") 244 | (value nil ,post-excerpt)) 245 | (member nil 246 | (name nil "wp_slug") 247 | (value nil ,post-permalink)) 248 | (member nil 249 | (name nil "wp_page_parent_id") 250 | (value nil ,post-parent)) 251 | (member nil 252 | (name nil "dateCreated") 253 | (dateTime.iso8601 nil ,post-date)) 254 | ,(when post-tags 255 | `(member nil 256 | (name nil "mt_keywords") 257 | (value nil 258 | (array 259 | nil 260 | ,(append 261 | '(data nil) 262 | (mapcar 263 | (lambda(f) 264 | `(value nil (string nil ,f))) 265 | post-tags)))))) 266 | ,(when post-categories 267 | `(member nil 268 | (name nil "categories") 269 | (value nil 270 | (array 271 | nil 272 | ,(append 273 | '(data nil) 274 | (mapcar 275 | (lambda(f) 276 | `(value nil (string nil ,f))) 277 | post-categories))))))))) 278 | (param nil (value nil (boolean nil ,(if publish "1" "0"))))))))))) 279 | 280 | (defun metaweblog-wp-edit-page 281 | (blog-xmlrpc user-name password blog-id page-id content publish) 282 | "Edits an existing page PAGE-ID on the blog. 283 | 284 | If PUBLISH is non-nil, the post is published, otherwise it is 285 | saved as draft. CONTENT will be an alist title, description, 286 | categories, and date as keys (string-ified) mapped to the title 287 | of the post, post contents, list of categories, and date 288 | respectively. 289 | 290 | Since `xml-rpc-method-call' entity-fies the HTML text in the post 291 | we've to use raw 292 | 293 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 294 | (let ((post-title (cdr (assoc "title" content))) 295 | (post-description (cdr (assoc "description" content))) 296 | (post-categories (cdr (assoc "categories" content))) 297 | (post-tags (cdr (assoc "tags" content))) 298 | (post-excerpt (cdr (assoc "excerpt" content))) 299 | (post-permalink (cdr (assoc "permalink" content))) 300 | (post-parent (cdr (assoc "parent" content))) 301 | (post-date (cdr (assoc "date" content)))) 302 | (message post-date) 303 | (xml-rpc-xml-to-response 304 | (xml-rpc-request 305 | blog-xmlrpc 306 | `((methodCall 307 | nil 308 | (methodName nil "wp.editPage") 309 | (params nil 310 | (param nil (value nil (string nil ,blog-id))) 311 | (param nil (value nil (string nil ,page-id))) 312 | (param nil (value nil (string nil ,user-name))) 313 | (param nil (value nil (string nil ,password))) 314 | (param nil (value nil 315 | (struct 316 | nil 317 | (member nil 318 | (name nil "title") 319 | (value nil ,post-title)) 320 | (member nil 321 | (name nil "description") 322 | (value nil ,post-description)) 323 | (member nil 324 | (name nil "mt_excerpt") 325 | (value nil ,post-excerpt)) 326 | (member nil 327 | (name nil "wp_slug") 328 | (value nil ,post-permalink)) 329 | (member nil 330 | (name nil "wp_page_parent_id") 331 | (value nil ,post-parent)) 332 | (member nil 333 | (name nil "dateCreated") 334 | (dateTime.iso8601 nil ,post-date)) 335 | ,(when post-tags 336 | `(member nil 337 | (name nil "mt_keywords") 338 | (value nil 339 | (array 340 | nil 341 | ,(append 342 | '(data nil) 343 | (mapcar 344 | (lambda(f) 345 | `(value nil (string nil ,f))) 346 | post-tags)))))) 347 | ,(when post-categories 348 | `(member nil 349 | (name nil "categories") 350 | (value nil 351 | (array 352 | nil 353 | ,(append 354 | '(data nil) 355 | (mapcar 356 | (lambda(f) 357 | `(value nil (string nil ,f))) 358 | post-categories))))))))) 359 | (param nil (value nil (boolean nil ,(if publish "1" "0"))))))))))) 360 | 361 | (defun metaweblog-edit-post 362 | (blog-xmlrpc user-name password post-id content publish) 363 | "Edit an exiting Post POST-ID. 364 | 365 | If PUBLISH is non-nil, the post is published, otherwise it is 366 | saved as draft. CONTENT will be an alist title, description, 367 | categories, and date as keys (string-ified) mapped to the title 368 | of the post, post contents, list of categories, and date 369 | respectively. 370 | 371 | Since `xml-rpc-method-call' entity-fies the HTML text in the post 372 | we've to use raw. 373 | 374 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 375 | (let ((post-title (cdr (assoc "title" content))) 376 | (post-description (cdr (assoc "description" content))) 377 | (post-categories (cdr (assoc "categories" content))) 378 | (post-tags (cdr (assoc "tags" content))) 379 | (post-excerpt (cdr (assoc "excerpt" content))) 380 | (post-permalink (cdr (assoc "permalink" content))) 381 | (post-date (cdr (assoc "date" content)))) 382 | (message post-date) 383 | (xml-rpc-xml-to-response 384 | (xml-rpc-request 385 | blog-xmlrpc 386 | `((methodCall 387 | nil 388 | (methodName nil "metaWeblog.editPost") 389 | (params nil 390 | (param nil (value nil (string nil ,post-id))) 391 | (param nil (value nil (string nil ,user-name))) 392 | (param nil (value nil (string nil ,password))) 393 | (param nil (value nil 394 | (struct 395 | nil 396 | (member nil 397 | (name nil "title") 398 | (value nil ,post-title)) 399 | (member nil 400 | (name nil "description") 401 | (value nil ,post-description)) 402 | (member nil 403 | (name nil "mt_excerpt") 404 | (value nil ,post-excerpt)) 405 | (member nil 406 | (name nil "wp_slug") 407 | (value nil ,post-permalink)) 408 | (member nil 409 | (name nil "dateCreated") 410 | (dateTime.iso8601 nil ,post-date)) 411 | ,(when post-tags 412 | `(member nil 413 | (name nil "mt_keywords") 414 | (value nil 415 | (array 416 | nil 417 | ,(append 418 | '(data nil) 419 | (mapcar 420 | (lambda(f) 421 | `(value nil (string nil ,f))) 422 | post-tags)))))) 423 | ,(when post-categories 424 | `(member nil 425 | (name nil "categories") 426 | (value nil 427 | (array 428 | nil 429 | ,(append 430 | '(data nil) 431 | (mapcar 432 | (lambda(f) 433 | `(value nil (string nil ,f))) 434 | post-categories))))))))) 435 | (param nil (value nil (boolean nil ,(if publish "1" "0"))))))))))) 436 | 437 | (defun metaweblog-get-post (blog-xmlrpc user-name password post-id) 438 | "Retrieve a post POST-ID. 439 | 440 | Also works for Pages. 441 | 442 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 443 | (xml-rpc-method-call blog-xmlrpc 444 | "metaWeblog.getPost" 445 | post-id 446 | user-name 447 | password)) 448 | 449 | (defun metaweblog-delete-post (blog-xmlrpc app-key user-name password post-id) 450 | "Delete an existing Post POST-ID. 451 | 452 | BLOG-XMLRPC APP-KEY USER-NAME PASSWORD BLOG-ID" 453 | (xml-rpc-method-call blog-xmlrpc 454 | "metaWeblog.deletePost" 455 | app-key 456 | post-id 457 | user-name 458 | password 459 | t)) 460 | 461 | (defun metaweblog-wp-delete-page (blog-xmlrpc blog-id user-name password page-id) 462 | "Delete a page PAGE-ID from the weblog system. 463 | 464 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 465 | (xml-rpc-method-call blog-xmlrpc 466 | "wp.deletePage" 467 | blog-id 468 | user-name 469 | password 470 | page-id)) 471 | 472 | (defun metaweblog-get-recent-posts(blog-xmlrpc blog-id user-name password number-of-posts) 473 | "Retrieve a list of recent Posts. 474 | 475 | NUMBER-OF-POSTS is the no. of posts that should be returned. 476 | 477 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 478 | (xml-rpc-method-call blog-xmlrpc 479 | "metaWeblog.getRecentPosts" 480 | blog-id 481 | user-name 482 | password 483 | number-of-posts)) 484 | 485 | (defun metaweblog-get-file-properties (file) 486 | "Gets the properties of a file FILE. 487 | 488 | Returns an assoc list with 489 | name - file name 490 | bits - data of the file as a base64 encoded string 491 | type - mimetype of file deduced from extension. 492 | 493 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 494 | (let* (base64-str type name file-props) 495 | (save-excursion 496 | (save-restriction 497 | (with-current-buffer (find-file-noselect file nil t) 498 | (fundamental-mode) 499 | (setq name (file-name-nondirectory file)) 500 | (setq base64-str (base64-encode-string (encode-coding-string (buffer-string) 'binary))) 501 | (setq type (mailcap-extension-to-mime (or (file-name-extension file) ""))) 502 | (kill-buffer) 503 | (setq file-props `(("name" . ,name) 504 | ("bits" . ,base64-str) 505 | ("type" . ,type)))))) 506 | file-props)) 507 | 508 | (defun metaweblog-upload-file (blog-xmlrpc user-name password blog-id file) 509 | "Upload a media file FILE. 510 | 511 | FILE will be an alist name, type, bits, as keys mapped to name of 512 | the file, mime type and the data. 513 | 514 | BLOG-XMLRPC USER-NAME PASSWORD BLOG-ID" 515 | (let ((file-name (cdr (assoc "name" file))) 516 | (file-type (cdr (assoc "type" file))) 517 | (file-bits (cdr (assoc "bits" file)))) 518 | 519 | (xml-rpc-xml-to-response 520 | (xml-rpc-request 521 | blog-xmlrpc 522 | `((methodCall 523 | nil 524 | (methodName nil "metaWeblog.newMediaObject") 525 | (params nil 526 | (param nil (value nil (string nil ,blog-id))) 527 | (param nil (value nil (string nil ,user-name))) 528 | (param nil (value nil (string nil ,password))) 529 | (param nil (value nil 530 | (struct 531 | nil 532 | (member nil 533 | (name nil "name") 534 | (value nil ,file-name)) 535 | (member nil 536 | (name nil "bits") 537 | (base64 nil ,file-bits)) 538 | (member nil 539 | (name nil "type") 540 | (value nil ,file-type)) 541 | (member nil 542 | (name nil "overwrite") 543 | (value nil "t")))))))))))) 544 | 545 | (defun metaweblog-get-users-blogs (blog-xmlrpc app-key user-name password) 546 | "Retrieve list of blogs to which USER-NAME can post. 547 | 548 | BLOG-XMLRPC APP-KEY USER-NAME PASSWORD" 549 | (xml-rpc-method-call blog-xmlrpc 550 | "metaWeblog.getUsersBlogs" 551 | app-key 552 | user-name 553 | password)) 554 | 555 | (provide 'metaweblog) 556 | 557 | ;;; metaweblog.el ends here 558 | -------------------------------------------------------------------------------- /tests/org2blog-tests.org: -------------------------------------------------------------------------------- 1 | # Tests for org2blog live here 2 | 3 | * Setup 4 | #+BEGIN_SRC emacs-lisp 5 | (require 'org2blog) 6 | 7 | ;; Global configuration for tests 8 | (setq org2blog/wp-use-sourcecode-shortcode t) 9 | 10 | (setq org2blog/wp-blog-alist 11 | `(("test" 12 | :url "https://testorg2blog.wordpress.com/xmlrpc.php" 13 | :username "org2blog" 14 | :password ,(getenv "org2blog_password") 15 | :default-title "Hello World" 16 | :default-categories ("org2blog")) 17 | )) 18 | #+END_SRC 19 | 20 | #+RESULTS: 21 | #+begin_EXAMPLE 22 | (("test" :url "https://testorg2blog.wordpress.com/xmlrpc.php" :username "org2blog" :password nil :default-title "Hello World" :default-categories ("org2blog"))) 23 | #+end_EXAMPLE 24 | 25 | * Utility code 26 | 27 | #+BEGIN_SRC emacs-lisp :var filename=(buffer-file-name) 28 | ;;; Directory containing tests 29 | (defconst o2b-test-dir 30 | (expand-file-name (file-name-directory (or load-file-name buffer-file-name)))) 31 | 32 | ;;; File with the test inputs and outputs 33 | (defconst o2b-test-case-file 34 | (expand-file-name filename o2b-test-dir)) 35 | 36 | ;;; Fetch the SRC block given the name 37 | (defun o2b-test-fetch-src-block (name) 38 | (let ((src "")) 39 | (save-excursion 40 | (save-restriction 41 | (with-temp-buffer 42 | (insert-file-contents o2b-test-case-file) 43 | (goto-char (point-min)) 44 | (unless (org-babel-goto-named-src-block name) 45 | (setq src (nth 1 (org-babel-get-src-block-info t))))))) 46 | src)) 47 | 48 | (defmacro o2b-test-buffer-with-block (src-name &rest body) 49 | "Create a temporary buffer, insert the code with the given 50 | SRC-NAME and evaluage BODY there." 51 | (declare (indent 0) (debug t)) 52 | `(let () 53 | (with-temp-buffer 54 | (org-mode) 55 | (insert (o2b-test-fetch-src-block ,src-name)) 56 | (goto-char (point-min)) 57 | (progn ,@body)))) 58 | #+END_SRC 59 | 60 | * Tests 61 | ** Sub-tree tests 62 | #+BEGIN_SRC emacs-lisp 63 | (ert-deftest should-correctly-parse-subtree () 64 | (should 65 | (string-equal 66 | (o2b-test-fetch-src-block "o2b-test-post-subtree-output") 67 | (o2b-test-buffer-with-block 68 | "o2b-test-post-subtree-input" 69 | (cdr (assoc "description" (org2blog/wp--export-as-post t))))))) 70 | #+END_SRC 71 | 72 | #+BEGIN_SRC emacs-lisp 73 | (ert-deftest should-correctly-parse-subtree-tags () 74 | (should 75 | (equal 76 | '("gratitude" "time" "awareness" "procrastination") 77 | (o2b-test-buffer-with-block 78 | "o2b-test-post-subtree-input" 79 | (cdr (assoc "tags" (org2blog/wp--export-as-post t))))))) 80 | #+END_SRC 81 | 82 | #+BEGIN_SRC emacs-lisp 83 | (ert-deftest should-not-change-output-when-subtree-demoted () 84 | (should (string-equal 85 | ;; Expected output 86 | (o2b-test-fetch-src-block "o2b-test-post-subtree-output") 87 | ;; Output from parsing entry 88 | (o2b-test-buffer-with-block 89 | "o2b-test-post-subtree-input" 90 | (org-demote-subtree) 91 | (cdr (assoc "description" (org2blog/wp--export-as-post t))))))) 92 | #+END_SRC 93 | 94 | #+BEGIN_SRC emacs-lisp 95 | (ert-deftest should-post-subtree-with-toc () 96 | (should 97 | (string-equal 98 | (o2b-test-fetch-src-block "o2b-test-post-subtree-toc") 99 | (o2b-test-buffer-with-block 100 | "o2b-test-post-subtree-input" 101 | (let ((org2blog/wp-export-options (copy-sequence org2blog/wp-export-options))) 102 | (plist-put org2blog/wp-export-options :with-toc t) 103 | (cdr (assoc "description" (org2blog/wp--export-as-post t)))))))) 104 | #+END_SRC 105 | 106 | #+BEGIN_SRC emacs-lisp 107 | (ert-deftest should-parse-subtree-parent () 108 | (let ((post (o2b-test-buffer-with-block 109 | "o2b-test-post-subtree-input" 110 | (org2blog/wp--export-as-post t)))) 111 | (should (equal (cdr (assoc "parent" post)) "20")))) 112 | #+END_SRC 113 | 114 | *** Data 115 | #+NAME: o2b-test-post-subtree-input 116 | #+BEGIN_SRC org 117 | ,* Test Post 118 | :PROPERTIES: 119 | :PARENT: 20 120 | :POST_TAGS: gratitude, time, awareness, procrastination 121 | :END: 122 | This is a subtree that we are testing 123 | ,** Sub heading 1 124 | - Foo 125 | - Bar 126 | - Baz 127 | #+END_SRC 128 | 129 | #+NAME: o2b-test-post-subtree-output 130 | #+BEGIN_SRC html 131 |

This is a subtree that we are testing

132 |
133 |

Sub heading 1

134 |
135 |
    136 |
  • Foo
  • 137 |
  • Bar
  • 138 |
  • Baz
  • 139 |
140 |
141 |
142 | 143 | #+END_SRC 144 | 145 | #+NAME: o2b-test-post-subtree-toc 146 | #+BEGIN_SRC html 147 |
148 |

Table of Contents

149 |
150 | 153 |
154 |
155 |

This is a subtree that we are testing

156 |
157 |

Sub heading 1

158 |
159 |
    160 |
  • Foo
  • 161 |
  • Bar
  • 162 |
  • Baz
  • 163 |
164 |
165 |
166 | 167 | #+END_SRC 168 | ** Buffer tests 169 | #+BEGIN_SRC emacs-lisp 170 | (ert-deftest should-post-from-non-visible-content-buffer () 171 | (should (string-equal 172 | (o2b-test-fetch-src-block "o2b-test-post-buffer-non-visible") 173 | (o2b-test-buffer-with-block 174 | "o2b-test-post-buffer-non-visible-input" 175 | (let () 176 | (org-shifttab 4) 177 | (goto-char (point-max)) 178 | (cdr (assoc "description" (org2blog/wp--export-as-post nil)))))))) 179 | #+END_SRC 180 | 181 | #+BEGIN_SRC emacs-lisp 182 | (ert-deftest should-not-hang-with-specific-input () 183 | (should (string-equal 184 | (o2b-test-fetch-src-block "o2b-test-post-buffer-hangs") 185 | (o2b-test-buffer-with-block 186 | "o2b-test-post-buffer-hangs-input" 187 | (let () 188 | (cdr (assoc "description" (org2blog/wp--export-as-post nil)))))))) 189 | #+END_SRC 190 | 191 | #+BEGIN_SRC emacs-lisp 192 | (ert-deftest should-use-tags-as-categories () 193 | (let ((post (o2b-test-buffer-with-block 194 | "o2b-test-tags-as-categories" 195 | (let ((org2blog/wp-use-tags-as-categories t)) 196 | (org2blog/wp--export-as-post nil))))) 197 | 198 | (should (equal (cdr (assoc "categories" post)) (list "tags" "sacha"))) 199 | (should (equal (cdr (assoc "tags" post)) nil)))) 200 | #+END_SRC 201 | 202 | #+BEGIN_SRC emacs-lisp 203 | (ert-deftest should-not-use-tags-as-categories () 204 | (let ((post (o2b-test-buffer-with-block 205 | "o2b-test-tags-as-categories" 206 | (org2blog/wp--export-as-post nil)))) 207 | 208 | (should (equal (cdr (assoc "categories" post)) nil)) 209 | (should (equal (cdr (assoc "tags" post)) (list "tags" "sacha"))))) 210 | #+END_SRC 211 | 212 | #+BEGIN_SRC emacs-lisp 213 | (ert-deftest should-parse-parent () 214 | (let ((post (o2b-test-buffer-with-block 215 | "o2b-test-tags-as-categories" 216 | (org2blog/wp--export-as-post nil)))) 217 | (should (equal (cdr (assoc "parent" post)) "20")))) 218 | #+END_SRC 219 | 220 | #+BEGIN_SRC emacs-lisp 221 | (ert-deftest should-get-parent-id () 222 | (let ((post (o2b-test-buffer-with-block 223 | "o2b-test-get-parent-id" 224 | (org2blog/wp--export-as-post nil)))) 225 | (should (equal (cdr (assoc "parent" post)) "1")))) 226 | #+END_SRC 227 | 228 | *** Data 229 | 230 | #+NAME: o2b-test-tags-as-categories 231 | #+BEGIN_SRC org 232 | ,#+BLOG: test 233 | ,#+POSTID: 121 234 | ,#+DATE: [2013-09-14 Sat 18:29] 235 | ,#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 236 | ,#+TAGS: tags, sacha 237 | ,#+DESCRIPTION: 238 | ,#+PARENT: 20 239 | ,#+TITLE: Hello World 240 | ,* Heading 1 241 | Text 242 | 243 | ,** Heading 2 244 | More text 245 | 246 | #+END_SRC 247 | 248 | #+NAME: o2b-test-post-buffer-non-visible-input 249 | #+BEGIN_SRC org 250 | ,#+BLOG: test 251 | ,#+POSTID: 121 252 | ,#+DATE: [2013-09-14 Sat 18:29] 253 | ,#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 254 | ,#+CATEGORY: org2blog, emacs 255 | ,#+TAGS: 256 | ,#+DESCRIPTION: 257 | ,#+TITLE: Hello World 258 | ,* Heading 1 259 | Text 260 | 261 | ,** Heading 2 262 | More text 263 | 264 | #+END_SRC 265 | 266 | #+NAME: o2b-test-post-buffer-non-visible 267 | #+BEGIN_SRC html 268 |
269 |

Heading 1

270 |
271 |

Text

272 |
273 | 274 |
275 |

Heading 2

276 |
277 |

More text

278 |
279 |
280 |
281 | 282 | #+END_SRC 283 | 284 | #+NAME: o2b-test-post-buffer-hangs-input 285 | #+BEGIN_SRC org 286 | ,#+BLOG: test 287 | ,#+POSTID: 127 288 | ,#+DATE: [2013-09-14 Sat 20:14] 289 | ,#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 290 | ,#+CATEGORY: org2blog, emacs 291 | ,#+TAGS: 292 | ,#+DESCRIPTION: 293 | ,#+TITLE: Test Hangs 294 | ,* Heading 295 | 296 | ,** Preparing patches 297 | 298 | The Org-mode mailing list has a [[http://patchwork.newartisans.com/project/org-mode/][Patchwork server]] that looks for 299 | patches in messages that contain the string =[PATCH]= in the subject. 300 | Make sure both the =master= and =jasond= branches are up-to-date and 301 | then type the following to get a diff that can be inserted into the 302 | =[PATCH]= email: 303 | 304 | #+END_SRC 305 | 306 | #+NAME: o2b-test-post-buffer-hangs 307 | #+BEGIN_SRC html 308 |
309 |

Heading

310 |
311 |
312 |

Preparing patches

313 |
314 |

The Org-mode mailing list has a Patchwork server that looks for patches in messages that contain the string [PATCH] in the subject. Make sure both the master and jasond branches are up-to-date and then type the following to get a diff that can be inserted into the [PATCH] email:

315 |
316 |
317 |
318 | 319 | #+END_SRC 320 | 321 | #+NAME: o2b-test-get-parent-id 322 | #+BEGIN_SRC org 323 | ,#+BLOG: org2blog 324 | ,#+DATE: [2013-09-14 Sat 18:29] 325 | ,#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 326 | ,#+TAGS: tags, sacha 327 | ,#+DESCRIPTION: 328 | ,#+PARENT: About 329 | ,#+TITLE: Hello World 330 | ,* Heading 1 331 | Text 332 | 333 | ,** Heading 2 334 | More text 335 | 336 | #+END_SRC 337 | ** LaTeX tests 338 | #+BEGIN_SRC emacs-lisp 339 | (ert-deftest should-render-latex-without-wp-plugin () 340 | (should (string-equal 341 | (o2b-test-fetch-src-block "o2b-test-parse-latex-output-plain") 342 | (o2b-test-buffer-with-block 343 | "o2b-test-parse-latex-input" 344 | (let ((org2blog/wp-use-wp-latex nil)) 345 | (cdr (assoc "description" (org2blog/wp--export-as-post t)))))))) 346 | #+END_SRC 347 | 348 | #+BEGIN_SRC emacs-lisp 349 | (ert-deftest should-render-latex-with-wp-plugin () 350 | 351 | (should (string-equal 352 | (o2b-test-fetch-src-block "o2b-test-parse-latex-output-wp") 353 | (o2b-test-buffer-with-block 354 | "o2b-test-parse-latex-input" 355 | (let ((org2blog/wp-use-wp-latex t)) 356 | (cdr (assoc "description" (org2blog/wp--export-as-post t)))))))) 357 | #+END_SRC 358 | 359 | *** Data 360 | #+NAME: o2b-test-parse-latex-input 361 | #+BEGIN_SRC org 362 | ,* LaTeX issues 363 | 364 | ,** Superscripts don't work correctly 365 | 366 | $f^{-1}$ 367 | 368 | ,** The equations should be centered 369 | 370 | \[ 371 | \alpha + \beta = \gamma 372 | \] 373 | #+END_SRC 374 | 375 | #+NAME: o2b-test-parse-latex-output-plain 376 | #+BEGIN_SRC html 377 |
378 |

Superscripts don't work correctly

379 |
380 |

\(f^{-1}\)

381 |
382 |
383 | 384 |
385 |

The equations should be centered

386 |
387 |

\[ \alpha + \beta = \gamma \]

388 |
389 |
390 | 391 | #+END_SRC 392 | 393 | #+NAME: o2b-test-parse-latex-output-wp 394 | #+BEGIN_SRC html 395 |
396 |

Superscripts don't work correctly

397 |
398 |

$latex f^{-1}$

399 |
400 |
401 | 402 |
403 |

The equations should be centered

404 |
405 |

$latex \alpha + \beta = \gamma $

406 |
407 |
408 | 409 | #+END_SRC 410 | 411 | ** Source code blocks tests 412 | #+BEGIN_SRC emacs-lisp 413 | (ert-deftest should-post-specific-subtree-with-awk-source () 414 | (should (string-equal 415 | (o2b-test-fetch-src-block "o2b-test-post-awk-source") 416 | (o2b-test-buffer-with-block 417 | "o2b-test-post-awk-source-input" 418 | (let () 419 | (cdr (assoc "description" (org2blog/wp--export-as-post t)))))))) 420 | #+END_SRC 421 | 422 | #+BEGIN_SRC emacs-lisp 423 | (ert-deftest should-post-subtree-with-source-code () 424 | (should (string-equal 425 | (o2b-test-fetch-src-block "o2b-test-source-subtree-error") 426 | (o2b-test-buffer-with-block 427 | "o2b-test-source-subtree-error-input" 428 | (let () 429 | (cdr (assoc "description" (org2blog/wp--export-as-post t)))))))) 430 | #+END_SRC 431 | 432 | #+BEGIN_SRC emacs-lisp 433 | (ert-deftest should-not-confuse-regexp-as-latex () 434 | "Testing if a source block with \[ is treated as LaTeX." 435 | (should (string-equal 436 | (o2b-test-fetch-src-block "o2b-test-regexp-source-becomes-latex") 437 | (o2b-test-buffer-with-block 438 | "o2b-test-regexp-source-becomes-latex-input" 439 | (let () 440 | (cdr (assoc "description" (org2blog/wp--export-as-post nil)))))))) 441 | #+END_SRC 442 | 443 | #+BEGIN_SRC emacs-lisp 444 | (ert-deftest should-not-escape-html-in-wp-src-blocks () 445 | (should (string-equal 446 | (o2b-test-fetch-src-block "o2b-test-greater-than-should-not-be-escaped-output") 447 | (o2b-test-buffer-with-block 448 | "o2b-test-greater-than-should-not-be-escaped" 449 | (let () 450 | (cdr (assoc "description" (org2blog/wp--export-as-post nil)))))))) 451 | #+END_SRC 452 | 453 | #+BEGIN_SRC emacs-lisp 454 | (ert-deftest should-escape-html-in-plain-src-blocks () 455 | (should (string-equal 456 | (o2b-test-fetch-src-block "o2b-test-greater-than-should-be-escaped-plain-output") 457 | (o2b-test-buffer-with-block 458 | "o2b-test-greater-than-should-not-be-escaped" 459 | (let ((org2blog/wp-use-sourcecode-shortcode nil)) 460 | (cdr (assoc "description" (org2blog/wp--export-as-post nil)))))))) 461 | #+END_SRC 462 | 463 | #+BEGIN_SRC emacs-lisp 464 | (ert-deftest should-set-wp-sourcecode-shortcode-attributes () 465 | (should (string-equal 466 | (o2b-test-fetch-src-block "o2b-test-sourcecode-shortcode-attrs-output") 467 | (o2b-test-buffer-with-block 468 | "o2b-test-sourcecode-shortcode-attrs-input" 469 | (let () 470 | (cdr (assoc "description" (org2blog/wp--export-as-post nil)))))))) 471 | #+END_SRC 472 | 473 | #+BEGIN_SRC emacs-lisp 474 | (ert-deftest should-set-correct-language-from-map () 475 | (should (string-equal 476 | (o2b-test-fetch-src-block "o2b-test-post-with-lang-map-output") 477 | (o2b-test-buffer-with-block 478 | "o2b-test-post-with-lang-map-input" 479 | (let ((org2blog/wp-shortcode-langs-map '(("sh" . "bash")))) 480 | (cdr (assoc "description" (org2blog/wp--export-as-post t)))))))) 481 | 482 | #+END_SRC 483 | 484 | *** Data 485 | 486 | #+NAME: o2b-test-post-awk-source-input 487 | #+BEGIN_SRC org 488 | ,* one liner of awk :linux:awk:en: 489 | ,#+begin_src sh 490 | echo "hello:world"| awk -F ":" '{printf("{\"%s\",\"%s\"},\n",$1,$2) }' 491 | ,#+end_src 492 | 493 | #+END_SRC 494 | 495 | #+NAME: o2b-test-post-awk-source 496 | #+BEGIN_SRC html 497 | [sourcecode language="sh" title="" ] 498 | echo "hello:world"| awk -F ":" '{printf("{\"%s\",\"%s\"},\n",$1,$2) }' 499 | [/sourcecode] 500 | 501 | #+END_SRC 502 | 503 | #+NAME: o2b-test-post-with-lang-map-input 504 | #+BEGIN_SRC org 505 | ,* one liner of awk :linux:awk:en: 506 | ,#+begin_src sh 507 | echo "hello:world"| awk -F ":" '{printf("{\"%s\",\"%s\"},\n",$1,$2) }' 508 | ,#+end_src 509 | 510 | #+END_SRC 511 | 512 | #+NAME: o2b-test-post-with-lang-map-output 513 | #+BEGIN_SRC html 514 | [sourcecode language="bash" title="" ] 515 | echo "hello:world"| awk -F ":" '{printf("{\"%s\",\"%s\"},\n",$1,$2) }' 516 | [/sourcecode] 517 | 518 | #+END_SRC 519 | 520 | #+NAME: o2b-test-source-subtree-error-input 521 | #+BEGIN_SRC org 522 | ,* How to use keyboard to navigate feedly.com :en:keysnail:emacs: 523 | :PROPERTIES: 524 | :ID: o2b:efc2e27e-8a71-4950-9b64-ad4aa5269ce9 525 | :POST_DATE: [2013-05-06 一 23:59] 526 | :END: 527 | Here is the detailed steps, 528 | 1. Install [[https://github.com/mooz/keysnail][keysnail]] (a firefox addon) 529 | 2. Install [[https://github.com/mooz/keysnail/wiki/plugin][HoK]] (no less than version 1.3.9) through keysnail 530 | 3. Add below code into .keysnail.js 531 | ,#+BEGIN_SRC javascript 532 | key.setViewKey('e', function (aEvent, aArg) {ext.exec("hok-start-foreground-mode", aArg);}, 'Hok - Foreground hint mode', true); 533 | key.setViewKey('E', function (aEvent, aArg) {ext.exec("hok-start-background-mode", aArg);}, 'HoK - Background hint mode', true); 534 | key.setViewKey(';', function (aEvent, aArg) {ext.exec("hok-start-extended-mode", aArg);}, 'HoK - Extented hint mode', true); 535 | key.setViewKey(['C-c', 'C-e'], function (aEvent, aArg) {ext.exec("hok-start-continuous-mode", aArg);}, 'Start continuous HaH', true); 536 | 537 | hook.addToHook('PluginLoaded', function () { 538 | if (!plugins.hok) 539 | return; 540 | 541 | /* HoK 1.3.9+ requried */ 542 | plugins.hok.pOptions.selector = plugins.hok.pOptions.selector 543 | /* feedly */ 544 | + ", *[data-uri]" 545 | + ", *[data-selector-toggle]" 546 | + ", *[data-page-action]" 547 | + ", *[data-app-action]" 548 | ; 549 | }); 550 | ,#+END_SRC 551 | 4. Restart Firefox, logged into [[http://www.feedly.com]] and press hot key "e" 552 | 5. Enjoy! 553 | #+END_SRC 554 | 555 | #+NAME: o2b-test-source-subtree-error 556 | #+BEGIN_SRC html 557 |

Here is the detailed steps,

558 | 559 |
    560 |
  1. Install keysnail (a firefox addon)
  2. 561 |
  3. Install HoK (no less than version 1.3.9) through keysnail
  4. 562 |
  5. Add below code into .keysnail.js
  6. 563 |
564 | [sourcecode language="javascript" title="" ] 565 | key.setViewKey('e', function (aEvent, aArg) {ext.exec("hok-start-foreground-mode", aArg);}, 'Hok - Foreground hint mode', true); 566 | key.setViewKey('E', function (aEvent, aArg) {ext.exec("hok-start-background-mode", aArg);}, 'HoK - Background hint mode', true); 567 | key.setViewKey(';', function (aEvent, aArg) {ext.exec("hok-start-extended-mode", aArg);}, 'HoK - Extented hint mode', true); 568 | key.setViewKey(['C-c', 'C-e'], function (aEvent, aArg) {ext.exec("hok-start-continuous-mode", aArg);}, 'Start continuous HaH', true); 569 | 570 | hook.addToHook('PluginLoaded', function () { 571 | if (!plugins.hok) 572 | return; 573 | 574 | /* HoK 1.3.9+ requried */ 575 | plugins.hok.pOptions.selector = plugins.hok.pOptions.selector 576 | /* feedly */ 577 | + ", *[data-uri]" 578 | + ", *[data-selector-toggle]" 579 | + ", *[data-page-action]" 580 | + ", *[data-app-action]" 581 | ; 582 | }); 583 | [/sourcecode] 584 |
    585 |
  1. Restart Firefox, logged into http://www.feedly.com/ and press hot key "e"
  2. 586 |
  3. Enjoy!
  4. 587 |
588 | 589 | #+END_SRC 590 | 591 | #+NAME: o2b-test-regexp-source-becomes-latex-input 592 | #+BEGIN_SRC org 593 | ,#+BLOG: test 594 | ,#+POSTID: 127 595 | ,#+DATE: [2013-09-14 Sat 20:14] 596 | ,#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 597 | ,#+CATEGORY: org2blog, emacs 598 | ,#+TAGS: 599 | ,#+DESCRIPTION: 600 | ,#+TITLE: Test source regexp becomes LaTeX 601 | Test source code 602 | ,#+BEGIN_SRC emacs-lisp 603 | (concat "- State \"\\(" (regexp-opt org-done-keywords)"\\)\"\\s-*\\\([^]\n]+\\)\$ "))) 604 | ,#+END_SRC 605 | 606 | #+END_SRC 607 | 608 | #+NAME: o2b-test-regexp-source-becomes-latex 609 | #+BEGIN_SRC html 610 |

Test source code

611 | 612 | [sourcecode language="emacs-lisp" title="" ] 613 | (concat "- State \"\\(" (regexp-opt org-done-keywords)"\\)\"\\s-*\\\([^]\n]+\\)\$ "))) 614 | [/sourcecode] 615 | 616 | #+END_SRC 617 | 618 | #+NAME: o2b-test-greater-than-should-not-be-escaped 619 | #+BEGIN_SRC org 620 | ,#+BLOG: test 621 | ,#+POSTID: 127 622 | ,#+DATE: [2013-09-14 Sat 20:14] 623 | ,#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 624 | ,#+CATEGORY: org2blog, emacs 625 | ,#+TAGS: 626 | ,#+DESCRIPTION: 627 | ,#+TITLE: Test > becomes > 628 | ,#+BEGIN_SRC sh 629 | echo hello > world 630 | ,#+END_SRC 631 | Test source code 632 | #+END_SRC 633 | 634 | #+NAME: o2b-test-greater-than-should-not-be-escaped-output 635 | #+BEGIN_SRC html 636 | [sourcecode language="sh" title="" ] 637 | echo hello > world 638 | [/sourcecode] 639 |

Test source code

640 | 641 | #+END_SRC 642 | 643 | #+NAME: o2b-test-greater-than-should-be-escaped-plain-output 644 | #+BEGIN_SRC html 645 |
646 | 647 |
echo hello > world
648 |   
649 |
650 |

Test source code

651 | 652 | #+END_SRC 653 | 654 | #+NAME: o2b-test-sourcecode-shortcode-attrs-input 655 | #+BEGIN_SRC org 656 | ,* wp sourcecode shortcode attrs :wp: 657 | 658 | ,#+attr_wp: :syntaxhl light="true" 659 | ,#+begin_src sh 660 | echo "hello:world"| awk -F ":" '{printf("{\"%s\",\"%s\"},\n",$1,$2) }' 661 | ,#+end_src 662 | 663 | #+END_SRC 664 | 665 | #+NAME: o2b-test-sourcecode-shortcode-attrs-output 666 | #+BEGIN_SRC html 667 |
668 |

wp sourcecode shortcode attrs

669 |
670 | [sourcecode language="sh" title="" light="true"] 671 | echo "hello:world"| awk -F ":" '{printf("{\"%s\",\"%s\"},\n",$1,$2) }' 672 | [/sourcecode] 673 |
674 |
675 | 676 | #+END_SRC 677 | 678 | ** Login 679 | #+BEGIN_SRC emacs-lisp 680 | (ert-deftest should-login () 681 | (org2blog/wp-login "test") 682 | (should org2blog/wp-logged-in)) 683 | #+END_SRC 684 | 685 | ** Tracking posts 686 | #+BEGIN_SRC emacs-lisp 687 | (ert-deftest should-save-post-details-when-org-directory-doesn-not-exist () 688 | (let* ((org-directory (expand-file-name (make-temp-name temporary-file-directory)))) 689 | (o2b-test-buffer-with-block 690 | "o2b-test-post-awk-source-input" 691 | (let ((post (org2blog/wp--export-as-post t)) 692 | (dashboard (expand-file-name (car org2blog/wp-track-posts) org-directory))) 693 | (org2blog/wp-save-details post "" nil t) 694 | (should (file-exists-p dashboard)) 695 | (should 696 | (with-temp-buffer 697 | (find-file-read-only dashboard) 698 | (search-forward (cdr (assoc "title" post)) nil t nil))))))) 699 | #+END_SRC 700 | ** Post date 701 | #+BEGIN_SRC emacs-lisp 702 | (ert-deftest should-persist-post-date-on-publishing () 703 | (should (string-equal 704 | (org2blog/wp--convert-timestamp-to-iso 705 | "[2013-09-14 Sat 18:29]") 706 | (o2b-test-buffer-with-block 707 | "o2b-test-persist-date" 708 | (cdr (assoc "date" (org2blog/wp--export-as-post nil))))))) 709 | #+END_SRC 710 | 711 | #+BEGIN_SRC emacs-lisp 712 | (ert-deftest should-insert-date-on-publishing () 713 | (o2b-test-buffer-with-block 714 | "o2b-test-insert-date" 715 | (should (string-equal 716 | ;; note: order is important since date is written during parse... 717 | (cdr (assoc "date" (org2blog/wp--export-as-post nil))) 718 | (org2blog/wp--convert-timestamp-to-iso (org2blog/wp-get-option "DATE")))))) 719 | #+END_SRC 720 | 721 | *** Data 722 | #+NAME: o2b-test-persist-date 723 | #+BEGIN_SRC org 724 | ,#+BLOG: test 725 | ,#+POSTID: 121 726 | ,#+DATE: [2013-09-14 Sat 18:29] 727 | ,#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 728 | ,#+CATEGORY: org2blog, emacs 729 | ,#+TAGS: 730 | ,#+DESCRIPTION: 731 | ,#+TITLE: Hello World 732 | ,* Heading 1 733 | Text 734 | 735 | ,** Heading 2 736 | More text 737 | 738 | #+END_SRC 739 | 740 | #+NAME: o2b-test-insert-date 741 | #+BEGIN_SRC org 742 | ,#+BLOG: test 743 | ,#+POSTID: 121 744 | ,#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 745 | ,#+CATEGORY: org2blog, emacs 746 | ,#+TAGS: 747 | ,#+DESCRIPTION: 748 | ,#+TITLE: Hello World 749 | ,* Heading 1 750 | Text 751 | 752 | ,** Heading 2 753 | More text 754 | 755 | #+END_SRC 756 | 757 | ** Posts with images 758 | 759 | #+BEGIN_SRC emacs-lisp 760 | (ert-deftest should-not-republish-images-if-url-line-indented () 761 | (should (equal 762 | 1 763 | (o2b-test-buffer-with-block 764 | "o2b-test-repost-buffer-with-image" 765 | (let ((org2blog/wp-show-post-in-browser nil)) 766 | (org2blog/wp-post-buffer-and-publish) 767 | (let ((updated-post (buffer-string))) 768 | (with-temp-buffer 769 | (insert updated-post) 770 | (goto-char (point-min)) 771 | (count-matches "# ./test-image.png http")))))))) 772 | 773 | #+END_SRC 774 | 775 | #+BEGIN_SRC emacs-lisp 776 | (ert-deftest should-preserve-img-attributes () 777 | (should (and 778 | (let ((output (o2b-test-buffer-with-block 779 | "o2b-test-thumbnails" 780 | (let ((org2blog/wp-show-post-in-browser nil) 781 | (org2blog/wp-image-thumbnails t)) 782 | (cdr (assoc "description" (org2blog/wp--export-as-post nil))))))) 783 | (string-match-p "My fancy value for the alt attribute" output) 784 | (string-match-p "super-stylish" output))))) 785 | 786 | #+END_SRC 787 | 788 | *** Data 789 | #+NAME: o2b-test-repost-buffer-with-image 790 | #+BEGIN_SRC org 791 | ,#+BLOG: test 792 | ,#+POSTID: 10 793 | ,#+DATE: [2014-11-05 Wed 23:21] 794 | ,#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 795 | ,#+CATEGORY: org2blog, emacs 796 | ,#+TAGS: 797 | ,#+DESCRIPTION: 798 | ,#+TITLE: Hello World 799 | 800 | ,* Heading 801 | This is an amazing blog post with an amazing image. 802 | 803 | [[./test-image.png]] 804 | 805 | # ./test-image.png http://testorg2blog.files.wordpress.com/2014/11/wpid-test-image3.png 806 | #+END_SRC 807 | 808 | #+NAME: o2b-test-thumbnails 809 | #+BEGIN_SRC org 810 | ,#+BLOG: test 811 | ,#+POSTID: 10 812 | ,#+DATE: [2014-11-05 Wed 23:21] 813 | ,#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil 814 | ,#+CATEGORY: org2blog, emacs 815 | ,#+TAGS: 816 | ,#+DESCRIPTION: 817 | ,#+TITLE: Hello World 818 | 819 | ,* Heading 820 | This is an amazing blog post with an amazing image. 821 | 822 | ,#+ATTR_HTML: :alt My fancy value for the alt attribute :style super-stylish; 823 | [[./test-image.png]] 824 | 825 | # ./test-image.png http://testorg2blog.files.wordpress.com/2014/11/wpid-test-image3.png 826 | 827 | #+END_SRC 828 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------